Commit Graph

302 Commits

Author SHA1 Message Date
Andrew Nacin 8bea3243c9 Do not notify the post author about comments if they are no longer a member of the blog.
This updates [23294] to use capability checks to determine if the user can still edit a post, which works for super admins. Additionally, it hides Trash/Spam action links when the user is still a member of the blog but cannot (or can no longer) moderate the comment.

fixes #23136.



git-svn-id: https://develop.svn.wordpress.org/trunk@24649 602fd350-edb4-49c9-b593-d223f7449a82
2013-07-10 22:01:12 +00:00
Sergey Biryukov 21704cfdc0 Make wp_mail() return the actual result of PHPMailer::Send() instead of always returning true. props chmac. fixes #23642.
git-svn-id: https://develop.svn.wordpress.org/trunk@24530 602fd350-edb4-49c9-b593-d223f7449a82
2013-06-29 23:03:13 +00:00
Andrew Nacin 626e77ec3b Add strict check to wp_verify_nonce() to avoid issues when it is improperly called.
git-svn-id: https://develop.svn.wordpress.org/trunk@24461 602fd350-edb4-49c9-b593-d223f7449a82
2013-06-21 02:11:31 +00:00
Peter Westwood d160c66498 Pluggable Auth: When setting new passwords for users trim any leading or trailing space to match what we do when we test passwords.
Fixes #23494


git-svn-id: https://develop.svn.wordpress.org/trunk@23814 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-27 14:15:13 +00:00
Mark Jaquith 58476bf203 Minor revisions PHP reorg, code cleanup, restores _post_restored_from functionality.
props adamsilverstein. see #23497

git-svn-id: https://develop.svn.wordpress.org/trunk@23811 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-27 11:56:28 +00:00
Peter Westwood ae03f1a0b6 Revisions: UI Update.
* Refines the UI to make it clearer and easier to use
* Introduces weighted tickmarks
* Fixes comparison bugs.

See #23497 props adamsilverstein


git-svn-id: https://develop.svn.wordpress.org/trunk@23769 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-21 15:54:11 +00:00
Peter Westwood ae4522b5f1 Revisions: Updates to the new Revisions UI.
Various Updates including:
 * i18n fixes
 * Added tracking of what revision ID was restored
 * async fetching of diffs so that slider works sooner even with many revisions

See #23497 props adamsilverstein, ethitter


git-svn-id: https://develop.svn.wordpress.org/trunk@23639 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-07 15:32:26 +00:00
Ryan Boren c61b68d896 Remove unnecessary stripslashes().
see #21767


git-svn-id: https://develop.svn.wordpress.org/trunk@23593 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-03 20:55:30 +00:00
Ryan Boren c363aea627 Revert 23416, 23419, 23445 except for wp_reset_vars() changes. We are going a different direction with the slashing cleanup, so resetting to a clean slate. see #21767
git-svn-id: https://develop.svn.wordpress.org/trunk@23554 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-01 16:28:40 +00:00
Peter Westwood 554627a0d5 Revisions: First pass an implementing a new UI/UX for reviewing the revisions of posts. See #23497 props adamsilverstein for the initial patch.
This implements a new revisions ui using Backbone and preserves all the old methods of "integration" so the change should be transparent to plugins using revisi
ons with CPTs.

This is the first pass and so there are a number of things still to be resolved, more details in the ticket. Feedback welcomed.


git-svn-id: https://develop.svn.wordpress.org/trunk@23506 602fd350-edb4-49c9-b593-d223f7449a82
2013-02-28 15:14:34 +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 12fcb94781 Use a human-readable constant in wp_set_auth_cookie(). fixes #23372.
git-svn-id: https://develop.svn.wordpress.org/trunk@23388 602fd350-edb4-49c9-b593-d223f7449a82
2013-02-06 03:44:43 +00:00
Mark Jaquith 22b416ef72 Do not notify the post author about comments if they are no longer a member of the blog. props nickmomrick. fixes #23136
git-svn-id: https://develop.svn.wordpress.org/trunk@23294 602fd350-edb4-49c9-b593-d223f7449a82
2013-01-08 04:03:16 +00:00
Mark Jaquith 654154ad89 Move 'endif;' to its own line instead of having it room with a right curly brace. props dimadin. fixes #22586
git-svn-id: https://develop.svn.wordpress.org/trunk@23228 602fd350-edb4-49c9-b593-d223f7449a82
2012-12-29 18:01:41 +00:00
Andrew Nacin 92d7e9db15 Pass 'blank' to Gravatar rather than sending blank.gif for Gravatar to proxy. props miqrogroove, fixes #22354.
git-svn-id: https://develop.svn.wordpress.org/trunk@22566 602fd350-edb4-49c9-b593-d223f7449a82
2012-11-14 05:29:56 +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
Andrew Nacin 8aee69730b It is 'Alternative Text', not 'Alternate Text'. props alecrust, RyanJKoehler. fixes #21176.
git-svn-id: https://develop.svn.wordpress.org/trunk@21917 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-19 16:55:43 +00:00
Andrew Nacin b4fa70c19c Add nonce_user_logged_out filters to wp_create_nonce() and wp_verify_nonce() for when there is no user ID. Provides plugins the ability to tie a nonce to some other characteristic of the session. props sc0ttkclark, fixes #21111.
git-svn-id: https://develop.svn.wordpress.org/trunk@21837 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-13 17:17:47 +00:00
Peter Westwood da2f11a8b8 Make sure that we always generate random numbers correctly even if the PHP build is slightly broken and truncates large integers.
Fixes #19571 props mdawaffe.


