Commit Graph

181 Commits

Author SHA1 Message Date
Ryan Boren cc5ed3a485 Change all core API to expect unslashed rather than slashed arguments.
The exceptions to this are update_post_meta() and add_post_meta() which are often used by plugins in POST handlers and will continue accepting slashed data for now.

Introduce wp_upate_post_meta() and wp_add_post_meta() as unslashed alternatives to update_post_meta() and add_post_meta(). These functions could become methods in WP_Post so don't use them too heavily yet.

Remove all escape() calls from wp_xmlrpc_server. Now that core expects unslashed data this is no longer needed.

Remove addslashes(), addslashes_gpc(), add_magic_quotes() calls on data being prepared for handoff to core functions that until now expected slashed data. Adding slashes in no longer necessary.

Introduce wp_unslash() and use to it remove slashes from GPCS data before using it in core API. Almost every instance of stripslashes() in core should now be wp_unslash(). In the future (a release or three) when GPCS is no longer slashed, wp_unslash() will stop stripping slashes and simply return what is passed. At this point wp_unslash() calls can be removed from core.

Introduce wp_slash() for slashing GPCS data. This will also turn into a noop once GPCS is no longer slashed. wp_slash() should almost never be used. It is mainly of use in unit tests.

Plugins should use wp_unslash() on data being passed to core API.

Plugins should no longer slash data being passed to core. So when you get_post() and then wp_insert_post() the post data from get_post() no longer needs addslashes(). Most plugins were not bothering with this. They will magically start doing the right thing. Unfortunately, those few souls who did it properly will now have to avoid calling addslashes() for 3.6 and newer.

Use wp_kses_post() and wp_kses_data(), which expect unslashed data, instead of wp_filter_post_kses() and wp_filter_kses(), which expect slashed data. Filters are no longer passed slashed data.

Remove many no longer necessary calls to $wpdb->escape() and esc_sql().

In wp_get_referer() and wp_get_original_referer(), return unslashed data.

Remove old stripslashes() calls from WP_Widget::update() handlers. These haven't been necessary since WP_Widget.

Switch several queries over to prepare().

Expect something to break.

Props alexkingorg
see #21767


git-svn-id: http://core.svn.wordpress.org/trunk@23416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-14 22:51:06 +00:00
Sergey Biryukov 08269aa6b0 Remove unused error string. props pavelevap. fixes #22107.
git-svn-id: http://core.svn.wordpress.org/trunk@23412 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-14 05:36:28 +00:00
Mark Jaquith 6b6ba31884 Properly wipe capabilities from new site-independent multisite users by using the right key.
props wonderboymusic. fixes #15627

git-svn-id: http://core.svn.wordpress.org/trunk@23307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-18 15:30:55 +00:00
Andrew Nacin 72d8ca4770 Use $current_site->path instead of $base in wpmu_validate_blog_signup(), as $base is now dead. props MarkJaquith. fixes #22787. see #19796.
git-svn-id: http://core.svn.wordpress.org/trunk@23107 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 09:43:52 +00:00
Andrew Nacin 3287c609a1 Make the return of is_upload_space_available() more obvious. props georgestephanis. see #22585.
git-svn-id: http://core.svn.wordpress.org/trunk@22861 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-27 03:42:02 +00:00
Ryan Boren 8dc401468e Make is_upload_space_available() available for front end page loads. Fixes fatal error when calling wp_editor() from the front end.
Props scribu, itworx
fixes #22585


git-svn-id: http://core.svn.wordpress.org/trunk@22840 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-26 14:42:43 +00:00
Peter Westwood b2ca616d1e Multisite: Move all the functions which calculate upload space usage to wp-includes so they apply correctly with front-end editors.
Fixes #22357 props wonderboymusic.


git-svn-id: http://core.svn.wordpress.org/trunk@22497 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 10:35:42 +00:00
Andrew Nacin 1d312da957 Fix the matching in is_email_address_unsafe(), which was too aggressive.
We should only check to see if the user's email address has the same
domain as or is a subdomain of any banned email domain.

Add a filter.

props mdawaffe.
fixes #21570.



