Exemplo n.º 1
0
    /**
     * Preprocessor for no-action reaction
     *
     * @return void
     */
    protected function doNoAction()
    {
        parent::doNoAction();
        $content = \XLite\Core\Request::getInstance()->id ? \XLite\Core\Database::getRepo('XLite\\Model\\IframeContent')->find(\XLite\Core\Request::getInstance()->id) : null;
        if ($content) {
            $method = $content->getMethod();
            $url = $content->getUrl();
            $body = $this->assembleFormBody($content);
            $html = <<<HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body onload="javascript: document.getElementById('payment_form').submit();">
  <form method="{$method}" id="payment_form" name="payment_form" action="{$url}">
    <fieldset style="display: none;">
{$body}
    </fieldset>
  </form>
</body>
</html>
HTML;
            print $html;
            exit;
        } else {
            $this->redirect(\XLite\Core\Converter::buildURL('checkout'));
        }
    }
Exemplo n.º 2
0
 /**
  * Redirect
  *
  * @return boolean
  */
 public function doRedirect()
 {
     if ($this->getIframe()->getEnabled()) {
         $this->getIframe()->finalize();
     } else {
         return parent::doRedirect();
     }
 }
Exemplo n.º 3
0
 /**
  * Handles the request.
  *
  * @return void
  */
 public function handleRequest()
 {
     if (!$this->isValidRequest()) {
         $this->display404();
         $this->doRedirect();
     }
     parent::handleRequest();
 }
Exemplo n.º 4
0
 /**
  * Get fingerprint difference
  *
  * @params array $old Old fingerprint
  * @params array $new New fingerprint
  *
  * @return array
  */
 protected function getCartFingerprintDifference(array $old, array $new)
 {
     $diff = parent::getCartFingerprintDifference($old, $new);
     $cellKeys = array('capostOfficeId', 'capostShippingZipCode');
     foreach ($cellKeys as $name) {
         if ($old[$name] != $new[$name]) {
             $diff[$name] = $new[$name];
         }
     }
     return $diff;
 }
Exemplo n.º 5
0
 /**
  * Handles the request.
  * Parses the request variables if necessary. Attempts to call the specified action function
  *
  * @return void
  */
 public function handleRequest()
 {
     \XLite\Core\Session::getInstance()->iframePaymentData = null;
     // security check on return page
     $orderId = \XLite\Core\Request::getInstance()->order_id;
     if ($orderId != \XLite\Core\Session::getInstance()->last_order_id && $orderId != $this->getCart()->getOrderId()) {
         $this->redirect($this->buildURL('cart'));
     } else {
         parent::handleRequest();
     }
 }
Exemplo n.º 6
0
 /**
  * Get return URL
  *
  * @return string
  */
 public function getReturnURL()
 {
     $url = parent::getReturnURL();
     if (\XLite\Core\Request::getInstance()->action) {
         $target = $this->getReturnTarget();
         $params = array('product_id' => $this->getProductId());
         $widget = \XLite\Core\Request::getInstance()->widget;
         if ($widget) {
             $params['widget'] = $widget;
         }
         $url = $this->buildURL($target, '', $params) . '#product-details-tab-reviews';
     }
     return $url;
 }
Exemplo n.º 7
0
 /**
  * Get fingerprint difference
  *
  * @param array $old Old fingerprint
  * @param array $new New fingerprint
  *
  * @return array
  */
 protected function getCartFingerprintDifference(array $old, array $new)
 {
     $diff = parent::getCartFingerprintDifference($old, $new);
     if (count($old['coupons']) !== count($new['coupons']) || count($old['coupons']) !== count(array_intersect($old['coupons'], $new['coupons']))) {
         $diff['coupons'] = array();
         foreach (array_diff($new['coupons'], $old['coupons']) as $id) {
             $diff['coupons'][] = array('id' => $id, 'state' => 'added');
         }
         foreach (array_diff($old['coupons'], $new['coupons']) as $id) {
             $diff['coupons'][] = array('id' => $id, 'state' => 'removed');
         }
     }
     return $diff;
 }
Exemplo n.º 8
0
Arquivo: Cart.php Projeto: kingsj/core
 /**
  * isSecure
  * TODO: check if this method is used
  *
  * @return void
  */
 public function isSecure()
 {
     return $this->is('HTTPS') ? true : parent::isSecure();
 }
Exemplo n.º 9
0
 /**
  * Check if current page is accessible
  *
  * @return boolean
  */
 protected function checkAccess()
 {
     return parent::checkAccess() && $this->getOrder() && $this->checkOrderAccess() && $this->getOrder()->isCapostShippingMethod();
 }
Exemplo n.º 10
0
 /**
  * Check if current page is accessible
  *
  * @return boolean
  */
 public function checkAccess()
 {
     return parent::checkAccess();
 }
Exemplo n.º 11
0
 /**
  * Add part to the location nodes list
  *
  * @return void
  */
 protected function addBaseLocation()
 {
     parent::addBaseLocation();
     foreach ($this->getCategoryPath() as $category) {
         if ($category->isVisible()) {
             $this->addLocationNode($category->getName(), $this->getCategoryURL($category), $this->getLocationNodeSubnodes($category));
         } else {
             break;
         }
     }
 }
