示例#1
0
 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();
     }
 }
示例#2
0
 public static function printTranslationAssistance()
 {
     if (isset(Lang::$_untranslated_dictionary) && count(Lang::$_untranslated_dictionary) > 0) {
         echo "Translation assistance for language " . Res::session("ARFramework_lang") . ". <br/>(You can set this assistant OFF by setting the constant LANG_TRANSLATION_ASSISTANCE to false in the 'config.php' file)" . ". <br/>Add the following elements to the locale/" . Res::session("ARFramework_lang") . "/core.xml file (or to the relevant subdictionary) :<br/>";
         echo "<textarea style=\"width:50%;\" rows=\"10\">";
         foreach (Lang::$_untranslated_dictionary as $key => $argument_count) {
             $s = "<translation key=\"{$key}\"";
             if ($argument_count != "0") {
                 $s .= " arguments=\"{$argument_count}\"";
             }
             $s .= "></translation>";
             echo "\n" . htmlentities($s, ENT_QUOTES);
         }
         echo "</textarea>";
     }
 }
示例#3
0
 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;
 }