|
|
|
@ -64,4 +64,26 @@ function msort($array, $id='id', $order = 'desc') { |
|
|
|
|
$array = array_merge(array_slice($array, 0, $lowest_id), array_slice($array, $lowest_id+1)); |
|
|
|
|
} |
|
|
|
|
return $temp_array; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function array_walk_recursive_limited(&$array, $function, $apply_to_keys_also = false) { |
|
|
|
|
static $recursive_counter = 0; |
|
|
|
|
if (++$recursive_counter > 1000) { |
|
|
|
|
die('possible deep recursion attack'); |
|
|
|
|
} |
|
|
|
|
foreach ($array as $key => $value) { |
|
|
|
|
if (is_array($value)) { |
|
|
|
|
array_walk_recursive_limited($array[$key], $function, $apply_to_keys_also); |
|
|
|
|
} else { |
|
|
|
|
$array[$key] = $function($value); |
|
|
|
|
} |
|
|
|
|
if ($apply_to_keys_also && is_string($key)) { |
|
|
|
|
$new_key = $function($key); |
|
|
|
|
if ($new_key != $key) { |
|
|
|
|
$array[$new_key] = $array[$key]; |
|
|
|
|
unset($array[$key]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$recursive_counter--; |
|
|
|
|
} |