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


PHP Validate::isPhoneNumber方法代码示例

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


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

示例1: postProcess

 public function postProcess()
 {
     if (Tools::isSubmit('submitSmsTest')) {
         $number = (string) Tools::getValue('campaign_last_tester');
         if (empty($number) || !Validate::isPhoneNumber($number)) {
             $this->errors[] = $this->module->l('Invalid gsm number !', 'adminmarketingsstep6');
             return false;
         }
         $prefixe = EMTools::getShopPrefixeCountry();
         $number = EMTools::cleanNumber($number, $prefixe);
         if ($number[0] != '0' && $number[0] != '+') {
             $this->errors[] = $this->module->l('Invalid gsm number !', 'adminmarketingsstep6');
             return false;
         }
         $response_array = array();
         $parameters = array('campaign_id' => $this->campaign_api_message_id, 'recipient' => $number, 'text' => $this->module->l('[TEST]', 'adminmarketingsstep6') . ' ' . $this->campaign_sms_text);
         if ($this->session_api->call('sms', 'campaign', 'send_test', $parameters, $response_array)) {
             // We store the last fax number
             // ----------------------------
             Db::getInstance()->update('expressmailing_sms', array('campaign_last_tester' => pSQL($number)), 'campaign_id = ' . $this->campaign_id);
             $this->confirmations[] = sprintf($this->module->l('Please wait, your sms is processing to %s ...', 'adminmarketingsstep6'), $number);
             return true;
         }
         $this->errors[] = sprintf($this->module->l('Error while sending sms to the API : %s', 'adminmarketingsstep6'), $this->session_api->getError());
         return false;
     }
 }
开发者ID:Oldwo1f,项目名称:yakaboutique,代码行数:27,代码来源:adminmarketingsstep6.php

示例2: initContent

 public function initContent()
 {
     parent::initContent();
     if (Tools::isSubmit('submitMessage')) {
         $message = Tools::getValue('message');
         // Html entities is not usefull, iscleanHtml check there is no bad html tags.
         $phone = Tools::getValue('tel');
         $mobile = Tools::getValue('mobile');
         if (!($from = trim(Tools::getValue('from'))) || !Validate::isEmail($from)) {
             $this->errors[] = Tools::displayError('Invalid email address.');
         } else {
             if (!$message) {
                 $this->errors[] = Tools::displayError('The message cannot be blank.');
             } else {
                 if (!Validate::isCleanHtml($message)) {
                     $this->errors[] = Tools::displayError('Invalid message');
                 } else {
                     if (!Validate::isPhoneNumber($phone)) {
                         $this->errors[] = Tools::displayError('Invalid phone number.');
                     } else {
                         if (!Validate::isPhoneNumber($mobile)) {
                             $this->errors[] = Tools::displayError('Invalid Mobile number.');
                         }
                     }
                 }
             }
         }
         //		var_dump($this->errors,empty($this->errors));
         if (empty($this->errors)) {
             $id_product = Tools::getValue('product_id');
             //var_dump($id_product);
             $product = new Product($id_product);
             //var_dump($product);
             $product_name = '';
             $item_number = '';
             if (Validate::isLoadedObject($product) && isset($product->name[(int) $this->context->language->id])) {
                 $product_name = $product->name[(int) $this->context->language->id];
                 $item_number = $product->item_number;
             }
             $data = array('{name}' => Tools::getValue('name'), '{phone}' => $phone, '{mobile}' => $mobile, '{message}' => $message, '{item_number}' => $item_number, '{product}' => $product_name, '{date}' => date('Y-m-d H:i:s'), '{email}' => $from);
             $sampleObj = new requestsample();
             $sampleObj->sendmail($data, $from, (int) $this->context->language->id, 'request_quote', 'New Request for Quote');
             $this->context->smarty->assign('confirmation', 1);
         }
     }
     $this->context->smarty->assign('product_id', $_GET['pr_id']);
     $this->setTemplate('quote_form.tpl');
 }
开发者ID:Eximagen,项目名称:3m,代码行数:48,代码来源:quote.php

示例3: __construct

 public function __construct(SimpleXMLElement $order_xml = null)
 {
     if (!$order_xml) {
         return;
     }
     /** Backward compatibility */
     require dirname(__FILE__) . '/../backward_compatibility/backward.php';
     list($this->firstname, $this->familyname) = $this->_formatShippingAddressName($order_xml->ShippingAddress->Name);
     $this->id_order_ref = (string) $order_xml->OrderID;
     $this->amount = (string) $order_xml->AmountPaid;
     $this->status = (string) $order_xml->CheckoutStatus->Status;
     $this->name = (string) $order_xml->ShippingAddress->Name;
     $this->address1 = (string) $order_xml->ShippingAddress->Street1;
     $this->address2 = (string) $order_xml->ShippingAddress->Street2;
     $this->city = (string) $order_xml->ShippingAddress->CityName;
     $this->state = (string) $order_xml->ShippingAddress->StateOrProvince;
     $this->country_iso_code = (string) $order_xml->ShippingAddress->Country;
     $this->country_name = (string) $order_xml->ShippingAddress->CountryName;
     $this->postalcode = (string) $order_xml->ShippingAddress->PostalCode;
     $this->shippingService = (string) $order_xml->ShippingServiceSelected->ShippingService;
     $this->shippingServiceCost = (string) $order_xml->ShippingServiceSelected->ShippingServiceCost;
     $this->payment_method = (string) $order_xml->CheckoutStatus->PaymentMethod;
     $this->id_order_seller = (string) $order_xml->ShippingDetails->SellingManagerSalesRecordNumber;
     if (count($order_xml->TransactionArray->Transaction)) {
         $this->email = (string) $order_xml->TransactionArray->Transaction[0]->Buyer->Email;
     }
     $phone = (string) $order_xml->ShippingAddress->Phone;
     if (!$phone || !Validate::isPhoneNumber($phone)) {
         $this->phone = '0100000000';
     } else {
         $this->phone = $phone;
     }
     $date = substr((string) $order_xml->CreatedTime, 0, 10) . ' ' . substr((string) $order_xml->CreatedTime, 11, 8);
     $this->date = $date;
     $this->date_add = $date;
     if ($order_xml->TransactionArray->Transaction) {
         $this->product_list = $this->_getProductsFromTransactions($order_xml->TransactionArray->Transaction);
     }
 }
开发者ID:juniorhq88,项目名称:PrestaShop-modules,代码行数:39,代码来源:EbayOrder.php

