Пример #1
0
 public function retrieve_states()
 {
     if (!Core::checkRequiredGetVars('id_link')) {
         Core::performResponse('Missing argument');
     }
     $m = new ModelLink();
     $s = $m->getStatesByLink($_GET['id_link']);
     Core::performResponse(SimpleJSON::encode($s), 'json');
 }
Пример #2
0
 public function index()
 {
     $cat = null;
     if (Core::checkRequiredGetVars('cat')) {
         $cat = $_GET['cat'];
     }
     $this->setTitle('Achilles');
     $m = new ModelPost();
     $this->addContent('posts', $m->getPostsByDay($cat));
 }
Пример #3
0
 public function view()
 {
     if (!Core::checkRequiredGetVars("permalink")) {
         Go::to404();
     }
     $m = new ModelPost();
     $post = $m->oneByPermalink($_GET["permalink"]);
     Autoload::addComponent('Dabox');
     $this->setTitle($post['title_post']);
     $this->addContent("post", $post);
 }
Пример #4
0
 public function details()
 {
     if (!Core::checkRequiredGetVars('id', 'tab')) {
         Go::to404();
     }
     if (!Core::checkRequiredGetVars('no-async')) {
         Core::deactivateDebug();
     }
     $details = $this->model_link->details($_GET['id']);
     $s = array_reverse($this->model_link->getStatesByLink($_GET['id']));
     $this->addContent('states', str_replace('"', "'", SimpleJSON::encode($s)));
     $this->addContent('details', $details);
     $this->addContent('tab', $_GET['tab']);
 }
Пример #5
0
 public function update()
 {
     if (!Core::checkRequiredGetVars('permalink_list', 'prop_list') || !isset($_POST) || empty($_POST) || !isset($_POST['value']) || empty($_POST['value'])) {
         Go::to404();
     }
     $m = new ModelList();
     $list = $m->one(Query::condition()->andWhere('permalink_list', Query::EQUAL, $_GET['permalink_list']));
     if (!$list) {
         Go::to404();
     }
     $name = $_GET['prop_list'];
     if ($m->updateById($list['id_list'], array($name => $_POST['value']))) {
         $response = array("message" => "ok");
     } else {
         $response = array("error", "Unable to perform an update on field '" . $name . "'");
     }
     $response = SimpleJSON::encode($response);
     Core::performResponse($response, 'json');
 }
Пример #6
0
 /**
  * @return void
  */
 public function captcha()
 {
     if (!Core::checkRequiredGetVars("form", "input")) {
         Go::to404();
     }
     $form = $_GET["form"];
     $input = $_GET["input"];
     if (isset($_GET["backoffice"]) && $_GET["backoffice"] == 1) {
         Core::$isBackoffice = true;
     }
     $form = new Form($form);
     $captcha = $form->getInput($input);
     if (empty($captcha) || $captcha["tag"] != Form::TAG_CAPTCHA) {
         Go::to404();
     }
     $avaibles = array("backgroundColor", "fontSizeMax", "fontSizeMin", "width", "height", "rotation", "transparent");
     if (!isset($captcha["length"]) || empty($captcha["length"]) || $captcha["length"] == 0) {
         $captcha["length"] = 5;
     }
     $c = new Captcha($captcha["length"], $input);
     if (isset($captcha["fontColors"]) && is_array($captcha["fontColors"])) {
         $a = $captcha["fontColors"];
         for ($i = 0, $max = count($a); $i < $max; $i++) {
             $c->addFontColor($a[$i]);
         }
     }
     if (isset($captcha["fontFace"]) && is_array($captcha["fontFace"])) {
         $a = $captcha["fontFace"];
         for ($i = 0, $max = count($a); $i < $max; $i++) {
             $c->addFontFace($a[$i]);
         }
     }
     for ($i = 0, $max = count($avaibles); $i < $max; $i++) {
         if (isset($captcha[$avaibles[$i]]) && !empty($captcha[$avaibles[$i]])) {
             $c->{$avaibles}[$i] = $captcha[$avaibles[$i]];
         }
     }
     $c->render();
     exit;
 }
Пример #7
0
 /**
  * @throws \Exception
  */
 public function retrieve()
 {
     /**
      * Check get vars
      */
     $need = Core::checkRequiredGetVars("need") ? explode(self::NEED_SEPARATOR, $_GET["need"]) : array();
     if (empty($need)) {
         $this->output($this->log("No lib to load", "warn"));
     }
     $needs = array();
     $this->calculateNeeds($need, $needs);
     $needs = array_unique($needs);
     /**
      * Get lib contents
      */
     foreach ($needs as $lib) {
         if (isset($this->manifest[$lib])) {
             if (!isset($this->manifest[$lib][$this->type]) || !is_array($this->manifest[$lib][$this->type])) {
                 $this->output .= $this->log($lib . " is not available", "warn");
                 continue;
             }
             $files = $this->manifest[$lib][$this->type];
             for ($i = 0, $max = count($files); $i < $max; $i++) {
                 $absolute_link = preg_match('/^http\\:\\/\\//', $files[$i], $matches);
                 if (!$absolute_link) {
                     $files[$i] = dirname(self::MANIFEST) . "/" . $this->configuration["relative"] . $files[$i];
                     $content = File::read($files[$i]);
                     self::$current_folder = dirname($files[$i]);
                     if ($this->type == self::TYPE_CSS) {
                         $content = preg_replace_callback('/(url\\(\\")([^\\"]+)/', 'core\\tools\\Dependencies::correctUrls', $content);
                     }
                     $this->output .= $content . "\r\n";
                 } else {
                     $this->output .= Request::load($files[$i]);
                 }
             }
         } else {
             $this->output .= $this->log($lib . " is not available", "warn");
         }
     }
     /**
      * Minified / Uglyflied / gzip
      */
     $accept_gzip = preg_match('/gzip/', $_SERVER['HTTP_ACCEPT_ENCODING'], $matches) && !Core::checkRequiredGetVars("output");
     if ($accept_gzip) {
         Header::content_encoding("gzip");
         $this->output = gzencode($this->output);
     }
     $this->output($this->output);
 }