diff --git a/api/api_system.php b/api/api_system.php index 736e2e0..a760030 100644 --- a/api/api_system.php +++ b/api/api_system.php @@ -27,7 +27,10 @@ class api_system extends api_login{ return \SYSTEM\SECURITY\Security::check($rightid);} public static function call_account_action_create($username, $password_sha, $email, $locale){ return \SYSTEM\SECURITY\Security::create($username, $password_sha, $email, $locale);}*/ - + + public static function call_cron(){ + return \SYSTEM\CRON\cron::run();} + public static function call_locale($request,$lang){ return \SYSTEM\LOG\JsonResult::toString(\SYSTEM\locale::getStrings($request, $lang));} @@ -37,5 +40,5 @@ class api_system extends api_login{ public static function static__lang($lang){ \SYSTEM\locale::set($lang);} public static function static__result($result){ - \SYSTEM\CONFIG\config::set(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_RESULT, $result);} + \SYSTEM\CONFIG\config::set(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_RESULT, $result);} } \ No newline at end of file diff --git a/autoload.inc.php b/autoload.inc.php index c718e94..dc05dbd 100644 --- a/autoload.inc.php +++ b/autoload.inc.php @@ -26,14 +26,12 @@ require_once dirname(__FILE__).'/system/autoload.php'; \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/db/qq','SYSTEM\DB'); \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/security','SYSTEM\SECURITY'); - \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/config','SYSTEM\CONFIG'); - \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/cache','SYSTEM\CACHE'); - \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/sai','SYSTEM\SAI'); \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/docu','SYSTEM\DOCU'); \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/files','SYSTEM\FILES'); +\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/cron','SYSTEM\CRON'); require_once dirname(__FILE__).'/lib/autoload.inc.php'; require_once dirname(__FILE__).'/docu/register_sys_docu.php'; diff --git a/cron/cron.php b/cron/cron.php new file mode 100644 index 0000000..9a26f6b --- /dev/null +++ b/cron/cron.php @@ -0,0 +1,41 @@ +next()){ + //check module + if(!self::check($cron[\SYSTEM\DBD\system_cron::FIELD_CLASS])){ + self::status($cron[\SYSTEM\DBD\system_cron::FIELD_CLASS], \SYSTEM\CRON\cronstatus::CRON_STATUS_FAIL_CLASS); + continue;} + //time to execute? + if(!\SYSTEM\CRON\crontime::check_now( time($cron[\SYSTEM\DBD\system_cron::FIELD_LAST_RUN]), + $cron[\SYSTEM\DBD\system_cron::FIELD_MIN], + $cron[\SYSTEM\DBD\system_cron::FIELD_HOUR], + $cron[\SYSTEM\DBD\system_cron::FIELD_DAY], + $cron[\SYSTEM\DBD\system_cron::FIELD_DAY_WEEK], + $cron[\SYSTEM\DBD\system_cron::FIELD_MONTH])){ + continue;} + //Status is ok? + if($cron[\SYSTEM\DBD\system_cron::FIELD_STATUS] != \SYSTEM\CRON\cronstatus::CRON_STATUS_SUCCESFULLY){ + new \SYSTEM\LOG\CRON('Cron for Class '.$cron[\SYSTEM\DBD\system_cron::FIELD_CLASS].' could not execute cuz Status aint good: '. \SYSTEM\CRON\cronstatus::decode($cron[\SYSTEM\DBD\system_cron::FIELD_STATUS])); + continue;} + //set running + self::status($cron[\SYSTEM\DBD\system_cron::FIELD_CLASS], \SYSTEM\CRON\cronstatus::CRON_STATUS_RUNNING); + self::status($cron[\SYSTEM\DBD\system_cron::FIELD_CLASS], call_user_func(array($cron[\SYSTEM\DBD\system_cron::FIELD_CLASS],'run'))); + } + return \SYSTEM\LOG\JsonResult::ok(); + } + + private static function status($class, $status){ + new \SYSTEM\LOG\CRON('Cron Status for Class '.$class.' updated to: '. \SYSTEM\CRON\cronstatus::decode($status)); + return \SYSTEM\DBD\SYS_CRON_UPD::QI(array($status,time(),$class));} +} \ No newline at end of file diff --git a/cron/cronjob.php b/cron/cronjob.php new file mode 100644 index 0000000..b0c58f0 --- /dev/null +++ b/cron/cronjob.php @@ -0,0 +1,7 @@ + $now_month){ $last_year -= 1;} + $last_month = $month;} + if($day){ + if($day > $now_day){ $last_month -= 1;} + $last_day = $day;} + if($hour){ + if($hour > $now_hour){ $last_day -= 1;} + $last_hour = $hour;} + if($min){ + if($min > $now_min){ $last_hour -= 1;} + $last_min = $min;} + if($day_week){ + $day_week = $day_week % 6; // 7 and 0 both mean Sunday + $now_day_week = $now_day_week % 6; // 7 and 0 both mean Sunday + $last_day -= abs($day_week - $now_day_week);} + return mktime($last_hour, $last_min, 0, $last_month, $last_day, $last_year); + } + public static function check($base_time,$last_run,$min,$hour,$day,$day_week,$month){ + return crontime::next($last_run, $min, $hour, $day, $day_week, $month) < $base_time ? true : false;} + public static function next_now($min,$hour,$day,$day_week,$month){ + self::next(time(),$min,$hour,$day,$day_week,$month);} + public static function last_now($min,$hour,$day,$day_week,$month){ + return self::last(time(),$min,$hour,$day,$day_week,$month);} + public static function check_now($last_run,$min,$hour,$day,$day_week,$month){ + return self::check(time(),$last_run,$min,$hour,$day,$day_week,$month);} +} \ No newline at end of file diff --git a/dbd/qq/SYS_CRON_LIST.php b/dbd/qq/SYS_CRON_LIST.php new file mode 100644 index 0000000..9c9f1fc --- /dev/null +++ b/dbd/qq/SYS_CRON_LIST.php @@ -0,0 +1,11 @@ + vll ist es einfach nicht hochgeladen, großkleinschreibeung... + + * E: 23:45:05: mmh + * E: 23:45:07: ich schau mal + * E: 23:45:10: vielleicht mal alles klein schreiben + * E: 23:47:02: mmh nein + * E: 23:47:06: auch das hat nichts gebracht + + - A: 23:52:23: kp + - A: 23:52:29: sonst fällt mir nix ein + + * E: 23:52:50: aber in der Datenbank muss dafür nichts geändert werden oder ? + + - A: 23:52:58: nö + + * E: 23:52:58: die Parameter die ich übergebe sollen ja die selben bleiben + * E: 23:53:01: kk + + - A: 23:53:06: hats n namespace? + + * E: 23:53:09: das ist schon mal gut zu wissen + + - A: 23:53:13: den musst du beim autloaden angeben + + * E: 23:53:20: mmh wie meinst du das ? + + - A: 23:53:27: namespace SYSTEM/LOG + - A: 23:53:41: dann musste beim autoload SYSTEM/LOG mit angeben + + * E: 23:54:20: in der algorithmen klasse selbst nicht nein + + - A: 23:54:31: dann müsste es passen + + * E: 23:54:59: mmh seltsam seltsam + * E: 23:55:06: ich stelle ich wahrscheinlich nur zu blöd an ^^ + + - A: 23:55:16: xD ich hab keinen plan was du da schaffst + - ##### A: 23:55:27: aber prüfe nochmal genau groß und kleinschreibung + + * E: 23:55:30: eigentlich sollte es doch nicht so kompliziert sein + + - ##### A: 23:55:31: KlassenName.php + + * E: 23:55:40: den ordner kopiern umbenennen + * E: 23:55:41: ne is eientlich ziemlich simpel + + - A: 23:56:00: der pfad im autoload haste angepasst?!^^ + + * E: 23:56:23: ja da hab ich noch einen hinzugefügt + + - A: 23:56:36: ajo + - A: 23:56:46: wenn er den ordner net findet schreit er auch + + * E: 23:56:54: genau + * E: 23:56:59: das hab ich ja auch ausprobiert + * E: 23:57:02: durch umbennenn vom ordner + * E: 23:57:07: den findet er also scheints + + - A: 23:57:12: vll ist es beim aufruf falsch geschrieben? + + * E: 23:59:06: /home/mona-srv/da-sense/test2/system/system/autoload.php + * E: 23:59:11: in der datei schmiert das system dann ab + * E: 23:59:30: aber das hilft mir auch nicht so richtig weiter + + - A: 23:59:32: joa mit der message class not found? + + * E: 23:59:37: exakt + + - A: 23:59:41: geb dir mal den klassennamen aus + - A: 23:59:50: und schau obs der gleiche ist + + * E: 00:00:41: public static function autoload($class){ + $classns = self::getClassNamespaceFromClass($class); + + if(!self::autoload_($classns[0],$classns[1]) || (!class_exists($class) && !interface_exists($class))){ + throw new \SYSTEM\LOG\ERROR("Class not found: ".$class);} + + return true; + } + * E: 00:00:48: mmh was davon ist der klassenname ? :D + * E: 00:00:55: classns[0] ? + + - A: 00:00:57: throw new \SYSTEM\LOG\ERROR("Class not found: ".$class);} + - A: 00:01:05: sollte dir den klassennamen schon sagen + + * E: 00:01:17: Class not found: s_algo + + - A: 00:01:22: ajo + + * E: 00:01:23: habs mal auf 1 buchstaben reduziert + + - ##### A: 00:01:26: da haste dein problem + + * E: 00:01:31: um schreibfehler auszuschließen + * E: 00:01:33: mmh ? + + - ##### A: 00:01:38: s_algo + + - ##### A: 00:01:45: so soll die klasse heißen + + - ##### A: 00:01:56: s_algo.php + + * ##### * E: 00:01:58: ja so heißt sie + * E: 00:02:03: und der ornder heißt auch s_algo + + - ##### A: 00:02:11: und die klasse heißt auch s_algo? + + * E: 00:02:41: oh man - ja ich bin echt zu blöd :( + + - A: 00:03:00: das war das erste, zweite und dritte was ich dich gefragt hab + + * E: 00:03:05: zu viele namen :/ + + - ##### A: 00:03:07: ob die klasse wie die datei heißt + + * E: 00:03:12: tut mir leid + + - A: 00:03:15: np + + * E: 00:03:30: ich habe dateinamen als ordnernamen fehl interpretiert + + - A: 00:03:46: kk^^ + + * E: 00:03:50: jetzt gehts - besten Dank. + * E: 00:04:04: bin mit blödheit geschlagen echt + * E: 00:04:53: danke - dann kann ich nämlich jetzt so nach herzenslust modifizieren + * E: 00:04:57: ohne das es was macht + + - A: 00:06:47: super, wenns läuft ;-) \ No newline at end of file diff --git a/log/exceptions/CRON.php b/log/exceptions/CRON.php new file mode 100644 index 0000000..ee48664 --- /dev/null +++ b/log/exceptions/CRON.php @@ -0,0 +1,5 @@ + +
| ID | +Group | +Type | +ParentID | +ParentValue | +Name | +Verify | +
|---|---|---|---|---|---|---|
| ${ID} | +${group} | +${type} | +${parentID} | +${parentValue} | +${name} | +${verify} | +
Api call deleted!
'); + $('#del_api_del').hide(); + }});});}});}); + + $('#addcall').click(function() { + var id = $('#new_call_id').val(); + var group = $('#new_call_group').val(); + var type = $('#new_call_type').val(); + var parentid = $('#new_call_parentid').val(); + var parentvalue = $('#new_call_parentvalue').val(); + var name = $('#new_call_name').val(); + var verify = $('#new_call_verify').val(); + $.ajax({ + url: SAI_ENDPOINT, + data: { sai_mod: '.SYSTEM.SAI.saimod_sys_api', + action: 'addcall', + ID: id, + group: group, + type: type, + parentID: parentid, + parentValue : parentvalue, + name: name, + verify: verify}, + type: 'GET', + success: function(data) { + console.log("new api call added"); + saimod_sys_api_loadcontent(); + } + }); + + }); + $('#del_api_close').click(function() { + console.log("olenski"); + $('#del_api_description').hide(); + $('#del_api_del').show(); + saimod_sys_api_loadcontent(); + }); $('#localetab a').click(function (e) {e.preventDefault(); $(this).tab('show');}); +} + +function saimod_sys_api_tree(){ + $('.tree li:has(ul)').addClass('parent_li').find(' > span').attr('title', 'Collapse this branch'); + $('.tree li.parent_li > span').on('click', function (e) { + var children = $(this).parent('li.parent_li').find(' > ul > li'); + if (children.is(":visible")) { + children.hide('fast'); + $(this).attr('title', 'Expand this branch').find(' > i').addClass('icon-plus-sign').removeClass('icon-minus-sign'); + } else { + children.show('fast'); + $(this).attr('title', 'Collapse this branch').find(' > i').addClass('icon-minus-sign').removeClass('icon-plus-sign'); + } + e.stopPropagation(); + }); } \ No newline at end of file diff --git a/sai/modules/saimod_sys_api/saimod_sys_api.php b/sai/modules/saimod_sys_api/saimod_sys_api.php index ed9eaa4..3601d32 100644 --- a/sai/modules/saimod_sys_api/saimod_sys_api.php +++ b/sai/modules/saimod_sys_api/saimod_sys_api.php @@ -50,6 +50,25 @@ class saimod_sys_api extends \SYSTEM\SAI\SaiModule { return $result;*/ } + public static function sai_mod__system_sai_saimod_sys_api_action_deletedialog($ID){ + $res = \SYSTEM\DBD\SYS_SAIMOD_API_SINGLE_SELECT::Q1(array($ID)); + return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_api/delete_dialog.tpl'), $res); + } + + public static function sai_mod__system_sai_saimod_sys_api_action_addcall($ID,$group,$type,$parentID,$parentValue,$name,$verify){ + if(!\SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_API)){ + throw new \SYSTEM\LOG\ERROR("You dont have edit Rights - Cant proceeed");} + \SYSTEM\DBD\SYS_SAIMOD_API_ADD::QI(array($ID,$group,$type,$parentID,$parentValue,$name,$verify)); + return \SYSTEM\LOG\JsonResult::ok(); + } + + public static function sai_mod__system_sai_saimod_sys_api_action_deletecall($ID){ + if(!\SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_API)){ + throw new \SYSTEM\LOG\ERROR("You dont have edit Rights - Cant proceeed");} + \SYSTEM\DBD\SYS_SAIMOD_API_DEL::QI(array($ID)); + return \SYSTEM\LOG\JsonResult::ok(); + } + private static function type_names($type){ switch($type){ case 0: return 'COMMAND'; @@ -72,9 +91,11 @@ class saimod_sys_api extends \SYSTEM\SAI\SaiModule { public static function html_li_menu(){return '| ID | +Group | +Type | +ParentID | +ParentValue | +Name | +Verify | +
|---|---|---|---|---|---|---|
| + | + | + | + | + | + | + |