Commit Graph

185 Commits

Author SHA1 Message Date
Andrew Nacin 5114e85747 In insert_blog(), make sure we retrieve the insertion ID from wpdb before calling a function that could invoke queries. props feedmeastraycat. fixes #23400.
git-svn-id: https://develop.svn.wordpress.org/trunk@23511 602fd350-edb4-49c9-b593-d223f7449a82
2013-02-28 16:53:48 +00:00
Andrew Nacin aedda3210c Deprecate get_user_id_from_string() in favor of get_user_by( $field ) where $field is 'email' or 'login'. props SergeyBiryukov. fixes #23190.
git-svn-id: https://develop.svn.wordpress.org/trunk@23438 602fd350-edb4-49c9-b593-d223f7449a82
2013-02-16 03:02:15 +00:00
Sergey Biryukov 8eebc4d4ff Use wp_get_current_user(). props nacin. see #23192.
git-svn-id: https://develop.svn.wordpress.org/trunk@23432 602fd350-edb4-49c9-b593-d223f7449a82
2013-02-15 18:13:18 +00:00
Sergey Biryukov 79df86b818 Replace get_user_id_from_string() with get_user_by(). props ocean90, bananastalktome. fixes #23192. see #23190.
git-svn-id: https://develop.svn.wordpress.org/trunk@23431 602fd350-edb4-49c9-b593-d223f7449a82
2013-02-15 18:00:52 +00:00
Ryan Boren a6c8efadb9 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: https://develop.svn.wordpress.org/trunk@23416 602fd350-edb4-49c9-b593-d223f7449a82
2013-02-14 22:51:06 +00:00
Sergey Biryukov 74f5d9dcb3 Remove unused error string. props pavelevap. fixes #22107.
git-svn-id: https://develop.svn.wordpress.org/trunk@23412 602fd350-edb4-49c9-b593-d223f7449a82
2013-02-14 05:36:28 +00:00
Mark Jaquith df47c013ec Properly wipe capabilities from new site-independent multisite users by using the right key.
props wonderboymusic. fixes #15627

git-svn-id: https://develop.svn.wordpress.org/trunk@23307 602fd350-edb4-49c9-b593-d223f7449a82
2013-01-18 15:30:55 +00:00
Andrew Nacin 2583123273 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: https://develop.svn.wordpress.org/trunk@23107 602fd350-edb4-49c9-b593-d223f7449a82
2012-12-06 09:43:52 +00:00
Andrew Nacin f7b3d1a854 Make the return of is_upload_space_available() more obvious. props georgestephanis. see #22585.
git-svn-id: https://develop.svn.wordpress.org/trunk@22861 602fd350-edb4-49c9-b593-d223f7449a82
2012-11-27 03:42:02 +00:00
Ryan Boren 8bf86e30f7 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: https://develop.svn.wordpress.org/trunk@22840 602fd350-edb4-49c9-b593-d223f7449a82
2012-11-26 14:42:43 +00:00
Peter Westwood c6c233cc2c 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: https://develop.svn.wordpress.org/trunk@22497 602fd350-edb4-49c9-b593-d223f7449a82
2012-11-09 10:35:42 +00:00
Andrew Nacin b7e9155e33 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: https://develop.svn.wordpress.org/trunk@22461 602fd350-edb4-49c9-b593-d223f7449a82
2012-11-08 01:06:17 +00:00
Andrew Nacin 496ae7b83f Merge some strings. props pavelevap. fixes #22306.
git-svn-id: https://develop.svn.wordpress.org/trunk@22430 602fd350-edb4-49c9-b593-d223f7449a82
2012-11-07 19:37:54 +00:00
Andrew Nacin d34180efc2 Remove single-argument calls to wpdb:prepare(), which are invalid as nothing is being prepared. see #22262.
git-svn-id: https://develop.svn.wordpress.org/trunk@22428 602fd350-edb4-49c9-b593-d223f7449a82
2012-11-07 19:28:08 +00:00
Ryan Boren fd8eeb4b8a Consolidate some transalted strings. Remove unnecessary trailing newlines. Props pavelevap. fixes #22274
git-svn-id: https://develop.svn.wordpress.org/trunk@22308 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-25 22:21:15 +00:00
Peter Westwood 44682216a8 i18n: Fix the usage of sprintf replacements in the Multisite include files. See #22260.
git-svn-id: https://develop.svn.wordpress.org/trunk@22270 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-23 11:27:20 +00:00
Ryan Boren 8d5ca186c2 Consolidate some strings. Props pavelevap, SergeyBiryukov. see #21728
git-svn-id: https://develop.svn.wordpress.org/trunk@22124 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-05 19:04:34 +00:00
Andrew Nacin e5c363a8ff Use 2 * DAY_IN_SECONDS rather than 172800. props pavelevap. fixes #20987.
git-svn-id: https://develop.svn.wordpress.org/trunk@22121 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-05 13:11:16 +00:00
Ryan Boren 42cfdfb614 * 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: https://develop.svn.wordpress.org/trunk@22092 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-01 18:03:23 +00:00
Ryan Boren 1ee0534f98 Add domain_exists filter. Props jamescollins. fixes #21142
git-svn-id: https://develop.svn.wordpress.org/trunk@22065 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-27 17:30:34 +00:00
Andrew Nacin 774a12be83 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: https://develop.svn.wordpress.org/trunk@21996 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-25 05:26:19 +00:00
Ryan Boren 097c2c0e90 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: https://develop.svn.wordpress.org/trunk@21924 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-20 13:39:46 +00:00
Andrew Nacin 9da4708e6d 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: https://develop.svn.wordpress.org/trunk@21860 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-15 20:05:58 +00:00
Andrew Nacin 0b2a08728b Pass current network ID to domain_exists() in wpmu_validate_blog_signup(). props larysa, fixes #17303.
git-svn-id: https://develop.svn.wordpress.org/trunk@21853 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-15 19:29:59 +00:00
Andrew Nacin 7f29924c6a Remove ms-files.php rewriting from WordPress multisite. fixes #19235.
Keep existing networks compatible with a ms_files_rewriting network option.



