Ejemplo n.º 1
0
 protected function processSubmitSellerinfo()
 {
     $cugxxpwlfps = "firstname";
     ${"GLOBALS"}["gmnuknt"] = "lastname";
     $eoemtqhasop = "passwd";
     ${$cugxxpwlfps} = trim(Tools::getValue("firstname"));
     ${${"GLOBALS"}["gmnuknt"]} = trim(Tools::getValue("lastname"));
     $ufvrdeas = "customer";
     $seqgjbwpajto = "email";
     ${$eoemtqhasop} = trim(Tools::getValue("passwd"));
     ${${"GLOBALS"}["cyutgacgwj"]} = trim(Tools::getValue("email"));
     if (empty(${${"GLOBALS"}["efoxtmc"]})) {
         $this->errors[] = Tools::displayError("First name is required field.");
     }
     if (empty(${${"GLOBALS"}["ptvgwodrri"]})) {
         $this->errors[] = Tools::displayError("Last name is required field.");
     }
     ${"GLOBALS"}["yqbqcnmck"] = "email";
     ${"GLOBALS"}["utmvhz"] = "passwd";
     ${"GLOBALS"}["tgijpv"] = "country";
     if (empty(${$seqgjbwpajto})) {
         $this->errors[] = Tools::displayError("An email address required.");
     } elseif (!Validate::isEmail(${${"GLOBALS"}["yqbqcnmck"]})) {
         $this->errors[] = Tools::displayError("Invalid email address.");
     } elseif (empty(${${"GLOBALS"}["trolpj"]})) {
         $this->errors[] = Tools::displayError("Password is required.");
     } elseif (!Validate::isPasswd(${${"GLOBALS"}["utmvhz"]})) {
         $this->errors[] = Tools::displayError("Invalid password.");
     }
     if (Customer::customerExists(${${"GLOBALS"}["cyutgacgwj"]})) {
         $this->errors[] = Tools::displayError("An account using this email address has already been registered.", false);
     }
     if (empty($_POST["postcode"])) {
         $this->errors[] = Tools::displayError("Postcode is required field.");
     }
     ${"GLOBALS"}["hdrwdzkfjgu"] = "zip_code_format";
     $this->errors = array_merge($this->errors, $this->sellerinfo->validateController());
     if (!(${${"GLOBALS"}["tgijpv"]} = new Country($this->sellerinfo->id_country)) || !Validate::isLoadedObject(${${"GLOBALS"}["lqineuzwfyx"]})) {
         throw new PrestaShopException("Country cannot be loaded with address->id_country");
     }
     if ((int) $country->contains_states && !(int) $this->sellerinfo->id_state) {
         $this->errors[] = Tools::displayError("This country requires a state selection.");
     }
     ${${"GLOBALS"}["hdrwdzkfjgu"]} = $country->zip_code_format;
     $mlynabrtypu = "firstname";
     if ($country->need_zip_code) {
         $pttheklyj = "zip_code_format";
         $rbigoogxf = "postcode";
         $eyigihyebms = "postcode";
         ${"GLOBALS"}["plwthxmbdlo"] = "zip_code_format";
         $cxtukbkhyi = "postcode";
         if ((${$rbigoogxf} = Tools::getValue("postcode")) && ${${"GLOBALS"}["sjdohmx"]}) {
             ${"GLOBALS"}["svnohdsrl"] = "zip_code_format";
             ${"GLOBALS"}["izxvxdtqx"] = "zip_regexp";
             ${${"GLOBALS"}["izxvxdtqx"]} = "/^" . ${${"GLOBALS"}["sjdohmx"]} . "\$/ui";
             ${"GLOBALS"}["qrxaqqsef"] = "zip_regexp";
             ${"GLOBALS"}["sjdvshef"] = "zip_regexp";
             $tvchozgsi = "zip_regexp";
             ${"GLOBALS"}["ttwdyf"] = "zip_regexp";
             $vvtylsjtq = "postcode";
             ${"GLOBALS"}["ncdyrvfvd"] = "zip_regexp";
             ${$tvchozgsi} = str_replace(" ", "( |)", ${${"GLOBALS"}["ncdyrvfvd"]});
             ${"GLOBALS"}["jzxhhwlf"] = "zip_regexp";
             ${${"GLOBALS"}["sjdvshef"]} = str_replace("-", "(-|)", ${${"GLOBALS"}["rjvnbwy"]});
             ${${"GLOBALS"}["rjvnbwy"]} = str_replace("N", "[0-9]", ${${"GLOBALS"}["qrxaqqsef"]});
             ${${"GLOBALS"}["rjvnbwy"]} = str_replace("L", "[a-zA-Z]", ${${"GLOBALS"}["jzxhhwlf"]});
             ${${"GLOBALS"}["ttwdyf"]} = str_replace("C", $country->iso_code, ${${"GLOBALS"}["rjvnbwy"]});
             if (!preg_match(${${"GLOBALS"}["rjvnbwy"]}, ${$vvtylsjtq})) {
                 $this->errors[] = "<strong>" . Tools::displayError("Zip / Postal code") . "</strong> " . Tools::displayError("is invalid.") . "<br />" . Tools::displayError("Must be typed as follows:") . " " . str_replace("C", $country->iso_code, str_replace("N", "0", str_replace("L", "A", ${${"GLOBALS"}["svnohdsrl"]})));
             }
         } else {
             if (${$pttheklyj}) {
                 $this->errors[] = "<strong>" . Tools::displayError("Zip / Postal code") . "</strong> " . Tools::displayError("is required.");
             } else {
                 if (${$eyigihyebms} && !preg_match("/^[0-9a-zA-Z -]{4,9}\$/ui", ${$cxtukbkhyi})) {
                     $this->errors[] = "<strong>" . Tools::displayError("Zip / Postal code") . "</strong> " . Tools::displayError("is invalid.") . "<br />" . Tools::displayError("Must be typed as follows:") . " " . str_replace("C", $country->iso_code, str_replace("N", "0", str_replace("L", "A", ${${"GLOBALS"}["plwthxmbdlo"]})));
                 }
             }
         }
     }
     if ($country->isNeedDni() && (!Tools::getValue("dni") || !Validate::isDniLite(Tools::getValue("dni")))) {
         $this->errors[] = Tools::displayError("Identification number is incorrect or has already been used.");
     }
     $this->sellerinfo->dni = Tools::getValue("dni");
     $this->sellerinfo->latitude = Tools::getValue("latitude");
     $this->sellerinfo->longitude = Tools::getValue("longitude");
     $this->sellerinfo->id_sellertype1 = Tools::getValue("id_sellertype1");
     $this->sellerinfo->id_sellertype2 = Tools::getValue("id_sellertype2");
     SellerInfo::processLogoUpload($this->sellerinfo);
     $this->errors = array_merge($this->errors, $this->sellerinfo->validateController());
     if (!empty($this->errors)) {
         return;
     }
     ${${"GLOBALS"}["rdkumopydcrd"]} = new Customer();
     $customer->firstname = ${$mlynabrtypu};
     $customer->lastname = ${${"GLOBALS"}["ptvgwodrri"]};
     $customer->email = ${${"GLOBALS"}["cyutgacgwj"]};
     $customer->is_guest = 1;
     $customer->active = 1;
     $lkenglu = "customer";
     if ($customer->add()) {
         if (!$this->sendConfirmationMail(${${"GLOBALS"}["rdkumopydcrd"]})) {
             $this->errors[] = Tools::displayError("The email cannot be sent.");
         }
     } else {
         $this->errors[] = Tools::displayError("Error during create a new customer account.");
         return;
     }
     $this->updateContext(${$ufvrdeas});
     Hook::exec("actionCustomerAccountAdd", array("_POST" => $_POST, "newCustomer" => ${$lkenglu}));
     if (empty($this->_errors)) {
         ${"GLOBALS"}["brdlwjleiw"] = "url";
         ${"GLOBALS"}["fnsbgq"] = "url";
         AgileMultipleSeller::createSellerAccount(${${"GLOBALS"}["rdkumopydcrd"]});
         ${${"GLOBALS"}["brdlwjleiw"]} = $this->context->link->getModuleLink("agilemultipleseller", "sellersignup", array(), true);
         Tools::redirect(${${"GLOBALS"}["fnsbgq"]});
     }
 }
