Changeset 46504 for branches/3.8/src/wp-includes/pluggable.php
- Timestamp:
- 10/14/2019 07:29:52 PM (6 years ago)
- Location:
- branches/3.8
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/wp-includes/pluggable.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/3.8
- Property svn:mergeinfo changed
/trunk merged: 46474-46478,46483,46485
- Property svn:mergeinfo changed
-
branches/3.8/src/wp-includes/pluggable.php
r45987 r46504 806 806 * @param string $query_arg where to look for nonce in $_REQUEST (since 2.5) 807 807 */ 808 function check_admin_referer( $action = -1, $query_arg = '_wpnonce') {809 if ( -1 == $action )810 _doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2 ' );808 function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) { 809 if ( -1 === $action ) 810 _doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2.0' ); 811 811 812 812 $adminurl = strtolower(admin_url()); 813 813 $referer = strtolower(wp_get_referer()); 814 814 $result = isset($_REQUEST[$query_arg]) ? wp_verify_nonce($_REQUEST[$query_arg], $action) : false; 815 if ( !$result && !(-1 == $action && strpos($referer, $adminurl) === 0) ) { 816 wp_nonce_ays($action); 815 816 /** 817 * Fires once the admin request has been validated or not. 818 * 819 * @since 1.5.1 820 * 821 * @param string $action The nonce action. 822 * @param bool $result Whether the admin request nonce was validated. 823 */ 824 do_action( 'check_admin_referer', $action, $result ); 825 826 if ( ! $result && ! ( -1 === $action && strpos( $referer, $adminurl ) === 0 ) ) { 827 wp_nonce_ays( $action ); 817 828 die(); 818 829 } 819 do_action('check_admin_referer', $action, $result); 830 820 831 return $result; 821 832 } … … 832 843 */ 833 844 function check_ajax_referer( $action = -1, $query_arg = false, $die = true ) { 845 if ( -1 === $action ) 846 _doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2.0' ); 847 834 848 $nonce = ''; 835 849 … … 1858 1872 } 1859 1873 endif; 1860 1861 if ( ! function_exists( 'hash_equals' ) ) :1862 /**1863 * Compare two strings in constant time.1864 *1865 * This function is NOT pluggable. It is in this file (in addition to1866 * compat.php) to prevent errors if, during an update, pluggable.php1867 * copies over but compat.php does not.1868 *1869 * This function was added in PHP 5.6.1870 * It can leak the length of a string.1871 *1872 * @since 3.9.21873 *1874 * @param string $a Expected string.1875 * @param string $b Actual string.1876 * @return bool Whether strings are equal.1877 */1878 function hash_equals( $a, $b ) {1879 $a_length = strlen( $a );1880 if ( $a_length !== strlen( $b ) ) {1881 return false;1882 }1883 $result = 0;1884 1885 // Do not attempt to "optimize" this.1886 for ( $i = 0; $i < $a_length; $i++ ) {1887 $result |= ord( $a[ $i ] ) ^ ord( $b[ $i ] );1888 }1889 1890 return $result === 0;1891 }1892 endif;
Note: See TracChangeset
for help on using the changeset viewer.