Changeset 111 for trunk/bin/module_maker/sql.cli.php
- Timestamp:
- Apr 27, 2006 1:49:54 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/module_maker/sql.cli.php
r44 r111 46 46 47 47 // Get DB table column info. 48 $qid = DB::query("DESCRIBE " . addslashes($db_tbl));48 $qid = DB::query("DESCRIBE " . DB::escapeString($db_tbl)); 49 49 while ($row = mysql_fetch_row($qid)) { 50 50 $cols[] = $row; … … 70 70 } else if ('set' == $type) { 71 71 // Set types usually need to be converted to comma-delimited lists. 72 $c[$field] = "'\" . dbArrayToList(\$frm['$field']) . \"'";72 $c[$field] = "'\" . escapedList(array_keys(\$frm['$field'])) . \"'"; 73 73 } else if ('featured' == $field || 'publish' == $field || preg_match("/enum\('true'\)/", $col[1])) { 74 74 // Toggle types. … … 76 76 } else if ('added_by_user_id' == $field || 'modified_by_user_id' == $field) { 77 77 // Toggle types. 78 $c[$field] = "'\" . addslashes(\$auth->getVal('user_id')) . \"'";78 $c[$field] = "'\" . DB::escapeString(\$auth->getVal('user_id')) . \"'"; 79 79 } else if ('added_datetime' == $field || 'modified_datetime' == $field) { 80 80 // DB record insertion datetime. … … 82 82 } else { 83 83 // Default. Just insert data. 84 $c[$field] = "'\" . addslashes(\$frm['$field']) . \"'";84 $c[$field] = "'\" . DB::escapeString(\$frm['$field']) . \"'"; 85 85 } 86 86 } … … 135 135 DB::query(" 136 136 UPDATE $db_tbl SET$key_eq_val 137 WHERE $primary_key = '" . addslashes(\$frm['$primary_key']) . "'137 WHERE $primary_key = '" . DB::escapeString(\$frm['$primary_key']) . "' 138 138 "); 139 139 E_O_F; … … 148 148 $delim = 'WHERE'; 149 149 if (!empty($primary_key)) { 150 $where_clause = " $delim $primary_key = '\" . addslashes(\$frm['$primary_key']) . \"'\n";150 $where_clause = " $delim $primary_key = '\" . DB::escapeString(\$frm['$primary_key']) . \"'\n"; 151 151 $delim = 'AND'; 152 152 } … … 155 155 continue; 156 156 } 157 $where_clause .= " $delim $k = '\" . addslashes(\$frm['$k']) . \"'\n";157 $where_clause .= " $delim $k = '\" . DB::escapeString(\$frm['$k']) . \"'\n"; 158 158 $delim = 'AND'; 159 159 } … … 183 183 if (!isset($op) || 'search' == $op) { 184 184 $search_skip_columns = array('added_datetime', 'added_by_user_id', 'modified_datetime', 'modified_by_user_id', 'publish', 'featured'); 185 $search_columns = $db_tbl . '.' . join(" LIKE '%\" . addslashes(\$qry_words[\$i]) . \"%'\n OR $db_tbl.", array_diff(array_keys($c), $search_skip_columns));185 $search_columns = $db_tbl . '.' . join(" LIKE '%\" . DB::escapeString(\$qry_words[\$i]) . \"%'\n OR $db_tbl.", array_diff(array_keys($c), $search_skip_columns)); 186 186 echo <<<E_O_F 187 187 \$where_clause .= (empty(\$where_clause) ? 'WHERE' : 'AND') . " 188 188 ( 189 $search_columns LIKE '%" . addslashes(\$qry_words[\$i]) . "%'189 $search_columns LIKE '%" . DB::escapeString(\$qry_words[\$i]) . "%' 190 190 ) 191 191 ";
Note: See TracChangeset
for help on using the changeset viewer.