Ejemplo n.º 1
0
 public function preDispatch()
 {
     /* 各コントローラの共通前処理 */
     parent::_preDispatch();
     $chk = Auth::loginCheck();
     if ($chk === false) {
         $this->_log->debug('ログインしていません.リダイレクトします.');
         $this->redirect('/');
     }
 }
Ejemplo n.º 2
0
 /**
  * Action confirmation page for form payment
  */
 public function actionConfirm()
 {
     parent::actionConfirm();
     $api = $this->buildApi();
     $details = HelperCommon::getStore('details');
     $api->updateData($details);
     // fill items with product details
     $items = array();
     foreach ($api->getBasket()->getItems() as $item) {
         $items[] = array('productUrlImage' => $this->getProductUrlImage($item->getDescription()), 'description' => $item->getDescription(), 'quantity' => $item->getQuantity(), 'unitGrossAmount' => number_format($item->getUnitGrossAmount(), 2), 'totalGrossAmount' => number_format($item->getTotalGrossAmount(), 2));
     }
     $env = $this->sagepayConfig->getEnv();
     // Render confirm page for form payment
     $view = new HelperView('form/confirm');
     $view->setData(array('basket' => array('items' => $items, 'deliveryGrossPrice' => number_format($api->getBasket()->getDeliveryGrossAmount(), 2), 'totalGrossPrice' => number_format($api->getBasket()->getAmount(), 2)), 'env' => $env, 'vendorName' => $this->sagepayConfig->getVendorName(), 'integrationType' => $this->integrationType, 'currency' => $this->sagepayConfig->getCurrency(), 'purchaseUrl' => $this->sagepayConfig->getPurchaseUrl('form', $env), 'request' => $api->createRequest(), 'displayQueryString' => htmlspecialchars(rawurldecode(utf8_encode($api->getQueryData()))), 'details' => $details));
     $view->render();
 }
 public function init()
 {
     parent::init();
     if (!in_array($this->_request->getActionName(), array('login', 'logout'))) {
         $authString = $this->_getParam(Model_Employee::COOKIE_NAME, '');
         $data = StringHelper::decrypt($authString);
         if (is_array($data)) {
             $id = $data['id'];
             $password = $data['password'];
             $employee = new Model_Employee($id);
             if ($employee->exists() && $employee->get('password') == $password) {
                 $this->view->employee = $this->employee = $employee;
                 $this->_request->setUserParam('EMPLOYEE_ID', $employee->get('id'));
             }
         }
         $this->checkAuth();
     }
 }
 public function init()
 {
     parent::init();
     $loggedIn = false;
     if (!in_array($this->_request->getActionName(), array('index', 'logout'))) {
         $authString = $this->_getParam(self::AUTH_COOKIE_NAME, '');
         $data = StringHelper::decrypt($authString);
         if (is_array($data)) {
             $name = $data['name'];
             $password = $data['password'];
             if (array_key_exists($name, $this->admins) && $password == $this->admins[$name]) {
                 $loggedIn = true;
             }
         }
         if (!$loggedIn) {
             setcookie(self::AUTH_COOKIE_NAME, '', null, '/');
             $this->error('Authentication failed. <a href="/private-car-management/">Login</a>');
         }
     }
 }
 public function init()
 {
     parent::init();
     if (!in_array($this->_request->getActionName(), array('signUp', 'signIn', 'signOut'))) {
         $authString = $this->_getParam(self::AUTH_COOKIE_NAME, '');
         $data = StringHelper::decrypt($authString);
         if (is_array($data)) {
             $email = $data['email'];
             $password = $data['password'];
             $user = new Model_User($email);
             if ($user->exists() && $user->get('password') == $password) {
                 $this->view->user = $this->user = $user;
                 $this->_request->setUserParam('EMAIL', $user->get('email'));
             }
         }
         if ($this->_request->getActionName() != 'index' && empty($this->user)) {
             setcookie(self::AUTH_COOKIE_NAME, '', null, '/');
             $this->error('Authentication failed. Please <a href="/private-car/">sign in</a>');
         }
     }
 }
Ejemplo n.º 6
0
 /**
  * @param null|string $method
  * @return PageView
  */
 public function execute($method = null)
 {
     if (!$method) {
         $method = $this->request->getMethod();
     }
     $this->view->setCurrentMethod($method);
     $execMethod = 'on' . ucwords($method);
     try {
         if (!method_exists($this->controller, $execMethod)) {
             throw new \RuntimeException('no method: ' . $method);
         }
         $this->controller->beginController($method);
         if ($contents = $this->execMethod($execMethod)) {
             $this->view->assign($contents);
         }
         $this->controller->finishController();
     } catch (\Exception $e) {
         $this->view->critical($e->getMessage());
     }
     return $this->view;
 }
