本文整理汇总了PHP中Tools::displayError方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::displayError方法的具体用法?PHP Tools::displayError怎么用?PHP Tools::displayError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools
的用法示例。
在下文中一共展示了Tools::displayError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTranslationsFieldsChild
/**
* Check then return multilingual fields for database interaction
*
* @return array Multilingual fields
*/
public function getTranslationsFieldsChild()
{
parent::validateFieldsLang();
$fieldsArray = array('title', 'url');
$fields = array();
$languages = Language::getLanguages(false);
$defaultLanguage = (int) Configuration::get('PS_LANG_DEFAULT');
foreach ($languages as $language) {
$fields[$language['id_lang']]['id_lang'] = (int) $language['id_lang'];
$fields[$language['id_lang']][self::$definition['primary']] = (int) $this->id;
foreach ($fieldsArray as $field) {
if (!Validate::isTableOrIdentifier($field)) {
die(Tools::displayError());
}
if (isset($this->{$field}[$language['id_lang']]) and !empty($this->{$field}[$language['id_lang']])) {
$fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']], true);
} elseif (in_array($field, $this->fieldsRequiredLang)) {
$fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage], true);
} else {
$fields[$language['id_lang']][$field] = '';
}
}
}
return $fields;
}
示例2: postProcess
public function postProcess()
{
parent::postProcess();
if (Tools::isSubmit('markAsReceived')) {
$idOrder = (int) Tools::getValue('id_order');
$order = new Order($idOrder);
if (Validate::isLoadedObject($order)) {
if ($order->getCurrentState() == 15) {
$new_history = new OrderHistory();
$new_history->id_order = (int) $order->id;
$new_history->changeIdOrderState(16, $order);
// 16: Ready for Production
//var_dump($order,$new_history);
$myfile = fopen(PS_PRODUCT_IMG_PATH . "/orders/" . $order->reference . ".txt", "w") or die("Unable to open file!");
$txt = "Order Confirmed\n Order Reference: " . $order->reference;
fwrite($myfile, $txt);
fclose($myfile);
$new_history->addWithemail(true);
}
$this->context->smarty->assign('receipt_confirmation', true);
} else {
$this->_errors[] = Tools::displayError('Error: Invalid order number');
}
}
}
示例3: initContent
public function initContent()
{
$this->errors[] = Tools::displayError('Controller not found');
$tpl_vars['controller'] = Tools::getvalue('controllerUri', Tools::getvalue('controller'));
$this->context->smarty->assign($tpl_vars);
parent::initContent();
}
示例4: updateWs
/**
* For a given {id_product, id_product_attribute and id_shop}, gets the stock available id associated
*
* @param int $id_product
* @param int $id_product_attribute Optional
* @param int $id_shop Optional
* @return int
*/
public function updateWs()
{
if ($this->depends_on_stock) {
return WebserviceRequest::getInstance()->setError(500, Tools::displayError('You can\'t update stock available when it\'s depend on stock'));
}
return $this->update();
}
示例5: upgrade_module_1_3_2_11
function upgrade_module_1_3_2_11($object)
{
$themes = Theme::getThemes();
$theme_meta_value = array();
foreach ($object->controllers as $controller) {
$page = 'module-' . $object->name . '-' . $controller;
$result = Db::getInstance()->getValue('SELECT * FROM ' . _DB_PREFIX_ . 'meta WHERE page="' . pSQL($page) . '"');
if ((int) $result > 0) {
continue;
}
$meta = new Meta();
$meta->page = $page;
$meta->configurable = 0;
$meta->save();
if ((int) $meta->id > 0) {
foreach ($themes as $theme) {
$theme_meta_value[] = array('id_theme' => $theme->id, 'id_meta' => $meta->id, 'left_column' => (int) $theme->default_left_column, 'right_column' => (int) $theme->default_right_column);
}
} else {
$object->_errors[] = sprintf(Tools::displayError('Unable to install controller: %s'), $controller);
}
}
if (count($theme_meta_value) > 0) {
return Db::getInstance()->insert('theme_meta', $theme_meta_value);
}
return true;
}
示例6: getPages
public static function getPages($excludeFilled = false, $addPage = false)
{
$selectedPages = array();
if (!($files = scandir(_PS_ROOT_DIR_))) {
die(Tools::displayError('Cannot scan base URI'));
}
// Exclude pages forbidden
$exludePages = array('cart', 'order', 'my-account', 'history', 'addresses', 'address', 'identity', 'discount', 'authentication', 'search', 'get-file', 'order-slip', 'order-detail', 'order-follow', 'order-return', 'order-confirmation', 'pagination', 'pdf-invoice', 'pdf-order-return', 'pdf-order-slip', 'product-sort', 'statistics', 'zoom', 'images.inc', 'header', 'footer', 'init', 'category', 'product', 'cms');
foreach ($files as $file) {
if (preg_match('/^[a-z0-9_.-]*\\.php$/i', $file) and !in_array(str_replace('.php', '', $file), $exludePages)) {
$selectedPages[] = str_replace('.php', '', $file);
}
}
// Exclude page already filled
if ($excludeFilled) {
$metas = self::getMetas();
foreach ($metas as $k => $meta) {
if (in_array($meta['page'], $selectedPages)) {
unset($selectedPages[array_search($meta['page'], $selectedPages)]);
}
}
}
// Add selected page
if ($addPage) {
$selectedPages[] = $addPage;
sort($selectedPages);
}
return $selectedPages;
}
示例7: process
public function process()
{
parent::process();
$multipleAddressesFormated = array();
$ordered_fields = array();
$customer = new Customer((int) self::$cookie->id_customer);
if (!Validate::isLoadedObject($customer)) {
die(Tools::displayError('Customer not found'));
}
// Retro Compatibility Theme < 1.4.1
self::$smarty->assign('addresses', $customer->getAddresses((int) self::$cookie->id_lang));
$customerAddressesDetailed = $customer->getAddresses((int) self::$cookie->id_lang);
$total = 0;
foreach ($customerAddressesDetailed as $addressDetailed) {
$address = new Address($addressDetailed['id_address']);
$multipleAddressesFormated[$total] = AddressFormat::getFormattedLayoutData($address);
unset($address);
++$total;
// Retro theme < 1.4.2
$ordered_fields = AddressFormat::getOrderedAddressFields($addressDetailed['id_country'], false, true);
}
// Retro theme 1.4.2
if ($key = array_search('Country:name', $ordered_fields)) {
$ordered_fields[$key] = 'country';
}
self::$smarty->assign('addresses_style', array('company' => 'address_company', 'vat_number' => 'address_company', 'firstname' => 'address_name', 'lastname' => 'address_name', 'address1' => 'address_address1', 'address2' => 'address_address2', 'city' => 'address_city', 'country' => 'address_country', 'phone' => 'address_phone', 'phone_mobile' => 'address_phone_mobile', 'alias' => 'address_title'));
self::$smarty->assign(array('multipleAddresses' => $multipleAddressesFormated, 'ordered_fields' => $ordered_fields));
unset($customer);
}
示例8: postProcess
public function postProcess()
{
global $currentIndex;
if (isset($_POST['submitLocalization' . $this->table])) {
if ($this->tabAccess['edit'] === '1') {
$this->_postConfig($this->_fieldsLocalization);
} else {
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
} elseif (Tools::isSubmit('submitLocalizationPack')) {
if (!($pack = @Tools::file_get_contents('http://www.prestashop.com/download/localization/' . Tools::getValue('iso_localization_pack') . '.xml')) and !($pack = @Tools::file_get_contents(dirname(__FILE__) . '/../../localization/' . Tools::getValue('iso_localization_pack') . '.xml'))) {
$this->_errors[] = Tools::displayError('Cannot load localization pack (from prestashop.com and from your local folder "localization")');
} elseif (!($selection = Tools::getValue('selection'))) {
$this->_errors[] = Tools::displayError('Please select at least one content item to import.');
} else {
foreach ($selection as $selected) {
if (!Validate::isLocalizationPackSelection($selected)) {
$this->_errors[] = Tools::displayError('Invalid selection');
return;
}
}
$localizationPack = new LocalizationPack();
if (!$localizationPack->loadLocalisationPack($pack, $selection)) {
$this->_errors = array_merge($this->_errors, $localizationPack->getErrors());
} else {
Tools::redirectAdmin($currentIndex . '&conf=23&token=' . $this->token);
}
}
}
parent::postProcess();
}
示例9: postProcess
public function postProcess()
{
global $cookie;
$this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
if (Tools::isSubmit('submitAdd' . $this->table)) {
if ($id_category = intval(Tools::getValue('id_category'))) {
if (!Category::checkBeforeMove($id_category, intval(Tools::getValue('id_parent')))) {
$this->_errors[] = Tools::displayError('category cannot be moved here');
return false;
}
// Updating customer's group
if ($this->tabAccess['edit'] !== '1') {
$this->_errors[] = Tools::displayError('You do not have permission to edit anything here.');
} else {
$object = new $this->className($id_category);
if (Validate::isLoadedObject($object)) {
$object->updateGroup(Tools::getValue('groupBox'));
} else {
$this->_errors[] = Tools::displayError('an error occurred while updating object') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
}
}
}
}
parent::postProcess();
}
示例10: postProcess
/**
* @see FrontController::postProcess()
*/
public function postProcess()
{
$oplata = new Oplata();
if ($_POST['order_status'] == OplataCls::ORDER_DECLINED) {
$this->errors[] = Tools::displayError('Order declined');
}
$settings = array('merchant_id' => $oplata->getOption('merchant'), 'secret_key' => $oplata->getOption('secret_key'));
$isPaymentValid = OplataCls::isPaymentValid($settings, $_POST);
if ($isPaymentValid !== true) {
$this->errors[] = Tools::displayError($isPaymentValid);
}
$cart = $this->context->cart;
if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) {
Tools::redirect('index.php?controller=order&step=1');
}
$customer = new Customer($cart->id_customer);
if (!Validate::isLoadedObject($customer)) {
Tools::redirect('index.php?controller=order&step=1');
}
if (empty($this->errors)) {
list($orderId, ) = explode(OplataCls::ORDER_SEPARATOR, $_POST['order_id']);
$history = new OrderHistory();
$history->id_order = $orderId;
$history->changeIdOrderState((int) Configuration::get('PS_OS_PAYMENT'), $orderId);
$history->addWithemail(true, array('order_name' => $orderId));
Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $cart->id . '&id_module=' . $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key);
}
}
示例11: init
/**
* Initialize addresses controller
* @see FrontController::init()
*/
public function init()
{
parent::init();
if (!Validate::isLoadedObject($this->context->customer)) {
die(Tools::displayError('The customer could not be found.'));
}
}
示例12: postProcess
public function postProcess()
{
${"GLOBALS"}["blpimnned"] = "id_order_seller";
$dbodbxes = "id_order";
${${"GLOBALS"}["qusrvgm"]} = (int) Tools::getValue("id_order");
if (!$this->context->customer->isLogged() && !Tools::getValue("secure_key")) {
Tools::redirect("index.php?controller=authentication&back=my-account");
}
${"GLOBALS"}["tvasln"] = "id_order";
$jpdhpfqcj = "id_order";
if (!(int) Configuration::get("PS_INVOICE")) {
die(Tools::displayError("Invoices are disabled in this shop."));
}
if (isset(${${"GLOBALS"}["qusrvgm"]}) && Validate::isUnsignedId(${$dbodbxes})) {
${${"GLOBALS"}["ymjzko"]} = new Order(${$jpdhpfqcj});
}
if (!isset(${${"GLOBALS"}["ymjzko"]}) || !Validate::isLoadedObject(${${"GLOBALS"}["ymjzko"]})) {
die(Tools::displayError("Invoice not found"));
}
${${"GLOBALS"}["vewtbt"]} = AgileSellerManager::getObjectOwnerID("order", ${${"GLOBALS"}["tvasln"]});
${${"GLOBALS"}["sokafjqdei"]} = AgileSellerManager::getLinkedSellerID($this->context->customer->id);
if (${${"GLOBALS"}["blpimnned"]} != ${${"GLOBALS"}["sokafjqdei"]}) {
die(Tools::displayError("You do not have permission to see this invoice"));
}
if (Tools::isSubmit("secure_key") && $order->secure_key != Tools::getValue("secure_key")) {
die(Tools::displayError("You do not have permission to see this invoice"));
}
if (!OrderState::invoiceAvailable($order->getCurrentState()) && !$order->invoice_number) {
die(Tools::displayError("No invoice available"));
}
$this->order = ${${"GLOBALS"}["ymjzko"]};
}
示例13: isItemsOrder
public static function isItemsOrder($value)
{
$str_error = Tools::displayError('For the items');
foreach ($value as $key => $item) {
$str_error .= ' ' . $key . ' ';
$str_error .= isset($item['name']) ? $item['name'] . ' ' : '';
$str_error .= ' :';
if (isset($item['total_ht']) && !Validate::isFloat($item['total_ht'])) {
throw new TwengaFieldsException($str_error . Tools::displayError('The total HT must be a float value.'));
}
if (isset($item['quantity']) && !Validate::isInt($item['quantity'])) {
throw new TwengaFieldsException($str_error . Tools::displayError('The quantity must be a integer value.'));
}
if (isset($item['sku']) && !is_string($item['sku']) && strlen($item['sku']) > 40) {
throw new TwengaFieldsException($str_error . Tools::displayError('The sku must be a string with length less than 40 chars.'));
}
if (isset($item['name']) && !is_string($item['name'])) {
throw new TwengaFieldsException($str_error . Tools::displayError('The name must be a string with length less than 100 chars.'));
}
if (isset($item['category_name']) && !is_string($item['category_name'])) {
throw new TwengaFieldsException($str_error . Tools::displayError('The category name must be a string with length less than 100 chars.'));
}
}
return true;
}
示例14: ajaxProcessSendMailTest
public function ajaxProcessSendMailTest()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_) {
die(Tools::displayError('This functionality has been disabled.'));
}
/* PrestaShop demo mode */
if ($this->tabAccess['view'] === '1') {
$smtpChecked = trim(Tools::getValue('mailMethod')) == 'smtp';
$smtpServer = Tools::getValue('smtpSrv');
$content = urldecode(Tools::getValue('testMsg'));
$content = html_entity_decode($content);
$subject = urldecode(Tools::getValue('testSubject'));
$type = 'text/html';
$to = Tools::getValue('testEmail');
$from = Configuration::get('PS_SHOP_EMAIL');
$smtpLogin = Tools::getValue('smtpLogin');
$smtpPassword = Tools::getValue('smtpPassword');
$smtpPassword = !empty($smtpPassword) ? urldecode($smtpPassword) : Configuration::get('PS_MAIL_PASSWD');
$smtpPassword = str_replace(array('<', '>', '"', '&'), array('<', '>', '"', '&'), Tools::htmlentitiesUTF8($smtpPassword));
$smtpPort = Tools::getValue('smtpPort');
$smtpEncryption = Tools::getValue('smtpEnc');
$result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($smtpServer), Tools::htmlentitiesUTF8($content), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8($type), Tools::htmlentitiesUTF8($to), Tools::htmlentitiesUTF8($from), Tools::htmlentitiesUTF8($smtpLogin), $smtpPassword, Tools::htmlentitiesUTF8($smtpPort), Tools::htmlentitiesUTF8($smtpEncryption));
die($result === true ? 'ok' : $result);
}
}
示例15: getSellerByEmail
private function getSellerByEmail($email, $passwd)
{
if (!Validate::isEmail($email) or $passwd != NULL and !Validate::isPasswd($passwd)) {
die(Tools::displayError());
}
$sql = '
SELECT *
FROM `' . _DB_PREFIX_ . 'employee`
WHERE `active` = 1
AND `email` = \'' . pSQL($email) . '\'
' . ($passwd ? 'AND `passwd` = \'' . $passwd . '\'' : '');
$result = Db::getInstance()->getRow($sql);
if (!$result) {
return false;
}
$emp = new Employee();
$emp->id = $result['id_employee'];
$emp->id_profile = $result['id_profile'];
foreach ($result as $key => $value) {
if (key_exists($key, $emp)) {
$emp->{$key} = $value;
}
}
return $emp;
}