コード例 #1
0
ファイル: Route.php プロジェクト: procivam/hochu-bilet-v3
 /**
  *  Start site. Initialize controller
  */
 public function execute()
 {
     if (!file_exists(HOST . APPLICATION . '/Modules/Base.php')) {
         return Config::error();
     }
     require_once HOST . APPLICATION . '/Modules/Base.php';
     $module = ucfirst(Route::module());
     $controller = ucfirst(Route::controller());
     $action = Route::action();
     if (APPLICATION) {
         $path[] = str_replace('/', '', APPLICATION);
     }
     $path[] = 'Modules';
     if ($module) {
         $path[] = $module;
     }
     $path[] = 'Controllers';
     $path[] = $controller;
     if (file_exists(HOST . '/' . implode('/', $path) . '.php')) {
         return $this->start($path, $action);
     }
     unset($path[count($path) - 2]);
     if (file_exists(HOST . '/' . implode('/', $path) . '.php')) {
         return $this->start($path, $action);
     }
     return Config::error();
 }
コード例 #2
0
ファイル: User.php プロジェクト: procivam/hochu-bilet-v3
 /**
  * @return string
  */
 public function get_current_access()
 {
     if (!$this->_info) {
         return 'no';
     }
     $access = $this->_access;
     if ($this->_full_access || Route::controller() == 'auth' || Route::module() == 'ajax') {
         return $this->_current_access = 'edit';
     }
     if (!isset($access[Route::controller()]) || $access[Route::controller()] == 'no') {
         return $this->_current_access = 'no';
     }
     if ($access[Route::controller()] == 'view' && Route::action() != 'index' && Route::action() != 'edit') {
         return $this->_current_access = 'no';
     }
     if ($access[Route::controller()] == 'view' && Route::action() == 'edit' && $_POST) {
         return $this->_current_access = 'no';
     }
     return $this->_current_access = $access[Route::controller()];
 }