Ejemplo n.º 2
0
 public function processSave()
 {
     AgileMultipleSeller::ensure_date_custom_field();
     $this->object = $this->loadObject();
     $this->errors = array_merge($this->errors, $this->object->validateController());
     $this->object->save();
     SellerInfo::processLogoUpload($this->object);
 }
 protected function processSubmitSellerinfo()
 {
     $lang_cookie = self::$cookie->id_lang;
     if ($lang_cookie != 1) {
         $_POST['address1_1'] = $_POST['address1_' . $lang_cookie];
         $_POST['address2_1'] = $_POST['address1_' . $lang_cookie];
         $_POST['address2_1'] = $_POST['address1_' . $lang_cookie];
         $_POST['city_1'] = $_POST['city_' . $lang_cookie];
         $_POST['description_1'] = $_POST['description_' . $lang_cookie];
     }
     ${"GLOBALS"}["vjnnsubap"] = "list";
     $vhheljumal = "selected_country";
     $zryhlvp = "list";
     $tjuksry = "countries";
     ${"GLOBALS"}["vpjnzdqa"] = "countries";
     if (Tools::isSubmit("id_country") && !is_null(Tools::getValue("id_country")) && is_numeric(Tools::getValue("id_country"))) {
         ${$vhheljumal} = (int) Tools::getValue("id_country");
     } else {
         if (isset($this->sellerinfo) && isset($this->sellerinfo->id_country) && !empty($this->sellerinfo->id_country) && is_numeric($this->sellerinfo->id_country)) {
             ${${"GLOBALS"}["ontiydub"]} = (int) $this->sellerinfo->id_country;
         } else {
             if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) {
                 $duwbhhjzvvl = "array";
                 ${$duwbhhjzvvl} = preg_split("/,|-/", $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
                 if (!Validate::isLanguageIsoCode(${${"GLOBALS"}["tjlrhpthnf"]}[0]) || !(${${"GLOBALS"}["ontiydub"]} = Country::getByIso(${${"GLOBALS"}["tjlrhpthnf"]}[0]))) {
                     ${${"GLOBALS"}["ontiydub"]} = (int) Configuration::get("PS_COUNTRY_DEFAULT");
                 }
             } else {
                 ${${"GLOBALS"}["ontiydub"]} = (int) Configuration::get("PS_COUNTRY_DEFAULT");
             }
         }
     }
     if (Configuration::get("PS_RESTRICT_DELIVERED_COUNTRIES")) {
         ${${"GLOBALS"}["vpjnzdqa"]} = Carrier::getDeliveredCountries($this->context->language->id, true, true);
     } else {
         ${${"GLOBALS"}["coohkibbnl"]} = Country::getCountries($this->context->language->id, true);
     }
     ${$zryhlvp} = "";
     $countries = ${$tjuksry};
     /**************** LANGUAGE LEVEL *******************/
     $seller_id_lang = $this->sellerinfo->id_seller;
     $langLevel = Tools::getValue("lang_level");
     $dialect = Tools::getValue("lang");
     $main_lang = Tools::getValue('main_lang');
     /*foreach ($dialect as $key => $value) {
           $level = $langLevel[$key];
           Db::getInstance(_PS_USE_SQL_SLAVE_)->execute("
               INSERT INTO " . _DB_PREFIX_ . "sellerinfo_language (seller_id, language, language_level)
               VALUES ('$seller_id_lang', '$value', '$level')
           ");
       }*/
     // die('<pre>' . print_r($dialect, true));
     $langLevel = implode(',', Tools::getValue("lang_level"));
     $languages = implode(',', Tools::getValue("lang"));
     $this->sellerinfo->language = $languages;
     $this->sellerinfo->language_level = $langLevel;
     $this->sellerinfo->main_language = $main_lang;
     $jlbwjt = "shop_name";
     ${"GLOBALS"}["oonrqhi"] = "shop_name";
     ${"GLOBALS"}["zlobvkbr"] = "virtual_uri";
     AgileMultipleSeller::ensure_date_custom_field();
     $uskhfeodhv = "zip_code_format";
     ${${"GLOBALS"}["oonrqhi"]} = "";
     if (isset($_POST["shop_name"])) {
         ${$jlbwjt} = trim($_POST["shop_name"], " ");
     }
     $famsbcd = "country";
     if (isset($_POST["virtual_uri"])) {
         ${${"GLOBALS"}["zlobvkbr"]} = Tools::link_rewrite(trim($_POST["virtual_uri"], " /")) . "/";
     }
     /*if (empty($_POST["postcode"]))
       $this->errors[] = Tools::displayError("Postcode is required field.");*/
     if (empty($_POST["address1_1"])) {
         $this->errors[] = Tools::displayError("Address is required field.");
     }
     if (empty($_POST["city_1"])) {
         $this->errors[] = Tools::displayError("City is required field.");
     }
     if (empty($_POST["phone"])) {
         $this->errors[] = Tools::displayError("Phone is required field.");
     }
     $this->errors = array_merge($this->errors, $this->sellerinfo->validateController());
     $this->sellerinfo->id_customer = self::$cookie->id_customer;
     if (Module::isInstalled("agilemultipleshop")) {
         $mcovgfrp = "shop_name";
         ${"GLOBALS"}["xdpblji"] = "seller_shopurl";
         if (empty(${$mcovgfrp})) {
             $this->errors[] = Tools::displayError("The shop name can not be empty.");
         }
         if (empty($_POST["virtual_uri"]) and (int) Configuration::get("ASP_SHOP_URL_MODE") == agilemultipleshop::SHOP_URL_MODE_VIRTUAL) {
             $this->errors[] = Tools::displayError("The shop Virtual Uri can not be empty.");
         }
         ${"GLOBALS"}["edessnqo"] = "id_found";
         ${"GLOBALS"}["kkzhciyk"] = "seller_shop";
         if ($this->sellerinfo->id_shop <= 1) {
             $this->sellerinfo->id_shop = 0;
         }
         ${${"GLOBALS"}["kkzhciyk"]} = new Shop($this->sellerinfo->id_shop);
         if (Shop::shop_name_duplicated(${${"GLOBALS"}["oxjolt"]}, $seller_shop->id)) {
             $this->errors[] = Tools::displayError("The shop name you select has been used by other seller. Please choose a new one.");
         }
         ${"GLOBALS"}["asepnxuok"] = "seller_shop";
         if ($this->errors) {
             return;
         }
         if (!Validate::isLoadedObject(${${"GLOBALS"}["asepnxuok"]})) {
             $this->sellerinfo->id_shop = AgileMultipleShop::create_new_shop($this->sellerinfo->id_seller, ${${"GLOBALS"}["oxjolt"]});
             $this->sellerinfo->update();
             ${${"GLOBALS"}["esrnnrtkg"]} = new Shop($this->sellerinfo->id_shop);
         }
         ${${"GLOBALS"}["xdpblji"]} = new ShopUrl(Shop::get_main_url_id($seller_shop->id));
         ${${"GLOBALS"}["edessnqo"]} = $seller_shopurl->canAddThisUrl($seller_shopurl->domain, $seller_shopurl->domain_ssl, $seller_shopurl->physical_uri, ${${"GLOBALS"}["uovivsqns"]});
         if (intval(${${"GLOBALS"}["vphoqso"]}) > 0) {
             $this->errors[] = Tools::displayError("The uri you select has been used by other seller. Please choose a new one.");
         }
     }
     ${"GLOBALS"}["uehqptpfhppm"] = "seller_shop";
     if (!(${${"GLOBALS"}["flggvi"]} = new Country($this->sellerinfo->id_country)) || !Validate::isLoadedObject(${$famsbcd})) {
         throw new PrestaShopException("Country cannot be loaded with address->id_country");
     }
     if ((int) $country->contains_states && !(int) $this->sellerinfo->id_state) {
         $this->errors[] = Tools::displayError("This country requires a state selection.");
     }
     ${$uskhfeodhv} = $country->zip_code_format;
     if ($country->need_zip_code) {
         $guefxsgyxvp = "zip_code_format";
         ${"GLOBALS"}["ayucbbdhdhcq"] = "zip_code_format";
         $krvjmkmqh = "postcode";
         ${"GLOBALS"}["smbwfoxbj"] = "zip_code_format";
         if ((${${"GLOBALS"}["wnwubvg"]} = Tools::getValue("postcode")) && ${${"GLOBALS"}["ayucbbdhdhcq"]}) {
             ${"GLOBALS"}["gusjike"] = "zip_regexp";
             ${"GLOBALS"}["bgahkjn"] = "zip_regexp";
             $edhlvb = "zip_regexp";
             ${"GLOBALS"}["yvbcolkxptn"] = "zip_regexp";
             $pslxhegowq = "zip_regexp";
             ${${"GLOBALS"}["ctdciodhb"]} = "/^" . ${${"GLOBALS"}["ebwpvmqblmd"]} . "\$/ui";
             ${"GLOBALS"}["mivinoyltqoh"] = "zip_regexp";
             ${$pslxhegowq} = str_replace(" ", "( |)", ${${"GLOBALS"}["ctdciodhb"]});
             ${${"GLOBALS"}["mivinoyltqoh"]} = str_replace("-", "(-|)", ${${"GLOBALS"}["bgahkjn"]});
             ${${"GLOBALS"}["ctdciodhb"]} = str_replace("N", "[0-9]", ${${"GLOBALS"}["gusjike"]});
             ${${"GLOBALS"}["ctdciodhb"]} = str_replace("L", "[a-zA-Z]", ${${"GLOBALS"}["ctdciodhb"]});
             ${${"GLOBALS"}["ctdciodhb"]} = str_replace("C", $country->iso_code, ${${"GLOBALS"}["yvbcolkxptn"]});
             // if (!preg_match(${$edhlvb}, ${${"GLOBALS"}["wnwubvg"]}))
             // $this->errors[] = "<strong>" . Tools::displayError("Zip / Postal code") . "</strong> " . Tools::displayError("is invalid.") . "<br />" . Tools::displayError("Must be typed as follows:") . " " . str_replace("C", $country->iso_code, str_replace("N", "0", str_replace("L", "A", ${${"GLOBALS"}["ebwpvmqblmd"]})));
         }
         /*else if (${$guefxsgyxvp})
                   $this->errors[] = "<strong>" . Tools::displayError("Zip / Postal code") . "</strong> " . Tools::displayError("is required.");
               else if (${${"GLOBALS"}["wnwubvg"]} && !preg_match("/^[0-9a-zA-Z -]{4,9}\$/ui", ${$krvjmkmqh}))
                   $this->errors[] = "<strong>" . Tools::displayError("Zip / Postal code") . "</strong> " . Tools::displayError("is invalid.") . "<br />" . Tools::displayError("Must be typed as follows:") . " " . str_replace("C", $country->iso_code, str_replace("N", "0", str_replace("L", "A", ${${"GLOBALS"}["smbwfoxbj"]})));
           */
     }
     if ($country->isNeedDni() && (!Tools::getValue("dni") || !Validate::isDniLite(Tools::getValue("dni")))) {
         $this->errors[] = Tools::displayError("Identification number is incorrect or has already been used.");
     }
     $this->sellerinfo->dni = Tools::getValue("dni");
     $this->sellerinfo->latitude = Tools::getValue("latitude");
     $this->sellerinfo->longitude = Tools::getValue("longitude");
     $this->sellerinfo->id_sellertype1 = Tools::getValue("id_sellertype1");
     $this->sellerinfo->id_sellertype2 = Tools::getValue("id_sellertype2");
     // echo '<pre>', print_r($_FILES, true) , '</pre>';
     SellerInfo::processLogoUpload($this->sellerinfo);
     SellerInfo::processLicenseUpload($this->sellerinfo);
     $this->errors = array_merge($this->errors, $this->sellerinfo->validateController());
     if (!empty($this->errors)) {
         return;
     }
     $this->sellerinfo->save();
     if (Module::isInstalled("agilemultipleshop") and Validate::isLoadedObject(${${"GLOBALS"}["uehqptpfhppm"]})) {
         $wrheluzg = "shop_name";
         $seller_shop->name = ${$wrheluzg};
         $seller_shop->save();
         ${"GLOBALS"}["sxuwmytjl"] = "virtual_uri";
         $seller_shopurl->virtual_uri = ${${"GLOBALS"}["sxuwmytjl"]};
         $seller_shopurl->save();
         Tools::generateHtaccess();
     }
     if (empty($this->errors)) {
         self::$smarty->assign("cfmmsg_flag", 1);
     }
 }