public function execute() { $this->view->assign('title', $this->getTitle()); $this->view->assign('title_style', $this->getTitleStyle()); $this->view->setOptions(array('left_delimiter' => '{', 'right_delimiter' => '}')); if ($this->template === null) { if (waRequest::isMobile()) { $this->setLayout(null); $this->template = 'LoginMobile.html'; } else { $this->template = 'Login.html'; } $template_file = wa()->getDataPath('templates/' . $this->template, false, 'webasyst'); if (file_exists($template_file)) { $this->template = 'file:' . $template_file; } else { $this->template = wa()->getAppPath('templates/actions/login/', 'webasyst') . $this->template; } } $this->view->assign('login', waRequest::post('login', $this->getStorage()->read('auth_login'))); parent::execute(); if ($this->layout) { $this->layout->assign('error', $this->view->getVars('error')); } $ref = waRequest::server('HTTP_REFERER'); if (waRequest::get('back_to') && $ref) { $this->getStorage()->write('login_back_on_cancel', $ref); } else { if (!$ref) { $this->getStorage()->remove('login_back_on_cancel'); } } $this->view->assign('back_on_cancel', wa()->getStorage()->read('login_back_on_cancel')); }
public function frontendHead($param) { $domain_settings = shopOnestep::getDomainSettings(); if (!(waRequest::isMobile() && !empty($domain_settings['desktop_only'])) && $this->getSettings('status') && $domain_settings['status'] && wa()->getRouting()->getCurrentUrl() != 'checkout/success/' && wa()->getRouting()->getCurrentUrl() != 'checkout/error/' && (wa()->getRouting()->getCurrentUrl() == 'cart/' || preg_match('@^checkout/@i', wa()->getRouting()->getCurrentUrl()))) { $onestep_url = wa()->getRouteUrl('shop/frontend/onestep'); wa()->getResponse()->redirect($onestep_url); } }
public function _getTemplate() { $template = parent::getTemplate(); if (($id = waRequest::isMobile()) || true) { $this->view->assign('mobile_id', $id); $template = str_replace('templates/actions/', 'templates/actions-mobile/', $template); } return $template; }
protected function getTemplate() { if (!$this->template) { $this->template = 'ApiAuth'; } if (waRequest::isMobile()) { $this->template .= 'Mobile'; } return parent::getTemplate(); }
protected function afterAuth() { $this->getStorage()->remove('auth_login'); $redirect = $this->getConfig()->getCurrentUrl(); $backend_url = $this->getConfig()->getBackendUrl(true); if (waRequest::isMobile()) { $this->redirect(array('url' => $backend_url)); } if (!$redirect || $redirect === $backend_url) { $redirect = $this->getUser()->getLastPage(); } if (!$redirect || substr($redirect, 0, strlen($backend_url) + 1) == $backend_url . '?') { $redirect = $backend_url; } $this->redirect(array('url' => $redirect)); }
public function execute() { if (waRequest::isMobile()) { $this->executeAction(new shopOrdersMobileAction()); } else { if (wa()->getUser()->getRights('shop', 'orders')) { $this->executeAction(new shopBackendOrdersAction()); } elseif ($this->getUser()->isAdmin('shop') || wa()->getUser()->getRights('shop', 'type.%')) { $this->executeAction(new shopBackendProductsAction()); } elseif ($this->getRights('pages') || $this->getRights('design')) { $this->executeAction(new shopBackendStorefrontsAction()); } elseif ($this->getRights('reports')) { $this->executeAction(new shopBackendReportsAction()); } elseif (wa()->getUser()->getRights('shop', 'settings')) { $this->executeAction(new shopBackendSettingsAction()); } else { $this->setLayout(new shopBackendLayout()); } } }
public function userAgent($type = null) { $user_agent = waRequest::server('HTTP_USER_AGENT'); if (!$type) { return $user_agent; } elseif ($type == 'isMobile') { return waRequest::isMobile(false); } elseif ($type == 'platform' || $type == 'os') { $patterns = array('android' => 'android', 'blackberry' => 'blackberry', 'linux' => 'Linux', 'ios' => '(ipad|iphone|ipod)', 'mac' => '(Macintosh|Mac\\sOS)', 'windows' => 'Windows'); } elseif ($type == 'device') { $patterns = array('ipad' => 'ipad', 'ipod' => 'ipod', 'iphone' => 'iphone', 'android' => 'android'); } foreach ($patterns as $id => $pattern) { if (preg_match('/' . $pattern . '/i', $user_agent)) { return $id; } } return ''; }