git-svn-id: https://develop.svn.wordpress.org/trunk@21685 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-31 09:45:50 +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
Andrew Nacin d41d58d128 Move the optimization done to get_user_by() in [21376] higher up the stack, into map_meta_cap() and is_super_admin().
This provides nearly the same benefits without possibly receiving a stale object from get_userdata(),
which could affect authentication, and introduce side effects for plugins.

see #21120.



git-svn-id: https://develop.svn.wordpress.org/trunk@21563 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-20 21:58:34 +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
Andrew Nacin 2c058d3b3a Optimize get_user_by( 'id', $id ) to return wp_get_current_user() when the current user ID is requested.
Provides for a major performance improvement by preventing repeated instantiations of WP_User in the capabilities API.

see #21120.



git-svn-id: https://develop.svn.wordpress.org/trunk@21376 602fd350-edb4-49c9-b593-d223f7449a82
2012-07-31 17:45:38 +00:00
Andrew Nacin c4f902f4c0 Remove $wp_secret_key_default.
With the duplicate key checks, this is isn't necessary. It could also cause problems when you
temporarily update to an English translation of a new version before going back to the locale.

see #19599.



git-svn-id: https://develop.svn.wordpress.org/trunk@20691 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-02 19:29:39 +00:00
Jon Cave 5b863a766b Add missing "?" to gravatar_default URL in get_avatar() to set size parameter correctly. Fixes #20512.
git-svn-id: https://develop.svn.wordpress.org/trunk@20563 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-22 11:45:31 +00:00
Jon Cave c3a7874f33 Don't override the $current_user global in get_currentuserinfo() on an XML-RPC request
if it's non-empty. Fixes capabilities checks for XML-RPC requests. See #20372.


git-svn-id: https://develop.svn.wordpress.org/trunk@20424 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-10 16:19:53 +00:00
Ryan Boren 781f632a82 When fetching the user in get_currentuserinfo(), make sure it is a valid WP_User object. If it is stdClass, upgrade it to WP_User. If it is WP_Error, an int, or anything else, set the current user to ID 0.
In wp_set_current_user(), return the current user global only if it is a WP_User object. If it is not, fall through and go about setting it up properly.

Formatting cleanups for both functions.

see #20372


git-svn-id: https://develop.svn.wordpress.org/trunk@20410 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-09 22:01:07 +00:00
Andrew Nacin 0a352eed01 wp_set_current_user(0) for XMLRPC_REQUEST in get_currentuserinfo(). Ensures that wp_get_current_user() always returns a WP_User object. see #20372.
git-svn-id: https://develop.svn.wordpress.org/trunk@20402 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-08 01:06:44 +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 555970c950 Internally cache return values of wp_salt(). Always run the filter. Big performance gains on a pageload that generates hundreds of nonces. see #19599.
git-svn-id: https://develop.svn.wordpress.org/trunk@20135 602fd350-edb4-49c9-b593-d223f7449a82
2012-03-07 03:41:56 +00:00
Ryan Boren 021c55798e Split the main WP_Query posts query into two queries to avoid temp tables. Leverage cache to avoid second query in persistent cache environments. Props scribu, cheald, prettyboymp. see #18536
git-svn-id: https://develop.svn.wordpress.org/trunk@19918 602fd350-edb4-49c9-b593-d223f7449a82
2012-02-14 15:09:35 +00:00
Andrew Nacin 25eac276df Re-purpose wp_die() for ajax responses.
* Allows unit testing of core ajax actions.
 * wp_die() now has separate filters to choose a handler depending on the context (ajax, XML-RPC, else).
 * wp_die) in ajax context does not need to be called with a string. Conversion takes place before die().
props kurtpayne, see #15327.



