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


PHP waRequest::request方法代码示例

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


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

示例1: execute

 public function execute()
 {
     if (!$this->getUser()->getRights('shop', 'settings')) {
         throw new waRightsException(_w('Access denied'));
     }
     $cm = new waCountryModel();
     $rm = new waRegionModel();
     $country = waRequest::request('country');
     $this->saveFromPost($rm, $cm, $country);
     $countries = $cm->all();
     if (!$country || empty($countries[$country])) {
         $country = wa()->getSetting('country');
     }
     if (!$country || empty($countries[$country])) {
         // Show the first country with regions by default
         $region_countries = $rm->getCountries();
         $country = reset($region_countries);
         if (!$country || empty($countries[$country])) {
             $country = key($countries);
         }
     }
     $regions = $country ? $rm->getByCountry($country) : array();
     $this->view->assign('countries', $cm->allWithFav($countries));
     $this->view->assign('country', ifset($countries[$country], $cm->getEmptyRow()));
     $this->view->assign('regions', $regions);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:26,代码来源:shopSettingsRegions.action.php

示例2: getTimeframeParams

 public static function getTimeframeParams()
 {
     $timeframe = waRequest::request('timeframe');
     if ($timeframe === 'all') {
         $start_date = null;
         $end_date = null;
     } else {
         if ($timeframe == 'custom') {
             $from = waRequest::request('from', 0, 'int');
             $start_date = $from ? date('Y-m-d', $from) : null;
             $to = waRequest::request('to', 0, 'int');
             $end_date = $to ? date('Y-m-d', $to) : null;
         } else {
             if (!wa_is_int($timeframe)) {
                 $timeframe = 30;
             }
             $start_date = date('Y-m-d', time() - $timeframe * 24 * 3600);
             $end_date = null;
         }
     }
     $group_by = waRequest::request('groupby', 'days');
     if ($group_by !== 'months') {
         $group_by = 'days';
     }
     return array($start_date, $end_date, $group_by);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:26,代码来源:shopReportsSales.action.php

示例3: dispatch

 public function dispatch()
 {
     if ($this->system->getEnv() == 'frontend') {
         $module = 'frontend';
     } else {
         $module = waRequest::get($this->options['module'], $this->system->getEnv());
     }
     $module = waRequest::param('module', $module);
     $action = waRequest::param('action', waRequest::get($this->options['action']));
     $plugin = waRequest::param('plugin', waRequest::get('plugin', ''));
     // event init
     if (!waRequest::request('background_process')) {
         if (method_exists($this->system->getConfig(), 'onInit')) {
             $this->system->getConfig()->onInit();
         }
     }
     if ($widget = waRequest::param('widget')) {
         $this->executeWidget($widget, $action);
     } elseif ($this->system->getEnv() == 'backend') {
         $url = explode("/", $this->system->getConfig()->getRequestUrl(true));
         if (isset($url[2]) && isset($url[3]) && $url[2] == 'widgets') {
             $this->executeWidget($url[3], $action);
         } else {
             $this->execute($plugin, $module, $action);
         }
     } else {
         $this->execute($plugin, $module, $action);
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:29,代码来源:waFrontController.class.php

示例4: execute

 public function execute()
 {
     $ids = waRequest::request('id', array(), 'array_int');
     if (!$ids) {
         throw new waException('Contact id not specified.');
     }
     // only allowed to global admin
     if (!wa()->getUser()->getRights('webasyst', 'backend')) {
         throw new waRightsException(_w('Access denied'));
     }
     $groups = waRequest::post('groups', array(), 'array_int');
     $counters = array();
     $ugm = new waUserGroupsModel();
     if ($this->getRequest()->request('set')) {
         foreach ($ids as $id) {
             $ugm->delete($id, array());
         }
     }
     foreach ($ids as $id) {
         if ($groups) {
             $ugm->add(array_map(wa_lambda('$gid', 'return array(' . $id . ', $gid);'), $groups));
         }
     }
     $gm = new waGroupModel();
     foreach ($groups as $gid) {
         $cnt = $ugm->countByField(array('group_id' => $gid));
         $gm->updateCount($gid, $cnt);
         $counters[$gid] = $cnt;
     }
     $this->response['counters'] = $counters;
     $this->response['message'] = _w("%d user has been added", "%d users have been added", count($ids));
     $this->response['message'] .= ' ';
     $this->response['message'] .= _w("to %d group", "to %d groups", count($groups));
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:34,代码来源:contactsGroupsContactSave.controller.php

示例5: execute

 public function execute()
 {
     $blog_id = wa()->getRequest()->param('blog_url_type');
     if ($blog_id <= 0) {
         $blog_id = waRequest::request('blog_id', 0, 'int');
     }
     $this->setLayout(new blogFrontendLayout());
     // Get contact id and name as post author
     if (wa()->getUser()->get('is_user')) {
         $post_contact_id = wa()->getUser()->getId();
         $post_contact_name = wa()->getUser()->getName();
     } else {
         foreach (blogHelper::getAuthors($blog_id) as $post_contact_id => $post_contact_name) {
             break;
         }
     }
     // Prepare empty fake post data
     $post_model = new blogPostModel();
     $post = $post_model->prepareView(array(array('id' => 0, 'blog_id' => $blog_id, 'contact_id' => $post_contact_id, 'contact_name' => $post_contact_name, 'datetime' => date('Y-m-d H:i:s'), 'title' => '%replace-with-real-post-title%', 'status' => 'published', 'text' => '<div class="replace-with-real-post-text"></div>' . $this->getScripts(), 'comments_allowed' => 0) + $post_model->getEmptyRow()));
     $post = array_merge($post[0], array('comments' => array(), 'comment_link' => '', 'link' => ''));
     $this->getResponse()->setTitle(_w('Preview'));
     $this->getResponse()->setMeta('keywords', '');
     $this->getResponse()->setMeta('description', '');
     $current_auth = wa()->getStorage()->read('auth_user_data');
     $current_auth_source = $current_auth ? $current_auth['source'] : null;
     $this->view->assign(array('realtime_preview' => true, 'frontend_post' => array(), 'errors' => array(), 'form' => array(), 'show_comments' => false, 'request_captcha' => false, 'require_authorization' => false, 'theme' => waRequest::param('theme', 'default'), 'current_auth_source' => $current_auth_source, 'current_auth' => $current_auth, true, 'auth_adapters' => wa()->getAuthAdapters(), 'post' => $post));
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:27,代码来源:blogFrontendPreviewTemplate.action.php

示例6: execute

 public function execute()
 {
     $config = $this->getConfig();
     /**
      * @var shopConfig $config
      */
     $product = new shopProduct(waRequest::get('id', 0, waRequest::TYPE_INT));
     $type_id = waRequest::request('type_id', null, waRequest::TYPE_INT);
     if ($type_id != null) {
         $product->type_id = $type_id;
     }
     $sku_type = waRequest::request('sku_type', null, waRequest::TYPE_INT);
     if ($sku_type != null) {
         $product->sku_type = $sku_type;
     }
     // Selectable features
     $features_selectable = $product->features_selectable;
     $counts = array();
     foreach ($features_selectable as $f) {
         if ($f['selected']) {
             $counts[] = $f['selected'];
         }
     }
     $this->view->assign('product', $product);
     $this->view->assign('features', $features_selectable);
     $this->view->assign('features_counts', $counts);
     $this->view->assign(array('use_product_currency' => wa()->getSetting('use_product_currency'), 'currencies' => $this->getCurrencies(), 'primary_currency' => $config->getCurrency()));
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:28,代码来源:shopProductFeaturesSelectable.action.php

示例7: dispatch

 public function dispatch()
 {
     $env = $this->system->getEnv();
     if ($env == 'frontend') {
         $module = 'frontend';
     } else {
         $module = waRequest::get($this->options['module'], $this->system->getEnv());
     }
     $module = waRequest::param('module', $module);
     $action = waRequest::param('action', waRequest::get($this->options['action']));
     $plugin = waRequest::param('plugin', $env == 'backend' ? waRequest::get('plugin', '') : '');
     // event init
     if (!waRequest::request('background_process')) {
         if (method_exists($this->system->getConfig(), 'onInit')) {
             $this->system->getConfig()->onInit();
         }
     }
     if ($this->system->getEnv() == 'backend') {
         if ($widget = waRequest::get('widget')) {
             $this->executeWidget($widget, $action);
         } else {
             $this->execute($plugin, $module, $action);
         }
     } else {
         $this->execute($plugin, $module, $action);
     }
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:27,代码来源:waFrontController.class.php

示例8: execute

 public function execute()
 {
     $order_id = waRequest::request('order_id', 0, 'int');
     $id = waRequest::request('id', 0, 'int');
     $to = waRequest::request('to');
     $nm = new shopNotificationModel();
     $n = $nm->getById($id);
     if (!$n) {
         $this->errors = sprintf_wp('%s entry not found', _w('Notification'));
         return;
     }
     $om = new shopOrderModel();
     $o = $om->getById($order_id);
     if (!$o) {
         $this->errors = _w('Order not found');
         return;
     }
     shopHelper::workupOrders($o, true);
     $opm = new shopOrderParamsModel();
     $o['params'] = $opm->get($order_id);
     try {
         $contact = $o['contact_id'] ? new shopCustomer($o['contact_id']) : wa()->getUser();
         $contact->getName();
     } catch (Exception $e) {
         $contact = new shopCustomer(wa()->getUser()->getId());
     }
     $cm = new shopCustomerModel();
     $customer = $cm->getById($contact->getId());
     if (!$customer) {
         $customer = $cm->getEmptyRow();
     }
     $workflow = new shopWorkflow();
     // send notifications
     shopNotifications::sendOne($id, array('order' => $o, 'customer' => $contact, 'status' => $workflow->getStateById($o['state_id'])->getName()), $to);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:35,代码来源:shopSettingsNotificationsTest.controller.php

示例9: init

 public function init()
 {
     parent::init();
     $this->storage = waSystem::getInstance()->getStorage();
     if (!isset(self::$options['session_timeout'])) {
         self::$options['session_timeout'] = 1800;
     }
     if (ini_get('session.gc_maxlifetime') < self::$options['session_timeout']) {
         ini_set('session.gc_maxlifetime', self::$options['session_timeout']);
     }
     $auth = waSystem::getInstance()->getAuth();
     $info = $auth->isAuth();
     if ($info && isset($info['id']) && $info['id']) {
         $this->auth = true;
         $this->id = $info['id'];
         // update last_datetime for contact
         if (!waRequest::request('background_process')) {
             $this->updateLastTime();
         }
         // check CSRF cookie
         if (!waRequest::cookie('_csrf')) {
             waSystem::getInstance()->getResponse()->setCookie('_csrf', uniqid('', true));
         }
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:25,代码来源:waAuthUser.class.php

示例10: getRates

 protected function getRates($shipping_id, $items, $address, $total)
 {
     $plugin = shopShipping::getPlugin(null, $shipping_id);
     $weight_unit = $plugin->allowedWeightUnit();
     $dimension = shopDimension::getInstance()->getDimension('weight');
     if ($weight_unit != $dimension['base_unit']) {
         foreach ($items as $item_id => $item) {
             if ($item['weight']) {
                 $items[$item_id]['weight'] = $item['weight'] / $dimension['units'][$weight_unit]['multiplier'];
             }
         }
     }
     $currency = $plugin->allowedCurrency();
     $currrent_currency = wa()->getConfig()->getCurrency(false);
     if ($currency != $currrent_currency) {
         $total = shop_currency($total, $currrent_currency, $currency, false);
     }
     $rates = $plugin->getRates($items, $address, array('total_price' => $total));
     if (is_array($rates)) {
         $is_html = waRequest::request('html');
         foreach ($rates as $r_id => &$r) {
             $r['id'] = $r_id;
             $r['rate_html'] = $is_html ? shop_currency_html($r['rate'], $r['currency']) : shop_currency($r['rate'], $r['currency']);
             $r['rate'] = shop_currency($r['rate'], $r['currency']);
         }
         unset($r);
         return array_values($rates);
     }
     return $rates;
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:30,代码来源:shopFrontendShipping.controller.php

示例11: setConfig

 public function setConfig($config = array(), $id = null)
 {
     $id = $this->getId($id);
     if ($id <= 0) {
         $name = wa()->getConfig()->getGeneralSettings('name');
         if (!$name) {
             $name = date('c');
         }
         $description = '';
         if (($raw = waRequest::request('profile')) && is_array($raw)) {
             if (!empty($raw['name'])) {
                 $name = $raw['name'];
             }
             if (!empty($raw['description'])) {
                 $description = $raw['description'];
             }
         }
         $id = $this->addConfig($name, $description);
     }
     $fields = array('id' => $id, 'plugin' => $this->plugin);
     $data = array('config' => json_encode($config));
     if (!empty($this->name)) {
         $data['name'] = $this->name;
     }
     $this->model->updateByField($fields, $data);
     return $id;
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:27,代码来源:shopImportexportHelper.class.php

示例12: execute

 public function execute()
 {
     $type = waRequest::request('type');
     if (!$type) {
         return;
     }
     $asm = new waAppSettingsModel();
     $asm->set('shop', 'discount_' . $type, waRequest::request('enable') ? 1 : null);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:9,代码来源:shopSettingsDiscountsEnable.controller.php

示例13: execute

 public function execute()
 {
     $code = waRequest::param('code');
     $encoded_order_id = waRequest::param('id');
     $order_id = shopHelper::decodeOrderId($encoded_order_id);
     if (!$order_id) {
         // fall back to non-encoded id
         $order_id = $encoded_order_id;
         $encoded_order_id = shopHelper::encodeOrderId($order_id);
     }
     if (!$order_id || $order_id != substr($code, 16, -16)) {
         throw new waException(_w('Order not found'), 404);
     }
     // When user is authorized, check if order belongs to him.
     // When it does, redirect to plain order page.
     if (wa()->getUser()->isAuth()) {
         $om = new shopOrderModel();
         $order = $om->getOrder($order_id);
         if (!$order) {
             throw new waException(_w('Order not found'), 404);
         }
         if ($order['contact_id'] == wa()->getUser()->getId()) {
             $this->redirect(wa()->getRouteUrl('/frontend/myOrder', array('id' => $order_id)));
         }
     }
     // Check auth code
     $opm = new shopOrderParamsModel();
     $params = $opm->get($order_id);
     if (ifset($params['auth_code']) !== $code || empty($params['auth_pin'])) {
         throw new waException(_w('Order not found'), 404);
     }
     // Check auth pin and show order page if pin is correct
     $pin = waRequest::request('pin', wa()->getStorage()->get('shop/pin/' . $order_id));
     if ($pin && $pin == $params['auth_pin']) {
         wa()->getStorage()->set('shop/pin/' . $order_id, $pin);
         parent::execute();
         if (!waRequest::isXMLHttpRequest()) {
             $this->layout->assign('breadcrumbs', self::getBreadcrumbs());
         }
         return;
     }
     //
     // No pin or pin is incorrect: show form to enter pin
     //
     $this->view->assign('wrong_pin', !!$pin);
     $this->view->assign('pin_required', true);
     $this->view->assign('encoded_order_id', $encoded_order_id);
     $this->view->assign('my_nav_selected', 'orders');
     // Set up layout and template from theme
     $this->setThemeTemplate('my.order.html');
     if (!waRequest::isXMLHttpRequest()) {
         $this->setLayout(new shopFrontendLayout());
         $this->getResponse()->setTitle(_w('Order') . ' ' . $encoded_order_id);
         $this->view->assign('breadcrumbs', self::getBreadcrumbs());
         $this->layout->assign('nofollow', true);
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:57,代码来源:shopFrontendMyOrderByCode.action.php

示例14: execute

 public function execute()
 {
     $action = waRequest::get('action_to_log', '', waRequest::TYPE_STRING_TRIM);
     $this->log($action, 1);
     if ($action == 'photos_upload') {
         $count = waRequest::request('count', 0, 'int');
         $this->response = _w('Uploaded %d photo', 'Uploaded %d photos', $count);
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:9,代码来源:photosBackendLog.controller.php

示例15: execute

 public function execute()
 {
     if ($this->thread_id = waRequest::get('thread_id', false)) {
         $cache = new waSerializeCache($this->getApp() . '.' . $this->thread_id);
         $this->urls = $cache->get();
         $cache->delete();
     }
     if ($this->urls) {
         wa()->getStorage()->close();
         ob_start();
         try {
             $this->model = new waAppSettingsModel();
             $log_level = waSystemConfig::isDebug() ? waInstaller::LOG_DEBUG : waInstaller::LOG_WARNING;
             $updater = new waInstaller($log_level, $this->thread_id);
             $this->getStorage()->close();
             $updater->init();
             $this->model->ping();
             $storage = wa()->getStorage();
             $storage->close();
             $this->urls = $updater->update($this->urls);
             if (waRequest::request('install')) {
                 $this->install();
             }
             $this->response['sources'] = $this->getResult();
             $this->response['current_state'] = $updater->getState();
             $this->response['state'] = $updater->getFullState(waRequest::get('mode', 'apps'));
             //cleanup cache
             $this->cleanup();
             //update themes
             foreach ($this->urls as $url) {
                 if (preg_match('@(wa-apps/)?(.+)/themes/(.+)@', $url['slug'], $matches)) {
                     try {
                         $theme = new waTheme($matches[3], $matches[2]);
                         $theme->update();
                     } catch (Exception $ex) {
                         waLog::log(sprintf('Error during theme %s@%s update: %s', $matches[3], $matches[2], $ex->getMessage()));
                     }
                 }
             }
             //and again cleanup
             $this->cleanup();
             $this->getConfig()->setCount(false);
             $response = $this->getResponse();
             $response->addHeader('Content-Type', 'application/json; charset=utf-8');
             $response->sendHeaders();
         } catch (Exception $ex) {
             $this->setError($ex->getMessage());
         }
         if ($ob = ob_get_clean()) {
             $this->response['warning'] = $ob;
             waLog::log('Output at ' . __METHOD__ . ': ' . $ob);
         }
     } else {
         throw new Exception('nothing to update');
     }
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:56,代码来源:installerUpdateExecute.controller.php


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