Esempio n. 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();
     }
 }
Esempio n. 2
0
 public static function run($root = "../", $routes = true, $session = true)
 {
     ob_start();
     //
     self::$root = $root;
     //
     require self::$root . 'vendor/fiesta/kernel/Logging/Handler.php';
     require self::$root . 'vendor/fiesta/kernel/Logging/Log.php';
     // Config
     require self::$root . 'vendor/fiesta/kernel/Config/Config.php';
     require self::$root . 'vendor/fiesta/kernel/Config/Exceptions/ConfigException.php';
     Config::load();
     // Set Timezone
     self::timeCall();
     // Set the error log
     Log::ini();
     // Set Whoops error handler
     Handler::run();
     //session
     require self::$root . 'vendor/fiesta/kernel/Storage/Session.php';
     if ($session) {
         Session::start(self::$root . 'app/storage/session');
     }
     //Maintenance
     require self::$root . 'vendor/fiesta/kernel/Maintenance/Maintenance.php';
     //Objects
     require self::$root . 'vendor/fiesta/kernel/Objects/Vars.php';
     require self::$root . 'vendor/fiesta/kernel/Objects/Strings/Strings.php';
     require self::$root . 'vendor/fiesta/kernel/Objects/Strings/Exceptions/StringOutIndexException.php';
     // Access
     require self::$root . 'vendor/fiesta/kernel/Access/Path.php';
     //Alias
     require self::$root . 'vendor/fiesta/kernel/Config/Alias.php';
     //
     //require self::$root.'vendor/fiesta/kernel/MVC/Templete.php';
     require self::$root . 'vendor/fiesta/kernel/Objects/Exception.php';
     require self::$root . 'vendor/fiesta/kernel/Resources/Faker.php';
     require self::$root . 'vendor/fiesta/kernel/Storage/Cookie.php';
     // Routes
     require self::$root . 'vendor/fiesta/kernel/Router/Routes.php';
     require self::$root . 'vendor/fiesta/kernel/Router/Route.php';
     require self::$root . 'vendor/fiesta/kernel/Router/Exceptions/NotFoundHttpException.php';
     // Caches
     require self::$root . 'vendor/fiesta/kernel/Caches/Caches.php';
     require self::$root . 'vendor/fiesta/kernel/Caches/Cache.php';
     require self::$root . 'vendor/fiesta/kernel/Caches/FileCache.php';
     require self::$root . 'vendor/fiesta/kernel/Caches/DatabaseCache.php';
     require self::$root . 'vendor/fiesta/kernel/Caches/Exceptions/DriverNotFoundException.php';
     require self::$root . 'vendor/fiesta/kernel/Storage/Storage.php';
     require self::$root . 'vendor/fiesta/kernel/Security/Auth.php';
     require self::$root . 'vendor/fiesta/kernel/Objects/Table.php';
     // Database
     require self::$root . 'vendor/fiesta/kernel/Database/Schema.php';
     require self::$root . 'vendor/fiesta/kernel/Database/Migration.php';
     require self::$root . 'vendor/fiesta/kernel/Database/Seeder.php';
     require self::$root . 'vendor/fiesta/kernel/Database/Database.php';
     require self::$root . 'vendor/fiesta/kernel/Database/Drivers/MySql.php';
     require self::$root . 'vendor/fiesta/kernel/Database/Exceptions/DatabaseArgumentsException.php';
     require self::$root . 'vendor/fiesta/kernel/Database/Exceptions/DatabaseConnectionException.php';
     require self::$root . 'vendor/fiesta/kernel/Access/Url.php';
     require self::$root . 'vendor/fiesta/kernel/Objects/Sys.php';
     require self::$root . 'vendor/fiesta/kernel/Http/Links.php';
     require self::$root . 'vendor/fiesta/kernel/Http/Http.php';
     require self::$root . 'vendor/fiesta/kernel/Objects/Base.php';
     require self::$root . 'vendor/fiesta/kernel/Resources/Libs.php';
     require self::$root . 'vendor/fiesta/kernel/Hypertext/Res.php';
     require self::$root . 'vendor/fiesta/kernel/Hypertext/Input.php';
     require self::$root . 'vendor/fiesta/kernel/Security/License.php';
     self::translatorCalls();
     self::modelsCalls();
     self::relationsCalls();
     self::mediaCalls();
     // MVC - View
     require self::$root . 'vendor/fiesta/kernel/MVC/View/View.php';
     require self::$root . 'vendor/fiesta/kernel/MVC/View/Libs/Template.php';
     require self::$root . 'vendor/fiesta/kernel/MVC/View/Libs/Views.php';
     require self::$root . 'vendor/fiesta/kernel/MVC/View/Exceptions/ViewNotFoundException.php';
     require self::$root . 'vendor/fiesta/kernel/Hypertext/HTML.php';
     require self::$root . 'vendor/fiesta/kernel/Security/Encrypt.php';
     require self::$root . 'vendor/fiesta/kernel/Security/Security.php';
     require self::$root . 'vendor/fiesta/kernel/MVC/Controller.php';
     require self::$root . 'vendor/fiesta/kernel/Http/Error.php';
     require self::$root . 'vendor/fiesta/kernel/Http/Root.php';
     require self::$root . 'vendor/fiesta/kernel/Mailing/Mail.php';
     require self::$root . 'vendor/fiesta/kernel/Objects/DataCollection.php';
     require self::$root . 'vendor/fiesta/kernel/Maintenance/Debug.php';
     // Filesystem
     require self::$root . 'vendor/fiesta/kernel/Filesystem/Exceptions/FileNotFoundException.php';
     require self::$root . 'vendor/fiesta/kernel/Filesystem/Exceptions/DirectoryNotFoundException.php';
     require self::$root . 'vendor/fiesta/kernel/Filesystem/Filesystem.php';
     // Database files
     require self::$root . 'vendor/fiesta/kernel/Database/DBTable.php';
     //
     Alias::ini(self::$root);
     Sys::ini();
     Url::ini();
     Path::ini();
     Template::run();
     Faker::ini();
     Links::ini();
     Errors::ini(self::$root);
     License::ini(self::$page);
     Lang::ini();
     Database::ini();
     Auth::ini();
     Panel::run();
     self::scoopCall();
     //
     if (self::$root != null) {
         // include models
         foreach (glob(self::$root . "app/models/*.php") as $file) {
             include_once $file;
         }
         //include the controllers files
         foreach (glob(self::$root . "app/controllers/*.php") as $file) {
             include_once $file;
         }
         //include the link files
         foreach (glob(self::$root . "app/paths/*.php") as $file) {
             include_once $file;
         }
         //include the seeders files
         foreach (glob(self::$root . "app/seeds/*.php") as $file) {
             include_once $file;
         }
         //
         //include filters
         include_once self::$root . "app/http/Filters.php";
         //include for routes
         if ($routes) {
             include_once self::$root . "app/http/Routes.php";
             Routes::run();
         }
     } else {
         // include models
         foreach (glob("app/models/*.php") as $file) {
             include_once $file;
         }
         //include the controllers files
         foreach (glob("app/controllers/*.php") as $file) {
             include_once $file;
         }
         //include the seeders files
         foreach (glob("app/seeds/*.php") as $file) {
             include_once $file;
         }
         //include filters
         include_once "app/http/Filters.php";
         //include for routes
         if ($routes) {
             include_once "app/http/Routes.php";
             Routes::run();
         }
     }
     return true;
 }