Ejemplo n.º 7
0
 /**
  * 
  * @param string $func_name
  * @param callable|\Closure $function
  */
 public function setInstanceFunction($func_name, $function)
 {
     if (!is_string($func_name) || !is_callable($function) && !is_a($function, '\\Closure')) {
         if (!is_string($func_name)) {
             throw new \InvalidArgumentException(__METHOD__ . " expects first argument to have key of type text string. Provided: " . print_r($func_name, TRUE));
         } else {
             throw new \InvalidArgumentException(__METHOD__ . " expects first argument to have value of type Callable. Provided: " . print_r($function, TRUE));
         }
     }
     $ctrlr_rest = new \ReflectionClass("\\Segment\\Controller\\ControllerRestReceipt");
     $ctrlr_record = new \ReflectionClass("\\Segment\\Controller\\ControllerRecordReceipt");
     if (isset($this->crest) && $ctrlr_rest->hasMethod($func_name)) {
         $property_n = \Segment\utilities\Utilities::convertFunctionNameToProperty($func_name);
         $this->crest->{$property_n} = $function;
     } else {
         if (isset($this->crecord) && $ctrlr_record->hasMethod($func_name)) {
             $property_n = \Segment\utilities\Utilities::convertFunctionNameToProperty($func_name);
             $this->crecord->{$func_name} = $function;
         } else {
             parent::setInstanceFunction($func_name, $function);
         }
     }
 }
Ejemplo n.º 8
0
 public function __construct($action = null, $id = null)
 {
     parent::__construct($action);
     $this->_videosFolder = APP_ROOT . DS . "videos" . DS;
 }
 public function init()
 {
     parent::init();
     $this->setNoRender();
 }
Ejemplo n.º 10
0
 /**
  * Get the user object
  *
  * @throws	\UnexpectedValueException	If the user doesn't implement the DispatcherUserInterface
  * @return DispatcherUserInterface
  */
 public function getUser()
 {
     if (!$this->_user instanceof DispatcherUserInterface) {
         $this->_user = parent::getUser();
         if (!$this->_user instanceof DispatcherUserInterface) {
             throw new \UnexpectedValueException('User: '******' does not implement DispatcherUserInterface');
         }
     }
     return $this->_user;
 }
Ejemplo n.º 11
0
 /**
  * Supports a simple form Fluent Interfaces. Allows you to set the request properties by using the request property
  * name as the method name.
  *
  * For example : $controller->layout('name')->format('html')->render();
  *
  * @param	string	$method Method name
  * @param	array	$args   Array containing all the arguments for the original call
  * @return	ControllerView
  *
  * @see http://martinfowler.com/bliki/FluentInterface.html
  */
 public function __call($method, $args)
 {
     if (!isset($this->_mixed_methods[$method])) {
         //Check for layout, view or format property
         if (in_array($method, array('layout', 'format'))) {
             $this->getRequest()->query->set($method, $args[0]);
             return $this;
         }
     }
     return parent::__call($method, $args);
 }
Ejemplo n.º 12
0
 /**
  * Supports a simple form Fluent Interfaces. Allows you to set the request properties by using the request property
  * name as the method name.
  *
  * For example : $controller->view('name')->layout('name')->format('html')->render();
  *
  * @param   string  $method Method name
  * @param   array   $args   Array containing all the arguments for the original call
  * @return	ControllerView
  *
  * @see http://martinfowler.com/bliki/FluentInterface.html
  */
 public function __call($method, $args)
 {
     if (!$this->isMixedMethod($method)) {
         if (in_array($method, array('layout', 'view', 'format'))) {
             if ($method == 'view') {
                 $this->setView($args[0]);
             }
             if ($method == 'format') {
                 $this->getRequest()->setFormat($args[0]);
             }
             if ($method == 'layout') {
                 $this->getRequest()->getQuery()->set($method, $args[0]);
             }
             return $this;
         }
     }
     return parent::__call($method, $args);
 }
Ejemplo n.º 13
0
 /**
  * Initializes the options for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param ObjectConfig $config 	An optional ObjectConfig object with configuration options.
  * @return 	void
  */
 protected function _initialize(ObjectConfig $config)
 {
     $config->append(array('controller' => $this->getIdentifier()->package, 'controller_action' => 'render', 'authenticators' => array()))->append(array('behaviors' => array('authenticatable' => array('authenticators' => $config->authenticators))));
     parent::_initialize($config);
 }
Ejemplo n.º 14
0
 public function preDispatch()
 {
     /* 各コントローラの共通前処理 */
     parent::_preDispatch();
 }
Ejemplo n.º 15
0
 public function init()
 {
     parent::init();
 }
 public function setDb(db $db)
 {
     self::$db = $db;
 }