本文整理汇总了PHP中Validate::isMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Validate::isMessage方法的具体用法?PHP Validate::isMessage怎么用?PHP Validate::isMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validate
的用法示例。
在下文中一共展示了Validate::isMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logHttpReferer
public static function logHttpReferer()
{
global $cookie;
if (!isset($cookie->id_connections) or !Validate::isUnsignedId($cookie->id_connections)) {
return false;
}
if (!isset($_SERVER['HTTP_REFERER']) and !Configuration::get('TRACKING_DIRECT_TRAFFIC')) {
return false;
}
$source = new ConnectionsSource();
if (isset($_SERVER['HTTP_REFERER']) and Validate::isAbsoluteUrl($_SERVER['HTTP_REFERER'])) {
if (preg_replace('/^www./', '', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST)) == preg_replace('/^www./', '', Tools::getHttpHost(false, false)) and !strncmp(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_PATH), parse_url('http://' . Tools::getHttpHost(false, false) . __PS_BASE_URI__, PHP_URL_PATH), strlen(__PS_BASE_URI__))) {
return false;
}
if (Validate::isAbsoluteUrl(strval($_SERVER['HTTP_REFERER']))) {
$source->http_referer = strval($_SERVER['HTTP_REFERER']);
$source->keywords = trim(SearchEngine::getKeywords(strval($_SERVER['HTTP_REFERER'])));
if (!Validate::isMessage($source->keywords)) {
return false;
}
}
}
$source->id_connections = intval($cookie->id_connections);
$source->request_uri = Tools::getHttpHost(false, false);
if (isset($_SERVER['REDIRECT_URL'])) {
$source->request_uri .= strval($_SERVER['REDIRECT_URL']);
} elseif (isset($_SERVER['REQUEST_URI'])) {
$source->request_uri .= strval($_SERVER['REQUEST_URI']);
}
if (!Validate::isUrl($source->request_uri)) {
unset($source->request_uri);
}
return $source->add();
}
示例2: processOrderStep
function processOrderStep($params)
{
global $cart, $smarty, $errors;
if (!isset($_POST['id_address_delivery']) or !Address::isCountryActiveById(intval($_POST['id_address_delivery']))) {
$errors[] = 'this address is not in a valid area';
} else {
$cart->id_address_delivery = intval($_POST['id_address_delivery']);
$cart->id_address_invoice = isset($_POST['same']) ? intval($_POST['id_address_delivery']) : intval($_POST['id_address_invoice']);
if (!$cart->update()) {
$errors[] = Tools::displayError('an error occured while updating your cart');
}
Module::hookExec('orderAddressVerification', array());
if (isset($_POST['message']) and !empty($_POST['message'])) {
if (!Validate::isMessage($_POST['message'])) {
$errors[] = Tools::displayError('invalid message');
} elseif ($oldMessage = Message::getMessageByCartId(intval($cart->id))) {
$message = new Message(intval($oldMessage['id_message']));
$message->message = htmlentities($_POST['message'], ENT_COMPAT, 'UTF-8');
$message->update();
} else {
$message = new Message();
$message->message = htmlentities($_POST['message'], ENT_COMPAT, 'UTF-8');
$message->id_cart = intval($cart->id);
$message->id_customer = intval($cart->id_customer);
$message->add();
}
}
}
}
示例3: postProcess
/**
* Start forms process
* @see FrontController::postProcess()
*/
public function postProcess()
{
if (Tools::isSubmit('submitMessage')) {
$idOrder = (int) Tools::getValue('id_order');
$msgText = Tools::getValue('msgText');
if (!$idOrder || !Validate::isUnsignedId($idOrder)) {
$this->errors[] = Tools::displayError('The order is no longer valid.');
} elseif (empty($msgText)) {
$this->errors[] = Tools::displayError('The message cannot be blank.');
} elseif (!Validate::isMessage($msgText)) {
$this->errors[] = Tools::displayError('This message is invalid (HTML is not allowed).');
}
if (!count($this->errors)) {
$order = new Order($idOrder);
if (Validate::isLoadedObject($order) && $order->id_customer == $this->context->customer->id) {
//check if a thread already exist
$id_customer_thread = CustomerThread::getIdCustomerThreadByEmailAndIdOrder($this->context->customer->email, $order->id);
$cm = new CustomerMessage();
if (!$id_customer_thread) {
$ct = new CustomerThread();
$ct->id_contact = 0;
$ct->id_customer = (int) $order->id_customer;
$ct->id_shop = (int) $this->context->shop->id;
if (($id_product = (int) Tools::getValue('id_product')) && $order->orderContainProduct((int) $id_product)) {
$ct->id_product = $id_product;
}
$ct->id_order = (int) $order->id;
$ct->id_lang = (int) $this->context->language->id;
$ct->email = $this->context->customer->email;
$ct->status = 'open';
$ct->token = Tools::passwdGen(12);
$ct->add();
} else {
$ct = new CustomerThread((int) $id_customer_thread);
}
$cm->id_customer_thread = $ct->id;
$cm->message = $msgText;
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
$cm->add();
if (!Configuration::get('PS_MAIL_EMAIL_MESSAGE')) {
$to = strval(Configuration::get('PS_SHOP_EMAIL'));
} else {
$to = new Contact((int) Configuration::get('PS_MAIL_EMAIL_MESSAGE'));
$to = strval($to->email);
}
$toName = strval(Configuration::get('PS_SHOP_NAME'));
$customer = $this->context->customer;
if (Validate::isLoadedObject($customer)) {
Mail::Send($this->context->language->id, 'order_customer_comment', Mail::l('Message from a customer'), array('{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{email}' => $customer->email, '{id_order}' => (int) $order->id, '{order_name}' => $order->getUniqReference(), '{message}' => Tools::nl2br($msgText)), $to, $toName, $customer->email, $customer->firstname . ' ' . $customer->lastname);
}
if (Tools::getValue('ajax') != 'true') {
Tools::redirect('index.php?controller=order-detail&id_order=' . (int) $idOrder);
}
$this->context->smarty->assign('message_confirmation', true);
} else {
$this->errors[] = Tools::displayError('Order not found');
}
}
}
}
示例4: processOrderStep
function processOrderStep($params)
{
global $cart, $smarty, $errors, $isVirtualCart, $orderTotal;
$cart->recyclable = (isset($_POST['recyclable']) and !empty($_POST['recyclable'])) ? 1 : 0;
if (isset($_POST['gift']) and !empty($_POST['gift'])) {
if (!Validate::isMessage($_POST['gift_message'])) {
$errors[] = Tools::displayError('invalid gift message');
} else {
$cart->gift = 1;
$cart->gift_message = strip_tags($_POST['gift_message']);
}
} else {
$cart->gift = 0;
}
$address = new Address(intval($cart->id_address_delivery));
if (!Validate::isLoadedObject($address)) {
die(Tools::displayError());
}
if (!($id_zone = Address::getZoneById($address->id))) {
$errors[] = Tools::displayError('no zone match with your address');
}
if (isset($_POST['id_carrier']) and Validate::isInt($_POST['id_carrier']) and sizeof(Carrier::checkCarrierZone(intval($_POST['id_carrier']), intval($id_zone)))) {
$cart->id_carrier = intval($_POST['id_carrier']);
} elseif (!$isVirtualCart) {
$errors[] = Tools::displayError('invalid carrier or no carrier selected');
}
Module::hookExec('extraCarrierDetailsProcess', array('carrier' => new Carrier($cart->id_carrier)));
$cart->update();
}
示例5: textRecord
function textRecord(Product $product, Cart $cart)
{
global $errors;
if (!($fieldIds = $product->getCustomizationFieldIds())) {
return false;
}
$authorizedTextFields = array();
foreach ($fieldIds as $fieldId) {
if ($fieldId['type'] == _CUSTOMIZE_TEXTFIELD_) {
$authorizedTextFields[intval($fieldId['id_customization_field'])] = 'textField' . intval($fieldId['id_customization_field']);
}
}
$indexes = array_flip($authorizedTextFields);
foreach ($_POST as $fieldName => $value) {
if (in_array($fieldName, $authorizedTextFields) and !empty($value)) {
if (!Validate::isMessage($value)) {
$errors[] = Tools::displayError('Invalid message');
} else {
$cart->addTextFieldToProduct(intval($product->id), $indexes[$fieldName], $value);
}
} elseif (in_array($fieldName, $authorizedTextFields) and empty($value)) {
$cart->deleteTextFieldFromProduct(intval($product->id), $indexes[$fieldName]);
}
}
}
示例6: getKeywords
public static function getKeywords($url)
{
$parsed_url = @parse_url($url);
if (!isset($parsed_url['host']) || !isset($parsed_url['query'])) {
return false;
}
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT `server`, `getvar` FROM `' . _DB_PREFIX_ . 'search_engine`');
foreach ($result as $row) {
$host =& $row['server'];
$varname =& $row['getvar'];
if (strstr($parsed_url['host'], $host)) {
$array = array();
preg_match('/[^a-z]' . $varname . '=.+\\&/U', $parsed_url['query'], $array);
if (empty($array[0])) {
preg_match('/[^a-z]' . $varname . '=.+$/', $parsed_url['query'], $array);
}
if (empty($array[0])) {
return false;
}
$str = urldecode(str_replace('+', ' ', ltrim(substr(rtrim($array[0], '&'), strlen($varname) + 1), '=')));
if (!Validate::isMessage($str)) {
return false;
}
return $str;
}
}
}
示例7: update
/**
* Update criterion
*
* @return boolean succeed
*/
public static function update($id_product_comment_criterion, $id_lang, $name)
{
if (!Validate::isUnsignedId($id_product_comment_criterion) || !Validate::isUnsignedId($id_lang) || !Validate::isMessage($name)) {
die(Tools::displayError());
}
return Db::getInstance()->Execute('
UPDATE `' . _DB_PREFIX_ . 'product_comment_criterion` SET
`name` = \'' . pSQL($name) . '\'
WHERE `id_product_comment_criterion` = ' . intval($id_product_comment_criterion) . ' AND
`id_lang` = ' . intval($id_lang));
}
示例8: logHttpReferer
public static function logHttpReferer(Cookie $cookie = null)
{
if (!$cookie) {
$cookie = Context::getContext()->cookie;
}
if (!isset($cookie->id_connections) || !Validate::isUnsignedId($cookie->id_connections)) {
return false;
}
if (!isset($_SERVER['HTTP_REFERER']) && !Configuration::get('TRACKING_DIRECT_TRAFFIC')) {
return false;
}
$source = new ConnectionsSource();
if (isset($_SERVER['HTTP_REFERER']) && Validate::isAbsoluteUrl($_SERVER['HTTP_REFERER'])) {
$parsed = parse_url($_SERVER['HTTP_REFERER']);
$parsed_host = parse_url(Tools::getProtocol() . Tools::getHttpHost(false, false) . __PS_BASE_URI__);
if (preg_replace('/^www./', '', $parsed['host']) == preg_replace('/^www./', '', Tools::getHttpHost(false, false)) && !strncmp($parsed['path'], $parsed_host['path'], strlen(__PS_BASE_URI__))) {
return false;
}
if (Validate::isAbsoluteUrl(strval($_SERVER['HTTP_REFERER']))) {
$source->http_referer = substr(strval($_SERVER['HTTP_REFERER']), 0, ConnectionsSource::$uri_max_size);
$source->keywords = trim(SearchEngine::getKeywords(strval($_SERVER['HTTP_REFERER'])));
if (!Validate::isMessage($source->keywords)) {
return false;
}
}
}
$source->id_connections = (int) $cookie->id_connections;
$source->request_uri = Tools::getHttpHost(false, false);
if (isset($_SERVER['REDIRECT_URL'])) {
$source->request_uri .= strval($_SERVER['REDIRECT_URL']);
} elseif (isset($_SERVER['REQUEST_URI'])) {
$source->request_uri .= strval($_SERVER['REQUEST_URI']);
}
if (!Validate::isUrl($source->request_uri)) {
$source->request_uri = '';
}
$source->request_uri = substr($source->request_uri, 0, ConnectionsSource::$uri_max_size);
return $source->add();
}
示例9: _processCarrier
protected function _processCarrier()
{
self::$cart->recyclable = (int) Tools::getValue('recyclable');
self::$cart->gift = (int) Tools::getValue('gift');
if ((int) Tools::getValue('gift')) {
if (!Validate::isMessage($_POST['gift_message'])) {
$this->errors[] = Tools::displayError('Invalid gift message');
} else {
self::$cart->gift_message = strip_tags($_POST['gift_message']);
}
}
if (isset(self::$cookie->id_customer) and self::$cookie->id_customer) {
$address = new Address((int) self::$cart->id_address_delivery);
if (!($id_zone = Address::getZoneById($address->id))) {
$this->errors[] = Tools::displayError('No zone match with your address');
}
} else {
$id_zone = Country::getIdZone((int) Configuration::get('PS_COUNTRY_DEFAULT'));
}
if (Validate::isInt(Tools::getValue('id_carrier')) and sizeof(Carrier::checkCarrierZone((int) Tools::getValue('id_carrier'), (int) $id_zone))) {
self::$cart->id_carrier = (int) Tools::getValue('id_carrier');
} elseif (!self::$cart->isVirtualCart() and (int) Tools::getValue('id_carrier') != 0) {
$this->errors[] = Tools::displayError('Invalid carrier or no carrier selected');
}
Module::hookExec('processCarrier', array('cart' => self::$cart));
return self::$cart->update();
}
示例10: utf8_encode
$return[strtoupper($key)] = utf8_encode(urldecode(stripslashes($val)));
}
}
if (isset($return['SIGNATURE']) and isset($return['CENAME']) and isset($return['DYPREPARATIONTIME']) and isset($return['DYFORWARDINGCHARGES']) and isset($return['TRCLIENTNUMBER']) and isset($return['ORDERID']) and isset($return['TRCLIENTNUMBER'])) {
if (!isset($return['ERRORCODE']) or $return['ERRORCODE'] == NULL or in_array($return['ERRORCODE'], $nonBlockingError)) {
if ($return['SIGNATURE'] === socolissimo::make_key($return['CENAME'], (double) $return['DYPREPARATIONTIME'], $return['DYFORWARDINGCHARGES'], $return['TRCLIENTNUMBER'], $return['ORDERID'])) {
global $cookie;
if (isset($cookie) or is_object($cookie)) {
if (saveOrderShippingDetails((int) $cookie->id_cart, (int) $return['TRCLIENTNUMBER'], $return)) {
global $cookie;
$cart = new Cart((int) $cookie->id_cart);
$TRPARAMPLUS = explode('|', Tools::getValue('TRPARAMPLUS'));
$cart->id_carrier = $TRPARAMPLUS[0];
$cart->gift = (int) $TRPARAMPLUS[1];
if ((int) $cart->gift) {
if (Validate::isMessage($TRPARAMPLUS[2])) {
$cart->gift_message = strip_tags($TRPARAMPLUS[2]);
}
}
if (!$cart->update()) {
Tools::redirect();
} else {
Tools::redirect('order.php?step=3&cgv=1');
}
} else {
echo '<div class="alert error"><img src="' . _PS_IMG_ . 'admin/forbbiden.gif" alt="nok" /> ' . $so->displaySoError('999') . '
<p><br/><a href="' . Tools::getProtocol(true) . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'order.php" class="button_small" title="Retour">« Retour</a></p></div>';
}
} else {
echo '<div class="alert error"><img src="' . _PS_IMG_ . 'admin/forbbiden.gif" alt="nok" /> ' . $so->displaySoError('999') . '
<p><br/><a href="' . Tools::getProtocol(true) . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'order.php" class="button_small" title="Retour">« Retour</a></p></div>';
示例11: _processCarrier
protected function _processCarrier()
{
$this->context->cart->recyclable = (int) Tools::getValue('recyclable');
$this->context->cart->gift = (int) Tools::getValue('gift');
if ((int) Tools::getValue('gift')) {
if (!Validate::isMessage($_POST['gift_message'])) {
$this->errors[] = Tools::displayError('Invalid gift message.');
} else {
$this->context->cart->gift_message = strip_tags($_POST['gift_message']);
}
}
if (isset($this->context->customer->id) && $this->context->customer->id) {
$address = new Address((int) $this->context->cart->id_address_delivery);
if (!($id_zone = Address::getZoneById($address->id))) {
$this->errors[] = Tools::displayError('No zone matches your address.');
}
} else {
$id_zone = Country::getIdZone((int) Configuration::get('PS_COUNTRY_DEFAULT'));
}
if (Tools::getIsset('delivery_option')) {
if ($this->validateDeliveryOption(Tools::getValue('delivery_option'))) {
$this->context->cart->setDeliveryOption(Tools::getValue('delivery_option'));
}
} elseif (Tools::getIsset('id_carrier')) {
// For retrocompatibility reason, try to transform carrier to an delivery option list
$delivery_option_list = $this->context->cart->getDeliveryOptionList();
if (count($delivery_option_list) == 1) {
$delivery_option = reset($delivery_option_list);
$key = Cart::desintifier(Tools::getValue('id_carrier'));
foreach ($delivery_option_list as $id_address => $options) {
if (isset($options[$key])) {
$this->context->cart->id_carrier = (int) Tools::getValue('id_carrier');
$this->context->cart->setDeliveryOption(array($id_address => $key));
if (isset($this->context->cookie->id_country)) {
unset($this->context->cookie->id_country);
}
if (isset($this->context->cookie->id_state)) {
unset($this->context->cookie->id_state);
}
}
}
}
}
Hook::exec('actionCarrierProcess', array('cart' => $this->context->cart));
if (!$this->context->cart->update()) {
return false;
}
// Carrier has changed, so we check if the cart rules still apply
CartRule::autoRemoveFromCart($this->context);
CartRule::autoAddToCart($this->context);
return true;
}
示例12: postProcess
public function postProcess()
{
${${"GLOBALS"}["thtbvco"]} = new Order((int) Tools::getValue("id_order"));
$difdqhzqxl = "id_order_seller";
if (!Validate::isLoadedObject(${${"GLOBALS"}["thtbvco"]})) {
$this->errors[] = Tools::displayError("Order not found or you do not have permission to view this order.");
return;
}
${"GLOBALS"}["fqitvbmdfl"] = "order";
${${"GLOBALS"}["gfrblyem"]} = AgileSellerManager::getObjectOwnerID("order", $order->id);
${"GLOBALS"}["bsmpehdujqe"] = "id_customer_seller";
${${"GLOBALS"}["taultlaseq"]} = AgileSellerManager::getLinkedSellerID($this->context->customer->id);
$qjwuyezbnwd = "order";
if (${$difdqhzqxl} != ${${"GLOBALS"}["taultlaseq"]} || ${${"GLOBALS"}["gfrblyem"]} <= 0 || ${${"GLOBALS"}["bsmpehdujqe"]} <= 0) {
$this->errors[] = Tools::displayError("You do not have permission to view this order.");
return;
}
if (Tools::isSubmit("submitShippingNumber") && isset(${${"GLOBALS"}["fqitvbmdfl"]})) {
${"GLOBALS"}["mllzihk"] = "order_carrier";
$fdknpwcl = "order_carrier";
${$fdknpwcl} = new OrderCarrier(Tools::getValue("id_order_carrier"));
if (!Validate::isLoadedObject(${${"GLOBALS"}["mllzihk"]})) {
$this->errors[] = Tools::displayError("The order carrier ID is invalid.");
} elseif (!Validate::isTrackingNumber(Tools::getValue("tracking_number"))) {
$this->errors[] = Tools::displayError("The tracking number is incorrect.");
} else {
$order->shipping_number = Tools::getValue("tracking_number");
$order->update();
$order_carrier->tracking_number = pSQL(Tools::getValue("tracking_number"));
if ($order_carrier->update()) {
$qvvnrvmsp = "templateVars";
${${"GLOBALS"}["cdmray"]} = new Customer((int) $order->id_customer);
$ijyvqhqokid = "carrier";
${"GLOBALS"}["mhbtmrqg"] = "templateVars";
${$ijyvqhqokid} = new Carrier((int) $order_carrier->id_carrier, $order->id_lang);
if (!Validate::isLoadedObject(${${"GLOBALS"}["cdmray"]})) {
throw new PrestaShopException("Can't load Customer object");
}
if (!Validate::isLoadedObject(${${"GLOBALS"}["tvqrewgc"]})) {
throw new PrestaShopException("Can't load Carrier object");
}
${${"GLOBALS"}["mhbtmrqg"]} = array("{followup}" => str_replace("@", $order_carrier->tracking_number, $carrier->url), "{firstname}" => $customer->firstname, "{lastname}" => $customer->lastname, "{id_order}" => $order->id, "{shipping_number}" => $order_carrier->tracking_number, "{order_name}" => $order->getUniqReference());
if (@Mail::Send((int) $order->id_lang, "in_transit", Mail::l('Package in transit', (int) $order->id_lang), ${$qvvnrvmsp}, $customer->email, $customer->firstname . " " . $customer->lastname, null, null, null, null, _PS_MAIL_DIR_, true, (int) $order->id_shop)) {
${"GLOBALS"}["rwzquyb"] = "order";
Hook::exec("actionAdminOrdersTrackingNumberUpdate", array("order" => ${${"GLOBALS"}["rwzquyb"]}, "customer" => ${${"GLOBALS"}["cdmray"]}, "carrier" => ${${"GLOBALS"}["tvqrewgc"]}), null, false, true, false, $order->id_shop);
} else {
$this->errors[] = Tools::displayError("An error occurred while sending an email to the customer.");
}
} else {
$this->errors[] = Tools::displayError("The order carrier cannot be updated.");
}
}
} elseif (Tools::isSubmit("submitState") && isset(${$qjwuyezbnwd})) {
${${"GLOBALS"}["bfrxhizen"]} = new OrderState(Tools::getValue("id_order_state"));
if (!Validate::isLoadedObject(${${"GLOBALS"}["bfrxhizen"]})) {
$this->errors[] = Tools::displayError("Invalid new order status");
} else {
${${"GLOBALS"}["rxsllerec"]} = $order->getCurrentOrderState();
if ($current_order_state->id != $order_state->id) {
$heccerkhiwt = "history";
${$heccerkhiwt} = new OrderHistory();
${"GLOBALS"}["uynetoegv"] = "templateVars";
$vriwvgqg = "templateVars";
$history->id_order = $order->id;
$history->id_employee = 1;
$history->changeIdOrderState($order_state->id, $order->id);
${${"GLOBALS"}["tvqrewgc"]} = new Carrier($order->id_carrier, $order->id_lang);
${$vriwvgqg} = array();
if ($history->id_order_state == Configuration::get("PS_OS_SHIPPING") && $order->shipping_number) {
${${"GLOBALS"}["nkwobosfw"]} = array("{followup}" => str_replace("@", $order->shipping_number, $carrier->url));
} elseif ($history->id_order_state == Configuration::get("PS_OS_CHEQUE")) {
${${"GLOBALS"}["nkwobosfw"]} = array("{cheque_name}" => Configuration::get("CHEQUE_NAME") ? Configuration::get("CHEQUE_NAME") : "", "{cheque_address_html}" => Configuration::get("CHEQUE_ADDRESS") ? nl2br(Configuration::get("CHEQUE_ADDRESS")) : "");
} elseif ($history->id_order_state == Configuration::get("PS_OS_BANKWIRE")) {
${${"GLOBALS"}["nkwobosfw"]} = array("{bankwire_owner}" => Configuration::get("BANK_WIRE_OWNER") ? Configuration::get("BANK_WIRE_OWNER") : "", "{bankwire_details}" => Configuration::get("BANK_WIRE_DETAILS") ? nl2br(Configuration::get("BANK_WIRE_DETAILS")) : "", "{bankwire_address}" => Configuration::get("BANK_WIRE_ADDRESS") ? nl2br(Configuration::get("BANK_WIRE_ADDRESS")) : "");
}
if (!$history->addWithemail(true, ${${"GLOBALS"}["uynetoegv"]})) {
$this->errors[] = Tools::displayError("An error occurred while changing the status or was unable to send e-mail to the customer.");
}
} else {
$this->errors[] = Tools::displayError("This order is already assigned this status");
}
}
if (empty($this->errors)) {
self::$smarty->assign("cfmmsg_flag", 1);
}
}
if (Tools::isSubmit("submitMessage")) {
$ipovlstkh = "idOrder";
${${"GLOBALS"}["pfwbejwlah"]} = (int) Tools::getValue("id_order");
${${"GLOBALS"}["nioumgdgj"]} = Tools::getValue("msgText");
${"GLOBALS"}["tumvnnp"] = "msgText";
if (!${${"GLOBALS"}["pfwbejwlah"]} || !Validate::isUnsignedId(${$ipovlstkh})) {
$this->errors[] = Tools::displayError("Order is no longer valid");
} else {
if (empty(${${"GLOBALS"}["nioumgdgj"]})) {
$this->errors[] = Tools::displayError("Message cannot be blank");
} else {
if (!Validate::isMessage(${${"GLOBALS"}["tumvnnp"]})) {
$this->errors[] = Tools::displayError("Message is invalid (HTML is not allowed)");
}
//.........这里部分代码省略.........
示例13: processCarrier
function processCarrier()
{
global $cart, $smarty, $isVirtualCart, $orderTotal;
$errors = array();
$cart->recyclable = (isset($_POST['recyclable']) and !empty($_POST['recyclable'])) ? 1 : 0;
if (isset($_POST['gift']) and !empty($_POST['gift'])) {
if (!Validate::isMessage($_POST['gift_message'])) {
$errors[] = Tools::displayError('invalid gift message');
} else {
$cart->gift = 1;
$cart->gift_message = strip_tags($_POST['gift_message']);
}
} else {
$cart->gift = 0;
}
$address = new Address(intval($cart->id_address_delivery));
if (!Validate::isLoadedObject($address)) {
die(Tools::displayError());
}
if (!($id_zone = Address::getZoneById($address->id))) {
$errors[] = Tools::displayError('no zone match with your address');
}
if (isset($_POST['id_carrier']) and Validate::isInt($_POST['id_carrier']) and sizeof(Carrier::checkCarrierZone(intval($_POST['id_carrier']), intval($id_zone)))) {
$cart->id_carrier = intval($_POST['id_carrier']);
} elseif (!$isVirtualCart) {
$errors[] = Tools::displayError('invalid carrier or no carrier selected');
}
$cart->update();
if (sizeof($errors)) {
$smarty->assign('errors', $errors);
displayCarrier();
include dirname(__FILE__) . '/footer.php';
exit;
}
$orderTotal = $cart->getOrderTotal();
}
示例14: postProcess
public function postProcess()
{
if (Tools::isSubmit('submitCloseClaim')) {
$id_mf_claim = (int) Tools::getValue('id_mf_claim');
if (!$id_mf_claim || !Validate::isUnsignedId($id_mf_claim)) {
$this->errors[] = $this->l('The claim is no longer valid.');
} else {
$claim = new MediafinanzClaim($id_mf_claim);
if (!Validate::isLoadedObject($claim)) {
$this->errors[] = $this->l('The Claim cannot be found');
} else {
try {
$res = $this->module->closeClaim($claim->file_number);
if ($res) {
$this->confirmations[] = $this->l('The Claim has been closed');
} else {
$this->errors[] = $this->l('The Claim has not been closed');
}
} catch (Exception $e) {
$this->errors[] = $this->l('The Claim has not been closed');
$this->errors[] = $e->getMessage();
Mediafinanz::logToFile($e->getMessage(), 'general');
}
}
}
}
if (Tools::isSubmit('submitBookDirectPayment')) {
$id_mf_claim = (int) Tools::getValue('id_mf_claim');
$amount = str_replace(',', '.', Tools::getValue('paidAmount'));
if (!$id_mf_claim || !Validate::isUnsignedId($id_mf_claim)) {
$this->errors[] = $this->l('The Claim is no longer valid.');
} else {
$claim = new MediafinanzClaim($id_mf_claim);
if (!Validate::isLoadedObject($claim)) {
$this->errors[] = $this->l('The Claim cannot be found');
} elseif (!Validate::isDate(Tools::getValue('dateOfPayment'))) {
$this->errors[] = $this->l('The date of payment is invalid');
} elseif (!Validate::isPrice($amount)) {
$this->errors[] = $this->l('The paid amount is invalid.');
} else {
try {
$direct_payment = array('dateOfPayment' => Tools::getValue('dateOfPayment'), 'paidAmount' => $amount);
$res = $this->module->bookDirectPayment($claim->file_number, $direct_payment);
if ($res) {
$this->confirmations[] = $this->l('Direct payment has been booked');
} else {
$this->errors[] = $this->l('Direct payment has not been booked');
}
} catch (Exception $e) {
$this->errors[] = $this->l('Direct payment has not been booked');
$this->errors[] = $e->getMessage();
Mediafinanz::logToFile($e->getMessage(), 'general');
}
}
}
}
if (Tools::isSubmit('submitMessage')) {
$id_mf_claim = (int) Tools::getValue('id_mf_claim');
$msg_text = Tools::getValue('message');
if (!$id_mf_claim || !Validate::isUnsignedId($id_mf_claim)) {
$this->errors[] = $this->l('The claim is no longer valid.');
} elseif (empty($msg_text)) {
$this->errors[] = $this->l('The message cannot be blank.');
} elseif (!Validate::isMessage($msg_text)) {
$this->errors[] = $this->l('This message is invalid (HTML is not allowed).');
}
if (!count($this->errors)) {
$claim = new MediafinanzClaim($id_mf_claim);
if (Validate::isLoadedObject($claim)) {
try {
$res = $this->module->sendMessage($claim->file_number, $msg_text);
if (!$res) {
$this->errors[] = $this->l('The Message has not been sent');
} else {
$this->confirmations[] = $this->l('The Message has been sent');
}
} catch (Exception $e) {
$this->errors[] = $this->l('The Message has not been sent');
$this->errors[] = $e->getMessage();
Mediafinanz::logToFile($e->getMessage(), 'general');
}
} else {
$this->errors[] = $this->l('The Claim not found');
}
}
}
/*if (Tools::isSubmit('update_claims_statuses'))
{*/
if ($this->display == '') {
try {
$this->module->updateClaimsStatuses();
} catch (Exception $e) {
$this->_errors[] = $e->getMessage();
Mediafinanz::logToFile($e->getMessage(), 'general');
}
}
//}
if (Tools::isSubmit('submitCreateClaims')) {
$order_ids = Tools::getValue('order_list');
$claim = Tools::getValue('claim');
//.........这里部分代码省略.........
示例15: displayFrontForm
public function displayFrontForm()
{
global $smarty, $cookie, $link;
session_start();
$errors = array();
$product = new Product((int) Tools::getValue('id_product'), false, (int) $cookie->id_lang);
$productlink = $link->getProductLink($product);
include_once dirname(__FILE__) . '/securimage/securimage.php';
$securimage = new Securimage();
$valid = $securimage->check($code = Tools::getValue('captcha_code'));
if (Tools::isSubmit('submitAskMoreInfoFront')) {
$message = Tools::htmlentitiesUTF8(Tools::getValue('message'));
if (!($name = Tools::getValue('name')) && !$cookie->isLogged()) {
$errors[] = $this->l('Enter your name.');
} elseif (!Validate::isName($name) && !$cookie->isLogged()) {
$errors[] = $this->l('Sorry, but the name is invalid.');
} elseif (!($email = Tools::getValue('email')) && !$cookie->isLogged()) {
$errors[] = $this->l('Enter your e-mail address.');
} elseif (!Validate::isEmail($email) && !$cookie->isLogged()) {
$errors[] = $this->l('Sorry, but the e-mail address is invalid.');
} elseif (!($message = nl2br2($message))) {
$errors[] = $this->l('Enter a message.');
} elseif (!Validate::isMessage($message)) {
$errors[] = $this->l('Sorry, but the message is invalid');
} elseif (!$code && (int) Configuration::get('ASK_CAPTCHA')) {
$errors[] = $this->l('Enter the security code.');
} elseif (!$valid && (int) Configuration::get('ASK_CAPTCHA')) {
$errors[] = $this->l('Sorry, but the security code is not right.');
} elseif (!isset($_GET['id_product']) or !is_numeric($_GET['id_product'])) {
$errors[] = $this->l('An error occurred during the process.');
} else {
$subject = ($cookie->customer_firstname ? $cookie->customer_firstname . ' ' . $cookie->customer_lastname : $this->l('A visitor')) . ' ' . $this->l('requires more information about') . ' ' . $product->name;
$templateVars = array('{product}' => $product->name, '{product_link}' => $productlink, '{customer}' => $cookie->customer_firstname ? $cookie->customer_firstname . ' ' . $cookie->customer_lastname : $this->l('A visitor'), '{name}' => $cookie->customer_firstname ? $cookie->customer_firstname . ' ' . $cookie->customer_lastname : Tools::safeOutput($name), '{email}' => $cookie->email ? $cookie->email : Tools::safeOutput($email), '{message}' => stripslashes($message));
if (Mail::Send((int) $cookie->id_lang, 'askmoreinfo', Mail::l($subject), $templateVars, Configuration::get('PS_SHOP_EMAIL'), NULL, $cookie->email ? $cookie->email : NULL, $cookie->customer_firstname ? $cookie->customer_firstname . ' ' . $cookie->customer_lastname : NULL, NULL, NULL, dirname(__FILE__) . '/mails/')) {
$smarty->assign('confirmation', 1);
} else {
$errors[] = $this->l('Sorry, an error occurred while sending message');
}
}
}
$images = $product->getImages((int) $cookie->id_lang);
foreach ($images as $image) {
if ($image['cover']) {
$cover['id_image'] = (int) $product->id . '-' . (int) $image['id_image'];
$cover['legend'] = $image['legend'];
}
}
if (!isset($cover)) {
$cover = array('id_image' => Language::getIsoById((int) $cookie->id_lang) . '-default', 'legend' => 'No picture');
}
$smarty->assign(array('customer_logged' => $cookie->customer_firstname, 'captcha' => (int) Configuration::get('ASK_CAPTCHA') == 1 ? true : false, 'askmoreinfo_imagesize' => Image::getSize('home'), 'cover' => $cover, 'errors' => $errors, 'product' => $product, 'productlink' => $productlink));
return $this->display(__FILE__, 'maofree_askmoreinfo.tpl');
}