git-svn-id: http://core.svn.wordpress.org/trunk@22461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-08 01:06:17 +00:00
Andrew Nacin dc40f18228 Merge some strings. props pavelevap. fixes #22306.
git-svn-id: http://core.svn.wordpress.org/trunk@22430 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 19:37:54 +00:00
Andrew Nacin 3a86c87c31 Remove single-argument calls to wpdb:prepare(), which are invalid as nothing is being prepared. see #22262.
git-svn-id: http://core.svn.wordpress.org/trunk@22428 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 19:28:08 +00:00
Ryan Boren 04a1ea0b39 Consolidate some transalted strings. Remove unnecessary trailing newlines. Props pavelevap. fixes #22274
git-svn-id: http://core.svn.wordpress.org/trunk@22308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-25 22:21:15 +00:00
Peter Westwood d30f0445e8 i18n: Fix the usage of sprintf replacements in the Multisite include files. See #22260.
git-svn-id: http://core.svn.wordpress.org/trunk@22270 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-23 11:27:20 +00:00
Ryan Boren 51920e1858 Consolidate some strings. Props pavelevap, SergeyBiryukov. see #21728
git-svn-id: http://core.svn.wordpress.org/trunk@22124 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-05 19:04:34 +00:00
Andrew Nacin 61e0dc0122 Use 2 * DAY_IN_SECONDS rather than 172800. props pavelevap. fixes #20987.
git-svn-id: http://core.svn.wordpress.org/trunk@22121 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-05 13:11:16 +00:00
Ryan Boren 9fc9d42d0a * Register blog-id-cache group as global
* Introduce clean_blog_cache() so we can run it independently of refresh_blog_details() which assumes the blog still exists and get_blog_details() can be called.
* Don't db escape cache keys in get_blog_id_from_url()
* prepare() the query in get_blog_id_from_url()
* Return 0 for all failures in get_blog_id_from_url()
* clean_blog_cache() after dropping tables in wpmu_delete_blog() to make sure the cache is for real cleaned.



git-svn-id: http://core.svn.wordpress.org/trunk@22092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-01 18:03:23 +00:00
Ryan Boren 115d53941b Add domain_exists filter. Props jamescollins. fixes #21142
git-svn-id: http://core.svn.wordpress.org/trunk@22065 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-27 17:30:34 +00:00
Andrew Nacin 557d9313a7 Introduce constants to allow for easier expression of time periods in seconds. Adds MINUTE_IN_SECONDS, HOUR_IN_SECONDS, DAY_IN_SECONDS, WEEK_IN_SECONDS, YEAR_IN_SECONDS. props nbachiyski, SergeyBiryukov. fixes #20987.
git-svn-id: http://core.svn.wordpress.org/trunk@21996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-25 05:26:19 +00:00
Ryan Boren 1513f1daea Suppress db errors when checking if the blog is already installed in install_blog(). Use DESCRIBE instead of SELECT. Props bpetty. fixes #21922
git-svn-id: http://core.svn.wordpress.org/trunk@21924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-20 13:39:46 +00:00
Andrew Nacin 7ae797b119 Pass the user parameter to the wpmu_validate_blog_signup filter and wpmu_validate_blog_signup()'s return array. props BrianLayman. fixes #17306.
git-svn-id: http://core.svn.wordpress.org/trunk@21860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-15 20:05:58 +00:00
Andrew Nacin 923b3e8e0e Pass current network ID to domain_exists() in wpmu_validate_blog_signup(). props larysa, fixes #17303.
git-svn-id: http://core.svn.wordpress.org/trunk@21853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-15 19:29:59 +00:00
Andrew Nacin dc49f24a6c Remove ms-files.php rewriting from WordPress multisite. fixes #19235.
Keep existing networks compatible with a ms_files_rewriting network option.



git-svn-id: http://core.svn.wordpress.org/trunk@21823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-11 22:22:20 +00:00
Ryan Boren c55cf716da Use set_url_scheme(). Props johnbillion, MarcusPope. see #19037 #20759
git-svn-id: http://core.svn.wordpress.org/trunk@21664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-30 13:33:00 +00:00
Ryan Boren 2ea0626e5d Use switch_to_blog()/restore_current_blog() in get_blog_post() and get_blog_permalink(). Eliminate the duplicate caching in these functions. Return WP_Post from get_blog_post(). Update phpdoc. Remove global-posts cache invalidation. Props jondavidjohn fixes #21595
git-svn-id: http://core.svn.wordpress.org/trunk@21628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-27 16:22:45 +00:00
nacin 7127ed1197 Move most instances of new WP_User to get_userdata(). see #21120.
git-svn-id: http://core.svn.wordpress.org/trunk@21413 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-03 01:06:05 +00:00
westi 4443baaab9 Multisite: Rework the upload space usage tracking code so as to be fully pluggable.
* Moves some admin only functions into wp-admin/includes/ms.php from wp-includes/ms-functions.php
 * Reworked the variable naming to be more in line with the Coding Standards
 * Introduced a new get_space_used() function instead of calculating it in multiple places.

Fixes #21181 props dllh and jkudish for inital work on this.


