Example #1
0
 /**
  * @param bool $forceDoNotCheckLogin
  * @return AccesRecord
  * @throws Exception
  */
 public static function getInstance($forceDoNotCheckLogin = false)
 {
     try {
         if (!self::$instance instanceof AccesRecord) {
             self::$instance = new AccesRecord($forceDoNotCheckLogin);
             self::$instance->store();
         }
         return self::$instance;
     } catch (Exception $e) {
         throw $e;
     }
 }
 public function store()
 {
     try {
         if (!$this->isInDatabase()) {
             $this->params["ref_access"] = AccesRecord::getInstance()->id;
         }
         if (strlen($this->params["time_published"]) < 1) {
             $this->params["time_published"] = time();
         }
         if (strlen($this->params["url_cs"]) < 1) {
             $this->params["url_cs"] = LBoxUtil::getURLByNameString($this->params["name_cs"]);
         }
         if (strlen($this->params["url_sk"]) < 1) {
             $this->params["url_sk"] = LBoxUtil::getURLByNameString($this->params["name_sk"]);
         }
         if (strlen($this->params["url_en"]) < 1) {
             $this->params["url_en"] = LBoxUtil::getURLByNameString($this->params["name_en"]);
         }
         if (strlen($this->params["name_sk"]) < 1 && strlen($this->params["name_cs"]) > 0) {
             $this->params["name_sk"] = $this->params["name_cs"];
         }
         if (strlen($this->params["name_en"]) < 1 && strlen($this->params["name_cs"]) > 0) {
             $this->params["name_en"] = $this->params["name_cs"];
         }
         if (strlen($this->params["url_sk"]) < 1 && strlen($this->params["url_cs"]) > 0) {
             $this->params["url_sk"] = $this->params["url_cs"];
         }
         if (strlen($this->params["url_en"]) < 1 && strlen($this->params["url_cs"]) > 0) {
             $this->params["url_en"] = $this->params["url_cs"];
         }
         parent::store();
     } catch (Exception $e) {
         throw $e;
     }
 }
 /**
  * vraci jestli uz uzivatel hlasoval pro tuto anketu
  * - podle IP
  * @return bool
  */
 public function didUserVotedForByIP()
 {
     try {
         $records = new InquiriesOptionsResponsesRecords(array("ref_inquiry" => $this->instance->id, "ip" => AccesRecord::getInstance()->ip));
         return $records->count() > 0;
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #4
0
 /**
  * spousti zobrazeni pozadovane stranky
  * @throws LBoxException
  */
 public static function run()
 {
     try {
         // starting timer
         LBoxTimer::getInstance();
         // init acces
         AccesRecord::getInstance();
         if (self::getPageCfg()->cache_off) {
             LBoxCacheManagerFront::getInstance()->switchListeningOff();
         }
         self::executeInit();
         // caching
         //var_dump(LBoxCacheManagerFront::getInstance()->wasFormSentNow());die;
         //if (self::getPage()->showConnivance()) {
         //LBoxFirePHP::table($_SERVER, "_SERVER");
         if (LBoxCacheManagerFront::getInstance()->isCacheON()) {
             if (!LBoxXTProject::isLoggedSuperAdmin() && !LBoxXTDBFree::isLogged() && !LBoxCacheManagerFront::getInstance()->wasFormSentNow()) {
                 if (count(self::getDataPost()) < 1) {
                     if (LBoxCacheManagerFront::getInstance()->doesCacheExists()) {
                         // send last modification header
                         LBoxFirePHP::warn("cache loaded in " . LBoxTimer::getInstance()->getTimeOfLife() . "s");
                         header("Last-Modified: " . gmdate("D, d M Y H:i:s", LBoxCacheManagerFront::getInstance()->getLastCacheModificationTime()) . " GMT");
                         echo LBoxCacheManagerFront::getInstance()->getData();
                         LBoxCacheManagerFront::getInstance()->__destruct();
                         return;
                     }
                 }
             }
             $content = self::getRequestContent();
             echo $content;
             if (!LBoxXTProject::isLoggedSuperAdmin() && !LBoxXTDBFree::isLogged() && !LBoxCacheManagerFront::getInstance()->wasFormSentNow()) {
                 if (count(self::getDataPost()) < 1) {
                     // vystup z nenalezenych URL neukladame - mohlo by umoznit snadno zahltit cache!
                     if (self::getPageCfg()->id != LBoxConfigSystem::getInstance()->getParamByPath("pages/page404")) {
                         //kontrola jestli vystup neni jen vypis exception
                         if (strlen(strip_tags($content)) > 0) {
                             LBoxCacheManagerFront::getInstance()->saveData($content);
                             LBoxFirePHP::warn("cache stored in " . LBoxTimer::getInstance()->getTimeOfLife() . "s");
                         } else {
                             LBoxFirePHP::error("cache NOT stored because output suppose to contain only exception message!");
                         }
                     }
                 }
             }
             LBoxCacheManagerFront::getInstance()->__destruct();
         } else {
             LBoxFirePHP::warn("cache VYPNUTA");
             echo self::getRequestContent();
         }
         /*}
         		else {
         			echo self::getRequestContent();
         		}*/
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #5
0
 /**
  * loggs show
  * @throws Exception
  */
 public function logShow()
 {
     try {
         $bannerAccess = new BannersAccesRecord();
         $bannerAccess->ref_banner = $this->get("filename");
         $bannerAccess->ref_access = AccesRecord::getInstance()->id;
         $bannerAccess->store();
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #6
0
 public function store()
 {
     try {
         if (!$this->params["created"]) {
             $this->params["created"] = time();
         }
         if (!$this->params["type"]) {
             $this->params["type"] = "discussion";
         }
         $this->params["ref_acces"] = AccesRecord::getInstance()->id;
         parent::store();
     } catch (Exception $e) {
         throw $e;
     }
 }
 public function process()
 {
     try {
         $recordOption = new InquiriesOptionsRecord($this->form->getControlByName("ref_option")->getValue());
         if ($recordOption->getInquiry()->didUserVotedFor) {
             return;
         }
         $record = new InquiriesResponsesRecord();
         $record->ref_option = $this->form->getControlByName("ref_option")->getValue();
         $record->ref_access = AccesRecord::getInstance()->id;
         $record->store();
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #8
0
 public function store()
 {
     try {
         if (!$this->params["time_published"] || strtolower($this->params["time_published"]) == "<<null>>") {
             $this->params["time_published"] = time();
         }
         if (strlen($this->params["url_cs"]) < 1 || $this->params["url_cs"] == "<<NULL>>") {
             $this->params["url_cs"] = LBoxUtil::getURLByNameString($this->params["heading_cs"]);
         }
         if (strlen($this->params["url_sk"]) < 1 || $this->params["url_sk"] == "<<NULL>>") {
             $this->params["url_sk"] = LBoxUtil::getURLByNameString($this->params["heading_sk"]);
         }
         $this->params["ref_access"] = AccesRecord::getInstance()->id;
         parent::store();
     } catch (Exception $e) {
         throw $e;
     }
 }
 public function process()
 {
     try {
         $record = new DataContactFormRecord();
         foreach ($this->form->getControls() as $control) {
             if ($control instanceof LBoxFormControlMultiple) {
                 continue;
             }
             if ($control instanceof LBoxFormControlSpamDefense) {
                 continue;
             }
             $colName = $control->getName();
             $record->{$colName} = strlen($control->getValue()) > 0 ? $control->getValue() : "<<NULL>>";
         }
         $record->ref_access = AccesRecord::getInstance()->id;
         $record->store();
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #10
0
<?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);
Example #11
0
 /**
  * vraci, jestli je uzivatel zalogovan jinde pouze podle predaneho XTUser id
  * @param int $id
  * @return bool
  */
 protected static function isLoggedParalellyByID($id = 0)
 {
     try {
         if (!is_numeric($id) || $id < 1) {
             throw new LBoxExceptionXT(LBoxExceptionXT::MSG_PARAM_INT_NOTNULL, LBoxExceptionXT::CODE_BAD_PARAM);
         }
         if (array_key_exists($id, self::$isLoggedParalellyByID)) {
             return self::$isLoggedParalellyByID[$id];
         }
         $timeout = LBoxConfigSystem::getInstance()->getParamByPath("xt/paralel_login_timeout_hours") * 3600;
         $where = new QueryBuilderWhere();
         $where->addConditionColumn("ref_xtuser", $id);
         $where->addConditionColumn("session_id", AccesRecord::getInstance()->session_id, -3);
         $where->addConditionColumn("time", date("Y-m-d H:i:s", time() - $timeout), 1);
         $records = new AccessXTUsersRecords(false, array("time" => 0), false, $where);
         if ($records->count() > 0 && false === strstr($records->current()->url, ":logout")) {
             return self::$isLoggedParalellyByID[$id] = true;
         }
         return self::$isLoggedParalellyByID[$id] = false;
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #12
0
<?php

require "lBox/lib/loader.php";
ob_start();
$acces = AccesRecord::getInstance();
$acces->store();
$files = new FilesRecords(array("id" => LBOX_REQUEST_URL_PARAMS));
if ($files->count() < 1) {
    header("HTTP/1.1 404 Not Found");
    die;
}
$file = $files->current();
// zapocist stazeni
if (file_exists($file->getFilePath())) {
    $downloaded = new FilesDownloadedRecord();
    $downloaded->ref_file = $file->id;
    $downloaded->countIn();
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Content-type: Content-type");
    header("Content-Disposition: attachment; filename=" . str_replace(" ", "_", $file->getFileName()));
    header("Content-Transfer-Encoding: binary");
    $readed = @readfile($file->getFilePath());
}
ob_end_flush();