Make WordPress Core

Ticket #12402: 12402.diff

File 12402.diff, 1.8 KB (added by Denis-de-Bernardy, 14 years ago)
  • wp-includes/wp-db.php

     
    775775         * @return string|array escaped
    776776         */
    777777        function _escape( $data ) {
    778                 if ( is_array( $data ) ) {
    779                         foreach ( (array) $data as $k => $v ) {
    780                                 if ( is_array($v) )
    781                                         $data[$k] = $this->_escape( $v );
    782                                 else
    783                                         $data[$k] = $this->_real_escape( $v );
    784                         }
    785                 } else {
    786                         $data = $this->_real_escape( $data );
    787                 }
    788 
    789                 return $data;
     778                return $this->escape( $data );
    790779        }
    791780
    792781        /**
     
    799788         * @return string|array escaped as query safe string
    800789         */
    801790        function escape( $data ) {
    802                 if ( is_array( $data ) ) {
    803                         foreach ( (array) $data as $k => $v ) {
    804                                 if ( is_array( $v ) )
    805                                         $data[$k] = $this->escape( $v );
    806                                 else
    807                                         $data[$k] = $this->_weak_escape( $v );
    808                         }
    809                 } else {
    810                         $data = $this->_weak_escape( $data );
    811                 }
    812 
    813                 return $data;
     791                if ( is_array( $data ) )
     792                        return array_map( array(&$this, 'escape'), $data );
     793                else
     794                        return $this->_real_escape( $data );
    814795        }
    815796
    816797        /**
  • wp-includes/formatting.php

     
    12141214 * @return string Returns a string escaped with slashes.
    12151215 */
    12161216function addslashes_gpc($gpc) {
    1217         if ( get_magic_quotes_gpc() )
    1218                 $gpc = stripslashes($gpc);
    1219 
    1220         return esc_sql($gpc);
     1217        return get_magic_quotes_gpc() ? $gpc : add_magic_quotes($gpc);
    12211218}
    12221219
    12231220/**
     
    21762173 * @return string The cleaned $sql
    21772174 */
    21782175function esc_sql( $sql ) {
    2179         global $wpdb;
    2180         return $wpdb->escape( $sql );
     2176        return add_magic_quotes( $sql );
    21812177}
    21822178
    21832179/**