git-svn-id: http://core.svn.wordpress.org/trunk@21387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-01 13:52:06 +00:00
markjaquith 3b46a53530 Do not block XML-RPC uploads when upload_space_check_disabled is true, regardless of fileupload_maxk value. props SergeyBiryukov. fixes #16217
git-svn-id: http://core.svn.wordpress.org/trunk@21237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-07-09 03:49:23 +00:00
nacin b28de3ea1b install_blog() should not be polluting the siteurl and home options with the trailing slash that comes from get_blogaddress_by_id().
git-svn-id: http://core.svn.wordpress.org/trunk@21172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-28 20:38:16 +00:00
ryan 30e6bb654d Rolling upgrade to set the welcome_user_email network-wide option via the welcome_user_msg_filter() callback. Fixes ability to save the welcome user email when no entry exists in the database. see #20116
git-svn-id: http://core.svn.wordpress.org/trunk@20697 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-02 20:31:37 +00:00
nacin c68f8c46f0 Use maybe_serialize() where appropriate. fixes #19617.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-27 15:57:51 +00:00
ryan 80eb4cbe9b Add terminal punctuation to some signup error messages. Props dllh. fixes #20332
git-svn-id: http://svn.automattic.com/wordpress/trunk@20441 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-11 20:41:59 +00:00
ryan de41bc288b Introduce WP_User::exists(). see #20372
git-svn-id: http://svn.automattic.com/wordpress/trunk@20378 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-06 19:18:45 +00:00
nacin 0730535015 Introduce $wpdb->delete(). props justindgivens, scribu. fixes #18948.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-24 15:24:31 +00:00
nacin ae113fba5e Pass WP_User object to the newuser_notify_siteadmin filter. props boonebgorges. fixes #20162.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20101 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-02 23:52:19 +00:00
nacin 86596214bd Simplify matching code. see #19670.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-07 17:44:29 +00:00
ryan 1438d03330 Fix notices. Simplify checkbox logic. Props SergeyBiryukov. fixes #19670
git-svn-id: http://svn.automattic.com/wordpress/trunk@19850 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-02-07 17:12:46 +00:00
duck_ e1068113ac Remove redundant logic from filter_SSL(). Props deltafactory. Fixes #19899.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-26 09:21:44 +00:00
nacin b96deccca8 Use get_blog_prefix() in another MU function. see #19891.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19749 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-25 00:10:46 +00:00
nacin b925695170 Use get_blog_prefix() in get_most_recent_post_of_user(). see #19891.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-25 00:09:30 +00:00
nacin 18804349bb Remove copy-pasted comment from upload_is_user_over_quota()'s phpdoc. It came from recurse_dirsize(). see #19879.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-24 23:54:24 +00:00
ryan e3b46b25d3 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: http://svn.automattic.com/wordpress/trunk@19712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-08 17:01:11 +00:00
duck_ 34b7010df8 Fix some mismatching parameter documentation. Props akshayagarwal, linuxologos. See #19756.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-06 11:42:00 +00:00
ryan aa8a3f89d8 Use home_url() instead of site_url(). Props johnbillion. fixes #18293
git-svn-id: http://svn.automattic.com/wordpress/trunk@19674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-04 19:29:03 +00:00
ryan 07ff8b216b Use one space, not two, after trailing punctuation. fixes #19537
git-svn-id: http://svn.automattic.com/wordpress/trunk@19593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-13 23:45:31 +00:00
nacin cc50764a8b They call me multisite. props ryan, zeo. see #19020.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-01 00:36:19 +00:00
nacin 56d46a1fe1 Send $user_id to is_super_admin() when checking to set primary_blog for a user in wpmu_create_blog(). see #19127.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-05 20:23:55 +00:00
ryan b957c72f9a Turn is_blog_user() into a wrapper around is_user_member_of_blog() and deprecate. Make user_id optional for is_user_member_of_blog(). Props SergeyBiryukov. fixes #16702
git-svn-id: http://svn.automattic.com/wordpress/trunk@19016 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-19 22:35:15 +00:00
ryan a0f6c4469d Introduce wp_get_db_schema() for rerieving the various flavors of the WP db schema. Eliminates need to use global. Allows multiple calls to wpmu_create_blog(). see #12028
git-svn-id: http://svn.automattic.com/wordpress/trunk@18899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-06 00:21:24 +00:00
markjaquith 37e23be4ed Be more consistent with ERROR: messages. fixes #15887
git-svn-id: http://svn.automattic.com/wordpress/trunk@18841 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-30 17:18:35 +00:00
ryan 6febc018a9 Deprecate wpmu_admin_redirect_add_updated_param() and wpmu_admin_do_redirect(). Props SergeyBiryukov. fixes #18619
git-svn-id: http://svn.automattic.com/wordpress/trunk@18834 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-30 15:13:13 +00:00
nacin 6edb31db27 Ensure we have a full blog object in get_active_blog_for_user(). fixes #18789.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-27 07:36:36 +00:00