示例4: init

 /**
  * Initialize order opc controller
  * @see FrontController::init()
  */
 public function init()
 {
     parent::init();
     if ($this->nbProducts) {
         $this->context->smarty->assign('virtual_cart', $this->context->cart->isVirtualCart());
     }
     $this->context->smarty->assign('is_multi_address_delivery', $this->context->cart->isMultiAddressDelivery() || (int) Tools::getValue('multi-shipping') == 1);
     $this->context->smarty->assign('open_multishipping_fancybox', (int) Tools::getValue('multi-shipping') == 1);
     if ($this->nbProducts) {
         if (Tools::isSubmit('ajax')) {
             if (Tools::isSubmit('method')) {
                 switch (Tools::getValue('method')) {
                     case 'updateMessage':
                         if (Tools::isSubmit('message')) {
                             $txtMessage = urldecode(Tools::getValue('message'));
                             $this->_updateMessage($txtMessage);
                             if (count($this->errors)) {
                                 die('{"hasError" : true, "errors" : ["' . implode('\',\'', $this->errors) . '"]}');
                             }
                             die(true);
                         }
                         break;
                     case 'updateCarrierAndGetPayments':
                         if ((Tools::isSubmit('delivery_option') || Tools::isSubmit('id_carrier')) && Tools::isSubmit('recyclable') && Tools::isSubmit('gift') && Tools::isSubmit('gift_message')) {
                             $this->_assignWrappingAndTOS();
                             if ($this->_processCarrier()) {
                                 $carriers = $this->context->cart->simulateCarriersOutput();
                                 $return = array_merge(array('HOOK_TOP_PAYMENT' => Hook::exec('displayPaymentTop'), 'HOOK_PAYMENT' => $this->_getPaymentMethods(), 'carrier_data' => $this->_getCarrierList(), 'HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array('carriers' => $carriers))), $this->getFormatedSummaryDetail());
                                 Cart::addExtraCarriers($return);
                                 //									die(Tools::jsonEncode($return));
                             } else {
                                 $this->errors[] = Tools::displayError('An error occurred while updating the cart.');
                             }
                             if (count($this->errors)) {
                                 die('{"hasError" : true, "errors_discount" : ["' . implode('\',\'', $this->errors) . '"]}');
                             }
                             exit;
                         }
                         break;
                     case 'updateTOSStatusAndGetPayments':
                         if (Tools::isSubmit('checked')) {
                             $this->context->cookie->checkedTOS = (int) Tools::getValue('checked');
                             die(Tools::jsonEncode(array('HOOK_TOP_PAYMENT' => Hook::exec('displayPaymentTop'), 'HOOK_PAYMENT' => $this->_getPaymentMethods())));
                         }
                         break;
                     case 'getCarrierList':
                         die(Tools::jsonEncode($this->_getCarrierList()));
                         break;
                     case 'editCustomer':
                         if (!$this->isLogged) {
                             exit;
                         }
                         if (Tools::getValue('years')) {
                             $this->context->customer->birthday = (int) Tools::getValue('years') . '-' . (int) Tools::getValue('months') . '-' . (int) Tools::getValue('days');
                         }
                         $_POST['lastname'] = $_POST['customer_lastname'];
                         $_POST['firstname'] = $_POST['customer_firstname'];
                         $this->errors = $this->context->customer->validateController();
                         //var_dump($this->errors);
                         if (Tools::getValue('delivery_form')) {
                             $address = new Address($this->context->cart->id_address_delivery);
                             if (empty($_POST['city'])) {
                                 $this->errors['city_courier'] = Tools::displayError('Город обязателен');
                             }
                             if (empty($_POST['street'])) {
                                 $this->errors['street_courier'] = Tools::displayError('Улица обязательна');
                             }
                             if (empty($_POST['house'])) {
                                 $this->errors['house_courier'] = Tools::displayError('Дом обязателен');
                             }
                             if (!Tools::getValue('phone')) {
                                 $this->errors['phone'] = Tools::displayError('Телефон обязателен');
                             } else {
                                 if (!Validate::isPhoneNumber(Tools::getValue('phone'))) {
                                     $this->errors['phone'] = Tools::displayError('мобильный телефон неверный');
                                 }
                             }
                             if (!empty($_POST['date_dilivery'])) {
                                 $address->other = 'Удобная дата доставки: ' . $_POST['date_dilivery'];
                             }
                             if (!count($this->errors) && is_object($address) && isset($address->id_customer)) {
                                 $address->address1 = $_POST['city'] . ' ' . $_POST['street'] . ' ' . $_POST['house'];
                                 $address->city = $_POST['city'];
                                 $address->firstname = $_POST['firstname'];
                                 $address->phone_mobile = $_POST['phone'];
                                 $delivery_pickup = array('delivery_city' => $_POST['city'], 'delivery_street' => $_POST['street'], 'delivery_house' => $_POST['house'], 'delivery_date' => isset($_POST['delivery_date']) ? $_POST['delivery_date'] : '');
                                 $address->other = $delivery_pickup['delivery_date'];
                                 foreach ($delivery_pickup as $k => $v) {
                                     $this->context->cookie->{$k} = $v;
                                 }
                                 $address->save();
                             }
                             //else
                             //$this->errors[] = Tools::displayError('Невозможно загрузить адресс');
                         }
                         $this->context->customer->newsletter = (int) Tools::isSubmit('newsletter');
//.........这里部分代码省略.........
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:101,代码来源:OrderOpcController.php

示例5: _postProcess

    private function _postProcess()
    {
        $errors = array();
        if (Tools::isSubmit('submitSecuvadEdit')) {
            return false;
        }
        if (Tools::isSubmit('submitSecuvadConfiguration')) {
            if (Tools::getValue('forme') != 'SARL' and Tools::getValue('forme') != 'SA' and Tools::getValue('forme') != 'EURL' and Tools::getValue('forme') != 'SAS' and Tools::getValue('forme') != 'Entreprise individuelle' and Tools::getValue('forme') != 'SNC') {
                $errors[] = $this->l('Company type is invalid');
            }
            if (Tools::getValue('societe') == NULL or !Validate::isName(Tools::getValue('societe'))) {
                $errors[] = $this->l('Company name is invalid');
            }
            if (Tools::getValue('capital') != NULL and !Validate::isGenericName(Tools::getValue('capital'))) {
                $errors[] = $this->l('Capital is invalid');
            }
            if (Tools::getValue('web_site') == NULL or !Validate::isUrl(Tools::getValue('web_site'))) {
                $errors[] = $this->l('WebSite is invalid');
            }
            if (Tools::getValue('address') != NULL and !Validate::isAddress(Tools::getValue('address'))) {
                $errors[] = $this->l('Address is invalid');
            }
            if (Tools::getValue('code_postal') != NULL and !Validate::isPostCode(Tools::getValue('code_postal'))) {
                $errors[] = $this->l('Zip/ Postal Code is invalid');
            }
            if (Tools::getValue('ville') != NULL and !Validate::isCityName(Tools::getValue('ville'))) {
                $errors[] = $this->l('City is invalid');
            }
            if (Tools::getValue('pays') != NULL and !Validate::isCountryName(Tools::getValue('pays'))) {
                $errors[] = $this->l('Country is invalid');
            }
            if (Tools::getValue('rcs') != NULL and !Validate::isGenericName(Tools::getValue('rcs'))) {
                $errors[] = $this->l('RCS is invalid');
            }
            if (Tools::getValue('siren') != NULL and !Validate::isGenericName(Tools::getValue('siren'))) {
                $errors[] = $this->l('Siren is invalid');
            }
            if (!is_array(Tools::getValue('categories')) or !sizeof(Tools::getValue('categories'))) {
                $errors[] = $this->l('You must select at least one category.');
            }
            if (Tools::getValue('civilite') != 'M' and Tools::getValue('civilite') != 'Mme' and Tools::getValue('civilite') != 'Mlle') {
                $errors[] = $this->l('Title is invalid');
            }
            if (Tools::getValue('nom') == NULL or !Validate::isName(Tools::getValue('nom'))) {
                $errors[] = $this->l('Last name is invalid');
            }
            if (Tools::getValue('prenom') == NULL or !Validate::isName(Tools::getValue('prenom'))) {
                $errors[] = $this->l('First name is invalid');
            }
            if (Tools::getValue('fonction') != NULL and !Validate::isGenericName(Tools::getValue('fonction'))) {
                $errors[] = $this->l('Function name is invalid');
            }
            if (Tools::getValue('email') == NULL or !Validate::isEmail(Tools::getValue('email'))) {
                $errors[] = $this->l('E-mail name is invalid');
            }
            if (Tools::getValue('telephone') == NULL or !Validate::isPhoneNumber(Tools::getValue('telephone'))) {
                $errors[] = $this->l('Telephone is invalid');
            }
            if (!sizeof($errors)) {
                return true;
            } else {
                $this->_html .= $this->displayError(implode('<br />', $errors));
                return false;
            }
        }
        if (Tools::isSubmit('submitSecuvadPostConfiguration')) {
            $errors = array();
            if (!Validate::isGenericName(Tools::getValue('secuvad_login'))) {
                $errors[] = $this->l('Invalid login');
            }
            if (!Validate::isGenericName(Tools::getValue('secuvad_password'))) {
                $errors[] = $this->l('Invalid password');
            }
            if (!in_array(Tools::getValue('secuvad_mode'), $this->_allowed_modes)) {
                $errors[] = $this->l('Invalid Mode');
            }
            if (!Validate::isInt(Tools::getValue('secuvad_id'))) {
                $errors[] = $this->l('Invalid ID');
            }
            if (!sizeof($errors)) {
                // update configuration
                Configuration::updateValue('SECUVAD_LOGIN', Tools::getValue('secuvad_login'));
                Configuration::updateValue('SECUVAD_MDP', Tools::getValue('secuvad_password'));
                Configuration::updateValue('SECUVAD_MODE', Tools::getValue('secuvad_mode'));
                Configuration::updateValue('SECUVAD_ID', Tools::getValue('secuvad_id'));
                Configuration::updateValue('SECUVAD_ACTIVATION', 1);
                $this->_html .= $this->displayConfirmation($this->l('Settings are updated') . '<img src="http://www.prestashop.com/modules/secuvad.png?id=' . urlencode(Tools::getValue('secuvad_id')) . '&login=' . urlencode(Tools::getValue('secuvad_login')) . '&mode=' . (Tools::getValue('secuvad_mode') == 'TEST' ? 0 : 1) . '" style="float:right" />');
            } else {
                $this->_html .= $this->displayError(implode('<br />', $errors));
            }
        }
        if (Tools::isSubmit('submitSecuvadCategory')) {
            Db::getInstance()->Execute('
			DELETE FROM `' . _DB_PREFIX_ . 'secuvad_assoc_category`
			');
            $sql = 'INSERT INTO `' . _DB_PREFIX_ . 'secuvad_assoc_category` VALUES';
            foreach ($_POST as $k => $category_id) {
                if (preg_match('/secuvad_cat_([0-9]+)$/Ui', $k, $result)) {
                    $id_category = $result[1];
                    $sql .= '(NULL, ' . (int) $id_category . ', ' . (int) $category_id . '),';
//.........这里部分代码省略.........
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:101,代码来源:secuvad.php

示例6: hookheader

 public function hookheader($params)
 {
     //Change context Shop to be default
     if ($this->isVersionOneDotFive() && Shop::isFeatureActive()) {
         $oldContextShop = $this->getContextShop();
         $this->setContextShop();
     }
     //End of change
     // Check if the module is configured
     if (!Configuration::get('EBAY_PAYPAL_EMAIL')) {
         return false;
     }
     // Fix hook update product attribute
     $this->hookupdateProductAttributeEbay();
     // init date to check from
     if (Configuration::get('EBAY_INSTALL_DATE') < date('Y-m-d', strtotime('-30 days')) . 'T' . date('H:i:s', strtotime('-30 days'))) {
         //If it is more than 30 days that we installed the module
         $dateToCheckFrom = Configuration::get('EBAY_ORDER_LAST_UPDATE');
         $dateToCheckFromArray = explode('T', $dateToCheckFrom);
         $dateToCheckFrom = date("Y-m-d", strtotime($dateToCheckFromArray[0] . " -30 day"));
         $dateToCheckFrom .= 'T' . $dateToCheckFromArray[1];
     } else {
         //If it is less than 30 days that we installed the module
         $dateToCheckFrom = Configuration::get('EBAY_INSTALL_DATE');
         $dateToCheckFromArray = explode('T', $dateToCheckFrom);
         $dateToCheckFrom = date("Y-m-d", strtotime($dateToCheckFromArray[0] . " -1 day"));
         $dateToCheckFrom .= 'T' . $dateToCheckFromArray[1];
     }
     if (Configuration::get('EBAY_ORDER_LAST_UPDATE') < date('Y-m-d', strtotime('-30 minutes')) . 'T' . date('H:i:s', strtotime('-30 minutes')) . '.000Z') {
         $dateNew = date('Y-m-d') . 'T' . date('H:i:s') . '.000Z';
         $this->setConfiguration('EBAY_ORDER_LAST_UPDATE', $dateNew);
         // eBay Request
         $ebay = new eBayRequest();
         $page = 1;
         $orderList = array();
         $orderCount = 0;
         $orderCountTmp = 100;
         while ($orderCountTmp == 100 && $page < 10) {
             $orderListTmp = $ebay->getOrders($dateToCheckFrom, $dateNew, $page);
             $orderCountTmp = count($orderListTmp);
             $orderList = array_merge((array) $orderList, (array) $orderListTmp);
             $orderCount += $orderCountTmp;
             $page++;
         }
         // Lock
         if ($orderList) {
             foreach ($orderList as $korder => $order) {
                 if ($order['status'] == 'Complete' && $order['amount'] > 0.1 && isset($order['product_list']) && count($order['product_list'])) {
                     if (!Db::getInstance()->getValue('SELECT `id_ebay_order` FROM `' . _DB_PREFIX_ . 'ebay_order` WHERE `id_order_ref` = \'' . pSQL($order['id_order_ref']) . '\'')) {
                         // Check for empty name
                         $order['firstname'] = trim($order['firstname']);
                         $order['familyname'] = trim($order['familyname']);
                         if (empty($order['familyname'])) {
                             $order['familyname'] = $order['firstname'];
                         }
                         if (empty($order['firstname'])) {
                             $order['firstname'] = $order['familyname'];
                         }
                         if (empty($order['phone']) || !Validate::isPhoneNumber($order['phone'])) {
                             $order['phone'] = '0100000000';
                         }
                         if (Validate::isEmail($order['email']) && !empty($order['firstname']) && !empty($order['familyname'])) {
                             // Getting the customer
                             $id_customer = (int) Db::getInstance()->getValue('SELECT `id_customer` FROM `' . _DB_PREFIX_ . 'customer` WHERE `active` = 1 AND `email` = \'' . pSQL($order['email']) . '\' AND `deleted` = 0' . (substr(_PS_VERSION_, 0, 3) == '1.3' ? '' : ' AND `is_guest` = 0'));
                             // Add customer if he doesn't exist
                             if ($id_customer < 1) {
                                 $customer = new Customer();
                                 $customer->id_gender = 0;
                                 $customer->id_default_group = 1;
                                 $customer->secure_key = md5(uniqid(rand(), true));
                                 $customer->email = $order['email'];
                                 $customer->passwd = md5(pSQL(_COOKIE_KEY_ . rand()));
                                 $customer->last_passwd_gen = pSQL(date('Y-m-d H:i:s'));
                                 $customer->newsletter = 0;
                                 $customer->lastname = pSQL($order['familyname']);
                                 $customer->firstname = pSQL($order['firstname']);
                                 $customer->active = 1;
                                 $customer->add();
                                 $id_customer = $customer->id;
                             }
                             // Search if address exists
                             $id_address = (int) Db::getInstance()->getValue('SELECT `id_address` FROM `' . _DB_PREFIX_ . 'address` WHERE `id_customer` = ' . (int) $id_customer . ' AND `alias` = \'eBay\'');
                             if ($id_address > 0) {
                                 $address = new Address((int) $id_address);
                             } else {
                                 $address = new Address();
                                 $address->id_customer = (int) $id_customer;
                             }
                             $address->id_country = (int) Country::getByIso($order['country_iso_code']);
                             $address->alias = 'eBay';
                             $address->lastname = pSQL($order['familyname']);
                             $address->firstname = pSQL($order['firstname']);
                             $address->address1 = pSQL($order['address1']);
                             $address->address2 = pSQL($order['address2']);
                             $address->postcode = pSQL($order['postalcode']);
                             $address->city = pSQL($order['city']);
                             $address->phone = pSQL($order['phone']);
                             $address->active = 1;
                             if ($id_address > 0 && Validate::isLoadedObject($address)) {
                                 $address->update();
//.........这里部分代码省略.........
开发者ID:rtajmahal,项目名称:PrestaShop-modules,代码行数:101,代码来源:ebay.php

示例7: processAccountRequestForm

 private function processAccountRequestForm()
 {
     if (!Tools::isSubmit('submit_account_request')) {
         return false;
     }
     // Check inputs validity
     if (Tools::isEmpty(Tools::getValue('lastname')) || !Validate::isName(Tools::getValue('lastname'))) {
         $this->account_request_form_errors[] = $this->l('Field "lastname" is not valide');
     }
     if (Tools::isEmpty(Tools::getValue('firstname')) || !Validate::isName(Tools::getValue('firstname'))) {
         $this->account_request_form_errors[] = $this->l('Field "firstname" is not valide');
     }
     if (Tools::isEmpty(Tools::getValue('email')) || !Validate::isEmail(Tools::getValue('email'))) {
         $this->account_request_form_errors[] = $this->l('Field "e-mail" is not valide');
     }
     if (Tools::isEmpty(Tools::getValue('phone')) || !Validate::isPhoneNumber(Tools::getValue('phone'))) {
         $this->account_request_form_errors[] = $this->l('Field "phone number" is not valide');
     }
     if (Tools::isEmpty(Tools::getValue('shop_name')) || !Validate::isGenericName(Tools::getValue('shop_name'))) {
         $this->account_request_form_errors[] = $this->l('Field "shop name" is not valide');
     }
     if (!is_numeric(Tools::getValue('packages_per_year')) || Tools::getValue('packages_per_year') <= 0) {
         $this->account_request_form_errors[] = $this->l('Field "packages per year" is not valide');
     }
     if (!is_numeric(Tools::getValue('package_weight')) || Tools::getValue('package_weight') <= 0) {
         $this->account_request_form_errors[] = $this->l('Field "average weight of a package" is not valide');
     }
     // Validation error dont send mail
     if (count($this->account_request_form_errors)) {
         return false;
     }
     return true;
 }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:33,代码来源:kiala.php

示例8: preProcess


//.........这里部分代码省略.........
         $this->company->City = trim(Tools::getValue('city'));
         $this->company->Address = trim(Tools::getValue('address'));
         $this->company->Website = trim(Tools::getValue('website'));
         $this->company->ManagingDirector = trim(Tools::getValue('managingDirector'));
         $this->company->Tel = trim(Tools::getValue('companyTel'));
         $this->company->Fax = trim(Tools::getValue('companyFax'));
         $this->company->ShouShu = trim(Tools::getValue('ShouShu'));
         $this->company->ShouShuType = trim(Tools::getValue('ShouShuType'));
         if ($editPayment) {
             $this->company->PaymentMethod = trim(Tools::getValue("paymentMethod"));
         }
         if ($editPref) {
             $this->company->PrefFax = trim(Tools::getValue("prefFax")) == "on" ? 1 : 0;
             $this->company->PrefEmail = trim(Tools::getValue("prefEmail")) == "on" ? 1 : 0;
         }
         if ($editCompany) {
             if (empty($this->company->CompanyName)) {
                 $this->errors[] = Tools::displayError('Company Name required');
             }
             if (empty($this->company->CountryId)) {
                 $this->errors[] = Tools::displayError('Country required');
             }
             if (empty($this->company->City)) {
                 $this->errors[] = Tools::displayError('Company City required');
             }
             if (empty($this->company->Website)) {
                 $this->errors[] = Tools::displayError('Company Website required');
             }
             if (empty($this->company->ManagingDirector)) {
                 $this->errors[] = Tools::displayError('Managing Director required');
             }
             if (empty($this->company->Tel)) {
                 $this->errors[] = Tools::displayError('Company TEL required');
             } elseif (!Validate::isPhoneNumber($this->company->Tel)) {
                 $this->errors[] = Tools::displayError('Invalid Compnay TEL number');
             }
         }
         /** Member Create **/
         if ($this->member->UserID == 0) {
             $this->member->LoginUserName = trim(Tools::getValue('loginUserName'));
         }
         $this->member->Name = trim(Tools::getValue('name'));
         $password = trim(Tools::getValue('password'));
         $con_password = trim(Tools::getValue('con_password'));
         $this->member->Email = trim(Tools::getValue('email'));
         $this->member->Tel = trim(Tools::getValue('tel'));
         $this->member->LanguageID = trim(Tools::getValue('languageId'));
         $hotelCode = trim(Tools::getValue('HotelCode'));
         if ($editRole) {
             $this->member->RoleID = trim(Tools::getValue('roleId'));
         } else {
             if (self::$cookie->RoleID == 3 && $this->member->UserID == 0) {
                 $this->member->RoleID = 2;
                 $this->member->CompanyID = self::$cookie->CompanyID;
                 $this->member->IsActive = 1;
             }
         }
         if (self::$cookie->RoleID > 3 && $this->member->RoleID > 3 && $this->member->UserID == 0) {
             $this->member->IsActive = 1;
         }
         if ($editDelete) {
             $this->member->IsDelete = trim(Tools::getValue('isDelete'));
         }
         if ($this->member->UserID == 0 && empty($this->member->LoginUserName)) {
             $this->errors[] = Tools::displayError('User ID required');
         }
开发者ID:khuyennd,项目名称:dev-tasagent,代码行数:67,代码来源:RegisterController.php

示例9: getContent

 public function getContent()
 {
     $output = null;
     if (Tools::isSubmit('submitApiKey')) {
         $key = (string) Tools::getValue('CASHWAY_API_KEY');
         $secret = (string) Tools::getValue('CASHWAY_API_SECRET');
         if (!$key || empty($key) || !Validate::isGenericName($key)) {
             $output .= $this->displayError($this->l('Missing API key.'));
         } else {
             Configuration::updateValue('CASHWAY_API_KEY', $key);
             $output .= $this->displayConfirmation($this->l('API key updated.'));
         }
         if (!$secret || empty($secret) || !Validate::isGenericName($secret)) {
             $output .= $this->displayError($this->l('Missing API secret.'));
         } else {
             Configuration::updateValue('CASHWAY_API_SECRET', $secret);
             $output .= $this->displayConfirmation($this->l('API secret updated.'));
         }
         $this->updateNotificationParameters();
     }
     if (Tools::isSubmit('submitSettings')) {
         Configuration::updateValue('CASHWAY_OS_PAYMENT', (int) Tools::getValue('CASHWAY_OS_PAYMENT'));
         Configuration::updateValue('CASHWAY_PAYMENT_TEMPLATE', Tools::getValue('CASHWAY_PAYMENT_TEMPLATE'));
         Configuration::updateValue('CASHWAY_SEND_EMAIL', Tools::getValue('CASHWAY_SEND_EMAIL'));
         Configuration::updateValue('CASHWAY_USE_STAGING', Tools::getValue('CASHWAY_USE_STAGING'));
     }
     if (Tools::isSubmit('submitRegister')) {
         $params = array();
         $params['name'] = Tools::getValue('name');
         $params['email'] = Tools::getValue('email');
         $params['password'] = Tools::getValue('password');
         $params['phone'] = Tools::getValue('phone');
         $params['country'] = Tools::getValue('country');
         $params['company'] = Tools::getValue('company');
         $params['url'] = $this->context->shop->getBaseURL();
         if (!$params['name'] || empty($params['name']) || !Validate::isGenericName($params['name'])) {
             $output .= $this->displayError($this->l('Missing name.'));
         }
         if (!$params['password'] || empty($params['password']) || !Validate::isGenericName($params['password'])) {
             $output .= $this->displayError($this->l('Missing password.'));
         } elseif (!$params['email'] || empty($params['email']) || !Validate::isEmail($params['email'])) {
             $output .= $this->displayError($this->l('Missing email.'));
         } elseif (!$params['phone'] || empty($params['phone']) || !Validate::isPhoneNumber($params['phone'])) {
             $output .= $this->displayError($this->l('Missing phone.'));
         } elseif (!$params['country'] || empty($params['country']) || !Validate::isLangIsoCode($params['country'])) {
             $output .= $this->displayError($this->l('Missing country.'));
         } elseif (!$params['company'] || empty($params['company']) || !Validate::isGenericName($params['company'])) {
             $output .= $this->displayError($this->l('Missing company.'));
         } else {
             $cashway = self::getCashWayAPI();
             $res = $cashway->registerAccount($params);
             if (isset($res['errors'])) {
                 foreach ($res['errors'] as $key => $value) {
                     $output .= $this->displayError($value['code'] . ' => ' . $value['message']);
                 }
             } elseif ($res['status'] == 'newbie') {
                 Configuration::updateValue('CASHWAY_API_KEY', $res['api_key']);
                 Configuration::updateValue('CASHWAY_API_SECRET', $res['api_secret']);
                 $this->updateNotificationParameters();
                 $output .= $this->displayConfirmation($this->l('Register completed'));
             }
         }
     }
     return $output . $this->renderForm();
 }
开发者ID:vAugagneur,项目名称:plugins,代码行数:65,代码来源:cashway.php

示例10: validateSettings

 public function validateSettings()
 {
     if (!Tools::getValue(DpdPolandConfiguration::LOGIN)) {
         self::$errors[] = $this->l('Login can not be empty');
     }
     if (!Tools::getValue(DpdPolandConfiguration::PASSWORD)) {
         self::$errors[] = $this->l('Password can not be empty');
     } elseif (!Validate::isPasswd(Tools::getValue(DpdPolandConfiguration::PASSWORD))) {
         self::$errors[] = $this->l('Password is not valid');
     }
     if (!Tools::getValue(DpdPolandConfiguration::CLIENT_NUMBER)) {
         self::$errors[] = $this->l('Default client number must be set');
     }
     if (!Tools::getValue(DpdPolandConfiguration::COMPANY_NAME)) {
         self::$errors[] = $this->l('Company name can not be empty');
     } elseif (!Validate::isLabel(Tools::getValue(DpdPolandConfiguration::COMPANY_NAME))) {
         self::$errors[] = $this->l('Company name is not valid');
     }
     if (!Tools::getValue(DpdPolandConfiguration::NAME_SURNAME)) {
         self::$errors[] = $this->l('Name and Surname can not be empty');
     } elseif (!Validate::isName(Tools::getValue(DpdPolandConfiguration::NAME_SURNAME))) {
         self::$errors[] = $this->l('Name and surname are not valid. Please use only letters and separate first name from last name with white space.');
     }
     if (!Tools::getValue(DpdPolandConfiguration::ADDRESS)) {
         self::$errors[] = $this->l('Address can not be empty');
     } elseif (!Validate::isAddress(Tools::getValue(DpdPolandConfiguration::ADDRESS))) {
         self::$errors[] = $this->l('Address is not valid');
     }
     if (!Tools::getValue(DpdPolandConfiguration::POSTCODE)) {
         self::$errors[] = $this->l('Postal code not be empty');
     } elseif (!Validate::isPostCode(Tools::getValue(DpdPolandConfiguration::POSTCODE))) {
         self::$errors[] = $this->l('Postal code is not valid');
     }
     if (!Tools::getValue(DpdPolandConfiguration::CITY)) {
         self::$errors[] = $this->l('City can not be empty');
     } elseif (!Validate::isCityName(Tools::getValue(DpdPolandConfiguration::CITY))) {
         self::$errors[] = $this->l('City is not valid');
     }
     if (!Tools::getValue(DpdPolandConfiguration::EMAIL)) {
         self::$errors[] = $this->l('Email can not be empty');
     } elseif (!Validate::isEmail(Tools::getValue(DpdPolandConfiguration::EMAIL))) {
         self::$errors[] = $this->l('Email is not valid');
     }
     if (!Tools::getValue(DpdPolandConfiguration::PHONE)) {
         self::$errors[] = $this->l('Tel. No. can not be empty');
     } elseif (!Validate::isPhoneNumber(Tools::getValue(DpdPolandConfiguration::PHONE))) {
         self::$errors[] = $this->l('Tel. No. is not valid');
     }
     if (Tools::isSubmit(DpdPolandConfiguration::CARRIER_STANDARD_COD)) {
         $checked = false;
         foreach (DpdPoland::getPaymentModules() as $payment_module) {
             if (Tools::isSubmit(DpdPolandConfiguration::COD_MODULE_PREFIX . $payment_module['name'])) {
                 $checked = true;
             }
         }
         if (!$checked) {
             self::$errors[] = $this->l('At least one COD payment method must be checked');
         }
     }
     if (!Tools::getValue(DpdPolandConfiguration::WEIGHT_CONVERSATION_RATE)) {
         self::$errors[] = $this->l('Weight conversation rate can not be empty');
     } elseif (!Validate::isUnsignedFloat(Tools::getValue(DpdPolandConfiguration::WEIGHT_CONVERSATION_RATE))) {
         self::$errors[] = $this->l('Weight conversation rate is not valid');
     }
     if (!Tools::getValue(DpdPolandConfiguration::DIMENSION_CONVERSATION_RATE)) {
         self::$errors[] = $this->l('Dimension conversation rate can not be empty');
     } elseif (!Validate::isUnsignedFloat(Tools::getValue(DpdPolandConfiguration::DIMENSION_CONVERSATION_RATE))) {
         self::$errors[] = $this->l('Dimension conversation rate is not valid');
     }
     if (!Tools::getValue(DpdPolandConfiguration::CUSTOMER_COMPANY)) {
         self::$errors[] = $this->l('Customer company name can not be empty');
     } elseif (!Validate::isLabel(Tools::getValue(DpdPolandConfiguration::CUSTOMER_COMPANY))) {
         self::$errors[] = $this->l('Customer company name is not valid');
     }
     if (!Tools::getValue(DpdPolandConfiguration::CUSTOMER_NAME)) {
         self::$errors[] = $this->l('Customer name and surname can not be empty');
     } elseif (!Validate::isName(Tools::getValue(DpdPolandConfiguration::CUSTOMER_NAME))) {
         self::$errors[] = $this->l('Customer name and surname is not valid');
     }
     if (!Tools::getValue(DpdPolandConfiguration::CUSTOMER_PHONE)) {
         self::$errors[] = $this->l('Customer tel. No. can not be empty');
     } elseif (!Validate::isPhoneNumber(Tools::getValue(DpdPolandConfiguration::CUSTOMER_PHONE))) {
         self::$errors[] = $this->l('Customer tel. No. is not valid');
     }
     if (!Tools::getValue(DpdPolandConfiguration::CUSTOMER_FID)) {
         self::$errors[] = $this->l('Customer FID can not be empty');
     } elseif (!ctype_alnum(Tools::getValue(DpdPolandConfiguration::CUSTOMER_FID))) {
         self::$errors[] = $this->l('Customer FID is not valid');
     }
     if (!Tools::getValue(DpdPolandConfiguration::MASTER_FID)) {
         self::$errors[] = $this->l('Master FID can not be empty');
     } elseif (!ctype_alnum(Tools::getValue(DpdPolandConfiguration::MASTER_FID))) {
         self::$errors[] = $this->l('Master FID is not valid');
     }
     if (!Tools::getValue(DpdPolandConfiguration::WS_URL)) {
         self::$errors[] = $this->l('Web Services URL can not be empty');
     } elseif (!Validate::isUrl(Tools::getValue(DpdPolandConfiguration::WS_URL))) {
         self::$errors[] = $this->l('Web Services URL is not valid');
     }
 }
开发者ID:rokaszygmantas,项目名称:dpdpoland,代码行数:100,代码来源:configuration.controller.php

示例11: displayFrontForm

 public function displayFrontForm()
 {
     global $smarty;
     $error = false;
     $confirm = false;
     if (isset($_POST['submitAddtoafriend'])) {
         global $cookie, $link;
         /* Product informations */
         $product = new Product(intval(Tools::getValue('id_product')), false, intval($cookie->id_lang));
         $productLink = $link->getProductLink($product);
         /*
         	Form Details
         */
         $form_details = array('visitorname' => $_POST['visitorname'] ? $_POST['visitorname'] : "", 'visitoremail' => $_POST['visitoremail'] ? $_POST['visitoremail'] : "", 'visitormobile' => $_POST['visitorphone'] ? $_POST['visitorphone'] : "", 'visitorcountry' => $_POST['id_country'] ? $_POST['id_country'] : "", 'visitorstate' => $_POST['id_state'] ? $_POST['id_state'] : "");
         /* Fields verifications */
         if (empty($_POST['enquiry']) or empty($_POST['enquiry'])) {
             $error = $this->l('You must enter some enquiry.');
         } elseif (empty($_POST['email']) or empty($_POST['name']) or empty($_POST['visitorname']) or empty($_POST['visitoremail']) or empty($_POST['visitorphone']) or empty($_POST['id_country'])) {
             $error = $this->l('You must fill all fields.');
         } elseif (!Validate::isEmail($_POST['visitoremail'])) {
             $error = $this->l('Your email is invalid.');
         } elseif (!Validate::isName($_POST['visitorname'])) {
             $error = $this->l('Your name is invalid.');
         } elseif (!Validate::isPhoneNumber($_POST['visitorphone'])) {
             $error = $this->l('Your phone number is invalid.');
         } elseif (!isset($_GET['id_product']) or !is_numeric($_GET['id_product'])) {
             $error = $this->l('An error occurred during the process.');
         } else {
             $countries = Country::getCountries(intval($cookie->id_lang), true);
             $finalstate = '';
             if (isset($countries[$_POST['id_country']]['country'])) {
                 $states = $countries[$_POST['id_country']]['states'];
                 foreach ($states as $ind => $statevalue) {
                     if ($statevalue['id_state'] == $_POST['id_state']) {
                         $finalstate = $statevalue['name'];
                     }
                 }
             }
             /* Email generation */
             $subject = $_POST['visitorname'] . ' ' . $this->l('enquired about the product') . ' ' . $product->name;
             $templateVars = array('{product}' => $product->name, '{product_link}' => $productLink, '{customer}' => $_POST['visitorname'], '{customeremail}' => $_POST['visitoremail'], '{customerphone}' => $_POST['visitorphone'], '{customercountry}' => isset($countries[$_POST['id_country']]['country']) ? $countries[$_POST['id_country']]['country'] : "", '{customerstate}' => $finalstate, '{name}' => Tools::safeOutput($_POST['name']), '{enquiry}' => Tools::safeOutput($_POST['enquiry']));
             /* Email sending */
             if (!Mail::Send(intval($cookie->id_lang), 'product_enquiry', $subject, $templateVars, $_POST['email'], NULL, $_POST['visitoremail'], $_POST['visitorname'], NULL, NULL, dirname(__FILE__) . '/mails/')) {
                 $error = $this->l('An error occurred during the process.');
             } else {
                 $confirm = $this->l('An email has been sent successfully to') . ' ' . Tools::safeOutput($_POST['email']) . '.';
             }
         }
     } else {
         global $cookie, $link;
         $customer = new Customer(intval($cookie->id_customer));
         $address = new Address(intval($cookie->id_address_delivery));
         /* Product informations */
         $product = new Product(intval(Tools::getValue('id_product')), false, intval($cookie->id_lang));
         $productLink = $link->getProductLink($product);
         /*
         	Form Details
         */
         $form_details = array('visitorname' => $customer->firstname ? $customer->firstname . ' ' . $customer->lastname : "", 'visitoremail' => $customer->email ? $customer->email : "", 'visitormobile' => $address->phone_mobile ? $address->phone_mobile : "", 'visitorcountry' => $address->id_country ? $address->id_country : "", 'visitorstate' => $address->id_state ? $address->id_state : "");
     }
     /*
     	Get country
     */
     if (isset($_POST['id_country']) and !empty($_POST['id_country']) and is_numeric($_POST['id_country'])) {
         $selectedCountry = intval($_POST['id_country']);
     } elseif (isset($address) and isset($address->id_country) and !empty($address->id_country) and is_numeric($address->id_country)) {
         $selectedCountry = intval($address->id_country);
     } elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
         $array = preg_split('/,|-/', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
         if (!Validate::isLanguageIsoCode($array[0]) or !($selectedCountry = Country::getByIso($array[0]))) {
             $selectedCountry = intval(Configuration::get('PS_COUNTRY_DEFAULT'));
         }
     } else {
         $selectedCountry = intval(Configuration::get('PS_COUNTRY_DEFAULT'));
     }
     $countries = Country::getCountries(intval($cookie->id_lang), true);
     $countriesList = '';
     foreach ($countries as $country) {
         $countriesList .= '<option value="' . intval($country['id_country']) . '" ' . ($country['id_country'] == $selectedCountry ? 'selected="selected"' : '') . '>' . htmlentities($country['name'], ENT_COMPAT, 'UTF-8') . '</option>';
     }
     /*
     	Customer Info.
     */
     $visitorname = $form_details['visitorname'] ? $form_details['visitorname'] : "";
     $visitoremail = $form_details['visitoremail'] ? $form_details['visitoremail'] : "";
     $visitormobile = $form_details['visitormobile'] ? $form_details['visitormobile'] : "";
     $visitorcountry = $selectedCountry ? $selectedCountry : "";
     $visitorstate = $form_details['visitorstate'] ? $form_details['visitorstate'] : "";
     $visitor = array('fullname' => $visitorname, 'email' => $visitoremail, 'mobile' => $visitormobile, 'country' => $visitorcountry, 'state' => $visitorstate);
     /* Image */
     $images = $product->getImages(intval($cookie->id_lang));
     foreach ($images as $k => $image) {
         if ($image['cover']) {
             $cover['id_image'] = intval($product->id) . '-' . intval($image['id_image']);
             $cover['legend'] = $image['legend'];
         }
     }
     if (!isset($cover)) {
         $cover = array('id_image' => Language::getIsoById(intval($cookie->id_lang)) . '-default', 'legend' => 'No picture');
     }
//.........这里部分代码省略.........
开发者ID:oracle178,项目名称:prestashop-product-enquiry,代码行数:101,代码来源:productenquiry.php

示例12: _update_configuration

 protected function _update_configuration($key, $value)
 {
     $interface = PS_CLI_Interface::getInterface();
     $validValue = false;
     switch ($key) {
         case 'PS_STORE_DISPLAY_FOOTER':
         case 'PS_STORE_DISPLAY_SITEMAP':
         case 'PS_STORE_SIMPLIFIED':
             $validValue = Validate::isBool($value);
             break;
         case 'PS_STORES_CENTER_LAT':
         case 'PS_STORES_CENTER_LONG':
             $validValue = Validate::isCoordinate($value);
             break;
         case 'PS_SHOP_NAME':
             $validValue = Validate::isName($value);
             break;
         case 'PS_SHOP_EMAIL':
             $validValue = Validate::isEmail($value);
             break;
         case 'PS_SHOP_DETAILS':
             $validValue = Validate::isString($value);
             break;
         case 'PS_SHOP_ADDR1':
         case 'PS_SHOP_ADDR2':
             $validValue = Validate::isAddress($value);
             break;
         case 'PS_SHOP_CODE':
             $validValue = Validate::isPostCode($value);
             break;
         case 'PS_SHOP_CITY':
             $validValue = Validate::isCityName($value);
             break;
         case 'PS_SHOP_COUNTRY_ID':
             if (Validate::isUnsignedId($value)) {
                 $obj = new Country((int) $value);
                 $validValue = Validate::isLoadedObject($obj);
             }
             break;
         case 'PS_SHOP_STATE_ID':
             $validValue = Validate::isUnsignedId($value);
             break;
         case 'PS_SHOP_PHONE':
         case 'PS_SHOP_FAX':
             $validValue = Validate::isPhoneNumber($value);
             break;
         default:
             $interface->error("Configuration key '{$key}' is not handled by this command");
             break;
     }
     if (!$validValue) {
         $interface->error("value '{$value}' is not a valid value for configuration key '{$key}'");
     }
     if (PS_CLI_Utils::update_configuration_value($key, $value)) {
         $interface->success("Successfully updated '{$key}' configuration");
     } else {
         $interface->error("Could not update configuration key '{$key}'");
     }
 }
开发者ID:rodrisan,项目名称:ps-cli,代码行数:59,代码来源:stores.php

示例13: disableUsesAddress

 public static function disableUsesAddress($order)
 {
     if (Validate::isLoadedObject($order)) {
         $address = new Address((int) $order->id_address_delivery);
         if (Validate::isLoadedObject($address)) {
             $default_address = Configuration::getMultiple(array('SHIPTOMYID_DEFAULT_ADDR_ADDRESS', 'SHIPTOMYID_DEFAULT_ADDR_ADDRESS2', 'SHIPTOMYID_DEFAULT_ADDR_CITY', 'SHIPTOMYID_DEFAULT_ADDR_POSTCODE', 'SHIPTOMYID_DEFAULT_ADDR_COUNTRY', 'SHIPTOMYID_DEFAULT_ADDR_STATE', 'SHIPTOMYID_DEFAULT_ADDR_PHONE', 'SHIPTOMYID_DEFAULT_ADDR_ALIAS'));
             if (Validate::isAddress($default_address['SHIPTOMYID_DEFAULT_ADDR_ADDRESS'])) {
                 $address->address1 = Tools::substr($default_address['SHIPTOMYID_DEFAULT_ADDR_ADDRESS'], 0, 128);
             }
             if (Validate::isAddress($default_address['SHIPTOMYID_DEFAULT_ADDR_ADDRESS2'])) {
                 $address->address2 = Tools::substr($default_address['SHIPTOMYID_DEFAULT_ADDR_ADDRESS2'], 0, 128);
             }
             if (Validate::isCityName($default_address['SHIPTOMYID_DEFAULT_ADDR_CITY'])) {
                 $address->city = Tools::substr($default_address['SHIPTOMYID_DEFAULT_ADDR_CITY'], 0, 64);
             }
             if (Validate::isPostCode($default_address['SHIPTOMYID_DEFAULT_ADDR_POSTCODE'])) {
                 $address->postcode = Tools::substr($default_address['SHIPTOMYID_DEFAULT_ADDR_POSTCODE'], 0, 12);
             }
             if (Validate::isPhoneNumber($default_address['SHIPTOMYID_DEFAULT_ADDR_PHONE'])) {
                 $address->phone = Tools::substr($default_address['SHIPTOMYID_DEFAULT_ADDR_PHONE'], 0, 32);
             }
             $address->id_country = (int) $default_address['SHIPTOMYID_DEFAULT_ADDR_COUNTRY'];
             $address->id_state = (int) $default_address['SHIPTOMYID_DEFAULT_ADDR_STATE'];
             $address->update();
         }
     }
     Db::getInstance()->Execute('UPDATE ' . _DB_PREFIX_ . 'address SET deleted = 1 WHERE id_address = ' . (int) $order->id_address_delivery);
 }
开发者ID:ac3gam3r,项目名称:Maxokraft,代码行数:28,代码来源:ShiptomyidOrder.php

示例14: processSave

 public function processSave()
 {
     $hotel_id = Tools::getValue('hotel_id');
     $hotel_name = Tools::getValue('hotel_name');
     $phone = Tools::getValue('phone');
     $email = Tools::getValue('email');
     $check_in = Tools::getValue('check_in');
     $check_out = Tools::getValue('check_out');
     $short_description = Tools::getValue('short_description');
     $description = Tools::getValue('description');
     $rating = Tools::getValue('hotel_rating');
     $city = Tools::getValue('hotel_city');
     $state = Tools::getValue('hotel_state');
     $country = Tools::getValue('hotel_country');
     $policies = Tools::getValue('hotel_policies');
     $zipcode = Tools::getValue('hotel_postal_code');
     $address = Tools::getValue('address');
     $active = Tools::getValue('ENABLE_HOTEL');
     if ($hotel_name == '') {
         $this->errors[] = Tools::displayError('Hotel name is required field.');
     } else {
         if (!Validate::isGenericName($hotel_name)) {
             $this->errors[] = Tools::displayError($this->l('Hotel name must not have Invalid characters <>;=#{}'));
         }
     }
     if (!$phone) {
         $this->errors[] = Tools::displayError('Phone number is required field.');
     } else {
         if (!Validate::isPhoneNumber($phone)) {
             $this->errors[] = Tools::displayError('Please enter a valid phone number.');
         }
     }
     if ($email == '') {
         $this->errors[] = Tools::displayError('Email is required field.');
     } else {
         if (!Validate::isEmail($email)) {
             $this->errors[] = Tools::displayError('Please enter a valid email.');
         }
     }
     if ($check_in == '') {
         $this->errors[] = Tools::displayError('Check In time is required field.');
     }
     if ($check_out == '') {
         $this->errors[] = Tools::displayError('Check Out Time is required field.');
     }
     if ($zipcode == '') {
         $this->errors[] = Tools::displayError('Postal Code is required field.');
     } else {
         if (!Validate::isPostCode($zipcode)) {
             $this->errors[] = Tools::displayError('Enter a Valid Postal Code.');
         }
     }
     if (!$rating) {
         $this->errors[] = Tools::displayError('Rating is required field.');
     }
     if ($address == '') {
         $this->errors[] = Tools::displayError('Address is required field.');
     }
     if (!$country) {
         $this->errors[] = Tools::displayError('Country is required field.');
     }
     if (!$state) {
         $this->errors[] = Tools::displayError('State is required field.');
     }
     if ($city == '') {
         $this->errors[] = Tools::displayError('City is required field.');
     } else {
         if (!Validate::isCityName($city)) {
             $this->errors[] = Tools::displayError('Enter a Valid City Name.');
         }
     }
     //validate hotel main image
     if (isset($_FILES['hotel_image']) && $_FILES['hotel_image']['name']) {
         $obj_htl_img = new HotelImage();
         $error = $obj_htl_img->validAddHotelMainImage($_FILES['hotel_image']);
         if ($error) {
             $this->errors[] = Tools::displayError('<strong>' . $_FILES['hotel_image']['name'] . '</strong> : Image format not recognized, allowed formats are: .gif, .jpg, .png', false);
         }
     }
     //validate Hotel's other images
     if (isset($_FILES['images']) && $_FILES['images']) {
         $obj_htl_img = new HotelImage();
         $error = $obj_htl_img->validAddHotelOtherImage($_FILES['images']);
         if ($error) {
             $this->errors[] = Tools::displayError('<strong>' . $_FILES['hotel_image']['name'] . '</strong> : Image format not recognized, allowed formats are: .gif, .jpg, .png', false);
         }
     }
     if (!count($this->errors)) {
         if ($hotel_id) {
             $obj_hotel_info = new HotelBranchInformation($hotel_id);
         } else {
             $obj_hotel_info = new HotelBranchInformation();
         }
         if ($obj_hotel_info) {
             if (!$active) {
                 $obj_htl_rm_info = new HotelRoomType();
                 $ids_product = $obj_htl_rm_info->getIdProductByHotelId($obj_hotel_info->id);
                 if (isset($ids_product) && $ids_product) {
                     foreach ($ids_product as $key_prod => $value_prod) {
                         $obj_product = new Product($value_prod['id_product']);
//.........这里部分代码省略.........
开发者ID:Rohit-jn,项目名称:hotelcommerce,代码行数:101,代码来源:AdminAddHotelController.php

示例15: postProcess

 /**
  * Start forms process
  * @see FrontController::postProcess()
  */
 public function postProcess()
 {
     //var_dump($_POST);exit();
     $customer = new Customer();
     $mail = trim(Tools::getValue('email'));
     if (Validate::isEmail($mail)) {
         $customer->getByEmail($mail, trim(Tools::getValue('passwd')));
     }
     if (Tools::isSubmit('SubmitCreate')) {
         $this->processSubmitCreate();
     }
     if (Tools::isSubmit('submitAccount') && $customer->id) {
         if (!Tools::getValue('customer_firstname')) {
             $this->val_errors['customer_firstname'] = Tools::displayError('Имя обязательно');
         }
         if (!Tools::getValue('phone_mobile')) {
             $this->val_errors['phone_mobile'] = Tools::displayError('Телефон обязателен');
         } else {
             if (!Validate::isPhoneNumber(Tools::getValue('phone_mobile'))) {
                 $this->val_errors['phone_mobile'] = Tools::displayError('мобильный телефон неверный');
             }
         }
         if (isset($_POST['delivery_form']) && $_POST['delivery_form'] == 1) {
             if (empty($_POST['city'])) {
                 $this->val_errors['city_courier'] = Tools::displayError('Город обязателен');
             }
             if (empty($_POST['street'])) {
                 $this->val_errors['street_courier'] = Tools::displayError('Улица обязательна');
             }
             if (empty($_POST['house'])) {
                 $this->val_errors['house_courier'] = Tools::displayError('Дом обязателен');
             }
         }
         if (count($this->val_errors)) {
             $return = array('hasError' => !empty($this->val_errors), 'errors' => $this->errors, 'isSaved' => false, 'id_customer' => 0, 'val_errors' => $this->val_errors);
             die(Tools::jsonEncode($return));
             $this->context->smarty->assign('account_error', $this->errors);
         } else {
             $this->processSubmitLogin();
         }
     } else {
         if (Tools::isSubmit('submitAccount') || Tools::isSubmit('submitGuestAccount')) {
             // if($customer->id)$this->processSubmitLogin();
             $this->processSubmitAccount();
         }
     }
     //$this->processSubmitAccount();
     if (Tools::isSubmit('SubmitLogin')) {
         $this->processSubmitLogin();
     }
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:55,代码来源:AuthController.php


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