public function __construct() { parent::__construct(get_class()); if ($this->CFG->isAuthenticated() && !count($this->CFG->getUserData('account')) && !$this->CFG->hasCapability('superadmin')) { header("Location: " . cBuildIndex::getActionUrl('nastaveni')); } $this->logs->on(); $this->aUserData = $this->CFG->getUserData(); self::action(); self::finish(); }
public final function setDefaultPage($pageName) { $data = cBuildIndex::getLngPageData($pageName); if (is_array($data) && count($data)) { self::$aDefaultPage['title'] = $data['title']; self::$aDefaultPage['menu_title'] = $data['menutitle']; self::$aDefaultPage['url'] = $data['url']; self::$aDefaultPage['path'] = cBuildIndex::getActionUrl($pageName); self::$aDefaultPage['name'] = $pageName; self::$aDefaultPage['parentid'] = intval($data['parentid']); self::$aDefaultPage['usecache'] = $data['usecache'] == '1' ? true : false; self::$aDefaultPage['id'] = intval($data['id']); } }
private function action() { if (isset($_POST['login']) && isset($_POST['challenge'])) { if (isset($_POST['password_hmac']) && strlen($_POST['password_hmac'])) { self::login(); } else { $this->aErrors[] = getString("Nebyly zaslány všechny potřebné údaje!", 'login'); $this->aErrors[] = getString("Zkontrolujte, zda máte zapnutý javascript!", 'login'); } } if (!$this->CFG->isAuthenticated()) { /// 3s prodleva mezi nactenim a odeslanim formulare pro ok prihlaseni /// $vals = array(array('timecreated', getDateToDb(time() + 3)), array('session', session_id())); $this->db->insert("core_challenges", $vals); $challenge = $this->db->getLastId(); $this->addVar($challenge, "challenge"); $this->addVar(cBuildIndex::getActionUrl('login'), "href"); } }
private function action() { $oPage = $this->parseArrayToObject(cBuildIndex::getActualPage()); $this->addVar($oPage, "page"); $zalozky = array(); $aZal = array('faktura', 'prehled', 'zakazky'); foreach ($aZal as $page) { /// page doesn't exists // if (!($lngPage = cBuildIndex::getLngPageData($page))) { continue; } if ($lngPage['published'] == '0') { continue; } $oP = $this->parseArrayToObject($lngPage); if ($oPage->id == $oP->id) { $oP->active = true; } $zalozky[] = $oP; } $this->addVar($zalozky, "zalozky"); $nastaveni = new stdClass(); $nastaveni->href = cBuildIndex::getActionUrl('nastaveni'); $this->addVar($nastaveni, "nastaveni"); if (count($aUser = $this->CFG->getUserData())) { $this->addVar($this->parseArrayToObject($aUser), "user"); } $login = new stdClass(); if ($this->CFG->isAuthenticated()) { $login->authenticated = true; $login->href = cBuildIndex::getActionUrl('login') . "?logout"; } else { $login->authenticated = false; $login->href = cBuildIndex::getActionUrl('login'); } $this->addVar($login, 'login'); $this->aSuperadminlinks[] = self::parseArrayToObject(array('href' => getUrl('admin'), 'text' => 'Admin page')); self::finish(); }
public function logout() { $userid = cCfg::getUserData('id'); $sess = session_id(); if ($userid !== false && $sess) { $where = array(array('session', '=', $sess), 'AND', array('ip', '=', $_SERVER['REMOTE_ADDR'])); $result = cDb::delete('core_authentications', $where); } $this->clearSessions(); header('Location: ' . cBuildIndex::getActionUrl(cCfg::getDefaultPage('name'))); }