Example #1
0
 private static function check_include($inc)
 {
     if ($_SERVER['REQUEST_METHOD'] === 'GET' && strpos(KEY_APP, 'ajax?get') !== false || $_SERVER['REQUEST_METHOD'] === 'POST' && KEY_APP == 'ajax?post') {
         $ACTION_APP = '';
         $classMain = CONTROLLER_APP . '_Controller';
         foreach (explode("-", ACTION_APP) as $index => $spl) {
             if ($index != 0) {
                 $ACTION_APP .= ucfirst($spl);
             } else {
                 $ACTION_APP .= $spl;
             }
         }
         $classMain = CONTROLLER_APP . '_Controller';
         $functionAction = $ACTION_APP . 'Action';
         $classMain = new $classMain();
         $classMain->{$functionAction}();
     } else {
         if (file_exists($inc) && is_readable($inc)) {
             $classMain = CONTROLLER_APP . '_Controller';
             $functionAction = ACTION_APP . 'Action';
             $classMain = new $classMain();
             $classMain->{$functionAction}();
             $view = new View();
             $view->launch_view($inc);
         } else {
             self::not_found(ACTION_APP);
         }
     }
 }