equal
deleted
inserted
replaced
1090 * Default '_wpnonce'. |
1090 * Default '_wpnonce'. |
1091 * @return false|int False if the nonce is invalid, 1 if the nonce is valid and generated between |
1091 * @return false|int False if the nonce is invalid, 1 if the nonce is valid and generated between |
1092 * 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago. |
1092 * 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago. |
1093 */ |
1093 */ |
1094 function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) { |
1094 function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) { |
1095 if ( -1 == $action ) { |
1095 if ( -1 === $action ) { |
1096 _doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2.0' ); |
1096 _doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2.0' ); |
1097 } |
1097 } |
1098 |
1098 |
1099 $adminurl = strtolower( admin_url() ); |
1099 $adminurl = strtolower( admin_url() ); |
1100 $referer = strtolower( wp_get_referer() ); |
1100 $referer = strtolower( wp_get_referer() ); |
1109 * @param false|int $result False if the nonce is invalid, 1 if the nonce is valid and generated between |
1109 * @param false|int $result False if the nonce is invalid, 1 if the nonce is valid and generated between |
1110 * 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago. |
1110 * 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago. |
1111 */ |
1111 */ |
1112 do_action( 'check_admin_referer', $action, $result ); |
1112 do_action( 'check_admin_referer', $action, $result ); |
1113 |
1113 |
1114 if ( ! $result && ! ( -1 == $action && strpos( $referer, $adminurl ) === 0 ) ) { |
1114 if ( ! $result && ! ( -1 === $action && strpos( $referer, $adminurl ) === 0 ) ) { |
1115 wp_nonce_ays( $action ); |
1115 wp_nonce_ays( $action ); |
1116 die(); |
1116 die(); |
1117 } |
1117 } |
1118 |
1118 |
1119 return $result; |
1119 return $result; |
1398 |
1398 |
1399 if ( ! isset( $lp['host'] ) && ! empty( $lp['path'] ) && '/' !== $lp['path'][0] ) { |
1399 if ( ! isset( $lp['host'] ) && ! empty( $lp['path'] ) && '/' !== $lp['path'][0] ) { |
1400 $path = ''; |
1400 $path = ''; |
1401 if ( ! empty( $_SERVER['REQUEST_URI'] ) ) { |
1401 if ( ! empty( $_SERVER['REQUEST_URI'] ) ) { |
1402 $path = dirname( parse_url( 'http://placeholder' . $_SERVER['REQUEST_URI'], PHP_URL_PATH ) . '?' ); |
1402 $path = dirname( parse_url( 'http://placeholder' . $_SERVER['REQUEST_URI'], PHP_URL_PATH ) . '?' ); |
|
1403 $path = wp_normalize_path( $path ); |
1403 } |
1404 } |
1404 $location = '/' . ltrim( $path . '/', '/' ) . $location; |
1405 $location = '/' . ltrim( $path . '/', '/' ) . $location; |
1405 } |
1406 } |
1406 |
1407 |
1407 // Reject if certain components are set but host is not. This catches urls like https:host.com for which parse_url does not set the host field. |
1408 // Reject if certain components are set but host is not. This catches urls like https:host.com for which parse_url does not set the host field. |