Exemplo n.º 12
0
 /**
  * Check if current page is accessible
  *
  * @return boolean
  */
 protected function checkAccess()
 {
     return parent::checkAccess() && $this->getShipment() && $this->checkTrackingAccess();
 }
Exemplo n.º 13
0
 /**
  * Check controller visibility
  *
  * @return boolean
  */
 protected function isVisible()
 {
     return parent::isVisible() && $this->getPage();
 }
Exemplo n.º 14
0
 /**
  * Return Viewer object
  *
  * @return \XLite\View\Controller
  */
 public function getViewer($isExported = false)
 {
     return parent::getViewer(true);
 }
Exemplo n.º 15
0
 /**
  * Add the base part of the location path
  *
  * @return void
  */
 protected function addBaseLocation()
 {
     parent::addBaseLocation();
     $this->addLocationNode(static::t('Help zone'));
 }
Exemplo n.º 16
0
Arquivo: Rest.php Projeto: kingsj/core
 /**
  * Perform some actions before redirect
  *
  * FIXME: check. Action should not be an optional param
  *
  * @param string|null $action Performed action OPTIONAL
  *
  * @return void
  */
 protected function actionPostprocess($action = null)
 {
     parent::actionPostprocess($action);
     header('Content-type: application/json');
     $data = json_encode($this->data);
     header('Content-Length: ' . strlen($data));
     echo $data;
     exit(0);
 }
Exemplo n.º 17
0
 /**
  * Check if current page is accessible
  *
  * @return boolean
  */
 protected function checkAccess()
 {
     return parent::checkAccess() && ('download' != $this->getAction() || $this->getStorage());
 }
Exemplo n.º 18
0
 /**
  * Check if current page is accessible
  *
  * @return boolean
  */
 protected function checkAccess()
 {
     return parent::checkAccess() && !\XLite\Module\CDev\XMLSitemap\Logic\SitemapGenerator::getInstance()->isEmpty();
 }
Exemplo n.º 19
0
 /**
  * Get pages templates
  *
  * @return array
  */
 protected function getPageTemplates()
 {
     $list = parent::getPages();
     $list['default'] = 'order/list.tpl';
     return $list;
 }
Exemplo n.º 20
0
 /**
  * Add part to the location nodes list
  *
  * @return void
  */
 protected function addBaseLocation()
 {
     parent::addBaseLocation();
     $this->addLocationNode('X-Payments');
 }
Exemplo n.º 21
0
 /**
  * Handles the request
  *
  * @return void
  */
 public function handleRequest()
 {
     \XLite\Core\Request::getInstance()->action = 'callback';
     parent::handleRequest();
 }
Exemplo n.º 22
0
 /**
  * Add part to the location nodes list
  *
  * @return void
  */
 protected function addBaseLocation()
 {
     parent::addBaseLocation();
     if (!$this->isRegisterMode()) {
         $this->addLocationNode(static::t('My account'));
     }
 }
 /**
  * Perform some actions before redirect
  *
  * FIXME: check. Action should not be an optional param
  *
  * @param string $action Current action OPTIONAL
  *
  * @return void
  */
 protected function actionPostprocess($action = null)
 {
     parent::actionPostprocess($action);
     if ($action) {
         $this->assembleReturnURL();
     }
 }
Exemplo n.º 24
0
 /**
  * Define the actions with no secure token
  *
  * @return array
  */
 public static function defineFreeFormIdActions()
 {
     $list = parent::defineFreeFormIdActions();
     $list[] = 'get_tree';
     return $list;
 }
Exemplo n.º 25
0
 /**
  * Add the base part of the location path
  *
  * @return void
  */
 protected function addBaseLocation()
 {
     parent::addBaseLocation();
     $this->addLocationNode(static::t('Search for orders'), $this->buildURL('order_list'));
 }
Exemplo n.º 26
0
 /**
  * Handles the request.
  * Parses the request variables if necessary. Attempts to call the specified action function
  *
  * @return void
  */
 public function handleRequest()
 {
     parent::handleRequest();
     $this->headerStatus(404);
 }
Exemplo n.º 27
0
 /**
  * Check if current page is accessible
  *
  * @return boolean
  */
 public function checkAccess()
 {
     return parent::checkAccess() && \XLite\Core\Config::getInstance()->CDev->ContactUs->enable_form;
 }
Exemplo n.º 28
0
 /**
  * Check - controller must work in secure zone or not
  *
  * @return boolean
  */
 public function isSecure()
 {
     return 'logoff' !== \XLite\Core\Request::getInstance()->action ? \XLite\Core\Config::getInstance()->Security->customer_security : parent::isSecure();
 }
Exemplo n.º 29
0
 /**
  * Add part to the location nodes list
  *
  * @return void
  */
 protected function addBaseLocation()
 {
     parent::addBaseLocation();
     $this->addLocationNode('My account');
 }
Exemplo n.º 30
0
 /**
  * Get the full URL of the page
  *
  * @param string  $url    Relative URL OPTIONAL
  * @param boolean $secure Flag to use HTTPS OPTIONAL
  * @param array   $params Optional URL params OPTIONAL
  *
  * @return string
  */
 public function getShopURL($url = '', $secure = null, array $params = array())
 {
     $add = (strpos($url, '?') ? '&' : '?') . 'feed=' . \XLite\Core\Request::getInstance()->action;
     return parent::getShopURL($url . $add, $secure, $params);
 }