mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Call Block: Partial support for Country Code.
This commit is contained in:
@@ -2058,13 +2058,25 @@ function number_pad($number,$n) {
|
||||
//validate and format order by clause of select statement
|
||||
if (!function_exists('order_by')) {
|
||||
function order_by($col, $dir, $col_default = '', $dir_default = 'asc') {
|
||||
$order_by = ' order by ';
|
||||
$col = preg_replace('#[^a-zA-Z0-9-_.]#', '', $col);
|
||||
$dir = strtolower($dir) == 'desc' ? 'desc' : 'asc';
|
||||
if ($col != '') {
|
||||
return ' order by '.$col.' '.$dir.' ';
|
||||
return $order_by.$col.' '.$dir.' ';
|
||||
}
|
||||
else if ($col_default != '') {
|
||||
return ' order by '.$col_default.' '.$dir_default.' ';
|
||||
else if (is_array($col_default) || $col_default != '') {
|
||||
if (is_array($col_default) && @sizeof($col_default) != 0) {
|
||||
foreach ($col_default as $k => $column) {
|
||||
$direction = (is_array($dir_default) && @sizeof($dir_default) != 0 && (strtolower($dir_default[$k]) == 'asc' || strtolower($dir_default[$k]) == 'desc')) ? $dir_default[$k] : 'asc';
|
||||
$order_bys[] = $column.' '.$direction.' ';
|
||||
}
|
||||
if (is_array($order_bys) && @sizeof($order_bys) != 0) {
|
||||
return $order_by.implode(', ', $order_bys);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return $order_by.$col_default.' '.$dir_default.' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user