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


PHP waRequest::server方法代码示例

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


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

示例1: execute

 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'));
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:34,代码来源:webasystLogin.action.php

示例2: __construct

 public function __construct()
 {
     $this->view = waSystem::getInstance()->getView();
     if (wa()->getEnv() == 'frontend') {
         // save utm to cookie
         $utm = array();
         foreach (waRequest::get() as $k => $v) {
             if (substr($k, 0, 4) == 'utm_') {
                 $utm[substr($k, 4)] = $v;
             }
         }
         if ($utm) {
             // save utm to cookie
             wa()->getResponse()->setCookie('utm', json_encode($utm), time() + 30 * 86400, null, '', false, true);
         }
         // save referer
         if ($ref = waRequest::server('HTTP_REFERER')) {
             $ref_host = @parse_url($ref, PHP_URL_HOST);
             if ($ref_host != waRequest::server('HTTP_HOST')) {
                 wa()->getResponse()->setCookie('referer', waRequest::server('HTTP_REFERER'), time() + 30 * 86400, null, '', false, true);
             }
         }
         // save landing page
         if (!waRequest::cookie('landing')) {
             wa()->getResponse()->setCookie('landing', waRequest::server('REQUEST_URI'), 0, null, '', false, true);
         }
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:28,代码来源:waLayout.class.php

示例3: execute

 public function execute()
 {
     $this->response['files'] = array();
     $this->getStorage()->close();
     if (waRequest::server('HTTP_X_FILENAME')) {
         $name = waRequest::server('HTTP_X_FILE_NAME');
         $size = waRequest::server('HTTP_X_FILE_SIZE');
         $file_path = wa()->getTempPath('shop/upload/') . $name;
         $append_file = is_file($file_path) && $size > filesize($file_path);
         clearstatcache();
         file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0);
         $file = new waRequestFile(array('name' => $name, 'type' => waRequest::server('HTTP_X_FILE_TYPE'), 'size' => $size, 'tmp_name' => $file_path, 'error' => 0));
         try {
             $this->response['files'][] = $this->save($file);
         } catch (Exception $e) {
             $this->response['files'][] = array('error' => $e->getMessage());
         }
     } else {
         $files = waRequest::file($this->name);
         foreach ($files as $file) {
             if ($file->error_code != UPLOAD_ERR_OK) {
                 $this->response['files'][] = array('error' => $file->error);
             } else {
                 try {
                     $this->response['files'][] = $this->save($file);
                 } catch (Exception $e) {
                     $this->response['files'][] = array('name' => $file->name, 'error' => $e->getMessage());
                 }
             }
         }
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:32,代码来源:shopUploadController.class.php

示例4: defaultAction

 public function defaultAction()
 {
     if (strpos(waRequest::server('HTTP_REFERER'), wa()->getRootUrl(true) . wa()->getConfig()->getBackendUrl() . '/logs') !== 0) {
         //on first app access, show latest updated files
         $this->redirect('?action=files&mode=updatetime');
     } else {
         //otherwise default view mode is root log directory
         $this->execute('directory');
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:10,代码来源:logsBackend.actions.php

示例5: execute

 public function execute()
 {
     if (wa()->getEnv() == 'frontend' && ($currency = waRequest::get("currency"))) {
         if ($this->getConfig()->getCurrencies(array($currency))) {
             wa()->getStorage()->set('shop/currency', $currency);
             wa()->getStorage()->remove('shop/cart');
         }
         $url = $this->getConfig()->getCurrentUrl();
         $url = preg_replace('/[\\?&]currency=' . $currency . '/i', '', $url);
         $this->redirect($url);
     }
     // save referer
     // @todo: save keywords for referers from search
     if (wa()->getEnv() == 'frontend' && ($ref = waRequest::server('HTTP_REFERER'))) {
         // check $ref domain
         $ref_parts = parse_url($ref);
         if ($ref_parts['host'] != waRequest::server('HTTP_HOST')) {
             wa()->getStorage()->set('shop/referer', waRequest::server('HTTP_REFERER'));
         }
     }
     $this->view->assign('action', waRequest::param('action', 'default'));
     $this->setThemeTemplate('index.html');
     /**
      * @event frontend_head
      * @return array[string]string $return[%plugin_id%] html output
      */
     $this->view->assign('frontend_head', wa()->event('frontend_head'));
     /**
      * @event frontend_header
      * @return array[string]string $return[%plugin_id%] html output
      */
     $this->view->assign('frontend_header', wa()->event('frontend_header'));
     if (!$this->view->getVars('frontend_nav')) {
         /**
          * @event frontend_nav
          * @return array[string]string $return[%plugin_id%] html output for navigation section
          */
         $this->view->assign('frontend_nav', wa()->event('frontend_nav'));
     }
     /**
      * @event frontend_footer
      * @return array[string]string $return[%plugin_id%] html output
      */
     $this->view->assign('frontend_footer', wa()->event('frontend_footer'));
     $this->view->assign('currencies', $this->getConfig()->getCurrencies());
     // set globals
     $params = waRequest::param();
     foreach ($params as $k => $v) {
         if (in_array($k, array('url', 'module', 'action', 'meta_keywords', 'meta_description', 'private', 'url_type', 'type_id', 'payment_id', 'shipping_id', 'currency', 'stock_id'))) {
             unset($params[$k]);
         }
     }
     $this->view->getHelper()->globals($params);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:54,代码来源:shopFrontend.layout.php

示例6: checkRights

 public function checkRights($module, $action)
 {
     if ($module == 'frontend' && waRequest::param('ssl') && (strpos($action, 'my') === 0 || $action === 'checkout')) {
         if (!waRequest::isHttps()) {
             $url = 'https://' . waRequest::server('HTTP_HOST') . wa()->getConfig()->getCurrentUrl();
             wa()->getResponse()->redirect($url, 301);
         }
     } elseif ($module == 'order' || $module == 'orders') {
         return wa()->getUser()->getRights('shop', 'orders');
     }
     return true;
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:12,代码来源:shopConfig.class.php

示例7: execute

 public function execute()
 {
     parent::execute();
     $return_url = waRequest::get('return_url', waRequest::server('HTTP_REFERER'));
     if ($return_hash = waRequest::get('return_hash')) {
         if ($return_hash = preg_replace('@^#@', '', $return_hash)) {
             $return_url .= '#' . $return_hash;
         }
     }
     $this->view->assign('top', !!preg_match('@^[^/]+$@', waRequest::get('slug')) && !waRequest::get('filter'));
     $this->view->assign('return_url', $return_url);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:12,代码来源:installerPluginsView.action.php

示例8: execute

 public function execute()
 {
     if (!$this->getRights('upload')) {
         throw new waRightsException(_w("You don't have sufficient access rights"));
     }
     $this->response['files'] = array();
     $this->model = new photosPhotoModel();
     $album_rights_model = new photosAlbumRightsModel();
     // rights for photos
     $this->status = waRequest::post('status', 0, 'int');
     $this->groups = waRequest::post('groups', array(), waRequest::TYPE_ARRAY_INT);
     if (!$this->groups) {
         $this->status = -1;
         // only author have access to this photo
         $this->groups = array(-$this->getUser()->getId());
     }
     // work with album
     $this->album_id = waRequest::post('album_id');
     $this->album_id = (int) $this->album_id;
     if ($this->album_id > 0 && !$album_rights_model->checkRights($this->album_id, true)) {
         $this->response['files'][] = array('error' => _w("You don't have sufficient access rights"));
         return;
     }
     $this->getStorage()->close();
     if (waRequest::server('HTTP_X_FILE_NAME')) {
         $name = waRequest::server('HTTP_X_FILE_NAME');
         $size = waRequest::server('HTTP_X_FILE_SIZE');
         $file_path = wa()->getTempPath('photos/upload/') . $name;
         $append_file = is_file($file_path) && $size > filesize($file_path);
         clearstatcache();
         file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0);
         $file = new waRequestFile(array('name' => $name, 'type' => waRequest::server('HTTP_X_FILE_TYPE'), 'size' => $size, 'tmp_name' => $file_path, 'error' => 0));
         try {
             $this->response['files'][] = $this->save($file);
         } catch (Exception $e) {
             $this->response['files'][] = array('error' => $e->getMessage());
         }
     } else {
         $files = waRequest::file('files');
         foreach ($files as $file) {
             if ($file->error_code != UPLOAD_ERR_OK) {
                 $this->response['files'][] = array('error' => $file->error);
             } else {
                 try {
                     $this->response['files'][] = $this->save($file);
                 } catch (Exception $e) {
                     $this->response['files'][] = array('name' => $file->name, 'error' => $e->getMessage());
                 }
             }
         }
     }
 }
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:52,代码来源:photosUploadPhoto.controller.php

示例9: saveReferer

 protected function saveReferer()
 {
     $referer = waRequest::server('HTTP_REFERER');
     $root_url = wa()->getRootUrl(true);
     if ($root_url != substr($referer, 0, strlen($root_url))) {
         $this->getStorage()->del('auth_referer');
         return;
     }
     $referer = substr($referer, strlen($this->getConfig()->getHostUrl()));
     if (!in_array($referer, array(wa()->getRouteUrl('/login'), wa()->getRouteUrl('/forgotpassword'), wa()->getRouteUrl('/signup')))) {
         $this->getStorage()->set('auth_referer', $referer);
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:13,代码来源:waLoginAction.class.php

示例10: execute

 public function execute()
 {
     $url = waRequest::param('url');
     $domain = waRequest::server('HTTP_HOST');
     $model = new waModel();
     //    $main_domain = $model->query("SELECT value FROM wa_app_settings WHERE app_id = 'webasyst' AND name = 'url'")->fetchField();
     $app_settings_model = new waAppSettingsModel();
     $main_domain = trim(str_replace(array('https', 'http', '://'), '', $app_settings_model->get('webasyst', 'url')), "/");
     $data = $model->query("\nSELECT\n  shop_deliveryshop_city_description.*\n, shop_deliveryshop_city.city\n, shop_deliveryshop_city.region\nFROM\n  shop_deliveryshop_city_description\nLEFT JOIN\n  shop_deliveryshop_city ON shop_deliveryshop_city_description.cityCode = shop_deliveryshop_city.cityCode\nLEFT JOIN\n  wa_region ON wa_region.code = shop_deliveryshop_city.region AND wa_region.country_iso3='rus'\nWHERE\n  (url = '{$url}' OR city = '{$url}')\nAND\n  domain IN ('{$domain}', '{$main_domain}')\nLIMIT 1\n  ")->fetchAssoc();
     // Уменьшаем стоимость доставки на сумму указанную в настройках плагина
     $delivery_compensation = $model->query("SELECT price FROM shop_deliveryshop_delivery WHERE domain = '" . $domain . "'")->fetchField();
     $delivery_compensation = intval($delivery_compensation);
     $delivery_price = intval($data['delivery_price']);
     $courier_price = intval($data['courier_price']);
     if ($delivery_price > $delivery_compensation) {
         $data['delivery_price'] = (int) (($delivery_price - $delivery_compensation) / 50) * 50;
         //Уменьшаем до ближайшего полтинника
     } else {
         $data['delivery_price'] = 0;
     }
     if ($courier_price > $delivery_compensation) {
         $data['courier_price'] = (int) (($courier_price - $delivery_compensation) / 50) * 50;
         //Уменьшаем до ближайшего полтинника
     } else {
         $data['courier_price'] = 0;
     }
     foreach (array('meta_title' => $main_domain, 'meta_description' => '', 'meta_keywords' => '', 'delivery_time' => '', 'courier_time' => '') as $key => $value) {
         $data[$key] = isset($data[$key]) ? $data[$key] : $value;
     }
     wa()->getResponse()->setTitle($data['meta_title']);
     wa()->getResponse()->setMeta('description', $data['meta_description']);
     wa()->getResponse()->setMeta('keywords', $data['meta_keywords']);
     $city_code = isset($data['cityCode']) ? $data['cityCode'] : 0;
     $pvz = $model->query("\nSELECT\n  shop_deliveryshop_pvz.*\nFROM\n  shop_deliveryshop_pvz\nWHERE\n  cityCode = {$city_code}\nAND\n  status = 'completed'\nAND\n  (domain IN ('{$domain}', '{$main_domain}') OR domain IS NULL)\n")->fetchAll();
     //$site_model = new siteDomainModel();
     //$domain_id = $site_model->getByName($domain);
     $domain_id = $model->query("SELECT id FROM site_domain WHERE name = '" . $domain . "'")->fetchField();
     $template_path = wa()->getDataPath('plugins/deliveryshop/templates/actions/frontend/FrontendDostavka' . $domain_id . '.html', false, 'shop', true);
     if (!file_exists($template_path)) {
         $template_path = wa()->getDataPath('plugins/deliveryshop/templates/actions/frontend/FrontendDostavka.html', false, 'shop', true);
     }
     if (!file_exists($template_path)) {
         $template_path = wa()->getAppPath('plugins/deliveryshop/templates/actions/frontend/FrontendDostavka.html', 'shop');
     }
     $this->view->assign('data', $data);
     $this->view->assign('pvz', $pvz);
     $this->view->assign('page', array('id' => null, 'name' => '', 'content' => $this->view->fetch($template_path)));
     $this->setThemeTemplate('page.html');
     waSystem::popActivePlugin();
 }
开发者ID:quadrodesign,项目名称:deliveryshop,代码行数:50,代码来源:shopDeliveryshopPluginFrontendDostavka.action.php

示例11: init

 private function init()
 {
     $url = parse_url($r = waRequest::server('HTTP_REFERER'), PHP_URL_QUERY);
     if (preg_match('/(^|&)module=(update|apps|plugins)($|&)/', $url, $matches)) {
         $this->module = $matches[2];
     }
     if (installerHelper::isDeveloper()) {
         if (waRequest::request('install')) {
             $msg = _w('Unable to install application (developer version is on)');
         } else {
             $msg = _w('Unable to install application (developer version is on)');
         }
         $this->redirect(array('module' => $this->module, 'msg' => installerMessage::getInstance()->raiseMessage($msg, 'fail')));
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:15,代码来源:installerUpdateManager.action.php

示例12: getFilesFromPost

 public static function getFilesFromPost()
 {
     if (waRequest::server('HTTP_X_FILE_NAME')) {
         $name = waRequest::server('HTTP_X_FILE_NAME');
         $size = waRequest::server('HTTP_X_FILE_SIZE');
         $safe_name = trim(preg_replace('~[^a-z\\.]~', '', waLocale::transliterate($name)), ". \n\t\r");
         $safe_name || ($safe_name = uniqid('p'));
         $file_path = wa()->getTempPath('photos/upload/') . $safe_name;
         $append_file = is_file($file_path) && $size > filesize($file_path);
         clearstatcache();
         file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0);
         $file = new waRequestFile(array('name' => $name, 'type' => waRequest::server('HTTP_X_FILE_TYPE'), 'size' => $size, 'tmp_name' => $file_path, 'error' => 0));
         return array($file);
     } else {
         return waRequest::file('files');
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:17,代码来源:photosUploadPhoto.controller.php

示例13: getCategory

 /**
  * @return mixed
  * @throws waException
  */
 protected function getCategory()
 {
     $category_model = $this->getModel();
     $url_field = waRequest::param('url_type') == 1 ? 'url' : 'full_url';
     if (waRequest::param('category_id')) {
         $category = $category_model->getById(waRequest::param('category_id'));
         if ($category) {
             $category_url = wa()->getRouteUrl('/frontend/category', array('category_url' => $category[$url_field]));
             if (urldecode(wa()->getConfig()->getRequestUrl(false, true)) !== $category_url) {
                 $q = waRequest::server('QUERY_STRING');
                 $this->redirect($category_url . ($q ? '?' . $q : ''), 301);
             }
         }
     } else {
         $category = $category_model->getByField($url_field, waRequest::param('category_url'));
         if ($category && $category[$url_field] !== urldecode(waRequest::param('category_url'))) {
             $q = waRequest::server('QUERY_STRING');
             $this->redirect(wa()->getRouteUrl('/frontend/category', array('category_url' => $category[$url_field])) . ($q ? '?' . $q : ''), 301);
         }
     }
     $route = wa()->getRouting()->getDomain(null, true) . '/' . wa()->getRouting()->getRoute('url');
     if ($category) {
         $category_routes_model = new shopCategoryRoutesModel();
         $routes = $category_routes_model->getRoutes($category['id']);
     }
     if (!$category || $routes && !in_array($route, $routes)) {
         throw new waException('Category not found', 404);
     }
     $category['subcategories'] = $category_model->getSubcategories($category, $route);
     $category_url = wa()->getRouteUrl('shop/frontend/category', array('category_url' => '%CATEGORY_URL%'));
     foreach ($category['subcategories'] as &$sc) {
         $sc['url'] = str_replace('%CATEGORY_URL%', waRequest::param('url_type') == 1 ? $sc['url'] : $sc['full_url'], $category_url);
     }
     unset($sc);
     // params
     $category_params_model = new shopCategoryParamsModel();
     $category['params'] = $category_params_model->get($category['id']);
     // smarty description
     if ($this->getConfig()->getOption('can_use_smarty') && $category['description']) {
         $category['description'] = wa()->getView()->fetch('string:' . $category['description']);
     }
     return $category;
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:47,代码来源:shopFrontendCategory.action.php

示例14: execute

 public function execute()
 {
     $this->response['files'] = array();
     $this->model = new photosPhotoModel();
     $data = array('contact_id' => wa()->getUser()->getId(), 'status' => 1, 'groups' => array(0), 'source' => 'publicgallery');
     $plugin = wa()->getPlugin('publicgallery');
     if ($plugin->getSettings('need_moderation')) {
         $data['moderation'] = 0;
     } else {
         $data['moderation'] = 1;
     }
     if ($data['moderation'] <= 0) {
         $data['status'] = 0;
     }
     $this->getStorage()->close();
     if (waRequest::server('HTTP_X_FILE_NAME')) {
         $name = waRequest::server('HTTP_X_FILE_NAME');
         $size = waRequest::server('HTTP_X_FILE_SIZE');
         $file_path = wa()->getTempPath('photos/upload/') . $name;
         $append_file = is_file($file_path) && $size > filesize($file_path);
         clearstatcache();
         file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0);
         $file = new waRequestFile(array('name' => $name, 'type' => waRequest::server('HTTP_X_FILE_TYPE'), 'size' => $size, 'tmp_name' => $file_path, 'error' => 0));
         try {
             $this->response['files'][] = $this->save($file, $data);
         } catch (Exception $e) {
             $this->response['files'][] = array('error' => $e->getMessage());
         }
     } else {
         $files = waRequest::file('files');
         foreach ($files as $file) {
             if ($file->error_code != UPLOAD_ERR_OK) {
                 $this->response['files'][] = array('error' => $file->error);
             } else {
                 try {
                     $this->response['files'][] = $this->save($file, $data);
                 } catch (Exception $e) {
                     $this->response['files'][] = array('name' => $file->name, 'error' => $e->getMessage());
                 }
             }
         }
     }
 }
开发者ID:Favorskij,项目名称:webasyst-framework,代码行数:43,代码来源:photosPublicgalleryPluginFrontendImageUpload.controller.php

示例15: afterAuth

 protected function afterAuth()
 {
     $referer = waRequest::server('HTTP_REFERER');
     $referer = substr($referer, strlen($this->getConfig()->getHostUrl()));
     $checkout_url = wa()->getRouteUrl('shop/frontend/checkout');
     if ($referer && !strncasecmp($referer, $checkout_url, strlen($checkout_url))) {
         $url = $referer;
     } elseif ($referer != wa()->getRouteUrl('/login')) {
         $url = $this->getStorage()->get('auth_referer');
     }
     if (empty($url)) {
         if (waRequest::param('secure')) {
             $url = $this->getConfig()->getCurrentUrl();
         } else {
             $url = wa()->getRouteUrl('shop/frontend/my');
         }
     }
     $this->getStorage()->del('auth_referer');
     $this->getStorage()->del('shop/cart');
     $this->redirect($url);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:21,代码来源:shopLogin.action.php


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