git-svn-id: https://develop.svn.wordpress.org/trunk@19801 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-31 22:12:58 +00:00
Andrew Nacin 30889de384 Provide a DB fallback for keys in wp_salt(). Fall back when any secret is used more than once. Change how we detect a localized 'put your unique phrase here' -- eliminate $wp_default_secret_key and introduce $wp_secret_key_default to be added during the localized build process, not by translators. fixes #19599.
git-svn-id: https://develop.svn.wordpress.org/trunk@19771 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-27 18:52:20 +00:00
Jon Cave 156048ca52 split was deprecated in PHP 5.3.0, so use explode instead. Props garyc40. Fixes #16325.
git-svn-id: https://develop.svn.wordpress.org/trunk@19726 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-09 21:20:51 +00:00
Ryan Boren 55d6e7e261 Update wp_salt() phpdoc. fixes #18696
git-svn-id: https://develop.svn.wordpress.org/trunk@19725 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-09 20:52:08 +00:00
Ryan Boren a8d77cbae9 User lowercase true, false, null instead of uppercase. Props c3mdigital, mfields. fixes #16302
git-svn-id: https://develop.svn.wordpress.org/trunk@19687 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-05 20:50:54 +00:00
Andrew Nacin 242f736374 s/is/if/. props ocean90.
git-svn-id: https://develop.svn.wordpress.org/trunk@19616 602fd350-edb4-49c9-b593-d223f7449a82
2011-12-20 22:06:34 +00:00
Andrew Nacin 483f3fd886 Gravatar emails should be trimmed before being lowered and hashed. props evansolomon. fixes #19614.
git-svn-id: https://develop.svn.wordpress.org/trunk@19614 602fd350-edb4-49c9-b593-d223f7449a82
2011-12-20 22:00:44 +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
Jon Cave 939b085f54 Correct @param text ordering to put "Optional." in description, see r19019 and #18958. Also remove empty docblock tag.
git-svn-id: https://develop.svn.wordpress.org/trunk@19030 602fd350-edb4-49c9-b593-d223f7449a82
2011-10-20 15:53:57 +00:00
Peter Westwood d01e2af94b Improve the parsing of email addresses in wp_mail to re-support RFC2822 nameless "<address@tld.com>" style. Fixes #18463 props kitchin and SergeyBiryukov.
git-svn-id: https://develop.svn.wordpress.org/trunk@18717 602fd350-edb4-49c9-b593-d223f7449a82
2011-09-19 14:30:50 +00:00
Jon Cave 82c0f09c09 Fix typos in documentation (wp-includes/[i-z]). See #18560.
git-svn-id: https://develop.svn.wordpress.org/trunk@18639 602fd350-edb4-49c9-b593-d223f7449a82
2011-09-05 19:08:15 +00:00
Ryan Boren 1d3e616495 Introduce metadata_exists(), WP_User::get_data_by(), WP_User::get(), WP_User::has_prop(). Don't fill user objects with meta. Eliminate data duplication in cache and memory. Props scribu. see #15458
git-svn-id: https://develop.svn.wordpress.org/trunk@18597 602fd350-edb4-49c9-b593-d223f7449a82
2011-08-24 19:32:59 +00:00
Dion Hulse 395a623c52 Harden up is_user_logged_in() against empty $current_user instances to prevent PHP Notices on XML-RPC requests. Fixes #18458
git-svn-id: https://develop.svn.wordpress.org/trunk@18558 602fd350-edb4-49c9-b593-d223f7449a82
2011-08-17 08:51:36 +00:00
Ryan Boren eda7d43e85 Deprecate get_userdatabylogin() and get_user_by_email(). Props scribu. fixes #18333
git-svn-id: https://develop.svn.wordpress.org/trunk@18513 602fd350-edb4-49c9-b593-d223f7449a82
2011-08-05 16:57:31 +00:00
Ryan Boren 8eea785bcb Add magic get/set/isset methods to WP_User to avoid data duplication. Standardize on WP_User::ID. Props scribu. see #15458
git-svn-id: https://develop.svn.wordpress.org/trunk@18504 602fd350-edb4-49c9-b593-d223f7449a82
2011-08-04 03:09:27 +00:00
Mark Jaquith 46a87bd9fa Throw _doing_it_wrong() when nonce action not passed to check_admin_referer(). props duck_. see #16449
git-svn-id: https://develop.svn.wordpress.org/trunk@18195 602fd350-edb4-49c9-b593-d223f7449a82
2011-06-08 16:56:26 +00:00
Peter Westwood 526f6fe677 Update wp_mail to correctly call the Address adding functions on PHPMailer for To, CC, BCC in a way which preserves our support for full RFC2822 address specifications.
Older versions of PHPMailer were not too careful about validating what we passed in to them as a plain email address - the new version expects we pass in the Name and Email address seperately.
Fixes #17305 based on a patch from dllh.

git-svn-id: https://develop.svn.wordpress.org/trunk@18006 602fd350-edb4-49c9-b593-d223f7449a82
2011-05-23 11:14:05 +00:00
Ryan Boren dbf64808b9 Use exceptions with phpmailer to avoid headers already sent errors. fixes #17228
git-svn-id: https://develop.svn.wordpress.org/trunk@17753 602fd350-edb4-49c9-b593-d223f7449a82
2011-04-28 18:16:01 +00:00
Ryan Boren 71eeebc9bc Remove setcookie() back compat. Props hakre. see#16920
git-svn-id: https://develop.svn.wordpress.org/trunk@17612 602fd350-edb4-49c9-b593-d223f7449a82
2011-04-06 17:07:59 +00:00