"; ini_set("max_execution_time",$O23); ob_end_flush();
\ No newline at end of file
+The following pieces of information were not found in the POST data received from the acceleration form: 'db', 'table'"; echo "
"; ini_set("max_execution_time",$l32); ob_end_flush();
\ No newline at end of file
diff --git a/JSON_SQL_Bridge/formAccelerateTopQueriesSubmit.php b/JSON_SQL_Bridge/formAccelerateTopQueriesSubmit.php
index 5f736a7..03629e0 100644
--- a/JSON_SQL_Bridge/formAccelerateTopQueriesSubmit.php
+++ b/JSON_SQL_Bridge/formAccelerateTopQueriesSubmit.php
@@ -1 +1 @@
-The following pieces of information were not found in the POST data received from the acceleration form: 'db', 'table'"; echo "
"; ini_set("max_execution_time",$O23); ob_end_flush();
\ No newline at end of file
+The following pieces of information were not found in the POST data received from the acceleration form: 'db', 'table'"; echo "
The following fields were registered as fields of special type:
"; $l2d=O2d($O28); if ($l2d == NULL || count($l2d) == 0) { echo "No fields were registered as fields of special type."; } else { foreach ($l2d as $l2e => $O2e) { if ($O2e === "date" || $O2e === "geo_point" || $O2e === "url") { echo "$O2e: $l2e "; } } } } } echo "";
\ No newline at end of file
+
+ *
db name of the database where the table is located with no indication of the path (e.g. income.sqlite)
+ *
table name of the table for which the index should be created (e.g. census)
+ *
+ *
+ */
+namespace kibella;
+
+require_once 'config.php';
+
+
+/** Returns a string with an internal error message about the TABLESDIR directory.
+ *
+ * @author: Daniel Mastropietro
+ * @since: 29-Jul-2016
+ */
+function msgErrorInternalTablesDir() {
+ return "An internal error occurred.\nCheck existence and permissions of '" . TABLESDIR . "' directory in the web server.\n";
+}
+
+/** Returns a string with a note message about table registered successfully.
+ *
+ * @param string $table table name.
+ * @param string $db database where the table is stored.
+ * @param string $id table ID used for registration.
+ * @param string $enablecache flag 0/1 indicating whether the cache is enabled for this table.
+ * @return string note message.
+ *
+ * @author: Daniel Mastropietro
+ * @since: 29-Jul-2016
+ */
+function msgNoteTableRegistrationAdded($table, $db, $id, $enablecache) {
+ $cachemode = $enablecache == 1 ? "ENABLED" : "DISABLED";
+ return "Table '$table' in database '$db' successfully registered with ID '$id'.\nCache is $cachemode.\n";
+}
+
+/** Returns a string with a note message about table registration updated.
+ *
+ * @param string $table table name.
+ * @param string $db database where the table is stored.
+ * @param string $id table ID used for registration.
+ * @param string $enablecache flag 0/1 indicating whether the cache is enabled for this table.
+ * @return string note message.
+ *
+ * @author: Daniel Mastropietro
+ * @since: 29-Jul-2016
+ */
+function msgNoteTableRegistrationUpdated($table, $db, $id, $enablecache) {
+ $cachemode = $enablecache == 1 ? "ENABLED" : "DISABLED";
+ return "The registration information for table '$table' in database '$db' with ID '$id' has been successfully updated.\nCache is $cachemode.\n";
+}
+
+/*------------------------------------- ERROR MESSAGES --------------------------------------*/
+// These messages are divided into EXTERNAL errors (triggered by the user, i.e. they could happen depending on the user input --e.g. user leaves the name of the table to register empty)
+// and INTERNAL errors (triggered by the application, i.e. they should NOT happen if everything is all right with the application setup --e.g. permissions to write in internal database)
+// - All EXTERNAL errors start with "msgErrorExternal" in the function name
+// - All INTERNAL errors start with "msgErrorInternal" in the function name
+/** Returns a string with an error message about database not found.
+ *
+ * @param string $db database name.
+ *
+ * @author: Daniel Mastropietro
+ * @since: 18-Jul-2016
+ */
+function msgErrorExternalDatabaseNotFound($db) {
+ return "Database '$db' does not exist.\nTry again going back to the previous page.\n";
+}
+
+/** Returns a string with an error message about table not found in database.
+ *
+ * @param string $table table name searched for.
+ * @param string $db database where the table was searched for.
+ *
+ * @author: Daniel Mastropietro
+ * @since: 13-Jun-2016
+ */
+function msgErrorExternalTableNotFound($table, $db) {
+ if ($table == "") {
+ return "Please specify a table name.\nTry again going back to the previous page.\n";
+ }
+ else if ($db == "") {
+ return "Please specify the database where the table '$table' resides.\nTry again going back to the previous page.\n";
+ }
+ else
+ return "Table '$table' was not found in database '$db'.\nTry again going back to the previous page.\n";
+}
+/** Returns a string with an internal error message about return codes.
+ *
+ * @return rc invalid return code to show in the error message.
+ *
+ * @author: Daniel Mastropietro
+ * @since: 29-Jul-2016
+ */
+function msgErrorInternalReturnCode($rc) {
+ return "Unknown return code ($rc).\n";
+}
+
+/*-------------------------- GET DATA FROM THE FORM ---------------------------*/
+$table = $_POST['table'];
+$db = $_POST['db'];
+$dbengine_name = "sqlite"; // In the future this attribute would be read from the form
+//$dbengine_name = $_POST['dbtype'];
+$datefields = $_POST['datefields']; // This is expected to be a list of date fields separated by commas
+$geofields = $_POST['geofields']; // This is expected to be a list of geo-coordinate fields separated by commas
+$linkfields = $_POST['linkfields']; // This is expected to be a list of link fields separated by commas
+$enablecache = 1; // $_POST['enablecache']; // Flag 0/1 indicating whether to enable the cache for the table
+
+// Assertions on the above values
+//dbAssertValidDBEngine($dbengine_name);
+//$dbengine_code = convertDBEngineNameToDBEngineCode($dbengine_name);
+
+// Store the above values in an array
+$aTableInfoFromUser = array( 'table' => $table,
+ 'db' => $db,
+ 'dbengine' => $dbengine_name,
+ 'datefields' => $datefields,
+ 'geofields' => $geofields,
+ 'linkfields' => $linkfields,
+ 'enablecache' => $enablecache
+ );
+/*-------------------------- GET DATA FROM THE FORM ---------------------------*/
+
+
+/*---------------------------- REGISTER THE TABLE -----------------------------*/
+// Save the table information in Kibella's database
+$aResult = dbRegisterTable($aTableInfoFromUser);
+if ($aResult !== FALSE) {
+ $id = $aResult['id']; // Table ID
+ $rc = $aResult['rc']; // Return code
+
+ // Check the return code and show a message accordingly
+ if ($rc === FALSE) {
+ showMessage(__FILE__, TAG_ERROR_INTERNAL, msgErrorInternalTablesDir());
+ }
+ else {
+ switch ($rc) {
+ case (RC_NOTE_TABLE_ADDED):
+ showMessage("", TAG_NOTE, msgNoteTableRegistrationAdded($table, $db, $id, $enablecache));
+ break;
+ case (RC_NOTE_TABLE_UPDATED):
+ showMessage("", TAG_NOTE, msgNoteTableRegistrationUpdated($table, $db, $id, $enablecache));
+ break;
+ case (RC_ERROR_NOTFOUND_DB):
+ $dbWithFullPath = $db;
+// if (isEmbeddedDatabase($dbengine_code)) {
+ $dbWithFullPath = DATADIR . "/$db";
+// }
+ showMessage("", TAG_ERROR, msgErrorExternalDatabaseNotFound($dbWithFullPath));
+ break;
+ case (RC_ERROR_NOTFOUND_TABLE):
+ $dbWithFullPath = $db;
+// if (isEmbeddedDatabase($dbengine_code)) {
+ $dbWithFullPath = DATADIR . "/$db";
+// }
+ showMessage("", TAG_ERROR, msgErrorExternalTableNotFound($table, $dbWithFullPath));
+ break;
+ default:
+ showMessage(__FILE__, TAG_ERROR_INTERNAL, msgErrorInternalReturnCode($rc));
+ break;
+ }
+ }
+
+ // List the fields of special type (e.g. date, geo, link) specified by the user that were found in the user table
+ if ($datefields !== "" or $geofields !== "" or $linkfields !== "") {
+ // Show a message with the fields registered as special-type fields
+ echo "
The following fields were registered as fields of special type:
";
+ $aFields = dbGetFieldTypes($id);
+ if ($aFields == null || count($aFields) == 0) {
+ echo "No fields were registered as fields of special type.";
+ }
+ else {
+ foreach ($aFields as $field => $type) {
+ if ($type === "date" || $type === "geo_point" || $type === "url") {
+ echo "$type: $field ";
+ }
+ }
+ }
+ /* // (2016/07/29) This was commented out because the information of the fields not found in the user data is no longer returned by dbGetFieldTypes().
+ // Check if any date fields were not found in the user table and show a message
+ if (count($aIndex['notfound']) > 0) {
+ showMessage("", TAG_WARNING, "The following date fields were not found in table '$table':\n");
+ foreach ($aIndex['notfound'] as $field) {
+ echo "$field ";
+ }
+ }
+ */
+ }
+}
+/*---------------------------- REGISTER THE TABLE -----------------------------*/
+
+//echo "";
diff --git a/JSON_SQL_Bridge/functionsaux.php b/JSON_SQL_Bridge/functionsaux.php
index 2677c1a..dcd4331 100644
--- a/JSON_SQL_Bridge/functionsaux.php
+++ b/JSON_SQL_Bridge/functionsaux.php
@@ -1,4 +1,4 @@
-0) { $l2j=-1; foreach ($O2h as $l2l => $O2l) { $l2j ++; $O2k[0]=$O2l; $O2k[1]=$l2l; $O2k[2]=$l2j; if (is_array($O2l)) { call_user_func_array($l2i,$O2k); $O2j ++; $O2g=l2h($O2l,$l2i,$O2i,$l2j,$O2j); } else { $O2g=call_user_func_array($l2i,$O2k); } } $O2j --; } else { $O2g=call_user_func_array($l2i,$O2k); $O2j --; } return $O2g; } function l2m($O2h) { $O2m=array(); $l2n=array_keys($O2h); sort($l2n); foreach ($l2n as $l2l) { $O2m[$l2l]=$O2h[$l2l]; } return $O2m; } function O2n($O2h,$l2o=FALSE) { return l2h($O2h,"updateDimension",array("max_number_elements" => $l2o)); } function O2o($O2l,$l2l,$l2j,$O2j,$l2k,$l2p) { static $O2p; static $l2q; static $O2q; static $l2r; if ($l2j == 0 && $O2j == 0) { $O2p=1; $l2q=array(array("count" => 0)); $O2q=0; $l2r=FALSE; if (array_key_exists("max_number_elements",$l2p)) $l2r=$l2p["max_number_elements"]; } if ($l2k>0) { $l2q[$O2j]["count"]++; } if (is_array($O2l)) { $l2q[]=array("count" => 0); } else { if ($l2q[$O2j]["count"] == $l2k) { if ($O2j+1>=$O2p) { $O2q=max($O2q,$l2q[$O2j]["count"]); } $O2p=max($O2p,$O2j+1); array_pop($l2q); } } if ($l2r === FALSE) { return max($O2p,$O2j+1); } else { return array(max($O2p,$O2j+1),$O2q); } } function checkdirexistsorcreate($O2r,$l2s=0744,$O2s=TRUE,$l2t=FALSE,$O2t="") { $l29=TRUE; if (!is_dir($O2r)) { if ($l2t) O29("",Ob,$O2t); $l29=mkdir($O2r,$l2s,$O2s); } return $l29; } function l2u($O2u) { if (strlen($O2u)>0) { $O2u=preg_replace("/\\s*,\\s*/",",",$O2u); $l2d=explode(",",strtolower($O2u)); for ($l2v=0; $l2vERROR: $O2r must be a directory\nThe deletion process failed.\n"; return FALSE; } if (substr($O2r,strlen($O2r)-1,1) != "/") { $O2r.="/"; } $O2w=glob($O2r."*",GLOB_MARK); foreach ($O2w as $l2x) { if (is_dir($l2x)) { deletedir($l2x); } else { if ($l2w == 0 || $l2w<0 && (time()-filemtime($l2x))>abs($l2w) || $l2w>0 && filemtime($l2x)<$l2w) { unlink($l2x); } } } if (!$O2v) rmdir($O2r); return TRUE; } function O2x($l2g,$l2y=FALSE) { if ($l2y) { $O2y="["; $l2z="]"; } else { $O2y=""; $l2z=""; } return "\"".$O2y.str_replace("\"","\\\"",$l2g).$l2z."\""; } function O2z($l30) { $l30=str_replace("'","''",$l30); return $l30; } function O30($l31,$O2h) { if (!is_array($O2h)) { user_error( "Input parameter $O2h is not an array\n" ,E_USER_ERROR); return; } foreach ($O2h as $O31) { $l32=explode($l31,$O31); $O32=count($l32); if ($O32 == 1) $l33[$l32[0]]=NULL; else if ($O32>1) $l33[$l32[0]]=$l32[1]; } return $l33; } function O33($O2r,$l34) { $O34=""; $l35=strrpos($O2r,$l34); if ($l35>0) { $O35=substr($O2r,0,$l35-1); $l36=substr($O2r,$l35-1,1); $O34=substr($O35,strrpos($O35,$l36)+1); } return $O34; } function O36($l2g) { return preg_replace("/^_{1}|_{1}\$/","",$l2g); }
\ No newline at end of file
+function l35($O35) { $l36=FALSE; $O35=trim($O35); if (strlen($O35)>0) { $O35=preg_replace("/^(\\-|\\+)\\s*/","\$1",$O35); if (!preg_match("/[^0123456789\\.\\-\\+]/",$O35)) { if (preg_match("/^.+(\\-|\\+)+/",$O35)) $l36=FALSE; else if (preg_match("/^(\\-\\.)|(\\+\\.)/",$O35) && preg_match("/\\.|\\-|\\+/",substr($O35,2))) $l36=FALSE; else if (preg_match_all("/\\./",$O35)>1) $l36=FALSE; else $l36=TRUE; } } return $l36; } function O36($O35,$l37=NULL) { if ($l37 === NULL) { echo $O35; } else { assert($l37 !== FALSE,"The file handle is not false"); fputs($l37,$O35); } } function O37($l38,$O38,$l39=array(),$O39=0,&$l3a=0) { if (!is_array($l38)) { user_error( __FUNCTION__.": The first argument should be an array",E_USER_ERROR); return; } if (!is_callable($O38)) { if (is_array($O38)) { $O38=$O38[0]."::".$O38[1]; } user_error( __FUNCTION__.": The second argument is not a valid callback ".$O38,E_USER_ERROR); return; } if (!is_null($l39) && !is_array($l39)) { user_error( __FUNCTION__.": The third argument should be an array",E_USER_ERROR); return; } $O3a=count($l38); if (is_null($l39)) { $l39=array(); } $l3b=array(); $l3b[]=NULL; $l3b[]=NULL; $l3b[]=$O39; $l3b[]=&$l3a; $l3b[]=$O3a; $l3b[]=$l39; $l37=NULL; if ($O3a>0) { $O39=-1; foreach ($l38 as $O3b => $l3c) { $O39 ++; $l3b[0]=$l3c; $l3b[1]=$O3b; $l3b[2]=$O39; if (is_array($l3c)) { call_user_func_array($O38,$l3b); $l3a ++; $l37=O37($l3c,$O38,$l39,$O39,$l3a); } else { $l37=call_user_func_array($O38,$l3b); } } $l3a --; } else { $l37=call_user_func_array($O38,$l3b); $l3a --; } return $l37; } function O3c($l38) { $l3d=array(); $O3d=array_keys($l38); sort($O3d); foreach ($O3d as $O3b) { $l3d[$O3b]=$l38[$O3b]; } return $l3d; } function l3e($l38,$O3e=FALSE) { return O37($l38,"updateDimension",array("max_number_elements" => $O3e)); } function l3f($O3f,$l3g,$O3g="string",$l3h=TRUE,$O3h=.1E-5) { if (is_null($O3f) && is_null($l3g) || $O3f === FALSE && $l3g === FALSE) { return TRUE; } if (strtolower($O3g) === "string") { if (strtolower($O3f) !== strtolower($l3g)) { return FALSE; } if ($l3h === TRUE && $O3f !== $l3g) { return FALSE; } else return TRUE; } else { if (!l35($O3f) || !l35($l3g)) { echo "WARNING: Not all the compared values are numbers.\n"; return FALSE; } if (( float) $O3f === .00 && ( float) $l3g === .00) { return TRUE; } if (abs($O3f-$l3g)/max(abs($O3f),abs($l3g))<( float) $O3h) { return TRUE; } else { return FALSE; } } } function l3i($O3i,$l3j,$O3j=TRUE,$l3k=TRUE,$O3k=array("value"),$O3h=.1E-5,$l3l="bool") { if (count($O3i) != count($l3j)) { return FALSE; } if (is_array($O3i) && !is_array($l3j) || !is_array($O3i) && is_array($l3j)) { return FALSE; } if (!is_array($O3i) && !is_array($l3j)) { return $O3i === $l3j; } if ($O3j === FALSE) { $l3j=array_change_key_case($l3j,CASE_LOWER); if (count($l3j) $O3f) { if ($O3j === FALSE) { $O3l=strtolower($O3l); } if (array_key_exists($O3l,$l3j)) { $l3g=$l3j[$O3l]; if (is_array($O3f)) { $l3m=l3i($O3f,$l3g,$O3j=$O3j,$l3k=$l3k,$O3k=$O3k,$O3h=$O3h,$l3l=$l3l); if ($l3m !== TRUE) { if (strtolower($l3l) === "bool") { return FALSE; } else { return $O3l." -> ".$l3m; } } } else { if (in_array($O3l,$O3k)) { $O3m="number"; } else { $O3m="string"; } if (l3f($O3f,$l3g,$O3g=$O3m,$l3k=$l3k,$O3h=$O3h) === FALSE) { if (strtolower($l3l) === "bool") { return FALSE; } else { return $O3l; } } } } else { if (strtolower($l3l) === "bool") { return FALSE; } else { return $O3l; } } } return TRUE; } function l3n($l3c,$O3b,$O39,$l3a,$O3a,$O3n) { static $l3o; static $O3o; static $l3p; static $O3p; if ($O39 == 0 && $l3a == 0) { $l3o=1; $O3o=array(array("count" => 0)); $l3p=0; $O3p=FALSE; if (array_key_exists("max_number_elements",$O3n)) $O3p=$O3n["max_number_elements"]; } if ($O3a>0) { $O3o[$l3a]["count"]++; } if (is_array($l3c)) { $O3o[]=array("count" => 0); } else { if ($O3o[$l3a]["count"] == $O3a) { if ($l3a+1>=$l3o) { $l3p=max($l3p,$O3o[$l3a]["count"]); } $l3o=max($l3o,$l3a+1); array_pop($O3o); } } if ($O3p === FALSE) { return max($l3o,$l3a+1); } else { return array(max($l3o,$l3a+1),$l3p); } } function checkdirexistsorcreate($l3q,$O3q=0744,$l3r=TRUE,$O3r=FALSE,$l3s="") { $O3s=TRUE; if (!is_dir($l3q)) { if ($O3r) showmessage("",l16,$l3s); $O3s=mkdir($l3q,$O3q,$l3r); } return $O3s; } function l3t($O3t) { if (strlen($O3t)>0) { $O3t=preg_replace("/\\s*,\\s*/",",",$O3t); $l3u=explode(",",strtolower($O3t)); for ($O3u=0; $O3uERROR: $l3q must be a directory\nThe deletion process failed.\n"; return FALSE; } if (substr($l3q,strlen($l3q)-1,1) != "/") { $l3q.="/"; } $l3w=glob($l3q."*",GLOB_MARK); foreach ($l3w as $O3w) { if (is_dir($O3w)) { deletedir($O3w); } else { if ($O3v == 0 || $O3v<0 && (time()-filemtime($O3w))>abs($O3v) || $O3v>0 && filemtime($O3w)<$O3v) { unlink($O3w); } } } if (!$l3v) rmdir($l3q); return TRUE; } function l3x($O35,$O3x=FALSE) { if ($O3x) { $l3y="["; $O3y="]"; } else { $l3y=""; $O3y=""; } return "\"".$l3y.str_replace("\"","\\\"",$O35).$O3y."\""; } function l3z($O3z) { $O3z=str_replace("'","''",$O3z); return $O3z; } function l40($O3z) { $O3z=str_replace("\"","'",$O3z); return $O3z; } function O40($Ob,$l38) { if (!is_array($l38)) { user_error( "Input parameter $l38 is not an array\n" ,E_USER_ERROR); return; } foreach ($l38 as $l41) { $O41=explode($Ob,$l41); $l42=count($O41); if ($l42 == 1) $O42[$O41[0]]=NULL; else if ($l42>1) $O42[$O41[0]]=$O41[1]; } return $O42; } function l43($l3q,$O43) { $l44=""; $O44=strrpos($l3q,$O43); if ($O44>0) { $l45=substr($l3q,0,$O44-1); $O45=substr($l3q,$O44-1,1); $l44=substr($l45,strrpos($l45,$O45)+1); } return $l44; } function l46($O35) { return preg_replace("/^_{1}|_{1}\$/","",$O35); }
\ No newline at end of file
diff --git a/JSON_SQL_Bridge/functionsauxkibella.php b/JSON_SQL_Bridge/functionsauxkibella.php
index 65ccf48..a7f912b 100644
--- a/JSON_SQL_Bridge/functionsauxkibella.php
+++ b/JSON_SQL_Bridge/functionsauxkibella.php
@@ -8,4 +8,4 @@
If you are interested in distributing, reselling, modifying, contibuting or in general creating
any derivative work from JSON_SQL_Bridge, please contact Frank Vanden Berghen at frank@timi.eu.
*/
-namespace kibella; require_once "functionsaux.php"; function l37($O2h,$O37) { if (!is_array($O2h) || count($O2h) == 0) { user_error( "The input parameter is not an array or is empty ($O2h)\n" ,E_USER_ERROR); return NULL; } else if ($O37<0 || $O37>=count($O2h)) { error( "The index to extract from the array is out of range ($O37 while size of array is count($O2h))\n" ,E_USER_ERROR); return NULL; } return $O2h[$O37]; } function l38($O38) { $l39=strtotime($O38)-strtotime("00:00"); $O39=time()-strtotime("00:00"); if ($l39<=$O39) { $l3a=strtotime($O38); } else { $l3a=strtotime($O38)-0250600; } return $l3a; } function O3a($l3b) { $date=date_create(strftime("%Y-%m-%d %H:%M:%S",$l3b)); $O3b=(array) $date; $l3c=timezone_offset_get(new \datetimezone($date->timezone),$date); return $l3b-$l3c; } function O3c($l3d,$timezone="UTC") { $O3d=array("s" => "second","m" => "minute","h" => "hour","d" => "day","w" => "week","M" => "month","y" => "year"); $l3e="/^((now)|([\\d\\/-:\\s]+)\\|\\|)([-+])(\\d+)([smhdwMy]{1})\\w*\\/*([smhdwMy])*/"; preg_match($l3e,$l3d,$O3e); if (count($O3e)>0) { assert(count($O3e)>=7,"The preg_match() array has at least 7 elements"); $date=date_create($O3e[2].$O3e[3]); if ($timezone !== NULL && $O3e[2] !== "now") { $date=date_create(strftime("%Y-%m-%d %H:%M:%S",date_timestamp_get($date)),new \datetimezone($timezone)); } $l3f=$O3e[4].$O3e[5]; $O3f=$O3e[6]; date_modify($date,"$l3f ".$O3d[$O3f]); $O3b=(array) $date; if (count($O3e)>=8) { $l3g=$O3e[7]; O3g($date,$l3g); } } else { if ($timezone !== NULL) { $date=date_create($l3d); $date=date_create(strftime("%Y-%m-%d %H:%M:%S",date_timestamp_get($date)),new \datetimezone($timezone)); } else { $date=date_create($l3d); } } return date_timestamp_get($date); } function O3g(&$l3h,$l3g) { switch ($l3g) { case ("s"): date_modify($l3h,strftime("%Y-%m-%d %H:%M:%S",strtotime($l3h->date))); break; case ("m"): date_modify($l3h,strftime("%Y-%m-%d %H:%M",strtotime($l3h->date)).":00"); break; case ("h"): date_modify($l3h,strftime("%Y-%m-%d %H",strtotime($l3h->date)).":00:00"); break; case ("d"): date_modify($l3h,strftime("%Y-%m-%d",strtotime($l3h->date))." 00:00:00"); break; case ("w"): date_modify($l3h,"last monday"); $O3b=(array) $l3h; date_modify($l3h,strftime("%Y-%m-%d",strtotime($l3h->date))." 00:00:00"); break; case ("M"): date_modify($l3h,"first day of this month"); $O3b=(array) $l3h; date_modify($l3h,strftime("%Y-%m-%d",strtotime($l3h->date))." 00:00:00"); break; case ("y"): date_modify($l3h,strftime("%Y",strtotime($l3h->date))."-01-01 00:00:00"); break; default : break; } $O3b=(array) $l3h; } function O3h($l3i) { $O3i=preg_grep("/^\\-/",array($l3i)); $l3j=count($O3i)>0; if ($l3j) $l3i=substr($l3i,1); $O3j=explode("-",$l3i,2); $l3k=$O3j[0]; if ($l3j) $l3k="-".$l3k; $O3k=""; if (count($O3j)>1) { $O3k=$O3j[1]; } return array($l3k,$O3k); } function l3l($O3l) { $l3m=FALSE; $O3m=filemtime($O3l); if (strtolower(CACHEMODE) === CACHEMODE_DAY) { $O38=CACHEDAYCHANGE; $l3a=l38($O38); if ($O3m<$l3a) { $l3m=TRUE; } } else if (time()-$O3m>CACHEHOURS*07020) { $l3m=TRUE; } return $l3m; } function l3n($l2g) { $l3m=FALSE; $l2g=trim($l2g); if (strlen($l2g)>0) { $l2g=preg_replace("/^(\\-|\\+)\\s*/","\$1",$l2g); if (!preg_match("/[^0123456789\\.\\-\\+]/",$l2g)) { if (preg_match("/^.+(\\-|\\+)+/",$l2g)) $l3m=FALSE; else if (preg_match("/^(\\-\\.)|(\\+\\.)/",$l2g) && preg_match("/\\.|\\-|\\+/",substr($l2g,2))) $l3m=FALSE; else if (preg_match_all("/\\./",$l2g)>1) $l3m=FALSE; else $l3m=TRUE; } } return $l3m; } function O3n($l3o,$O3o) { switch (( string) $l3o) { case (l19): $l3o=O19; break; case (O1c): if ($O3o == O1b) $l3o=O1j; break; case (O1m): if ($O3o == l1a) $l3o=O1a; else $l3o=l1g; break; default : break; } return $l3o; } function l3p($O3p,$l3q) { if ($O3p == $l3q) $O3q=""; else $O3q=","; return $O3q; } function l3r($O2l) { if ($O2l<=0) $O3r=""; else $O3r="LIMIT ".$O2l; return $O3r; }
\ No newline at end of file
+namespace kibella; require_once "functionsaux.php"; function O46($l38,$l47) { if (!is_array($l38) || count($l38) == 0) { user_error( "The input parameter is not an array or is empty ($l38)\n" ,E_USER_ERROR); return NULL; } else if ($l47<0 || $l47>=count($l38)) { error( "The index to extract from the array is out of range ($l47 while size of array is count($l38))\n" ,E_USER_ERROR); return NULL; } return $l38[$l47]; } function O47($l48) { $O48=strtotime($l48)-strtotime("00:00"); $l49=time()-strtotime("00:00"); if ($O48<=$l49) { $O49=strtotime($l48); } else { $O49=strtotime($l48)-0250600; } return $O49; } function l4a($O4a) { global $l4b; $O4b=array_search($O4a,$l4b); assert($O4b !== FALSE,"The database engine name is valid: $O4b\n"); return $O4b; } function l4c($O4b) { if ($O4b == NULL) { return NULL; } O4c($O4b); global $l4b; return $l4b[$O4b]; } function l4d($O4d) { $date=date_create(strftime("%Y-%m-%d %H:%M:%S",$O4d)); $l4e=(array) $date; $O4e=timezone_offset_get(new \datetimezone($date->timezone),$date); return $O4d-$O4e; } function l4f($O4f,$timezone="UTC") { $l4g=array("s" => "second","m" => "minute","h" => "hour","d" => "day","w" => "week","M" => "month","y" => "year"); $O4g="/^((now)|([\\d\\/-:\\s]+)\\|\\|)([-+])(\\d+)([smhdwMy]{1})\\w*\\/*([smhdwMy])*/"; preg_match($O4g,$O4f,$l4h); if (count($l4h)>0) { assert(count($l4h)>=7,"The preg_match() array has at least 7 elements"); $date=date_create($l4h[2].$l4h[3]); if ($timezone !== NULL && $l4h[2] !== "now") { $date=date_create(strftime("%Y-%m-%d %H:%M:%S",date_timestamp_get($date)),new \datetimezone($timezone)); } $O4h=$l4h[4].$l4h[5]; $l4i=$l4h[6]; date_modify($date,"$O4h ".$l4g[$l4i]); $l4e=(array) $date; if (count($l4h)>=8) { $O4i=$l4h[7]; l4j($date,$O4i); } } else { if ($timezone !== NULL) { $date=date_create($O4f); $date=date_create(strftime("%Y-%m-%d %H:%M:%S",date_timestamp_get($date)),new \datetimezone($timezone)); } else { $date=date_create($O4f); } } return date_timestamp_get($date); } function l4j(&$O4j,$O4i) { switch ($O4i) { case ("s"): date_modify($O4j,strftime("%Y-%m-%d %H:%M:%S",strtotime($O4j->date))); break; case ("m"): date_modify($O4j,strftime("%Y-%m-%d %H:%M",strtotime($O4j->date)).":00"); break; case ("h"): date_modify($O4j,strftime("%Y-%m-%d %H",strtotime($O4j->date)).":00:00"); break; case ("d"): date_modify($O4j,strftime("%Y-%m-%d",strtotime($O4j->date))." 00:00:00"); break; case ("w"): date_modify($O4j,"last monday"); $l4e=(array) $O4j; date_modify($O4j,strftime("%Y-%m-%d",strtotime($O4j->date))." 00:00:00"); break; case ("M"): date_modify($O4j,"first day of this month"); $l4e=(array) $O4j; date_modify($O4j,strftime("%Y-%m-%d",strtotime($O4j->date))." 00:00:00"); break; case ("y"): date_modify($O4j,strftime("%Y",strtotime($O4j->date))."-01-01 00:00:00"); break; default : break; } $l4e=(array) $O4j; } function l4k($O4k) { $l4l=preg_grep("/^\\-/",array($O4k)); $O4l=count($l4l)>0; if ($O4l) $O4k=substr($O4k,1); $l4m=explode("-",$O4k,2); $O4m=$l4m[0]; if ($O4l) $O4m="-".$O4m; $l4n=""; if (count($l4m)>1) { $l4n=$l4m[1]; } return array($O4m,$l4n); } function O4n($Oe) { $l36=FALSE; $l4o=filemtime($Oe); if (strtolower(CACHEMODE) === CACHEMODE_DAY) { $l48=CACHEDAYCHANGE; $O49=O47($l48); if ($l4o<$O49) { $l36=TRUE; } } else if (time()-$l4o>CACHEHOURS*07020) { $l36=TRUE; } return $l36; } function O4o($lp,$l4p,$O30) { global $O4p; return $O4p[$l4p][$lp].$O4p[$l4p][O1a]."'$O30'".$O4p[$l4p][l1b]; } function l4q($lp) { global $O4q; return $O4q[$lp] === O17; } function l4r($O4r,$l4s) { switch (( string) $O4r) { case (l23): $O4r=O23; break; case (O26): if ($l4s == O25) $O4r=O2d; break; case (O2g): if ($l4s == l24) $O4r=O24; else $O4r=l2a; break; default : break; } return $O4r; } function O4s($l4t,$O4t) { if ($l4t == $O4t) $l4u=""; else $l4u=","; return $l4u; } function O4u($l3c,$lp,$l4v) { $O4v=""; if ($l3c>0) { switch ($lp) { case (O18): if ($l4v === 1) $O4v= "LIMIT $l3c"; break; case (l19): if ($l4v === 0) $O4v= "TOP $l3c"; break; default : break; } } return $O4v; }
\ No newline at end of file
diff --git a/JSON_SQL_Bridge/functionscfg.php b/JSON_SQL_Bridge/functionscfg.php
index e884294..f01095c 100644
--- a/JSON_SQL_Bridge/functionscfg.php
+++ b/JSON_SQL_Bridge/functionscfg.php
@@ -8,4 +8,4 @@
If you are interested in distributing, reselling, modifying, contibuting or in general creating
any derivative work from JSON_SQL_Bridge, please contact Frank Vanden Berghen at frank@timi.eu.
*/
-namespace kibella; define(__NAMESPACE__."\\DEFAULT_DATADIR",__DIR__."/../../data"); const l3s=0764; const O3s=1; const l3t="day"; const O3t="04:00"; const l3u=030; const O3u=017; const l3v=024; function O3v($O3l,$l31="/\t+/") { $l3w=array(); if (($O3w=fopen($O3l,"r")) === FALSE) throw new exception( __FUNCTION__."Cannot open configuration file ($O3l)."); while (($l3x=fgets($O3w,02000)) !== FALSE) { $l3x=preg_replace("/(^\\s+)|(\\s+\$)/","",$l3x); if (preg_match("/^#/",$l3x) == 0) { $O3x=preg_split($l31,$l3x); if (count($O3x)>1) { $l3w[$O3x[0]]=trim($O3x[1]); } } } return $l3w; } function l7($O3l,$l31="/\t+/") { $l3w=O3v($O3l,$l31); foreach ($l3w as $l3y => $O2l) { $l3y=trim(strtoupper( "$l3y")); if ($l3y === "CACHEMODE" || $l3y === "CACHEDAYCHANGE" || $l3y === "CACHEHOURS" || $l3y === "DATADIR" || $l3y === "DISCOVERSIZE" || $l3y === "ADDTABLEPREFIX" || $l3y === "ACCELERATETOP" || $l3y === "ACCELERATEMAX") { if ($l3y === "DATADIR" && stripos(trim($O2l),"..") == 0) { $O2l= __DIR__."/../".trim($O2l); } define(__NAMESPACE__."\\".$l3y,$O2l); } } if (!defined(__NAMESPACE__."\\DATADIR"))define(__NAMESPACE__."\\DATADIR",DEFAULT_DATADIR); if (!defined(__NAMESPACE__."\\DISCOVERSIZE")) { define(__NAMESPACE__."\\DISCOVERSIZE",l3s); } if (!defined(__NAMESPACE__."\\ADDTABLEPREFIX"))define(__NAMESPACE__."\\ADDTABLEPREFIX",O3s); if (!defined(__NAMESPACE__."\\CACHEMODE"))define(__NAMESPACE__."\\CACHEMODE",l3t); if (!defined(__NAMESPACE__."\\CACHEDAYCHANGE"))define(__NAMESPACE__."\\CACHEDAYCHANGE",O3t); if (!defined(__NAMESPACE__."\\CACHEHOURS"))define(__NAMESPACE__."\\CACHEHOURS",l3u); if (!defined(__NAMESPACE__."\\ACCELERATETOP"))define(__NAMESPACE__."\\ACCELERATETOP",l3v); if (!defined(__NAMESPACE__."\\ACCELERATEMAX"))define(__NAMESPACE__."\\ACCELERATEMAX",O3u); }
\ No newline at end of file
+namespace kibella; require_once "constantscfg.php"; function lc($Oe,$Ob="/\t+/") { $lf=array(); if (($Of=fopen($Oe,"r")) === FALSE) throw new exception( __FUNCTION__."Cannot open configuration file ($Oe)."); while (($lg=fgets($Of,02000)) !== FALSE) { $lg=preg_replace("/(^\\s+)|(\\s+\$)/","",$lg); if (preg_match("/^#/",$lg) == 0) { $Og=preg_split($Ob,$lg); if (count($Og)>1) { $lf[$Og[0]]=trim($Og[1]); } } } return $lf; } function l12($Oe=APPCONFIG,$Ob="/\t+/") { $lf=lc($Oe,$Ob); foreach ($lf as $l4w => $l3c) { $l4w=trim(strtoupper( "$l4w")); if ($l4w === "CACHEMODE" || $l4w === "CACHEDAYCHANGE" || $l4w === "CACHEHOURS" || $l4w === "DATADIR" || $l4w === "DISCOVERSIZE" || $l4w === "ADDTABLEPREFIX" || $l4w === "LISTONLYTABLEOBJECTS" || $l4w === "ACCELERATETOP" || $l4w === "ACCELERATEMAX" || $l4w === "DBCONNECTIONSFILE" || $l4w === "MULTITHREADING") { if ($l4w === "DATADIR" && stripos(trim($l3c),"..") == 0) { $l3c= __DIR__."/../".trim($l3c); } define(__NAMESPACE__."\\".$l4w,$l3c); } } if (!defined(__NAMESPACE__."\\DATADIR"))define(__NAMESPACE__."\\DATADIR",DEFAULT_DATADIR); if (!defined(__NAMESPACE__."\\DISCOVERSIZE")) { define(__NAMESPACE__."\\DISCOVERSIZE",O2v); } if (!defined(__NAMESPACE__."\\ADDTABLEPREFIX"))define(__NAMESPACE__."\\ADDTABLEPREFIX",l2w); if (!defined(__NAMESPACE__."\\LISTONLYTABLEOBJECTS"))define(__NAMESPACE__."\\LISTONLYTABLEOBJECTS",O2w); if (!defined(__NAMESPACE__."\\CACHEMODE"))define(__NAMESPACE__."\\CACHEMODE",l2x); if (!defined(__NAMESPACE__."\\CACHEDAYCHANGE"))define(__NAMESPACE__."\\CACHEDAYCHANGE",O2x); if (!defined(__NAMESPACE__."\\CACHEHOURS"))define(__NAMESPACE__."\\CACHEHOURS",l2y); if (!defined(__NAMESPACE__."\\ACCELERATETOP"))define(__NAMESPACE__."\\ACCELERATETOP",l2z); if (!defined(__NAMESPACE__."\\ACCELERATEMAX"))define(__NAMESPACE__."\\ACCELERATEMAX",O2y); if (!defined(__NAMESPACE__."\\DBCONNECTIONSFILE"))define(__NAMESPACE__."\\DBCONNECTIONSFILE",DEFAULT_DBCONNECTIONSFILE); if (!defined(__NAMESPACE__."\\MULTITHREADING"))define(__NAMESPACE__."\\MULTITHREADING",O2z); }
\ No newline at end of file
diff --git a/JSON_SQL_Bridge/functionsdashaccelerate.php b/JSON_SQL_Bridge/functionsdashaccelerate.php
index 009ae9e..27fc0aa 100644
--- a/JSON_SQL_Bridge/functionsdashaccelerate.php
+++ b/JSON_SQL_Bridge/functionsdashaccelerate.php
@@ -8,4 +8,4 @@
If you are interested in distributing, reselling, modifying, contibuting or in general creating
any derivative work from JSON_SQL_Bridge, please contact Frank Vanden Berghen at frank@timi.eu.
*/
-namespace kibella; function O3y($O2l,&$l3z) { if (array_search($O2l,$l3z["values"]) === FALSE) { $l3z["values"][]=$O2l; } } function O3z($l40,$l2d,$O40,$O2j,&$l41,&$O41) { $l42=array_keys($l2d); $O42=count($l2d); if ($O2j+1<$O42) $l43=TRUE; else $l43=FALSE; if ($l43) $O43=$l42[$O2j+1]; $O2e=$l2d[$l40]["type"]; $l44=$l2d[$l40]["ifield"]; $O44=$l2d[$l40]["interval"]; if (array_key_exists($l44,$l41) === FALSE) { $l41[$l44]=array("type" => $O2e,"values" => array(),"interval" => $O44); } switch ($O2e) { case ("h"): case ("hd"): case ("t"): foreach ($O40 as $l45) { $O2l=$l45["key"]; if ($O2e == "hd") { $O2l=$O2l/01750; } if ($l43) { $O41[$O2l]=array(); if (array_key_exists($O43,$l45)) { $O45=$l45[$O43][l1c]; O3z($O43,$l2d,$O45,$O2j+1,$l41,$O41[$O2l]); } } else { $O41[]=$O2l; } O3y($O2l,$l41[$l44]); } break; case ("r"): case ("rd"): foreach ($O40 as $O2l => $l45) { if ($l43) { $O41[$O2l]=array(); if (array_key_exists($O43,$l45)) { $O45=$l45[$O43][l1c]; O3z($O43,$l2d,$O45,$O2j+1,$l41,$O41[$O2l]); } } else { $O41[]=$O2l; } O3y($O2l,$l41[$l44]); } break; default : break; } } function l46($O46,$l47) { $O47=array(); $l41=array(); $O41=array(); $l48=json_decode($O46,TRUE); assert(array_key_exists("xaggs",$l47),"The parsed query array contains the attribute 'xaggs'"); $O48=$l47["xaggs"]; $l42=array(); foreach ($O48 as $l49) { assert(array_key_exists("ofield",$l49),"The array with the aggregation info contains the attribute 'ofield'"); assert(array_key_exists("type",$l49),"The array with the aggregation info contains the attribute 'type'"); $l42[]=$l49["ofield"]; if ($l49["type"] == "h" || $l49["type"] == "hd") { assert(array_key_exists("interval",$l49),"The array with the aggregation info contains the attribute 'interval'"); $O44=$l49["interval"]; } else { $O44=NULL; } assert(array_key_exists("ifieldname",$l49),"The array with the aggregation info contains the attribute 'ifieldname'"); $O47[$l49["ofield"]]=array("type" => $l49["type"],"ifield" => $l49["ifieldname"],"interval" => $O44); } if (array_key_exists(l19,$l48)) { $O49=$l48[l19]; $O2j=-1; $l40=$l42[0]; $O40=$O49[$l40][l1c]; O3z($l40,$O47,$O40,$O2j+1,$l41,$O41); } $l4a=count($O41); if (0<$l4a && $l4a<=ACCELERATEMAX) { if (DEBUG) { O29( __FUNCTION__ ,"note","Multi-level filter values\n"); O4a($O41); } return array("Fields and Values" => $l41,"Multilevel Values" => $O41); } else { return FALSE; } } function l4b(&$O4b,$l2e,$O2e,$O44,$O2l,$l4c="") { global $O4c; switch ($O2e) { case ("t"): $O4b.=$l4c."{"."\"query\":{"."\"match\":{".$l2e.":{"."\"query\":\"".$O2l."\","."\"type\":\"phrase\""."}"."}"."}"."}"; break; case ("h"): case ("hd"): if ($O2e == "hd") { $l4d=$O2l*01750; } else { $l4d=$O2l; } $O4b.=$l4c."{"."\"range\":{".$l2e.":{"."\"gte\":".$l4d.","; if ($O2e == "h") { assert(is_numeric($O44),"The histogram interval (bin size) is a number or numeric string"); $O4d=$l4d+$O44; $O4b.="\"lt\":".$O4d; } else { $l3f=max(1,round(substr($O44,0,strlen($O44)-1)))*1; $O3f=substr($O44,strlen($O44)-1); $l4e=date_create(gmstrftime("%Y-%m-%d %H:%M:%S",$l4d/01750),new \datetimezone("UTC")); $O4e=(array) $l4e; date_modify($l4e,"$l3f ".$O4c[$O3f]); $O4e=(array) $l4e; $O4d=date_timestamp_get($l4e); $O4b.="\"lte\":".($O4d*01750-1); } $O4b.="}"."}"."}"; break; case ("r"): case ("rd"): $l4f=O3h($O2l); $l4d=$l4f[0]; $O4d=$l4f[1]; $O4b.=$l4c."{"."\"range\":{".$l2e.":{"."\"gte\":".$l4d.","."\"lt\":".$O4d."}"."}"."}"; break; default : break; } } function O4f($l4g,$O4b) { $O4g=FALSE; if ($O4b != NULL && trim($O4b) !== "") { $O4g=TRUE; $l4h=json_decode($O4b,TRUE); } foreach ($l4g["objects"] as $O4h) { $l4i=$O4h["id"]; $O22=$O4h["tableid"]; $O4i=$O4h["query"]; if ($O4i != NULL) { if ($O4g === TRUE) { $l4j=json_decode($O4i,TRUE); if (array_key_exists("query",$l4j)) { $l4j["query"]=$l4h; } $O4i=json_encode($l4j); } $O4j=l4k($O22,$O4i); $O4k=l4($O4j); } if (DEBUG) O29( __FUNCTION__ ,"note","\t\t*********** FILTER QUERY for object $l4i **************\n\t\t$O4i\n"); } } function l4l($l4g,$O4l) { if (DEBUG) { O29( __FUNCTION__ ,"note","Objects in dashboard to be accelerated:\n"); O4a($l4g); O29( __FUNCTION__ ,"note","Filters to apply:\n"); O4a($O4l); } O4f($l4g,""); $l4m="{"."\"filtered\":{"."\"query\":{"."\"query_string\":{"."\"query\":\"*\","."\"analyze_wildcard\":true"."}"."},"."\"filter\":{"."\"bool\":{"."\"must\":["; $O4m=",{"."\"query\":{"."\"query_string\":{"."\"analyze_wildcard\":true,"."\"query\":\"*\""."}"."}"."}"."],"."\"must_not\":[]"."}"."}"."}"."}"; foreach ($O4l as $l4n => $O4n) { $l4o=array(); foreach ($O4n["Fields and Values"] as $l2e => $O4o) { $O2e=$O4o["type"]; $O44=$O4o["interval"]; $l4o[]=array("field" => $l2e,"type" => $O2e,"interval" => $O44); foreach ($O4o["values"] as $O2l) { $O4b=$l4m; l4b($O4b,$l2e,$O2e,$O44,$O2l); $O4b.=$O4m; O4f($l4g,$O4b); } } $l4p=count($l4o); if ($l4p>1) { l2h($O4n["Multilevel Values"],"kibella\\dashAddMultiLevelFilterAndAccelerateObjects",array($l4g,$l4o,$l4m,$O4m)); } } } function dashaddmultilevelfilterandaccelerateobjects($O2l,$l2l,$l2j,$O2j,$l2k,$O2i) { static $O4p; static $l4q; static $O4q; static $l4r; static $O4r; assert(count($O2i) == 4,"The parameters array has exactly 4 elements"); if ($l2j == 0 && $O2j == 0) { $O4p=$O2i[0]; $l4q=$O2i[1]; $l4r=$O2i[2]; $O4q=array($l4r); $O4r=$O2i[3]; } assert(count($l4q)>$O2j,"The number of elements in the aFieldsInfo array is larger than the current level (numel=".count($l4q)."), level=$O2j)"); $l2e=$l4q[$O2j]["field"]; $O2e=$l4q[$O2j]["type"]; $O44=$l4q[$O2j]["interval"]; if (is_array($O2l)) { $l4s=$l2l; $O4q[]=$O4q[$O2j]; if ($O2j == 0) { $l4c=""; } else { $l4c=","; } l4b($O4q[$O2j+1],$l2e,$O2e,$O44,$l4s,$l4c=$l4c); } else { $l4s=$O2l; $O4b=$O4q[$O2j]; l4b($O4b,$l2e,$O2e,$O44,$l4s,$l4c=","); $O4b.=$O4r; O4f($O4p,$O4b); if ($l2j == $l2k-1) { array_pop($O4q); } } } function O4s($O22,$l4t) { $O4t=l4u($O22)["cache"]; if ($O4t) { if (LOG) { O29( __FUNCTION__ ,"note","$O22 - Accelerating dashboard...\n"); } $O4u=array(); if (array_key_exists("panelsJSON",$l4t)) { $l4v=json_decode($l4t["panelsJSON"],TRUE); foreach ($l4v as $O4v) { if (array_key_exists("id",$O4v)) { $l4w=O4w("select * from ".Ov." where ".Ow." <> '".Og."' and ".lq." = '".$O4v["id"]."'",KIBELLADB,TABLESDIR,$l4x="query",$O24="sqlite"); if (count($l4w)>0) { assert(count($l4w) == 1,"There is only one object that matches the searched ID"); $O4i=$l4w[0][Ox]; $O4x["objects"][]=array("id" => $O4v["id"],"tableid" => $O22,"query" => $O4i); if ($O4i != NULL) { $O4j=l4k($O22,$O4i); $l4y=l4($O4j); $l3=$l4y["responseFile"]; $l47=$l4y["parsedQuery"]; if ($l3 !== FALSE) { $O46=file_get_contents($l3); } $O4l=l46($O46,$l47); if ($O4l !== FALSE) { $O4u[$O4v["id"]]=$O4l; } } } } } if (count($O4u)>0) { l4l($O4x,$O4u); } } } } function dashacceleratealldashboards($O22,$O2=FALSE) { $O4t=l4u($O22)["cache"]; if ($O4t) { $O4y=l4z($O22); if ($O4y !== FALSE) { foreach ($O4y as $O4z) { if ($O2) echo "
Accelerating dashboard ".$O4z[lq]."...
"; ob_flush(); $l4t=json_decode($O4z[lx],TRUE); O4s($O22,$l4t); } } } } function dashacceleratetopqueries($O22,$l24=l3v,$O2=FALSE) { $O4t=l4u($O22)["cache"]; if ($O4t && $l24>0) { $l50=O50($O22); if ($l50 !== FALSE) { $l51=0; foreach ($l50 as $O51) { $l51 += $O51["n"]; $l52=$O51["counter"]; } $O52=0; $l53=$l50[0]["counter"]; foreach ($l50 as $O51) { $O52 += $O51["n"]; if ($O52/$l51>$l24/0144) { $l52=$l53; break; } $l53=$O51["counter"]; } if ($O2) echo "
=> Queries to accelerate should have been run at least $l52 times.
"; $O53=l54($O22,$l52); if ($O53 !== FALSE) { $l2v=0; foreach ($O53 as $l4j) { $l2v ++; $O54=$l4j[lz]; $l55=$l4j[l11]; if ($O2) echo "
Running query $l2v with MD5 $O54 (run $l55 times)
"; $O4i=$l4j[O10]; $O4j=l4k($O22,$O4i); l4($O4j); } } } } }
\ No newline at end of file
+namespace kibella; function O4w($l3c,&$l4x) { if (array_search($l3c,$l4x["values"]) === FALSE) { $l4x["values"][]=$l3c; } } function O4x($l4y,$l3u,$O4y,$l3a,&$l4z,&$O4z) { $l50=array_keys($l3u); $O50=count($l3u); if ($l3a+1<$O50) $l51=TRUE; else $l51=FALSE; if ($l51) $O51=$l50[$l3a+1]; $l52=$l3u[$l4y]["type"]; $O52=$l3u[$l4y]["ifield"]; $l53=$l3u[$l4y]["interval"]; if (array_key_exists($O52,$l4z) === FALSE) { $l4z[$O52]=array("type" => $l52,"values" => array(),"interval" => $l53); } switch ($l52) { case ("h"): case ("hd"): case ("t"): foreach ($O4y as $O53) { $l3c=$O53["key"]; if ($l52 == "hd") { $l3c=$l3c/01750; } if ($l51) { $O4z[$l3c]=array(); if (array_key_exists($O51,$O53)) { $l54=$O53[$O51][l26]; O4x($O51,$l3u,$l54,$l3a+1,$l4z,$O4z[$l3c]); } } else { $O4z[]=$l3c; } O4w($l3c,$l4z[$O52]); } break; case ("r"): case ("rd"): foreach ($O4y as $l3c => $O53) { if ($l51) { $O4z[$l3c]=array(); if (array_key_exists($O51,$O53)) { $l54=$O53[$O51][l26]; O4x($O51,$l3u,$l54,$l3a+1,$l4z,$O4z[$l3c]); } } else { $O4z[]=$l3c; } O4w($l3c,$l4z[$O52]); } break; default : break; } } function O54($l55,$O55) { $l56=array(); $l4z=array(); $O4z=array(); $O56=json_decode($l55,TRUE); assert(array_key_exists("xaggs",$O55),"The parsed query array contains the attribute 'xaggs'"); $l57=$O55["xaggs"]; $l50=array(); foreach ($l57 as $O57) { assert(array_key_exists("ofield",$O57),"The array with the aggregation info contains the attribute 'ofield'"); assert(array_key_exists("type",$O57),"The array with the aggregation info contains the attribute 'type'"); $l50[]=$O57["ofield"]; if ($O57["type"] == "h" || $O57["type"] == "hd") { assert(array_key_exists("interval",$O57),"The array with the aggregation info contains the attribute 'interval'"); $l53=$O57["interval"]; } else { $l53=NULL; } assert(array_key_exists("ifieldname",$O57),"The array with the aggregation info contains the attribute 'ifieldname'"); $l56[$O57["ofield"]]=array("type" => $O57["type"],"ifield" => $O57["ifieldname"],"interval" => $l53); } if (array_key_exists(l23,$O56)) { $l58=$O56[l23]; $l3a=-1; $l4y=$l50[0]; $O4y=$l58[$l4y][l26]; O4x($l4y,$l56,$O4y,$l3a+1,$l4z,$O4z); } $O58=count($O4z); if (0<$O58 && $O58<=ACCELERATEMAX) { if (DEBUG) { showmessage( __FUNCTION__ ,"note","Multi-level filter values\n"); l59($O4z); } return array("Fields and Values" => $l4z,"Multilevel Values" => $O4z); } else { return FALSE; } } function O59(&$l5a,$O5a,$l52,$l53,$l3c,$l5b="") { global $O5b; switch ($l52) { case ("t"): $l5a.=$l5b."{"."\"query\":{"."\"match\":{".$O5a.":{"."\"query\":\"".$l3c."\","."\"type\":\"phrase\""."}"."}"."}"."}"; break; case ("h"): case ("hd"): if ($l52 == "hd") { $l5c=$l3c*01750; } else { $l5c=$l3c; } $l5a.=$l5b."{"."\"range\":{".$O5a.":{"."\"gte\":".$l5c.","; if ($l52 == "h") { assert(is_numeric($l53),"The histogram interval (bin size) is a number or numeric string"); $O5c=$l5c+$l53; $l5a.="\"lt\":".$O5c; } else { $O4h=max(1,round(substr($l53,0,strlen($l53)-1)))*1; $l4i=substr($l53,strlen($l53)-1); $l5d=date_create(gmstrftime("%Y-%m-%d %H:%M:%S",$l5c/01750),new \datetimezone("UTC")); $O5d=(array) $l5d; date_modify($l5d,"$O4h ".$O5b[$l4i]); $O5d=(array) $l5d; $O5c=date_timestamp_get($l5d); $l5a.="\"lte\":".($O5c*01750-1); } $l5a.="}"."}"."}"; break; case ("r"): case ("rd"): $l5e=l4k($l3c); $l5c=$l5e[0]; $O5c=$l5e[1]; $l5a.=$l5b."{"."\"range\":{".$O5a.":{"."\"gte\":".$l5c.","."\"lt\":".$O5c."}"."}"."}"; break; default : break; } } function O5e($l5f,$l5a) { $O5f=FALSE; if ($l5a != NULL && trim($l5a) !== "") { $O5f=TRUE; $l5g=json_decode($l5a,TRUE); } foreach ($l5f["objects"] as $O5g) { $l5h=$O5g["id"]; $l31=$O5g["tableid"]; $O5h=$O5g["query"]; if ($O5h != NULL) { if ($O5f === TRUE) { $l5i=json_decode($O5h,TRUE); if (array_key_exists("query",$l5i)) { $l5i["query"]=$l5g; } $O5h=json_encode($l5i); } $O5i=l5j($l31,$O5h); $O5j=lz($O5i); } if (DEBUG) showmessage( __FUNCTION__ ,"note","\t\t*********** FILTER QUERY for object $l5h **************\n\t\t$O5h\n"); } } function l5k($l5f,$O5k) { if (DEBUG) { showmessage( __FUNCTION__ ,"note","Objects in dashboard to be accelerated:\n"); l59($l5f); showmessage( __FUNCTION__ ,"note","Filters to apply:\n"); l59($O5k); } O5e($l5f,""); $l5l="{"."\"filtered\":{"."\"query\":{"."\"query_string\":{"."\"query\":\"*\","."\"analyze_wildcard\":true"."}"."},"."\"filter\":{"."\"bool\":{"."\"must\":["; $O5l=",{"."\"query\":{"."\"query_string\":{"."\"analyze_wildcard\":true,"."\"query\":\"*\""."}"."}"."}"."],"."\"must_not\":[]"."}"."}"."}"."}"; foreach ($O5k as $l5m => $O5m) { $l5n=array(); foreach ($O5m["Fields and Values"] as $O5a => $O5n) { $l52=$O5n["type"]; $l53=$O5n["interval"]; $l5n[]=array("field" => $O5a,"type" => $l52,"interval" => $l53); foreach ($O5n["values"] as $l3c) { $l5a=$l5l; O59($l5a,$O5a,$l52,$l53,$l3c); $l5a.=$O5l; O5e($l5f,$l5a); } } $l5o=count($l5n); if ($l5o>1) { O37($O5m["Multilevel Values"],"kibella\\dashAddMultiLevelFilterAndAccelerateObjects",array($l5f,$l5n,$l5l,$O5l)); } } } function dashaddmultilevelfilterandaccelerateobjects($l3c,$O3b,$O39,$l3a,$O3a,$l39) { static $O5o; static $l5p; static $O5p; static $l5q; static $O5q; assert(count($l39) == 4,"The parameters array has exactly 4 elements"); if ($O39 == 0 && $l3a == 0) { $O5o=$l39[0]; $l5p=$l39[1]; $l5q=$l39[2]; $O5p=array($l5q); $O5q=$l39[3]; } assert(count($l5p)>$l3a,"The number of elements in the aFieldsInfo array is larger than the current level (numel=".count($l5p)."), level=$l3a)"); $O5a=$l5p[$l3a]["field"]; $l52=$l5p[$l3a]["type"]; $l53=$l5p[$l3a]["interval"]; if (is_array($l3c)) { $l5r=$O3b; $O5p[]=$O5p[$l3a]; if ($l3a == 0) { $l5b=""; } else { $l5b=","; } O59($O5p[$l3a+1],$O5a,$l52,$l53,$l5r,$l5b=$l5b); } else { $l5r=$l3c; $l5a=$O5p[$l3a]; O59($l5a,$O5a,$l52,$l53,$l5r,$l5b=","); $l5a.=$O5q; O5e($O5o,$l5a); if ($O39 == $O3a-1) { array_pop($O5p); } } } function O5r($l31,$l5s) { $O5s=l5t($l31)["cache"]; if ($O5s) { if (LOG) { showmessage( __FUNCTION__ ,"note","$l31 - Accelerating dashboard...\n"); } $O5t=array(); if (array_key_exists("panelsJSON",$l5s)) { $l5u=json_decode($l5s["panelsJSON"],TRUE); foreach ($l5u as $O5u) { if (array_key_exists("id",$O5u)) { $l5v=dbcreatedbh(KIBELLADB); $O5v=dbdbhexecutesqlquery($l5v->getdbhandle(),"select * from ".l3." where ".l4." <> '".O4."' and ".O3." = '".$O5u["id"]."'"); $l5v->close(); if (count($O5v)>0) { assert(count($O5v) == 1,"There is only one object that matches the searched ID"); $O5h=$O5v[0][O1r]; $l5w["objects"][]=array("id" => $O5u["id"],"tableid" => $l31,"query" => $O5h); if ($O5h != NULL) { $O5i=l5j($l31,$O5h); $O5w=lz($O5i); $ly=$O5w["responseFile"]; $O55=$O5w["parsedQuery"]; if ($ly !== FALSE) { $l55=file_get_contents($ly); } $O5k=O54($l55,$O55); if ($O5k !== FALSE) { $O5t[$O5u["id"]]=$O5k; } } } } } if (count($O5t)>0) { l5k($l5w,$O5t); } } } } function dashacceleratealldashboards($l31,$lx=FALSE) { $O5s=l5t($l31)["cache"]; if ($O5s) { $l5x=O5x($l31); if ($l5x !== FALSE) { foreach ($l5x as $l5y) { if ($lx) echo "
Accelerating dashboard ".$l5y[O3]."...
"; ob_flush(); $l5s=json_decode($l5y[l1r],TRUE); O5r($l31,$l5s); } } } } function dashacceleratetopqueries($l31,$O32=l2z,$lx=FALSE) { $O5s=l5t($l31)["cache"]; if ($O5s && $O32>0) { $O5y=l5z($l31); if ($O5y !== FALSE) { $O5z=0; foreach ($O5y as $l60) { $O5z += $l60["n"]; $O60=$l60["counter"]; } $l61=0; $O61=$O5y[0]["counter"]; foreach ($O5y as $l60) { $l61 += $l60["n"]; if ($l61/$O5z>$O32/0144) { $O60=$O61; break; } $O61=$l60["counter"]; } if ($lx) echo "
=> Queries to accelerate should have been run at least $O60 times.
"; $l62=O62($l31,$O60); if ($l62 !== FALSE) { $O3u=0; foreach ($l62 as $l5i) { $O3u ++; $l63=$l5i[O1s]; $O63=$l5i[O1u]; if ($lx) echo "
Running query $O3u with MD5 $l63 (run $O63 times)
"; $O5h=$l5i[l1u]; $O5i=l5j($l31,$O5h); lz($O5i); } } } } }
\ No newline at end of file
diff --git a/JSON_SQL_Bridge/functionsdb.php b/JSON_SQL_Bridge/functionsdb.php
index 8dc3695..ed07629 100644
--- a/JSON_SQL_Bridge/functionsdb.php
+++ b/JSON_SQL_Bridge/functionsdb.php
@@ -1,11 +1,11 @@
close(); unset ($l5b); } return $l29; } function l5c($l2e,$l22,$O21,$O2r,$O24="sqlite") { $O27=O5c($l22,$O21,$O2r,$O24=$O24); if ($O27 === FALSE) { return FALSE; } foreach ($O27 as $O51) { if (O2x(strtolower($O51["name"])) === strtolower($l2e)) { return TRUE; } } return FALSE; } function l5a($l22,$O21,$O2r) { if (!file_exists( "$O2r/$O21")) { return le; } $O27=O4w( "select * from sqlite_master where type = 'table' and lower(name) = lower('$l22')" ,$O21,$O2r); if ($O27 === FALSE) { return FALSE; } if (count($O27) == 0) { return Oe; } return TRUE; } function l5d($l5b,$l22) { $O27=dbdbhexecutesqlquery($l5b,"select * from sqlite_master where type = 'table' and name = '$l22'"); if ($O27 === FALSE) { return FALSE; } if (count($O27) == 0) { return Oe; } return TRUE; } function O5d(&$l5b,$l4x="pdo",$l5e=FALSE,$O5e="",$l5f=NULL) { if ($l5f == NULL) { O5f($l5b,$l4x=$l4x); } else { assert(count($l5f)>=2 && array_key_exists("dbh",$l5f) && array_key_exists("attachname",$l5f),"Input array \$dbAttachInfo contains the neccessary keys"); $l5g="DETACH DATABASE ".$l5f["attachname"]; dbdbhexecutesqlquery($l5b,$l5g,$l4x="exec"); O5f($l5f["dbh"],$l4x=$l4x); } if ($l5e === TRUE && $O5e != "" && $O5e != ":memory:") { unlink($O5e); } } function O5f(&$l5b,$l4x="pdo") { switch ($l4x) { case ("pdo"): $l5b=NULL; break; case ("sqlite"): $l5b->close(); break; default : $l5b=NULL; break; } unset ($l5b); } function dbdbhcreate($O21,$O2r="",$l4x="pdo",$O5g=array("dbtype" => "sqlite","attributes" => array( \pdo::ATTR_PERSISTENT => true,\pdo::ATTR_STRINGIFY_FETCHES => false)),$l5h=array("flags" => SQLITE3_OPEN_READWRITE)) { $l5b=FALSE; if ($O2r === "") $O0=$O21; else $O0= "$O2r/$O21"; if (strtolower($l4x) === "sqlite") { assert($l5h !== NULL && count($l5h)>=1 && array_key_exists("flags",$l5h),"Input array \$optionsSQLite contains the minimum required attributes"); $O5h=$l5h["flags"]; try { $l5b=new l0($O0,$O5h=$O5h); } catch ( \exception $l1) { O29( __FUNCTION__ ,Oc,$l1->getmessage()." '$O0'.\n"); } } else { assert($O5g !== NULL && count($O5g)>=1 && array_key_exists("dbtype",$O5g),"Input array \$optionsPDO contains the minimum required attributes"); $O24=$O5g["dbtype"]; if (array_key_exists("attributes",$O5g)) { $l5i=$O5g["attributes"]; } else { $l5i=NULL; } try { $l5b=new \pdo( "$O24:$O0"); if ($l5i != NULL) { foreach ($l5i as $O5i => $O2l) { $l5b->setattribute($O5i,$O2l); } } $l5b->setattribute( \pdo::ATTR_ERRMODE,\pdo::ERRMODE_SILENT); } catch ( \l5j $l1) { O29( __FUNCTION__ ,Oc,$l1->getmessage()." '$O0' of type '$O24'.\n"); } } return $l5b; } function O5j($l5b,$l22) { $l29=l5d($l5b,$l22); if ($l29 === TRUE) { dbdbhexecutesqlquery($l5b,"drop table $l22" ,$l4x="exec"); } return $l29; } function dbdbhexecutesqlquery($l5b,$l5k,$l4x="query",$O2i=NULL) { $O5k=FALSE; if ($l4x == "exec") { try { if ($O2i != NULL) { $l5l=@$l5b->prepare($l5k); foreach ($O2i as $O5l => $O2l) { $l5l->bindvalue($O5l,$O2l); } $O5k=@$l5l->execute(); unset ($l5l); } else { $O5k=@$l5b->exec($l5k); } } catch ( \l5j $l1) { } } else { $l5l=@$l5b->query($l5k); if ($l5l) { if (get_class($l5l) == "PDOStatement") { $O5k=$l5l->fetchall( \pdo::FETCH_ASSOC); } else if (get_class($l5l) == "SQLite3Result") { $O5k=array(); while ($l5m=$l5l->fetcharray(SQLITE3_ASSOC)) { $O5k[]=$l5m; } } } unset ($l5l); } return $O5k; } function O5m($O28,$O21,$l22,$l25,$O25,$O2r,$O24="sqlite") { if (strtolower($O24) != "sqlite") { return Od; } $l29=l5a($l22,$O21,$O2r); if ($l29 === FALSE || $l29<0) { return FALSE; } $l5n=O5c($l22,$O21,$O2r,$O24=$O24); if ($l5n === FALSE) { return FALSE; } if (count($l5n) == 0) { return Oe; } $O5n=""; $l5o=l2u($l25); $O5o=l2u($O25); $l4c=""; $l5p=0; $O5p=$O5o; for ($l2v=0; $l2v0) $l4c=","; $O5n.=$l4c.dbgeneratefieldmetadatashort($l5q,$l5s); $l5p ++; } } if ($O5o != NULL) { O5s($O5n,$O5o,$l5n,"kibella\\dbGenerateFieldMetadataShort"); } $l5t="{\"docs\":[{\"".lj."\":\"".O7."\",\"".Oj."\":\"index-pattern\",\"".lk."\":\"".$O28."\",\"".Ok."\":1,\"".lo."\":true,\"".lm."\":{\"title\":\"".$O28."\","."\"fields\":".O2x($O5n,TRUE)."}"."}]"."}"; return $l5t; } function O5t($O28,$O21,$l22,$l25,$O25,$O2r,$O24="sqlite") { if (strtolower($O24) != "sqlite") { return Od; } $l29=l5a($l22,$O21,$O2r); if ($l29 === FALSE || $l29<0) { return FALSE; } $l5n=O5c($l22,$O21,$O2r,$O24=$O24); if ($l5n === FALSE) { return FALSE; } if (count($l5n) == 0) { return Oe; } $l5u="{\"".$O28."\":{"."\"mappings\":{"."\"row\":{"."\"_ttl\":{"."\"full_name\":\"_ttl\","."\"mapping\":{"."\"_ttl\":{"."\"enabled\":false,"."\"default\":-1"."}"."}"."}"; $l5o=l2u($l25); $O5o=l2u($O25); $l4c=","; $O5p=$O5o; for ($l2v=0; $l2v0) { $l5w="true"; $O5w=$O27[0][Oq]*1; O4w( "delete from $l5v $O5v" ,KIBELLADB,TABLESDIR,$l4x="exec",$O24="sqlite"); } else { $l5w="false"; $O5w=1; } if ($O2e == lh) { l58(Ov,$l2t=FALSE); O4w("delete from ".Ov." where ".lw." = '$O28'" ,KIBELLADB,TABLESDIR,$l4x="exec",$O24="sqlite"); } l5x($O2e,$O28,$O5w,lo,$l5w); } function O5x($l22,$O21,$O2r) { $l29=l5a($l22,$O21,$O2r); if ($l29 === TRUE) { O4w( "drop table $l22" ,$O21,$O2r,$l4x="exec"); } return $l29; } function O4w($l5k,$O21,$O2r,$l4x="query",$O24="sqlite",$O2i=NULL) { $O5k=FALSE; $O0= "$O2r/$O21"; try { $l5y=new \pdo( "$O24:$O0"); if ($l4x == "exec") { try { if ($O2i != NULL) { $O5y=@$l5y->prepare($l5k); foreach ($O2i as $O5l => $O2l) { $O5y->bindvalue($O5l,$O2l); } $O5k=$O5y->execute(); unset ($O5y); } else { $O5k=@$l5y->exec($l5k); } } catch ( \l5j $l1) { } } else { $O5y=@$l5y->query($l5k); if ($O5y) { $O5k=$O5y->fetchall( \pdo::FETCH_ASSOC); } unset ($O5y); } unset ($l5y); } catch ( \l5j $l1) { O29( __FUNCTION__ ,Oc,$l1->getmessage()." ".$O0."\n"); } return $O5k; } function O5r($l5q,$l5s,&$l5o,&$O5o,$O5p,$O24="sqlite") { $l5z=FALSE; if ($O5p !== NULL && count($O5p)>0) { $O5z="/_geohash[".Oo."-".lp."]\$/i"; if (preg_match($O5z,$l5q) === 1 && array_search(preg_replace($O5z,"",strtolower($l5q)),$O5p) !== FALSE) { $l60=""; $O60=""; $l5z=TRUE; } } if (!$l5z) { $l61=array_search(strtolower($l5q),$l5o); if ($l61 !== FALSE) { $l60="date"; $O60="date"; unset ($l5o[$l61]); } else { $O61=array_search(strtolower($l5q),$O5o); if ($O61 !== FALSE) { $l60="geo_point"; $O60="geo_point"; unset ($O5o[$O61]); } else { switch (( string) strtoupper($l5s)) { case ("DOUBLE"): case ("FLOAT"): case ("REAL"): $l60="number"; $O60="double"; break; case ("INT"): $l60="number"; $O60="long"; break; case ("TEXT"): $l60="string"; $O60="string"; break; default : l62($l5s,$O24); $l60="string"; $O60="string"; break; } } } } return array("FieldTypeIndex" => $l60,"FieldTypeMappings" => $O60); } function dbgeneratefieldmetadatalong($l5q,$l5s) { $l2g="\"".$l5q."\":{"."\"full_name\":\"".$l5q."\","."\"mapping\":{\"".$l5q."\":{"."\"type\":\"".$l5s."\","; if ($l5s === "date") { $l2g.="\"analyzer\":\"_date/16\","."\"search_analyzer\":\"_date/max\","."\"format\":\"yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||epoch_second\","."\"numeric_resolution\":\"seconds\","; } $l2g.="\"index\":\"not_analyzed\""."}"."}"."}"; return $l2g; } function dbgeneratefieldmetadatashort($l5q,$l5s) { return "{"."\"name\":\"".$l5q."\","."\"type\":\"".$l5s."\","."\"count\":0,"."\"scripted\":false,"."\"indexed\":true,"."\"analyzed\":false,"."\"doc_values\":true"."}"; } function O5s(&$l2g,&$O5o,$O62,$l63) { assert($O5o != NULL,"the input geofields array is not null"); foreach ($O5o as $O63) { $O63=strtolower($O63); $l64=FALSE; $O64=FALSE; $l65=FALSE; foreach ($O62 as $O51) { $l5q=$O51["name"]; $O65=strtolower($l5q); if ($O65 === $O63."_lat") $l64=TRUE; if ($O65 === $O63."_lon") $O64=TRUE; $l66=$O63."_geohash"; $O66=substr($O65,0,strlen($l66)); $l67=substr($O65,strlen($l66)); if ($O66 === $l66 && Oo<=$l67 && $l67<=lp) $l65=TRUE; if ($l64 && $O64 && $l65) break; } if ($l64 && $O64 && $l65) { if ($l2g == "") $l4c=""; else $l4c=","; $O67=substr($l5q,0,strlen($O63)); $l2g.=$l4c.call_user_func($l63,$O67,"geo_point"); } unset ($O5o[$O63]); } return $l2g; } function l23($l22,$O21) { return strtoupper(strstr($O21,".",TRUE))."(".strtolower($l22).")"; } function l68() { if (PHP_SAPI !== "cli") { $O68=str_replace([":","."],"_",$_SERVER["REMOTE_ADDR"]); $l69=$O68."_"; } else { $l69=""; } return "_$l69".floor(microtime(1))."_".rand(0,023420); } function O2d($O28) { $l5r=FALSE; $l5t=O69($O28); $l6a=json_decode($l5t,TRUE); if ($l6a != NULL && array_key_exists("docs",$l6a) && count($l6a["docs"])>0) { $O6a=$l6a["docs"][0][lm]["fields"]; $l6b=json_decode($O6a,TRUE); $l5r=array(); foreach ($l6b as $O6b) { $l5r["\"".$O6b["name"]."\""]=$O6b["type"]; } } return $l5r; } function l4z($O22) { l58(Ov,$l2t=FALSE); $O4y=O4w("select ".lw.", ".lq.", ".lx." from ".Ov." where ".Ow." = '".Og."' and ".lw." = '".$O22."'",KIBELLADB,TABLESDIR,$l4x="query",$O24="sqlite"); if ($O4y == FALSE or count($O4y) == 0) { return FALSE; } return $O4y; } function l54($O22,$l52=0) { l58(Oy,$l2t=FALSE); $O53=O4w("select ".lz.", ".l10.", ".O10.", ".l11." from ".Oy." where ".l10." = '".$O22."' and ".l11." >= $l52"." order by ".l11." desc",KIBELLADB,TABLESDIR,$l4x="query",$O24="sqlite"); if ($O53 == FALSE or count($O53) == 0) { return FALSE; } return $O53; } function O50($O22) { l58(Oy,$l2t=FALSE); $l6c=O4w("select ".l11.", count(*) as n "." from ".Oy." where ".l10." = '".$O22."'"." group by ".l11." order by ".l11." desc",KIBELLADB,TABLESDIR,$l4x="query",$O24="sqlite"); if ($l6c === FALSE or count($l6c) == 0) { return FALSE; } return $l6c; } function l4u($O22) { l58(lr,$l2t=FALSE); $O6c=O4w("select ".Os.", ".ls.", ".lv." from ".lr." where ".lq." = '$O22'" ,KIBELLADB,TABLESDIR); if ($O6c == FALSE or count($O6c) == 0) { return FALSE; } $O21=$O6c[0][Os]; $l22=$O6c[0][ls]; $l6d=strtolower(CACHEMODE) !== "none" && ($O6c[0][lv] == 1); $l27=array("table" => $l22,"db" => $O21,"cache" => $l6d); return $l27; } function O69($O22) { l58(lr,$l2t=FALSE); $O27=O4w("select ".ls.", ".Os.", ".lt.", ".Ot.", ".lu.", ".Ou." from ".lr." where lower(".lq.") = '".strtolower($O22)."'",KIBELLADB,TABLESDIR,$l4x="query",$O24="sqlite"); if ($O27 !== FALSE && count($O27)>0) { $l22=$O27[0][ls]; $O21=$O27[0][Os]; $O24=$O27[0][lt]; $l25=$O27[0][Ot]; $O25=$O27[0][lu]; $l26=$O27[0][Ou]; $l5t=O5m($O22,$O21,$l22,$l25,$O25,DATADIR,$O24=$O24); } else { $l5t=FALSE; } return $l5t; } function O6d($O28) { l58(lr,$l2t=FALSE); $O27=O4w("select ".ls.", ".Os.", ".lt.", ".Ot.", ".lu.", ".Ou." from ".lr." where lower(".lq.") = '".strtolower($O28)."'",KIBELLADB,TABLESDIR,$l4x="query",$O24="sqlite"); if ($O27 !== FALSE && count($O27)>0) { $l22=$O27[0][ls]; $O21=$O27[0][Os]; $O24=$O27[0][lt]; $l25=$O27[0][Ot]; $O25=$O27[0][lu]; $l26=$O27[0][Ou]; $l5u=O5t($O28,$O21,$l22,$l25,$O25,DATADIR,$O24=$O24); } else { $l5u=FALSE; } return $l5u; } function O5c($l22,$O21,$O2r,$O24="sqlite") { if ($O24 == "sqlite") { return O4w( "PRAGMA table_info('$l22')" ,$O21,$O2r,$l4x="query",$O24=$O24); } else { O29( __FUNCTION__ ,Oc,l6e($O24)); } } function O6e($l6f) { $O6f=json_decode($l6f["kibanaSavedObjectMeta"]["searchSourceJSON"],TRUE); return $O6f["index"]; } function l6g($O2e,$O28,$O6g=TRUE) { l58(Ov,$l2t=FALSE); $l6h=O4w("select * from ".Ov." where ".Ow." = '".$O2e."' and ".lq." = '".$O28."'",KIBELLADB,TABLESDIR,$l4x="query",$O24="sqlite"); if ($l6h === FALSE) { echo Oc." when reading from Objects table '".Ov."'. ".ld.".\n"; } else { if (count($l6h) == 0) { $O6h="{\"".lj."\":\"".O7."\",\"".Oj."\":\"".$O2e."\",\"".lk."\":\"".$O28."\",\"".lo."\":false"."}"; if ($O6g) { $O6h="{\"docs\":[".$O6h."]}"; } } else { $O6h="{\"".lj."\":\"".O7."\",\"".Oj."\":\"".$l6h[0][Ow]."\",\"".lk."\":\"".$l6h[0][lq]."\",\"".Ok."\":".$l6h[0][Oq]*1 .",\"".lo."\":true,\"".lm."\":".$l6h[0][lx]; $l6i=$l6h[0][Om]; if ($l6i) $O6h.=",\"".Om."\":".$l6i; $O6h.="}"; if ($O6g) { $O6h="{\"docs\":[".$O6h."]}"; } } O2f($O6h); } } function O6i($O22,$l6j,$O6j) { $l27=l4u($O22); $l22=$l27["table"]; $O21=$l27["db"]; $O4t=$l27["cache"]; $l6k=O6k($O22,$l6j); $l6l=O6l($l6k,$O4t); if ($l6l === FALSE) { $l6m["xaggs"]=array(); $l6m["yaggs"]=array(); $l6m["filter"]= "where rowid = $O6j"; $l6m["discover"]=array("tab" => TRUE,"limit" => l3r(1)); O6m($l22,$O21,$l6m,$l6k["responseFileTmp"]); l6n($l6k,$O4t); } O6n($l6k["responseFileFinal"]); } function l6o($O28) { $l5t=O69($O28); if ($l5t !== FALSE) { $O46=$l5t; } else { $l22=l14; $O21=l13; $O28=l23($l22,$O21); $O46="{\"docs\":[{\"".lj."\":\"".O7."\",\"".Oj."\":\"index-pattern\",\"".lk."\":\"".$O28."\",\"".Ok."\":1,\"".lo."\":true,\"".lm."\":{\"title\":\"".$O28."\","."\"fields\":\"[{}]\""."}"."}]"."}"; } O2f($O46); } function O6o($O28) { $l5u=O6d($O28); if ($l5u !== FALSE) { $O46=$l5u; } else { $l22=l14; $O21=l13; $O28=l23($l22,$O21); $l5q="_dummy"; $l5s="string"; $O46="{\"".$O28."\":{"."\"mappings\":{"."\"row\":{"."\"_ttl\":{"."\"full_name\":\"_ttl\","."\"mapping\":{"."\"_ttl\":{"."\"enabled\":false,"."\"default\":-1"."}"."}"."},\"".$l5q."\":{"."\"full_name\":\"".$l5q."\","."\"mapping\":{\"".$l5q."\":{"."\"type\":\"".$l5s."\","."\"index\":\"not_analyzed\""."}"."}"."}"."}"."}"."}"."}"; } O2f($O46); } function l6p($l5b,$l5k) { $l5l=FALSE; if ($l5b !== FALSE) { $l5l=@$l5b->query($l5k); } return $l5l; } function O6p($l5l,$l6q=0) { $O5k=FALSE; if ($l5l) { if (get_class($l5l) == "PDOStatement") { $O5k=$l5l->fetch( \pdo::FETCH_ASSOC); } else if (get_class($l5l) == "SQLite3Result") { $O5k=$l5l->fetcharray(SQLITE3_ASSOC); } } return $O5k; } function O6q($O22,$O4i,$O54) { $l29=l58(Oy,$l2t=FALSE); $O27=O4w("select ".lz.", ".l11." from ".Oy." where ".lz." = '".$O54."'"." and ".l10." = '$O22'" ,KIBELLADB,TABLESDIR,$l4x="query",$O24="sqlite"); $l2w=@strftime("%Y/%m/%d %H:%M:%S",time()); if (count($O27) == 0) { $l6r="true"; $l55=1; $O5k=O4w("insert into ".Oy." values(\t'$O54',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$O22',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$O4i',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$l55,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$l2w'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)" ,KIBELLADB,TABLESDIR,$l4x="exec",$O24="sqlite"); } else { $l55=$O27[0][l11]+1; $O5k=O4w("update ".Oy." set ".lz." = '$O54', ".l10." = '$O22', ".O10." = '$O4i', ".l11." = $l55, ".Oz." = '$l2w'"." where ".lz." = '$O54'" ,KIBELLADB,TABLESDIR,$l4x="exec",$O24="sqlite"); } } function l28($l27) { $O6r=new user(); if (PHP_SAPI !== "cli" && !$O6r->isloggedin()) return FALSE; $l22=$l27["table"]; $O21=$l27["db"]; $O24=$l27["dbtype"]; $l25=$l27["datefields"]; $O25=$l27["geofields"]; $l26=$l27["linkfields"]; $O26=$l27["enablecache"]; if ($O21 == "") { O29("","note",l6s("Database")); } if ($l22 == "") { O29("","note",l6s("Table")); } if ($O21 == "" || $l22 == "") { return FALSE; } assert($O24 != "","The database type is not empty."); $l29=l5a($l22,$O21,DATADIR); if ($l29 === FALSE || $l29<0) { $O28=""; } else { $l29=FALSE; $O21=basename(realpath(DATADIR."/$O21")); $O28=l23($l22,$O21); $l29=l58(lr,$l2t=TRUE); if ($l29 === FALSE) { return array("id" => $O28,"rc" => FALSE); } $l29=FALSE; $O27=O4w("select ".Oq." from ".lr." where lower(".lq.") = '".strtolower($O28)."'",KIBELLADB,TABLESDIR,$l4x="query",$O24="sqlite"); if ($O27 === FALSE) { $l29=FALSE; } else if (count($O27) == 0) { $O5w=1; $O5k=O4w("insert into ".lr." (".lq.",".ls.",".Os.",".lt.",".Oq.",".Ot.",".lu.",".Ou.",".lv.")"." values(\t'$O28',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$l22',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$O21',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$O24',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t $O5w,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$l25',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$O25',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$l26',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$O26'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)" ,KIBELLADB,TABLESDIR,$l4x="exec",$O24="sqlite"); if ($O5k !== FALSE) $l29=lf; } else { $O5w=$O27[0][Oq]+1; $O5k=O4w("update ".lr." set ".ls." = '$l22', ".Os." = '$O21', ".lt." = '$O24', ".Oq." = $O5w, ".Ot." = '$l25', ".lu." = '$O25', ".Ou." = '$l26', ".lv." = $O26"." where lower(".lq.") = '".strtolower($O28)."'",KIBELLADB,TABLESDIR,$l4x="exec",$O24="sqlite"); if ($O5k !== FALSE) $l29=Of; } } return array("id" => $O28,"rc" => $l29); } function O5a($l2t=FALSE) { $l29=TRUE; $l5b=dbdbhcreate(KIBELLADB,$O2r=TABLESDIR,$l4x="sqlite"); if ($l5b === FALSE) { return FALSE; } $O6s=array(lr,Ov,Oy); $l29=TRUE; foreach ($O6s as $l22) { $l29=$l29 && O5b($l5b,$l22,$l2t=$l2t); } $l5b->close(); unset ($l5b); return $l29; } function O5b($l5b,$l22,$l2t=FALSE) { assert($l5b !== NULL && $l5b != FALSE,"The database handle is not null nor false"); $l29=O5j($l5b,$l22); if ($l29 === FALSE) { O29( __FUNCTION__ ,Ob,l6t($l22)); } else { switch ($l22) { case (lr): $O6t=lq." TEXT, ".ls." TEXT, ".Os." TEXT, ".lt." TEXT, ".Oq." INT, ".Ot." TEXT, ".lu." TEXT, ".Ou." TEXT, ".lv." NUMBER".",imageFields TEXT".",linkTemplate TEXT".",linkTemplateLabel TEXT".",imageTemplate TEXT".",imageTemplateLabel TEXT".", PRIMARY KEY(".lq.")"; $l6u="Registered tables"; break; case (Ov): $O6t=lw." TEXT, ".Ow." TEXT, ".lq." TEXT, ".Oq." INT, ".lx." TEXT, ".Ox." TEXT, ".ly." INT"; $l6u="Saved objects (visualizations, dashboards, searches)"; break; case (Oy): $O6t=lz." TEXT, ".l10." TEXT, ".O10." TEXT, ".l11." INT, ".Oz." TEXT"; $l6u="Run queries"; break; default : $O6t=""; $l6u=""; break; } $l29=dbdbhexecutesqlquery($l5b,"create table ".$l22." ($O6t)" ,$l4x="exec"); if ($l29 === FALSE) { O29( __FUNCTION__ ,lc,O6u($l22)); } else if ($l2t) { echo l6v($l6u); } } return $l29; } function O6v($O2e,$l6w) { $O6r=new user(); if (PHP_SAPI !== "cli" && !$O6r->isloggedin()) return FALSE; $O6w=json_decode($l6w,TRUE); switch ($O2e) { case (Oh): case (Oi): $O22=O6e($O6w); $O4i=l6x(O12); break; case (Og): $O22=l6x(l12); $O4i=""; break; default : $O22=""; $O4i=""; break; } $l29=l58(Ov,$l2t=FALSE); if (ADDTABLEPREFIX == 1) { $O6x= "$O22: "; $l6y=strpos($l6w,$O6x); if ($l6y === strlen("{\"title\":\"")) { $l6w=substr_replace($l6w,"",$l6y,strlen($O6x)); } } else { $O6x=""; } $O6y="\"title\":\"([^\"]+)\""; $l6w=preg_replace( "/$O6y/" ,"\"title\":\"".$O6x."\$1\"",$l6w); preg_match( "/$O6y/" ,$l6w,$O3e); if (count($O3e)>1) { $l6z=$O3e[1]; $O6z=l70($l6z); } else { $O6z=""; } $O27=O4w("select ".lq.", ".Oq." from ".Ov." where ".Ow." = '$O2e' and ".lq." = '".$O6z."'",KIBELLADB,TABLESDIR,$l4x="query",$O24="sqlite"); if (count($O27) == 0) { $l6r="true"; $O5w=1; $O5k=O4w("insert into ".Ov." values(\t'$O22',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$O2e',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$O6z',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$O5w,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$l6w',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$O4i', ".O11.")",KIBELLADB,TABLESDIR,$l4x="exec",$O24="sqlite"); } else { $l6r="false"; $O5w=$O27[0][Oq]+1; $O5k=O4w("update ".Ov." set ".lw." = '$O22', ".Ow." = '$O2e', ".lq." = '$O6z', ".Oq." = $O5w, ".lx." = '$l6w', ".Ox." = '$O4i'"." where ".lq." = '$O6z'" ,KIBELLADB,TABLESDIR,$l4x="exec",$O24="sqlite"); } l5x($O2e,$O6z,$O5w,On,$l6r); } function O70($l5v,$O2e,$O4n) { l58($l5v,$l2t=FALSE); switch ($O2e) { case (Og): case (Oh): case (Oi): $l71=Ow; $O71=lq; $l72=lx; $O5v= "where $l71 = '$O2e'"; $l22=l6x(l12); if ($l22 !== "") { $O5v.=" and ".lw." = '$l22'"; } if ($O4n != "*") { $O4n=str_replace(" ","-",$O4n); $O5v.= " and lower($O71) GLOB lower('*".$O4n."')"; } $l4g=O4w( "select $l71, $O71, $l72\n\t\t\t\t\t\t\t\t\t\t\tfrom $l5v\n\t\t\t\t\t\t\t\t\t\t\t$O5v\n\t\t\t\t\t\t\t\t\t\t\torder by $O71" ,KIBELLADB,TABLESDIR,$l4x="query",$O24="sqlite"); break; case (lh): $O71=lq; $l72=Oq; $l4g=O4w( "select $O71, $l72\n\t\t\t\t\t\t\t\t\t\t\tfrom $l5v\n\t\t\t\t\t\t\t\t\t\t\torder by $O71" ,KIBELLADB,TABLESDIR,$l4x="query",$O24="sqlite"); break; default : O29( __FUNCTION__ ,Oc,"Invalid object type ($O2e). ".ld.".\n"); break; } if ($l4g === FALSE) { O29( __FUNCTION__ ,Oc,"when reading from table '$l5v'. ".ld.".\n"); } else { if ($O2e == Og || $O2e == Oh || $O2e == Oi) { for ($l2v=0; $l2v=0,"Invalid database engine '$lp'. Valid values are: '".implode("' , '",$O65)."'"); } function l66($O66,$O30,$O5a) { $l67=O67($O66,$O30); if ($l67 === FALSE) { return FALSE; } foreach ($l67 as $l60) { if (l3x(strtolower($l60["name"])) === strtolower($O5a)) { return TRUE; } } return FALSE; } function l68($O30,$O3r=FALSE) { if ($O3r) { switch ($O30) { case (O1m): $O68="registered tables"; break; case (l3): $O68="saved objects"; break; case (l1s): $O68="run queries"; break; default : break; } } $O3s=checkdirexistsorcreate(TABLESDIR,$O3r=$O3r,$l3s="The temporary directory with the application's information '".TABLESDIR."' was not found and is being recreated.\n"); if ($O3s === FALSE) { showmessage( __FUNCTION__ ,TAG_ERROR,l69().O69()); return FALSE; } $O66=dbcreatedbh(KIBELLADB); if ($O66->lu() === RC_ERROR_NOTFOUND_DB) { if ($O3r) showmessage("",l16,"Internal database storing the application's information was not found and is being recreated.\n"); $O3s=l6a($O3r=FALSE); return $O3s; } $O3s=O6a($O66,$O30); if ($O3s === RC_ERROR_NOTFOUND_TABLE) { if ($O3r) showmessage("",l16,"The internal table storing the $O68 was not found and is being recreated.\n"); $O3s=l6b($O66->getdbhandle(),$O30,FALSE); } $O66->close(); return $O3s; } function O6a($O66,$O30) { $O5h=O6b($O66,$O30,O19); $l67=dbdbhexecutesqlquery($O66->getdbhandle(),$O5h); if ($l67 === FALSE) { return FALSE; } if (count($l67) == 0) { return RC_ERROR_NOTFOUND_TABLE; } return TRUE; } function O6b($O66,$O30,$l4p) { $l6c=O6c($O66,$O30); return O4o($O66->lp ,$l4p,$l6c); } function O6c($O66,$O30) { $l6c=$O30; return $l6c; } function dbcreatedbh($lo,$Oo=O17,$l6d=array("dir" => TABLESDIR)) { switch ($Oo) { case (O17): return O6d($lo,$l3q=$l6d["dir"]); break; default : global $l6e; showmessage( __FUNCTION__ ,TAG_ERROR,"Invalid DBMS type '$Oo'. Valid values are: '".implode(" , ",$l6e)."'"); return FALSE; break; } } function O6d($l9,$l3q=TABLESDIR,$O6e=array("dbenginePDO" => O18,"attributesPDO" => array( \pdo::ATTR_PERSISTENT => true,\pdo::ATTR_STRINGIFY_FETCHES => false,\pdo::ATTR_ERRMODE => \pdo::ERRMODE_SILENT))) { assert($O6e !== NULL && count($O6e)>=1 && array_key_exists("dbenginePDO",$O6e),"Input array \$optionsPDO contains the minimum required attributes"); if ($l3q !== "") $l9= "$l3q/$l9"; $O4a=$O6e["dbenginePDO"]; $O4b=l4a($O4a); if (array_key_exists("attributesPDO",$O6e) === FALSE) { $O6e["attributesPDO"]=NULL; } $O66=new On($l9,"$O4b:$l9" ,O17,$O4a,$O6e["attributesPDO"]); return $O66; } function l6f($Op,$O30) { $O5h=O4o(O18,O19,$O30); $l67=dbdbhexecutesqlquery($Op,$O5h); if ($l67 === FALSE) { return FALSE; } if (count($l67) == 0) { return RC_ERROR_NOTFOUND_TABLE; } return TRUE; } function O6f($O66,$l6g=FALSE,$O6g="",$l6h=NULL) { if ($l6h == NULL) { $O66->close(); } else { assert(count($l6h)>=2 && array_key_exists("dbhandle",$l6h) && array_key_exists("attachname",$l6h),"Input array \$dbAttachInfo contains the neccessary keys"); $O6h="DETACH DATABASE ".$l6h["attachname"]; dbdbhexecutesqlquery($O66->getdbhandle(),$O6h,$O5="exec"); $l6h["dbhandle"]->close(); } if ($l6g === TRUE && $O6g != "" && $O6g != ":memory:") { unlink($O6g); } } function Ot(&$Op,$l6i=lt) { switch ($l6i) { case (lt): $Op=NULL; break; case (l17): $Op->close(); break; default : $Op=NULL; break; } unset ($Op); } function l6b($Op,$O30,$O3r=FALSE) { assert($Op !== NULL && $Op != FALSE,"The database handle is not null nor false"); $O3s=O6i($Op,$O30); if ($O3s === FALSE) { showmessage( __FUNCTION__ ,l16,l6j($O30)); } else { switch ($O30) { case (O1m): $O6j=O3." TEXT, ".l1n." TEXT, ".O1n." TEXT, ".l1o." TEXT, ".O1l." INT, ".O1o." TEXT, ".l1p." TEXT, ".O1p." TEXT, ".l1q." NUMBER".",imageFields TEXT".",linkTemplate TEXT".",linkTemplateLabel TEXT".",imageTemplate TEXT".",imageTemplateLabel TEXT".",".l1m." TEXT".", PRIMARY KEY(".O3.")"; $l6k="Registered tables"; break; case (l3): $O6j=O1q." TEXT, ".l4." TEXT, ".O3." TEXT, ".O1l." INT, ".l1r." TEXT, ".O1r." TEXT, ".O2." INT, ".l1m." TEXT"; $l6k="Saved objects (visualizations, dashboards, searches)"; break; case (l1s): $O6j=O1s." TEXT, ".O1t." TEXT, ".l1u." TEXT, ".O1u." INT, ".l1t." TEXT"; $l6k="Run queries"; break; default : $O6j=""; $l6k=""; break; } $O3s=dbdbhexecutesqlquery($Op,"create table ".$O30." ($O6j)" ,$O5="exec"); if ($O3s === FALSE) { showmessage( __FUNCTION__ ,TAG_ERROR,O6k($O30)); } else if ($O3r) { echo l6l($l6k); } } return $O3s; } function O6l($Op,$Os) { if ($Os != NULL) { foreach ($Os as $l6m => $l3c) { $Op->setattribute($l6m,$l3c); } } } function O6i($Op,$O30) { $O3s=l6f($Op,$O30); if ($O3s === TRUE) { dbdbhexecutesqlquery($Op,"drop table $O30" ,$O5="exec"); } return $O3s; } function dbdbhexecutesqlquery($Op,$O5h,$O5="query",$l39=NULL) { $l5=FALSE; if ($O5 == "exec") { try { if ($l39 != NULL) { $O6m=@$Op->prepare($O5h); foreach ($l39 as $l6n => $l3c) { $O6m->bindvalue($l6n,$l3c); } $l5=@$O6m->execute(); unset ($O6m); } else { $l5=@$Op->exec($O5h); } } catch ( \pdoexception $O9) { } } else { $O6m=O6n($Op,$O5h); if ($O6m) { if (get_class($O6m) == "PDOStatement") { $l5=$O6m->fetchall( \pdo::FETCH_ASSOC); } else if (get_class($O6m) == "SQLite3Result") { $l5=array(); while ($l6o=$O6m->fetcharray(SQLITE3_ASSOC)) { $l5[]=$l6o; } } } unset ($O6m); } return $l5; } function O6o($O1,$lo,$O30,$lp,$l6p,$O6p,$l6d=array("dir" => DATADIR)) { $l6q=O6q($lo,$O30,$lp,$l6d=$l6d); if ($l6q === FALSE) { return FALSE; } $l6r=""; $O6r=l3t($l6p); $l6s=l3t($O6p); $l5b=""; $O6s=0; $l6t=$l6s; for ($O3u=0; $O3u0) $l5b=","; $l6r.=$l5b.dbgeneratefieldmetadatashort($O6t,$O6v); $O6s ++; } } if ($l6s != NULL) { l6w($l6r,$l6s,$l6q,"kibella\\dbGenerateFieldMetadataShort"); } $O6w="{\"docs\":[{\"".l1f."\":\"".O12."\",\"".O1f."\":\"index-pattern\",\"".l1g."\":\"".$O1."\",\"".O1g."\":1,\"".O1j."\":true,\"".O1h."\":{\"title\":\"".$O1."\","."\"fields\":".l3x($l6r,TRUE)."}"."}]"."}"; return $O6w; } function l6x($O1,$lo,$O30,$lp,$l6p,$O6p,$l6d=array("dir" => DATADIR)) { $l6q=O6q($lo,$O30,$lp,$l6d=$l6d); if ($l6q === FALSE) { return FALSE; } $O6x="{\"".$O1."\":{"."\"mappings\":{"."\"row\":{"."\"_ttl\":{"."\"full_name\":\"_ttl\","."\"mapping\":{"."\"_ttl\":{"."\"enabled\":false,"."\"default\":-1"."}"."}"."}"; $O6r=l3t($l6p); $l6s=l3t($O6p); $l5b=","; $l6t=$l6s; for ($O3u=0; $O3u DATADIR)) { global $O4q; $O66=dbcreatedbh($lo,$Oo=$O4q[$lp],$l6d=$l6d); if ($O66->lu()<0) { return FALSE; } $O3s=O6a($O66,$O30); if ($O3s === FALSE || $O3s<0) { return FALSE; } $l6q=O67($O66,$O30); if ($l6q === FALSE) { return FALSE; } assert(count($l6q)>0,"The number of fields in the table is > 0"); $O66->close(); return $l6q; } function l6y($O6y,$l52,$O1) { l68($O6y,$O3r=FALSE); switch ($l52) { case (O1d): $l6z="where lower(".O3.") = '".strtolower($O1)."'"; break; default : $l6z="where ".l4." = '$l52' and ".O3." = '".$O1."'"; break; } $l5v=dbcreatedbh(KIBELLADB); $l67=dbdbhexecutesqlquery($l5v->getdbhandle(),"select ".O1l." from $O6y $l6z"); if ($l67 !== FALSE && count($l67)>0) { $O6z="true"; $l70=$l67[0][O1l]*1; dbdbhexecutesqlquery($l5v->getdbhandle(),"delete from $O6y $l6z" ,$O5="exec"); } else { $O6z="false"; $l70=1; } if ($l52 == O1d) { l68(l3,$O3r=FALSE); dbdbhexecutesqlquery($l5v->getdbhandle(),"delete from ".l3." where ".O1q." = '$O1'" ,$O5="exec"); } $l5v->close(); O70($l52,$O1,$l70,O1j,$O6z); } function l6v($O6t,$O6v,&$O6r,&$l6s,$l6t) { $l71=FALSE; if ($l6t !== NULL && count($l6t)>0) { $O71="/_geohash[".O1k."-".l1l."]\$/i"; if (preg_match($O71,$O6t) === 1 && array_search(preg_replace($O71,"",strtolower($O6t)),$l6t) !== FALSE) { $l72=""; $O72=""; $l71=TRUE; } } if (!$l71) { $l73=array_search(strtolower($O6t),$O6r); if ($l73 !== FALSE) { $l72="date"; $O72="date"; unset ($O6r[$l73]); } else { $O73=array_search(strtolower($O6t),$l6s); if ($O73 !== FALSE) { $l72="geo_point"; $O72="geo_point"; unset ($l6s[$O73]); } else { switch (( string) strtoupper($O6v)) { case ("DOUBLE"): case ("FLOAT"): case ("REAL"): $l72="number"; $O72="double"; break; case ("BIGINT"): case ("INT"): $l72="number"; $O72="long"; break; case ("TEXT"): case ("VARCHAR"): $l72="string"; $O72="string"; break; default : l74($O6v); $l72="string"; $O72="string"; break; } } } } return array("FieldTypeIndex" => $l72,"FieldTypeMappings" => $O72); } function dbgeneratefieldmetadatalong($O6t,$O6v) { $O35="\"".$O6t."\":{"."\"full_name\":\"".$O6t."\","."\"mapping\":{\"".$O6t."\":{"."\"type\":\"".$O6v."\","; if ($O6v === "date") { $O35.="\"analyzer\":\"_date/16\","."\"search_analyzer\":\"_date/max\","."\"format\":\"yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||epoch_second\","."\"numeric_resolution\":\"seconds\","; } $O35.="\"index\":\"not_analyzed\""."}"."}"."}"; return $O35; } function dbgeneratefieldmetadatashort($O6t,$O6v) { return "{"."\"name\":\"".$O6t."\","."\"type\":\"".$O6v."\","."\"count\":0,"."\"scripted\":false,"."\"indexed\":true,"."\"analyzed\":false,"."\"doc_values\":true"."}"; } function l6w(&$O35,&$l6s,$O74,$l75) { assert($l6s != NULL,"the input geofields array is not null"); foreach ($l6s as $O75) { $O75=strtolower($O75); $l76=FALSE; $O76=FALSE; $l77=FALSE; foreach ($O74 as $l60) { $O6t=$l60["name"]; $O77=strtolower($O6t); if ($O77 === $O75."_lat") $l76=TRUE; if ($O77 === $O75."_lon") $O76=TRUE; $l78=$O75."_geohash"; $O78=substr($O77,0,strlen($l78)); $l79=substr($O77,strlen($l78)); if ($O78 === $l78 && O1k<=$l79 && $l79<=l1l) $l77=TRUE; if ($l76 && $O76 && $l77) break; } if ($l76 && $O76 && $l77) { if ($O35 == "") $l5b=""; else $l5b=","; $O79=substr($O6t,0,strlen($O75)); $O35.=$l5b.call_user_func($l75,$O79,"geo_point"); } unset ($l6s[$O75]); } return $O35; } function O31($O30,$l30) { $l7a=strstr($l30,".",TRUE); if (empty($l7a)) { $l7a=$l30; } return strtoupper($l7a)."(".strtolower($O30).")"; } function O7a() { if (PHP_SAPI !== "cli") { $l7b=str_replace([":","."],"_",$_SERVER["REMOTE_ADDR"]); $O7b=$l7b."_"; } else { $O7b=""; } return "_$O7b".floor(microtime(1))."_".rand(0,023420); } function l7c($O1) { $O6u=FALSE; $O6w=O7c($O1); $l7d=json_decode($O6w,TRUE); if ($l7d != NULL && array_key_exists("docs",$l7d) && count($l7d["docs"])>0) { $O7d=$l7d["docs"][0][O1h]["fields"]; $l7e=json_decode($O7d,TRUE); $O6u=array(); foreach ($l7e as $O7e) { $O6u["\"".$O7e["name"]."\""]=$O7e["type"]; } } return $O6u; } function O5x($l31) { l68(l3,$O3r=FALSE); $l5v=dbcreatedbh(KIBELLADB); $l5x=dbdbhexecutesqlquery($l5v->getdbhandle(),"select ".O1q.", ".O3.", ".l1r." from ".l3." where ".l4." = '".O4."' and ".O1q." = '".$l31."'"); $l5v->close(); if ($l5x == FALSE or count($l5x) == 0) { return FALSE; } return $l5x; } function O62($l31,$O60=0) { l68(l1s,$O3r=FALSE); $l5v=dbcreatedbh(KIBELLADB); $l62=dbdbhexecutesqlquery($l5v->getdbhandle(),"select ".O1s.", ".O1t.", ".l1u.", ".O1u." from ".l1s." where ".O1t." = '".$l31."' and ".O1u." >= $O60"." order by ".O1u." desc"); $l5v->close(); if ($l62 == FALSE or count($l62) == 0) { return FALSE; } return $l62; } function l5z($l31) { l68(l1s,$O3r=FALSE); $l5v=dbcreatedbh(KIBELLADB); $l7f=dbdbhexecutesqlquery($l5v->getdbhandle(),"select ".O1u.", count(*) as n "." from ".l1s." where ".O1t." = '".$l31."'"." group by ".O1u." order by ".O1u." desc"); $l5v->close(); if ($l7f === FALSE or count($l7f) == 0) { return FALSE; } return $l7f; } function O7f($lo,$lp) { if ($lp === O18) { return basename(realpath(DATADIR."/$lo")); } else { return $lo; } } function l5t($l31) { l68(O1m,$O3r=FALSE); $l5v=dbcreatedbh(KIBELLADB); $l7g=dbdbhexecutesqlquery($l5v->getdbhandle(),"select ".l1n.", ".O1n.", ".l1o.", ".l1q." from ".O1m." where ".O3." = '$l31'"); $l5v->close(); if ($l7g == FALSE or count($l7g) == 0) { return FALSE; } $O30=$l7g[0][l1n]; $l30=$l7g[0][O1n]; $lp=l4c($l7g[0][l1o]); $O7g=strtolower(CACHEMODE) !== "none" && ($l7g[0][l1q] == 1); $l7h=array("table" => $O30,"db" => $l30,"dbengine" => $lp,"cache" => $O7g); return $l7h; } function O7c($l31) { l68(O1m,$O3r=FALSE); $l5v=dbcreatedbh(KIBELLADB); $l67=dbdbhexecutesqlquery($l5v->getdbhandle(),"select ".l1n.", ".O1n.", ".l1o.", ".O1o.", ".l1p.", ".O1p." from ".O1m." where lower(".O3.") = '".strtolower($l31)."'"); $l5v->close(); if ($l67 !== FALSE && count($l67)>0) { $O30=$l67[0][l1n]; $l30=$l67[0][O1n]; $lp=l4c($l67[0][l1o]); $l6p=$l67[0][O1o]; $O6p=$l67[0][l1p]; $O7h=$l67[0][O1p]; $O6w=O6o($l31,$l30,$O30,$lp,$l6p,$O6p); } else { $O6w=FALSE; } return $O6w; } function l7i($O1) { l68(O1m,$O3r=FALSE); $l5v=dbcreatedbh(KIBELLADB); $l67=dbdbhexecutesqlquery($l5v->getdbhandle(),"select ".l1n.", ".O1n.", ".l1o.", ".O1o.", ".l1p.", ".O1p." from ".O1m." where lower(".O3.") = '".strtolower($O1)."'"); $l5v->close(); if ($l67 !== FALSE && count($l67)>0) { $O30=$l67[0][l1n]; $l30=$l67[0][O1n]; $lp=l4c($l67[0][l1o]); $l6p=$l67[0][O1o]; $O6p=$l67[0][l1p]; $O7h=$l67[0][O1p]; $O6x=l6x($O1,$l30,$O30,$lp,$l6p,$O6p); } else { $O6x=FALSE; } return $O6x; } function O67($O66,$O30) { $O5h=O6b($O66,$O30,l1a); $l67=dbdbhexecutesqlquery($O66->getdbhandle(),$O5h); return $l67; } function O7i($l7j) { $O7j=json_decode($l7j["kibanaSavedObjectMeta"]["searchSourceJSON"],TRUE); return $O7j["index"]; } function l7k($l52,$O1,$O7k=TRUE) { l68(l3,$O3r=FALSE); $l5v=dbcreatedbh(KIBELLADB); $l7l=dbdbhexecutesqlquery($l5v->getdbhandle(),"select * from ".l3." where ".l4." = '".$l52."' and ".O3." = '".$O1."'"); $l5v->close(); if ($l7l === FALSE) { echo TAG_ERROR_INTERNAL." when reading from Objects table '".l3."'. ".O16.".\n"; } else { if (count($l7l) == 0) { $O7l="{\"".l1f."\":\"".O12."\",\"".O1f."\":\"".$l52."\",\"".l1g."\":\"".$O1."\",\"".O1j."\":false"."}"; if ($O7k) { $O7l="{\"docs\":[".$O7l."]}"; } } else { $O7l="{\"".l1f."\":\"".O12."\",\"".O1f."\":\"".$l7l[0][l4]."\",\"".l1g."\":\"".$l7l[0][O3]."\",\"".O1g."\":".$l7l[0][O1l]*1 .",\"".O1j."\":true,\"".O1h."\":".$l7l[0][l1r]; $l7m=$l7l[0][l1i]; if ($l7m) $O7l.=",\"".l1i."\":".$l7m; $O7l.="}"; if ($O7k) { $O7l="{\"docs\":[".$O7l."]}"; } } O36($O7l); } } function O7m($l31,$l7n,$O7n) { $l7h=l5t($l31); $O30=$l7h["table"]; $l30=$l7h["db"]; $lp=$l7h["dbengine"]; $O5s=$l7h["cache"]; $l7o=O7o($l31,$l7n); $l7p=O7p($l7o,$O5s); if ($l7p === FALSE) { $l7q["xaggs"]=array(); $l7q["yaggs"]=array(); $l7q["filter"]="where ".l1v." = $O7n"; $l7q["onerec"]=$l7q["filter"]; $l7q["discover"]=array("tab" => TRUE,"limit" => 1); global $O4q; O7q($O30,$l30,$O4q[$lp],$l7q,$l7o["responseFileTmp"]); l7r($l7o,$O5s); } O7r($l7o["responseFileFinal"]); } function l7s($O1) { $O6w=O7c($O1); if ($O6w !== FALSE) { $l55=$O6w; } else { $O30=l1y; $l30=l1x; $O1=O31($O30,$l30); $l55="{\"docs\":[{\"".l1f."\":\"".O12."\",\"".O1f."\":\"index-pattern\",\"".l1g."\":\"".$O1."\",\"".O1g."\":1,\"".O1j."\":true,\"".O1h."\":{\"title\":\"".$O1."\","."\"fields\":\"[{}]\""."}"."}]"."}"; } O36($l55); } function O7s($O1) { $O6x=l7i($O1); if ($O6x !== FALSE) { $l55=$O6x; } else { $O30=l1y; $l30=l1x; $O1=O31($O30,$l30); $O6t="_dummy"; $O6v="string"; $l55="{\"".$O1."\":{"."\"mappings\":{"."\"row\":{"."\"_ttl\":{"."\"full_name\":\"_ttl\","."\"mapping\":{"."\"_ttl\":{"."\"enabled\":false,"."\"default\":-1"."}"."}"."},\"".$O6t."\":{"."\"full_name\":\"".$O6t."\","."\"mapping\":{\"".$O6t."\":{"."\"type\":\"".$O6v."\","."\"index\":\"not_analyzed\""."}"."}"."}"."}"."}"."}"."}"; } O36($l55); } function O6n($Op,$O5h) { $O6m=FALSE; if ($Op !== FALSE) { $O6m=@$Op->query($O5h); } return $O6m; } function l7t($O6m) { $l5=FALSE; if ($O6m) { if (get_class($O6m) == "PDOStatement") { $l5=$O6m->fetch( \pdo::FETCH_ASSOC); } else if (get_class($O6m) == "SQLite3Result") { $l5=$O6m->fetcharray(SQLITE3_ASSOC); } } return $l5; } function O7t($l31,$O5h,$l63) { $O3s=l68(l1s,$O3r=FALSE); $l5v=dbcreatedbh(KIBELLADB); $l67=dbdbhexecutesqlquery($l5v->getdbhandle(),"select ".O1s.", ".O1u." from ".l1s." where ".O1s." = '".$l63."'"." and ".O1t." = '$l31'"); $l7u=strftime("%Y/%m/%d %H:%M:%S",time()); if (count($l67) == 0) { $O7u="true"; $O63=1; $l5=dbdbhexecutesqlquery($l5v->getdbhandle(),"insert into ".l1s." values(\t'$l63',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$l31',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$O5h',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$O63,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$l7u'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)" ,$O5="exec"); } else { $O63=$l67[0][O1u]+1; $l5=dbdbhexecutesqlquery($l5v->getdbhandle(),"update ".l1s." set ".O1s." = '$l63', ".O1t." = '$l31', ".l1u." = '$O5h', ".O1u." = $O63, ".l1t." = '$l7u'"." where ".O1s." = '$l63'" ,$O5="exec"); } $l5v->close(); } function dbregistertable($l7v) { $l7=new user(); if (PHP_SAPI !== "cli" && !$l7->isloggedin()) return FALSE; $O30=$l7v["table"]; $l30=$l7v["db"]; $O4b=$l7v["dbengine"]; $l6p=$l7v["datefields"]; $O6p=$l7v["geofields"]; $O7h=$l7v["linkfields"]; $O7v=$l7v["enablecache"]; if ($l30 == "") { showmessage("","note",l7w("Database")); } if ($O30 == "") { showmessage("","note",l7w("Table")); } if ($l30 == "" || $O30 == "") { return FALSE; } $O4a=l4c($O4b); global $O4q; $O66=dbcreatedbh($l30,$Oo=$O4q[$O4a],$l6d=array("dir" => DATADIR)); if ($O66->lu()<0) { $O1=""; $O3s=$O66->lu(); } else { $O3s=O6a($O66,$O30); if ($O3s === FALSE || $O3s<0) { $O1=""; } else { $O3s=FALSE; $l30=O7f($l30,$O4a); $O1=O31($O30,$l30); $O3s=l68(O1m,$O3r=TRUE); if ($O3s === FALSE) { return array("id" => $O1,"rc" => FALSE); } $O3s=FALSE; $l7u=strftime("%Y/%m/%d %H:%M:%S",time()); $l5v=dbcreatedbh(KIBELLADB); $l67=dbdbhexecutesqlquery($l5v->getdbhandle(),"select ".O1l." from ".O1m." where lower(".O3.") = '".strtolower($O1)."'"); if ($l67 === FALSE) { $O3s=FALSE; } else if (count($l67) == 0) { $l70=1; $l5=dbdbhexecutesqlquery($l5v->getdbhandle(),"insert into ".O1m." (".O3.",".l1n.",".O1n.",".l1o.",".O1l.",".O1o.",".l1p.",".O1p.",".l1q.",".l1m.")"." values(\t'$O1',\n\t\t\t\t\t\t\t\t\t\t'$O30',\n\t\t\t\t\t\t\t\t\t\t'$l30',\n\t\t\t\t\t\t\t\t\t\t'$O4b',\n\t\t\t\t\t\t\t\t\t\t$l70,\n\t\t\t\t\t\t\t\t\t\t'$l6p',\n\t\t\t\t\t\t\t\t\t\t'$O6p',\n\t\t\t\t\t\t\t\t\t\t'$O7h',\n\t\t\t\t\t\t\t\t\t\t'$O7v',\n\t\t\t\t\t\t\t\t\t\t'$l7u'\n\t\t\t\t\t\t\t\t\t)" ,$O5="exec"); if ($l5 !== FALSE) $O3s=RC_NOTE_TABLE_ADDED; } else { $l70=$l67[0][O1l]+1; $l5=dbdbhexecutesqlquery($l5v->getdbhandle(),"update ".O1m." set ".l1n." = '$O30', ".O1n." = '$l30', ".l1o." = '$O4b', ".O1l." = $l70, ".O1o." = '$l6p', ".l1p." = '$O6p', ".O1p." = '$O7h', ".l1q." = $O7v, ".l1m." = '$l7u'"." where lower(".O3.") = '".strtolower($O1)."'",$O5="exec"); if ($l5 !== FALSE) $O3s=RC_NOTE_TABLE_UPDATED; } $l5v->close(); } } return array("id" => $O1,"rc" => $O3s); } function l6a($O3r=FALSE) { $O3s=TRUE; $l5v=dbcreatedbh(KIBELLADB); if ($l5v === FALSE) { return FALSE; } $O7w=array(O1m,l3,l1s); $O3s=TRUE; foreach ($O7w as $O30) { $O3s=$O3s && l6b($l5v->getdbhandle(),$O30,$O3r=$O3r); } $l5v->close(); return $O3s; } function l7x($l52,$O7x) { $l7=new user(); if (PHP_SAPI !== "cli" && !$l7->isloggedin()) return FALSE; $l7y=json_decode($O7x,TRUE); switch ($l52) { case (l1e): case (O1e): $l31=O7i($l7y); $O5h=O7y(O1w); break; case (O4): $l31=O7y(l1w); $O5h=""; break; default : $l31=""; $O5h=""; break; } $O3s=l68(l3,$O3r=FALSE); if (ADDTABLEPREFIX == 1) { $l7z= "$l31: "; $O7z=strpos($O7x,$l7z); if ($O7z === strlen("{\"title\":\"")) { $O7x=substr_replace($O7x,"",$O7z,strlen($l7z)); } } else { $l7z=""; } $l80="\"title\":\"([^\"]+)\""; $O7x=preg_replace( "/$l80/" ,"\"title\":\"".$l7z."\$1\"",$O7x); preg_match( "/$l80/" ,$O7x,$l4h); if (count($l4h)>1) { $O80=$l4h[1]; $l81=O81($O80); } else { $l81=""; } $l5v=dbcreatedbh(KIBELLADB); $l67=dbdbhexecutesqlquery($l5v->getdbhandle(),"select ".O3.", ".O1l." from ".l3." where ".l4." = '$l52' and ".O3." = '".$l81."'"); $l7u=strftime("%Y/%m/%d %H:%M:%S",time()); if (count($l67) == 0) { $O7u="true"; $l70=1; $l5=dbdbhexecutesqlquery($l5v->getdbhandle(),"insert into ".l3." values(\t'$l31',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$l52',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$l81',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$l70,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$O7x',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'$O5h', ".O1v.", "."'$l7u'".")",$O5="exec"); } else { $O7u="false"; $l70=$l67[0][O1l]+1; $l5=dbdbhexecutesqlquery($l5v->getdbhandle(),"update ".l3." set ".O1q." = '$l31', ".l4." = '$l52', ".O3." = '$l81', ".O1l." = $l70, ".l1r." = '$O7x', ".O1r." = '$O5h', ".l1m." = '$l7u'"." where ".O3." = '$l81'" ,$O5="exec"); } $l5v->close(); O70($l52,$l81,$l70,l1j,$O7u); } function l82($O6y,$l52,$O5m) { l68($O6y,$O3r=FALSE); switch ($l52) { case (O4): case (l1e): case (O1e): $O82=l4; $l83=O3; $O83=l1r; $l6z= "where $O82 = '$l52'"; if (LISTONLYTABLEOBJECTS === 1) { $O30=O7y(l1w); if ($O30 !== "") { $l6z.=" and ".O1q." = '$O30'"; } } if ($O5m != "*") { $O5m=str_replace(" ","-",$O5m); $l6z.= " and lower($l83) GLOB lower('*".$O5m."')"; } $l5v=dbcreatedbh(KIBELLADB); $l5f=dbdbhexecutesqlquery($l5v->getdbhandle(),"select $O82, $l83, $O83\n\t\t\t\t\t\t\t\t\t\t\t\tfrom $O6y\n\t\t\t\t\t\t\t\t\t\t\t\t$l6z\n\t\t\t\t\t\t\t\t\t\t\t\torder by $l83"); $l5v->close(); break; case (O1d): $l83=O3; $O83=O1l; $l5v=dbcreatedbh(KIBELLADB); $l5f=dbdbhexecutesqlquery($l5v->getdbhandle(),"select $l83, $O83\n\t\t\t\t\t\t\t\t\t\t\t\tfrom $O6y\n\t\t\t\t\t\t\t\t\t\t\t\torder by $l83"); $l5v->close(); break; default : showmessage( __FUNCTION__ ,TAG_ERROR_INTERNAL,"Invalid object type ($l52). ".O16.".\n"); break; } if ($l5f === FALSE) { showmessage( __FUNCTION__ ,TAG_ERROR_INTERNAL,"when reading from table '$O6y'. ".O16.".\n"); } else { if ($l52 == O4 || $l52 == l1e || $l52 == O1e) { for ($O3u=0; $O3u$O77 successfully deleted.
"; } function O2a($l22,$O21,$O28,$O26) { $l78=$O26 == 1 ? "ENABLED": "DISABLED"; return "Table '$l22' in database '$O21' successfully registered with ID '$O28'.\nCache is $l78.\n"; } function l2b($l22,$O21,$O28,$O26) { $l78=$O26 == 1 ? "ENABLED": "DISABLED"; return "The registration information for table '$l22' in database '$O21' with ID '$O28' has been successfully updated.\nCache is $l78.\n"; } function O29($O78,$O2e,$l79) { global $O79; if ($O78 !== "") $O78= "($O78) "; if ($O79) { fwrite($O79,strftime("%Y/%m/%d:%H:%M:%S",time())." ".strtoupper($O2e).": $O78 $l79"); } else { echo "
".strtoupper($O2e).": $O78 $l79
"; } } function O4a($O2h) { global $O79; if ($O79) { $O2g=print_r($O2h,TRUE); fwrite($O79,$O2g); } else { print_r($O2h); } }
\ No newline at end of file
+namespace kibella; function O84($O4r,$l85,$O85,$l3a,$l86=0) { if (DEBUG && O86($l85,$O85) && array_search($O4r,$O85[$l85]) == FALSE) { if ($l86 == 0) { echo "WARNING: (".strtoupper($l3a)."): Invalid keyword '$O4r' for context '$l85'!\n"; } if ($l86 == 1) { echo "WARNING: (".strtoupper($l3a)."): Invalid keyword '$O4r' for context '$l85'! Previous context is maintained.\n"; } else if ($l86 == 2) { echo "WARNING: (".strtoupper($l3a)."): Invalid keyword '$O4r' for context '$l85'! The process may generate unexpected results.\n"; } } } function l87($l85,$l3a) { if (DEBUG) { echo "WARNING: (".strtoupper($l3a)."): Invalid context '$l85'!\n"; } } function l74($l52) { if (DEBUG) { echo "WARNING: Invalid metadata type ('$l52') for the currently used database!\n"; echo " Field type set to STRING.\n"; } } function O87($l52) { if (DEBUG) { echo "WARNING: Invalid aggregation type ('$l52'). No action will be taken on the aggregation type.\n"; } } function l88($l3q) { return "Could not create directory '$l3q'.\n"; } function l7w($O88) { return "Please specify a value for the '$O88' field.\n"; } function l89($lp) { global $O65; return "Invalid database engine ('$lp').\nValid ones are: ".implode("' , '",$O65)."'\n"; } function l69() { return "An error occurred when attempting to create the temporary directory '".TABLESDIR."' with the application's information.\n"; } function O6k($O30) { return "Could not create table '$O30' in the application's database.\n"; } function l6j($O30) { return "Could not drop table '$O30' from the application's database.\n"; } function O69() { return "Check user permissions and try again.\n"; } function l6l($O89) { return "
$O89 successfully deleted.
"; } function showmessage($l8a,$l52,$O8a) { global $l8b; if ($l8a !== "") $l8a= "($l8a) "; if ($l8b) { fwrite($l8b,strftime("%Y/%m/%d:%H:%M:%S",time())." ".strtoupper($l52).": $l8a $O8a"); } else { echo "
".strtoupper($l52).": $l8a $O8a
"; } } function l59($l38) { global $l8b; if ($l8b) { $l37=print_r($l38,TRUE); fwrite($l8b,$l37); } else { print_r($l38); } }
\ No newline at end of file
diff --git a/JSON_SQL_Bridge/functionsparse.php b/JSON_SQL_Bridge/functionsparse.php
index 443758b..103538f 100644
--- a/JSON_SQL_Bridge/functionsparse.php
+++ b/JSON_SQL_Bridge/functionsparse.php
@@ -4,8 +4,8 @@
Copyright 2016 Frank Vanden berghen
All Right reserved.
-JSON_SQL_Bridge is not a free software. The JSON_SQL_Bridge software is NOT licensed under the "Apache License".
-If you are interested in distributing, reselling, modifying, contibuting or in general creating
+JSON_SQL_Bridge is not a free software. The JSON_SQL_Bridge software is NOT licensed under the "Apache License".
+If you are interested in distributing, reselling, modifying, contibuting or in general creating
any derivative work from JSON_SQL_Bridge, please contact Frank Vanden Berghen at frank@timi.eu.
*/
-namespace kibella; function l7a($l6j,$l22,$O21) { $O2h=json_decode($l6j,TRUE); $O22=l23($l22,$O21); $l5r=O2d($O22); $O27=l2h($O2h,"kibella\\parseEsJsonQueryElement",array("fieldtypes" => $l5r)); return $O27; } function parseesjsonqueryelement($O2l,$l3o,$l2j,$O2j,$l2k,$O2i) { static $O7a; static $l7b; static $O7b; static $l7c; static $O7c; static $l7d; static $O7d; static $l7e; static $O7e; static $l7f; static $O7f; static $l7g; static $O7g; static $l7h; static $O7h; static $l7i; static $O7i; static $l7j; static $O7j; static $l7k; static $O7k; static $l7l; static $O7l; static $l7m; static $O7m; static $l7n; static $O7n; static $l7o; static $O7o; static $l7p; static $O7p; static $l7q; static $O7q; static $l7r; static $O7r; static $l7s; static $O7s; static $l7t; static $O7t; static $l7u; static $O7u; static $l7v; global $O7v; global $l7w; if ($l2j == 0 && $O2j == 0) { $O7a=array(); $l7b=array(); $O7b=array(); $l7c=array("level" => 0,"context" => array(O1n),"idx" => array(-1),"size" => array($l2k)); $l7d=array(); $O7d=FALSE; $l7e=FALSE; $O7e=FALSE; $l7f=-1; $O7f=NULL; $l7g=NULL; $O7g=NULL; $l7h=NULL; $O7h=NULL; $l7i=NULL; $O7i=DISCOVERSIZE; $l7j=NULL; $O7j=NULL; $l7k=NULL; $l7l=NULL; $O7k=NULL; $O7l=NULL; $l7m=NULL; $O7m=NULL; $l7n=""; $O7n=l15; $l7o=""; $O7o=NULL; $l7p=NULL; $O7p=NULL; $l7q=""; $O7q=""; $l7r=NULL; $O7r=""; $l7s=NULL; $O7s=NULL; $l7t=NULL; $O7t=NULL; $l7u=NULL; $O7u=NULL; $l7v=""; if (array_key_exists("fieldtypes",$O2i)) $O7a=$O2i["fieldtypes"]; } if ($O2j>$l7c["level"]) { return $O7c; } $l7c["idx"][$l7c["level"]]++; if (is_array($O2l) && count($O2l)>0) { $l7c["level"]++; $O3o=$l7c["context"][$l7c["level"]-1]; $l3o=O3n($l3o,$O3o); if (array_search(NULL,$O7v[$O3o]) !== FALSE || array_search(( string) $l3o,$O7v[$O3o]) !== FALSE || $O3o == l1a && array_search(( string) $l3o,$O7v[l1a][0]) !== FALSE) { if ($l3o === O19) { $l7f ++; } else if ($l3o === l1i) { $O7d=TRUE; } switch ($O3o) { case (O19): $l7m=$l3o; $l7c["context"][]=l1a; $O7s="(CASE"; break; case (l1a): if ($l2l=array_search($l3o,$O7v[l1a][0]) !== FALSE) { $l7u=$l7w[$l3o]; $l7c["context"][]=l1p; } else if ($l2l=array_search($l3o,array_slice($O7v[l1a],1)) !== FALSE) { $l7c["context"][]=$l3o; } else l73($l3o,$O3o,$O7v,"COMPOUND",2); break; case (O1b): if ($l3o === O1j) $l7o=""; else if ($l3o === l1k) $l7o=" not "; $l7c["context"][]=$l3o; break; case (l1f): if (strpos($l3o,"(CASE WHEN ") === 0) { $O7k=$l3o; } else { $O7k=O2x($l3o); } $l7c["context"][]=O1f; break; case (l1g): $l7l=O2x($l3o); $l7c["context"][]=O1g; break; case (l1d): $O7w=O2x($l3o); $l7x=O36($l3o); $O7j=O2x($l7x."_".l1u); $l7k=O2x($l7x."_".O1t); $l7c["context"][]=l1e; break; case (l1e): switch (( string) $l3o) { case (O1d): case (O1e): $l7c["context"][]=$l3o; break; default : l73($l3o,$O3o,$O7v,"LEAF"); break; } break; default : if (gettype($l3o) == "integer") { $O7x=end($l7c["size"]); reset($l7c["size"]); if ($O7x>1) { $l2j=$l3o; if ($l2j == $O7x-1) { $O7q=")"; } if ($l2j == 0) { $l7q="("; } else { $O7n=" and "; $l7q=""; if ($l2j<$O7x-1) $O7q=""; } } $l7c["context"][]=$O3o; } else $l7c["context"][]=$l3o; break; } } else { l73($l3o,$O3o,$O7v,"COMPOUND",1); $l7c["context"][]=$O3o; } if (DEBUG) { echo "CONTEXT history\n"; print_r($l7c["context"]); } $l7c["idx"][]=-1; $l7c["size"][]=count($O2l); $O3o=$l7c["context"][$l7c["level"]]; if (DEBUG) echo "Keyword: $l3o => Entering context ".$O3o."... (field aggregation level is $l7f)\n"; } else { $O2j=$l7c["level"]; $O37=$l7c["idx"][$O2j]; $O7x=$l7c["size"][$O2j]; $O3o=$l7c["context"][$O2j]; $l3o=O3n($l3o,$O3o); switch ($O3o) { case (O1i): case (l1j): $l7b[$l7f]["ofield"]=$l7m; if ($O3o == O1i) $l7b[$l7f]["type"]="h"; else $l7b[$l7f]["type"]="hd"; $l7b[$l7f]["order"]=O2x($l7m); $l7b[$l7f]["limit"]=""; switch (( string) $l3o) { case (O1r): $O7l=O2x($O2l); $l7b[$l7f]["ifieldname"]=$O7l; $l7b[$l7f]["ifield"]=$O7l; break; case (O1v): $l7b[$l7f]["interval"]=$O2l; break; case (O1x): break; default : l73($l3o,$O3o,$O7v,"LEAF"); break; } break; case (O1h): $l7b[$l7f]["ofield"]=$l7m; $l7b[$l7f]["type"]="g"; $l7b[$l7f]["order"]=O2x($l7m); $l7b[$l7f]["limit"]=""; switch (( string) $l3o) { case (O1r): $O7l=$O2l; $l7b[$l7f]["ifieldname"]=O2x(O36($O7l)); break; case (O1y): $l7b[$l7f]["ifield"]=O2x(O36($O7l)."_geohash".$O2l); break; default : l73($l3o,$O3o,$O7v,"LEAF"); break; } break; case (O1d): switch (( string) $l3o) { case (O1t): $l7h=$O2l; break; case (l1u): $O7f=$O2l; break; default : l73($l3o,$O3o,$O7v,"LEAF"); break; } break; case (O1e): switch (( string) $l3o) { case (O1t): $O7g=$O2l; break; case (l1u): $l7g=$O2l; break; default : l73($l3o,$O3o,$O7v,"LEAF"); break; } break; case (O1f): switch (( string) $l3o) { case (l1y): $O7n=$O2l; break; case (l1z): $O7u=$O2l; break; case (l21): if ($O2l === "phrase") $O7r="'"; else $O7r=""; break; default : l73($l3o,$O3o,$O7v,"LEAF"); break; } break; case (l1l): if ($l3o === l1q) { $O7p=$l7w[l17]."(*)"." ".$O2l; } else { $O7p=O2x($l3o)." ".$O2l; } $l7b[$l7f]["order"]=$O7p; break; case (l1m): switch (( string) $l3o) { case (O1p): break; case (l1z): if ($O2l === "*") $l7r=1; else $l7r=$O2l; $l7d[]=trim($l7r); break; default : l73($l3o,$O3o,$O7v,"LEAF"); break; } break; case (O1a): case (l1b): $l7b[$l7f]["ofield"]=$l7m; if ($O3o == O1a) { $l7b[$l7f]["type"]="r"; } else { $l7b[$l7f]["type"]="rd"; } $l7b[$l7f]["order"]=O2x($l7m); $l7b[$l7f]["limit"]=""; switch (( string) $l3o) { case (O1r): $O7l=O2x($O2l); $l7b[$l7f]["ifieldname"]=$O7l; break; default : l73($l3o,$O3o,$O7v,"LEAF"); break; } break; case (O1g): switch (( string) $l3o) { case (O1s): $O7m=$O2l; break; case (O1u): case (l1v): $l7i=$O2l; if ($l3o === O1w) $O7o=">"; else $O7o=">="; break; case (O1w): case (l1x): $O7h=$O2l; if ($l3o === O1w) $l7p="<"; else $l7p="<="; break; default : l73($l3o,$O3o,$O7v,"LEAF"); break; } break; case (l1n): switch (( string) $l3o) { case (l1t): if ($l7b[$l7f]["type"] == "rd") { $O2l=O3c($O2l); } $l7s=$O2l; $l7t=$O2l."-"; break; case (O20): if ($l7b[$l7f]["type"] == "rd") { $O2l=O3c($O2l); } $O7t=$O2l; $l7t.=$O2l; $O7s.="\n\tWHEN ".$l7s." <= ".$O7l." AND ".$O7l." < ".$O7t." THEN "."'".$l7t."'"; $l7b[$l7f]["ranges"][]=$l7t; break; default : l73($l3o,$O3o,$O7v,"LEAF"); break; } break; case (O1n): if ($l3o === l20) { $O7i=$O2l; $l7n=l3r($O7i); } else l73($l3o,$O3o,$O7v,"LEAF"); break; case (l1p): switch (( string) $l3o) { case (O1r): $l7j=O2x($O2l); break; default : l73($l3o,$O3o,$O7v,"LEAF"); break; } break; case (O1o): $l7b[$l7f]["ofield"]=$l7m; $l7b[$l7f]["type"]="t"; switch (( string) $l3o) { case (O1r): $O7l=O2x($O2l); $l7b[$l7f]["ifieldname"]=$O7l; $l7b[$l7f]["ifield"]=$O7l; break; case (l20): $l7n=l3r($O2l); $l7b[$l7f]["limit"]=$l7n; break; default : l73($l3o,$O3o,$O7v,"LEAF"); break; } break; default : O75($O3o,"LEAF"); break; } while ($O37 == $O7x-1 && $O2j>=0) { if (DEBUG) echo "\tRemoving data from level: ".$O2j."\n"; $O2j --; $l7c["level"]=$O2j; foreach (array_slice($l7c,1) as $l7y => $O7y) { array_pop($l7c[$l7y]); } assert($O2j>=-1,"\$level >= -1"); if ($O2j>=0) { switch ($O3o) { case (l1a): $l7j=NULL; $l7m=NULL; $l7u=NULL; break; case (O1a): case (l1b): assert(!is_null($O7s) && !is_null($l7m),"C_AGGS_RANGE: Range grouping ($O7s), FieldOut ($l7m) are not null"); $O7s.="\nEND)"; $l7b[$l7f]["ifield"]=$O7s; break; case (O1d): case (O1e): case (O1f): case (O1g): case (l1m): if ($O3o == O1d && !is_null($O7j) && !is_null($l7k) && !is_null($O7f) && !is_null($l7h)) { if (!$O7e) { $l7z="("; $O7z=""; } else { $l7z=""; $O7z=")"; } $l7r=$l7z.$l7h." <= ".$l7k." and ".$O7j." <= ".$O7f.$O7z; $l7e=TRUE; } else if ($O3o == O1e && !is_null($O7j) && !is_null($l7k) && !is_null($l7g) && !is_null($O7g)) { if (!$l7e) { $l7z="("; $O7z=""; } else { $l7z=""; $O7z=")"; } $l7r=$l7z.$l7g." <= ".$O7j." and ".$l7k." <= ".$O7g.$O7z; $O7e=TRUE; } else if ($O3o == O1f && !is_null($O7k) && !is_null($O7u)) { $l7r=$O7k." = ".$O7r.O2z($O7u).$O7r; } else if ($O3o == O1g && !is_null($l7i) && !is_null($O7h)) { if (array_key_exists($l7l,$O7a) && $O7a[$l7l] === "date") { $l7l=$l7l."*1000"; } $l7r= "$l7l $O7o $l7i and $l7l $l7p $O7h"; } $l80=$l7q.$l7o; if ($l7v == "") $l7v="WHERE"; else { if (($l7e+$O7e)<2) $l80=$O7n.$l7q.$l7o; else $l80=$O7n.$l7q; } if (!is_null($l7r)) { $l7v.="\n".$l80."(".$l7r.")".$O7q; } $l7d[]=trim($l7o.$l7r); $l7q=""; $O7q=""; $O7n=l15; $O7o=NULL; $l7p=NULL; if ($l7e && $O7e) { $O7j=NULL; $l7k=NULL; $l7e=FALSE; $O7e=FALSE; } $O7f=NULL; $l7g=NULL; $O7g=NULL; $l7h=NULL; $O7h=NULL; $l7i=NULL; $O7k=NULL; $l7l=NULL; $O7u=NULL; $l7r=NULL; break; case (l1l): assert(!is_null($O7p),"C_ORDER: Order statistic ($O7p) is not null"); break; case (l1p): assert(!is_null($l7j) && !is_null($l7m) && !is_null($l7u),"C_STATISTIC: Field ($l7j), FieldOut ($l7m), Statistic ($l7u) are not null"); $O7z=str_repeat(")",substr_count($l7u,"(")); $O7b[$l7m]=$l7u."(".$l7j.")".$O7z; $l7j=NULL; break; case (O1o): assert(!is_null($O7l) && !is_null($l7m),"C_TERMS: Grouping field ($O7l), FieldOut ($l7m) are not null"); break; default : break; } $O37=$l7c["idx"][$O2j]; $O7x=$l7c["size"][$O2j]; if ($O3o == O19) { $l7f --; } $O3o=$l7c["context"][$O2j]; } else { if (DEBUG) echo "REACHED LAST KEY-VALUE PAIR\n"; if ($O7d === TRUE) { $l7n=l3r(DISCOVERSIZE); } $O7c=array("xaggs" => $l7b,"yaggs" => $O7b,"filterArray" => $l7d,"filter" => $l7v,"discover" => array("tab" => $O7d,"limit" => $l7n)); return $O7c; } } } } function O80($l81) { $O81=array(); foreach ($l81["xaggs"] as $l49) { $O81[]=l2m($l49); } $O81[]=l2m($l81["yaggs"]); $O81[]=$l81["filterArray"]; sort($O81[count($O81)-1]); $O81[]=l2m($l81["discover"]); return $O81; } function O6m($l22,$O21,$l82,$l3) { $O48=$l82["xaggs"]; $O82=$l82["yaggs"]; $l83=$l82["filter"]; $O83=$l82["discover"]; $l84=fopen($l3,"wt"); if (!$l84) { O29( __FUNCTION__ ,lc,"Error opening or creating file $l3\n. An empty response will be returned.\n"); return ""; } $O84="sqlite"; $l85=dbdbhcreate($O21,$O2r=DATADIR,$l4x=$O84,$O5g=array("dbtype" => "sqlite","attributes" => array( \pdo::ATTR_PERSISTENT => TRUE,\pdo::ATTR_STRINGIFY_FETCHES => FALSE)),$l5h=array("flags" => SQLITE3_OPEN_READONLY)); $O85= "SELECT count(*) from $l22"."\n".$l83; $l86=dbdbhexecutesqlquery($l85,$O85); if ($l86 === FALSE) { $O86=0; } else { $O86=$l86[0]["count(*)"]; } if (DEBUG) { echo "\nTotal Hits:\n"; print_r($l86); } l87($l84,$O86); if ($O83["tab"] === TRUE && count($O48) == 0 && count($O82) == 0) { O2f("[",$O2g=$l84); $O22=l23($l22,$O21); $l5r=O2d($O22); $O87="SELECT rowid as _id"; $l5o=array(); foreach ($l5r as $l2e => $O2e) { if ($O2e === "date") { $O87.=", ".$l2e." as ".$l2e; $l5o[]=str_replace("\"","",$l2e); } else if ($O2e === "geo_point") { if (l5c($l2e,$l22,$O21,$O2r,$O24="sqlite") === TRUE) $O87.=", ".$l2e; } else { $O87.=", ".$l2e; } } $l5k=$O87."\nFROM ".$l22."\n".$l83."\nORDER BY _id"."\n".$O83["limit"]; $l5l=l6p($l85,$l5k); if ($l5l !== FALSE) { $l88=""; while ($O51=O6p($l5l)) { $O28=$O51["_id"]; foreach ($l5o as $O88) { $l89=date_create(strftime("%Y-%m-%d %H:%M:%S",$O51[$O88])); $O3b=(array) $l89; $l3c=timezone_offset_get(new \datetimezone($l89->timezone),$l89); $O51[$O88]=($O51[$O88]-$l3c)*01750; } $O89=($O86-$O28)/$O86; $l8a=$l88."{"."\"".lj."\":\"".$O22."\","."\"".Oj."\":\"row\","."\"".lk."\":\"".$O28."\","."\"".ll."\":".$O89.","."\"".lm."\":".json_encode($O51)."}"; O2f($l8a,$O2g=$l84); $l88=","; } unset ($O51); } unset ($l5l); O2f("]}",$O2g=$l84); } else { O2f("[]}",$O2g=$l84); if (count($O48)>0 || count($O82)>0) { O2f(",\"aggregations\":{",$O2g=$l84); if (count($O48) == 0) { $l88=""; $O8a=""; foreach ($O82 as $l8b => $O8b) { $O8a.= "\n\t$l88".$O8b." as ".O2x($l8b); $l88=","; } $l5k="SELECT".$O8a."\nFROM ".$l22."\n".$l83; $l8c=dbdbhexecutesqlquery($l85,$l5k,$l4x="query"); if ($l8c !== FALSE) { O8c($l84,$l8c[0],0); } } else { $l8d=":memory:"; $O8d=dbdbhcreate($l8d,$O2r="",$l4x=$O84); $l8e="attach database '".$l8d."' as ".Op; dbdbhexecutesqlquery($l85,$l8e,$l4x="exec"); $O2e=$O48[0]["type"]; $O8e="T".l68(); $l8f=$O8e."_T0"; $O8f=l8g($O48[0],$O82,Op.".$l8f" ,$l22,$l83,$l85); if (DEBUG) { echo "Output filename: $l3\n"; echo "\nCreating temporary table $l8f in the temporary database located at ".$l8d."...\n"; echo $O8f; } $l5k=$O8f; $O8g=dbdbhexecutesqlquery($l85,$l5k,$l4x="exec"); if ($O8g !== FALSE) { if (count($O48)>1) { if (DEBUG) echo "\nRecurring to the lower grouping level...\n"; l8h($l84,$l22,$l85,$l83,$l8f,1,$O48,array(),$O82,$O8e,""); } else { $l5k="select * from ".Op.".$l8f"; if (DEBUG) echo "\nSQLQUERY: $l5k\n"; $O8h=array("sqlquery" => $l5k,"db" => $l85,"dbtype" => "sqlite","dir" => TABLESDIR); $l8i=O8i($l84,$O2e,0,$O48,$O8h); if ($l8i>0) l8j($l84,$O2e); } } $O8j=array("dbh" => $O8d,"attachname" => Op); O5d($l85,$l4x=$O84,$l5e=TRUE,$O5e=$l8d,$l5f=$O8j); } O2f("}",$O2g=$l84); } } O2f("}",$O2g=$l84); O5d($l85,$l4x=$O84,$l5e=FALSE); fclose($l84); } function l8h($O3w,$l8k,$l85,$l83,$O8k,$O2j,$O48,$l8l,$O82,$O8l,$l8m) { assert($O2j>0,"Grouping level is larger than 0"); assert(count($O48)>$O2j,"The xaggs array has more than \$level elements (count(\$xaggs)=".count($O48).", level=$O2j)"); assert(count($l8l) == $O2j-1,"The aGroupValuesAndTypes array has \$level-1 elements (count(\$aGroupValuesAndTypes)=".count($l8l).", level-1=$O2j-1)"); $O8m=$O48[$O2j-1]["ofield"]; $l8n=$O48[$O2j-1]["type"]; $l5k="select * from ".Op.".$O8k"; $l5l=l6p($l85,$l5k); $O8n=TEMPDIR."/$O8k"; $l8o=fopen($O8n,"wt"); if (!$l8o) { O29( __FUNCTION__ ,lc,"Cannot open temporary file $O8n for writing. Check directory permissions.\n"); } while ($O51=O6p($l5l)) { $O8o=array_keys($O51); $l8p=implode("|",$O51); fwrite($l8o,$l8p."\n"); } fclose($l8o); unset ($O51); unset ($l5l); $l8o=fopen($O8n,"r"); if (!$l8o) { user_error( "Cannot open temporary file $O8n for reading" ,E_USER_ERROR); } $O8p=-1; $l88=""; while (($l8p=fgets($l8o)) !== FALSE) { $O8p ++; if (DEBUG) echo "Reading row $O8p...\n"; $l8p=preg_replace("/[\n\r]\$/","",$l8p); $l8q=explode("|",$l8p); $O51=array_combine($O8o,$l8q); $O8q=$O51[$O8m]; if ($O8p == 0) { l8r($O3w,$l8n,$O2j-1,$O8m); $l8m.= "_$O8p"; $l8l[]=array("value" => $O8q,"type" => $l8n); } else { $l8m=substr_replace($l8m,$O8p,strrpos($l8m,"_")+1); $l8l[$O2j-1]=array("value" => $O8q,"type" => $l8n); } O8r($O3w,$l8n,$O51,$l88); $l8s=""; for ($O8s=0; $O8s<$O2j; $O8s ++) { $l8t=$O48[$O8s]["ifield_parsed"]; $O8t=$l8l[$O8s]["value"]; $l8u=$l8l[$O8s]["type"]; if ($l8u == "t" || $l8u == "r" || $l8u == "rd") $O8u="'".O2z($O8t)."'"; else $O8u=$O8t; $l8s.=" and ".$l8t." = ".$O8u; } if (strstr($l83,"WHERE") === FALSE) { $l8s=preg_replace("/[ ]+and[ ]+/","WHERE ",$l8s,1); } $l8v=$l83.$l8s; $l8f=$O8l."_S$l8m"; if (DEBUG) echo "Output table name: $l8f\n"; $O8f=l8g($O48[$O2j],$O82,Op.".$l8f" ,$l8k,$l8v,$l85); if (DEBUG) { echo "\n".str_repeat("\t",$O2j)."SQLQUERY Level $O2j:\n"; echo "\nCreating temporary table $l8f in temporary database...\n"; echo $O8f; } $l5k=$O8f; dbdbhexecutesqlquery($l85,$l5k,$l4x="exec"); if ($O2j $l5k,"db" => $l85,"dbtype" => "sqlite","dir" => TABLESDIR); $l8i=O8i($O3w,$O2e,$O2j,$O48,$O8h); if ($l8i>0) { if (DEBUG) echo "Closing Lowest level $O2j...\n"; l8j($O3w,$O2e); } } if (DEBUG) echo "Closing Group value $O8p at level (".$O2j-1 .")...\n"; O2f("}",$O2g=$O3w); $l88=","; } fclose($l8o); if (!unlink($O8n)) { user_error( "Could not delete temporary file $O8n" ,E_USER_WARNING); } if ($O8p>=0) l8j($O3w,$l8n); } function O8v($l8w,$O8w="_count") { return str_ireplace("count(*)",$O8w,$l8w); } function l8g(&$O48,$O82,$l8f,$O8k,$l83,$l5b) { global $O4c; $l40=$O48["ofield"]; $l8x=O2x($l40); $O2e=$O48["type"]; $l44=$O48["ifield"]; $l8w=$O48["order"]; $O8x=$O48["limit"]; switch ($O2e) { case ("r"): case ("rd"): assert(count($O48["ranges"])>0,"There is at least one RANGE value"); $l8y=Op."._ranges"; $l5k= "CREATE TABLE $l8y (_range TEXT, _range_from NUMBER);"; foreach ($O48["ranges"] as $O8y) { $l8z=O3h($O8y); $O8z=$l8z[0]; if ($O8z === "") $O8z="NULL"; $l5k.= "\nINSERT INTO $l8y values ('$O8y', $O8z);"; } if (DEBUG) { echo "SQL for _RANGES:\n"; echo $l5k."\n"; } O5j($l5b,$l8y); dbdbhexecutesqlquery($l5b,$l5k,$l4x="exec"); if (DEBUG) { echo "RESULT _ranges:\n"; $O5k=dbdbhexecutesqlquery($l5b,"select * from $l8y"); print_r($O5k); } $l8w="_range_from"; $l90=$l44; $O48["ifield_parsed"]=$l90; break; case ("h"): case ("hd"): $O44=$O48["interval"]; $l5k= "SELECT min($l44) as _min, max($l44) as _max FROM $O8k $l83"; $O90=dbdbhexecutesqlquery($l5b,$l5k,$l4x="query"); if ($O90 === FALSE || count($O90) == 0) { $l90=""; } else { if ($O90[0]["_min"] === "" || $O90[0]["_max"] === "") { $l90="(CASE WHEN 1 THEN null END)"; } else { if ($O2e == "h") { assert($O44>0,"The histogram interval value (bin size) is positive"); $l91=floor($O90[0]["_min"]/$O44)*$O44; $O91=$O90[0]["_max"]; $l92=floor(($O91-$l91)/$O44)+1; if ($l92 == 0) $O92=1; $l93="(CASE"; $O93=$l91; for ($l2v=0; $l2v<$l92; $l2v ++) { $l94=$O93+$O44; $l93.= "\n\tWHEN $O93 <= $l44 AND $l44 < $l94 THEN $O93"; $O93=$l94; } } else { $l4e=date_create(gmstrftime("%Y-%m-%d %H:%M:%S",$O90[0]["_min"]),new \datetimezone("UTC")); $O4e=(array) $l4e; $l3f=max(1,round(substr($O44,0,strlen($O44)-1)))*1; $O3f=substr($O44,strlen($O44)-1); assert($l3f>0,"The step is positive (value given: $l3f)\n"); assert(array_key_exists($O3f,$O4c) !== FALSE,"The period definition is one of the 7 valid one (value given: $O3f)\n"); $O94=$O90[0]["_max"]-$O90[0]["_min"]; if ($O3f === "s" && $O94>01274) { $l3f=1; $O3f="m"; } if ($O3f === "m" && $O94/074>01274) { $l3f=1; $O3f="h"; } $O48["interval"]=$l3f.$O3f; O3g($l4e,$O3f); $l91=date_timestamp_get($l4e); $O91=$O90[0]["_max"]; $l93="(CASE"; $O93=$l91; while ($O93<=$O91) { date_modify($l4e,"$l3f ".$O4c[$O3f]); $O4e=(array) $l4e; $l94=date_timestamp_get($l4e); $l95=$O93; $l93.= "\n\tWHEN $O93 <= $l44 AND $l44 < $l94 THEN $l95"; $O93=$l94; } } $l90=$l93."\nEND)"; } $O48["ifield_parsed"]=$l90; } break; default : $l90=$l44; $O48["ifield_parsed"]=$l90; break; } $O95=$l90." as ".$l8x; $O8a=""; $l96=""; foreach ($O82 as $l8b => $O8b) { $O8a.="\n\t,".$O8b." as ".O2x($l8b); $l96.="\n\t,".O2x($l8b); } $O87="SELECT"."\n\t".$O95."\n\t,count(*) as _count".$O8a."\nFROM ".$O8k."\n".$l83."\nGROUP BY ".$l90; $l5k= "CREATE TABLE $l8f as"; if ($O2e == "r" or $O2e == "rd") { $l5k.="\nSELECT"."\n\ta._range as ".$l8x."\n\t,IFNULL(b._count,0) as _count".$l96."\nFROM $l8y a"."\nLEFT JOIN ("."\n\t".$O87."\n\t\t) b"."\nON a._range = b.".$l8x; } else { $l5k.="\n".$O87; } assert($l8w != NULL && $l8w != "","Order variable is not null nor empty"); $l8w=O8v($l8w); $l5k.="\nORDER BY ".$l8w."\n".$O8x; return $l5k; } function l87($O3w,$O86) { assert($O86 !== NULL,"The number of total hits is not null"); $O96="{"; $l97="\"took\":0,"."\"timed_out\":false,"."\"_shards\":{"."\"total\":5,"."\"successful\":5,"."\"failed\":0"."},"; $O97="\"hits\":{"."\"total\":".$O86.","."\"max_score\":0,"."\"hits\":"; O2f($O96.$l97.$O97,$O2g=$O3w); } function l8r($O3w,$O2e,$O2j,$l40) { $l98=""; $l88=","; if ($O2j == 0) $l88=""; $l2g=$l88.O2x($l40).":{"; switch ($O2e) { case ("t"): $l2g.="\"doc_count_error_upper_bound\":0,"; $l2g.="\"sum_other_doc_count\":0,"; $l98="["; break; case ("g"): case ("h"): case ("hd"): $l98="["; break; case ("r"): case ("rd"): $l98="{"; break; default : break; } $l2g.="\"".l1c."\":".$l98; O2f($l2g,$O2g=$O3w); } function O8r($O3w,$O2e,$O98,$l88) { l99($O3w,$O2e,$O98,$l88); O8c($O3w,$O98); } function O8i($O3w,$O2e,$O2j,$O48,$O8h) { $O21=$O8h["db"]; $l5k=$O8h["sqlquery"]; $l5l=l6p($O21,$l5k); $O51=O6p($l5l); $l88=""; $l8i=0; if ($O51) { l8r($O3w,$O2e,$O2j,$O48[$O2j]["ofield"]); do { $l8i ++; l99($O3w,$O2e,$O51,$l88); O8c($O3w,$O51); O2f("}",$O2g=$O3w); $O51=O6p($l5l); $l88=","; } while ($O51); } unset ($O51); unset ($l5l); return $l8i; } function l99($O3w,$O2e,$O98,$l88="") { $l2n=array_keys($O98); $O2l=$O98[$l2n[0]]; $l2g=$l88; switch ($O2e) { case ("t"): case ("g"): case ("h"): case ("hd"): $l2g.="{"; if (l3n($O2l) === FALSE) $O99=O2x($O2l); else { if ($O2e == "hd") { if (PHP_SAPI !== "cli") { $O2l=O3a($O2l); } $O99=$O2l*01750; } else $O99=$O2l; } $l2g.="\"key\":".$O99.","; break; case ("r"): case ("rd"): $l2g.=O2x($O2l).":{"; $l4f=O3h($O2l); $l3k=$l4f[0]; $O3k=$l4f[1]; if ($O2e == "rd") { if (PHP_SAPI !== "cli") { $l3k=O3a($l3k); $O3k=O3a($O3k); } $l3k=$l3k*01750; $O3k=$O3k*01750; } $l2g.="\"from\":".$l3k.","; $l2g.="\"from_as_string\":".O2x($l3k).","; $l2g.="\"to\":".$O3k.","; $l2g.="\"to_as_string\":".O2x($O3k).","; break; default : break; } $l2g.="\"doc_count\":".$O98["_count"]; O2f($l2g,$O2g=$O3w); } function O8c($O3w,$O98,$l9a=2) { $l2n=array_keys($O98); $O9a=count($O98); if ($l9a == 0) { $l88=""; } else { $l88=","; } $l2g=""; for ($l2v=$l9a; $l2v<$O9a; $l2v ++) { $l2e=$l2n[$l2v]; $O2l=$O98[$l2n[$l2v]]; $l2g.=$l88.O2x($l2e).":{"; if ($O2l === NULL || $O2l === "") $l2g.="\"value\":null"; else $l2g.="\"value\":".$O2l; $l2g.="}"; $l88=","; } O2f($l2g,$O2g=$O3w); } function l8j($O3w,$O2e) { $l9b=""; switch ($O2e) { case ("t"): case ("g"): case ("h"): case ("hd"): $l9b="]"; break; case ("r"): case ("rd"): $l9b="}"; break; default : break; } $l2g=$l9b."}"; O2f($l2g,$O2g=$O3w); }
\ No newline at end of file
+namespace kibella; use l33\O33\O8b\l8c; function O8c($l7n,$O30,$l30) { $l38=json_decode($l7n,TRUE); $l31=O31($O30,$l30); $O6u=l7c($l31); $l67=O37($l38,"kibella\\parseEsJsonQueryElement",array("fieldtypes" => $O6u)); return $l67; } function parseesjsonqueryelement($l3c,$O4r,$O39,$l3a,$O3a,$l39) { static $l8d; static $O8d; static $l8e; static $O8e; static $l8f; static $O8f; static $l8g; static $O8g; static $l8h; static $O8h; static $l8i; static $O8i; static $l8j; static $O8j; static $l8k; static $O8k; static $l8l; static $O8l; static $l8m; static $O8m; static $l8n; static $O8n; static $l8o; static $O8o; static $l8p; static $O8p; static $l8q; static $O8q; static $l8r; static $O8r; static $l8s; static $O8s; static $l8t; static $O8t; static $l8u; static $O8u; static $l8v; static $O8v; static $l8w; static $O8w; static $l8x; global $O8x; global $l8y; if ($O39 == 0 && $l3a == 0) { $l8d=array(); $O8d=array(); $l8e=array(); $O8e=array("level" => 0,"context" => array(O2h),"idx" => array(-1),"size" => array($O3a)); $O8f=array(); $l8g=FALSE; $O8g=FALSE; $l8h=FALSE; $O8h=-1; $l8i=NULL; $O8i=NULL; $l8j=NULL; $O8j=NULL; $l8k=NULL; $O8k=NULL; $l8l=DISCOVERSIZE; $O8l=NULL; $l8m=NULL; $O8m=NULL; $O8n=NULL; $l8n=NULL; $l8o=NULL; $O8o=NULL; $l8p=NULL; $O8p=l1z; $l8q=""; $O8q=NULL; $l8r=NULL; $O8r=NULL; $l8s=""; $O8s=""; $l8t=NULL; $O8t=""; $l8u=NULL; $O8u=NULL; $l8v=NULL; $O8v=NULL; $l8w=NULL; $O8w=NULL; $l8x=""; if (array_key_exists("fieldtypes",$l39)) $l8d=$l39["fieldtypes"]; } if ($l3a>$O8e["level"]) { return $l8f; } $O8e["idx"][$O8e["level"]]++; if (is_array($l3c) && count($l3c)>0) { $O8e["level"]++; $l4s=$O8e["context"][$O8e["level"]-1]; $O4r=l4r($O4r,$l4s); if (array_search(NULL,$O8x[$l4s]) !== FALSE || array_search(( string) $O4r,$O8x[$l4s]) !== FALSE || $l4s == l24 && array_search(( string) $O4r,$O8x[l24][0]) !== FALSE) { if ($O4r === O23) { $O8h ++; } else if ($O4r === l2c) { $l8g=TRUE; } switch ($l4s) { case (O23): $O8o=$O4r; $O8e["context"][]=l24; $O8u="(CASE"; break; case (l24): if ($O3b=array_search($O4r,$O8x[l24][0]) !== FALSE) { $l8w=$l8y[$O4r]; $O8e["context"][]=l2j; } else if ($O3b=array_search($O4r,array_slice($O8x[l24],1)) !== FALSE) { $O8e["context"][]=$O4r; } else O84($O4r,$l4s,$O8x,"COMPOUND",2); break; case (O25): if ($O4r === O2d) $l8q=""; else if ($O4r === l2e) $l8q=" not "; $O8e["context"][]=$O4r; break; case (l29): if (strpos($O4r,"(CASE WHEN ") === 0) { $l8n=$O4r; } else { $l8n=l3x($O4r); } $O8e["context"][]=O29; break; case (l2a): $O8n=l3x($O4r); $O8e["context"][]=O2a; break; case (l27): $O8y=l3x($O4r); $l8z=l46($O4r); $l8m=l3x($l8z."_".l2o); $O8m=l3x($l8z."_".O2n); $O8e["context"][]=l28; break; case (l28): switch (( string) $O4r) { case (O27): case (O28): $O8e["context"][]=$O4r; break; default : O84($O4r,$l4s,$O8x,"LEAF"); break; } break; default : if (gettype($O4r) == "integer") { $O8z=end($O8e["size"]); reset($O8e["size"]); if ($O8z>1) { $O39=$O4r; if ($O39 == $O8z-1) { $O8s=")"; } if ($O39 == 0) { $l8s="("; } else { $O8p=" and "; $l8s=""; if ($O39<$O8z-1) $O8s=""; } } $O8e["context"][]=$l4s; } else $O8e["context"][]=$O4r; break; } } else { O84($O4r,$l4s,$O8x,"COMPOUND",1); $O8e["context"][]=$l4s; } if (DEBUG) { echo "CONTEXT history\n"; print_r($O8e["context"]); } $O8e["idx"][]=-1; $O8e["size"][]=count($l3c); $l4s=$O8e["context"][$O8e["level"]]; if (DEBUG) echo "Keyword: $O4r => Entering context ".$l4s."... (field aggregation level is $O8h)\n"; } else { $l3a=$O8e["level"]; $l47=$O8e["idx"][$l3a]; $O8z=$O8e["size"][$l3a]; $l4s=$O8e["context"][$l3a]; $O4r=l4r($O4r,$l4s); switch ($l4s) { case (O2c): case (l2d): $O8d[$O8h]["ofield"]=$O8o; if ($l4s == O2c) $O8d[$O8h]["type"]="h"; else $O8d[$O8h]["type"]="hd"; $O8d[$O8h]["order"]=l3x($O8o); $O8d[$O8h]["limit"]=0; switch (( string) $O4r) { case (O2l): $l8o=l3x($l3c); $O8d[$O8h]["ifieldname"]=$l8o; $O8d[$O8h]["ifield"]=$l8o; break; case (O2p): $O8d[$O8h]["interval"]=$l3c; break; case (O2r): break; default : O84($O4r,$l4s,$O8x,"LEAF"); break; } break; case (O2b): $O8d[$O8h]["ofield"]=$O8o; $O8d[$O8h]["type"]="g"; $O8d[$O8h]["order"]=l3x($O8o); $O8d[$O8h]["limit"]=0; switch (( string) $O4r) { case (O2l): $l8o=$l3c; $O8d[$O8h]["ifieldname"]=l3x(l46($l8o)); break; case (O2s): $O8d[$O8h]["ifield"]=l3x(l46($l8o)."_geohash".$l3c); break; default : O84($O4r,$l4s,$O8x,"LEAF"); break; } break; case (O27): switch (( string) $O4r) { case (O2n): $O8j=$l3c; break; case (l2o): $l8i=$l3c; break; default : O84($O4r,$l4s,$O8x,"LEAF"); break; } break; case (O28): switch (( string) $O4r) { case (O2n): $l8j=$l3c; break; case (l2o): $O8i=$l3c; break; default : O84($O4r,$l4s,$O8x,"LEAF"); break; } break; case (O29): switch (( string) $O4r) { case (l2s): $O8p=$l3c; break; case (l2t): $O8w=l40($l3c); break; case (l2v): if ($l3c === "phrase") $O8t="'"; else $O8t=""; break; default : O84($O4r,$l4s,$O8x,"LEAF"); break; } break; case (l2f): if ($O4r === l2k) { $O8r=$l8y[l21]."(*)"." ".$l3c; } else { $O8r=l3x($O4r)." ".$l3c; } assert(!is_null($O8d[$O8h]["ifield"]),"The aggregation field name is NOT null"); $O8d[$O8h]["order"]=$O8r.", ".$O8d[$O8h]["ifield"]; break; case (l2g): switch (( string) $O4r) { case (O2j): break; case (l2t): if ($l3c === "*") $l8t="1 = 1"; else $l8t=$l3c; $O8f[]=trim($l8t); break; default : O84($O4r,$l4s,$O8x,"LEAF"); break; } break; case (O24): case (l25): $O8d[$O8h]["ofield"]=$O8o; if ($l4s == O24) { $O8d[$O8h]["type"]="r"; } else { $O8d[$O8h]["type"]="rd"; } $O8d[$O8h]["order"]=l3x($O8o); $O8d[$O8h]["limit"]=0; switch (( string) $O4r) { case (O2l): $l8o=l3x($l3c); $O8d[$O8h]["ifieldname"]=$l8o; break; default : O84($O4r,$l4s,$O8x,"LEAF"); break; } break; case (O2a): switch (( string) $O4r) { case (O2m): $l8p=$l3c; break; case (O2o): case (l2p): $O8k=$l3c; if ($O4r === O2q) $O8q=">"; else $O8q=">="; break; case (O2q): case (l2r): $l8k=$l3c; if ($O4r === O2q) $l8r="<"; else $l8r="<="; break; default : O84($O4r,$l4s,$O8x,"LEAF"); break; } break; case (l2h): switch (( string) $O4r) { case (l2n): if ($O8d[$O8h]["type"] == "rd") { $l3c=l4f($l3c); } $l8u=$l3c; $l8v=$l3c."-"; break; case (O2u): if ($O8d[$O8h]["type"] == "rd") { $l3c=l4f($l3c); } $O8v=$l3c; $l8v.=$l3c; $O8u.=O1c."WHEN ".$l8u." <= ".$l8o." AND ".$l8o." < ".$O8v." THEN "."'".$l8v."'"; $O8d[$O8h]["ranges"][]=$l8v; break; default : O84($O4r,$l4s,$O8x,"LEAF"); break; } break; case (O2h): if ($O4r === l2u) { $l8l=$l3c; } else O84($O4r,$l4s,$O8x,"LEAF"); break; case (l2j): switch (( string) $O4r) { case (O2l): $O8l=l3x($l3c); break; default : O84($O4r,$l4s,$O8x,"LEAF"); break; } break; case (O2i): $O8d[$O8h]["ofield"]=$O8o; $O8d[$O8h]["type"]="t"; switch (( string) $O4r) { case (O2l): $l8o=l3x($l3c); $O8d[$O8h]["ifieldname"]=$l8o; $O8d[$O8h]["ifield"]=$l8o; break; case (l2u): $l8l=$l3c; $O8d[$O8h]["limit"]=$l8l; break; default : O84($O4r,$l4s,$O8x,"LEAF"); break; } break; default : l87($l4s,"LEAF"); break; } while ($l47 == $O8z-1 && $l3a>=0) { if (DEBUG) echo "\tRemoving data from level: ".$l3a."\n"; $l3a --; $O8e["level"]=$l3a; foreach (array_slice($O8e,1) as $l90 => $O90) { array_pop($O8e[$l90]); } assert($l3a>=-1,"\$level >= -1"); if ($l3a>=0) { switch ($l4s) { case (l24): $O8l=NULL; $O8o=NULL; $l8w=NULL; break; case (O24): case (l25): assert(!is_null($O8u) && !is_null($O8o),"C_AGGS_RANGE: Range grouping ($O8u), FieldOut ($O8o) are not null"); $O8u.="\nEND)"; $O8d[$O8h]["ifield"]=$O8u; break; case (O27): case (O28): case (O29): case (O2a): case (l2g): if ($l4s == O27 && !is_null($l8m) && !is_null($O8m) && !is_null($l8i) && !is_null($O8j)) { if (!$l8h) { $l91="("; $O91=""; } else { $l91=""; $O91=")"; } $l8t=$l91.$O8j." <= ".$O8m." and ".$l8m." <= ".$l8i.$O91; $O8g=TRUE; } else if ($l4s == O28 && !is_null($l8m) && !is_null($O8m) && !is_null($O8i) && !is_null($l8j)) { if (!$O8g) { $l91="("; $O91=""; } else { $l91=""; $O91=")"; } $l8t=$l91.$O8i." <= ".$l8m." and ".$O8m." <= ".$l8j.$O91; $l8h=TRUE; } else if ($l4s == O29 && !is_null($l8n) && !is_null($O8w)) { $l8t=$l8n." = ".$O8t.l3z($O8w).$O8t; } else if ($l4s == O2a && !is_null($O8k) && !is_null($l8k)) { if (array_key_exists($O8n,$l8d) && $l8d[$O8n] === "date") { $O8n=$O8n."*1000"; } $l8t= "$O8n $O8q $O8k and $O8n $l8r $l8k"; } $l92=$l8s.$l8q; if ($l8x == "") $l8x="WHERE"; else { if (($O8g+$l8h)<2) $l92=$O8p.$l8s.$l8q; else $l92=$O8p.$l8s; } if (!is_null($l8t)) { $l8x.="\n".$l92."(".$l8t.")".$O8s; } $O8f[]=trim($l8q.$l8t); $l8s=""; $O8s=""; $O8p=l1z; $O8q=NULL; $l8r=NULL; if ($O8g && $l8h) { $l8m=NULL; $O8m=NULL; $O8g=FALSE; $l8h=FALSE; } $l8i=NULL; $O8i=NULL; $l8j=NULL; $O8j=NULL; $l8k=NULL; $O8k=NULL; $l8n=NULL; $O8n=NULL; $O8w=NULL; $l8t=NULL; break; case (l2f): assert(!is_null($O8r),"C_ORDER: Order statistic ($O8r) is not null"); break; case (l2j): assert(!is_null($O8l) && !is_null($O8o) && !is_null($l8w),"C_STATISTIC: Field ($O8l), FieldOut ($O8o), Statistic ($l8w) are not null"); $O91=str_repeat(")",substr_count($l8w,"(")); $l8e[$O8o]=$l8w."(".$O8l.")".$O91; $O8l=NULL; break; case (O2i): assert(!is_null($l8o) && !is_null($O8o),"C_TERMS: Grouping field ($l8o), FieldOut ($O8o) are not null"); break; default : break; } $l47=$O8e["idx"][$l3a]; $O8z=$O8e["size"][$l3a]; if ($l4s == O23) { $O8h --; } $l4s=$O8e["context"][$l3a]; } else { if (DEBUG) echo "REACHED LAST KEY-VALUE PAIR\n"; if ($l8g === TRUE) { $l8l=DISCOVERSIZE; } $l8f=array("xaggs" => $O8d,"yaggs" => $l8e,"filterArray" => $O8f,"filter" => $l8x,"discover" => array("tab" => $l8g,"limit" => $l8l)); return $l8f; } } } } function O92($l93) { $O93=array(); foreach ($l93["xaggs"] as $O57) { $O93[]=O3c($O57); } $O93[]=O3c($l93["yaggs"]); $O93[]=$l93["filterArray"]; sort($O93[count($O93)-1]); $O93[]=O3c($l93["discover"]); return $O93; } function O7q($O30,$l30,$Oo,$l94,$ly) { $l31=O31($O30,$l30); $l57=$l94["xaggs"]; $O94=$l94["yaggs"]; $l95=$l94["filter"]; $O95=array_key_exists("onerec",$l94); $l96=$l94["discover"]; $O96=$l94["discover"]["limit"]; $l97=fopen($ly,"wt"); if (!$l97) { showmessage( __FUNCTION__ ,TAG_ERROR,"Error opening or creating file $ly\n. An empty response will be returned.\n"); return ""; } $O97=dbcreatedbh($l30,$Oo=$Oo,$l6d=array("dir" => DATADIR)); $l98=O98($O97,$O30,$l95,$O95); if (l99($l94,$l57,$O94)) { O99($O97,$O30,$l31,$l95,$l98,$O96,$l37=$l97); } else if (count($l57)+count($O94)>0) { l9a($O97,$O30,$l95,$l57,$O94,$l98,$l37=$l97); } else { $O9a=l9b($O97->getdbhandle(),$O30,$l95); O9b($O9a,$l37=$l97); O36("[]}",$l37=$l97); } O36("}",$l37=$l97); O6f($O97,$l6g=FALSE); fclose($l97); } function l9b($Op,$O30,$l95) { $l9c= "SELECT count(*) as _count from $O30"."\n".$l95; $O9c=dbdbhexecutesqlquery($Op,$l9c); if ($O9c === FALSE) { $O9a=0; } else { $O9a=$O9c[0]["_count"]; } if (DEBUG) { echo "\nTotal Hits:\n"; print_r($O9c); } return $O9a; } function l99($l9d,$l57,$O94) { assert(array_key_exists("discover",$l9d) && array_key_exists("limit",$l9d["discover"]) && array_key_exists("filter",$l9d),"The required keys exist in the input array \$aParseResult"); return $l9d["discover"]["tab"] === TRUE && count($l57) == 0 && count($O94) == 0; } function O99($O66,$O30,$l31,$l95,$O9d,$O96,$l37=NULL) { global $l9e; $l6c=O6c($O66,$O30); $O9e="SELECT ".O4u($O96,$O66->lp ,$l4v=0)." * FROM ("."SELECT ".$l9e[O1b][$O66->lp ]." as ".l1v; $O6u=l7c($l31); $O6r=array(); foreach ($O6u as $O5a => $l52) { if ($l52 === "date") { $O9e.=",".$O5a." as ".$O5a; $O6r[]=str_replace("\"","",$O5a); } else if ($l52 === "geo_point") { if (l66($O66,$l6c,$O5a) === TRUE) $O9e.=",".$O5a; } else { $O9e.=",".$O5a; } } $l9f=$O9d."(".$O9e."\nFROM ".$l6c.") innerQueryWithRowNumber"."\n".$l95."\n".O4u($O96,$O66->lp ,$l4v=1).") mainQuery"; $O6m=O6n($O66->getdbhandle(),$l9f); if ($O6m === FALSE) { O9b(0,$l37=$l37); O36("[",$l37=$l37); } else { $O9f=""; $l9g=0; while ($l60=l7t($O6m)) { $l9g ++; if ($l9g == 1) { $O9a=$l60["_count"]; O9b($O9a,$l37=$l37); O36("[",$l37=$l37); } foreach ($O6r as $O9g) { $l9h=date_create(strftime("%Y-%m-%d %H:%M:%S",$l60[$O9g])); $l4e=(array) $l9h; $O4e=timezone_offset_get(new \datetimezone($l9h->timezone),$l9h); $l60[$O9g]=($l60[$O9g]-$O4e)*01750; } $O9h=(PHP_INT_MAX-$l9g)/PHP_INT_MAX; $l9i=$O9f."{"."\"".l1f."\":\"".$l31."\","."\"".O1f."\":\"row\","."\"".l1g."\":\"".$l9g."\","."\"".l1h."\":".$O9h.","."\"".O1h."\":".json_encode($l60)."}"; O36($l9i,$l37=$l37); $O9f=","; } unset ($l60); } unset ($O6m); O36("]}",$l37=$l37); } function l9a($O66,$O30,$l95,$l57,$O94,$O9d,$l37=NULL) { if (count($l57) == 0) { O9i($O66,$O30,$l95,$O94,$O9d,$l37=$l37); } else { $O9a=l9b($O66->getdbhandle(),$O30,$l95); O9b($O9a,$l37=$l37); O36("[]}",$l37=$l37); O36(",\"aggregations\":{",$l37=$l37); l9j($O66,$O30,$l95,$l57,$O94,$l37=$l37); } O36("}",$l37=$l37); } function O98($O66,$O30,$l95,$O95) { if ($O95) { $O9j="WITH cnt as (SELECT ".O4u(1,$O66->lp ,$l4v=0)." 1 as _count FROM $O30 ".O4u(1,$O66->lp ,$l4v=1).")"."\nSELECT * FROM cnt"."\nCROSS JOIN "; } else { $O9j="WITH cnt as (SELECT count(*) as _count FROM ".$O30." ".$l95.")"."\nSELECT * FROM cnt"."\nCROSS JOIN "; } return $O9j; } function O9i($O66,$O30,$l95,$O94,$O9d,$l37=NULL) { $l9k=O9k($O94); $O9e=l9l($O30,$l95,"","",$l9k); $l9f=$O9d."(SELECT ".$O9e.") mainQuery"; $O9l=dbdbhexecutesqlquery($O66->getdbhandle(),$l9f,$O5="query"); if ($O9l === FALSE) { O9b(0,$l37=$l37); O36("[]",$l37=$l37); } else { assert(count($O9l) == 1,"There is exactly one row returned by the only-Y-axis-aggregations query"); $O9a=$O9l[0]["_count"]; O9b($O9a,$l37=$l37); O36("[]}",$l37=$l37); O36(",\"aggregations\":{",$l37=$l37); l9m($O9l[0],$O9m=1,$O9f="",$l37=$l37); } } function l9j($O66,$O30,$l95,$l57,$O94,$l37=NULL) { $l9k=O9k($O94); l9n($O66,$O30,$l95,$l57,0,$O94,$l9k,$l37=$l37); } function l9n($O66,$O30,$l95,$l57,$l3a,$O94,$l9k,$l37=NULL) { assert($l3a>=0,"Grouping level is non-negative"); assert(count($l57)>$l3a,"The xaggs array has more than \$level elements (count(\$xaggs)=".count($l57).", level=$l3a)"); $l9f=O9n($O66,$O30,$l95,$l57,$l3a,$O94); $O6m=O6n($O66->getdbhandle(),$l9f); $l60=l7t($O6m); $O9f=""; $l9o=0; if ($l60) { O9o($l57[$l3a]["type"],$l3a,$l57[$l3a]["ofield"],$l37=$l37); do { l9p($l57[$l3a]["type"],$l60,$O9f,$l37=$l37); $O9p=($l3a == count($l57)-1); if (!$O9p) { $l9q=$l60[$l57[$l3a]["ofield"]]; $O9q=l9r($l95,$l57,$l3a,$l9q); $O9r=dbcreatedbh($O66->lo ,$Oo=$O66->Oo ,$l6d=array("dir" => "")); l9n($O9r,$O30,$O9q,$l57,$l3a+1,$O94,$l9k,$l37=$l37); unset ($O9r); } O36("}",$l37=$l37); $l60=l7t($O6m); $O9f=","; } while ($l60); l9s($l57[$l3a]["type"],$l37=$l37); } unset ($l60); unset ($O6m); } function l9r($l95,$l57,$l3a,$l9q) { $O9s=$l57[$l3a]["ifield_parsed"]; $l9t=$l57[$l3a]["type"]; if ($l9t == "t" || $l9t == "r" || $l9t == "rd") $O9t="'".l3z($l9q)."'"; else $O9t=$l9q; if (preg_match("/^\\s*WHERE/",$l95)>0) { $O4r=" AND "; } else { $O4r="WHERE "; } return $l95.$O4r.$O9s." = ".$O9t; } function O9n($O66,$O30,$l95,&$l57,$l3a,$O94) { $l57[$l3a]=l9u($O66,$O30,$l95,$l57[$l3a],$O94); $O9u=l3x($l57[$l3a]["ofield"]); $l9v=O9v($O66,$O30,$l95,$l57,$l3a,$O94); $l9k=O9k($O94); $O9e=l9l($O30,$l95,$l9v["field"],$l9v["statement"],$l9k); $l9f=""; if ($l57[$l3a]["type"] == "r" or $l57[$l3a]["type"] == "rd") { $l9f.="\nSELECT".$l57[$l3a]["ranges_clause"]." r"."\nLEFT JOIN (".O1c."SELECT ".$O9e.O1c."\t) d"."\nON r._range = d.".$O9u; } else { $l9f.="\nSELECT ".O4u($l57[$l3a]["limit"],$O66->lp ,$l4v=0).$O9e; } assert($l57[$l3a]["order"] != NULL && $l57[$l3a]["order"] != "","Order variable is not null nor empty"); $l9w=O9w($l57[$l3a]["order"]); $l9f.="\nORDER BY ".$l9w."\n".O4u($l57[$l3a]["limit"],$O66->lp ,$l4v=1); return $l9f; } function l9u($O66,$O30,$l95,$l9x,$O94) { switch ($l9x["type"]) { case ("r"): case ("rd"): $O9x=l9y($O66,$l9x["ofield"],$l9x["ranges"],$O94); $l9x["order"]=$O9x["order"]; $l9x["ifield_parsed"]=$l9x["ifield"]; $l9x["ranges_clause"]=$O9x["sqlclause"]; break; case ("h"): case ("hd"): $O9x=O9y($O66,$O30,$l95,$l9x["ifield"],$l9x["type"],$l9x["interval"]); $l9x["ifield_parsed"]=$O9x["sqlclause"]; $l9x["interval"]=$O9x["interval"]; break; default : $l9x["ifield_parsed"]=$l9x["ifield"]; break; } return $l9x; } function l9y($O66,$l4y,$l9z,$O94) { assert(count($l9z)>0,"There is at least one RANGE value"); global $l9e; $O9u=l3x($l4y); $l9k=O9k($O94,$O9z=TRUE); $la0=O1c."_range as ".$O9u.O1c.",".$l9e[l1c][$O66->lp ]."(_count,0) as _count".$l9k."\nFROM ("; $Oa0=""; foreach ($l9z as $O4k) { $la1=l4k($O4k); $Oa1=$la1[0]; if ($Oa1 === "") $Oa1="NULL"; $la0.=$Oa0."\nSELECT '$O4k' as _range, $Oa1 as _range_from"; $Oa0="\nUNION "; } $la0.="\n)"; if (DEBUG) { echo "SQL for _RANGES:\n"; echo $la0."\n"; } return array("sqlclause" => $la0,"order" => "_range_from"); } function O9y($O66,$O30,$l95,$O5a,$la2,$l53) { global $O5b; assert($la2 === "h" || $la2 === "hd","The histogram aggregation type is either 'h' or 'hd'"); $Oa2= function (&$la3,&$l5d,$Oa3,$la4) { $Oa4=$la4-$Oa3; if ($l5d === "s" && $Oa4>l1k) { $la3=1; $l5d="m"; } if ($l5d === "m" && $Oa4/074>l1k) { $la3=1; $l5d="h"; } $l53=$la3.$l5d; return $l53; }; $l9f= "SELECT min($O5a) as _min, max($O5a) as _max FROM $O30 $l95"; $la5=dbdbhexecutesqlquery($O66->getdbhandle(),$l9f,$O5="query"); if ($la5 === FALSE || count($la5) == 0) { $la0=""; } else { $Oa5=$la5[0]["_min"]; $la6=$la5[0]["_max"]; if ($Oa5 === "" || $la6 === "") { $la0="(CASE WHEN 1 THEN null END)"; } else { if ($la2 == "h") { assert($l53>0,"The histogram interval value (bin size) is positive"); $Oa6=floor($Oa5/$l53)*$l53; $la7=$la6; $Oa7=floor(($la7-$Oa6)/$l53)+1; if ($Oa7 == 0) $la8=1; $Oa8="(CASE"; $la9=$Oa6; for ($O3u=0; $O3u<$Oa7; $O3u ++) { $Oa9=$la9+$l53; $Oa8.=O1c."WHEN $la9 <= $O5a AND $O5a < $Oa9 THEN $la9"; $la9=$Oa9; } } else { $l5d=date_create(gmstrftime("%Y-%m-%d %H:%M:%S",$Oa5),new \datetimezone("UTC")); $O5d=(array) $l5d; $la3=max(1,round(substr($l53,0,strlen($l53)-1)))*1; $l4i=substr($l53,strlen($l53)-1); assert($la3>0,"The date step is positive (value given: $la3)\n"); assert(array_key_exists($l4i,$O5b) !== FALSE,"The period definition is one of the 7 valid one (value given: $l4i)\n"); $l53=$Oa2($la3,$l4i,$Oa5,$la6); l4j($l5d,$l4i); $Oa6=date_timestamp_get($l5d); $la7=$la6; $Oa8="(CASE"; $la9=$Oa6; while ($la9<=$la7) { date_modify($l5d,"$la3 ".$O5b[$l4i]); $O5d=(array) $l5d; $Oa9=date_timestamp_get($l5d); $laa=$la9; $Oa8.=O1c."WHEN $la9 <= $O5a AND $O5a < $Oa9 THEN $laa"; $la9=$Oa9; } } $la0=$Oa8."\nEND)"; } } return array("sqlclause" => $la0,"interval" => $l53); } function O9v($O66,$O30,$l95,&$l57,$l3a,$O94) { $l57[$l3a]=l9u($O66,$O30,$l95,$l57[$l3a],$O94); $O9u=l3x($l57[$l3a]["ofield"]); $Oaa=$l57[$l3a]["ifield_parsed"]." as ".$O9u; $lab="GROUP BY ".$l57[$l3a]["ifield_parsed"]; return array("field" => $Oaa,"statement" => $lab); } function O9k($O94,$O9z=FALSE) { $l9k=""; if ($O9z === TRUE) { foreach (array_keys($O94) as $Oab) { $l9k.=O1c.",".l3x($Oab); } } else { foreach ($O94 as $Oab => $lac) { $l9k.=O1c.",".$lac." as ".l3x($Oab); } } return $l9k; } function l9l($O30,$l95,$Oac,$lab,$lad) { $Oad=""; if (strlen($Oac)>0) { $Oad=","; } $O9e=O1c.$Oac.O1c.$Oad."count(*) as _count".$lad."\nFROM ".$O30."\n".$l95."\n".$lab; return $O9e; } function O9w($l9w,$lae="_count") { return str_ireplace("count(*)",$lae,$l9w); } function O9b($O9a,$l37=NULL) { assert($O9a !== NULL,"The number of total hits is not null"); $Oae="{"; $laf="\"took\":0,"."\"timed_out\":false,"."\"_shards\":{"."\"total\":5,"."\"successful\":5,"."\"failed\":0"."},"; $Oaf="\"hits\":{"."\"total\":".$O9a.","."\"max_score\":0,"."\"hits\":"; O36($Oae.$laf.$Oaf,$l37=$l37); } function O9o($l52,$l3a,$l4y,$l37=NULL) { $lag=""; $O9f=","; if ($l3a == 0) $O9f=""; $O35=$O9f.l3x($l4y).":{"; switch ($l52) { case ("t"): $O35.="\"doc_count_error_upper_bound\":0,"; $O35.="\"sum_other_doc_count\":0,"; $lag="["; break; case ("g"): case ("h"): case ("hd"): $lag="["; break; case ("r"): case ("rd"): $lag="{"; break; default : break; } $O35.="\"".l26."\":".$lag; O36($O35,$l37=$l37); } function l9p($l52,$Oag,$O9f,$l37=NULL) { lah($l52,$Oag,$O9f,$l37=$l37); l9m($Oag,$O9m=2,$Oah=",",$l37=$l37); } function lah($l52,$Oag,$O9f="",$l37=NULL) { $O3d=array_keys($Oag); $l3c=$Oag[$O3d[0]]; $O35=$O9f; switch ($l52) { case ("t"): case ("g"): case ("h"): case ("hd"): $O35.="{"; if (l35($l3c) === FALSE) $lai=l3x($l3c); else { if ($l52 == "hd") { if (PHP_SAPI !== "cli") { $l3c=l4d($l3c); } $lai=$l3c*01750; } else $lai=$l3c; } $O35.="\"key\":".$lai.","; break; case ("r"): case ("rd"): $O35.=l3x($l3c).":{"; $l5e=l4k($l3c); $O4m=$l5e[0]; $l4n=$l5e[1]; if ($l52 == "rd") { if (PHP_SAPI !== "cli") { $O4m=l4d($O4m); $l4n=l4d($l4n); } $O4m=$O4m*01750; $l4n=$l4n*01750; } $O35.="\"from\":".$O4m.","; $O35.="\"from_as_string\":".l3x($O4m).","; $O35.="\"to\":".$l4n.","; $O35.="\"to_as_string\":".l3x($l4n).","; break; default : break; } $O35.="\"doc_count\":".$Oag["_count"]; O36($O35,$l37=$l37); } function l9m($Oag,$O9m=2,$O9f=",",$l37=NULL) { $O3d=array_keys($Oag); $Oai=count($Oag); $O35=""; for ($O3u=$O9m; $O3u<$Oai; $O3u ++) { $O5a=$O3d[$O3u]; $l3c=$Oag[$O3d[$O3u]]; $O35.=$O9f.l3x($O5a).":{"; if ($l3c === NULL || $l3c === "") $O35.="\"value\":null"; else $O35.="\"value\":".$l3c; $O35.="}"; $O9f=","; } O36($O35,$l37=$l37); } function l9s($l52,$l37=NULL) { $laj=""; switch ($l52) { case ("t"): case ("g"): case ("h"): case ("hd"): $laj="]"; break; case ("r"): case ("rd"): $laj="}"; break; default : break; } $O35=$laj."}"; O36($O35,$l37=$l37); }
\ No newline at end of file
diff --git a/JSON_SQL_Bridge/functionsquery.php b/JSON_SQL_Bridge/functionsquery.php
index 8d42661..9d15987 100644
--- a/JSON_SQL_Bridge/functionsquery.php
+++ b/JSON_SQL_Bridge/functionsquery.php
@@ -8,4 +8,4 @@
If you are interested in distributing, reselling, modifying, contibuting or in general creating
any derivative work from JSON_SQL_Bridge, please contact Frank Vanden Berghen at frank@timi.eu.
*/
-namespace kibella; function O9b($l9c) { return array_sum(array_map( function ($O9c) { return $O9c->isrunning(); } ,$l9c)); } function l9d($O9d) { $l6f=explode("\n",$O9d); if (count($l6f)<2) { O29( __FILE__ ,"error","The request body of the POST data is not valid. It should have at least 2 elements but ".count($l6f)." were found.\nProgram aborts.\n"); } else { $l9e=floor(count($l6f)/2); echo "{\"responses\":["; $O9e=array(); $l9f=array(); $O9f=array(); $l9g=NULL; $O9g=array(); $l9h=array(); $O9h=-1; $l9i=-1; for ($O9i=0; $O9i<$l9e; $O9i ++) { $l27=json_decode($l6f[2*$O9i],TRUE); $O22=$l27["index"]; $l6j=$l6f[2*$O9i+1]; $O9e[]=l4k($O22,$l6j); O6q($O22,$l6j,l9j($O9e[$O9i]["responseFiles"]["responseFileFinal"])); if ($O9e[$O9i]["cacheFileExists"] === FALSE) { $O9h ++; $l9h[]=array("type" => "run","index" => $O9h); $l9f[]=$O9e[$O9i]; if ($O9h == 0) { $l9g=$O9e[$O9i]; } else { $O9g[]=new O1($O9e[$O9i]); } } else { $l9i ++; $l9h[]=array("type" => "cache","index" => $l9i); $O9f[]=$O9e[$O9i]; } } if ($O9h>=1) { assert($l9g != NULL,"The first request to run is not null"); foreach ($O9g as $O9c) { $O9c->start(PTHREADS_INHERIT_ALL|PTHREADS_ALLOW_GLOBALS); } $O9j=l4($l9g); foreach ($O9g as $O9c) { $O9c->join(); } for ($O9i=0; $O9i<$l9e; $O9i ++) { if ($O9i>0) echo ","; $l9k=$l9h[$O9i]["index"]; if ($l9h[$O9i]["type"] == "run") { if ($l9k == 0) { $O9k=O6n($O9j["responseFile"]); if ($O9k === FALSE) O29( __FUNCTION__ ,"warning","PARALLEL RUN (FIRST JOB): The response file could not be read.\nCheck permissions on the file '".$l3."'.\n"); } else { assert($l9k-1l6()); if ($O9k === FALSE) O29( __FUNCTION__ ,"warning","PARALLEL RUN: The response file could not be read.\nCheck permissions on the file '".$O9c->l6()."'.\n"); } } else { assert($l9k0) echo ","; $O3=l4($O9e[$O9i]); $O9k=O6n($O3["responseFile"]); if ($O9k === FALSE) O29( __FUNCTION__ ,"warning","SEQUENTIAL RUN: The response file could not be read.\nCheck permissions on the file '".$l3."'.\n"); } } echo "]}"; } } function l4k($O22,$l6j,$O2=FALSE) { $l27=l4u($O22); if ($l27 === FALSE) { if ($O2) O29("",lc,"Table with table ID '$O22' was not found in the registered tables information."); l87(NULL,0); O2f("[]}}"); return FALSE; } $l22=$l27["table"]; $O21=$l27["db"]; $O4t=$l27["cache"]; $l9l=l7a($l6j,$l22,$O21); $O9l=O80($l9l); $l6k=O6k($O22,$O9l); if (!l6x(la) && (time()-l6x(O9))>Oa && file_exists(l6x(l9)) === TRUE) { @unlink(l6x(l9)); } $l9m=O6l($l6k,$O4t); return array("table" => $l22,"db" => $O21,"responseFiles" => $l6k,"parsedQuery" => $l9l,"cacheEnabled" => $O4t,"cacheFileExists" => $l9m); } function l4($O4j,$O2=FALSE) { $l22=$O4j["table"]; $O21=$O4j["db"]; $l6k=$O4j["responseFiles"]; $l47=$O4j["parsedQuery"]; $O4t=$O4j["cacheEnabled"]; $l9m=$O4j["cacheFileExists"]; if ($l9m === FALSE) { if (file_exists($l6k["responseFileTmp"])) { O9m($l6k["responseFileFinal"]); } else { O6m($l22,$O21,$l47,$l6k["responseFileTmp"]); l6n($l6k,$O4t); if ($O2) { echo "--------------------\n"; echo "Result from parseEsJsonRequest():\n"; print_r($l47); echo "--------------------\n"; echo "Result from generateEsJsonResponse():\n"; O6n($l6k["responseFileFinal"]); } } } return array("responseFile" => $l6k["responseFileFinal"],"parsedQuery" => $l47); }
\ No newline at end of file
+namespace kibella; function Oaj($lak) { return array_sum(array_map( function ($Oak) { return $Oak->isrunning(); } ,$lak)); } function lal($Oal) { $l7j=explode("\n",$Oal); if (count($l7j)<2) { showmessage( __FILE__ ,"error","The request body of the POST data is not valid. It should have at least 2 elements but ".count($l7j)." were found.\nProgram aborts.\n"); } else { $lam=floor(count($l7j)/2); echo "{\"responses\":["; $Oam=array(); $lan=array(); $Oan=array(); $lao=array(); $Oao=array(); $lap=-1; $Oap=-1; for ($laq=0; $laq<$lam; $laq ++) { $l7h=json_decode($l7j[2*$laq],TRUE); $l31=$l7h["index"]; $l7n=$l7j[2*$laq+1]; $Oam[]=l5j($l31,$l7n); O7t($l31,$l7n,Oaq($Oam[$laq]["responseFiles"]["responseFileFinal"])); if ($Oam[$laq]["cacheFileExists"] === FALSE) { $lap ++; $Oao[]=array("type" => "run","index" => $lap); $lan[]=$Oam[$laq]; $lar=new lv($Oam[$laq],$lx=FALSE); $lao[]=$lar; } else { $Oap ++; $Oao[]=array("type" => "cache","index" => $Oap); $Oan[]=$Oam[$laq]; } } if ($lap>=1 && MULTITHREADING == 1) { foreach ($lao as $Oak) { $Oar=$Oak->start(PTHREADS_INHERIT_ALL|PTHREADS_ALLOW_GLOBALS); } foreach ($lao as $Oak) { $Oak->join(); } for ($laq=0; $laq<$lam; $laq ++) { if ($laq>0) echo ","; $las=$Oao[$laq]["index"]; if ($Oao[$laq]["type"] == "run") { assert($lasO10()); if ($Oar === FALSE) showmessage( __FUNCTION__ ,"warning","PARALLEL RUN: The response file could not be read.\nCheck permissions on the file '".$Oak->O10()."'.\n"); } else { assert($las0) echo ","; $Oy=lz($Oam[$laq]); $Oar=O7r($Oy["responseFile"]); if ($Oar === FALSE) showmessage( __FUNCTION__ ,"warning","SEQUENTIAL RUN: The response file could not be read.\nCheck permissions on the file '".$ly."'.\n"); } } echo "]}"; } } function l5j($l31,$l7n,$lx=FALSE) { $l7h=l5t($l31); if ($l7h === FALSE) { if ($lx) showmessage("",TAG_ERROR,"Table with table ID '$l31' was not found in the registered tables information."); O9b(NULL,0); O36("[]}}"); return FALSE; } $O30=$l7h["table"]; $l30=$l7h["db"]; $lp=$l7h["dbengine"]; $O5s=$l7h["cache"]; $Oas=O8c($l7n,$O30,$l30); $lat=O92($Oas); $l7o=O7o($l31,$lat); if (!O7y(l15) && (time()-O7y(O14))>O15 && file_exists(O7y(l14)) === TRUE) { @unlink(O7y(l14)); } $Oat=O7p($l7o,$O5s); return array("table" => $O30,"db" => $l30,"dbengine" => $lp,"responseFiles" => $l7o,"parsedQuery" => $Oas,"cacheEnabled" => $O5s,"cacheFileExists" => $Oat); } function lz($O5i,$lx=FALSE) { $O30=$O5i["table"]; $l30=$O5i["db"]; $lp=$O5i["dbengine"]; $l7o=$O5i["responseFiles"]; $O55=$O5i["parsedQuery"]; $O5s=$O5i["cacheEnabled"]; $Oat=$O5i["cacheFileExists"]; if ($Oat === FALSE) { if (file_exists($l7o["responseFileTmp"])) { lau($l7o["responseFileFinal"]); } else { global $O4q; O7q($O30,$l30,$O4q[$lp],$O55,$l7o["responseFileTmp"]); l7r($l7o,$O5s); if ($lx) { echo "--------------------\n"; echo "Result from parseEsJsonRequest():\n"; print_r($O55); echo "--------------------\n"; echo "Result from generateEsJsonResponse():\n"; O7r($l7o["responseFileFinal"]); } } } return array("responseFile" => $l7o["responseFileFinal"],"parsedQuery" => $O55); }
\ No newline at end of file
diff --git a/JSON_SQL_Bridge/functionsserver.php b/JSON_SQL_Bridge/functionsserver.php
index b1fb806..5b138f1 100644
--- a/JSON_SQL_Bridge/functionsserver.php
+++ b/JSON_SQL_Bridge/functionsserver.php
@@ -1,11 +1,11 @@
$l9n,"responseFileTmp" => $O9n); return $l6k; } function l9j($O3l) { $l9q=substr($O3l,strrpos($O3l,O14)+1); $O9q=strrpos($l9q,"."); if ($O9q>0) { $O54=substr($l9q,0,$O9q); } else { $O54=$l9q; } return $O54; } function l6x($l9r) { if ( isset ($_COOKIE[$l9r])) { return $_COOKIE[$l9r]; } else { return ""; } } function O6n($O3l,$O9r=5) { $O9k=FALSE; if ($O3l !== NULL && $O3l !== FALSE && $O3l !== "") { $l9s=time(); $O9s=strlen(ob_get_contents()); while ($O9k === FALSE && (time()-$l9s)<=$O9r) { @readfile($O3l); if (PHP_SAPI === "cli" || strlen(ob_get_contents())>$O9s && @filesize($O3l)>0) $O9k=TRUE; } } return $O9k; } function O9o($l6k,$O9r=5) { $O9k=FALSE; $l9s=time(); while ($O9k === FALSE && (time()-$l9s)<=$O9r) { $O9k=@rename($l6k["responseFileTmp"],$l6k["responseFileFinal"]); } return $O9k; } function l9t($O9t,$O2e="application/json") { header($_SERVER["SERVER_PROTOCOL"]." ".$O9t); header("Access-Control-Allow-Origin: *"); header( "Content-Type: $O2e; charset=UTF-8"); } function l9u($O6g=TRUE) { $O9u=l6x(l12); if ($O9u == "") { l58(lr,$l2t=FALSE); $l9v=O4w("select ".lq." from ".lr." LIMIT 1",KIBELLADB,TABLESDIR,$l4x="query",$O24="sqlite"); if ($l9v !== FALSE && count($l9v)>0) { $l22=$l9v[0][lq]; } else { $l22=""; } } else { $l22=$O9u; } $O9v="{\"".lj."\":\"".O7."\",\"".Oj."\":\"config\",\"".lk."\":\"".l8."\",\"".Ok."\":1,\"".lo."\":true,\"".lm."\":{"."\"buildNum\":1000,"."\"defaultIndex\":\"".$l22."\""."}"."}"; if ($O6g) { $O9v="{\"docs\":[".$O9v."]}"; } O2f($O9v); } function O72($l9w) { $O9w="{\"took\":2,\"timed_out\":false,\"".ln."\":{\"total\":1,\"successful\":1,\"failed\":0},"."\"hits\":{"."\"total\":".count($l9w).","."\"max_score\":1,"."\"hits\":".json_encode($l9w)."}"."}"; O2f($O9w); } function l5x($O2e,$O28,$O5w,$l9x,$O9x) { $O9w="{\"".lj."\":\"".O7."\",\"".Oj."\":\"".$O2e."\",\"".lk."\":\"".$O28."\",\"".Ok."\":".$O5w.",\"".ln."\":{\"total\":2,\"successful\":1,\"failed\":0},\"".$l9x."\":".$O9x."}"; O2f($O9w); } function l9y($l9r,$O2l,$O9y="",$l9z=NULL,$O9z=NULL) { if ($l9z === NULL) $l9z=@strtotime("+365 days"); if ($O9z === NULL) $O9z="/".APPDIRNAME."/"; if ($O9y === "raw") { setrawcookie($l9r,$O2l,$l9z,$O9z); } else { setcookie($l9r,$O2l,$l9z,$O9z); } } function la0($Oa0,$la1,$Oa1) { $la2=""; $Oa2=""; if (strtolower($Oa1) == "begin") { if ($la1 == "" || $la1 == NULL) { $la3=$Oa0; $la1=""; } else $la3=str_replace($la1."/","",$Oa0); $l3c=0; $Oa3=""; if ($la3[0] == "/") { $l3c=1; $Oa3="/"; } if ($la1 == "") $la4=""; else $la4=$Oa3.$la1; $Oa1=strpos($la3,"/",$l3c); if ($Oa1 !== FALSE) { $la2=$la4.substr($la3,$Oa1); $Oa2=substr($la3,$l3c,$Oa1-$l3c); } else { $Oa4=la5($Oa0); $Oa5=$Oa4["URI"]; $Oa2=substr($Oa5,$l3c); } } else { $Oa4=la5($Oa0); $Oa5=$Oa4["URI"]; $la6=strlen($Oa5); if ($Oa5[$la6-1] == "/") $Oa5=substr($Oa5,0,$la6-1); $Oa1=strrpos($Oa5,"/"); if ($Oa1 !== FALSE) { if ($Oa1 $la2,"object" => $Oa2); } function la5($Oa0) { $Oa1=strpos($Oa0,"?"); if ($Oa1 === FALSE) { $Oa6=$Oa0; $O2i=NULL; } else { $Oa6=substr($Oa0,0,$Oa1); if ($Oa1 == strlen($Oa0)-1) { $O2i=NULL; } else { $la7=substr($Oa0,$Oa1+1); $Oa7=explode("&",$la7); $O2i=O30("=",$Oa7); } } return array("URI" => $Oa6,"params" => $O2i); } function l70($l2g) { $l2g=preg_replace("/\\s+/","-",$l2g); return $l2g; } function la8($l2g) { $l2g=urldecode($l2g); return $l2g; } function O9m($l2x,$Oa8=O8) { $l9s=time(); while (!file_exists($l2x) && (time()-$l9s)<=$Oa8) { sleep(1); } }
\ No newline at end of file
+namespace kibella; function O7p($l7o,$O5s) { $Oat=FALSE; if ($O5s) { $Oau=$l7o["responseFileFinal"]; $lav=$l7o["responseFileTmp"]; $O3s=checkdirexistsorcreate(CACHEDIR); if ($O3s === FALSE) { showmessage( __FUNCTION__ ,TAG_ERROR,l88(CACHEDIR).Oav()); return FALSE; } if (file_exists($Oau) && !O4n($Oau)) { $Oat=TRUE; } else if (file_exists($lav)) { lau($Oau); if (file_exists($Oau)) { $Oat=TRUE; } } } return $Oat; } function l7r($l7o,$O5s) { if (file_exists($l7o["responseFileTmp"]) === TRUE) { $Oar=law($l7o); if ($Oar !== FALSE && PHP_SAPI !== "cli") { if ($l7o["responseFileFinal"] !== O7y(l14)) { setrawcookie(l14,$l7o["responseFileFinal"],strtotime("+365 days"),"/".APPDIRNAME."/"); setrawcookie(O14,time(),strtotime("+365 days"),"/".APPDIRNAME."/"); setrawcookie(l15,$O5s*1,strtotime("+365 days"),"/".APPDIRNAME."/"); } } } } function O7o($l31,$l7n) { if (is_string($l7n)) { $Oaw=$l7n; } else { $Oaw=serialize($l7n); } $Oau=CACHEDIR."/query_".$l31.O1y.md5($l31."\n".$Oaw).".json"; $lax="_tmp"; $lav= "$Oau$lax"; $l7o=array("responseFileFinal" => $Oau,"responseFileTmp" => $lav); return $l7o; } function Oaq($Oe) { $Oax=substr($Oe,strrpos($Oe,O1y)+1); $lay=strrpos($Oax,"."); if ($lay>0) { $l63=substr($Oax,0,$lay); } else { $l63=$Oax; } return $l63; } function O7y($Oay) { if ( isset ($_COOKIE[$Oay])) { return $_COOKIE[$Oay]; } else { return ""; } } function O7r($Oe,$laz=5) { $Oar=FALSE; if ($Oe !== NULL && $Oe !== FALSE && $Oe !== "") { $Oaz=time(); $lb0=strlen(ob_get_contents()); while ($Oar === FALSE && (time()-$Oaz)<=$laz) { @readfile($Oe); if (PHP_SAPI === "cli" || strlen(ob_get_contents())>$lb0 && @filesize($Oe)>0) $Oar=TRUE; } } return $Oar; } function law($l7o,$laz=5) { $Oar=FALSE; $Oaz=time(); while ($Oar === FALSE && (time()-$Oaz)<=$laz) { $Oar=@rename($l7o["responseFileTmp"],$l7o["responseFileFinal"]); } return $Oar; } function Ob0($lb1,$l52="application/json") { header($_SERVER["SERVER_PROTOCOL"]." ".$lb1); header("Access-Control-Allow-Origin: *"); header( "Content-Type: $l52; charset=UTF-8"); } function Ob1($O7k=TRUE) { $lb2=O7y(l1w); if ($lb2 == "") { l68(O1m,$O3r=FALSE); $O66=dbcreatedbh(KIBELLADB); $Ob2=dbdbhexecutesqlquery($O66->getdbhandle(),"select ".O3." from ".O1m." LIMIT 1"); $O66->close(); if ($Ob2 !== FALSE && count($Ob2)>0) { $O30=$Ob2[0][O3]; } else { $O30="INCOME(income)"; } } else { $O30=$lb2; } $lb3="{\"".l1f."\":\"".O12."\",\"".O1f."\":\"config\",\"".l1g."\":\"".l13."\",\"".O1g."\":1,\"".O1j."\":true,\"".O1h."\":{"."\"buildNum\":1000,"."\"defaultIndex\":\"".$O30."\""."}"."}"; if ($O7k) { $lb3="{\"docs\":[".$lb3."]}"; } O36($lb3); } function l84($Ob3) { $lb4="{\"took\":2,\"timed_out\":false,\"".O1i."\":{\"total\":1,\"successful\":1,\"failed\":0},"."\"hits\":{"."\"total\":".count($Ob3).","."\"max_score\":1,"."\"hits\":".json_encode($Ob3)."}"."}"; O36($lb4); } function O70($l52,$O1,$l70,$Ob4,$lb5) { $lb4="{\"".l1f."\":\"".O12."\",\"".O1f."\":\"".$l52."\",\"".l1g."\":\"".$O1."\",\"".O1g."\":".$l70.",\"".O1i."\":{\"total\":2,\"successful\":1,\"failed\":0},\"".$Ob4."\":".$lb5."}"; O36($lb4); } function Ob5($Oay,$l3c,$lb6="",$Ob6=NULL,$lb7=NULL) { if ($Ob6 === NULL) $Ob6=strtotime("+365 days"); if ($lb7 === NULL) $lb7="/".APPDIRNAME."/"; if ($lb6 === "raw") { setrawcookie($Oay,$l3c,$Ob6,$lb7); } else { setcookie($Oay,$l3c,$Ob6,$lb7); } } function Ob7($lb8,$Ob8,$l4v) { $lb9=""; $Ob9=""; if (strtolower($l4v) == "begin") { if ($Ob8 == "" || $Ob8 == NULL) { $lba=$lb8; $Ob8=""; } else $lba=str_replace($Ob8."/","",$lb8); $O4e=0; $Oba=""; if ($lba[0] == "/") { $O4e=1; $Oba="/"; } if ($Ob8 == "") $lbb=""; else $lbb=$Oba.$Ob8; $l4v=strpos($lba,"/",$O4e); if ($l4v !== FALSE) { $lb9=$lbb.substr($lba,$l4v); $Ob9=substr($lba,$O4e,$l4v-$O4e); } else { $Obb=lbc($lb8); $Obc=$Obb["URI"]; $Ob9=substr($Obc,$O4e); } } else { $Obb=lbc($lb8); $Obc=$Obb["URI"]; $lbd=strlen($Obc); if ($Obc[$lbd-1] == "/") $Obc=substr($Obc,0,$lbd-1); $l4v=strrpos($Obc,"/"); if ($l4v !== FALSE) { if ($l4v $lb9,"object" => $Ob9); } function lbc($lb8) { $l4v=strpos($lb8,"?"); if ($l4v === FALSE) { $Obd=$lb8; $l39=NULL; } else { $Obd=substr($lb8,0,$l4v); if ($l4v == strlen($lb8)-1) { $l39=NULL; } else { $lbe=substr($lb8,$l4v+1); $Obe=explode("&",$lbe); $l39=O40("=",$Obe); } } return array("URI" => $Obd,"params" => $l39); } function O81($O35) { $O35=preg_replace("/\\s+/","-",$O35); return $O35; } function lbf($O35) { $O35=urldecode($O35); return $O35; } function lau($O3w,$Obf=O13) { $Oaz=time(); while (!file_exists($O3w) && (time()-$Oaz)<=$Obf) { sleep(1); } }
\ No newline at end of file
diff --git a/JSON_SQL_Bridge/functionsstatic.php b/JSON_SQL_Bridge/functionsstatic.php
index 0ff1f80..9bc55c3 100644
--- a/JSON_SQL_Bridge/functionsstatic.php
+++ b/JSON_SQL_Bridge/functionsstatic.php
@@ -8,4 +8,4 @@
If you are interested in distributing, reselling, modifying, contibuting or in general creating
any derivative work from JSON_SQL_Bridge, please contact Frank Vanden Berghen at frank@timi.eu.
*/
-namespace kibella; function __kibana_4___kibanaqueryvalidator__validate_query() { $O46="{\"valid\":true,\"_shards\":{\"total\":1,\"successful\":1,\"failed\":0},\"explanations\":[{\"index\":\".kibana-4\",\"valid\":true,\"explanation\":\"ConstantScore(ConstantScore(+_type:__kibanaQueryValidator))\"}]}"; O2f($O46); } function __kibana_4__mapping___field__source() { $O46="{\".kibana-4\":{\"mappings\":{\"index-pattern\":{\"_source\":{\"full_name\":\"_source\",\"mapping\":{}}},\"search\":{\"_source\":{\"full_name\":\"_source\",\"mapping\":{}}},\"visualization\":{\"_source\":{\"full_name\":\"_source\",\"mapping\":{}}},\"config\":{\"_source\":{\"full_name\":\"_source\",\"mapping\":{}}},\"dashboard\":{\"_source\":{\"full_name\":\"_source\",\"mapping\":{}}}}}}"; O2f($O46); } function __kibana_4__refresh() { $O46="{\"_shards\":{\"total\":2,\"successful\":1,\"failed\":0}}"; O2f($O46); } function __kibana_4__settings() { $O46="{\"acknowledge\":true}"; O2f($O46); } function __kibana_4_config_4_1_2_es_2_0() { $O46="{\"_index\":\".kibana-4\",\"_type\":\"config\",\"_id\":\"4.1.2\",\"_version\":1,\"_shards\":{\"total\":2,\"successful\":1,\"failed\":0}}"; O2f($O46); } function __kibana_4_config() { $O46="{\"_index\":\".kibana-4\",\"_type\":\"config\",\"_id\":\"4.1.2\",\"_version\":1,\"_shards\":{\"total\":2,\"successful\":1,\"failed\":0}}"; O2f($O46); } function __kibana_4() { $O46="{\n\t \".kibana-4\" : {\n\t \"aliases\" : { },\n\t \"mappings\" : {\n\t \"config\" : {\n\t \"properties\" : {\n\t \"buildNum\" : {\n\t \"type\" : \"long\"\n\t }\n\t }\n\t }\n\t },\n\t \"settings\" : {\n\t \"index\" : {\n\t \"creation_date\" : \"1456837727490\",\n\t \"uuid\" : \"KyQTolBsQKKDHGaS1FPSLQ\",\n\t \"number_of_replicas\" : \"1\",\n\t \"number_of_shards\" : \"1\",\n\t \"version\" : {\n\t \"created\" : \"2020099\"\n\t }\n\t }\n\t },\n\t \"warmers\" : { }\n\t }\n\t}"; O2f($O46); } function __cluster_health__kibana_4() { $O46="{\"cluster_name\":\"elasticsearch\",\"status\":\"yellow\",\"timed_out\":false,\"number_of_nodes\":1,\"number_of_data_nodes\":1,\"active_primary_shards\":1,\"active_shards\":1,\"relocating_shards\":0,\"initializing_shards\":0,\"unassigned_shards\":1,\"delayed_unassigned_shards\":0,\"number_of_pending_tasks\":0,\"number_of_in_flight_fetch\":0,\"task_max_waiting_in_queue_millis\":0,\"active_shards_percent_as_number\":50.0}"; O2f($O46); } function __nodes() { $O46="{\n\t \"cluster_name\" : \"elasticsearch\",\n\t \"nodes\" : {\n\t \"9X39ibGRSziEvcgaY0h21w\" : {\n\t \"name\" : \"Awesome Android\",\n\t \"transport_address\" : \"10.0.2.15:9300\",\n\t \"host\" : \"10.0.2.15\",\n\t \"ip\" : \"10.0.2.15\",\n\t \"version\" : \"2.2.0\",\n\t \"build\" : \"8ff36d1\",\n\t \"http_address\" : \"10.0.2.15:9200\",\n\t \"settings\" : {\n\t \"client\" : {\n\t \"type\" : \"node\"\n\t },\n\t \"http\" : {\n\t \"cors\" : {\n\t \"enabled\" : \"true\",\n\t \"allow-origin\" : \"*\"\n\t }\n\t },\n\t \"name\" : \"Awesome Android\",\n\t \"pidfile\" : \"/var/run/elasticsearch/elasticsearch.pid\",\n\t \"path\" : {\n\t \"data\" : \"/var/lib/elasticsearch\",\n\t \"home\" : \"/usr/share/elasticsearch\",\n\t \"conf\" : \"/etc/elasticsearch\",\n\t \"logs\" : \"/var/log/elasticsearch\"\n\t },\n\t \"config\" : {\n\t \"ignore_system_properties\" : \"true\"\n\t },\n\t \"cluster\" : {\n\t \"name\" : \"elasticsearch\"\n\t },\n\t \"network\" : {\n\t \"host\" : \"0.0.0.0\"\n\t },\n\t \"foreground\" : \"false\"\n\t },\n\t \"os\" : {\n\t \"refresh_interval_in_millis\" : 1000,\n\t \"name\" : \"Linux\",\n\t \"arch\" : \"amd64\",\n\t \"version\" : \"3.2.0-23-generic\",\n\t \"available_processors\" : 2,\n\t \"allocated_processors\" : 2\n\t },\n\t \"process\" : {\n\t \"refresh_interval_in_millis\" : 1000,\n\t \"id\" : 2056,\n\t \"mlockall\" : false\n\t },\n\t \"jvm\" : {\n\t \"pid\" : 2056,\n\t \"version\" : \"1.7.0_95\",\n\t \"vm_name\" : \"OpenJDK 64-Bit Server VM\",\n\t \"vm_version\" : \"24.95-b01\",\n\t \"vm_vendor\" : \"Oracle Corporation\",\n\t \"start_time_in_millis\" : 1456758145723,\n\t \"mem\" : {\n\t \"heap_init_in_bytes\" : 268435456,\n\t \"heap_max_in_bytes\" : 1056309248,\n\t \"non_heap_init_in_bytes\" : 24313856,\n\t \"non_heap_max_in_bytes\" : 224395264,\n\t \"direct_max_in_bytes\" : 1056309248\n\t },\n\t \"gc_collectors\" : [ \"ParNew\", \"ConcurrentMarkSweep\" ],\n\t \"memory_pools\" : [ \"Code Cache\", \"Par Eden Space\", \"Par Survivor Space\", \"CMS Old Gen\", \"CMS Perm Gen\" ],\n\t \"using_compressed_ordinary_object_pointers\" : \"true\"\n\t },\n\t \"thread_pool\" : {\n\t \"generic\" : {\n\t \"type\" : \"cached\",\n\t \"keep_alive\" : \"30s\",\n\t \"queue_size\" : -1\n\t },\n\t \"index\" : {\n\t \"type\" : \"fixed\",\n\t \"min\" : 2,\n\t \"max\" : 2,\n\t \"queue_size\" : 200\n\t },\n\t \"fetch_shard_store\" : {\n\t \"type\" : \"scaling\",\n\t \"min\" : 1,\n\t \"max\" : 4,\n\t \"keep_alive\" : \"5m\",\n\t \"queue_size\" : -1\n\t },\n\t \"get\" : {\n\t \"type\" : \"fixed\",\n\t \"min\" : 2,\n\t \"max\" : 2,\n\t \"queue_size\" : 1000\n\t },\n\t \"snapshot\" : {\n\t \"type\" : \"scaling\",\n\t \"min\" : 1,\n\t \"max\" : 1,\n\t \"keep_alive\" : \"5m\",\n\t \"queue_size\" : -1\n\t },\n\t \"force_merge\" : {\n\t \"type\" : \"fixed\",\n\t \"min\" : 1,\n\t \"max\" : 1,\n\t \"queue_size\" : -1\n\t },\n\t \"suggest\" : {\n\t \"type\" : \"fixed\",\n\t \"min\" : 2,\n\t \"max\" : 2,\n\t \"queue_size\" : 1000\n\t },\n\t \"bulk\" : {\n\t \"type\" : \"fixed\",\n\t \"min\" : 2,\n\t \"max\" : 2,\n\t \"queue_size\" : 50\n\t },\n\t \"warmer\" : {\n\t \"type\" : \"scaling\",\n\t \"min\" : 1,\n\t \"max\" : 1,\n\t \"keep_alive\" : \"5m\",\n\t \"queue_size\" : -1\n\t },\n\t \"flush\" : {\n\t \"type\" : \"scaling\",\n\t \"min\" : 1,\n\t \"max\" : 1,\n\t \"keep_alive\" : \"5m\",\n\t \"queue_size\" : -1\n\t },\n\t \"search\" : {\n\t \"type\" : \"fixed\",\n\t \"min\" : 4,\n\t \"max\" : 4,\n\t \"queue_size\" : 1000\n\t },\n\t \"fetch_shard_started\" : {\n\t \"type\" : \"scaling\",\n\t \"min\" : 1,\n\t \"max\" : 4,\n\t \"keep_alive\" : \"5m\",\n\t \"queue_size\" : -1\n\t },\n\t \"listener\" : {\n\t \"type\" : \"fixed\",\n\t \"min\" : 1,\n\t \"max\" : 1,\n\t \"queue_size\" : -1\n\t },\n\t \"percolate\" : {\n\t \"type\" : \"fixed\",\n\t \"min\" : 2,\n\t \"max\" : 2,\n\t \"queue_size\" : 1000\n\t },\n\t \"refresh\" : {\n\t \"type\" : \"scaling\",\n\t \"min\" : 1,\n\t \"max\" : 1,\n\t \"keep_alive\" : \"5m\",\n\t \"queue_size\" : -1\n\t },\n\t \"management\" : {\n\t \"type\" : \"scaling\",\n\t \"min\" : 1,\n\t \"max\" : 5,\n\t \"keep_alive\" : \"5m\",\n\t \"queue_size\" : -1\n\t }\n\t },\n\t \"transport\" : {\n\t \"bound_address\" : [ \"[::]:9300\" ],\n\t \"publish_address\" : \"10.0.2.15:9300\",\n\t \"profiles\" : { }\n\t },\n\t \"http\" : {\n\t \"bound_address\" : [ \"[::]:9200\" ],\n\t \"publish_address\" : \"10.0.2.15:9200\",\n\t \"max_content_length_in_bytes\" : 104857600\n\t },\n\t \"plugins\" : [ ],\n\t \"modules\" : [ {\n\t \"name\" : \"lang-expression\",\n\t \"version\" : \"2.2.0\",\n\t \"description\" : \"Lucene expressions integration for Elasticsearch\",\n\t \"jvm\" : true,\n\t \"classname\" : \"org.elasticsearch.script.expression.ExpressionPlugin\",\n\t \"isolated\" : true,\n\t \"site\" : false\n\t }, {\n\t \"name\" : \"lang-groovy\",\n\t \"version\" : \"2.2.0\",\n\t \"description\" : \"Groovy scripting integration for Elasticsearch\",\n\t \"jvm\" : true,\n\t \"classname\" : \"org.elasticsearch.script.groovy.GroovyPlugin\",\n\t \"isolated\" : true,\n\t \"site\" : false\n\t } ]\n\t }\n\t }\n\t}"; O2f($O46); } function _() { $O46="{\n\t \"name\" : \"Awesome Android\",\n\t \"cluster_name\" : \"elasticsearch\",\n\t \"version\" : {\n\t \"number\" : \"2.2.0\",\n\t \"build_hash\" : \"8ff36d139e16f8720f2947ef62c8167a888992fe\",\n\t \"build_timestamp\" : \"2016-01-27T13:32:39Z\",\n\t \"build_snapshot\" : false,\n\t \"lucene_version\" : \"5.4.1\"\n\t },\n\t \"tagline\" : \"You Know, for Search\"\n\t}"; O2f($O46); }
\ No newline at end of file
+namespace kibella; function __kibana_4___kibanaqueryvalidator__validate_query() { $l55="{\"valid\":true,\"_shards\":{\"total\":1,\"successful\":1,\"failed\":0},\"explanations\":[{\"index\":\".kibana-4\",\"valid\":true,\"explanation\":\"ConstantScore(ConstantScore(+_type:__kibanaQueryValidator))\"}]}"; O36($l55); } function __kibana_4__mapping___field__source() { $l55="{\".kibana-4\":{\"mappings\":{\"index-pattern\":{\"_source\":{\"full_name\":\"_source\",\"mapping\":{}}},\"search\":{\"_source\":{\"full_name\":\"_source\",\"mapping\":{}}},\"visualization\":{\"_source\":{\"full_name\":\"_source\",\"mapping\":{}}},\"config\":{\"_source\":{\"full_name\":\"_source\",\"mapping\":{}}},\"dashboard\":{\"_source\":{\"full_name\":\"_source\",\"mapping\":{}}}}}}"; O36($l55); } function __kibana_4__refresh() { $l55="{\"_shards\":{\"total\":2,\"successful\":1,\"failed\":0}}"; O36($l55); } function __kibana_4__settings() { $l55="{\"acknowledge\":true}"; O36($l55); } function __kibana_4_config_4_1_2_es_2_0() { $l55="{\"_index\":\".kibana-4\",\"_type\":\"config\",\"_id\":\"4.1.2\",\"_version\":1,\"_shards\":{\"total\":2,\"successful\":1,\"failed\":0}}"; O36($l55); } function __kibana_4_config() { $l55="{\"_index\":\".kibana-4\",\"_type\":\"config\",\"_id\":\"4.1.2\",\"_version\":1,\"_shards\":{\"total\":2,\"successful\":1,\"failed\":0}}"; O36($l55); } function __kibana_4() { $l55="{\n\t \".kibana-4\" : {\n\t \"aliases\" : { },\n\t \"mappings\" : {\n\t \"config\" : {\n\t \"properties\" : {\n\t \"buildNum\" : {\n\t \"type\" : \"long\"\n\t }\n\t }\n\t }\n\t },\n\t \"settings\" : {\n\t \"index\" : {\n\t \"creation_date\" : \"1456837727490\",\n\t \"uuid\" : \"KyQTolBsQKKDHGaS1FPSLQ\",\n\t \"number_of_replicas\" : \"1\",\n\t \"number_of_shards\" : \"1\",\n\t \"version\" : {\n\t \"created\" : \"2020099\"\n\t }\n\t }\n\t },\n\t \"warmers\" : { }\n\t }\n\t}"; O36($l55); } function __cluster_health__kibana_4() { $l55="{\"cluster_name\":\"elasticsearch\",\"status\":\"yellow\",\"timed_out\":false,\"number_of_nodes\":1,\"number_of_data_nodes\":1,\"active_primary_shards\":1,\"active_shards\":1,\"relocating_shards\":0,\"initializing_shards\":0,\"unassigned_shards\":1,\"delayed_unassigned_shards\":0,\"number_of_pending_tasks\":0,\"number_of_in_flight_fetch\":0,\"task_max_waiting_in_queue_millis\":0,\"active_shards_percent_as_number\":50.0}"; O36($l55); } function __nodes() { $l55="{\n\t \"cluster_name\" : \"elasticsearch\",\n\t \"nodes\" : {\n\t \"9X39ibGRSziEvcgaY0h21w\" : {\n\t \"name\" : \"Awesome Android\",\n\t \"transport_address\" : \"10.0.2.15:9300\",\n\t \"host\" : \"10.0.2.15\",\n\t \"ip\" : \"10.0.2.15\",\n\t \"version\" : \"2.2.0\",\n\t \"build\" : \"8ff36d1\",\n\t \"http_address\" : \"10.0.2.15:9200\",\n\t \"settings\" : {\n\t \"client\" : {\n\t \"type\" : \"node\"\n\t },\n\t \"http\" : {\n\t \"cors\" : {\n\t \"enabled\" : \"true\",\n\t \"allow-origin\" : \"*\"\n\t }\n\t },\n\t \"name\" : \"Awesome Android\",\n\t \"pidfile\" : \"/var/run/elasticsearch/elasticsearch.pid\",\n\t \"path\" : {\n\t \"data\" : \"/var/lib/elasticsearch\",\n\t \"home\" : \"/usr/share/elasticsearch\",\n\t \"conf\" : \"/etc/elasticsearch\",\n\t \"logs\" : \"/var/log/elasticsearch\"\n\t },\n\t \"config\" : {\n\t \"ignore_system_properties\" : \"true\"\n\t },\n\t \"cluster\" : {\n\t \"name\" : \"elasticsearch\"\n\t },\n\t \"network\" : {\n\t \"host\" : \"0.0.0.0\"\n\t },\n\t \"foreground\" : \"false\"\n\t },\n\t \"os\" : {\n\t \"refresh_interval_in_millis\" : 1000,\n\t \"name\" : \"Linux\",\n\t \"arch\" : \"amd64\",\n\t \"version\" : \"3.2.0-23-generic\",\n\t \"available_processors\" : 2,\n\t \"allocated_processors\" : 2\n\t },\n\t \"process\" : {\n\t \"refresh_interval_in_millis\" : 1000,\n\t \"id\" : 2056,\n\t \"mlockall\" : false\n\t },\n\t \"jvm\" : {\n\t \"pid\" : 2056,\n\t \"version\" : \"1.7.0_95\",\n\t \"vm_name\" : \"OpenJDK 64-Bit Server VM\",\n\t \"vm_version\" : \"24.95-b01\",\n\t \"vm_vendor\" : \"Oracle Corporation\",\n\t \"start_time_in_millis\" : 1456758145723,\n\t \"mem\" : {\n\t \"heap_init_in_bytes\" : 268435456,\n\t \"heap_max_in_bytes\" : 1056309248,\n\t \"non_heap_init_in_bytes\" : 24313856,\n\t \"non_heap_max_in_bytes\" : 224395264,\n\t \"direct_max_in_bytes\" : 1056309248\n\t },\n\t \"gc_collectors\" : [ \"ParNew\", \"ConcurrentMarkSweep\" ],\n\t \"memory_pools\" : [ \"Code Cache\", \"Par Eden Space\", \"Par Survivor Space\", \"CMS Old Gen\", \"CMS Perm Gen\" ],\n\t \"using_compressed_ordinary_object_pointers\" : \"true\"\n\t },\n\t \"thread_pool\" : {\n\t \"generic\" : {\n\t \"type\" : \"cached\",\n\t \"keep_alive\" : \"30s\",\n\t \"queue_size\" : -1\n\t },\n\t \"index\" : {\n\t \"type\" : \"fixed\",\n\t \"min\" : 2,\n\t \"max\" : 2,\n\t \"queue_size\" : 200\n\t },\n\t \"fetch_shard_store\" : {\n\t \"type\" : \"scaling\",\n\t \"min\" : 1,\n\t \"max\" : 4,\n\t \"keep_alive\" : \"5m\",\n\t \"queue_size\" : -1\n\t },\n\t \"get\" : {\n\t \"type\" : \"fixed\",\n\t \"min\" : 2,\n\t \"max\" : 2,\n\t \"queue_size\" : 1000\n\t },\n\t \"snapshot\" : {\n\t \"type\" : \"scaling\",\n\t \"min\" : 1,\n\t \"max\" : 1,\n\t \"keep_alive\" : \"5m\",\n\t \"queue_size\" : -1\n\t },\n\t \"force_merge\" : {\n\t \"type\" : \"fixed\",\n\t \"min\" : 1,\n\t \"max\" : 1,\n\t \"queue_size\" : -1\n\t },\n\t \"suggest\" : {\n\t \"type\" : \"fixed\",\n\t \"min\" : 2,\n\t \"max\" : 2,\n\t \"queue_size\" : 1000\n\t },\n\t \"bulk\" : {\n\t \"type\" : \"fixed\",\n\t \"min\" : 2,\n\t \"max\" : 2,\n\t \"queue_size\" : 50\n\t },\n\t \"warmer\" : {\n\t \"type\" : \"scaling\",\n\t \"min\" : 1,\n\t \"max\" : 1,\n\t \"keep_alive\" : \"5m\",\n\t \"queue_size\" : -1\n\t },\n\t \"flush\" : {\n\t \"type\" : \"scaling\",\n\t \"min\" : 1,\n\t \"max\" : 1,\n\t \"keep_alive\" : \"5m\",\n\t \"queue_size\" : -1\n\t },\n\t \"search\" : {\n\t \"type\" : \"fixed\",\n\t \"min\" : 4,\n\t \"max\" : 4,\n\t \"queue_size\" : 1000\n\t },\n\t \"fetch_shard_started\" : {\n\t \"type\" : \"scaling\",\n\t \"min\" : 1,\n\t \"max\" : 4,\n\t \"keep_alive\" : \"5m\",\n\t \"queue_size\" : -1\n\t },\n\t \"listener\" : {\n\t \"type\" : \"fixed\",\n\t \"min\" : 1,\n\t \"max\" : 1,\n\t \"queue_size\" : -1\n\t },\n\t \"percolate\" : {\n\t \"type\" : \"fixed\",\n\t \"min\" : 2,\n\t \"max\" : 2,\n\t \"queue_size\" : 1000\n\t },\n\t \"refresh\" : {\n\t \"type\" : \"scaling\",\n\t \"min\" : 1,\n\t \"max\" : 1,\n\t \"keep_alive\" : \"5m\",\n\t \"queue_size\" : -1\n\t },\n\t \"management\" : {\n\t \"type\" : \"scaling\",\n\t \"min\" : 1,\n\t \"max\" : 5,\n\t \"keep_alive\" : \"5m\",\n\t \"queue_size\" : -1\n\t }\n\t },\n\t \"transport\" : {\n\t \"bound_address\" : [ \"[::]:9300\" ],\n\t \"publish_address\" : \"10.0.2.15:9300\",\n\t \"profiles\" : { }\n\t },\n\t \"http\" : {\n\t \"bound_address\" : [ \"[::]:9200\" ],\n\t \"publish_address\" : \"10.0.2.15:9200\",\n\t \"max_content_length_in_bytes\" : 104857600\n\t },\n\t \"plugins\" : [ ],\n\t \"modules\" : [ {\n\t \"name\" : \"lang-expression\",\n\t \"version\" : \"2.2.0\",\n\t \"description\" : \"Lucene expressions integration for Elasticsearch\",\n\t \"jvm\" : true,\n\t \"classname\" : \"org.elasticsearch.script.expression.ExpressionPlugin\",\n\t \"isolated\" : true,\n\t \"site\" : false\n\t }, {\n\t \"name\" : \"lang-groovy\",\n\t \"version\" : \"2.2.0\",\n\t \"description\" : \"Groovy scripting integration for Elasticsearch\",\n\t \"jvm\" : true,\n\t \"classname\" : \"org.elasticsearch.script.groovy.GroovyPlugin\",\n\t \"isolated\" : true,\n\t \"site\" : false\n\t } ]\n\t }\n\t }\n\t}"; O36($l55); } function _() { $l55="{\n\t \"name\" : \"Awesome Android\",\n\t \"cluster_name\" : \"elasticsearch\",\n\t \"version\" : {\n\t \"number\" : \"2.2.0\",\n\t \"build_hash\" : \"8ff36d139e16f8720f2947ef62c8167a888992fe\",\n\t \"build_timestamp\" : \"2016-01-27T13:32:39Z\",\n\t \"build_snapshot\" : false,\n\t \"lucene_version\" : \"5.4.1\"\n\t },\n\t \"tagline\" : \"You Know, for Search\"\n\t}"; O36($l55); }
\ No newline at end of file
diff --git a/JSON_SQL_Bridge/geohash.php b/JSON_SQL_Bridge/geohash.php
index bf8fab0..c62c6b0 100644
--- a/JSON_SQL_Bridge/geohash.php
+++ b/JSON_SQL_Bridge/geohash.php
@@ -1 +1 @@
-=$Oab) { if ($lag) { $Oah=($lad+$Oad)/2; if ($lab>$Oah) { $Oag |= self::$Oa9[$lah]; $lad=$Oah; } else { $Oad=$Oah; } } else { $Oah=($lae+$Oae)/2; if ($Oaa>$Oah) { $Oag |= self::$Oa9[$lah]; $lae=$Oah; } else { $Oae=$Oah; } } $lag=!$lag; if ($lah<4) { $lah ++; } else { $laf[]=self::$l22[$Oag]; $Oaf=max($Oad-$lad,$Oae-$lae); $lah=0; $Oag=0; } } return join("",$laf); } public static function lai($laf) { $lad=-0264; $Oad=0264; $lae=-0132; $Oae=0132; $Oai=0132; $laj=0264; for ($l2v=0,$Oaj=strlen($laf); $l2v<$Oaj; $l2v ++) { $O7y=strpos(self::$l22,$laf[$l2v]); if (1&$l2v) { if (020&$O7y) { $lae=($lae+$Oae)/2; } else { $Oae=($lae+$Oae)/2; } if (8&$O7y) { $lad=($lad+$Oad)/2; } else { $Oad=($lad+$Oad)/2; } if (4&$O7y) { $lae=($lae+$Oae)/2; } else { $Oae=($lae+$Oae)/2; } if (2&$O7y) { $lad=($lad+$Oad)/2; } else { $Oad=($lad+$Oad)/2; } if (1&$O7y) { $lae=($lae+$Oae)/2; } else { $Oae=($lae+$Oae)/2; } $Oai /= 8; $laj /= 4; } else { if (020&$O7y) { $lad=($lad+$Oad)/2; } else { $Oad=($lad+$Oad)/2; } if (8&$O7y) { $lae=($lae+$Oae)/2; } else { $Oae=($lae+$Oae)/2; } if (4&$O7y) { $lad=($lad+$Oad)/2; } else { $Oad=($lad+$Oad)/2; } if (2&$O7y) { $lae=($lae+$Oae)/2; } else { $Oae=($lae+$Oae)/2; } if (1&$O7y) { $lad=($lad+$Oad)/2; } else { $Oad=($lad+$Oad)/2; } $Oai /= 4; $laj /= 8; } } $Oaa=round(($lae+$Oae)/2,max(1,-round(log10($Oai)))-1); $lab=round(($lad+$Oad)/2,max(1,-round(log10($laj)))-1); return array($Oaa,$lab); } }
\ No newline at end of file
+=$Obi) { if ($lbn) { $Obo=($lbk+$Obk)/2; if ($lbi>$Obo) { $Obn |= self::$Obg[$lbo]; $lbk=$Obo; } else { $Obk=$Obo; } } else { $Obo=($lbl+$Obl)/2; if ($Obh>$Obo) { $Obn |= self::$Obg[$lbo]; $lbl=$Obo; } else { $Obl=$Obo; } } $lbn=!$lbn; if ($lbo<4) { $lbo ++; } else { $lbm[]=self::$O30[$Obn]; $Obm=max($Obk-$lbk,$Obl-$lbl); $lbo=0; $Obn=0; } } return join("",$lbm); } public static function lbp($lbm) { $lbk=-0264; $Obk=0264; $lbl=-0132; $Obl=0132; $Obp=0132; $lbq=0264; for ($O3u=0,$Obq=strlen($lbm); $O3u<$Obq; $O3u ++) { $O90=strpos(self::$O30,$lbm[$O3u]); if (1&$O3u) { if (020&$O90) { $lbl=($lbl+$Obl)/2; } else { $Obl=($lbl+$Obl)/2; } if (8&$O90) { $lbk=($lbk+$Obk)/2; } else { $Obk=($lbk+$Obk)/2; } if (4&$O90) { $lbl=($lbl+$Obl)/2; } else { $Obl=($lbl+$Obl)/2; } if (2&$O90) { $lbk=($lbk+$Obk)/2; } else { $Obk=($lbk+$Obk)/2; } if (1&$O90) { $lbl=($lbl+$Obl)/2; } else { $Obl=($lbl+$Obl)/2; } $Obp /= 8; $lbq /= 4; } else { if (020&$O90) { $lbk=($lbk+$Obk)/2; } else { $Obk=($lbk+$Obk)/2; } if (8&$O90) { $lbl=($lbl+$Obl)/2; } else { $Obl=($lbl+$Obl)/2; } if (4&$O90) { $lbk=($lbk+$Obk)/2; } else { $Obk=($lbk+$Obk)/2; } if (2&$O90) { $lbl=($lbl+$Obl)/2; } else { $Obl=($lbl+$Obl)/2; } if (1&$O90) { $lbk=($lbk+$Obk)/2; } else { $Obk=($lbk+$Obk)/2; } $Obp /= 4; $lbq /= 8; } } $Obh=round(($lbl+$Obl)/2,max(1,-round(log10($Obp)))-1); $lbi=round(($lbk+$Obk)/2,max(1,-round(log10($lbq)))-1); return array($Obh,$lbi); } }
\ No newline at end of file
diff --git a/JSON_SQL_Bridge/globals.php b/JSON_SQL_Bridge/globals.php
index 10aa36e..dc3839e 100644
--- a/JSON_SQL_Bridge/globals.php
+++ b/JSON_SQL_Bridge/globals.php
@@ -8,4 +8,4 @@
If you are interested in distributing, reselling, modifying, contibuting or in general creating
any derivative work from JSON_SQL_Bridge, please contact Frank Vanden Berghen at frank@timi.eu.
*/
-namespace kibella; if (LOG) { global $O79; $O79=@fopen(LOGFILE,"a+"); } global $O4c; global $O7v; global $l7w; global $lak; global $Oak; global $lal; $O4c=array("s" => "second","m" => "minute","h" => "hour","d" => "day","w" => "week","M" => "month","y" => "year"); $l7w=array(l16 => "avg",O16 => "count(distinct",MAX => "max",MIN => "min",O17 => "percentiles",l18 => "stddev",O18 => "sum",l17 => "count",); $lak=array(l16,O16,l17,MAX,MIN,O17,O18); $O7v=array(O19 => array(NULL),l1a => array(array_values($lak),O19,O1a,l1b,O1h,O1i,l1j,O1o),O1a => array(NULL,l1n,O1r,l1w),l1b => array(NULL,l1n,O1r,l1w),O1b => array(O1j,l1k),O1c => array(O1b,O1a,O1l),l1d => array(NULL),l1e => array(O1d,O1e),l1f => array(NULL),O1f => array(l1y,l1z,l21),l1g => array(NULL),O1g => array(O1s,O1u,l1v,O1w,l1x),l1h => array(O1c,O1l),O1h => array(O1r,O1y),l1i => array(O1z),O1i => array(O1r,O1v,O1x),l1j => array(O1r,O1v),O1j => array(NULL,l1d,O1l),l1k => array(NULL,l1d,O1l),l1l => array(NULL,l1q),O1l => array(l1h,l1f,l1m),l1m => array(O1p,O1q,l1r,l1s,l1z),l1n => array(l1t,O20),O1n => array(O19,l1i,O1l,l20),l1p => array(O1r),l1o => array(NULL),O1o => array(l1l,O1r,l20)); $Oak=array(lj,Oj,lk,Ok,ll,lm);
\ No newline at end of file
+namespace kibella; if (LOG) { global $l8b; $l8b=@fopen(LOGFILE,"a+"); } global $l4b; global $O65; global $O4q; global $O4p; global $l9e; global $O5b; global $O8x; global $l8y; global $lbr; global $Obr; global $lbs; $l4b=array("sqlite" => O18,"sqlserver" => l19); $O65=array_keys($l4b); $l6e=array(O17); $O4q=array(O18 => O17,l19 => l18); $O4p=array(O19 => array(O1a => "(",l1b => ")",O18 => "select * from sqlite_master where lower(type) = 'table' and lower(name) = lower",l19 => "select * from MASTER.INFORMATION_SCHEMA.TABLES where upper(TABLE_TYPE) = 'BASE TABLE' and\n\t\t\t\t\t\t\t\tlower(TABLE_CATALOG) + '.' + lower(TABLE_SCHEMA) + '.' + lower(TABLE_NAME) = lower",),l1a => array(O1a => "(",l1b => ")",O18 => "PRAGMA table_info",l19 => "select COLUMN_NAME as name, DATA_TYPE as type from INFORMATION_SCHEMA.COLUMNS\n \t\t\t\t\t\t\t\twhere lower(TABLE_CATALOG) + '.' + lower(TABLE_SCHEMA) + '.' + lower(TABLE_NAME) = lower"),); $l9e=array(O1b => array(O18 => "rowid",l19 => "row_number() over (order by (select null))",),l1c => array(O18 => "IFNULL",l19 => "ISNULL")); $O5b=array("s" => "second","m" => "minute","h" => "hour","d" => "day","w" => "week","M" => "month","y" => "year"); $l8y=array(l20 => "avg",O20 => "count(distinct",MAX => "max",MIN => "min",O21 => "percentiles",l22 => "stddev",O22 => "sum",l21 => "count",); $lbr=array(l20,O20,l21,MAX,MIN,O21,O22); $O8x=array(O23 => array(NULL),l24 => array(array_values($lbr),O23,O24,l25,O2b,O2c,l2d,O2i),O24 => array(NULL,l2h,O2l,l2q),l25 => array(NULL,l2h,O2l,l2q),O25 => array(O2d,l2e),O26 => array(O25,O24,O2f),l27 => array(NULL),l28 => array(O27,O28),l29 => array(NULL),O29 => array(l2s,l2t,l2v),l2a => array(NULL),O2a => array(O2m,O2o,l2p,O2q,l2r),l2b => array(O26,O2f),O2b => array(O2l,O2s),l2c => array(O2t),O2c => array(O2l,O2p,O2r),l2d => array(O2l,O2p),O2d => array(NULL,l27,O2f),l2e => array(NULL,l27,O2f),l2f => array(NULL,l2k),O2f => array(l2b,l29,l2g),l2g => array(O2j,O2k,l2l,l2m,l2t),l2h => array(l2n,O2u),O2h => array(O23,l2c,O2f,l2u),l2j => array(O2l),l2i => array(NULL),O2i => array(l2f,O2l,l2u)); $Obr=array(l1f,O1f,l1g,O1g,l1h,O1h);
\ No newline at end of file
diff --git a/JSON_SQL_Bridge/requests.php b/JSON_SQL_Bridge/requests.php
index 937c69f..cd0eb5b 100644
--- a/JSON_SQL_Bridge/requests.php
+++ b/JSON_SQL_Bridge/requests.php
@@ -8,4 +8,4 @@
If you are interested in distributing, reselling, modifying, contibuting or in general creating
any derivative work from JSON_SQL_Bridge, please contact Frank Vanden Berghen at frank@timi.eu.
*/
-namespace kibella; require_once "config.php"; ob_start(); l9t("200 OK"); $Oa0=$_SERVER["REQUEST_URI"]; $Oal=$_SERVER["REQUEST_METHOD"]; $O9d=file_get_contents("php://input"); $l6f=json_decode($O9d,TRUE); $lam=O7; if (preg_match( "/$lam%2C/" ,$Oa0)) { if (array_key_exists("docs",$l6f)) { O2f("{\"docs\":["); for ($l2v=0; $l2v0) O2f(","); l5x("","",1,lo,"false"); } O2f("]}"); } } else if (preg_match("/_msearch/i",$Oa0)) { l9d($O9d); $l6f=explode("\n",$O9d); if (count($l6f)>1) { $O4i=$l6f[1]; l9y(O12,$O4i); } } else if (preg_match("/_mapping\\/field\\//i",$Oa0)) { $lan=la0($Oa0,ESDIRNAME,"begin"); $O28=$lan["object"]; O6o($O28); } else if (preg_match("/index-pattern\\/\$/i",$Oa0)) { $lan=la0($Oa0,ESDIRNAME,"begin"); $l22=$lan["object"]; l5x("index-pattern",$l22,1,lo,"true"); } else if (preg_match("/index-pattern\\/_search/i",$Oa0)) { O70(lr,lh,"*"); } else if (preg_match("/index-pattern/i",$Oa0)) { $lan=la0($Oa0,ESDIRNAME,"end"); $O28=$lan["object"]; if ($Oal == "POST") { l5x("index-pattern",$O28,1,lo,"true"); } else if ($Oal == "DELETE") { O5u(lr,lh,$O28); } } else if (preg_match("/_update\$/i",$Oa0)) { l9y(l12,$l6f["doc"]["defaultIndex"],$O9y="raw"); } else if (preg_match("/(dashboard|search|visualization)\\/_search/i",$Oa0,$O3e)) { assert(count($O3e)>=2,"Variable \$matches with the matched pattern has at least 1 element (found ".count($O3e).")"); $Oan=$O3e[1]; assert(array_key_exists("query",$l6f),"Attribute 'query' exists in the request array"); if (array_key_exists("simple_query_string",$l6f["query"]) && array_key_exists("query",$l6f["query"]["simple_query_string"])) { $O4n=$l6f["query"]["simple_query_string"]["query"]; } else { $O4n="*"; } O70(Ov,$Oan,$O4n); } else if (preg_match("/\\/dashboard|\\/search|\\/visualization/i",$Oa0,$O3e)) { assert(count($O3e)>=1,"Variable \$matches with the matched pattern has at least 1 element (found ".count($O3e).")"); $Oan=substr($O3e[0],1); $lan=la0($Oa0,ESDIRNAME,"end"); $O28=$lan["object"]; if ($Oal == "POST") { $l6w=$O9d; O6v($Oan,$l6w); } else if ($Oal == "GET") { $O28=la8($O28); l6g($Oan,$O28,$O6g=FALSE); } else if ($Oal == "DELETE") { $O28=la8($O28); O5u(Ov,$Oan,$O28); } } else if (preg_match("/\\/_search/i",$Oa0,$O3e)) { $lao=str_replace($O3e[0],"",$Oa0); $lan=la0($lao,ESDIRNAME,"end"); $O22=$lan["object"]; if (count($l6f["query"]["ids"]["values"])>0) { $O6j=$l6f["query"]["ids"]["values"][0]; O6i($O22,$O9d,$O6j); } } else if (preg_match("/_mget/i",$Oa0)) { assert(array_key_exists("docs",$l6f),"Attribute 'docs' exists in the request array"); assert(count($l6f["docs"] == 1),"There is only one request in the request array"); if (array_key_exists(lk,$l6f["docs"][0])) { $O28=$l6f["docs"][0][lk]; } else { $O28=""; } if (array_key_exists(Oj,$l6f["docs"][0])) { $O2e=$l6f["docs"][0][Oj]; switch ($O2e) { case (lg): l9u(); break; case (Og): case (Oh): case (Oi): l6g($O2e,$O28); break; case (lh): l6o($O28); break; default : break; } } } else { $Oa4=la5($Oa0); $Oa5=$Oa4["URI"]; $Oao=str_replace("/".ESDIRNAME,"",$Oa5); $Oao=str_replace(O7,"_kibana_4",$Oao); $Oao=preg_replace("/[\\/\\-\\.\\*]/","_",$Oao); if (function_exists( "kibella\\$Oao")) { call_user_func( "kibella\\$Oao"); } } ob_end_flush(); if (LOG) { fclose($O79); } exit;
\ No newline at end of file
+namespace kibella; require_once "config.php"; ob_start(); Ob0("200 OK"); $lb8=$_SERVER["REQUEST_URI"]; $Obs=$_SERVER["REQUEST_METHOD"]; $Oal=file_get_contents("php://input"); $l7j=json_decode($Oal,TRUE); $lbt=O12; if (preg_match( "/$lbt%2C/" ,$lb8)) { if (array_key_exists("docs",$l7j)) { O36("{\"docs\":["); for ($O3u=0; $O3u0) O36(","); O70("","",1,O1j,"false"); } O36("]}"); } } else if (preg_match("/_msearch/i",$lb8)) { lal($Oal); $l7j=explode("\n",$Oal); if (count($l7j)>1) { $O5h=$l7j[1]; Ob5(O1w,$O5h); } } else if (preg_match("/_mapping\\/field\\//i",$lb8)) { $lbu=Ob7($lb8,ESDIRNAME,"begin"); $O1=$lbu["object"]; O7s($O1); } else if (preg_match("/index-pattern\\/\$/i",$lb8)) { $lbu=Ob7($lb8,ESDIRNAME,"begin"); $O30=$lbu["object"]; O70("index-pattern",$O30,1,O1j,"true"); } else if (preg_match("/index-pattern\\/_search/i",$lb8)) { l82(O1m,O1d,"*"); } else if (preg_match("/index-pattern/i",$lb8)) { $lbu=Ob7($lb8,ESDIRNAME,"end"); $O1=$lbu["object"]; if ($Obs == "POST") { O70("index-pattern",$O1,1,O1j,"true"); } else if ($Obs == "DELETE") { l6y(O1m,O1d,$O1); } } else if (preg_match("/_update\$/i",$lb8)) { Ob5(l1w,$l7j["doc"]["defaultIndex"],$lb6="raw"); } else if (preg_match("/(dashboard|search|visualization)\\/_search/i",$lb8,$l4h)) { assert(count($l4h)>=2,"Variable \$matches with the matched pattern has at least 1 element (found ".count($l4h).")"); $Obu=$l4h[1]; assert(array_key_exists("query",$l7j),"Attribute 'query' exists in the request array"); if (array_key_exists("simple_query_string",$l7j["query"]) && array_key_exists("query",$l7j["query"]["simple_query_string"])) { $O5m=$l7j["query"]["simple_query_string"]["query"]; } else { $O5m="*"; } l82(l3,$Obu,$O5m); } else if (preg_match("/\\/dashboard|\\/search|\\/visualization/i",$lb8,$l4h)) { assert(count($l4h)>=1,"Variable \$matches with the matched pattern has at least 1 element (found ".count($l4h).")"); $Obu=substr($l4h[0],1); $lbu=Ob7($lb8,ESDIRNAME,"end"); $O1=$lbu["object"]; if ($Obs == "POST") { $O7x=$Oal; l7x($Obu,$O7x); } else if ($Obs == "GET") { $O1=lbf($O1); l7k($Obu,$O1,$O7k=FALSE); } else if ($Obs == "DELETE") { $O1=lbf($O1); l6y(l3,$Obu,$O1); } } else if (preg_match("/\\/_search/i",$lb8,$l4h)) { $lbv=str_replace($l4h[0],"",$lb8); $lbu=Ob7($lbv,ESDIRNAME,"end"); $l31=$lbu["object"]; if (count($l7j["query"]["ids"]["values"])>0) { $O7n=$l7j["query"]["ids"]["values"][0]; O7m($l31,$Oal,$O7n); } } else if (preg_match("/_mget/i",$lb8)) { assert(array_key_exists("docs",$l7j),"Attribute 'docs' exists in the request array"); assert(count($l7j["docs"] == 1),"There is only one request in the request array"); if (array_key_exists(l1g,$l7j["docs"][0])) { $O1=$l7j["docs"][0][l1g]; } else { $O1=""; } if (array_key_exists(O1f,$l7j["docs"][0])) { $l52=$l7j["docs"][0][O1f]; switch ($l52) { case (l1d): Ob1(); break; case (O4): case (l1e): case (O1e): l7k($l52,$O1); break; case (O1d): l7s($O1); break; default : break; } } } else { $Obb=lbc($lb8); $Obc=$Obb["URI"]; $Obv=str_replace("/".ESDIRNAME,"",$Obc); $Obv=str_replace(O12,"_kibana_4",$Obv); $Obv=preg_replace("/[\\/\\-\\.\\*]/","_",$Obv); if (function_exists( "kibella\\$Obv")) { call_user_func( "kibella\\$Obv"); } } ob_end_flush(); if (LOG) { fclose($l8b); } exit;
\ No newline at end of file
diff --git a/JSON_SQL_Bridge/reset.php b/JSON_SQL_Bridge/reset.php
index cd4383c..7736ebb 100644
--- a/JSON_SQL_Bridge/reset.php
+++ b/JSON_SQL_Bridge/reset.php
@@ -8,4 +8,4 @@
If you are interested in distributing, reselling, modifying, contibuting or in general creating
any derivative work from JSON_SQL_Bridge, please contact Frank Vanden Berghen at frank@timi.eu.
*/
-namespace kibella; require_once __DIR__."/config.php"; $O21=TABLESDIR."/".KIBELLADB; $Oaf=FALSE; $l29=checkdirexistsorcreate(TABLESDIR,$l2t=FALSE); if ($l29 === FALSE) { O29("",lc,l59().O59()); exit; } else { echo "
Kibella reset process started
"; if (file_exists($O21)) { $l29=unlink($O21); if (!$l29) { O29("\t\t",lc,"Could not delete database file '".$O21."'.\nThe process aborts.\n"); exit; } } } $l29=O5a($O77=NULL,$l2t=TRUE); $Oaf=!$l29; if ($Oaf === FALSE) { $l22="income"; $O21="income.sqlite"; $O24="sqlite"; $l25=""; $O25=""; $l26=""; $O26=1; $l27=array("table" => $l22,"db" => $O21,"dbtype" => $O24,"datefields" => $l25,"geofields" => $O25,"linkfields" => $l26,"enablecache" => $O26); $O27=l28($l27); $Oaf=!$l29 && !$O27["rc"]; } $l29=checkdirexistsorcreate(CACHEDIR,$l2t=FALSE); if ($l29 === FALSE) { $Oaf=TRUE; } else { $O9k=deletedir(CACHEDIR,$O2v=TRUE); if ($O9k) echo l6v("Cache files"); $Oaf=!$O9k; } if ($Oaf === FALSE) { echo "
System successfully reset
"; } else { echo "
ERRORS FOUND! Check messages shown above.
"; }
\ No newline at end of file
+namespace kibella; require_once __DIR__."/config.php"; $l30=TABLESDIR."/".KIBELLADB; $Obm=FALSE; $O3s=checkdirexistsorcreate(TABLESDIR,$O3r=FALSE); if ($O3s === FALSE) { showmessage("",TAG_ERROR,l69().O69()); exit; } else { echo "
Kibella reset process started
"; if (file_exists($l30)) { $O3s=unlink($l30); if (!$O3s) { showmessage("\t\t",TAG_ERROR,"Could not delete database file '".$l30."'.\nThe process aborts.\n"); exit; } } } $O3s=l6a($O89=NULL,$O3r=TRUE); $Obm=!$O3s; if ($Obm === FALSE) { $O30="income"; $l30="income.sqlite"; $lp=O18; $l6p=""; $O6p=""; $O7h=""; $O7v=1; $l7h=array("table" => $O30,"db" => $l30,"dbengine" => $lp,"datefields" => $l6p,"geofields" => $O6p,"linkfields" => $O7h,"enablecache" => $O7v); $l67=dbregistertable($l7h); $Obm=!$O3s && !$l67["rc"]; } $O3s=checkdirexistsorcreate(CACHEDIR,$O3r=FALSE); if ($O3s === FALSE) { $Obm=TRUE; } else { $Oar=deletedir(CACHEDIR,$l3v=TRUE); if ($Oar) echo l6l("Cache files"); $Obm=!$Oar; } if ($Obm === FALSE) { echo "
System successfully reset
"; } else { echo "
ERRORS FOUND! Check messages shown above.
"; }
\ No newline at end of file
diff --git a/JSON_SQL_Bridge/table/actions/insert.php b/JSON_SQL_Bridge/table/actions/insert.php
deleted file mode 100644
index 5e423db..0000000
--- a/JSON_SQL_Bridge/table/actions/insert.php
+++ /dev/null
@@ -1,98 +0,0 @@
-
- *
db name of the database where the table is located with no indication of the path (e.g. CensusIncome.sqlite)
- *
table name of the table for which the index should be created (e.g. census)
- *
- * */
-
-/*-------------------------- GET DATA FROM THE FORM ---------------------------*/
-$table = $_POST['table'];
-$db = $_POST['db'];
-$dbtype = "sqlite"; // In the future this attribute would be read from the form
-$datefields = $_POST['datefields']; // This is expected to be a list of date fields separated by commas
-$geofields = $_POST['geofields']; // This is expected to be a list of geo-coordinate fields separated by commas
-$linkfields = $_POST['linkfields']; // This is expected to be a list of link fields separated by commas
-$enablecache = $_POST['enablecache']; // Flag 0/1 indicating whether to enable the cache for the table
-$aTableInfo = array(
- 'table' => $table,
- 'db' => $db,
- 'dbtype' => $dbtype,
- 'datefields' => $datefields,
- 'geofields' => $geofields,
- 'linkfields' => $linkfields,
- 'enablecache' => $enablecache
-);
-/*-------------------------- GET DATA FROM THE FORM ---------------------------*/
-
-
-/*---------------------------- REGISTER THE TABLE -----------------------------*/
-// Save the table information in Kibella's database
-$aResult = dbRegisterTable($aTableInfo);
-$id = $aResult['id']; // Table ID
-$rc = $aResult['rc']; // Return code
-
-// Check the return code and show a message accordingly
-if ($rc === FALSE) {
- showMessage(__FILE__, TAG_ERROR_INTERNAL, msgErrorInternalTablesDir());
-} else {
- switch ($rc) {
- case (RC_NOTE_TABLE_ADDED):
- showMessage("", TAG_NOTE, msgNoteTableRegistrationAdded($table, $db, $id, $enablecache));
- break;
- case (RC_NOTE_TABLE_UPDATED):
- showMessage("", TAG_NOTE, msgNoteTableRegistrationUpdated($table, $db, $id, $enablecache));
- break;
- case (RC_ERROR_NOTFOUND_DB):
- showMessage("", TAG_ERROR, msgErrorDatabaseNotFound(DATADIR . "/" . $db));
- break;
- case (RC_ERROR_NOTFOUND_TABLE):
- showMessage("", TAG_ERROR, msgErrorTableNotFound($table, DATADIR . "/" . $db));
- break;
- default:
- showMessage(__FILE__, TAG_ERROR_INTERNAL, msgErrorInternalReturnCode($rc));
- break;
- }
-}
-
-// List the fields of special type (e.g. date, geo, link) specified by the user that were found in the user table
-if ($datefields !== "" or $geofields !== "" or $linkfields !== "") {
- // Show a message with the fields registered as special-type fields
- echo "
The following fields were registered as fields of special type:
- Careful! The field selected contains analyzed strings. Analyzed strings are highly unique and can use a lot of memory to visualize. Values such as foo-bar will be broken into foo and bar. See Mapping Core Types for more information on setting this field as not_analyzed
-
-
+ Careful! The selected field contains analyzed strings. Analyzed strings are highly unique and can use a lot of memory to visualize.
Tip:{{agg.params.field.name + '.raw'}} may be a not_analyzed version of this field.
@@ -31,7 +29,7 @@
- No Compatible Fields: The "{{ vis.indexPattern.id }}" index pattern does not contain any of the following field types: {{ agg.type.params.byName.field.filterFieldTypes | commaList:false }}
+ No Compatible Fields: The "{{ vis.indexPattern.id }}" Dataset does not contain any of the following field types: {{ agg.type.params.byName.field.filterFieldTypes | commaList:false }}
- Any JSON formatted properties you add here will be merged with the elasticsearch aggregation definition for this section. For example shard_size on a terms aggregation
+ Any JSON formatted properties you add here will be merged with the aggregation definition for this section. For example shard_size on a terms aggregation
diff --git a/interface/components/config/defaults.js b/interface/components/config/defaults.js
index dc7d5b5..9f8ac44 100644
--- a/interface/components/config/defaults.js
+++ b/interface/components/config/defaults.js
@@ -10,7 +10,7 @@ define(function () {
},
'sort:options': {
value: '{ "unmapped_type": "boolean" }',
- description: 'Options the Elasticsearch sort parameter',
+ description: 'Options the sort parameter',
type: 'json'
},
'dateFormat': {
@@ -35,8 +35,8 @@ define(function () {
' http://en.wikipedia.org/wiki/ISO_8601#Time_intervals'
},
'defaultIndex': {
- value: null,
- description: 'The index to access if no index is set',
+ value: "INCOME(income)",
+ description: 'The dataset to access if no dataset is set',
},
'metaFields': {
value: ['_source', '_id', '_type', '_index'],
@@ -90,7 +90,7 @@ define(function () {
},
'indexPattern:fieldMapping:lookBack': {
value: 5,
- description: 'For index patterns containing timestamps in their names, look for this many recent matching ' +
+ description: 'For datasets containing timestamps in their names, look for this many recent matching ' +
'patterns from which to query the field mapping.'
},
'format:defaultTypeMap': {
diff --git a/interface/components/courier/data_source/_root_search_source.js b/interface/components/courier/data_source/_root_search_source.js
index e14162f..30638f9 100644
--- a/interface/components/courier/data_source/_root_search_source.js
+++ b/interface/components/courier/data_source/_root_search_source.js
@@ -21,14 +21,14 @@ define(function (require) {
* @return {Promise}
*/
function loadDefaultPattern() {
- return notify.event('loading default index pattern', function () {
+ return notify.event('loading default Dataset', function () {
var defId = config.get('defaultIndex');
return Promise.cast(defId && indexPatterns.get(defId))
.then(function (pattern) {
pattern = pattern || undefined;
globalSource.set('index', pattern);
- notify.log('index pattern set to', defId);
+ notify.log('Current Dataset set to', defId);
});
});
}
diff --git a/interface/components/courier/fetch/_call_client.js b/interface/components/courier/fetch/_call_client.js
index 2ac51a3..f0ef815 100644
--- a/interface/components/courier/fetch/_call_client.js
+++ b/interface/components/courier/fetch/_call_client.js
@@ -66,7 +66,7 @@ define(function (require) {
};
// Now that all of THAT^^^ is out of the way, lets actually
- // call out to elasticsearch
+ // call out to Back-end
Promise.map(executable, function (req) {
return Promise.try(req.getFetchParams, void 0, req)
.then(function (fetchParams) {
diff --git a/interface/components/courier/fetch/strategy/doc.js b/interface/components/courier/fetch/strategy/doc.js
index 005de6d..8cc413c 100644
--- a/interface/components/courier/fetch/strategy/doc.js
+++ b/interface/components/courier/fetch/strategy/doc.js
@@ -15,8 +15,8 @@ define(function (require) {
},
/**
- * Fetch the multiple responses from the ES Response
- * @param {object} resp - The response sent from Elasticsearch
+ * Fetch the multiple responses from the Back-end Response
+ * @param {object} resp - The response sent from Back-end
* @return {array} - the list of responses
*/
getResponses: function (resp) {
diff --git a/interface/components/courier/fetch/strategy/search.js b/interface/components/courier/fetch/strategy/search.js
index 742fdc0..b593718 100644
--- a/interface/components/courier/fetch/strategy/search.js
+++ b/interface/components/courier/fetch/strategy/search.js
@@ -34,7 +34,7 @@ define(function (require) {
/**
* Fetch the multiple responses from the ES Response
- * @param {object} resp - The response sent from Elasticsearch
+ * @param {object} resp - The response sent from Back-end
* @return {array} - the list of responses
*/
getResponses: function (resp) {
diff --git a/interface/components/courier/saved_object/saved_object.js b/interface/components/courier/saved_object/saved_object.js
index cf1c62e..125675c 100644
--- a/interface/components/courier/saved_object/saved_object.js
+++ b/interface/components/courier/saved_object/saved_object.js
@@ -81,7 +81,7 @@ define(function (require) {
return mappingSetup.setup(type, mapping);
})
.then(function () {
- // If there is not id, then there is no document to fetch from elasticsearch
+ // If there is not id, then there is no document to fetch from Back-end
if (!self.id) {
// just assign the defaults and be done
_.assign(self, defaults);
@@ -277,7 +277,7 @@ define(function (require) {
};
/**
- * Delete this object from Elasticsearch
+ * Delete this object from Back-end
* @return {promise}
*/
self.delete = function () {
diff --git a/interface/components/doc_table/lib/get_sort.js b/interface/components/doc_table/lib/get_sort.js
index 18f5c47..2a85345 100644
--- a/interface/components/doc_table/lib/get_sort.js
+++ b/interface/components/doc_table/lib/get_sort.js
@@ -5,7 +5,7 @@ define(function (require) {
* Take a sorting array and make it into an object
* @param {array} 2 item array [fieldToSort, directionToSort]
* @param {object} indexPattern used for determining default sort
- * @returns {object} a sort object suitable for returning to elasticsearch
+ * @returns {object} a sort object suitable for returning to Back-end
*/
function getSort(sort, indexPattern) {
var sortObj = {};
diff --git a/interface/components/errors.js b/interface/components/errors.js
index 6cec8bf..d44a94b 100644
--- a/interface/components/errors.js
+++ b/interface/components/errors.js
@@ -56,7 +56,7 @@ define(function (require) {
err = err || false;
KbnError.call(this,
- 'Request to Elasticsearch failed: ' + angular.toJson(resp || err.message),
+ 'Request to WebServer failed: ' + angular.toJson(resp || err.message),
errors.RequestFailure);
this.origError = err;
@@ -133,7 +133,7 @@ define(function (require) {
*/
errors.CacheWriteFailure = function CacheWriteFailure() {
KbnError.call(this,
- 'A Elasticsearch cache write has failed.',
+ 'A cache write has failed.',
errors.CacheWriteFailure);
};
inherits(errors.CacheWriteFailure, KbnError);
@@ -228,7 +228,7 @@ define(function (require) {
inherits(errors.NotEnoughData, KbnError);
/**
- * error thrown when no results are returned from an elasticsearch query
+ * error thrown when no results are returned from a query
*/
errors.NoResults = function NoResults() {
KbnError.call(this,
@@ -238,7 +238,7 @@ define(function (require) {
inherits(errors.NoResults, KbnError);
/**
- * error thrown when no results are returned from an elasticsearch query
+ * error thrown when no results are returned from a query
*/
errors.PieContainsAllZeros = function PieContainsAllZeros() {
KbnError.call(this,
@@ -248,7 +248,7 @@ define(function (require) {
inherits(errors.PieContainsAllZeros, KbnError);
/**
- * error thrown when no results are returned from an elasticsearch query
+ * error thrown when no results are returned from a query
*/
errors.InvalidLogScaleValues = function InvalidLogScaleValues() {
KbnError.call(this,
diff --git a/interface/components/field_editor/scripting_warning.html b/interface/components/field_editor/scripting_warning.html
index c525c9e..d800555 100644
--- a/interface/components/field_editor/scripting_warning.html
+++ b/interface/components/field_editor/scripting_warning.html
@@ -7,5 +7,5 @@
- Scripted fields can be used to display and aggregate calculated values. As such, they can be very slow, and if done incorrectly, can cause Kibana to be unusable. There's no safety net here. If you make a typo, unexpected exceptions will be thrown all over the place!
+ Scripted fields can be used to display and aggregate calculated values. As such, they can be very slow, and if done incorrectly, can cause Kibella to become unusable. There's no safety net here. If you make a typo, unexpected exceptions will be thrown all over the place!
diff --git a/interface/components/highlight/highlight_tags.js b/interface/components/highlight/highlight_tags.js
index 2f6aea6..d5688b2 100644
--- a/interface/components/highlight/highlight_tags.js
+++ b/interface/components/highlight/highlight_tags.js
@@ -1,7 +1,7 @@
define(function (require) {
var module = require('ui/modules').get('kibana');
- // By default, ElasticSearch surrounds matched values in . This is not ideal because it is possible that
+ // By default, Back-end surrounds matched values in . This is not ideal because it is possible that
// the value could contain in the value. We define these custom tags that we would never expect to see
// inside a field value.
module.constant('highlightTags', {
diff --git a/interface/components/index_patterns/_index_pattern.js b/interface/components/index_patterns/_index_pattern.js
index 9817a3b..a71425b 100644
--- a/interface/components/index_patterns/_index_pattern.js
+++ b/interface/components/index_patterns/_index_pattern.js
@@ -75,7 +75,7 @@ define(function (require) {
return mappingSetup.setup(type, mapping);
})
.then(function () {
- // If there is no id, then there is no document to fetch from elasticsearch
+ // If there is no id, then there is no document to fetch from Back-end
if (!self.id) return;
// fetch the object from ES
diff --git a/interface/components/index_patterns/_map_field.js b/interface/components/index_patterns/_map_field.js
index 1e6ce76..59040ae 100644
--- a/interface/components/index_patterns/_map_field.js
+++ b/interface/components/index_patterns/_map_field.js
@@ -5,7 +5,7 @@ define(function (require) {
/**
* Accepts a field object and its name, and tries to give it a mapping
- * @param {Object} field - the field mapping returned by elasticsearch
+ * @param {Object} field - the field mapping returned by Back-end
* @param {String} type - name of the field
* @return {Object} - the resulting field after overrides and tweaking
*/
@@ -16,7 +16,7 @@ define(function (require) {
var mapping = _.cloneDeep(field.mapping[keys.shift()]);
mapping.type = castMappingType(mapping.type);
- // Override the mapping, even if elasticsearch says otherwise
+ // Override the mapping, even if Back-end says otherwise
var mappingOverrides = {
_timestamp: {
type: 'date',
@@ -29,7 +29,7 @@ define(function (require) {
};
if (!mapping.index || mapping.index === 'no') {
- // elasticsearch responds with false sometimes and 'no' others
+ // Back-end responds with false sometimes and 'no' others
mapping.indexed = false;
} else {
mapping.indexed = true;
diff --git a/interface/components/index_patterns/_mapper.js b/interface/components/index_patterns/_mapper.js
index d747b1e..2e5a478 100644
--- a/interface/components/index_patterns/_mapper.js
+++ b/interface/components/index_patterns/_mapper.js
@@ -100,7 +100,7 @@ define(function (require) {
};
/**
- * Clears mapping caches from elasticsearch and from local object
+ * Clears mapping caches from Back-end and from local object
* @param {dataSource} dataSource
* @returns {Promise}
* @async
diff --git a/interface/components/setup/steps/check_es_version.js b/interface/components/setup/steps/check_es_version.js
index 5453404..a8bc667 100644
--- a/interface/components/setup/steps/check_es_version.js
+++ b/interface/components/setup/steps/check_es_version.js
@@ -32,10 +32,7 @@ define(function (require) {
});
throw SetupError(
- 'This version of Kibana requires Elasticsearch ' +
- minimumElasticsearchVersion + ' or higher on all nodes. ' +
- 'I found the following incompatible nodes in your cluster: \n\n' +
- badNodeNames.join('\n')
+ 'This version of Kibeblla requires a specific Back-end'
);
});
});
diff --git a/interface/components/setup/steps/check_for_es.js b/interface/components/setup/steps/check_for_es.js
index 951f525..0e57be9 100644
--- a/interface/components/setup/steps/check_for_es.js
+++ b/interface/components/setup/steps/check_for_es.js
@@ -12,7 +12,7 @@ define(function (require) {
if (err.body && err.body.message) {
throw new SetupError(err.body.message, err);
} else {
- throw new SetupError('Unknown error while connecting to Elasticsearch', err);
+ throw new SetupError('Unknown error while connecting to Back-end server', err);
}
})
.then(complete, complete.failure);
diff --git a/interface/components/setup/steps/check_for_kibana_index.js b/interface/components/setup/steps/check_for_kibana_index.js
index ca962e3..bc8582a 100644
--- a/interface/components/setup/steps/check_for_kibana_index.js
+++ b/interface/components/setup/steps/check_for_kibana_index.js
@@ -9,7 +9,7 @@ define(function (require) {
index: configFile.kibana_index
})
.catch(function (err) {
- throw new SetupError('Unable to check for Kibana index "<%= configFile.kibana_index %>"', err);
+ throw new SetupError('Unable to check for any Kibella back-end "<%= configFile.kibana_index %>"', err);
})
.then(complete, complete.failure);
};
diff --git a/interface/components/setup/steps/create_kibana_index.js b/interface/components/setup/steps/create_kibana_index.js
index 840984c..71252be 100644
--- a/interface/components/setup/steps/create_kibana_index.js
+++ b/interface/components/setup/steps/create_kibana_index.js
@@ -14,7 +14,7 @@ define(function (require) {
}
})
.catch(function (err) {
- throw new SetupError('Unable to create Kibana index "<%= configFile.kibana_index %>"', err);
+ throw new SetupError('Unable to create Kibella back-end "<%= configFile.kibana_index %>"', err);
})
.then(function () {
return es.cluster.health({
@@ -22,7 +22,7 @@ define(function (require) {
index: configFile.kibana_index
})
.catch(function (err) {
- throw new SetupError('Waiting for Kibana index "<%= configFile.kibana_index %>" to come online failed', err);
+ throw new SetupError('Waiting for Kibella back-end "<%= configFile.kibana_index %>" to come online failed', err);
});
})
.then(complete, complete.failure);
diff --git a/interface/components/time_buckets/time_buckets.js b/interface/components/time_buckets/time_buckets.js
index 1257634..084c253 100644
--- a/interface/components/time_buckets/time_buckets.js
+++ b/interface/components/time_buckets/time_buckets.js
@@ -178,8 +178,8 @@ define(function (require) {
* - "10 days"
* - "3 years"
*
- * interval.expr: the elasticsearch expression that creates this
- * interval. If the interval does not properly form an elasticsearch
+ * interval.expr: the expression that creates this
+ * interval. If the interval does not properly form an
* expression it will be forced into one.
*
* interval.scaled: the interval was adjusted to
diff --git a/interface/components/vis/_agg_config_result.js b/interface/components/vis/_agg_config_result.js
index d1b4c8b..d2bfb77 100644
--- a/interface/components/vis/_agg_config_result.js
+++ b/interface/components/vis/_agg_config_result.js
@@ -28,8 +28,8 @@ define(function () {
};
/**
- * Returns an Elasticsearch filter that represents the result.
- * @returns {object} Elasticsearch filter
+ * Returns a filter that represents the result.
+ * @returns {object} filter
*/
AggConfigResult.prototype.createFilter = function () {
return this.aggConfig.createFilter(this.key);
diff --git a/interface/components/vislib/lib/data.js b/interface/components/vislib/lib/data.js
index 084f48a..b3874d0 100644
--- a/interface/components/vislib/lib/data.js
+++ b/interface/components/vislib/lib/data.js
@@ -14,7 +14,7 @@ define(function (require) {
*
* @class Data
* @constructor
- * @param data {Object} Elasticsearch query results
+ * @param data {Object} query results
* @param attr {Object|*} Visualization options
*/
function Data(data, attr) {
diff --git a/interface/components/vislib/lib/layout/layout.js b/interface/components/vislib/lib/layout/layout.js
index 52203e2..a8afb14 100644
--- a/interface/components/vislib/lib/layout/layout.js
+++ b/interface/components/vislib/lib/layout/layout.js
@@ -17,7 +17,7 @@ define(function (require) {
* @class Layout
* @constructor
* @param el {HTMLElement} HTML element to which the chart will be appended
- * @param data {Object} Elasticsearch query results for this specific chart
+ * @param data {Object} query results for this specific chart
* @param chartType {Object} Reference to chart functions, i.e. Pie
*/
function Layout(el, data, chartType, opts) {
diff --git a/interface/components/vislib/vis.js b/interface/components/vislib/vis.js
index dc3aaea..3d902ad 100644
--- a/interface/components/vislib/vis.js
+++ b/interface/components/vislib/vis.js
@@ -37,7 +37,7 @@ define(function (require) {
* Renders the visualization
*
* @method render
- * @param data {Object} Elasticsearch query results
+ * @param data {Object} query results
*/
Vis.prototype.render = function (data) {
var chartType = this._attr.type;
diff --git a/interface/components/vislib/visualizations/_chart.js b/interface/components/vislib/visualizations/_chart.js
index 025f6df..c3ad5ad 100644
--- a/interface/components/vislib/visualizations/_chart.js
+++ b/interface/components/vislib/visualizations/_chart.js
@@ -14,7 +14,7 @@ define(function (require) {
* @constructor
* @param handler {Object} Reference to the Handler Class Constructor
* @param el {HTMLElement} HTML element to which the chart will be appended
- * @param chartData {Object} Elasticsearch query results for this specific chart
+ * @param chartData {Object} query results for this specific chart
*/
function Chart(handler, el, chartData) {
if (!(this instanceof Chart)) {
diff --git a/interface/components/vislib/visualizations/_point_series_chart.js b/interface/components/vislib/visualizations/_point_series_chart.js
index b086f15..dd40e15 100644
--- a/interface/components/vislib/visualizations/_point_series_chart.js
+++ b/interface/components/vislib/visualizations/_point_series_chart.js
@@ -43,7 +43,7 @@ define(function (require) {
* Stacks chart data values
*
* @method stackData
- * @param data {Object} Elasticsearch query result for this chart
+ * @param data {Object} query result for this chart
* @returns {Array} Stacked data objects with x, y, and y0 values
*/
PointSeriesChart.prototype.stackData = function (data) {
diff --git a/interface/components/vislib/visualizations/area_chart.js b/interface/components/vislib/visualizations/area_chart.js
index 2f51b55..4fd430f 100644
--- a/interface/components/vislib/visualizations/area_chart.js
+++ b/interface/components/vislib/visualizations/area_chart.js
@@ -16,7 +16,7 @@ define(function (require) {
* @extends Chart
* @param handler {Object} Reference to the Handler Class Constructor
* @param el {HTMLElement} HTML element to which the chart will be appended
- * @param chartData {Object} Elasticsearch query results for this specific
+ * @param chartData {Object} query results for this specific
* chart
*/
_(AreaChart).inherits(PointSeriesChart);
diff --git a/interface/components/vislib/visualizations/column_chart.js b/interface/components/vislib/visualizations/column_chart.js
index 9f0fe14..dcc8f21 100644
--- a/interface/components/vislib/visualizations/column_chart.js
+++ b/interface/components/vislib/visualizations/column_chart.js
@@ -19,7 +19,7 @@ define(function (require) {
* @extends Chart
* @param handler {Object} Reference to the Handler Class Constructor
* @param el {HTMLElement} HTML element to which the chart will be appended
- * @param chartData {Object} Elasticsearch query results for this specific chart
+ * @param chartData {Object} query results for this specific chart
*/
_(ColumnChart).inherits(PointSeriesChart);
function ColumnChart(handler, chartEl, chartData) {
diff --git a/interface/components/vislib/visualizations/line_chart.js b/interface/components/vislib/visualizations/line_chart.js
index 3689477..2c5c6db 100644
--- a/interface/components/vislib/visualizations/line_chart.js
+++ b/interface/components/vislib/visualizations/line_chart.js
@@ -16,7 +16,7 @@ define(function (require) {
* @extends Chart
* @param handler {Object} Reference to the Handler Class Constructor
* @param el {HTMLElement} HTML element to which the chart will be appended
- * @param chartData {Object} Elasticsearch query results for this specific chart
+ * @param chartData {Object} query results for this specific chart
*/
_(LineChart).inherits(PointSeriesChart);
function LineChart(handler, chartEl, chartData) {
diff --git a/interface/components/vislib/visualizations/pie_chart.js b/interface/components/vislib/visualizations/pie_chart.js
index 5689765..6587ab0 100644
--- a/interface/components/vislib/visualizations/pie_chart.js
+++ b/interface/components/vislib/visualizations/pie_chart.js
@@ -15,7 +15,7 @@ define(function (require) {
* @extends Chart
* @param handler {Object} Reference to the Handler Class Constructor
* @param el {HTMLElement} HTML element to which the chart will be appended
- * @param chartData {Object} Elasticsearch query results for this specific chart
+ * @param chartData {Object} query results for this specific chart
*/
_(PieChart).inherits(Chart);
function PieChart(handler, chartEl, chartData) {
diff --git a/interface/components/vislib/visualizations/tile_map.js b/interface/components/vislib/visualizations/tile_map.js
index 75c3094..c55cc9b 100644
--- a/interface/components/vislib/visualizations/tile_map.js
+++ b/interface/components/vislib/visualizations/tile_map.js
@@ -25,7 +25,7 @@ define(function (require) {
* @extends Chart
* @param handler {Object} Reference to the Handler Class Constructor
* @param chartEl {HTMLElement} HTML element to which the map will be appended
- * @param chartData {Object} Elasticsearch query results for this map
+ * @param chartData {Object} query results for this map
*/
_(TileMap).inherits(Chart);
function TileMap(handler, chartEl, chartData) {
diff --git a/interface/components/visualize/spy/_req_resp_stats.html b/interface/components/visualize/spy/_req_resp_stats.html
index 0668beb..62d571d 100644
--- a/interface/components/visualize/spy/_req_resp_stats.html
+++ b/interface/components/visualize/spy/_req_resp_stats.html
@@ -12,14 +12,14 @@
-
+
Enable the cache for the results run on this table?
diff --git a/interface/plugins/discover/_hit_sort_fn.js b/interface/plugins/discover/_hit_sort_fn.js
index 7738c39..19cdc4e 100644
--- a/interface/plugins/discover/_hit_sort_fn.js
+++ b/interface/plugins/discover/_hit_sort_fn.js
@@ -6,7 +6,7 @@ define(function () {
* es used to sort them.
*
* background:
- * When a hit is sorted by elasticsearch, es will write the values that it used
+ * When a hit is sorted by Back-end, Back-end will write the values that it used
* to sort them into an array at the top level of the hit like so
*
* ```
diff --git a/interface/plugins/discover/components/field_chooser/lib/field_calculator.js b/interface/plugins/discover/components/field_chooser/lib/field_calculator.js
index f5d231e..cf582f2 100644
--- a/interface/plugins/discover/components/field_chooser/lib/field_calculator.js
+++ b/interface/plugins/discover/components/field_chooser/lib/field_calculator.js
@@ -43,7 +43,7 @@ define(function (require) {
if (params.hits.length - missing === 0) {
return {
- error: 'This field is present in your elasticsearch mapping' +
+ error: 'This field is present in your mapping' +
' but not in any documents in the search results.' +
' You may still be able to visualize or search on it.'
};
diff --git a/interface/plugins/discover/index.html b/interface/plugins/discover/index.html
index d7a1833..d6d1497 100644
--- a/interface/plugins/discover/index.html
+++ b/interface/plugins/discover/index.html
@@ -118,7 +118,7 @@
Expand your time range
Refine your query
- The search bar at the top uses Elasticsearch's support for Lucene Query String syntax. Let's say we're searching web server logs that have been parsed into a few fields.
+ The search bar at the top uses Lucene Query String syntax. Let's say we're searching web server logs that have been parsed into a few fields.
- Oh no. Something went very wrong. Its not just that I couldn't find your document, I couldn't even try. The index was missing, or the type. Go check out Elasticsearch, something isn't quite right here.
+ Oh no. Something went very wrong. Its not just that I couldn't find your document, I couldn't even try. The index was missing, or the type. Go check out Back-end Server, something isn't quite right here.
diff --git a/interface/plugins/enhanced_tilemap/geoserver.md b/interface/plugins/enhanced_tilemap/geoserver.md
index bdf6768..2be84b8 100644
--- a/interface/plugins/enhanced_tilemap/geoserver.md
+++ b/interface/plugins/enhanced_tilemap/geoserver.md
@@ -7,16 +7,16 @@ As the map is zoomed and panned, new tiles are requested and displayed.
[Geoserver](http://geoserver.org/) is an open source server that implements OGC compliant standards such as WMS.
Geoserver provides the tools needed to turn geospatial data into map tiles.
-Out of the box, geoserver supports data stores such as PostGis and static files - but not Elasticsearch.
-[ElasticGeo](https://github.com/ngageoint/elasticgeo) provides the plumbing needed to hook up geoserver to Elasticsearch.
+Out of the box, geoserver supports data stores such as PostGis and static files - but not Kibella.
+[ElasticGeo](https://github.com/ngageoint/elasticgeo) provides the plumbing needed to hook up geoserver to Kibella.
A servlet is a Java program that implements the Java Servlet API - a standard for Java classes that respond to requests.
Geoserver is a servlet.
Servlets are deployed in web containers. A web container is an application that manages one to many servlets.
[Apache Tomcat](http://tomcat.apache.org/) is an easy to use web container.
-### Passing Elasticsearch queries over WMS
-ElasticGeo exposes native Elasticsearch query functionality with the WMS parameter [viewparams](https://github.com/ngageoint/elasticgeo/blob/master/gs-web-elasticsearch/doc/index.rst#custom-q-and-f-parameters).
+### Passing Kibella queries over WMS
+ElasticGeo exposes native Kibella query functionality with the WMS parameter [viewparams](https://github.com/ngageoint/elasticgeo/blob/master/gs-web-elasticsearch/doc/index.rst#custom-q-and-f-parameters).
The enhanced tilemap plugin uses this mechanism to pass the identical query Kibana used for aggregations to the WMS server.
## Installation
@@ -40,7 +40,7 @@ The enhanced tilemap plugin uses this mechanism to pass the identical query Kiba
View the page http://localhost:8080/geoserver/web/wicket/bookmarkable/org.geoserver.web.data.store.NewDataPage and ensure that Elasticsearch is an option under Vector Data Source.
## Setting up a WMS layer
-Must have elasticsearch 2.2 instance running on the standard ports with an index containing a top level field with either a geo_point or geo_shape type.
+Must have Kibella Back-end server running on the standard ports with an index containing a top level field with either a geo_point or geo_shape type.
### Login as admin
username: admin
diff --git a/interface/plugins/enhanced_tilemap/vislib/geoFilter.js b/interface/plugins/enhanced_tilemap/vislib/geoFilter.js
index 18cc0e5..96db813 100644
--- a/interface/plugins/enhanced_tilemap/vislib/geoFilter.js
+++ b/interface/plugins/enhanced_tilemap/vislib/geoFilter.js
@@ -59,10 +59,10 @@ define(function (require) {
}
/**
- * Convert elasticsearch geospatial filter to leaflet vectors
+ * Convert geospatial filter to leaflet vectors
*
* @method toVector
- * @param filter {Object} elasticsearch geospatial filter
+ * @param filter {Object} geospatial filter
* @param field {String} Index field name for geo_point or geo_shape field
* @return {Array} Array of Leaftet Vector Layers constructed from filter geometries
*/
diff --git a/interface/plugins/extended_metric_vis/extended_metric_vis.js b/interface/plugins/extended_metric_vis/extended_metric_vis.js
index 244a143..dcb6b89 100644
--- a/interface/plugins/extended_metric_vis/extended_metric_vis.js
+++ b/interface/plugins/extended_metric_vis/extended_metric_vis.js
@@ -17,7 +17,7 @@ define(function (require) {
// Vis object of this type.
return new TemplateVisType({
name: 'extended_metric',
- title: 'Extended Metric',
+ title: 'Metric(Ext.)',
description: 'Based on the core Metric-Plugin but gives you the ability' +
'to output custom aggregates on metric-results.',
icon: 'fa-calculator',
diff --git a/interface/plugins/kbn_dotplot/kbn_dotplot.js b/interface/plugins/kbn_dotplot/kbn_dotplot.js
index b6a0b8f..05dc18c 100644
--- a/interface/plugins/kbn_dotplot/kbn_dotplot.js
+++ b/interface/plugins/kbn_dotplot/kbn_dotplot.js
@@ -34,9 +34,9 @@ function DotplotVisTypeProvider(Private) {
// Vis object of this type.
return new TemplateVisType({
name: 'dotplot',
- title: 'Dot plot',
+ title: 'Scatter plot',
icon: 'fa-ellipsis-v',
- description: 'Display values in a dot plot',
+ description: 'Display values in a Scatter plot',
// category: VisType.CATEGORY.DATA,
template: DotplotVisTemplate,
params: {
diff --git a/interface/plugins/kibi_timeline_vis/lib/directives/kibi_select.html b/interface/plugins/kibi_timeline_vis/lib/directives/kibi_select.html
index e85bb4d..29a9f57 100644
--- a/interface/plugins/kibi_timeline_vis/lib/directives/kibi_select.html
+++ b/interface/plugins/kibi_timeline_vis/lib/directives/kibi_select.html
@@ -22,7 +22,7 @@
- Careful! The field selected contains analyzed strings. Values such as foo-bar will be broken into foo and bar. See Mapping Core Types for more information on setting this field as not_analyzed
+ Careful! The field selected contains analyzed strings.
diff --git a/interface/plugins/metric_vis_colors/metric_vis_colors.js b/interface/plugins/metric_vis_colors/metric_vis_colors.js
index d76c35c..ae64f99 100644
--- a/interface/plugins/metric_vis_colors/metric_vis_colors.js
+++ b/interface/plugins/metric_vis_colors/metric_vis_colors.js
@@ -16,7 +16,7 @@ define(function (require) {
// Vis object of this type.
return new TemplateVisType({
name: 'metric-vis-colors',
- title: 'Simple Metric',
+ title: 'Metric(Simple)',
description: 'One big number for all of your one big number needs. Perfect for showing ' +
'a count of hits, or the exact average a numeric field. Now with customizable colors.',
icon: 'fa-calculator',
diff --git a/interface/plugins/pie/c3_vis.js b/interface/plugins/pie/c3_vis.js
index ba07e74..4bac88f 100644
--- a/interface/plugins/pie/c3_vis.js
+++ b/interface/plugins/pie/c3_vis.js
@@ -16,9 +16,9 @@ console.log("cc", colors.params)
return new TemplateVisType({
name: 'pie_chart',
- title: 'Plotly Pie',
+ title: 'Pie',
icon: 'fa-pie-chart',
- description: 'This is Kibella plugin which uses the JavaScript library Plotly for data representations.',
+ description: 'This is a Kibella plugin which uses the JavaScript library Plotly for data representations.',
template: c3VisTemplate,
params: {
defaults: Object.assign({
diff --git a/interface/plugins/settings/sections/about/index.html b/interface/plugins/settings/sections/about/index.html
index 1526955..ccf277f 100644
--- a/interface/plugins/settings/sections/about/index.html
+++ b/interface/plugins/settings/sections/about/index.html
@@ -135,12 +135,12 @@
diff --git a/interface/plugins/settings/sections/indices/_create.js b/interface/plugins/settings/sections/indices/_create.js
index db0d69a..b524347 100644
--- a/interface/plugins/settings/sections/indices/_create.js
+++ b/interface/plugins/settings/sections/indices/_create.js
@@ -70,7 +70,7 @@ define(function (require) {
})
.catch(function (err) {
if (err instanceof MissingIndices) {
- notify.error('Could not locate any indices matching that pattern. Please add the index to Elasticsearch');
+ notify.error('Could not locate any indices matching that pattern. Please add the index to Kibella');
}
else notify.fatal(err);
});
diff --git a/interface/plugins/settings/sections/indices/_edit.html b/interface/plugins/settings/sections/indices/_edit.html
index 51b20cc..efd87ef 100644
--- a/interface/plugins/settings/sections/indices/_edit.html
+++ b/interface/plugins/settings/sections/indices/_edit.html
@@ -11,16 +11,12 @@
This page lists every field in the {{indexPattern.id}}
- index and the field's associated core type as recorded by Elasticsearch.
- While this list allows you to view the core type of each field, changing
- field types must be done using Elasticsearch's
-
- Mapping API
-
-
+ Dataset and the field's associated core type as recorded in Kibella
+ This list is read-only: you can only view the core type of each field, not changing
+ it.
- This index uses a Time-based index pattern which repeats
+ This Dataset uses a Time-based Datasets which repeats
Mapping conflict! {{conflictFields.length > 1 ? conflictFields.length : 'A'}} field{{conflictFields.length > 1 ? 's' : ''}} {{conflictFields.length > 1 ? 'are' : 'is'}} defined as several types (string, integer, etc) across the indices that match this pattern. You may still be able to use these conflict fields in parts of Kibana, but they will be unavailable for functions that require Kibana to know their type. Correcting this issue will require reindexing your data.
diff --git a/interface/plugins/settings/sections/indices/_index_header.html b/interface/plugins/settings/sections/indices/_index_header.html
index 7ae9f79..6e8a5a2 100644
--- a/interface/plugins/settings/sections/indices/_index_header.html
+++ b/interface/plugins/settings/sections/indices/_index_header.html
@@ -24,11 +24,11 @@