Update database_transactions.php. Functions: order_by() adjustment.

This commit is contained in:
Nate 2019-11-05 08:25:41 -07:00
parent c6d5516467
commit 7af2fbf3c8
2 changed files with 7 additions and 9 deletions

View File

@ -43,12 +43,6 @@
$language = new text;
$text = $language->get();
//get posted data
if (is_array($_POST['bridges'])) {
$action = $_POST['action'];
$search = $_POST['search'];
}
//get variables used to control the order
$order_by = $_GET["order_by"];
$order = $_GET["order"];
@ -103,7 +97,7 @@
echo "<form id='form_search' class='inline' method='get'>\n";
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'bridges.php','style'=>($search == '' ? 'display: none;' : null)]);
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'database_transactions.php','style'=>($search == '' ? 'display: none;' : null)]);
if ($paging_controls_mini != '') {
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
}

View File

@ -2000,8 +2000,12 @@ function number_pad($number,$n) {
function order_by($col, $dir, $col_default = '', $dir_default = 'asc') {
$col = preg_replace('#[^a-zA-Z0-9-_.]#', '', $col);
$dir = strtolower($dir) == 'desc' ? 'desc' : 'asc';
if ($col != '') { return ' order by '.$col.' '.$dir.' '; }
else if ($col_default != '') { return ' order by '.$col_default.' '.$dir.' '; }
if ($col != '') {
return ' order by '.$col.' '.$dir.' ';
}
else if ($col_default != '') {
return ' order by '.$col_default.' '.$dir_default.' ';
}
}
}