-
Notifications
You must be signed in to change notification settings - Fork 0
/
tools.php
54 lines (48 loc) · 1.26 KB
/
tools.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* MSergeev
* @package core
* @author Mikhail Sergeev
* @copyright 2016 Mikhail Sergeev
*/
require_once ("tools/tools.msdebug.php");
require_once ("tools/tools.html.php");
function __include_once ($path,$echo=false)
{
if ($echo)
{
echo $path."<br>";
}
include_once($path);
}
function maskValue ($value=null)
{
static $triple_char = array(
"!><" => "NB", //not between
);
static $double_char = array(
"!=" => "NI", //not Identical
"!%" => "NS", //not substring
"><" => "B", //between
">=" => "GE", //greater or equal
"<=" => "LE", //less or equal
);
static $single_char = array(
"=" => "I", //Identical
"%" => "S", //substring
"?" => "?", //logical
">" => "G", //greater
"<" => "L", //less
"!" => "N", //not field LIKE val
);
$op = substr($value,0,3);
if ($op && isset($triple_char[$op]))
return array("value"=>substr($value,3),"mask"=>$op,"operation"=>$triple_char[$op]);
$op = substr($value,0,2);
if ($op && isset($double_char[$op]))
return array("value"=>substr($value,2),"mask"=>$op,"operation"=>$double_char[$op]);
$op = substr($value,0,1);
if ($op && isset($single_char[$op]))
return array("value"=>substr($value,1),"mask"=>$op,"operation"=>$single_char[$op]);
return false;
}