本文整理汇总了PHP中waRequest::post方法的典型用法代码示例。如果您正苦于以下问题:PHP waRequest::post方法的具体用法?PHP waRequest::post怎么用?PHP waRequest::post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waRequest
的用法示例。
在下文中一共展示了waRequest::post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$data = waRequest::post();
// check required params
$this->post('blog_id', true);
$this->post('title', true);
$blog_model = new blogBlogModel();
$blogs = $blog_model->getAvailable();
if (!isset($blogs[$data['blog_id']])) {
throw new waAPIException('invalid_param', 'Blog not found', 404);
}
$blog = $blogs[$data['blog_id']];
if ($blog['rights'] < blogRightConfig::RIGHT_READ_WRITE) {
throw new waAPIException('access_denied', 403);
}
$data = array_merge($data, array('blog_status' => $blog['status'], 'url' => '', 'text' => '', 'status' => blogPostModel::STATUS_PUBLISHED));
$post_model = new blogPostModel();
$options = array();
if (waRequest::post('transliterate', null)) {
$options['transliterate'] = true;
}
$messages = $post_model->validate($data, array('transliterate' => true));
if ($messages) {
throw new waAPIException('invalid_param', 'Validate messages: ' . implode("\n", $messages), 404);
}
$id = $post_model->updateItem(null, $data);
$_GET['id'] = $id;
$method = new blogPostGetInfoMethod();
$this->response = $method->getResponse(true);
}
示例2: execute
public function execute()
{
$query = trim(waRequest::post('q'), ' /');
$hash = '/search/' . $query;
$collection = new photosCollection($hash);
if ($query == 'rate>0') {
$collection->orderBy('p.rate DESC, p.id');
}
$this->template = 'templates/actions/photo/PhotoList.html';
$count = $this->getConfig()->getOption('photos_per_page');
$photos = $collection->getPhotos("*,thumb,thumb_crop,thumb_middle,thumb_big,tags,edit_rights", 0, $count);
$photos = photosCollection::extendPhotos($photos);
$frontend_link = $query == 'rate>0' ? photosCollection::getFrontendLink('favorites', false) : photosCollection::getFrontendLink($hash, false);
/**
* @event search_frontend_link
* @param string $query
* @return array of bool|string if false - default frontend_link isn't overridden, if string - override default frontend link
*/
$res = wa()->event('search_frontend_link', $query);
foreach ($res as $r) {
if (is_string($r)) {
$frontend_link = $r;
break;
}
}
$config = $this->getConfig();
$this->view->assign('sidebar_width', $config->getSidebarWidth());
$this->view->assign('big_size', $config->getSize('big'));
$this->view->assign('frontend_link', $frontend_link);
$this->view->assign('photos', $photos);
$this->view->assign('title', $query == 'rate>0' ? _w('Rated') : $collection->getTitle());
$this->view->assign('total_count', $collection->count());
$this->view->assign('sort_method', $query == 'rate>0' ? 'rate' : 'upload_datetime');
$this->view->assign('hash', $hash);
}
示例3: execute
public function execute()
{
try {
$app_settings_model = new waAppSettingsModel();
if (waRequest::post('cancel')) {
wa()->getStorage()->set('shop/discountcard', '');
} else {
if ($discountcard_number = waRequest::post('discountcard')) {
$model = new shopDiscountcardsPluginModel();
if ($app_settings_model->get(shopDiscountcardsPlugin::$plugin_id, 'binding_customer')) {
$contact_id = wa()->getUser()->getId();
$discountcard = $model->getByField(array('contact_id' => $contact_id, 'discountcard' => $discountcard_number));
if (empty($discountcard)) {
$discountcard = $model->getByField(array('contact_id' => 0, 'discountcard' => $discountcard_number));
}
} else {
$discountcard = $model->getByField('discountcard', $discountcard_number);
}
if ($discountcard) {
wa()->getStorage()->set('shop/discountcard', $discountcard['discountcard']);
} else {
throw new waException('Дисконтная карта не найдена');
}
} else {
throw new waException('Укажите номер дисконтной карты');
}
}
} catch (Exception $ex) {
$this->setError($ex->getMessage());
}
}
开发者ID:klxqz,项目名称:discountcards,代码行数:31,代码来源:shopDiscountcardsPluginFrontendDiscountcard.controller.php
示例4: execute
public function execute()
{
$id = $this->get('id', true);
$page_model = new sitePageModel();
$page = $page_model->getById($id);
if ($page) {
$data = waRequest::post();
$keys = array('name', 'title', 'content', 'status');
$update = array();
foreach ($keys as $k) {
if (isset($data[$k])) {
$update[$k] = $data[$k];
}
}
$r = true;
if ($update || !empty($data['params'])) {
if ($update) {
$r = $page_model->update($id, $update);
}
if (!empty($data['params'])) {
$page_model->setParams($id, $data['params']);
}
}
if ($r) {
$method = new sitePageGetInfoMethod();
$this->response = $method->getResponse(true);
} else {
throw new waAPIException('server_error', 500);
}
} else {
throw new waAPIException('invalid_param', 'Page not found', 404);
}
}
示例5: execute
public function execute()
{
try {
$discountcard = waRequest::post('discountcard', array());
$model = new shopDiscountcardsPluginModel();
if (!empty($discountcard['id'])) {
$model->updateById($discountcard['id'], $discountcard);
$discountcard = $model->getById($discountcard['id']);
} elseif (empty($discountcard['discountcard'])) {
throw new waException('Ошибка: Не указан номер дисконтной карты');
} else {
if ($model->getByField('discountcard', $discountcard['discountcard'])) {
throw new waException('Ошибка: Номер дисконтной карты не уникален');
}
$id = $model->insert($discountcard);
$discountcard = $model->getById($id);
}
if (!empty($discountcard['contact_id'])) {
$contact = new waContact($discountcard['contact_id']);
$discountcard['contact_name'] = $contact->get('name');
}
$discountcard['amount'] = shop_currency($discountcard['amount']);
$this->response = $discountcard;
} catch (Exception $ex) {
$this->setError($ex->getMessage());
}
}
开发者ID:klxqz,项目名称:discountcards,代码行数:27,代码来源:shopDiscountcardsPluginBackendSaveDiscountcard.controller.php
示例6: execute
public function execute()
{
$photo_id = $this->post('id', true);
if (!is_array($photo_id)) {
if (strpos($photo_id, ',') !== false) {
$photo_id = array_map('intval', explode(',', $photo_id));
} else {
$photo_id = array($photo_id);
}
}
$album_id = waRequest::post('album_id', '');
if (!$album_id) {
$album_id = array();
}
if (!is_array($album_id)) {
if (strpos($album_id, ',') !== false) {
$album_id = explode(',', $album_id);
} else {
$album_id = array($album_id);
}
}
$album_id = array_map('trim', $album_id);
$album_photos_model = new photosAlbumPhotosModel();
$photo_rights_model = new photosPhotoRightsModel();
$allowed_photo_id = $photo_rights_model->filterAllowedPhotoIds($photo_id, true);
if ($allowed_photo_id) {
$album_photos_model->deletePhotos($album_id, $allowed_photo_id);
$this->response = true;
} else {
throw new waAPIException('access_denied', 403);
}
}
示例7: getHash
public function getHash()
{
$order_ids = waRequest::post('order_id', null, waRequest::TYPE_ARRAY_INT);
if ($order_ids !== null) {
if ($order_ids) {
return 'id/' . implode(',', $order_ids);
} else {
return null;
}
}
$filter_params = waRequest::post('filter_params', null);
if ($filter_params === null) {
return null;
}
$hash = '';
if ($filter_params) {
if (count($filter_params) == 1) {
$k = key($filter_params);
$v = $filter_params[$k];
if (is_array($v)) {
$v = implode("||", $v);
}
if ($k == 'storefront') {
$k = 'params.' . $k;
if (substr($v, -1) == '*') {
$v = substr($v, 0, -1);
}
}
$hash = "search/{$k}={$v}";
}
}
return $hash;
}
示例8: execute
public function execute()
{
if (wa()->getAuth()->isAuth()) {
$this->redirect(wa()->getAppUrl());
}
// check auth config
$auth = wa()->getAuthConfig();
if (!isset($auth['auth']) || !$auth['auth']) {
throw new waException(_ws('Page not found'), 404);
}
// check auth app and url
$signup_url = wa()->getRouteUrl((isset($auth['app']) ? $auth['app'] : '') . '/signup');
if (wa()->getConfig()->getRequestUrl(false) != $signup_url) {
$this->redirect($signup_url);
}
$errors = array();
if (waRequest::method() == 'post') {
// try sign up
if ($contact = $this->signup(waRequest::post('data'), $errors)) {
// assign new contact to view
$this->view->assign('contact', $contact);
}
}
$this->view->assign('errors', $errors);
wa()->getResponse()->setTitle(_ws('Sign up'));
}
示例9: execute
public function execute()
{
$order_id = waRequest::post('order_id', null, waRequest::TYPE_INT);
if ($order_id) {
$order_model = new shopOrderModel();
$order = $order_model->getOrder($order_id);
$customer_model = new shopCustomerModel();
$customer = $customer_model->getById($order['contact_id']);
$customer_model->updateById($order['contact_id'], array('is_spamer' => 1));
$plugin = waSystem::getInstance()->getPlugin('orderantispam');
$action_id = $plugin->getSettings('action_id');
$workflow = new shopWorkflow();
$action = $workflow->getActionById($action_id);
$action->run($order_id);
// counters
$state_counters = $order_model->getStateCounters();
$pending_counters = (!empty($state_counters['new']) ? $state_counters['new'] : 0) + (!empty($state_counters['processing']) ? $state_counters['processing'] : 0) + (!empty($state_counters['paid']) ? $state_counters['paid'] : 0);
// update app coutner
wa('shop')->getConfig()->setCount($state_counters['new']);
$script = "<script>";
$script .= "\$.order_list.updateCounters(" . json_encode(array('state_counters' => $state_counters, 'common_counters' => array('pending_counters' => $pending_counters))) . ");";
$script .= "\$.order.reload();</script>";
$this->response['script'] = $script;
}
}
开发者ID:klxqz,项目名称:orderantispam,代码行数:25,代码来源:shopOrderantispamPluginBackendSpamerOrder.controller.php
示例10: getContactData
private function getContactData()
{
$contact_id = (int) $this->getUser()->getId();
$adapter = 'user';
if (!$contact_id) {
$adapter = waRequest::post('auth_provider', 'guest', waRequest::TYPE_STRING_TRIM);
if (!$adapter || $adapter == 'user') {
$adapter = 'guest';
}
}
if ($adapter == 'guest') {
$data['name'] = waRequest::post('name', '', waRequest::TYPE_STRING_TRIM);
$data['email'] = waRequest::post('email', '', waRequest::TYPE_STRING_TRIM);
$data['site'] = waRequest::post('site', '', waRequest::TYPE_STRING_TRIM);
$this->getStorage()->del('auth_user_data');
} else {
if ($adapter != 'user') {
$auth_adapters = wa()->getAuthAdapters();
if (!isset($auth_adapters[$adapter])) {
$this->errors[] = _w('Invalid auth provider');
} elseif ($user_data = $this->getStorage()->get('auth_user_data')) {
$data['name'] = $user_data['name'];
$data['email'] = '';
$data['site'] = $user_data['url'];
} else {
$this->errors[] = _w('Invalid auth provider data');
}
}
}
$data['auth_provider'] = $adapter;
$data['contact_id'] = $contact_id;
return $data;
}
示例11: execute
public function execute($params = null)
{
$result = array();
// from payment callback
if (is_array($params)) {
$order_id = $params['order_id'];
$result['text'] = $params['plugin'] . ' (' . $params['view_data'] . ' - ' . $params['amount'] . ' ' . $params['currency_id'] . ')';
$result['update']['params'] = array('payment_transaction_id' => $params['id']);
} else {
$order_id = $params;
$result['text'] = waRequest::post('text', '');
}
$order_model = new shopOrderModel();
$order = $order_model->getById($order_id);
$log_model = new waLogModel();
if (wa()->getEnv() == 'backend') {
$log_model->add('order_pay', $order_id);
} else {
$log_model->add('order_pay_callback', $order_id, $order['contact_id']);
}
if (!$order['paid_year']) {
shopAffiliate::applyBonus($order_id);
if (wa('shop')->getConfig()->getOption('order_paid_date') == 'create') {
$time = strtotime($order['create_datetime']);
} else {
$time = time();
}
$result['update'] = array('paid_year' => date('Y', $time), 'paid_quarter' => floor((date('n', $time) - 1) / 3) + 1, 'paid_month' => date('n', $time), 'paid_date' => date('Y-m-d', $time));
if (!$order_model->where("contact_id = ? AND paid_date IS NOT NULL", $order['contact_id'])->limit(1)->fetch()) {
$result['update']['is_first'] = 1;
}
}
return $result;
}
示例12: execute
public function execute()
{
$enabled = waRequest::post('enabled');
$app_id = waRequest::post('app_id');
$domain = siteHelper::getDomain();
$config = wa()->getConfig()->getAuth();
if (!isset($config[$domain])) {
if (!$enabled) {
return;
}
$config[$domain] = array();
}
if ($enabled && $app_id) {
$config[$domain]['auth'] = true;
$config[$domain]['app'] = $app_id;
} else {
if (isset($config[$domain]['auth'])) {
unset($config[$domain]['auth']);
}
if (isset($config[$domain]['app'])) {
unset($config[$domain]['app']);
}
}
if (!$this->getConfig()->setAuth($config)) {
$this->errors = sprintf(_w('File could not be saved due to the insufficient file write permissions for the "%s" folder.'), 'wa-config/');
}
}
示例13: execute
public function execute()
{
$this->plugin_id = 'category';
parent::execute();
if ($data = waRequest::post($this->plugin_id)) {
$order = 0;
$model = new blogCategoryModel();
foreach ($data as $id => &$row) {
$id = intval($id);
if (!empty($row['name'])) {
$row['sort'] = $order++;
if ($id > 0) {
if (!empty($row['delete'])) {
$model->deleteById($id);
} else {
$model->updateById($id, $row);
$row['id'] = $id;
}
} elseif ($id < 0) {
$row['id'] = $model->insert($row);
}
}
}
unset($row);
}
$categories = blogCategory::getAll();
$icons = $this->getConfig()->getIcons();
if (!$categories) {
$categories[0] = array('url' => '', 'name' => '', 'icon' => current($icons), 'id' => 0, 'qty' => 0, 'sort' => 0);
}
$this->view->assign('categories', $categories);
$this->view->assign('icons', $icons);
}
示例14: execute
public function execute()
{
$id = $this->get('id', true);
$post_model = new blogPostModel();
$post = $post_model->getById($id);
if (!$post) {
throw new waAPIException('invalid_param', 'Post not found', 404);
}
//check rights
if (blogHelper::checkRights($post['blog_id']) < blogRightConfig::RIGHT_FULL && $post['contact_id'] != wa()->getUser()->getId()) {
throw new waAPIException('access_denied', 403);
}
$data = array_merge($post, waRequest::post());
$blog_model = new blogBlogModel();
$blogs = $blog_model->getAvailable();
if (!isset($blogs[$data['blog_id']])) {
throw new waAPIException('invalid_param', 'Blog not found', 404);
}
$blog = $blogs[$data['blog_id']];
$data['blog_status'] = $blog['status'];
$data['datetime'] = $this->formateDatetime($data['datetime']);
$messages = $post_model->validate($data, array('transliterate' => true));
if ($messages) {
throw new waAPIException('invalid_param', 'Validate messages: ' . implode("\n", $messages), 404);
}
$post_model->updateItem($data['id'], $data);
$_GET['id'] = $id;
$method = new blogPostGetInfoMethod();
$this->response = $method->getResponse(true);
}
示例15: save
/**
* @param array $settings
*/
protected function save(&$settings)
{
$settings['sharpen'] = waRequest::post('sharpen') ? 1 : 0;
$settings['save_original'] = waRequest::post('save_original') ? 1 : 0;
$settings['thumbs_on_demand'] = waRequest::post('thumbs_on_demand') ? 1 : 0;
if ($settings['thumbs_on_demand']) {
$settings['max_size'] = waRequest::post('max_size', 1000, 'int');
$big_size = $this->getConfig()->getSize('big');
if ($settings['max_size'] < $big_size) {
$settings['max_size'] = $big_size;
}
} elseif (isset($settings['max_size'])) {
unset($settings['max_size']);
}
// delete sizes
if ($delete = waRequest::post('delete', array(), waRequest::TYPE_ARRAY_INT)) {
foreach ($delete as $k) {
if (isset($settings['sizes'][$k])) {
unset($settings['sizes'][$k]);
}
}
}
// sizes
if ($types = waRequest::post('size_type', array())) {
$sizes = waRequest::post('size', array());
$width = waRequest::post('width', array());
$height = waRequest::post('height', array());
foreach ($types as $k => $type) {
if ($type == 'rectangle') {
$w = $this->checkSize($width[$k], $settings);
$h = $this->checkSize($height[$k], $settings);
if ($w && $h) {
$settings['sizes'][] = $w . 'x' . $h;
}
} else {
$size = $this->checkSize($sizes[$k], $settings);
if (!$size) {
continue;
}
switch ($type) {
case 'crop':
$settings['sizes'][] = $size . 'x' . $size;
break;
case 'height':
$settings['sizes'][] = '0x' . $size;
break;
case 'width':
$settings['sizes'][] = $size . 'x0';
break;
case 'max':
$settings['sizes'][] = $size;
break;
}
}
}
}
$settings['sizes'] = array_values($settings['sizes']);
$config_file = $this->getConfig()->getConfigPath('config.php');
waUtils::varExportToFile($settings, $config_file);
}