git-svn-id: https://develop.svn.wordpress.org/trunk@21823 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-11 22:22:20 +00:00
Ryan Boren 92ea34f6a2 Use set_url_scheme(). Props johnbillion, MarcusPope. see #19037 #20759
git-svn-id: https://develop.svn.wordpress.org/trunk@21664 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-30 13:33:00 +00:00
Ryan Boren a94b94504a 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: https://develop.svn.wordpress.org/trunk@21628 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-27 16:22:45 +00:00
Andrew Nacin a5c7405975 Move most instances of new WP_User to get_userdata(). see #21120.
git-svn-id: https://develop.svn.wordpress.org/trunk@21413 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-03 01:06:05 +00:00
Peter Westwood 61abf077d0 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: https://develop.svn.wordpress.org/trunk@21387 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-01 13:52:06 +00:00
Mark Jaquith 0290c34cee 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: https://develop.svn.wordpress.org/trunk@21237 602fd350-edb4-49c9-b593-d223f7449a82
2012-07-09 03:49:23 +00:00
Andrew Nacin 309ae4c917 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: https://develop.svn.wordpress.org/trunk@21172 602fd350-edb4-49c9-b593-d223f7449a82
2012-06-28 20:38:16 +00:00
Ryan Boren 1f3ca85ab5 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: https://develop.svn.wordpress.org/trunk@20697 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-02 20:31:37 +00:00
Andrew Nacin 07fce717e7 Use maybe_serialize() where appropriate. fixes #19617.
git-svn-id: https://develop.svn.wordpress.org/trunk@20612 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-27 15:57:51 +00:00
Ryan Boren beb1d196b3 Add terminal punctuation to some signup error messages. Props dllh. fixes #20332
git-svn-id: https://develop.svn.wordpress.org/trunk@20441 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-11 20:41:59 +00:00
Ryan Boren 6f9ceb2326 Introduce WP_User::exists(). see #20372
git-svn-id: https://develop.svn.wordpress.org/trunk@20378 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-06 19:18:45 +00:00
Andrew Nacin 54a6a40533 Introduce $wpdb->delete(). props justindgivens, scribu. fixes #18948.
git-svn-id: https://develop.svn.wordpress.org/trunk@20287 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-24 15:24:31 +00:00
Andrew Nacin df490f0ec5 Pass WP_User object to the newuser_notify_siteadmin filter. props boonebgorges. fixes #20162.
git-svn-id: https://develop.svn.wordpress.org/trunk@20101 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-02 23:52:19 +00:00
Andrew Nacin 7391c909df Simplify matching code. see #19670.
git-svn-id: https://develop.svn.wordpress.org/trunk@19852 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-07 17:44:29 +00:00
Ryan Boren b495757102 Fix notices. Simplify checkbox logic. Props SergeyBiryukov. fixes #19670
git-svn-id: https://develop.svn.wordpress.org/trunk@19850 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-07 17:12:46 +00:00
Jon Cave c67d273f1f Remove redundant logic from filter_SSL(). Props deltafactory. Fixes #19899.
git-svn-id: https://develop.svn.wordpress.org/trunk@19759 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-26 09:21:44 +00:00
Andrew Nacin c647c3494d Use get_blog_prefix() in another MU function. see #19891.
git-svn-id: https://develop.svn.wordpress.org/trunk@19749 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-25 00:10:46 +00:00
Andrew Nacin 844dd38b8f Use get_blog_prefix() in get_most_recent_post_of_user(). see #19891.
git-svn-id: https://develop.svn.wordpress.org/trunk@19748 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-25 00:09:30 +00:00
Andrew Nacin c8b1c822ce Remove copy-pasted comment from upload_is_user_over_quota()'s phpdoc. It came from recurse_dirsize(). see #19879.
git-svn-id: https://develop.svn.wordpress.org/trunk@19747 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-24 23:54:24 +00:00
Ryan Boren 2b186b0c45 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: https://develop.svn.wordpress.org/trunk@19712 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-08 17:01:11 +00:00
Jon Cave 2cc75b6a05 Fix some mismatching parameter documentation. Props akshayagarwal, linuxologos. See #19756.
git-svn-id: https://develop.svn.wordpress.org/trunk@19695 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-06 11:42:00 +00:00
Ryan Boren f6b0e7e580 Use home_url() instead of site_url(). Props johnbillion. fixes #18293
git-svn-id: https://develop.svn.wordpress.org/trunk@19674 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-04 19:29:03 +00:00
Ryan Boren 676ba7043e Use one space, not two, after trailing punctuation. fixes #19537
git-svn-id: https://develop.svn.wordpress.org/trunk@19593 602fd350-edb4-49c9-b593-d223f7449a82
2011-12-13 23:45:31 +00:00
Andrew Nacin 69a34ae62d They call me multisite. props ryan, zeo. see #19020.
git-svn-id: https://develop.svn.wordpress.org/trunk@19504 602fd350-edb4-49c9-b593-d223f7449a82
2011-12-01 00:36:19 +00:00
Andrew Nacin 2ae685c4c2 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: https://develop.svn.wordpress.org/trunk@19182 602fd350-edb4-49c9-b593-d223f7449a82
2011-11-05 20:23:55 +00:00
Ryan Boren 2c83b5728f 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: https://develop.svn.wordpress.org/trunk@19016 602fd350-edb4-49c9-b593-d223f7449a82
2011-10-19 22:35:15 +00:00