From d368226d1473e627eb2416b0ea88ee58e0c487f3 Mon Sep 17 00:00:00 2001 From: rylon Date: Thu, 5 Jun 2014 01:39:42 +0200 Subject: [PATCH 1/4] sql update for sai api - pg compatible, saimod_sys_locale pg fix, saimod_sys_log 1h instead of 7d. --- dbd/sql/mysql/data/basic_locale_string.sql | 1 + .../mysql/data/sai_error_locale_string.sql | 1 + dbd/sql/mysql/data/sai_locale_string.sql | 1 + dbd/sql/pg/data/basic_locale_string.sql | 23 +++ dbd/sql/pg/data/sai_api.sql | 131 ++++++++++++++---- dbd/sql/pg/data/sai_error_locale_string.sql | 9 ++ dbd/sql/pg/data/sai_locale_string.sql | 2 + dbd/sql/pg/data/system_api.sql | 19 +++ .../saimod_sys_locale/saimod_sys_locale.php | 8 +- sai/modules/saimod_sys_log/saimod_sys_log.js | 4 +- .../saimod_sys_log/saimod_sys_log_stats.tpl | 4 +- 11 files changed, 168 insertions(+), 35 deletions(-) create mode 100644 dbd/sql/pg/data/basic_locale_string.sql create mode 100644 dbd/sql/pg/data/sai_error_locale_string.sql create mode 100644 dbd/sql/pg/data/sai_locale_string.sql create mode 100644 dbd/sql/pg/data/system_api.sql diff --git a/dbd/sql/mysql/data/basic_locale_string.sql b/dbd/sql/mysql/data/basic_locale_string.sql index 65301a9..bfc9318 100644 --- a/dbd/sql/mysql/data/basic_locale_string.sql +++ b/dbd/sql/mysql/data/basic_locale_string.sql @@ -1,3 +1,4 @@ +DELETE FROM system_locale_string WHERE category = 1; INSERT INTO `system_locale_string` (`id`, `category`, `enUS`, `deDE`) VALUES ('basic_logout', 1, 'Logout', 'Ausloggen'); INSERT INTO `system_locale_string` (`id`, `category`, `enUS`, `deDE`) VALUES ('basic_login', 1, 'Login', 'Einloggen'); INSERT INTO `system_locale_string` (`id`, `category`, `enUS`, `deDE`) VALUES ('basic_register', 1, 'Register', 'Registrieren'); diff --git a/dbd/sql/mysql/data/sai_error_locale_string.sql b/dbd/sql/mysql/data/sai_error_locale_string.sql index b432da8..3517ad2 100644 --- a/dbd/sql/mysql/data/sai_error_locale_string.sql +++ b/dbd/sql/mysql/data/sai_error_locale_string.sql @@ -1,3 +1,4 @@ +DELETE FROM system_locale_string WHERE category = 43; INSERT INTO `system_locale_string` (`id`, `category`, `enUS`, `deDE`) VALUES ('sai_error_username_short', 43, 'Username is too short', 'Nutzername ist zu kurz'); INSERT INTO `system_locale_string` (`id`, `category`, `enUS`, `deDE`) VALUES ('sai_error_username_long', 43, 'Username is too long', 'Nutzername ist zu lang'); INSERT INTO `system_locale_string` (`id`, `category`, `enUS`, `deDE`) VALUES ('sai_error_username_miss', 43, 'Username required', 'Nutzername erfoderlich'); diff --git a/dbd/sql/mysql/data/sai_locale_string.sql b/dbd/sql/mysql/data/sai_locale_string.sql index 1a85b5e..c91637c 100644 --- a/dbd/sql/mysql/data/sai_locale_string.sql +++ b/dbd/sql/mysql/data/sai_locale_string.sql @@ -1 +1,2 @@ +DELETE FROM system_locale_string WHERE category = 42; INSERT INTO `system_locale_string` (`id`, `category`, `enUS`, `deDE`) VALUES ('sai_mod_login_text', 42, 'Please login for developer access (if you are a developer).', 'Please login for developer access (if you are a developer).'); \ No newline at end of file diff --git a/dbd/sql/pg/data/basic_locale_string.sql b/dbd/sql/pg/data/basic_locale_string.sql new file mode 100644 index 0000000..12bce7b --- /dev/null +++ b/dbd/sql/pg/data/basic_locale_string.sql @@ -0,0 +1,23 @@ +DELETE FROM system.locale_string WHERE category = 1; +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_logout', 1, 'Logout', 'Ausloggen'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_login', 1, 'Login', 'Einloggen'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_register', 1, 'Register', 'Registrieren'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_username', 1, 'Username', 'Username'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_password', 1, 'Password', 'Passwort'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_email', 1, 'EMail', 'E-Mail2'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_last_active', 1, 'Last active', 'Zuletzt aktiv'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_join_date', 1, 'Joindate', 'Beitrittsdatum'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_locale', 1, 'Locale', 'Sprache'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_admin_rights', 1, 'Admin Rights', 'Admin Rechte'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_cancel', 1, 'Cancel', 'Abbrechen'); + +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_text_logout', 1, 'Logout before you leave!', 'Loggen Sie sie sich aus bevor Sie gehen!'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_text_login', 1, 'Login to your Website.', 'Loggen Sie sich in ihre Website ein.'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_text_register', 1, 'Register an Account', 'Register an Account'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_text_password_miss', 1, 'Cannot really remember your Password?', 'Cannot really remember your Password?'); + +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_placeholder_username', 1, 'peter / peter@world.org', 'peter / peter@world.org'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_placeholder_password', 1, 'my secret123', 'geheim567'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_placeholder_email', 1, 'peter@world.org', 'peter@world.org'); + +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('basic_state_login', 1, 'You are logged in.', 'You are logged in.'); \ No newline at end of file diff --git a/dbd/sql/pg/data/sai_api.sql b/dbd/sql/pg/data/sai_api.sql index 34c0267..4725e70 100644 --- a/dbd/sql/pg/data/sai_api.sql +++ b/dbd/sql/pg/data/sai_api.sql @@ -1,38 +1,115 @@ DELETE FROM system.api WHERE "group" = 42; +-- basic INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (0, 42, 0, -1, NULL, 'sai_mod', NULL); INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (1, 42, 1, 0, NULL, 'js', NULL); INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (2, 42, 1, 0, NULL, 'css', NULL); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (3, 42, 0, 0, NULL, 'action', NULL); +-- INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (3, 42, 0, 0, NULL, 'page', NULL); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (10, 42, 2, 3, 'login', 'username', 'ALL'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (11, 42, 2, 3, 'login', 'password_sha', 'ALL'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (12, 42, 2, 3, 'login', 'password_md5', 'ALL'); +-- system_api +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (10, 42, 0, -1, NULL, 'call', NULL); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (11, 42, 0, 10, NULL, 'action', NULL); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (20, 42, 2, 11, 'login', 'username', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (21, 42, 2, 11, 'login', 'password_sha', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (22, 42, 2, 11, 'login', 'password_md5', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (23, 42, 2, 11, 'check', 'rightid', 'UINT'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (24, 42, 2, 11, 'create', 'username', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (25, 42, 2, 11, 'create', 'password_sha', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (26, 42, 2, 11, 'create', 'email', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (27, 42, 2, 11, 'create', 'locale', 'LANG'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (30, 42, 2, 10, 'files', 'cat', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (31, 42, 3, 30, 'files', 'id', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (40, 42, 4, -1, NULL, '_lang', 'LANG'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (41, 42, 4, -1, NULL, '_result', 'RESULT'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (20, 42, 2, 3, 'register', 'username', 'ALL'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (21, 42, 2, 3, 'register', 'password_sha', 'ALL'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (22, 42, 2, 3, 'register', 'password_md5', 'ALL'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (23, 42, 2, 3, 'register', 'email', 'ALL'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (24, 42, 2, 4, 'register', 'locale', 'ALL'); +-- specific stuff for mods +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (100, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_login', 'action', NULL); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (101, 42, 2, 100, 'login', 'username', 'ALL'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (102, 42, 2, 100, 'login', 'password_sha', 'ALL'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (103, 42, 2, 100, 'login', 'password_md5', 'ALL'); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (110, 42, 2, 100, 'register', 'username', 'ALL'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (111, 42, 2, 100, 'register', 'password', 'ALL'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (112, 42, 2, 100, 'register', 'email', 'ALL'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (113, 42, 3, 100, 'register', 'locale', 'ALL'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (30, 42, 2, 3, 'edit', 'id', 'ALL'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (31, 42, 2, 3, 'edit', 'lang', 'LANG'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (32, 42, 2, 3, 'edit', 'newtext', 'ALL'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (33, 42, 2, 3, 'delete', 'id', 'ALL'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (34, 42, 2, 3, 'editmode', 'entry', 'ALL'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (35, 42, 2, 3, 'add', 'id', 'ALL'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (36, 42, 2, 3, 'add', 'category', 'INT'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (40, 42, 2, 3, 'upload', 'cat', 'STRING'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (41, 42, 2, 3, 'del', 'cat', 'STRING'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (42, 42, 2, 3, 'del', 'id', 'STRING'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (43, 42, 2, 3, 'rn', 'cat', 'STRING'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (44, 42, 2, 3, 'rn', 'id', 'STRING'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (45, 42, 2, 3, 'rn', 'newid', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (200, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_log', 'action', NULL); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (201, 42, 3, 200, 'filter', 'filter', 'STRING'); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (210, 42, 3, 200, 'error', 'error', 'INT'); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (220, 42, 0, 200, 'stats', 'name', null); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (221, 42, 3, 220, null, 'filter', 'UINT'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (50, 42, 3, 3, 'filter', 'filter', 'STRING'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (51, 42, 3, 3, 'error', 'error', 'INT'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (52, 42, 0, 3, 'stats', 'name', null); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (53, 42, 3, 52, null, 'filter', 'UINT'); -INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (300, 42, 4, -1, NULL, '_lang', 'LANG'); \ No newline at end of file +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (300, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_security', 'action', NULL); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (301, 42, 2, 300, 'user', 'username', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (302, 42, 3, 300, 'users', 'search', 'STRING'); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (310, 42, 2, 300, 'addright', 'id', 'UINT'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (311, 42, 2, 300, 'addright', 'name', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (312, 42, 2, 300, 'addright', 'description', 'STRING'); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (320, 42, 2, 300, 'deleteright', 'id', 'UINT'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (321, 42, 2, 300, 'deleterightconfirm', 'id', 'UINT'); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (330, 42, 2, 300, 'addrightuser', 'rightid', 'UINT'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (331, 42, 2, 300, 'addrightuser', 'userid', 'UINT'); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (340, 42, 2, 300, 'deleterightuser', 'rightid', 'UINT'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (341, 42, 2, 300, 'deleterightuser', 'userid', 'UINT'); + + +-- INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (400, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_sai_mods', 'action', NULL); + + +-- INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (500, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_config', 'action', NULL); + + +-- INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (600, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_api', 'action', NULL); + + +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (700, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_locale', 'action', NULL); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (701, 42, 2, 700, 'load', 'id', 'LANG'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (702, 42, 2, 700, 'load', 'group', 'INT'); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (710, 42, 2, 700, 'singleload', 'id', 'ALL'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (711, 42, 2, 700, 'singleload', 'lang', 'ALL'); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (720, 42, 2, 700, 'delete', 'id', 'ALL'); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (730, 42, 2, 700, 'add', 'id', 'ALL'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (731, 42, 2, 700, 'add', 'category', 'INT'); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (740, 42, 2, 700, 'edit', 'id', 'ALL'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (741, 42, 2, 700, 'edit', 'lang', 'LANG'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (742, 42, 2, 700, 'edit', 'category', 'ALL'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (743, 42, 2, 700, 'edit', 'newtext', 'ALL'); + + +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (800, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_files', 'action', NULL); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (801, 42, 2, 800, 'upload', 'cat', 'STRING'); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (810, 42, 2, 800, 'del', 'cat', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (811, 42, 2, 800, 'del', 'id', 'STRING'); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (820, 42, 2, 800, 'rn', 'cat', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (821, 42, 2, 800, 'rn', 'id', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (822, 42, 2, 800, 'rn', 'newid', 'STRING'); +-- +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (830, 42, 2, 800, 'tab', 'name', 'STRING'); + + +-- INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (900, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_cache', 'action', NULL); + + +-- INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (1000, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_todo', 'action', NULL); + + +-- INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (1100, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_docu', 'action', NULL); \ No newline at end of file diff --git a/dbd/sql/pg/data/sai_error_locale_string.sql b/dbd/sql/pg/data/sai_error_locale_string.sql new file mode 100644 index 0000000..98e4c3c --- /dev/null +++ b/dbd/sql/pg/data/sai_error_locale_string.sql @@ -0,0 +1,9 @@ +DELETE FROM system.locale_string WHERE category = 43; +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('sai_error_username_short', 43, 'Username is too short', 'Nutzername ist zu kurz'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('sai_error_username_long', 43, 'Username is too long', 'Nutzername ist zu lang'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('sai_error_username_miss', 43, 'Username required', 'Nutzername erfoderlich'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('sai_error_password_miss', 43, 'Password required', 'Passwort erforderlich'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('sai_error_password_long', 43, 'Password too long', 'Passwort zu lang'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('sai_error_password_short', 43, 'Password too short', 'Passwort zu kurz'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('sai_error_password_match', 43, 'Passwords do not match!', 'Passwords do not match!'); +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('sai_error_email_wrong', 43, 'Invalid EMail!', 'Invalid EMail!'); \ No newline at end of file diff --git a/dbd/sql/pg/data/sai_locale_string.sql b/dbd/sql/pg/data/sai_locale_string.sql new file mode 100644 index 0000000..7ed052c --- /dev/null +++ b/dbd/sql/pg/data/sai_locale_string.sql @@ -0,0 +1,2 @@ +DELETE FROM system.locale_string WHERE category = 42; +INSERT INTO system.locale_string ("id", "category", "enUS", "deDE") VALUES ('sai_mod_login_text', 42, 'Please login for developer access (if you are a developer).', 'Please login for developer access (if you are a developer).'); \ No newline at end of file diff --git a/dbd/sql/pg/data/system_api.sql b/dbd/sql/pg/data/system_api.sql new file mode 100644 index 0000000..e555ee5 --- /dev/null +++ b/dbd/sql/pg/data/system_api.sql @@ -0,0 +1,19 @@ +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (10, 42, 0, -1, NULL, 'call', NULL); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (11, 42, 0, 10, NULL, 'action', NULL); + +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (20, 42, 2, 11, 'login', 'username', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (21, 42, 2, 11, 'login', 'password_sha', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (22, 42, 2, 11, 'login', 'password_md5', 'STRING'); + +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (23, 42, 2, 11, 'check', 'rightid', 'UINT'); + +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (24, 42, 2, 11, 'create', 'username', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (25, 42, 2, 11, 'create', 'password_sha', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (26, 42, 2, 11, 'create', 'email', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (27, 42, 2, 11, 'create', 'locale', 'LANG'); + +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (30, 42, 2, 10, 'files', 'cat', 'STRING'); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (31, 42, 3, 30, 'files', 'id', 'STRING'); + +-- INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (100, 0, 2, 0, 'files', 'cat', 'STRING'); +-- INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (101, 0, 3, 0, 'files', 'id', 'STRING'); \ No newline at end of file diff --git a/sai/modules/saimod_sys_locale/saimod_sys_locale.php b/sai/modules/saimod_sys_locale/saimod_sys_locale.php index 69192f3..9121626 100644 --- a/sai/modules/saimod_sys_locale/saimod_sys_locale.php +++ b/sai/modules/saimod_sys_locale/saimod_sys_locale.php @@ -34,7 +34,7 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule { public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_load($lang, $group){ $con = new \SYSTEM\DB\Connection(); - $query = 'SELECT id, '.$lang.' FROM '.\SYSTEM\DBD\system_locale_string::NAME_MYS.' WHERE category='.$group.' ORDER BY category ASC;'; + $query = 'SELECT id, "'.$lang.'" FROM '.(\SYSTEM\system::isSystemDbInfoPG() ? \SYSTEM\DBD\system_locale_string::NAME_PG : \SYSTEM\DBD\system_locale_string::NAME_MYS).' WHERE category='.$group.' ORDER BY category ASC;'; $res = $con->query($query); $entries = ''; $temparr = array(); @@ -49,7 +49,7 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule { public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_singleload($id, $lang){ $con = new \SYSTEM\DB\Connection(); $result = ""; - $query = 'SELECT `'.$lang.'` FROM `'.\SYSTEM\DBD\system_locale_string::NAME_MYS.'` WHERE id=\''.$id.'\' ORDER BY category ASC;'; + $query = 'SELECT "'.$lang.'" FROM '.(\SYSTEM\system::isSystemDbInfoPG() ? \SYSTEM\DBD\system_locale_string::NAME_PG : \SYSTEM\DBD\system_locale_string::NAME_MYS).' WHERE id=\''.$id.'\' ORDER BY category ASC;'; new \SYSTEM\LOG\WARNING($query); $res = $con->query($query); $entries = ''; @@ -65,9 +65,9 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule { $con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo()); $res = null; if(\SYSTEM\system::isSystemDbInfoPG()){ - $res = $con->prepare('newText' ,'UPDATE '.\SYSTEM\DBD\system_locale_string::NAME_PG.' SET "'.$lang.'"=$1 WHERE category = $1 AND id=$2;', array($newtext, $category, $id)); + $res = $con->prepare('newText' ,'UPDATE '.(\SYSTEM\system::isSystemDbInfoPG() ? \SYSTEM\DBD\system_locale_string::NAME_PG : \SYSTEM\DBD\system_locale_string::NAME_MYS).' SET "'.$lang.'"=$1 WHERE category = $1 AND id=$2;', array($newtext, $category, $id)); } else { - $res = $con->prepare('newText' ,'UPDATE '.\SYSTEM\DBD\system_locale_string::NAME_MYS.' SET '.$lang.'=? WHERE category = ? AND id=?;', array($newtext, $category, $id)); + $res = $con->prepare('newText' ,'UPDATE '.(\SYSTEM\system::isSystemDbInfoPG() ? \SYSTEM\DBD\system_locale_string::NAME_PG : \SYSTEM\DBD\system_locale_string::NAME_MYS).' SET '.$lang.'=? WHERE category = ? AND id=?;', array($newtext, $category, $id)); } return $res->affectedRows() == 0 ? \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("no rows affected")) : \SYSTEM\LOG\JsonResult::ok(); } diff --git a/sai/modules/saimod_sys_log/saimod_sys_log.js b/sai/modules/saimod_sys_log/saimod_sys_log.js index 93bd3c7..b2fe0f2 100644 --- a/sai/modules/saimod_sys_log/saimod_sys_log.js +++ b/sai/modules/saimod_sys_log/saimod_sys_log.js @@ -58,10 +58,10 @@ function register_log(){ load_table_log($(this).attr('filter')); }); } -var filter_time = 604800; +var filter_time = 3600; var last_active = "#basic_tab"; function register_stats(){ - filter_time = 604800; + filter_time = 3600; $('#stats_tabs a').click(function (e) { e.preventDefault(); $(this).tab('show'); diff --git a/sai/modules/saimod_sys_log/saimod_sys_log_stats.tpl b/sai/modules/saimod_sys_log/saimod_sys_log_stats.tpl index 7221777..7762cd0 100644 --- a/sai/modules/saimod_sys_log/saimod_sys_log_stats.tpl +++ b/sai/modules/saimod_sys_log/saimod_sys_log_stats.tpl @@ -2,14 +2,14 @@
  • 30d
  • 14d
  • -
  • 7d
  • +
  • 7d
  • 2d
  • 1d
  • 12h
  • 6h
  • 4h
  • 2h
  • -
  • 1h
  • +
  • 1h
  • 30m
  • 10m
  • 5m
  • From 6f06fd22e3f20c4d920cadf51555f096888473ad Mon Sep 17 00:00:00 2001 From: rylon Date: Fri, 6 Jun 2014 02:20:34 +0200 Subject: [PATCH 2/4] right check for api --- dbd/sql/mysql/data/system_rights.sql | 10 +- docu/system/system.system.md | 186 ++++++++++++++++++ sai/modules/saimod_sys_api/saimod_sys_api.php | 14 +- security/RIGHTS.php | 3 + 4 files changed, 204 insertions(+), 9 deletions(-) diff --git a/dbd/sql/mysql/data/system_rights.sql b/dbd/sql/mysql/data/system_rights.sql index 72f0b4c..5834681 100644 --- a/dbd/sql/mysql/data/system_rights.sql +++ b/dbd/sql/mysql/data/system_rights.sql @@ -1,5 +1,11 @@ -INSERT INTO `system_rights` (`ID`, `name`, `description`) VALUES (6, 'SYS_SAI_SECURITY_RIGHTS_EDIT', 'Allows deleting, editing and adding of Right in the SAI module Security'); +INSERT INTO `system_rights` (`ID`, `name`, `description`) VALUES (1, 'SYS_SAI', 'SAI access right'); + INSERT INTO `system_rights` (`ID`, `name`, `description`) VALUES (5, 'SYS_SAI_SECURITY', 'Allows access to the Security Module in SAI'); +INSERT INTO `system_rights` (`ID`, `name`, `description`) VALUES (6, 'SYS_SAI_SECURITY_RIGHTS_EDIT', 'Allows deleting, editing and adding of Right in the SAI module Security'); + INSERT INTO `system_rights` (`ID`, `name`, `description`) VALUES (10, 'SYS_SAI_LOCALE', 'Allows access to the Locale Module in SAI to edit or add Multilanguage Text'); + INSERT INTO `system_rights` (`ID`, `name`, `description`) VALUES (15, 'SYS_SAI_IMG', 'Allows access to the Image Module in SAI to delete or add Pictures'); -INSERT INTO `system_rights` (`ID`, `name`, `description`) VALUES (1, 'SYS_SAI', 'SAI access right'); \ No newline at end of file + +INSERT INTO `system_rights` (`ID`, `name`, `description`) VALUES (20, 'SYS_SAI_API', 'SAI API Access right'); +INSERT INTO `system_rights` (`ID`, `name`, `description`) VALUES (21, 'SYS_SAI_API_EDIT', 'SAI API Edit right'); \ No newline at end of file diff --git a/docu/system/system.system.md b/docu/system/system.system.md index e69de29..7cef9a2 100644 --- a/docu/system/system.system.md +++ b/docu/system/system.system.md @@ -0,0 +1,186 @@ +####autoload + + Komuniktationsprobleme der Neuzeit ;-) + + * E: Entwickler + * A: Admin + + * ##### Lösung + + * ##### * Lösung Ignorieren + +----- + + * E: 23:36:01: Hi A + * E: 23:36:13: ich habe noch mal eine Frage an dich wegen Project21 + * E: 23:36:32: ich habe es ja soweit hinbekommen die Visualisierung auf unser Handy zu bekommen + * E: 23:36:58: ich dachte mir nun, das ich jetzt am Besten einen bestehenden Algorithmus kopiere - in umbenenne und dann daran unsere Modifikationen vornehme + * E: 23:37:20: aber leider scheint das mit dem kopieren und hinzufügen in der api.php nicht getan zu sein + * E: 23:37:33: muss ich dabei sonst noch etwas beachten ? + * E: 23:37:52: weil derzeit bekomme ich in der autoload.php unter system/system + + - A: 23:37:54: in der tabelle system.api müssen zeilen hinzugefügt werden + + * E: 23:38:01: den fehler class not found + + - A: 23:38:09: dann fehlt wohl ne klasse^^ + + * E: 23:38:48: mmh ich will keine neuen parameter einfügen wenn du das meinst + * E: 23:38:54: leidiglich z.b. statt heatmapRect + * E: 23:39:02: heatMapRectCoverage callen z.B. + + - ##### A: 23:39:17: die klasse muss so heißen wie die datei + - A: 23:39:23: und geautoloaded werden + + * E: 23:40:22: mmh ich habe jetzt im ordner preprocessing in die autload.inc.php eine zeile hinzugefügt gehabt + * E: 23:40:28: das scheint dann aber wohl nicht die richtige zu sein + * E: 23:40:35: für die visualisierungs algorithmen + * ##### * E: 23:40:42: weil Datei und Ordner heißen schon gleich + + * ##### * E: 23:40:45: das habe ich berücksichtigt + + - A: 23:41:01: dann ist der ordner in der die klasse liegt wohl nicht registriert + + * E: 23:42:28: mmh das stimmt + * E: 23:42:39: aber in welcher autload.inc.php mache ich das bekannt ? + + - A: 23:42:48: in der nächsten^^ + - A: 23:42:55: die die am nächsten dran liegt + - A: 23:42:59: aber prinzipiell egal + + * ##### * E: 23:43:20: mmh dann hätte ich das aber richtig gemacht + + - A: 23:43:39: kp er sagt dir ja class not found + - A: 23:43:47: sprich er kann die klasse nicht laden + + * E: 23:43:52: korrekt + * E: 23:43:59: den ordner scheint er aber zu finden + + - A: 23:44:26: sonst schmiert der autoload mit nem fehler ab, ja + - A: 23:44:47: kp -> 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/sai/modules/saimod_sys_api/saimod_sys_api.php b/sai/modules/saimod_sys_api/saimod_sys_api.php index 0aa884e..3601d32 100644 --- a/sai/modules/saimod_sys_api/saimod_sys_api.php +++ b/sai/modules/saimod_sys_api/saimod_sys_api.php @@ -51,21 +51,21 @@ class saimod_sys_api extends \SYSTEM\SAI\SaiModule { } public static function sai_mod__system_sai_saimod_sys_api_action_deletedialog($ID){ - new \SYSTEM\LOG\WARNING("api call added"); - new \SYSTEM\LOG\WARNING(print_r($ID, true)); $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){ - new \SYSTEM\LOG\WARNING("api call added"); - $res = \SYSTEM\DBD\SYS_SAIMOD_API_ADD::QI(array($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){ - new \SYSTEM\LOG\WARNING("api call deleted"); - $res = \SYSTEM\DBD\SYS_SAIMOD_API_DEL::QI(array($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(); } @@ -91,7 +91,7 @@ class saimod_sys_api extends \SYSTEM\SAI\SaiModule { public static function html_li_menu(){return '
  • API
  • ';} public static function right_public(){return false;} - public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);} + public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI) && \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_API);} public static function sai_mod__SYSTEM_SAI_saimod_sys_api_flag_css(){ return \SYSTEM\LOG\JsonResult::toString( diff --git a/security/RIGHTS.php b/security/RIGHTS.php index ebc1781..41c67c7 100644 --- a/security/RIGHTS.php +++ b/security/RIGHTS.php @@ -13,6 +13,9 @@ class RIGHTS { const SYS_SAI_LOCALE = 10; //Image Module const SYS_SAI_FILES = 15; + //Api Module + const SYS_SAI_API = 20; + const SYS_SAI_API_EDIT = 21; //Reserve first 1000 ids. const RESERVED_SYS_0_999 = 999; From 29738f079a240eb5dbc24809685cb0ceed9f17f1 Mon Sep 17 00:00:00 2001 From: rylon Date: Sat, 7 Jun 2014 04:34:32 +0200 Subject: [PATCH 3/4] system cron --- api/api_system.php | 7 +++-- autoload.inc.php | 4 +-- cron/cron.php | 41 ++++++++++++++++++++++++++ cron/cronjob.php | 7 +++++ cron/cronjobtest.php | 9 ++++++ cron/cronstatus.php | 29 +++++++++++++++++++ cron/crontime.php | 56 ++++++++++++++++++++++++++++++++++++ dbd/qq/SYS_CRON_LIST.php | 11 +++++++ dbd/qq/SYS_CRON_UPD.php | 11 +++++++ dbd/tbl/system_cron.php | 18 ++++++++++++ docu/system/system.system.md | 2 ++ log/exceptions/CRON.php | 5 ++++ 12 files changed, 195 insertions(+), 5 deletions(-) create mode 100644 cron/cron.php create mode 100644 cron/cronjob.php create mode 100644 cron/cronjobtest.php create mode 100644 cron/cronstatus.php create mode 100644 cron/crontime.php create mode 100644 dbd/qq/SYS_CRON_LIST.php create mode 100644 dbd/qq/SYS_CRON_UPD.php create mode 100644 dbd/tbl/system_cron.php create mode 100644 log/exceptions/CRON.php 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 @@ + Date: Sat, 7 Jun 2014 16:11:22 +0200 Subject: [PATCH 4/4] fixed login.tpl - placeholders --- sai/modules/saistart_sys_sai/login.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sai/modules/saistart_sys_sai/login.tpl b/sai/modules/saistart_sys_sai/login.tpl index b022299..7682d4c 100644 --- a/sai/modules/saistart_sys_sai/login.tpl +++ b/sai/modules/saistart_sys_sai/login.tpl @@ -9,7 +9,7 @@ ${basic_text_login} size="30" style="margin-bottom: 15px;" id="bt_login_user" - placeholder="${sai_placeholder_username}" + placeholder="${basic_placeholder_username}" minlength="3" data-validation-minlength-message="${sai_error_username_short}" maxlength="16" data-validation-maxlength-message="${sai_error_username_long}" required data-validation-required-message="${sai_error_username_miss}"/> @@ -19,7 +19,7 @@ ${basic_text_login} size="30" style="margin-bottom: 15px;" id="bt_login_password" - placeholder="${sai_placeholder_password}" + placeholder="${basic_placeholder_password}" minlength="5" data-validation-minlength-message="${sai_error_password_short}" maxlength="16" data-validation-maxlength-message="${sai_error_password_long}" required data-validation-required-message="${sai_error_password_miss}"/>