fixes for saimod log and security,header fixes, autoload_all
This commit is contained in:
parent
5a6294bdb6
commit
59ca6e5ab9
@ -122,7 +122,7 @@ function load_visualisation(id, filter){
|
|||||||
});
|
});
|
||||||
$.each(json, function(key, value){first = true; data.addRow($.map(value, function(v) { if(first){first=false;return [new Date(v)];}else{return [(v == null || parseFloat(v) <= 0) ? 0.1 : parseFloat(v)];}}));});
|
$.each(json, function(key, value){first = true; data.addRow($.map(value, function(v) { if(first){first=false;return [new Date(v)];}else{return [(v == null || parseFloat(v) <= 0) ? 0.1 : parseFloat(v)];}}));});
|
||||||
|
|
||||||
var options = {title: id, aggregationTarget: 'category', selectionMode: 'multiple', /*focusTarget: 'category',*/ chartArea:{left:100,top:40}, vAxis:{logScale: true}, interpolateNulls: false, width: "1200", height: "500"};
|
var options = {title: id, aggregationTarget: 'category', selectionMode: 'multiple', curveType: 'function', /*focusTarget: 'category',*/ chartArea:{left:100,top:40}, vAxis:{logScale: true}, interpolateNulls: false, width: "1200", height: "500"};
|
||||||
new google.visualization.LineChart(document.getElementById(id)).draw(data, options);
|
new google.visualization.LineChart(document.getElementById(id)).draw(data, options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1,8 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace SYSTEM\SAI;
|
namespace SYSTEM\SAI;
|
||||||
|
|
||||||
|
|
||||||
class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_truncate(){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_truncate(){
|
||||||
@ -94,6 +92,13 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_basic_sucess($filter){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_basic_sucess($filter){
|
||||||
|
/*
|
||||||
|
$children = array();
|
||||||
|
is_subclass_of
|
||||||
|
foreach(get_declared_classes() as $class){
|
||||||
|
if($class instanceof foo) $children[] = $class;
|
||||||
|
}
|
||||||
|
*/
|
||||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
if(\SYSTEM\system::isSystemDbInfoPG()){
|
||||||
$res = $con->query('SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % '.$filter.')) as day,'
|
$res = $con->query('SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % '.$filter.')) as day,'
|
||||||
@ -102,13 +107,15 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
|||||||
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' and'
|
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' and'
|
||||||
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'INFO\' and'
|
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'INFO\' and'
|
||||||
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\DEPRECATED\' and'
|
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\DEPRECATED\' and'
|
||||||
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'EPRECATED\' '
|
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'DEPRECATED\' and '
|
||||||
|
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'PreprocessingLog\' '
|
||||||
.'then 1 else 0 end) class_fail,'
|
.'then 1 else 0 end) class_fail,'
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' or '
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' or '
|
||||||
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' or '
|
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' or '
|
||||||
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'INFO\' or '
|
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'INFO\' or '
|
||||||
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\DEPRECATED\' or '
|
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\DEPRECATED\' or '
|
||||||
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'EPRECATED\' '
|
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'DEPRECATED\' or '
|
||||||
|
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'PreprocessingLog\' '
|
||||||
.'then 1 else 0 end) class_log,'
|
.'then 1 else 0 end) class_log,'
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\COUNTER\' then 1 else 0 end) class_sucess'
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\COUNTER\' then 1 else 0 end) class_sucess'
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
||||||
|
|||||||
@ -270,10 +270,9 @@ class Security {
|
|||||||
self::startSession();
|
self::startSession();
|
||||||
return (isset($_SESSION['user']) && $_SESSION['user'] instanceof User);}
|
return (isset($_SESSION['user']) && $_SESSION['user'] instanceof User);}
|
||||||
private static function startSession(){
|
private static function startSession(){
|
||||||
if(!isset($_SESSION)){
|
if(!isset($_SESSION) && !headers_sent()){
|
||||||
session_start();}
|
\session_start();}
|
||||||
}
|
}
|
||||||
|
|
||||||
//This functions is called from \SYSTEM\locale::set()
|
//This functions is called from \SYSTEM\locale::set()
|
||||||
public static function _db_setLocale($lang){
|
public static function _db_setLocale($lang){
|
||||||
$user = self::getUser();
|
$user = self::getUser();
|
||||||
|
|||||||
@ -7,15 +7,18 @@ class HEADER {
|
|||||||
$file = null;
|
$file = null;
|
||||||
$line = null;
|
$line = null;
|
||||||
if(headers_sent($file, $line)){
|
if(headers_sent($file, $line)){
|
||||||
throw new \SYSTEM\LOG\ERROR('Header already sent @ '.$file.' line '.$line);}
|
new \SYSTEM\LOG\WARNING('Header already sent @ '.$file.' line '.$line);
|
||||||
|
return false;}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function JSON(){
|
public static function JSON(){
|
||||||
self::checkHeader();
|
if(self::checkHeader()){
|
||||||
header('Access-Control-Allow-Origin: *');//allow cross domain calls
|
header('Access-Control-Allow-Origin: *');//allow cross domain calls
|
||||||
header('content-type: application/json');
|
header('content-type: application/json');}
|
||||||
}
|
}
|
||||||
public static function PNG(){
|
public static function PNG(){
|
||||||
self::checkHeader();
|
if(self::checkHeader()){
|
||||||
header('content-type:image/png;');}
|
header('content-type:image/png;');}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -67,4 +67,28 @@ class autoload {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function file_extension($filename){
|
||||||
|
$path_info = pathinfo($filename);
|
||||||
|
return array_key_exists('extension', $path_info) ? strtolower($path_info['extension']) : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//for docu we need all classes actually declared
|
||||||
|
public static function autoload_all(){
|
||||||
|
foreach(self::$files as $file){
|
||||||
|
require_once $file[2];}
|
||||||
|
|
||||||
|
foreach(self::$folders as $folder){
|
||||||
|
if ($handle = opendir($folder[1])) {
|
||||||
|
while (false !== ($file = readdir($handle))) {
|
||||||
|
if ( $file != "." && $file != ".." &&
|
||||||
|
self::file_extension($file) == 'php' &&
|
||||||
|
!class_exists($folder[0].'\\'.substr($file,0,count($file)-5),false)) {
|
||||||
|
require_once $folder[1].'/'.$file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user