Example #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);
                                         //var_dump($value);
                                         break;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if ($ok == 0) {
             if (\Config::get('app.unrouted')) {
                 throw new RouteNotFoundException($currentUrl);
             } else {
                 \Errors::r_404();
             }
         }
     } else {
         \Maintenance::show();
     }
 }