Skip to content

Commit

Permalink
Making it more compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel authored and daniel committed Aug 7, 2019
1 parent e404b07 commit b6def02
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions objects/bootGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ static function getSqlFromPost($searchFieldsNames = array(), $keyPrefix = "", $a
$sql .= $alternativeOrderBy;
}

if (empty($_POST['rowCount']) && !empty($_GET['length'])) {
$_POST['rowCount'] = intval($_GET['length']);
}

if (empty($_POST['current']) && !empty($_GET['start'])) {
$_POST['current'] = ($_GET['start'] / $_GET['length']) + 1;
} else if (empty($_POST['current']) && isset($_GET['start'])) {
$_POST['current'] = 1;
}

$_POST['current'] = intval(@$_POST['current']);
$_POST['rowCount'] = intval(@$_POST['rowCount']);

if(!empty($_POST['rowCount']) && $_POST['rowCount']>0){
if(empty($_POST['current'])){
$_POST['current'] = 1;
Expand All @@ -47,6 +60,14 @@ static function getSqlFromPost($searchFieldsNames = array(), $keyPrefix = "", $a

static function getSqlSearchFromPost($searchFieldsNames = array(), $connection = "AND") {
$sql = "";
if (!empty($_GET['searchPhrase'])) {
$_POST['searchPhrase'] = $_GET['searchPhrase'];
} else if (!empty($_GET['search']['value'])) {
$_POST['searchPhrase'] = $_GET['search']['value'];
}else if (!empty($_GET['q'])) {
$_POST['searchPhrase'] = $_GET['q'];
}

if(!empty($_POST['searchPhrase'])){
global $global;
$search = $global['mysqli']->real_escape_string(xss_esc($_POST['searchPhrase']));
Expand Down

0 comments on commit b6def02

Please sign in to comment.