public static function run() { $currentUrl = self::CheckUrl(); // if (!Maintenance::check()) { self::ReplaceParams(); self::Replace(); // $ok = false; // foreach (self::$requests as $value) { $requestsUrl = $value["url"]; //var_dump($value); // if (preg_match("#^{$requestsUrl}\$#", $currentUrl, $params)) { if (!is_null($value["subdomain"])) { if (Table::contains($value["subdomain"], self::getDomain())) { if ($value["methode"] == "post" && Res::isPost()) { $ok = self::exec($params, $value); break; } else { if ($value["methode"] == "post" && !Res::isPost()) { $ok = 0; } else { if ($value["methode"] == "get") { $ok = self::exec($params, $value); break; } else { if ($value["methode"] == "resource") { $ok = self::exec($params, $value); break; } else { if ($value["methode"] == "object") { $ok = self::exec($params, $value); //var_dump($value); break; } } } } } } else { $ok = 0; } } else { if ($value["methode"] == "post" && Res::isPost()) { $ok = self::exec($params, $value); break; } else { if ($value["methode"] == "post" && !Res::isPost()) { $ok = 0; } else { if ($value["methode"] == "get") { $ok = self::exec($params, $value); break; } else { if ($value["methode"] == "resource") { $ok = self::exec($params, $value); break; } else { if ($value["methode"] == "object") { $ok = self::exec($params, $value); break; } } } } } } } } if ($ok == 0) { if (Config::get('app.unrouted')) { throw new NotFoundHttpException(); } else { Errors::r_404(); } } } else { Maintenance::show(); } }
public static function setDefault() { Cookie::create(self::getName(), Config::get('lang.default'), 60 * 24 * 7); Res::stsession("Fiesta_lang", Config::get('lang.default')); }
public function paginate($RowsPerPage) { // count data $sql = "select count(*) as nbRows from " . $this->name; $var = Database::read($sql); $this->RowsPerPage = $RowsPerPage; $this->nbRows = $var[0]['nbRows']; $this->nbPages = ceil($this->nbRows / $RowsPerPage); //if isset get $this->CurrentPage = 1; if (isset($_GET[Config::get('view.pagination_param')]) && !empty($_GET[Config::get('view.pagination_param')])) { if ($_GET[Config::get('view.pagination_param')] > 0 && $_GET[Config::get('view.pagination_param')] <= $this->nbPages) { $this->CurrentPage = Res::get(Config::get('view.pagination_param')); } } //get Data $r = array(); $sql = "select * from " . $this->name . " Limit " . ($this->CurrentPage - 1) * $this->RowsPerPage . ",{$this->RowsPerPage}"; $this->data = Database::read($sql); // return $this; }