protected function executePrepend(PHPTAL $TAL) { //DbControl::$debug = true; try { // XT admin if (LBoxXT::isLoggedAdmin() && count($_POST[$this->getFormGroupName()]["xt"]) > 0) { switch ($_POST[$this->getFormGroupName()]["xt"]["action"]) { case "edit": $pageEditArticlesId = LBoxConfigManagerProperties::getInstance()->getPropertyByName("ref_page_xt_admin_articles")->getContent(); $pageEditArticles = LBoxConfigManagerStructure::getPageById($pageEditArticlesId); $this->reload($pageEditArticles->url . ":" . $_POST[$this->getFormGroupName()]["xt"]["id"]); break; case "delete": $this->deleteArticle($_POST[$this->getFormGroupName()]["xt"]["id"]); $this->reload(); break; } } $TAL->xtAdmin = LBoxXT::isLoggedAdmin(); $pageMoreId = LBoxConfigManagerProperties::getInstance()->getPropertyByName("ref_page_articles_news")->getContent(); $pageMore = LBoxConfigManagerStructure::getPageById($pageMoreId); $limit = $this->getListPaging(); $news = new ArticlesNewsRecords(false, array("time_published" => 0), array(1, $limit)); $news->setOutputFilterItemsClass("OutputFilterArticleNews"); $TAL->news = $news->count() > 0 ? $news : false; $TAL->urlMore = $pageMore->url; } catch (Exception $e) { throw $e; } }
protected function executePrepend(PHPTAL $TAL) { try { $TAL->adminLogged = LBoxXT::isLoggedAdmin(); } catch (Exception $e) { throw $e; } }
protected function executePrepend(PHPTAL $TAL) { //DbControl::$debug = true; try { parent::executePrepend($TAL); if (LBoxXT::isLoggedAdmin()) { $this->reloadAdminHome(); } } catch (Exception $e) { throw $e; } }
/** * @param bool $forceDoNotCheckLogin * Pozor! pouziva se jako singleton presto ze ma public constructor - kuli dedicnosti */ public function __construct($forceDoNotCheckLogin = false) { $className = __CLASS__; if (AccesRecord::$instance instanceof $className) { //throw new LBoxExceptionFront(LBoxExceptionFront::MSG_ACCES_MULTIPLE_INSTANCES, LBoxExceptionFront::CODE_ACCES_MULTIPLE_INSTANCES); } $this->params["time"] = date("Y-m-d H:i:s"); $this->params["ip"] = LBOX_REQUEST_IP; $this->params["url"] = LBOX_REQUEST_URL; $this->params["referer"] = LBOX_REQUEST_REFERER; $this->params["agent"] = LBOX_REQUEST_AGENT; if (!$forceDoNotCheckLogin && LBoxXT::isLogged()) { $this->params["ref_xtuser"] = LBoxXT::getUserXTRecord()->id; } }
public function prepare($name = "", $value = NULL) { try { switch ($name) { case "rolesArray": foreach (LBoxXT::getXTRoles($superAdmin = true) as $role) { $out[$role->id]["value"] = $role->name; $out[$role->id]["selected"] = $role->id == $this->instance->ref_xtRole ? "selected" : ""; } return $out; break; default: return $value; } } catch (Exception $e) { throw $e; } }
public function store() { try { if (!$this->params["created"]) { $this->params["created"] = date("Y-m-d H:i:s"); } if (!$this->params["ref_xtRole"]) { $this->params["ref_xtRole"] = LBoxXT::getRoleRecordByName(LBoxXT::XT_ROLE_NAME_USER)->id; } if (!$this->isInDatabase()) { $this->params["hash"] = md5($this->get("nick") . $this->hashString . $this->get("password")); } parent::store(); // vygenerovani hashe if (strlen(trim($this->params["hash"])) < 1) { $hashString = "kiou5s" . (string) rand(1, 9999) . $this->params[self::$idColName]; $this->__set("hash", md5((string) $hashString)); } parent::store(); } catch (Exception $e) { throw $e; } }
<?php session_start(); require "../../../../../../../lBox/lib/loader.php"; try { if (!LBoxXT::isLoggedAdmin()) { throw new LBoxExceptionXT(LBoxExceptionXT::MSG_NOT_LOGGED . " acces.id=" . AccesRecord::getInstance()->id, LBoxExceptionXT::CODE_NOT_LOGGED); } } catch (Exception $e) { echo "<hr />"; echo "Exception code: <font style='color:blue'>" . $e->getCode() . "</font>"; echo "<br />"; echo "Exception message: <font style='color:blue'>" . nl2br($e->getMessage()) . "</font>"; /*echo "<br />"; echo "Thrown by: '". $e->getFile() ."'"; echo "<br />"; echo "on line: '". $e->getLine() ."'."; echo "<br />"; echo "<br />"; echo "Stack trace:"; echo "<br />"; echo nl2br($e->getTraceAsString());*/ echo "<hr />"; die; } $sfd_root_path = LBOX_PATH_PROJECT; $sfd_dir = LBoxConfigSystem::getInstance()->getParamByPath("wsw/img/path") . "/"; $sfd_dir_rel = str_replace("\\", "/", LBOX_PATH_PROJECT . $sfd_dir);
/** * getter na form pro vlozeni prispevku * Pokud je zavolan na record diskuze, vrati form pro vlozeni noveho prispevku * POkud je zavolan na record prispevku, vrati form pro vlozeni odpovedi na nej * @return LBoxForm */ public function getForm() { try { if ($this->form instanceof LBoxForm) { return $this->form; } if (!$this->isInDatabase()) { LBoxFront::reload(LBoxUtil::getURLWithoutParamsByPattern(array("/" . $this->patternURLParamReplyTo . "/"))); } if ($this->hasParent()) { $title = $this->title; switch (true) { case preg_match("/^re( *)(\\d+)(.*)/i", $title, $regs): $num = $regs[2] + 1; $title = "RE{$num}" . trim($regs[3]); break; case preg_match("/^re(.*)/i", $title, $regs): $title = "RE2" . $regs[1]; break; default: $title = "RE: {$title}"; } } else { $title = ""; } $id = $this->params[self::$idColName]; $controls["pid"] = new LBoxFormControlFillHidden("pid", "", $id); $controls["pid"]->setDisabled(); $controls["title"] = new LBoxFormControlFill("title", "titulek", $title, LBoxConfigManagerProperties::gpcn("form_max_length_discussion_title")); $controls["title"]->setRequired(); $controls["title"]->setTemplateFilename("discussion_title.html"); $controls["nick"] = new LBoxFormControlFill("nick", "nick", LBoxXT::isLogged() ? LBoxXT::getUserXTRecord()->nick : "", LBoxConfigManagerProperties::gpcn("form_max_length_nick")); if (LBoxXT::isLogged() && strlen(LBoxXT::getUserXTRecord()->nick) > 0) { $controls["nick"]->setDisabled(); } $controls["nick"]->setTemplateFilename("lbox_form_control_nick.html"); $validatorNick = new ValidatorAdminRecordNotExists(LBoxXT::isLogged() ? LBoxXT::getUserXTRecord()->id : NULL); $validatorNick->setRecordClassName("XTUsersRecord"); $validatorNick->setFilterColName("nick"); $controls["nick"]->addValidator($validatorNick); $controls["nick"]->setRequired(); $controls["email"] = new LBoxFormControlFill("email", "email", LBoxXT::isLogged() ? LBoxXT::getUserXTRecord()->email : "", LBoxConfigManagerProperties::gpcn("form_max_length_email")); if (LBoxXT::isLogged() && strlen(LBoxXT::getUserXTRecord()->email) > 0) { $controls["email"]->setDisabled(); } $controls["email"]->setTemplateFilename("lbox_form_control_email.html"); $controls["email"]->addValidator(new LBoxFormValidatorEmail()); $validatorEmail = new ValidatorAdminRecordNotExists(LBoxXT::isLogged() ? LBoxXT::getUserXTRecord()->id : NULL); $validatorEmail->setRecordClassName("XTUsersRecord"); $validatorEmail->setFilterColName("email"); $controls["email"]->addValidator($validatorEmail); $controls["www"] = new LBoxFormControlFill("www", "www", LBoxXT::isLogged() ? LBoxXT::getUserXTRecord()->www : "", LBoxConfigManagerProperties::gpcn("form_max_length_www")); if (LBoxXT::isLogged() && strlen(LBoxXT::getUserXTRecord()->www) > 0) { $controls["www"]->setDisabled(); } $controls["www"]->setTemplateFilename("lbox_form_control_www.html"); $controls["www"]->addValidator(new LBoxFormValidatorURLHTTPHTTPS()); $controls["body"] = new LBoxFormControlFill("body", "body", "", 1); $controls["body"]->setTemplateFilename("discussion_body.html"); $controls["body"]->addValidator(new LBoxFormValidatorDiscussionBody()); $controls["body"]->setRequired(); if (LBoxConfigManagerProperties::gpcn("discussion_recaptcha")) { $controls["recaptcha"] = new LBoxFormControlReCaptcha(); } $this->form = new LBoxForm("discussion-{$id}-post", "post", $this->hasParent() ? "Odpověď na příspěvek \"" . $this->getParamDirect("title") . "\"" : "Nový příspěvek", "odeslat"); //$this->form ->addProcessor(new LBoxFormProcessorDev); $this->form->addProcessor(new ProcessorDiscussionPost()); $this->form->setAntiSpam((bool) LBoxConfigManagerProperties::gpcn("discussion_antispam")); foreach ($controls as $control) { $control->addFilter(new LBoxFormFilterTrim()); $this->form->addControl($control); } return $this->form; } catch (Exception $e) { throw $e; } }
/** * @return LBoxXT * @throws Exception */ public static function getInstance() { $className = __CLASS__; try { if (!self::$instance instanceof $className) { self::$instance = new $className(); } return self::$instance; } catch (Exception $e) { throw $e; } }