1
0

Admin interface security improved, thanks to Stefan Esser.

This commit is contained in:
Garvin Hicking
2007-07-12 11:23:05 +00:00
parent 472432b1b9
commit 0c41b7b558
5 changed files with 44 additions and 14 deletions

@ -152,4 +152,31 @@ function serendipity_db_get_interval($val, $ival = 900) {
}
}
/**
* Operates on an array to prepare it for SQL usage.
*
* @access public
* @param string Concatenation character
* @param array Input array
* @param string How to convert (int: Only numbers, string: serendipity_db_escape_String)
* @return string Imploded string
*/
function serendipity_db_implode($string, &$array, $type = 'int') {
$new_array = array();
if (!is_array($array)) {
return '';
}
foreach($array AS $idx => $key) {
if ($type == 'int') {
$new_array[$idx] = (int)$key;
} else {
$new_array[$idx] = serendipity_db_escape_string($key);
}
}
$string = implode($string, $new_array);
return $string;
}
/* vim: set sts=4 ts=4 expandtab : */