function __construct() { global $parametersMod; global $cms; $elements = array(); $element = new \Library\Php\StandardModule\element_text("text"); $element->name = $parametersMod->getValue('administrator', 'administrators', 'admin_translations', 'name'); $element->db_field = "name"; $element->required = true; $element->show_on_list = true; // $element->searchable = true; $elements[] = $element; $element = new \Library\Php\StandardModule\element_pass("text"); $element->name = $parametersMod->getValue('administrator', 'administrators', 'admin_translations', 'password'); $element->db_field = "pass"; $element->show_on_list = false; // $element->searchable = true; $elements[] = $element; $element = new element_administrators("select"); $element->set_name($parametersMod->getValue('administrator', 'administrators', 'admin_translations', 'permissions')); // $element->set_db_field("id"); $modules = \Backend\Db::modules(true); $values = array(); foreach ($modules as $key => $group) { $tmp_values = array(); foreach ($group as $key2 => $module) { $value = array(); $value[] = $module['id']; $value[] = $module['translation']; $tmp_values[] = $value; } $values[] = array("title" => $key, "values" => $tmp_values); } $element->set_values($values); $code = ' global $cms; $sql = " select translation from `".DB_PREF."module` where `id` = \'".$value."\' "; $rs = mysql_query($sql); if ($rs && $lock = mysql_fetch_assoc($rs)){ $value = htmlspecialchars($lock[\'translation\']); }else $value = \'\'; if(!$rs) trigger_error("Can\'t get field value translation ".$sql); '; $element->set_php_code_for_preview($code); $element->set_show_on_list(false); $elements[] = $element; $area0 = new mod_administrator_area(); $area0->db_table = "user"; $area0->name = $parametersMod->getValue('administrator', 'administrators', 'admin_translations', 'administrators'); $area0->db_key = "id"; $area0->elements = $elements; $area0->sort_field = "row_number"; $this->standard_module = new \Library\Php\StandardModule\StandardModule($area0); }
function genHtml($class) { global $cms; $answer = ''; $moduleGroups = \Backend\Db::modules(); foreach ($moduleGroups as $key => $group) { $answer .= '<div class="moduleGroup">' . htmlspecialchars($key) . '</div>'; foreach ($group as $key2 => $module) { if (isset($_POST[$this->name . '[' . $module['id'] . ']']) || $this->value) { $answer .= '<div class="module"><input checked class="' . $class . ' checkbox" type="checkbox" name="' . $this->name . '[' . $module['m_name'] . '][' . $module['g_name'] . ']" value="' . $module['id'] . '"/> ' . htmlspecialchars($module['translation']) . '</div>'; } else { $answer .= '<div class="module"><input class="' . $class . ' checkbox" type="checkbox" name="' . $this->name . '[' . $module['g_name'] . '][' . $module['m_name'] . ']" value="' . $module['id'] . '"/>' . htmlspecialchars($module['translation']) . "</div>"; } } } return $answer; }
public function getDeleteError($moduleGroupKey, $moduleKey, $ignoreGroupId = null) { global $parametersMod; $moduleGroups = \Backend\Db::modules(); foreach ($moduleGroups as $group) { foreach ($group as $module) { if ($module['g_id'] != $ignoreGroupId) { if (!$module['core']) { $configuration = new ConfigurationFile(BASE_DIR . PLUGIN_DIR . $module['g_name'] . '/' . $module['m_name'] . '/install/plugin.ini'); if ($configuration) { foreach ($configuration->getRequiredModules() as $requiredModule) { if ($requiredModule['module_group_key'] == $moduleGroupKey && $requiredModule['module_key'] == $moduleKey) { $error = $parametersMod->getValue('developer', 'modules', 'admin_translations', 'error_delete_required_module') . ' ' . $module['g_name'] . '/' . $module['m_name']; return $error; } } } } } } } }
private function _adminAccess() { require BASE_DIR . BACKEND_DIR . 'db.php'; if (!isset($_REQUEST['username'])) { return false; } if (!isset($_REQUEST['password'])) { return false; } //check log in if (isset($_REQUEST['username']) && isset($_REQUEST['password'])) { if (\Backend\Db::incorrectLoginCount($_REQUEST['username'] . '(' . $_SERVER['REMOTE_ADDR'] . ')') > 2) { \Backend\Db::log('system', 'backend login suspended (menu management)', $_REQUEST['username'] . '(' . $_SERVER['REMOTE_ADDR'] . ')', 2); return false; } else { $id = \Backend\Db::userId($_REQUEST['username'], $_REQUEST['password']); if ($id !== false) { $module = \Db::getModule(null, $groupName = 'standard', $moduleName = 'menu_management'); if (\Backend\Db::allowedModule($moduleId = $module['id'], $userId = $id)) { \Backend\Db::log('system', 'backend login (menu management)', $_REQUEST['username'] . ' (' . $_SERVER['REMOTE_ADDR'] . ')', 0); return true; } else { \Backend\Db::log('system', 'this user is not allowed to access menu management module', $_REQUEST['username'] . '(' . $_SERVER['REMOTE_ADDR'] . ')', 1); return false; } } else { \Backend\Db::log('system', 'backend login incorrect (menu management)', $_REQUEST['username'] . '(' . $_SERVER['REMOTE_ADDR'] . ')', 1); return false; } } } //check log in return false; }
function worker() { //make worker actions. global $cms; global $log; global $globalWorker; if ($this->session->loggedIn()) { //login check //deprecated way if (isset($_GET['module_id']) && $_GET['module_id'] != '' && \Backend\Db::allowedModule($_GET['module_id'], $cms->session->userId())) { $this->curModId = $_GET['module_id']; $newModule = \Db::getModule($_GET['module_id']); if (Db::allowedModule($_GET['module_id'], $this->session->userId())) { if (file_exists(MODULE_DIR . $newModule['g_name'] . '/' . $newModule['m_name'] . '/backend_worker.php')) { require_once MODULE_DIR . $newModule['g_name'] . '/' . $newModule['m_name'] . '/backend_worker.php'; } else { require_once PLUGIN_DIR . $newModule['g_name'] . '/' . $newModule['m_name'] . '/backend_worker.php'; } eval('$globalWorker = new \\Modules\\' . $newModule['g_name'] . '\\' . $newModule['m_name'] . '\\BackendWorker();'); $globalWorker->work(); } } //eof deprecated way } }