- File:
-
- 1 edited
-
branches/3.6/wp-includes/functions.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/3.6/wp-includes/functions.php
r25345 r24918 243 243 * 244 244 * @param mixed $data Value to check to see if was serialized. 245 * @param bool $strict Optional. Whether to be strict about the end of the string. Defaults true.246 245 * @return bool False if not serialized and true if it was. 247 246 */ 248 function is_serialized( $data , $strict = true) {247 function is_serialized( $data ) { 249 248 // if it isn't a string, it isn't serialized 250 249 if ( ! is_string( $data ) ) … … 258 257 if ( ':' !== $data[1] ) 259 258 return false; 260 if ( $strict ) { 261 $lastc = $data[ $length - 1 ]; 262 if ( ';' !== $lastc && '}' !== $lastc ) 263 return false; 264 } else { 265 $semicolon = strpos( $data, ';' ); 266 $brace = strpos( $data, '}' ); 267 // Either ; or } must exist. 268 if ( false === $semicolon && false === $brace ) 269 return false; 270 // But neither must be in the first X characters. 271 if ( false !== $semicolon && $semicolon < 3 ) 272 return false; 273 if ( false !== $brace && $brace < 4 ) 274 return false; 275 } 259 $lastc = $data[$length-1]; 260 if ( ';' !== $lastc && '}' !== $lastc ) 261 return false; 276 262 $token = $data[0]; 277 263 switch ( $token ) { 278 264 case 's' : 279 if ( $strict ) { 280 if ( '"' !== $data[ $length - 2 ] ) 281 return false; 282 } elseif ( false === strpos( $data, '"' ) ) { 265 if ( '"' !== $data[$length-2] ) 283 266 return false; 284 }285 267 case 'a' : 286 268 case 'O' : … … 289 271 case 'i' : 290 272 case 'd' : 291 $end = $strict ? '$' : ''; 292 return (bool) preg_match( "/^{$token}:[0-9.E-]+;$end/", $data ); 273 return (bool) preg_match( "/^{$token}:[0-9.E-]+;\$/", $data ); 293 274 } 294 275 return false; … … 337 318 // Double serialization is required for backward compatibility. 338 319 // See http://core.trac.wordpress.org/ticket/12930 339 if ( is_serialized( $data , false) )320 if ( is_serialized( $data ) ) 340 321 return serialize( $data ); 341 322 … … 1303 1284 1304 1285 if ( $ref && $ref !== wp_unslash( $_SERVER['REQUEST_URI'] ) ) 1305 return wp_ validate_redirect( $ref, false);1286 return wp_unslash( $ref ); 1306 1287 return false; 1307 1288 } … … 1318 1299 function wp_get_original_referer() { 1319 1300 if ( !empty( $_REQUEST['_wp_original_http_referer'] ) ) 1320 return wp_ validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false);1301 return wp_unslash( $_REQUEST['_wp_original_http_referer'] ); 1321 1302 return false; 1322 1303 } … … 2026 2007 * @uses wp_get_upload_mime_types() to fetch the list of mime types 2027 2008 * 2028 * @param int|WP_User $user Optional. User to check. Defaults to current user.2029 2009 * @return array Array of mime types keyed by the file extension regex corresponding to those types. 2030 2010 */ 2031 function get_allowed_mime_types( $user = null ) { 2032 $t = wp_get_mime_types(); 2033 2034 unset( $t['swf'], $t['exe'] ); 2035 if ( function_exists( 'current_user_can' ) ) 2036 $unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' ); 2037 2038 if ( empty( $unfiltered ) ) 2039 unset( $t['htm|html'] ); 2040 2041 return apply_filters( 'upload_mimes', $t, $user ); 2011 function get_allowed_mime_types() { 2012 return apply_filters( 'upload_mimes', wp_get_mime_types() ); 2042 2013 } 2043 2014
Note: See TracChangeset
for help on using the changeset viewer.