Skip to content

Commit

Permalink
Update database_transactions.php. Functions: order_by() adjustment.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate committed Nov 5, 2019
1 parent c6d5516 commit 7af2fbf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 1 addition & 7 deletions app/database_transactions/database_transactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand Down Expand Up @@ -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>";
}
Expand Down
8 changes: 6 additions & 2 deletions resources/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2000,8 +2000,12 @@ function email_button($text = 'Click Here!', $link = URL, $bg_color = '#dddddd',
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.' ';
}
}
}

Expand Down

0 comments on commit 7af2fbf

Please sign in to comment.