Beispiel #1
0
 private function __construct()
 {
     $this->viewPath = realpath(config("app.views_default_path"));
     $current_controller = FrontController::getInstance()->getRouter()->controller . 'Controller';
     if (class_exists($current_controller)) {
         $reflection = new \ReflectionClass($current_controller);
         $view_path = $_SERVER['DOCUMENT_ROOT'] . "/../" . str_replace("\\", DIRECTORY_SEPARATOR, lcfirst($reflection->getNamespaceName())) . "/../views";
         if (is_dir($view_path) && is_readable($view_path)) {
             $this->viewPath = realpath($view_path);
         } else {
             $this->viewPath = config("app.views_default_path");
         }
     }
     $this->errors = Session::getInstance()->getSession()->withErrors;
     $this->success = Session::getInstance()->getSession()->withSuccess;
     $this->input = Session::getInstance()->getSession()->withInput;
     Session::getInstance()->getSession()->unsetKey('withErrors');
     Session::getInstance()->getSession()->unsetKey('withSuccess');
     Session::getInstance()->getSession()->unsetKey('withInput');
 }
Beispiel #2
0
 public function run()
 {
     $db = new SimpleDB();
     $list = $db->sql("SELECT * FROM ban_ip")->fetchAllAssoc();
     foreach ($list as $ip) {
         if ($_SERVER['REMOTE_ADDR'] == $ip['ip']) {
             throw new \Exception("Currently your IP is blocked by admin");
         }
     }
     CSRF::getInstance()->generate();
     Auth::doAuth();
     $this->_frontController = FrontController::getInstance();
     if ($this->router instanceof \SSFrame\Routers\iRouter) {
         $this->_frontController->setRouter($this->router);
     } else {
         $this->_frontController->setRouter(new Route());
     }
     $this->_frontController->parseRouter();
     CSRF::getInstance()->check();
 }