本文整理汇总了PHP中Tools::getRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::getRequest方法的具体用法?PHP Tools::getRequest怎么用?PHP Tools::getRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools
的用法示例。
在下文中一共展示了Tools::getRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postContact
public function postContact()
{
global $smarty, $cookie;
session_start();
if ($_SESSION['validate_code'] == strtolower(Tools::getRequest('validate_code'))) {
if ($cookie->isLogged()) {
$user = new User($cookie->id_user);
$_POST['name'] = $user->first_name . ' ' . $user->last_name;
$_POST['email'] = $user->email;
if (isset($_POST['id_user'])) {
unset($_POST['id_user']);
}
$_POST['id_user'] = $user->id;
}
$contact = new Contact();
$contact->copyFromPost();
if ($contact->add()) {
$vars = array('{name}' => $contact->name, '{subject}' => $contact->subject, '{email}' => $contact->email, '{message}' => $contact->content);
Mail::Send('contact', $contact->subject, $vars, Configuration::get('TM_SHOP_EMAIL'));
$this->_success = 'Your message has been successfully sent to our team.';
} else {
$this->_errors = $contact->_errors;
}
} else {
$this->_errors[] = 'Confirmation code is error!';
}
}
示例2: displayMain
public function displayMain()
{
global $smarty, $link, $cookie;
if ($cookie->logged) {
Tools::redirect($link->getPage('MyaccountView'));
}
if (Tools::isSubmit('loginSubmit')) {
if (Tools::getRequest('email') && Tools::getRequest('passwd')) {
$user = new User();
if ($user->getByEmail(Tools::getRequest('email'), Tools::getRequest('passwd'))) {
$user->logined();
if (Tools::G("step") == 2) {
Tools::redirect($link->getPage('CheckoutView'));
} else {
Tools::redirect($link->getPage('MyaccountView'));
}
} else {
$smarty->assign('errors', $user->_errors);
}
} else {
$smarty->assign('errors', 'invalid email password combination');
}
}
return $smarty->fetch('login.tpl');
}
示例3: updateProductMeta
public function updateProductMeta($post)
{
$pbrands = Tools::getRequest('id_brands');
$brand_where = '';
if (is_array($pbrands)) {
$brand_where = ' AND p.id_brand IN(' . implode(",", $pbrands) . ')';
}
$rows = Db::getInstance()->getAll("SELECT p.id_product,p.ean13,p.special_price,p.price,p.name,c.name AS category,cl.name AS color\n\t\t\t\tFROM " . DB_PREFIX . "product AS p\n\t\t\t\tLeft Join " . DB_PREFIX . "category AS c ON p.id_category_default = c.id_category\n\t\t\t\tLeft Join " . DB_PREFIX . "color AS cl ON p.id_color = cl.id_color\n\t\t\t\tWHERE p.id_category_default IN(" . implode(",", $post["categoryBox"]) . ")" . $brand_where);
foreach ($rows as $row) {
$title = mb_substr(self::replaceProduct($post["title"], $row), 0, 255);
$keyword = mb_substr(self::replaceProduct($post["keywords"], $row), 0, 255);
$description = mb_substr(self::replaceProduct($post["description"], $row), 0, 255);
$rewrite = preg_replace("/[^a-zA-Z0-9\\.]/", "-", self::replaceProduct($post["rewrite"], $row));
$rewrite = strtolower(preg_replace("/(\\-{2,})/", "-", $rewrite));
if (!empty($title)) {
Db::getInstance()->exec("UPDATE " . DB_PREFIX . "product SET meta_title='" . pSQL($title) . "' WHERE id_product=" . intval($row['id_product']));
}
if (!empty($keyword)) {
Db::getInstance()->exec("UPDATE " . DB_PREFIX . "product SET meta_keywords='" . pSQL($keyword) . "' WHERE id_product=" . intval($row['id_product']));
}
if (!empty($description)) {
Db::getInstance()->exec("UPDATE " . DB_PREFIX . "product SET meta_description='" . pSQL($description) . "' WHERE id_product=" . intval($row['id_product']));
}
if (!empty($rewrite)) {
Db::getInstance()->exec("UPDATE " . DB_PREFIX . "product SET rewrite='" . pSQL($rewrite) . "' WHERE id_product=" . intval($row['id_product']));
Db::getInstance()->exec('UPDATE `' . DB_PREFIX . 'rule` SET `rule_link`="' . pSQL($rewrite) . '" WHERE `entity`="Product" AND `id_entity` =' . intval($row['id_product']));
}
}
}
示例4: displayMain
public function displayMain()
{
global $smarty, $link, $cookie;
if (!$cookie->logged) {
Tools::redirect($link->getPage('LoginView'));
}
$user = new User((int) $cookie->id_user);
if (Tools::isSubmit('joinCommit')) {
if (User::checkPassword($user->id, Tools::encrypt($_POST['old_passwd']))) {
if (Tools::getRequest('confirmation') == Tools::getRequest('passwd')) {
if (!empty($_POST['passwd']) && Validate::isPasswd($_POST['passwd'])) {
$user->copyFromPost();
if ($user->update()) {
$cookie->passwd = $user->passwd;
$cookie->write();
$smarty->assign('success', 'Your personal information has been successfully updated.');
}
} else {
$user->_errors[] = 'Password is invalid.';
}
} else {
$user->_errors[] = 'Password and confirmation do not match.';
}
} else {
$user->_errors[] = 'Your password is incorrect.';
}
}
$smarty->assign(array('errors' => $user->_errors, 'DISPLAY_LEFT' => Module::hookBlock(array('myaccount')), 'user' => $user));
return $smarty->fetch('my-user.tpl');
}
示例5: getContent
/**
* 后台配置模块
* @return string
*/
public function getContent()
{
if (Tools::isSubmit('Submit_Cardpay_CheckOut')) {
if (empty($_POST['NEWORDER_MERCHANT_NO'])) {
$this->_postErrors[] = 'Merchant No is required.';
}
if (!isset($_POST['NEWORDER_MERCHANT_KEY'])) {
$this->_postErrors[] = 'Sign Key is required.';
}
if (!sizeof($this->_postErrors)) {
Configuration::updateValue('NEWORDER_MERCHANT_NO', strval($_POST['NEWORDER_MERCHANT_NO']));
Configuration::updateValue('NEWORDER_MERCHANT_KEY', strval($_POST['NEWORDER_MERCHANT_KEY']));
Configuration::updateValue('NEWORDER_MERCHANT_LANG', strval($_POST['NEWORDER_MERCHANT_LANG']));
$this->displayConf();
} else {
$this->displayErrors();
}
}
$conf = Configuration::getMultiple(array('NEWORDER_MERCHANT_NO', 'NEWORDER_MERCHANT_KEY', 'NEWORDER_MERCHANT_LANG'));
$lang = array_key_exists('NEWORDER_MERCHANT_LANG', $_POST) ? $_POST['NEWORDER_MERCHANT_LANG'] : (array_key_exists('NEWORDER_MERCHANT_LANG', $conf) ? $conf['NEWORDER_MERCHANT_LANG'] : '');
$html = '<h2>Create a new order</h2>
<form action="' . $_SERVER['REQUEST_URI'] . '" method="post">
<fieldset>
<legend><img src="../modules/payment/neworder/logo.png" />Settings</legend>
<p>First use the sandbox to test out the module then you can use the real mode if everything\'s fine. Don\'t forget to change your merchant key and id according to the mode!</p>
<label>Merchant No.</label>
<div class="margin-form">
<input type="text" name="NEWORDER_MERCHANT_NO" value="' . Tools::getRequest('NEWORDER_MERCHANT_NO', Configuration::get('NEWORDER_MERCHANT_NO')) . '" size="30" />
</div>
<label>Sign Key</label>
<div class="margin-form">
<input type="text" name="NEWORDER_MERCHANT_KEY" value="' . Tools::getRequest('NEWORDER_MERCHANT_KEY', Configuration::get('NEWORDER_MERCHANT_KEY')) . '" size="30"/>
</div>
<label>Language</label>
<div class="margin-form">
<input type="radio" name="NEWORDER_MERCHANT_LANG" value="en" ' . ($lang == "en" ? 'checked="checked"' : '') . '/>英国
<input type="radio" name="NEWORDER_MERCHANT_LANG" value="fr" ' . ($lang == "fr" ? 'checked="checked"' : '') . '/>法国
<input type="radio" name="NEWORDER_MERCHANT_LANG" value="de" ' . ($lang == "de" ? 'checked="checked"' : '') . '/>德国
<input type="radio" name="NEWORDER_MERCHANT_LANG" value="it" ' . ($lang == "it" ? 'checked="checked"' : '') . '/>意大利
<input type="radio" name="NEWORDER_MERCHANT_LANG" value="da" ' . ($lang == "da" ? 'checked="checked"' : '') . '/>丹麦
<input type="radio" name="NEWORDER_MERCHANT_LANG" value="es" ' . ($lang == "es" ? 'checked="checked"' : '') . '/>西班牙
<input type="radio" name="NEWORDER_MERCHANT_LANG" value="in" ' . ($lang == "in" ? 'checked="checked"' : '') . '/>印度尼西亚
<input type="radio" name="NEWORDER_MERCHANT_LANG" value="iw" ' . ($lang == "iw" ? 'checked="checked"' : '') . '/>希伯来
<input type="radio" name="NEWORDER_MERCHANT_LANG" value="ja" ' . ($lang == "ja" ? 'checked="checked"' : '') . '/>日本
<input type="radio" name="NEWORDER_MERCHANT_LANG" value="ms" ' . ($lang == "ms" ? 'checked="checked"' : '') . '/>马来西亚
<input type="radio" name="NEWORDER_MERCHANT_LANG" value="nl" ' . ($lang == "nl" ? 'checked="checked"' : '') . '/>荷兰
<input type="radio" name="NEWORDER_MERCHANT_LANG" value="nn" ' . ($lang == "nn" ? 'checked="checked"' : '') . '/>挪威
<input type="radio" name="NEWORDER_MERCHANT_LANG" value="pl" ' . ($lang == "pl" ? 'checked="checked"' : '') . '/>波兰
<input type="radio" name="NEWORDER_MERCHANT_LANG" value="ru" ' . ($lang == "ru" ? 'checked="checked"' : '') . '/>俄罗斯
<input type="radio" name="NEWORDER_MERCHANT_LANG" value="sv" ' . ($lang == "sv" ? 'checked="checked"' : '') . '/>瑞典
<input type="radio" name="NEWORDER_MERCHANT_LANG" value="tr" ' . ($lang == "tr" ? 'checked="checked"' : '') . '/>土耳其
</div>
<div class="margin-form"><input type="submit" name="Submit_Cardpay_CheckOut" class="button" value="Save And Update" /></div>
</fieldset>
</form>';
return $html;
}
示例6: displayMain
public function displayMain()
{
global $cookie, $smarty, $link;
if (!$cookie->logged) {
Tools::redirect($link->getPage('UserView'));
}
$payment = Module::hook((int) Tools::getRequest('id_module'));
$smarty->assign('HOOK_PAYMENT_RESULT', $payment->resultPayment());
return $smarty->fetch('payment_result.tpl');
}
示例7: displayMain
public function displayMain()
{
global $smarty, $link;
$errors = array();
$step = 1;
$isExp = false;
if (Tools::getRequest('reset') == 'passwd') {
$step = 2;
}
if ($step == 1 && Tools::isSubmit('ResetPassword')) {
$user = new User();
$user->getByEmail(Tools::getRequest('email'));
if (Validate::isLoadedObject($user)) {
$md5_key = md5(_COOKIE_KEY_ . $user->email . $user->passwd . $user->upd_date);
$subject = 'Reset your password in' . Configuration::get('TM_SHOP_DOMAIN');
$vars = array('{name}' => $user->first_name . ' ' . $user->last_name, '{subject}' => $subject, '{link}' => $link->getPage('PasswordView') . '?reset=passwd&id_user=' . $user->id . '&key=' . $md5_key);
if (Mail::Send('passwd', $subject, $vars, $user->email)) {
$step = 4;
} else {
$errors[] = 'Send mail fail! Pless try agen!';
}
} else {
$errors[] = 'The email don\'t exists!';
}
} elseif ($step == 2) {
$sign = Tools::getRequest('key');
$id_user = Tools::getRequest('id_user');
$user = new User($id_user);
if (Validate::isLoadedObject($user)) {
$md5_key = md5(_COOKIE_KEY_ . $user->email . $user->passwd . $user->upd_date);
if ($md5_key == $sign) {
if (Tools::isSubmit('confrimPassword')) {
$user->copyFromPost();
if (Validate::isPasswd(Tools::getRequest('passwd')) && $user->update()) {
$step = 3;
} else {
$errors[] = 'This passwd is incorrect';
}
}
} else {
$isExp = true;
$errors[] = 'This link has expired!';
}
} else {
$isExp = true;
$errors[] = 'The customer don\'t exists!';
}
}
$smarty->assign(array('step' => $step, 'isExp' => $isExp, 'errors' => $errors));
return $smarty->fetch('password.tpl');
}
示例8: displayMain
public function displayMain()
{
global $smarty, $link, $cookie;
if (!$cookie->logged) {
Tools::redirect($link->getPage('LoginView'));
}
$user = new User((int) $cookie->id_user);
if ($reference = Tools::getRequest('reference')) {
$order = Order::getByReference($reference);
$smarty->assign(array('products' => $order->cart->getProducts(), 'h_order' => $order));
}
$smarty->assign(array('orders' => $user->getOrders(), 'DISPLAY_LEFT' => Module::hookBlock(array('myaccount'))));
return $smarty->fetch('my-orders.tpl');
}
示例9: requestAction
public function requestAction()
{
global $smarty, $cookie, $cart, $link;
parent::requestAction();
if (!Validate::isLoadedObject($cart) && isset($cookie->id_cart)) {
$cart = new Cart((int) $cookie->id_cart);
}
if (Tools::isSubmit('addToCart')) {
if (!isset($cart) || !Validate::isLoadedObject($cart)) {
$cart = new Cart();
$cart->copyFromPost();
if ($cart->add()) {
$cookie->id_cart = $cart->id;
}
}
if (Tools::getRequest('id_product')) {
$id_product = Tools::getRequest('id_product');
}
if (Tools::getRequest('quantity')) {
$quantity = Tools::getRequest('quantity');
}
if (Tools::getRequest('id_attributes')) {
$attributes = Tools::getRequest('id_attributes');
}
$product = new Product(intval($id_product));
if (Validate::isLoadedObject($cart)) {
$cart->addProduct($id_product, $quantity, $product->price, $attributes);
}
Tools::redirect($link->getPage('CartView'));
}
if (isset($_GET['delete']) and intval($_GET['delete']) > 0) {
$cart->deleteProduct(intval($_GET['delete']));
Tools::redirect($link->getPage('CartView'));
}
if (Tools::isSubmit('cart_update')) {
$quantitys = Tools::getRequest('quantity');
if (count($quantitys) > 0) {
foreach ($quantitys as $key => $val) {
$cart->updateProduct($key, $val['quantity']);
}
}
Tools::redirect($link->getPage('CartView'));
}
if (isset($cart) && Validate::isLoadedObject($cart)) {
$this->cart_info = $cart->getCartInfo();
$this->cart_info["cart_msg"] = $cart->msg;
}
$smarty->assign(array('cart_products' => $this->cart_info['cart_products'], 'cart_quantity' => $this->cart_info['cart_quantity'], 'cart_msg' => $this->cart_info['cart_msg'], 'cart_discount' => $this->cart_info['cart_discount'], 'cart_shipping' => $this->cart_info['cart_shipping'], 'cart_total' => $this->cart_info['cart_total'], 'enjoy_free_shipping' => (double) Configuration::get('ENJOY_FREE_SHIPPING')));
}
示例10: displayMain
public function displayMain()
{
global $smarty, $cookie;
$query = Tools::getRequest('s');
$query = str_replace(array('%', '\'', '*', '"'), '', $query);
if ($query) {
$this->loadFilter();
$products = Product::getSreachProduct($query, $this->p, $this->n, $this->by, $this->way);
$this->pagination($products['total']);
if ($products) {
$smarty->assign(array('query' => $query, 'total' => $products['total'], 'products' => $products['entitys']));
}
}
return $smarty->fetch('search.tpl');
}
示例11: postComment
public function postComment()
{
global $smarty;
session_start();
if ($_SESSION['validate_code'] == strtolower(Tools::getRequest('validate_code'))) {
$comment = new CMSComment();
$comment->copyFromPost();
if ($comment->add()) {
$this->_success = '添加评论成功,请等待管理员审核哟!';
} else {
$this->_errors = $comment->_errors;
}
} else {
$this->_errors[] = '验证码错误!';
}
}
示例12: displayMain
public function displayMain()
{
global $smarty, $link, $cookie;
if (!$cookie->logged) {
Tools::redirect($link->getPage('LoginView'));
}
$user = new User((int) $cookie->id_user);
$errors = array();
$success = false;
//添加feedback
//1.添加创建对象
if (Tools::isSubmit('submit')) {
$feedback = new Feedback();
$feedback->copyFromPost();
if ($feedback->rating <= 0 && $feedback->rating > 5) {
$feedback->rating = 4;
}
$data = explode("-", base64_decode(Tools::getRequest("data")));
$feedback->id_product = (int) $data[0];
$feedback->unit_price = (double) $data[2];
$feedback->quantity = (int) $data[3];
$feedback->md5_key = md5(Tools::getRequest("data"));
$feedback->name = substr($user->first_name, 0, 1) . "***" . substr($user->last_name, -1, 1);
$feedback->id_user = $user->id;
if ($feedback->add()) {
$success = true;
} else {
$errors = $feedback->_errors;
}
}
//2.获取用户评论过的MD5KEY
$proids = Feedback::haveFeedbackWithUser($user->id);
//3.获取用户购买过的产品
$products = array();
if ($result = $user->getPaymentedProduct()) {
foreach ($result as &$row) {
if (!in_array($row['md5_key'], $proids)) {
$products[] = $row;
}
}
}
$smarty->assign(array('success' => $success, 'errors' => $errors, 'products' => $products, 'DISPLAY_LEFT' => Module::hookBlock(array('myaccount'))));
return $smarty->fetch('my-feedback.tpl');
}
示例13: displayMain
public function displayMain()
{
global $cookie, $link;
if (!isset($cookie->id_cart) || !$cookie->logged) {
Tools::redirect($link->getPage('UserView'));
}
if (!Tools::getRequest('id_module') || !Tools::getRequest('id_address')) {
Tools::redirect($link->getPage('CheckoutView'));
}
$cart = new Cart((int) $cookie->id_cart);
$cart->id_address = (int) Tools::getRequest('id_address');
$cart->id_carrier = (int) Tools::getRequest('id_carrier');
$cart->update();
$payment = Module::hook((int) Tools::getRequest('id_module'));
if (!$payment->active) {
Tools::redirect($link->getPage('CheckoutView'));
}
return $payment->execPayment($cart);
}
示例14: displayMain
public function displayMain()
{
global $smarty, $link;
$errors = array();
if (Tools::isSubmit('CreateUser')) {
if (!Validate::isEmail(Tools::getRequest('email')) || User::userExists(Tools::getRequest('email'))) {
$errors[] = 'The email is invalid or an account is already registered with this e-mail!';
} elseif (empty($_POST['passwd'])) {
$errors[] = 'The password is empty!';
} else {
$user = new User();
$user->copyFromPost();
$user->active = 1;
if ($user->add()) {
$address = new Address();
$address->copyFromPost();
$address->id_user = $user->id;
$address->is_default = 1;
if ($address->add()) {
$user->logined(array('id_address' => $address->id));
if (Tools::getRequest("step") == 2) {
Tools::redirect($link->getPage('CheckoutView'));
} else {
Tools::redirect($link->getPage('MyaccountView'));
}
return;
} else {
$errors = $address->_errors;
}
} else {
$errors = $user->_errors;
}
}
}
$countrys = Country::loadData(1, 500, null, null, array('active' => 1));
$smarty->assign(array('id_default_country' => Configuration::get('TM_DEFAULT_COUNTRY_ID'), 'countrys' => $countrys, 'step' => Tools::getRequest("step"), 'errors' => $errors));
return $smarty->fetch('join.tpl');
}
示例15: Color
<?php
if (intval(Tools::getRequest('delete')) > 0) {
$object = new Color(intval(Tools::getRequest('delete')));
if (Validate::isLoadedObject($object)) {
$object->delete();
}
if (is_array($object->_errors) and count($object->_errors) > 0) {
$errors = $object->_errors;
} else {
UIAdminAlerts::conf('颜色已删除');
}
} elseif (Tools::isSubmit('subDelete')) {
$select_cat = Tools::P('itemsBox');
$color = new Color();
if ($color->deleteSelection($select_cat)) {
UIAdminAlerts::conf('颜色已删除');
}
}
echo UIAdminDndTable::loadHead();
$table = new UIAdminDndTable('color', 'Color', 'id_color');
$table->addAttribte('id', 'color-table');
$table->header = array(array('sort' => false, 'isCheckAll' => 'itemsBox[]'), array('name' => 'id_color', 'title' => 'ID'), array('name' => 'name', 'title' => '名称'), array('name' => 'code', 'title' => '颜色', 'color' => true), array('name' => 'position', 'title' => '排序'), array('sort' => false, 'title' => '操作', 'class' => 'text-right', 'isAction' => array('edit', 'delete')));
$orderBy = isset($_GET['orderby']) ? Tools::G('orderby') : 'position';
$orderWay = isset($_GET['orderway']) ? Tools::G('orderway') : 'asc';
$result = Color::loadData($orderBy, $orderWay);
if (isset($errors)) {
UIAdminAlerts::MError($errors);
}
$breadcrumb = new UIAdminBreadcrumb();
$breadcrumb->home();