Page Menu
Home
GitPull.it
Search
Configure Global Search
Log In
Files
F13210019
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/objects/bootGrid.php b/objects/bootGrid.php
index e8f26b8cd..5216476d3 100644
--- a/objects/bootGrid.php
+++ b/objects/bootGrid.php
@@ -1,60 +1,63 @@
<?php
class BootGrid {
- static function getSqlFromPost($searchFieldsNames = array(), $keyPrefix = "", $alternativeOrderBy = "") {
- $sql = self::getSqlSearchFromPost($searchFieldsNames);
-
+ static function getSqlFromPost($searchFieldsNames = array(), $keyPrefix = "", $alternativeOrderBy = "", $doNotSearch=false) {
+ if(empty($doNotSearch)){
+ $sql = self::getSqlSearchFromPost($searchFieldsNames);
+ }else{
+ $sql = "";
+ }
if(empty($_POST['sort']) && !empty($_GET['order'][0]['dir'])){
$index = intval($_GET['order'][0]['column']);
$_GET['columns'][$index]['data'];
$_POST['sort'][$_GET['columns'][$index]['data']] = $_GET['order'][0]['dir'];
}
if (!empty($_POST['sort'])) {
$orderBy = array();
foreach ($_POST['sort'] as $key => $value) {
$orderBy[] = " {$keyPrefix}{$key} {$value} ";
}
$sql .= " ORDER BY ".implode(",", $orderBy);
} else {
$sql .= $alternativeOrderBy;
}
if(!empty($_POST['rowCount']) && $_POST['rowCount']>0){
if(empty($_POST['current'])){
$_POST['current'] = 1;
}
$_POST['rowCount'] = intval($_POST['rowCount']);
$_POST['current'] = intval($_POST['current']);
$current = intval(($_POST['current']-1)*$_POST['rowCount']);
$current = $current<0?0:$current;
$sql .= " LIMIT $current, {$_POST['rowCount']} ";
}else{
$_POST['current'] = 0;
$_POST['rowCount'] = 0;
}
return $sql;
}
- static function getSqlSearchFromPost($searchFieldsNames = array()) {
+ static function getSqlSearchFromPost($searchFieldsNames = array(), $connection = "AND") {
$sql = "";
if(!empty($_POST['searchPhrase'])){
global $global;
$search = $global['mysqli']->real_escape_string(xss_esc($_POST['searchPhrase']));
$like = array();
foreach ($searchFieldsNames as $value) {
$like[] = " {$value} LIKE '%{$search}%' ";
}
if(!empty($like)){
- $sql .= " AND (". implode(" OR ", $like).")";
+ $sql .= " {$connection} (". implode(" OR ", $like).")";
}else{
- $sql .= " AND 1=1 ";
+ $sql .= " {$connection} 1=1 ";
}
}
return $sql;
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Wed, Apr 22, 16:02 (1 d, 22 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1862862
Default Alt Text
(2 KB)
Attached To
Mode
R58 TurboFlop
Attached
Detach File
Event Timeline
Log In to Comment