/** * standard constructor. */ function LoginForm() { global $c, $nx_version; Form::Form("N/X WCMS {$nx_version} Login", "i_key.gif", "loginform", $c["docroot"] . "api/auth/login.php"); $this->width = 350; global $lang; if (reg_load("SYSTEM/MAINTENANCE/BB") == "1") { $this->add(new Label("lbl", $lang->get("bb_in_mm_mode", "The backend is in maintenance at the moment. Only the System Administrator can log in!"), "standardwhite", 2)); } $submitTxt = 'onKeyPress="if (event.keyCode==13) {document.loginform.passwd.value=hex_md5(document.loginform.passwd0.value);document.loginform.passwd0.value=\'\';document.loginform.submit();}";'; $login = new Input("login", "", "standard", 16, "", 150); $login->additionalParameters = $submitTxt; $pass = new Input("passwd0", "", "standard", 64, "", 150, "PASSWORD"); $pass->additionalParameters = $submitTxt; $this->add(new Label("lbl1", $lang->get("user_name"), "standard")); $this->add($login); $this->add(new Label("lbl2", $lang->get("password"), "standard")); $this->add($pass); $this->add(new Hidden("passwd", "")); }
/** * Checks, if a session is still correct. If so, returns true, else false. * The procedure checks, if the timeout is not reached yet and if the given sid * is correct. Also the remote address of the user is checked. The maximum login time * that is allowed is 4 hours at the moment. After that time, a new login is necessary. * @return boolean true if Session valid, else false. */ function validateSession() { global $db, $c; if ($this->session != "") { if ($c["disalbehostchecking"]) { $sql = "SELECT U.USER_ID, U.USER_NAME, U.FULL_NAME FROM user_session S, users U WHERE U.USER_ID = S.USER_ID AND S.SESSION_ID='{$this->session}' AND U.ACTIVE=1 AND NOW() <= DATE_ADD(S.LAST_LOGIN, INTERVAL 4 HOUR)"; } else { $sql = "SELECT U.USER_ID, U.USER_NAME, U.FULL_NAME FROM user_session S, users U WHERE U.USER_ID = S.USER_ID AND S.SESSION_ID='{$this->session}' AND S.REMOTE_ADDRESS = '{$this->remote}' AND U.ACTIVE=1 AND NOW() <= DATE_ADD(S.LAST_LOGIN, INTERVAL 4 HOUR)"; } $query = new query($db, $sql); if ($query->count() == 1) { // login successfull $query->getrow(); $this->userId = $query->field("USER_ID"); $this->user = $query->field("USER_NAME"); $this->userName = $query->field("FULL_NAME"); if (reg_load("SYSTEM/MAINTENANCE/BB") != "1" || sameText("Administrator", $this->user)) { return true; } } else { return false; } } return false; }
} if ($cbwww == "1" && reg_load("SYSTEM/MAINTENANCE/WWW") != "1") { switchToMaintenanceMode("live"); } if ($cbwwwdev == "" && reg_load("SYSTEM/MAINTENANCE/WWWDEV") == "1") { disableMaintenanceMode("dev"); } if ($cbwww == "" && reg_load("SYSTEM/MAINTENANCE/WWW") == "1") { disableMaintenanceMode("live"); } reg_save("SYSTEM/MAINTENANCE/WWWDEV", $cbwwwdev); reg_save("SYSTEM/MAINTENANCE/WWW", $cbwww); reg_save("SYSTEM/MAINTENANCE/BB", $cbbb); } else { $cbwwwdev = reg_load("SYSTEM/MAINTENANCE/WWWDEV"); $cbwww = reg_load("SYSTEM/MAINTENANCE/WWW"); $cbbb = reg_load("SYSTEM/MAINTENANCE/BB"); } $page->tipp = $lang->get("maint_descr", "Maintenance mode displays a 'Page under maintance' message for the development or the live-website. <br>You can also switch the whole backend into maintenance mode. Then only the user ADMINISTRATOR can log in!"); $form = new Form($lang->get("maint_mode", "Maintenance Mode")); $form->add(new Label("lbl", $lang->get("maint_bb", "Backend Maintenance"), "standard")); $form->add(new Checkbox("cbbb", "1", "standard", $cbbb)); $form->add(new Label("lbl", $lang->get("maint_www", "Live Website Maintenance"), "standard")); $form->add(new Checkbox("cbwww", "1", "standard", $cbwww)); $form->add(new Label("lbl", $lang->get("maint_wwwdev", "Dev Website Maintenance"), "standard")); $form->add(new Checkbox("cbwwwdev", "1", "standard", $cbwwwdev)); $form->add(new Hidden("processing", "yes")); $form->add(new Spacer(2)); $form->add(new FormButtons(true, true)); $page->add($form); $page->draw();
/** * load a key from the N/X-Registry * @param string Key in format: folder1/folder2/keyname * @returns string saved value of the key */ function loadRegistryKey($key) { return reg_load($key); }
<? /********************************************************************** * @module Application **********************************************************************/ require_once "../../config.inc.php"; $auth = new auth("Administrator"); $page = new page("Designs"); require_once "menudef.inc.php"; $form = new SettingsForm($lang->get("designs", "Website Designs")); $ar = createNameValueArray('sitemap', 'NAME', 'MENU_ID'); $designclasses = getDCFileList('designs'); $form->addRadioSetting($lang->get('sel_design', 'Select Design'), 'CDS/MENU', $designclasses); $mclass = reg_load('CDS/MENU'); if ((value("set0", "", "") != $mclass) && (value("set0", "", "") != "")) $mclass = value("set0"); if ($mclass != "") { $form->addHeadline($lang->get('adjust/desugb', 'Adjust Design')); $ref = createDCRef($c["basepath"]."designs/".$mclass); $ref->editConfiguration(&$form); $form->add(new Spacer(2)); } $page->add($form); $page->draw(); $db->close(); ?>
/** * Draws the menu footer, use this instead of drawMenu for some special menus. * */ function drawMenuFooter() { global $c; if (!is_object($this->menuRef)) { $menuType = reg_load('CDS/MENU'); if ($menuType != "") $this->menuRef = createDCRef($c["basepath"]."designs/".$menuType); } if (is_object($this->menuRef)) echo $this->menuRef->getFooter(); }