Advertisement
ManWithNoName

Untitled

May 6th, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.19 KB | None | 0 0
  1. if ( isset( $_POST['_search'] ) && $_POST['_search'] == 'true' ) {
  2.  
  3.     $operations = array(
  4.             'eq' => "= '%s'",            // Equal
  5.             'ne' => "<> '%s'",           // Not equal
  6.             'lt' => "< '%s'",            // Less than
  7.             'le' => "<= '%s'",           // Less than or equal
  8.             'gt' => "> '%s'",            // Greater than
  9.             'ge' => ">= '%s'",           // Greater or equal
  10.             'bw' => "LIKE '%s%%'",       // Begins With
  11.             'bn' => "NOT LIKE '%s%%'",   // Does not begin with
  12.             'in' => "IN ('%s')",         // In
  13.             'ni' => "NOT IN ('%s')",     // Not in
  14.             'ew' => "LIKE '%%%s'",       // Ends with
  15.             'en' => "NOT LIKE '%%%s'",   // Does not end with
  16.             'cn' => "ILIKE '%%%s%%'",    // Contains , case insensitive
  17.             'nc' => "NOT LIKE '%%%s%%'", // Does not contain
  18.             'nu' => "IS NULL OR %s =''", // Is null,
  19.             'nn' => "IS NOT NULL"        // Is not null
  20.     );
  21.  
  22.  
  23.     $filters        =   json_decode( $_POST['filters'] ); // this is a result of an ajax call from a jqgrid
  24.  
  25.     foreach($filters->rules as $filter){
  26.        
  27.         $searchField    =   $filter->field;
  28.         $searchOperator =   $filter->op;
  29.         $searchString   =   $filter->data; //  the problem is here, it contains htmlentities (Like &nbsp; in my case)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement