コード例 #1
0
ファイル: settings.php プロジェクト: mehulsbhatt/volcano
 /**
  * Switches the active seller.
  * 
  * @param int $id Seller ID.
  *
  * @return void
  */
 public function action_switch($id = null)
 {
     if (!$id) {
         throw new HttpNotFoundException();
     }
     $seller = Service_Seller::find_one($id);
     if (!$seller) {
         throw new HttpNotFoundException();
     }
     Seller::set($seller);
     Session::set_alert('success', "You are now viewing as seller \"{$seller->name}\".");
     Response::redirect('/');
 }
コード例 #2
0
ファイル: controller.php プロジェクト: mehulsbhatt/volcano
 /**
  * Checks for api key authentication.
  *
  * @return bool
  */
 protected function _prepare_key_auth()
 {
     // Skip auth for front-end interface.
     if (\Seller::active()) {
         return true;
     }
     \Config::load('api', true);
     $api_key = \Input::param('api_key', \Config::get('api.key'));
     if (!$api_key) {
         return false;
     }
     $api_key = \Service_Api_Key::find_one(array('key' => $api_key));
     if (!$api_key) {
         return false;
     }
     if ($api_key->seller) {
         \Seller::set($api_key->seller);
     }
     return true;
 }