| @@ 234-247 (lines=14) @@ | ||
| 231 | ||
| 232 | break; |
|
| 233 | ||
| 234 | case 'array_string': |
|
| 235 | if (is_array($replacement)) |
|
| 236 | { |
|
| 237 | if (empty($replacement)) |
|
| 238 | smf_db_error_backtrace('Database error, given array of string values is empty. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
| 239 | ||
| 240 | foreach ($replacement as $key => $value) |
|
| 241 | $replacement[$key] = sprintf('\'%1$s\'', mysqli_real_escape_string($connection, $value)); |
|
| 242 | ||
| 243 | return implode(', ', $replacement); |
|
| 244 | } |
|
| 245 | else |
|
| 246 | smf_db_error_backtrace('Wrong value type sent to the database. Array of strings expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
| 247 | break; |
|
| 248 | ||
| 249 | case 'date': |
|
| 250 | if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d)$~', $replacement, $date_matches) === 1) |
|
| @@ 194-207 (lines=14) @@ | ||
| 191 | ||
| 192 | break; |
|
| 193 | ||
| 194 | case 'array_string': |
|
| 195 | if (is_array($replacement)) |
|
| 196 | { |
|
| 197 | if (empty($replacement)) |
|
| 198 | smf_db_error_backtrace('Database error, given array of string values is empty. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
| 199 | ||
| 200 | foreach ($replacement as $key => $value) |
|
| 201 | $replacement[$key] = sprintf('\'%1$s\'', pg_escape_string($value)); |
|
| 202 | ||
| 203 | return implode(', ', $replacement); |
|
| 204 | } |
|
| 205 | else |
|
| 206 | smf_db_error_backtrace('Wrong value type sent to the database. Array of strings expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); |
|
| 207 | break; |
|
| 208 | ||
| 209 | case 'date': |
|
| 210 | if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d)$~', $replacement, $date_matches) === 1) |
|