当前位置: 首页>>代码示例>>PHP>>正文


PHP HTTP_Exception::Factory方法代码示例

本文整理汇总了PHP中HTTP_Exception::Factory方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP_Exception::Factory方法的具体用法?PHP HTTP_Exception::Factory怎么用?PHP HTTP_Exception::Factory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTTP_Exception的用法示例。


在下文中一共展示了HTTP_Exception::Factory方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_index

 /**
  * View users profile
  */
 public function action_index()
 {
     $id = $this->request->param('id');
     $user = ORM::factory('User', $id);
     if (!$user->loaded()) {
         throw HTTP_Exception::Factory('404', 'No such user');
     }
     $container = new Tabs();
     $about = new Tab('About me');
     $about->add_content(new Tab_Text($user->get_property('about')));
     $about->add_content(new Tab_Text($user->get_property('signature')));
     $container->add_tab($about);
     Event::fire('user.profile_tabs', array($user, $container));
     $this->view = new View_User_Profile();
     $this->view->user = $user;
     $this->view->tabs = $container->render();
     /*
     // @TODO, This belongs to the pet module, better to use events?
     $pets = ORM::factory('User_Pet')
     	->where('user_id', '=', $user->id)
     	->order_by('active', 'desc');
     
     $paginate = Paginate::factory($pets)
     	->execute();
     
     $this->view = new View_User_Profile;
     $this->view->pagination = $paginate->render();
     $this->view->profile_user = $user;
     // $this->view->pets = ORM::factory('User_Pet')->where('user_id', '=', $user->id)->order_by('active', 'desc')->find_all()->as_array();
     $this->view->pets = $paginate->result();
     */
 }
开发者ID:modulargaming,项目名称:user,代码行数:35,代码来源:Profile.php

示例2: _validate_csrf

 /**
  * Check to ensure POST requests contains CSRF.
  * @throws HTTP_Exception
  */
 private function _validate_csrf()
 {
     if ($this->request->method() == HTTP_Request::POST) {
         $validation = Validation::factory($this->request->post())->rule('csrf', 'not_empty')->rule('csrf', 'Security::check');
         if (!$validation->check()) {
             throw HTTP_Exception::Factory(403, 'CSRF check failed!');
         }
     }
 }
开发者ID:modulargaming,项目名称:core,代码行数:13,代码来源:Frontend.php

示例3: action_profile

 /**
  * Show company profile
  */
 public function action_profile()
 {
     // Defaults to ID = 1
     $id = $this->request->param('id');
     if ($id == '') {
         $id = 1;
     }
     $company = Model::factory('Company');
     $company_data = $company->load($id);
     if ($company_data === FALSE) {
         throw HTTP_Exception::Factory(404, "File not found!");
     }
     $view = View::factory('company/profile');
     $view->set('id', $id);
     $view->set('company_data', $company_data);
     $this->response->body($view);
 }
开发者ID:stwns,项目名称:lasku,代码行数:20,代码来源:Company.php

示例4: action_index

 /**
  * View message
  */
 public function action_index()
 {
     $id = $this->request->param('id');
     $message = ORM::factory('Message', $id);
     if (!$message->loaded()) {
         throw HTTP_Exception::Factory('404', 'No such message');
     }
     if (!$this->user->can('Message_View_Index', array('message' => $message))) {
         throw HTTP_Exception::Factory('403', 'Message does not belong to you');
     }
     if (!$message->read) {
         $message->read = 1;
         $message->save();
     }
     if ($message->sent) {
         $message->sender = $message->receiver;
     }
     $this->view = new View_Message_View();
     $this->view->message = $message;
 }
开发者ID:modulargaming,项目名称:message,代码行数:23,代码来源:View.php

示例5: logged_in_required

 /**
  * Ensure the user is logged in, else throw a 403 Exception.
  *
  * @throws HTTP_Exception
  */
 protected function logged_in_required()
 {
     if ($this->auth->logged_in() == FALSE) {
         throw HTTP_Exception::Factory(401, 'Login to access this page!');
     }
 }
开发者ID:modulargaming,项目名称:core,代码行数:11,代码来源:Controller.php

示例6: action_view

 public function action_view()
 {
     $id = $this->request->param('id');
     $shop = ORM::factory('User_Shop', $id);
     if (!$shop->loaded()) {
         throw HTTP_Exception::Factory('404', 'No such user shop.');
     }
     $this->view = new View_Item_Shop_View();
     $this->view->shop = $shop->as_array();
     $this->view->owner = $shop->user->as_array();
     $inventory = Item::location('shop', FALSE, NULL, $shop->user)->where('parameter', '>', '0')->find_all();
     $this->view->items = $inventory;
 }
开发者ID:modulargaming,项目名称:item,代码行数:13,代码来源:Shop.php


注:本文中的HTTP_Exception::Factory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。