private final function buildContent()
 {
     foreach ($this->aTemplateTree as $temp) {
         self::setHead($temp);
         self::setContent($temp);
     }
     /// css lib files ///
     $aCss = explode(",", $this->sCssLib);
     foreach ($aCss as $css) {
         cBuildIndex::addCssToHead("pages/tpl/css/lib/" . trim($css) . ".css");
     }
     foreach ($this->aHeadCssTemps as $temp) {
         cBuildIndex::addCssToHead("pages/tpl/css/" . $temp . ".css");
     }
     /// javascript lib files ///
     $aJs = explode(",", $this->sJsLib);
     foreach ($aJs as $js) {
         cBuildIndex::addJsToHead("pages/tpl/js/lib/" . trim($js) . ".js");
     }
     foreach ($this->aHeadJsTemps as $temp) {
         cBuildIndex::addJsToHead("pages/tpl/js/" . $temp . ".js");
     }
     /// vars of this page are not set ///
     if (!isset($this->aContent[$this->getName()])) {
         $oVar = new stdClass();
         $this->aContent[$this->getName()] = array("oVars" => $oVar, "content" => "");
     } else {
         $oVar = $this->aContent[$this->getName()]['oVars'];
     }
     foreach (self::getFinalVars() as $name => $val) {
         eval("\$oVar->" . $name . " = \$val;");
     }
     $this->aContent[$this->getName()]['oVars'] = $oVar;
 }
예제 #2
0
 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();
 }
예제 #3
0
 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']);
     }
 }
 public function buildPage()
 {
     try {
         if (requireFile('pages/actions/' . $this->aPageTree[0]['name'] . '.php')) {
             $this->oPage = new $this->aPageTree[0]['name']();
         } else {
             throw new cException("Action " . $this->aPageTree[0]['name'] . " not found!");
         }
     } catch (cException $e) {
         $this->logs->addLog($e->getMessage());
     }
     self::$aActPage = $this->oPage->getData();
     self::$sTitle .= " - " . $this->oPage->aPageData['title'];
     $this->oPage->end();
     self::buildHead();
     self::buildBody();
 }
예제 #5
0
 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");
     }
 }
예제 #6
0
 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')));
 }
예제 #8
0
$DB = new cDb();
$connection = $DB->connect();
if ($connection) {
    $CFG = new cCfg();
    if (!isset($_GET['_pageAction_'])) {
        if (is_string($CFG->getDefaultPage('path'))) {
            header("Location: " . $CFG->getDefaultPage('path'));
        } else {
            if (!ADMIN_PAGE_ACCESS_AUTHORIZIED) {
                header("Location: " . HTTP_PATH . "admin");
            }
        }
    }
    $action = get_magic_quotes_gpc() ? $_GET['_pageAction_'] : addslashes($_GET['_pageAction_']);
    //$Logs->addLog($action,"_pageAction_");
    $CORE = new cBuildIndex($action);
    if (MK_DEBUG) {
        $CORE->addCssToHead("core/logs.css");
    }
    $Authent = new cAuthentication();
    $Authent->authenticate();
    /// user authenticated ///
    if ($CFG->isAuthenticated()) {
        $Logs->addLog("user authenticated", "authentication process");
        $CFG->setUserAccount();
    }
    $CORE->buildPage();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">