Ignore:
Timestamp:
Apr 27, 2006 1:49:54 AM (18 years ago)
Author:
scdev
Message:

Q - Finished depreciating addslashes. array_map instances need to use array('DB', 'escapeString') as first argument.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/RecordVersion.inc.php

    r49 r111  
    182182                version_datetime
    183183            ) VALUES (
    184                 '" . addslashes($record_table) . "',
    185                 '" . addslashes($record_key) . "',
    186                 '" . addslashes($record_val) . "',
    187                 '" . addslashes(gzcompress(serialize($record), 9)) . "',
    188                 '" . addslashes($title) . "',
    189                 '" . addslashes($notes) . "',
    190                 '" . addslashes($this->_auth->getVal('user_id')) . "',
     184                '" . DB::escapeString($record_table) . "',
     185                '" . DB::escapeString($record_key) . "',
     186                '" . DB::escapeString($record_val) . "',
     187                '" . DB::escapeString(gzcompress(serialize($record), 9)) . "',
     188                '" . DB::escapeString($title) . "',
     189                '" . DB::escapeString($notes) . "',
     190                '" . DB::escapeString($this->_auth->getVal('user_id')) . "',
    191191                NOW()
    192192            )
     
    210210        $qid = DB::query("
    211211            SELECT * FROM " . $this->getParam('db_table') . "
    212             WHERE version_id = '" . addslashes($version_id) . "'
     212            WHERE version_id = '" . DB::escapeString($version_id) . "'
    213213        ");
    214214        if (!$record = mysql_fetch_assoc($qid)) {
     
    227227
    228228        // SQLize the keys of the specified versioned record.
    229         $replace_keys = join(",\n", array_map('addslashes', array_keys($data)));
     229        $replace_keys = join(",\n", array_map(array('DB', 'escapeString'), array_keys($data)));
    230230
    231231        // SQLize the keys of the values of the specified versioned record. (These are more complex because we need to account for SQL null values.)
     
    233233        $comma = '';
    234234        foreach ($data as $v) {
    235             $replace_values .= is_null($v) ? "$comma\nNULL" : "$comma\n'" . addslashes($v) . "'";
     235            $replace_values .= is_null($v) ? "$comma\nNULL" : "$comma\n'" . DB::escapeString($v) . "'";
    236236            $comma = ',';
    237237        }
     
    268268        $qid = DB::query("
    269269            SELECT COUNT(*) FROM " . $this->getParam('db_table') . "
    270             WHERE record_table = '" . addslashes($record_table) . "'
    271             AND record_key = '" . addslashes($record_key) . "'
    272             AND record_val = '" . addslashes($record_val) . "'
     270            WHERE record_table = '" . DB::escapeString($record_table) . "'
     271            AND record_key = '" . DB::escapeString($record_key) . "'
     272            AND record_val = '" . DB::escapeString($record_val) . "'
    273273        ");
    274274        list($v_count) = mysql_fetch_row($qid);
     
    280280                $qid = DB::query("
    281281                    SELECT version_id FROM " . $this->getParam('db_table') . "
    282                     WHERE record_table = '" . addslashes($record_table) . "'
    283                     AND record_key = '" . addslashes($record_key) . "'
    284                     AND record_val = '" . addslashes($record_val) . "'
     282                    WHERE record_table = '" . DB::escapeString($record_table) . "'
     283                    AND record_key = '" . DB::escapeString($record_key) . "'
     284                    AND record_val = '" . DB::escapeString($record_val) . "'
    285285                    ORDER BY version_datetime ASC
    286286                    LIMIT " . ($v_count - $this->getParam('min_qty')) . "
     
    297297                $qid = DB::query("
    298298                    SELECT version_id FROM " . $this->getParam('db_table') . "
    299                     WHERE record_table = '" . addslashes($record_table) . "'
    300                     AND record_key = '" . addslashes($record_key) . "'
    301                     AND record_val = '" . addslashes($record_val) . "'
     299                    WHERE record_table = '" . DB::escapeString($record_table) . "'
     300                    AND record_key = '" . DB::escapeString($record_key) . "'
     301                    AND record_val = '" . DB::escapeString($record_val) . "'
    302302                    AND DATE_ADD(version_datetime, INTERVAL '" . $this->getParam('min_days') . "' DAY) < NOW()
    303303                    ORDER BY version_datetime ASC
     
    334334            SELECT version_id, saved_by_admin_id, version_datetime, version_title
    335335            FROM " . $this->getParam('db_table') . "
    336             WHERE record_table = '" . addslashes($record_table) . "'
    337             AND record_key = '" . addslashes($record_key) . "'
    338             AND record_val = '" . addslashes($record_val) . "'
     336            WHERE record_table = '" . DB::escapeString($record_table) . "'
     337            AND record_key = '" . DB::escapeString($record_key) . "'
     338            AND record_val = '" . DB::escapeString($record_val) . "'
    339339            ORDER BY version_datetime DESC
    340340        ");
     
    362362        $qid = DB::query("
    363363            SELECT * FROM " . $this->getParam('db_table') . "
    364             WHERE version_id = '" . addslashes($version_id) . "'
     364            WHERE version_id = '" . DB::escapeString($version_id) . "'
    365365        ");
    366366        return mysql_fetch_assoc($qid);
     
    381381        $qid = DB::query("
    382382            SELECT * FROM " . $this->getParam('db_table') . "
    383             WHERE version_id = '" . addslashes($version_id) . "'
     383            WHERE version_id = '" . DB::escapeString($version_id) . "'
    384384        ");
    385385        $record = mysql_fetch_assoc($qid);
     
    403403
    404404        $qid = DB::query("
    405             SELECT * FROM " . addslashes($record_table) . "
    406             WHERE " . addslashes($record_key) . " = '" . addslashes($record_val) . "'
     405            SELECT * FROM " . DB::escapeString($record_table) . "
     406            WHERE " . DB::escapeString($record_key) . " = '" . DB::escapeString($record_val) . "'
    407407        ");
    408408        if ($record = mysql_fetch_assoc($qid)) {
Note: See TracChangeset for help on using the changeset viewer.