![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/html/keeview_app/html/ |
Upload File : |
const hrapi = function () { var core = { loaded: {}, users: {}, storage: {}, table: {}, orgs: {}, templates: {}, url: "hrapi.php" }; core.api_call = function (core) { return function (task, params, callbackfunc) { FormClass.api_call({ url: core.url, params: [ { name: "task", value: task }, { name: "params", value: EncodingClass.string.fromVariable(params) } ], func: function (callbackfunc) { return function(success, message) { var s, r; if (success) { if (message.substr(0, 2) == "ok") { s = true; r = EncodingClass.string.toVariable(message.substr(2)); } else { s = false; r = message; } } else { s = false; r = message; } try { callbackfunc(s, r); } catch (e) { console.error(e); } } } (callbackfunc) }); } } (core); core.users.getCurrentId = function (core) { return function (callbackfunc) { core.api_call("users.getCurrentId", [], function (callbackfunc) { return function (success, content) { callbackfunc(success, content); } } (callbackfunc)); } } (core); core.users.isAdmin = function (core) { return function (callbackfunc) { core.api_call("users.isAdmin", [], function (callbackfunc) { return function (success, content) { callbackfunc(success, content); } } (callbackfunc)); } } (core); core.users.getList = function (core) { return function (callbackfunc) { core.api_call("users.getList", [], function (callbackfunc) { return function (success, content) { callbackfunc(success, content); } } (callbackfunc)); } } (core); core.orgs.getCompanyInfo = function (core) { return function (companyid, callbackfunc) { core.api_call("orgs.getCompanyInfo", {id: companyid}, function (callbackfunc) { return function (success, content) { callbackfunc(success, content); } } (callbackfunc)); } } (core); core.orgs.getFullCompanyInfo = function (core) { return function (companyid, callbackfunc) { core.api_call("orgs.getFullCompanyInfo", {id: companyid}, function (callbackfunc) { return function (success, content) { callbackfunc(success, content); } } (callbackfunc)); } } (core); core.orgs.getCompaniesList = function (core) { return function (callbackfunc) { core.api_call("orgs.getCompaniesList", [], function (callbackfunc) { return function (success, content) { callbackfunc(success, content); } } (callbackfunc)); } } (core); core.orgs.getEmployeesList = function (core) { return function (orgid, callbackfunc) { core.api_call("orgs.getEmployeesList", {id: orgid}, function (callbackfunc) { return function (success, content) { callbackfunc(success, content); } } (callbackfunc)); } } (core); core.orgs.getEmployeeByUserId = function (core) { return function (orgid, callbackfunc) { core.api_call("orgs.getEmployeeByUserId", {id: orgid}, function (callbackfunc) { return function (success, content) { callbackfunc(success, content); } } (callbackfunc)); } } (core); core.templates.getGroupsList = function (core) { return function (callbackfunc) { core.api_call("templates.getGroupsList", [], function (callbackfunc) { return function (success, content) { callbackfunc(success, content); } } (callbackfunc)); } } (core); core.templates.getEmails = function (core) { return function (callbackfunc) { core.api_call("templates.getEmails", [], function (callbackfunc) { return function (success, content) { callbackfunc(success, content); } } (callbackfunc)); } } (core); core.storage.getList = function (core) { return function (chost, callbackfunc) { chost.cacheConnector.keys(callbackfunc); } } (core); core.storage.read = function (core) { return function (chost, key, callbackfunc) { chost.cacheConnector.read(key, callbackfunc); } } (core); core.storage.write = function (core) { return function (chost, key, value, callbackfunc) { chost.cacheConnector.write(key, value, callbackfunc); } } (core); core.storage.delete = function (core) { return function (chost, key, callbackfunc) { chost.cacheConnector.delete(key, callbackfunc); } } (core); core.table.getList = function (core) { return function (plugin_name, callbackfunc) { core.api_call("table.getList", {name: plugin_name}, function (callbackfunc) { return function (success, content) { callbackfunc(success, content); } } (callbackfunc)); } } (core); core.table.create = function (core) { return function (plugin_name, name, callbackfunc) { core.api_call("table.create", {name: plugin_name, tablename: name}, function (callbackfunc) { return function (success, content) { callbackfunc(success, content); } } (callbackfunc)); } } (core); core.table.drop = function (core) { return function (plugin_name, name, callbackfunc) { core.api_call("table.drop", {name: plugin_name, tablename: name}, function (callbackfunc) { return function (success, content) { callbackfunc(success, content); } } (callbackfunc)); } } (core); core.table.select = function (core) { return function (plugin_name, name, callbackfunc) { core.api_call("table.select", {name: plugin_name, tablename: name}, function (callbackfunc) { return function (success, content) { callbackfunc(success, content); } } (callbackfunc)); } } (core); core.table.update = function (core) { return function (plugin_name, name, key, value, callbackfunc) { core.api_call("table.update", {name: plugin_name, tablename: name, key: key, value: value}, function (callbackfunc) { return function (success, content) { callbackfunc(success, content); } } (callbackfunc)); } } (core); core.table.delete = function (core) { return function (plugin_name, name, key, callbackfunc) { core.api_call("table.delete", {name: plugin_name, tablename: name, key: key}, function (callbackfunc) { return function (success, content) { callbackfunc(success, content); } } (callbackfunc)); } } (core); core.getAPI = function (core) { return function (plugin_name) { var users = {}; users.getCurrentId = function (core) { return function (callbackfunc) { return core.users.getCurrentId(callbackfunc); } } (core); users.isAdmin = function (core) { return function (callbackfunc) { return core.users.isAdmin(callbackfunc); } } (core); users.getList = function (core) { return function (callbackfunc) { return core.users.getList(callbackfunc); } } (core); var orgs = {}; orgs.getCompaniesList = function (core) { return function (callbackfunc) { return core.orgs.getCompaniesList(callbackfunc); } } (core); orgs.getCompanyInfo = function (core) { return function (companyid, callbackfunc) { return core.orgs.getCompanyInfo(companyid, callbackfunc); } } (core); orgs.getFullCompanyInfo = function (core) { return function (companyid, callbackfunc) { return core.orgs.getFullCompanyInfo(companyid, callbackfunc); } } (core); orgs.getEmployeesList = function (core) { return function (orgid, callbackfunc) { return core.orgs.getEmployeesList(orgid, callbackfunc); } } (core); orgs.getEmployeeByUserId = function (core) { return function (orgid, callbackfunc) { return core.orgs.getEmployeeByUserId(orgid, callbackfunc); } } (core); var templates = {}; templates.getGroupsList = function (core) { return function (callbackfunc) { return core.templates.getGroupsList(callbackfunc); } } (core); templates.getEmails = function (core) { return function (callbackfunc) { return core.templates.getEmails(callbackfunc); } } (core); var storage = {}; var chost = { name: plugin_name }; var cname; if (window.client_code !== undefined) { cname = client_code + "_"; } else { cname = ""; } jscache.open("hrapi_pluginstorage_" + cname + plugin_name, function (chost) { return function (success, value) { if (success) { chost.cacheConnector = value; } else { console.log("open storage failed", plugin_name, value); } } } (chost)); storage.getList = function (core, chost) { return function (callbackfunc) { return core.storage.getList(chost, callbackfunc); } } (core, chost); storage.read = function (core, chost) { return function (key, callbackfunc) { return core.storage.read(chost, key, callbackfunc); } } (core, chost); storage.write = function (core, chost) { return function (key, value, callbackfunc) { return core.storage.write(chost, key, value, callbackfunc); } } (core, chost); storage.delete = function (core, chost) { return function (key, callbackfunc) { return core.storage.delete(chost, key, callbackfunc); } } (core, chost); var table = {}; table.getList = function (core, plugin_name) { return function (callbackfunc) { return core.table.getList(plugin_name, callbackfunc); } } (core, plugin_name); table.create = function (core, plugin_name) { return function (name, callbackfunc) { return core.table.create(plugin_name, name, callbackfunc); } } (core, plugin_name); table.drop = function (core, plugin_name) { return function (name, callbackfunc) { return core.table.drop(plugin_name, name, callbackfunc); } } (core, plugin_name); table.select = function (core, plugin_name) { return function (name, callbackfunc) { return core.table.select(plugin_name, name, callbackfunc); } } (core, plugin_name); table.update = function (core, plugin_name) { return function (name, key, value, callbackfunc) { return core.table.update(plugin_name, name, key, value, callbackfunc); } } (core, plugin_name); table.delete = function (core, plugin_name) { return function (name, key, callbackfunc) { return core.table.delete(plugin_name, name, key, callbackfunc); } } (core, plugin_name); var retval = { users: Object.freeze(users), storage: Object.freeze(storage), table: Object.freeze(table), orgs: Object.freeze(orgs), templates: Object.freeze(templates), test: function () { var x = hrapi("training_test"); var thread = function (x) { return function (step) { if (step === undefined) step = 0; switch (step) { case 0: x.storage.write("test", 100, (s) => {console.log("storage.write", s); thread(step + 1);}); break; case 1: x.storage.read("test", (s, r) => {console.log("storage.read", s, r); thread(step + 1);}); break; case 2: x.storage.getList((r) => {console.log("storage.getList", r); thread(step + 1);}); break; case 3: x.storage.delete("test", (s) => {console.log("storage.delete", s); thread(step + 1);}); break; case 4: x.users.getCurrentId((s, r) => {console.log("users.getCurrentId", s, r); thread(step + 1);}); break; case 5: x.users.isAdmin((s, r) => {console.log("users.isAdmin", s, r); thread(step + 1);}); break; case 6: x.users.getList((s, r) => {console.log("users.getList", s, r); thread(step + 1);}); break; case 7: x.orgs.getCompaniesList((s, r) => {console.log("orgs.getCompaniesList", s, r); thread(step + 1);}); break; case 8: x.orgs.getCompanyInfo(28, (s, r) => {console.log("orgs.getCompanyInfo", s, r); thread(step + 1);}); break; case 9: x.orgs.getFullCompanyInfo(28, (s, r) => {console.log("orgs.getFullCompanyInfo", s, r); thread(step + 1);}); break; case 10: x.orgs.getEmployeesList(38, (s, r) => {console.log("orgs.getEmployeesList", s, r); thread(step + 1);}); break; case 11: x.orgs.getEmployeeByUserId(371, (s, r) => {console.log("orgs.getEmployeeByUserId", s, r); thread(step + 1);}); break; case 12: x.table.getList((s, r) => {console.log("table.getList", s, r); thread(step + 1);}); break; case 13: x.table.create("test", (s, r) => {console.log("table.create - test", s, r); thread(step + 1);}); break; case 14: x.table.create("test2", (s, r) => {console.log("table.create - test2", s, r); thread(step + 1);}); break; case 15: x.table.select("test", (s, r) => {console.log("table.select", s, r); thread(step + 1);}); break; case 16: x.table.update("test", "testkey", "testvalue", (s, r) => {console.log("table.update - testkey", s, r); thread(step + 1);}); break; case 17: x.table.update("test", "testkey2", "testvalue2", (s, r) => {console.log("table.update - testkey2", s, r); thread(step + 1);}); break; case 18: x.table.delete("test", "testkey2", (s, r) => {console.log("table.delete", s, r); thread(step + 1);}); break; case 19: x.table.drop("test2", (s, r) => {console.log("table.drop", s, r); thread(step + 1);}); break; case 20: x.templates.getGroupsList((s, r) => {console.log("templates.getGroupsList", s, r); thread(step + 1);}); break; case 21: x.templates.getEmails((s, r) => {console.log("templates.getEmails", s, r); thread(step + 1);}); break; } } } (x); setTimeout(function (thread) { return function () { thread(0); } } (thread), 100); return null; } }; return Object.freeze(retval); } } (core); core.init = function (core) { return function (plugin_name) { if (plugin_name === undefined) return null; if (!(typeof plugin_name === "string")) return null; if (core.loaded[plugin_name] === undefined) core.loaded[plugin_name] = core.getAPI(plugin_name); return core.loaded[plugin_name]; } } (core); return function (core) { return function (plugin_name) { return core.init(plugin_name); } } (core); } ();