コード例 #1
0
 function init($options)
 {
     parent::init($options);
     // run Phalcon Eye to get session from database
     require_once ROOT_PATH . "/app/engine/Config.php";
     require_once ROOT_PATH . "/app/engine/Exception.php";
     require_once ROOT_PATH . "/app/engine/ApplicationInitialization.php";
     require_once ROOT_PATH . "/app/engine/Application.php";
     $application = new \Engine\Application();
     $application->run('session');
     $identity = Phalcon\DI::getDefault()->get('session')->get('identity');
     $viewer = \User\Model\User::findFirstById($identity);
     if (!$viewer || !$viewer->isAdmin()) {
         die('Access not allowed');
     }
 }
コード例 #2
0
ファイル: User.php プロジェクト: biggtfish/cms
 /**
  * Get some user.
  *
  * @param int $id User identity.
  *
  * @return UserModel
  */
 public function get($id)
 {
     return UserModel::findFirstById($id);
 }