From fba95afdccd1c143f577db97e009ad4d74f4a895 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 17 Oct 2013 09:36:45 +0200 Subject: [PATCH] // Removed deprecated modules --- modules/importerosc/ajax.php | 17 - modules/importerosc/config.xml | 12 - modules/importerosc/importerosc.php | 631 -------- modules/importerosc/index.php | 35 - modules/importerosc/logo.gif | Bin 2378 -> 0 bytes modules/importerosc/logo.png | Bin 2595 -> 0 bytes modules/importerosc/passwordhash.php | 254 ---- modules/importerosc/translations/index.php | 35 - modules/shopimporter/ajax.php | 214 --- modules/shopimporter/config.xml | 12 - modules/shopimporter/img/ajax-loader.gif | Bin 1849 -> 0 bytes modules/shopimporter/img/delete.gif | Bin 992 -> 0 bytes modules/shopimporter/img/error.png | Bin 1061 -> 0 bytes modules/shopimporter/img/file.png | Bin 330 -> 0 bytes modules/shopimporter/img/force.gif | Bin 971 -> 0 bytes modules/shopimporter/img/index.php | 35 - modules/shopimporter/img/ok.png | Bin 1162 -> 0 bytes modules/shopimporter/img/skip.png | Bin 1508 -> 0 bytes modules/shopimporter/img/stop.png | Bin 1496 -> 0 bytes modules/shopimporter/img/warn.png | Bin 1061 -> 0 bytes modules/shopimporter/index.php | 35 - modules/shopimporter/logo.gif | Bin 379 -> 0 bytes modules/shopimporter/logo.png | Bin 1489 -> 0 bytes modules/shopimporter/shopimporter.js | 910 ----------- modules/shopimporter/shopimporter.php | 1522 ------------------- modules/shopimporter/translations/index.php | 35 - 26 files changed, 3747 deletions(-) delete mode 100644 modules/importerosc/ajax.php delete mode 100644 modules/importerosc/config.xml delete mode 100644 modules/importerosc/importerosc.php delete mode 100644 modules/importerosc/index.php delete mode 100644 modules/importerosc/logo.gif delete mode 100644 modules/importerosc/logo.png delete mode 100755 modules/importerosc/passwordhash.php delete mode 100644 modules/importerosc/translations/index.php delete mode 100644 modules/shopimporter/ajax.php delete mode 100644 modules/shopimporter/config.xml delete mode 100644 modules/shopimporter/img/ajax-loader.gif delete mode 100644 modules/shopimporter/img/delete.gif delete mode 100644 modules/shopimporter/img/error.png delete mode 100644 modules/shopimporter/img/file.png delete mode 100644 modules/shopimporter/img/force.gif delete mode 100644 modules/shopimporter/img/index.php delete mode 100644 modules/shopimporter/img/ok.png delete mode 100644 modules/shopimporter/img/skip.png delete mode 100644 modules/shopimporter/img/stop.png delete mode 100644 modules/shopimporter/img/warn.png delete mode 100644 modules/shopimporter/index.php delete mode 100644 modules/shopimporter/logo.gif delete mode 100755 modules/shopimporter/logo.png delete mode 100644 modules/shopimporter/shopimporter.js delete mode 100644 modules/shopimporter/shopimporter.php delete mode 100644 modules/shopimporter/translations/index.php diff --git a/modules/importerosc/ajax.php b/modules/importerosc/ajax.php deleted file mode 100644 index 3e6c316d1..000000000 --- a/modules/importerosc/ajax.php +++ /dev/null @@ -1,17 +0,0 @@ -server = Tools::getValue('server'); -$importOsc->user = Tools::getValue('user'); -$importOsc->passwd = Tools::getValue('password'); -$importOsc->database = Tools::getValue('database'); -$importOsc->prefix = Tools::getValue('prefix'); - -die($importOsc->createLevelAndCalculate()); \ No newline at end of file diff --git a/modules/importerosc/config.xml b/modules/importerosc/config.xml deleted file mode 100644 index 91f4912e7..000000000 --- a/modules/importerosc/config.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - importerosc - - - - - - 0 - 1 - - \ No newline at end of file diff --git a/modules/importerosc/importerosc.php b/modules/importerosc/importerosc.php deleted file mode 100644 index 25a5f1329..000000000 --- a/modules/importerosc/importerosc.php +++ /dev/null @@ -1,631 +0,0 @@ - -* @copyright 2007-2013 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -if (!defined('_PS_VERSION_')) - exit; - -class importerosc extends ImportModule -{ - public function __construct() - { - $this->name = 'importerosc'; - $this->tab = 'migration_tools'; - $this->version = '1.0'; - $this->author = 'PrestaShop'; - $this->theImporter = 1; - $this->need_instance = 1; - - parent::__construct (); - - $this->displayName = $this->l('Importer osCommerce'); - $this->description = $this->l('This module allows you to import from osCommerce to Prestashop.'); - } - - public function install() - { - if (!parent::install() || !$this->registerHook('beforeAuthentication')) - return false; - return true; - } - - public function uninstall() - { - if (!parent::uninstall()) - return false; - return true; - } - - public function displaySpecificOptions() - { - $html = ''; - if (!$this->checkCategoriesLevel()) - $html .= $this->displayCategoriesLevelConf(); - - $langagues = $this->executeS('SELECT * FROM `'.bqSQL($this->prefix).'languages`'); - $curencies = $this->executeS('SELECT * FROM `'.bqSQL($this->prefix).'currencies`'); - - $html .= ' -
-
- -
-
'; - $html .= ' -
- http:/// -

'.$this->l('Specify the root URL of your site oscommerce').'

-
'; - return $html; - } - - - public function validateSpecificOptions() - { - $errors = array(); - if (Tools::getValue('defaultOscLang') == 0) - $errors[] = $this->l('Please select a default language'); - if (Tools::getValue('defaultOscCurrency') == 0) - $errors[] = $this->l('Please select a default currency'); - if (Tools::getValue('shop_url') == '') - $errors[] = $this->l('Please set your shop url'); - if (!sizeof($errors)) - die('{"hasError" : false, "error" : []}'); - else - die('{"hasError" : true, "error" : '.Tools::jsonEncode($errors).'}'); - } - - - public function getDefaultIdLang () - { - return Tools::getValue('defaultOscLang'); - } - - public function getDefaultIdCurrency () - { - return Tools::getValue('defaultOscCurrency'); - } - - - public function getLangagues($limit = 0, $nrb_import = 100) - { - $identifier = 'id_lang'; - - $langagues = $this->executeS(' - SELECT languages_id as id_lang, name as name, code as iso_code, 1 as active, (\'m/j/Y\') as date_format_lite, (\'m/j/Y H:i:s\') as date_format_full - FROM `'.bqSQL($this->prefix).'languages` - LIMIT '.(int)$limit.' , '.(int)$nrb_import); - return $this->autoFormat($langagues, $identifier); - } - - public function getCurrencies($limit = 0, $nrb_import = 100) - { - $identifier = 'id_currency'; - $currencies = $this->executeS(' - SELECT currencies_id as id_currency, title as name, code as iso_code, 0 as format, 999 as iso_code_num, 1 as decimals, - CONCAT(`symbol_left`, `symbol_right`) as sign, value as conversion_rate - FROM `'.bqSQL($this->prefix).'currencies` LIMIT '.(int)($limit).' , '.(int)$nrb_import - ); - return $this->autoFormat($currencies, $identifier); - } - - public function getZones($limit = 0, $nrb_import = 100) - { - $identifier = 'id_zone'; - $zones = $this->executeS('SELECT geo_zone_id as id_zone, geo_zone_name as name, 1 as active FROM `'.bqSQL($this->prefix).'geo_zones` LIMIT '.(int)($limit).' , '.(int)$nrb_import); - return $this->autoFormat($zones, $identifier); - } - - public function getCountries($limit = 0, $nrb_import = 100) - { - $multiLangFields = array('name'); - $keyLanguage = 'id_lang'; - $identifier = 'id_country'; - $defaultIdLang = $this->getDefaultIdLang(); - $countries = $this->executeS(' - SELECT countries_id as id_country, countries_name as name, countries_iso_code_2 as iso_code, '.(int)$defaultIdLang.' as id_lang, - 1 as id_zone, 0 as id_currency, 1 as contains_states, 1 as need_identification_number, 1 as active, 1 as display_tax_label - FROM `'.bqSQL($this->prefix).'countries` as c LIMIT '.(int)($limit).' , '.(int)$nrb_import); - - return $this->autoFormat($countries, $identifier, $keyLanguage, $multiLangFields); - } - - public function getStates($limit = 0, $nrb_import = 100) - { - $identifier = 'id_state'; - $states = array( - 0 => array( - 'id_state' => 0, - 'id_country' => 0, - 'id_zone' => 0, - 'iso_code' => 999, - 'name' => 'osc', - 'active' => 0 - ) - ); - return $this->autoFormat($states, $identifier); - } - - public function getGroups() - { - $idLang = $this->getDefaultIdLang(); - return array( 1 => array( - 'id_group' => 1, - 'price_display_method' => 0, - 'name' => array($idLang => $this->l('Default osCommerce Group')) - ) - ); - } - - public function getCustomers($limit = 0, $nrb_import = 100) - { - $genderMatch = array('m' => 1,'f' => 2); - $identifier = 'id_customer'; - $customers = $this->executeS(' - SELECT c.`customers_id` as id_customer, 1 as id_default_group, c.`customers_gender` as id_gender, c.`customers_firstname` as firstname, - IFNULL( STRCMP(c.`customers_newsletter`, \'\') , 0 ) as newsletter, c.`customers_lastname` as lastname, - DATE(c.`customers_dob`) as birthday, c.`customers_email_address` as email, c.`customers_password` as passwd, 1 as active, - ci.`customers_info_date_account_created` as date_add - FROM `'.bqSQL($this->prefix).'customers` c - LEFT JOIN `'.bqSQL($this->prefix).'customers_info` ci ON (c.`customers_id` = ci.`customers_info_id`) - LIMIT '.(int)($limit).' , '.(int)$nrb_import - ); - - foreach($customers AS &$customer) - if (isset($customer['id_gender']) && array_key_exists($customer['id_gender'], $genderMatch)) - $customer['id_gender'] = $genderMatch[$customer['id_gender']]; - else - $customer['id_gender'] = 0; - - return $this->autoFormat($customers, $identifier); - } - - public function getAddresses($limit = 0, $nrb_import = 100) - { - $identifier = 'id_address'; - $addresses = $this->executeS(' - SELECT address_book_id as id_address, customers_id as id_customer, CONCAT(customers_id, \'_address\') as alias, entry_company as company, entry_firstname as firstname, - entry_lastname as lastname, entry_street_address as address1, entry_postcode as postcode, entry_city as city, entry_country_id as id_country, 0 as id_state - FROM `'.bqSQL($this->prefix).'address_book` LIMIT '.(int)($limit).' , '.(int)$nrb_import); - return $this->autoFormat($addresses, $identifier); - } - - public function getCategories($limit = 0, $nrb_import = 100) - { - $multiLangFields = array('name', 'link_rewrite'); - $keyLanguage = 'id_lang'; - $identifier = 'id_category'; - $categories = $this->executeS(' - SELECT c.categories_id as id_category, c.parent_id as id_parent, level as level_depth, cd.language_id as id_lang, cd.categories_name as name , 1 as active, categories_image as images, c.date_added as date_add - FROM `'.bqSQL($this->prefix).'categories` c - LEFT JOIN `'.bqSQL($this->prefix).'categories_description` cd ON (c.categories_id = cd.categories_id) - WHERE cd.categories_name IS NOT NULL AND cd.language_id IS NOT NULL - ORDER BY c.level ASC , c.`categories_id` - LIMIT '.(int)($limit).' , '.(int)$nrb_import); - foreach($categories as& $cat) - { - $cat['link_rewrite'] = Tools::link_rewrite($cat['name']); - $cat['images'] = array(Tools::getProtocol().Tools::getValue('shop_url').'/images/'.$cat['images']); - } - - return $this->autoFormat($categories, $identifier, $keyLanguage, $multiLangFields); - } - - public function getAttributesGroups($limit = 0, $nrb_import = 100) - { - $multiLangFields = array('name', 'public_name'); - $keyLanguage = 'id_lang'; - $identifier = 'id_attribute_group'; - $countries = $this->executeS(' - SELECT products_options_id as id_attribute_group, products_options_name as name , products_options_name as public_name, language_id as id_lang, 0 as is_color_group - FROM `'.bqSQL($this->prefix).'products_options` - LIMIT '.(int)($limit).' , '.(int)$nrb_import); - return $this->autoFormat($countries, $identifier, $keyLanguage, $multiLangFields); - } - - public function getAttributes($limit = 0, $nrb_import = 100) - { - $multiLangFields = array('name'); - $keyLanguage = 'id_lang'; - $identifier = 'id_attribute'; - $countries = $this->executeS(' - SELECT p.`products_options_values_id` as id_attribute, p.`products_options_values_name` as name, p.`language_id` as id_lang , po.`products_options_id` as id_attribute_group - FROM `'.bqSQL($this->prefix).'products_options_values` p - LEFT JOIN `'.bqSQL($this->prefix).'products_options_values_to_products_options` po ON (po.products_options_values_id = p.products_options_values_id) - ORDER BY p.`products_options_values_id` - LIMIT '.(int)($limit).' , '.(int)$nrb_import); - return $this->autoFormat($countries, $identifier, $keyLanguage, $multiLangFields); - } - - public function getProducts($limit = 0, $nrb_import = 100) - { - $multiLangFields = array('name', 'link_rewrite', 'description'); - $keyLanguage = 'id_lang'; - $identifier = 'id_product'; - $products = $this->executeS(' - SELECT p.`products_id` as id_product, p.`products_quantity` as quantity, p.`products_model` as reference, p.`products_price` as price, p.`products_weight` as weight, - IFNULL(STRCMP(p.`products_status`, \'\') , 0 ) as active, p.`manufacturers_id` as id_manufacturer, pd.language_id as id_lang, pd.products_name as name, - pd.products_description as description, CONCAT(\''.pSQL(Tools::getProtocol()).pSQL(Tools::getValue('shop_url')).'\/images/\',p.`products_image`) as images, - (SELECT ptc.categories_id FROM `'.bqSQL($this->prefix).'products_to_categories` ptc WHERE ptc.`products_id` = p.`products_id` LIMIT 1) as id_category_default, - p.`products_date_added` as date_add - FROM `'.bqSQL($this->prefix).'products` p - LEFT JOIN `'.bqSQL($this->prefix).'products_description` pd ON (p.products_id = pd.products_id) - WHERE pd.products_name IS NOT NULL AND pd.language_id IS NOT NULL - ORDER BY p.`products_id` - LIMIT '.(int)($limit).' , '.(int)$nrb_import); - - $this->execute('CREATE TABLE IF NOT EXISTS`products_images` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `products_id` int(11) NOT NULL, - `image` varchar(64) DEFAULT NULL, - `htmlcontent` text, - `sort_order` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `products_images_prodid` (`products_id`) - )'); - foreach($products as& $product) - { - $result = $this->executeS('SELECT `image` FROM `'.bqSQL($this->prefix).'products_images` WHERE products_id = '.(int)$product['id_product']); - $images = array(); - foreach($result as $res) - $images[] = Tools::getProtocol().Tools::getValue('shop_url').'/images/'.$res['image']; - $product['images'] = array_merge(array($product['images']), $images); - $product['link_rewrite'] = Tools::link_rewrite($product['name']); - - - $result = $this->executeS('SELECT `categories_id` FROM `'.bqSQL($this->prefix).'products_to_categories` WHERE products_id = '.(int)$product['id_product']); - $category_product = array('category_product' => array($product['id_category_default'] => $product['id_product'])); - foreach($result as $res) - $category_product['category_product'][$res['categories_id']] = $product['id_product']; - $product['association'] = $category_product; - } - return $this->autoFormat($products, $identifier, $keyLanguage, $multiLangFields); - } - - public function getProductsCombination($limit = 0, $nrb_import = 100) - { - $identifier = 'id_product_attribute'; - $combinations = $this->executeS(' - SELECT products_attributes_id as id_product_attribute, products_id as id_product, options_values_price as price, options_values_id - FROM `'.bqSQL($this->prefix).'products_attributes` LIMIT '.(int)($limit).' , '.(int)$nrb_import); - foreach($combinations as& $combination) - { - $combination['association'] = array('product_attribute_combination' => array($combination['options_values_id'] => $combination['id_product_attribute'])); - unset($combination['options_values_id']); - } - return $this->autoFormat($combinations, $identifier); - } - - public function getManufacturers($limit = 0, $nrb_import = 100) - { - $identifier = 'id_manufacturer'; - $manufacturers = $this->executeS(' - SELECT manufacturers_id as id_manufacturer, manufacturers_name as name, 1 as active, manufacturers_image as images - FROM `'.bqSQL($this->prefix).'manufacturers` LIMIT '.(int)($limit).' , '.(int)$nrb_import); - foreach($manufacturers as& $manufacturer) - $manufacturer['images'] = array(Tools::getProtocol().Tools::getValue('shop_url').'/images/'.$manufacturer['images']); - - return $this->autoFormat($manufacturers, $identifier); - } - - public function getOrdersStates($limit = 0, $nrb_import = 100) - { - $multiLangFields = array('name'); - $keyLanguage = 'id_lang'; - $identifier = 'id_order_state'; - $ordersStates = $this->executeS(' - SELECT `orders_status_id` as id_order_state, `language_id` as id_lang, `orders_status_name` as name , 1 as hidden - FROM `'.bqSQL($this->prefix).'orders_status` - LIMIT '.(int)($limit).' , '.(int)$nrb_import);//IF(`public_flag` = 0, 1, 0) as hidden - return $this->autoFormat($ordersStates, $identifier, $keyLanguage, $multiLangFields); - } - - public function getOrders($limit = 0, $nrb_import = 100) - { - $orders = array(); - $addresses = $this->executeS('SELECT customers_id as id_customer, address_book_id as id_address FROM `'.bqSQL($this->prefix).'address_book` GROUP BY customers_id'); - $matchAddresses = array(); - foreach($addresses as $address) - $matchAddresses[$address['id_customer']] = $address['id_address']; - $psCarrierDefault = (int)Configuration::get('PS_CARRIER_DEFAULT'); - $psCurrency = Currency::getCurrencies(); - - foreach($psCurrency as $key => $currency) - { - $psCurrency[$currency['iso_code']] = $currency['id_currency']; - unset($psCurrency[$key]); - } - - $orders = $this->executeS(' - SELECT orders_id as id_cart, '.$psCarrierDefault.' as id_carrier, 1 as id_lang, currency as id_currency, customers_id as id_customer, payment_method as payment, 1 as valid, - date_purchased as date_add, last_modified as date_upd - FROM `'.bqSQL($this->prefix).'orders` LIMIT '.(int)($limit).' , '.(int)$nrb_import); - foreach($orders as $key => $order) - { - $orders[$key]['id_currency'] = (array_key_exists($order['id_currency'], $psCurrency) ? $psCurrency[$order['id_currency']] : 0); - $orders[$key]['id_address_delivery'] = (array_key_exists($order['id_customer'], $matchAddresses) ? $matchAddresses[$order['id_customer']] : 0); - $orders[$key]['id_address_invoice'] = (array_key_exists($order['id_customer'], $matchAddresses) ? $matchAddresses[$order['id_customer']] : 0); - $orders[$key]['total_paid'] = $this->getValue('SELECT value FROM `'.bqSQL($this->prefix).'orders_total` WHERE `orders_id` = '.(int)$order['id_cart'].' AND class=\'ot_total\''); - $orders[$key]['total_paid_real'] = $this->getValue('SELECT value FROM `'.bqSQL($this->prefix).'orders_total` WHERE `orders_id` = '.(int)$order['id_cart'].' AND class=\'ot_total\''); - $orders[$key]['total_products'] = $this->getValue('SELECT value FROM `'.bqSQL($this->prefix).'orders_total` WHERE `orders_id` = '.(int)$order['id_cart'].' AND class=\'ot_shipping\''); - $tax = $this->getValue('SELECT value FROM `'.bqSQL($this->prefix).'orders_total` WHERE `orders_id` = '.(int)$order['id_cart'].' AND class=\'ot_tax\''); - $orders[$key]['total_products_wt'] = $this->getValue('SELECT value FROM `'.bqSQL($this->prefix).'orders_total` WHERE `orders_id` = '.(int)$order['id_cart'].' AND class=\'ot_total\'') - $tax; - $orders[$key]['total_shipping'] = $this->getValue('SELECT value FROM `'.bqSQL($this->prefix).'orders_total` WHERE `orders_id` = '.(int)$order['id_cart'].' AND class=\'ot_shipping\''); - $orders[$key]['total_discounts'] = 0; - $orders[$key]['total_wrapping'] = 0; - $orders[$key]['cart_products'] = $this->executeS(' - SELECT `orders_id` as id_cart, `products_id` as id_product, 0 as id_product_attribute, `products_quantity` as quantity - FROM `'.bqSQL($this->prefix).'orders_products` WHERE `orders_id` = '.(int)$order['id_cart']); - $orders[$key]['order_products'] = $this->executeS(' - SELECT `orders_id` as id_order, `products_id` as product_id, 0 as product_attribute_id, `products_name` as product_name, `products_quantity` as product_quantity, - `final_price` as product_price, 0 as product_weight - FROM `'.bqSQL($this->prefix).'orders_products` WHERE `orders_id` = '.(int)$order['id_cart']); - $orders[$key]['order_history'] = $this->executeS(' - SELECT `orders_status_history_id` as id_order_history, 0 as id_employee, `orders_id` as id_order, `orders_status_id` as id_order_state, `date_added` as date_add - FROM `'.bqSQL($this->prefix).'orders_status_history` WHERE `orders_id` = '.(int)$order['id_cart']); - - } - return $orders; - } - - private function autoFormat($items, $identifier, $keyLanguage = NULL, $multiLangFields = array()) - { - $array = array(); - foreach ($items AS $item) - if (sizeof($multiLangFields) && is_array($multiLangFields) && isset($array[$item[$identifier]][$multiLangFields[0]])) - foreach ($multiLangFields AS $key) - $array[$item[$identifier]][$key][$item[$keyLanguage]] = $item[$key]; - else - foreach ($item AS $key => $value) - if (sizeof($multiLangFields) AND in_array($key, $multiLangFields)) - $array[$item[$identifier]][$key] = array($item[$keyLanguage] => $value); - elseif (sizeof($multiLangFields) AND $key == $keyLanguage) - continue; - else - $array[$item[$identifier]][$key] = $value; - return $array; - } - - public function hookbeforeAuthentication($params) - { - $passwd = trim(Tools::getValue('passwd')); - $email = trim(Tools::getValue('email')); - $result = Db::getInstance()->GetRow(' - SELECT * - FROM `'._DB_PREFIX_ .'customer` - WHERE `active` = 1 AND `email` = \''.pSQL($email).'\''); - if ($result && !empty($result['passwd_'.$this->name])) - { - if($this->checkPwd($passwd, $result['passwd_'.pSQL($this->name)])) - { - $ps_passwd = md5(pSQL(_COOKIE_KEY_.$passwd)); - Db::getInstance()->execute(' - UPDATE `'._DB_PREFIX_.'customer` - SET `passwd` = \''.pSQL($ps_passwd).'\', `passwd_'.bqSQL($this->name).'` = \'\' - WHERE `'._DB_PREFIX_.'customer`.`id_customer` ='.(int)$result['id_customer'].' LIMIT 1'); - } - } - - } - - private function checkPwd($passwd, $encrypt_pwd) - { - //checks the type of encryption password - if (preg_match('/^[A-Z0-9]{32}\:[A-Z0-9]{2}$/i', $encrypt_pwd) === 1) - { - //salt - $stack = explode(':', $encrypt_pwd); - if (sizeof($stack) != 2) - return false; - - if (md5($stack[1] . $passwd) == $stack[0]) - return true; - else - return false; - } - else - { - //phpass - if (file_exists(dirname(__FILE__).'/passwordhash.php')) - { - include(dirname(__FILE__).'/passwordhash.php'); - $hasher = new PasswordHash(10, true); - return $hasher->CheckPassword($passwd, $encrypt_pwd); - } - else - return false; - } - - } - - public function displayConfigConnector() - { - $content = ' - -
- -

'.$this->l('(eg : mysql.mydomain.com)').'

-
- -
- -
- -
- -

'.$this->l('(password can be empty)').'

-
- -
- -
- -
- -

'.$this->l('(The prefix is optional. If all of your database tables start with "pref_", your prefix is "pref_")').'

-
'; - return $content; -} - - public function checkCategoriesLevel() - { - $columns = $this->executeS('SHOW COLUMNS FROM `'.bqSQL($this->prefix).'categories` '); - foreach($columns as $field) - if ($field['Field'] == 'level') - return true; - return false; -} - - public function displayCategoriesLevelConf() - { - $html = ' - '; - - $html .= ' - '; - - return $html; - } - - public function createLevelAndCalculate() - { - if ($this->checkCategoriesLevel()) - die('{"hasError" : false}'); - - if ($this->createLevel()) - $this->calculateLevel(); - else - die('{"hasError" : true, "error" : "'.$this->l('Can not ALTER TABLE').'"}'); - } - - public function createLevel() - { - return $this->execute('ALTER TABLE `'.bqSQL($this->prefix).'categories` ADD `level` INT NOT NULL'); - } - - public function calculateLevel() - { - $this->updateLevel($this->getSubCat(0), 1); - die('{"hasError" : false}'); - } - - public function updateLevel($ids_cat, $level = 1) - { - $this->execute(' - UPDATE `'.bqSQL($this->prefix).'categories` - SET level = '.(int)$level.' - WHERE categories_id IN ('.implode(',', $ids_cat).')'); - foreach($ids_cat as $id) - if ($sub_cat = $this->getSubCat($id)) - $this->updateLevel($sub_cat, $level + 1); - - } - - public function getSubCat($id_parent) - { - $result = $this->executeS('SELECT `categories_id` FROM `'.bqSQL($this->prefix).'categories` WHERE `parent_id`='.(int)$id_parent); - if (!is_array($result) OR empty($result)) - return false; - return $this->formatCategoriesIds($result); - } - - public function formatCategoriesIds($result) - { - $return = array(); - foreach($result as $key => $val) - $return[] = $val['categories_id']; - return $return; - } -} - -?> diff --git a/modules/importerosc/index.php b/modules/importerosc/index.php deleted file mode 100644 index 3f6561f72..000000000 --- a/modules/importerosc/index.php +++ /dev/null @@ -1,35 +0,0 @@ - -* @copyright 2007-2013 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); - -header("Cache-Control: no-store, no-cache, must-revalidate"); -header("Cache-Control: post-check=0, pre-check=0", false); -header("Pragma: no-cache"); - -header("Location: ../"); -exit; \ No newline at end of file diff --git a/modules/importerosc/logo.gif b/modules/importerosc/logo.gif deleted file mode 100644 index cabfae43e6612a7321766890f8acd36eebfcbf56..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2378 zcmeHJdr(w$6#f?1x!nd_*yE-zOe60Ri1WXtXa7B2g^yF5gPRz%SZ z#aEH}NJU2*OP$QDu?EyZDjfyENYNA>6<;}Gnv-%ncbCUDI`vO~_M5qPzkAMi&iT&o z-rt#xSH~$PXa~X%4?!yp{@-ED3dqV4brmtY5Z?r~9tkJ$<|U*9S$5r_p=Y;R4&!{_b=&^Tr6ICt1cgqxC3tY z^sH3}^m|NxQ#J_!q+&h)BAeMp*e+t;X31ZFDrK#)-B?nl*Ty7}J)8vJ(6ceIghL7M z%reBO36G|$EsKwv<;0RP2Af*r#BOOuE;+Fq2N*MxXAq|R5~o<)R;NP3nOiA^)%c#urR;~ zR-hY$RK!DtFqpx^ge-Cyh+-fsE0V}+fR(12ol0H~ z*<{V9%h42R?cs;Hs>?D~1@?Lvu?8ztBtLLzlXWQ-hD=H*wk@__NSLE1)={vhoG7KQ zRNwXy_t=6%0lhw^MS3vfwD++Eu5w6xPi#+H&aD>Pa@~5J3(s}4S?N$|gj6k6NGE`i zPLV35QPLQCnkY@|jhICW4JabrJgL`G4@S%*Z?{(AZ@UZUd83bp&Qd&UWO;**5obUO zZ^|-oti$2F{fpa$`A<-sEl&TO0${fl81j0btuxgzM>4P60W*j-N|IRV(%VmkLgw8=b=H)QA77`aR~o|#Hxi)GYCU3hdTqvbfp;j=P4 zYi0RDRv!*)RwNBWS`u#+4T}qc&`D=-z-r*hDna;js~|ktMk3mPT24IifcU=x?w1kl z@p8lU#@a>h{kG3rQ&Ba%e8BVCMpd@oh$%}L&y3(J3B#1u+G2IhD(}@{GjsiwRZPPx zOY`l2C}fO%Nr;+nouF{{tneR`8DqE9`z#;5LfX~X$Sn35mGNPQOci^ia&qNxwf5BT z{ww9htpn4Qwea2j-gJ#JD6=A9l4aBEYDVd?HLgIe!Bkc3s_?Xua@ZwFBVtS9G_AFD zM?Hqfb2QZvBlEV!#Rsf?H}UY%<-Q@!OnGo!U4;*mVos@gHAEFTG(cv*YgY}53Jm^X Xm;B0rHL}IL7pIwaD!Ni4!Nk7+6WlRu diff --git a/modules/importerosc/logo.png b/modules/importerosc/logo.png deleted file mode 100644 index 20cf15b706665101e1cd197f0bdb82d3762fa2b5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2595 zcmaJ@dpwi-AAd?A<@yuTDb|c6cExOr*yeH=LM4{0c`&v;>)GUzI?_d`m0Z(tB=swf zBvQwrn&=>>n_rP@id?ESrCO=%H{H(fkNQ2Y*Yo{;Ki}8;^ZvX)mp{H40e+s^T1&J5 z0MPdKq6eyW04uYb@32Yby+#;dPAkv%9js^okc4X3)cF-9B z)KJ{u5OE08m%@Sg81^g%lgJmUyaB-3HBrds#DQYuW-yv7prYgrS5Qc9Bo(#Zo{3`$ zX6}PW5%57V8=1)G2}G1cD(Vw2MRlIN#-fm)AmTVG z>a(a2W&n}~!64EegR|w}9B@bnJO)p+BauipNCFOz!{P{7Ji!)Eq7Vrb91i*AL#d*{ zkx`UDy2qDTDvOGW5sQTsEH)t_0h2()KyWk`PbQORIS2$>6~b1OBoMO`Z3QCpuMBih z#DTd&F&7dbXBpX>p?EPBrBeDi1-|ebtw8jpOsaxm6WKy69)p`r=_`=Q{Qpos{~KB) z4g~+v`(0vDaFP(j27)3e9_FYT7iB&hN=Tu>AX^NRs*Zg?7< z=H~d-mkx2_`Jh1j)i?4VU&0T4XGeiAR7IwPFn22$=>bE0A9wP00Zu(OT*pGJSZQcch7@!Qy{jBkSv3RKe$tHwHaX5KLXP%rSN zy9Foqo?qw9`)SPNV^qmQp;x98Bde5gCO6V4O=g`x;3#>7jyI5wm!=!FEnf|{lTY=- zv3F>9Xkq6WX-1do1alj<29>R4t<5MvOBQ!j+N{avWn|F-Ke~zuswJc(X5wMe{x5DG0ea@R4gv*An|J!jMo+vhPK6`U)(z+^|^?W8B{5dVO=&w z!_E_b;OsU1cSpn`P%et}+Kuw?HcOgM#!kFs*vv{_n-tc4_W7oUKl?nq^%_vmVUIJ9<{N!{=(az9Zfa&$n(Y>fCCNpbgMp2 z^F|ZM6F%D({eg@y^U|so4E5`shnu!vnM`rG1V5BLd#T9$=*&*_ozy(m_Ubt1#@Qtr zTI93c%`dC?K*gCGinEs#zx&8}p%tCl8wva7R%7%U^`@klt!>(YLGL!(*X%oav8HzV z$b_78sBx~%$U{F9>x#=Pp3%$tU`Xx&X!a0$MDp+t>;$$h)M z`3xtR#dbx{Qz)3ynHgNy$TXobfL(QZt)ERfQp)?2B z^sFM(ACcc4!!V0q)oJm5*YeS)U~lJ>#dRloB#t9*7tO&*yQJ&9Pq_`wUpV7R^kbgX zD-5d+PbKFe&}rx~>x-GkN)b6G`}nVQO*6K(k|hmht4Z-$A-m+ZUK+aybM*HcnRo^a zvn9X%ZY^3fYNaNgKiYkOc~!GK;M+qHmJ38Mq zOE~o>pq35|QW01(&jFs!2{^a%R98$^B~<Y_+F|k)ieI?o_{@2@2BY5PQA`8zWTbG@;m@H6G>!6qSMXl+b z6K7pN&bW+coRH`iFI|`vT2xju%t+Tb*Mwe2l2)dzO}PA%Z46fJir&PSuHVula#wDwI0EKui7jwPB8CKe^4>f@ox8-0f=e0+NcQiwZ7`$uEI*xplvE?y zgxR=Zkaa)SSUafIQbxG6!=X#&f7r&ZF#*@pXRi53skbctelPEFR=w7OkiCMi!m=c& zz##LzT50NWtAn;5deIk=BP?&V)^mmdP6y>mg9rfbUShz}7^KZU+q@Zm^eXp=wEqGL Cb6L6o diff --git a/modules/importerosc/passwordhash.php b/modules/importerosc/passwordhash.php deleted file mode 100755 index 55e80ceab..000000000 --- a/modules/importerosc/passwordhash.php +++ /dev/null @@ -1,254 +0,0 @@ - in 2004-2006 and placed in -# the public domain. Revised in subsequent years, still public domain. -# -# There's absolutely no warranty. -# -# The homepage URL for this framework is: -# -# http://www.openwall.com/phpass/ -# -# Please be sure to update the Version line if you edit this file in any way. -# It is suggested that you leave the main version number intact, but indicate -# your project name (after the slash) and add your own revision information. -# -# Please do not change the "private" password hashing method implemented in -# here, thereby making your hashes incompatible. However, if you must, please -# change the hash type identifier (the "$P$") to something different. -# -# Obviously, since this code is in the public domain, the above are not -# requirements (there can be none), but merely suggestions. -# -class PasswordHash { - var $itoa64; - var $iteration_count_log2; - var $portable_hashes; - var $random_state; - - function PasswordHash($iteration_count_log2, $portable_hashes) - { - $this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; - - if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31) - $iteration_count_log2 = 8; - $this->iteration_count_log2 = $iteration_count_log2; - - $this->portable_hashes = $portable_hashes; - - $this->random_state = microtime(); - if (function_exists('getmypid')) - $this->random_state .= getmypid(); - } - - function get_random_bytes($count) - { - $output = ''; - if (@is_readable('/dev/urandom') && - ($fh = @fopen('/dev/urandom', 'rb'))) { - $output = fread($fh, $count); - fclose($fh); - } - - if (strlen($output) < $count) { - $output = ''; - for ($i = 0; $i < $count; $i += 16) { - $this->random_state = - md5(microtime() . $this->random_state); - $output .= - pack('H*', md5($this->random_state)); - } - $output = substr($output, 0, $count); - } - - return $output; - } - - function encode64($input, $count) - { - $output = ''; - $i = 0; - do { - $value = ord($input[$i++]); - $output .= $this->itoa64[$value & 0x3f]; - if ($i < $count) - $value |= ord($input[$i]) << 8; - $output .= $this->itoa64[($value >> 6) & 0x3f]; - if ($i++ >= $count) - break; - if ($i < $count) - $value |= ord($input[$i]) << 16; - $output .= $this->itoa64[($value >> 12) & 0x3f]; - if ($i++ >= $count) - break; - $output .= $this->itoa64[($value >> 18) & 0x3f]; - } while ($i < $count); - - return $output; - } - - function gensalt_private($input) - { - $output = '$P$'; - $output .= $this->itoa64[min($this->iteration_count_log2 + - ((PHP_VERSION >= '5') ? 5 : 3), 30)]; - $output .= $this->encode64($input, 6); - - return $output; - } - - function crypt_private($password, $setting) - { - $output = '*0'; - if (substr($setting, 0, 2) == $output) - $output = '*1'; - - $id = substr($setting, 0, 3); - # We use "$P$", phpBB3 uses "$H$" for the same thing - if ($id != '$P$' && $id != '$H$') - return $output; - - $count_log2 = strpos($this->itoa64, $setting[3]); - if ($count_log2 < 7 || $count_log2 > 30) - return $output; - - $count = 1 << $count_log2; - - $salt = substr($setting, 4, 8); - if (strlen($salt) != 8) - return $output; - - # We're kind of forced to use MD5 here since it's the only - # cryptographic primitive available in all versions of PHP - # currently in use. To implement our own low-level crypto - # in PHP would result in much worse performance and - # consequently in lower iteration counts and hashes that are - # quicker to crack (by non-PHP code). - if (PHP_VERSION >= '5') { - $hash = md5($salt . $password, TRUE); - do { - $hash = md5($hash . $password, TRUE); - } while (--$count); - } else { - $hash = pack('H*', md5($salt . $password)); - do { - $hash = pack('H*', md5($hash . $password)); - } while (--$count); - } - - $output = substr($setting, 0, 12); - $output .= $this->encode64($hash, 16); - - return $output; - } - - function gensalt_extended($input) - { - $count_log2 = min($this->iteration_count_log2 + 8, 24); - # This should be odd to not reveal weak DES keys, and the - # maximum valid value is (2**24 - 1) which is odd anyway. - $count = (1 << $count_log2) - 1; - - $output = '_'; - $output .= $this->itoa64[$count & 0x3f]; - $output .= $this->itoa64[($count >> 6) & 0x3f]; - $output .= $this->itoa64[($count >> 12) & 0x3f]; - $output .= $this->itoa64[($count >> 18) & 0x3f]; - - $output .= $this->encode64($input, 3); - - return $output; - } - - function gensalt_blowfish($input) - { - # This one needs to use a different order of characters and a - # different encoding scheme from the one in encode64() above. - # We care because the last character in our encoded string will - # only represent 2 bits. While two known implementations of - # bcrypt will happily accept and correct a salt string which - # has the 4 unused bits set to non-zero, we do not want to take - # chances and we also do not want to waste an additional byte - # of entropy. - $itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; - - $output = '$2a$'; - $output .= chr(ord('0') + $this->iteration_count_log2 / 10); - $output .= chr(ord('0') + $this->iteration_count_log2 % 10); - $output .= '$'; - - $i = 0; - do { - $c1 = ord($input[$i++]); - $output .= $itoa64[$c1 >> 2]; - $c1 = ($c1 & 0x03) << 4; - if ($i >= 16) { - $output .= $itoa64[$c1]; - break; - } - - $c2 = ord($input[$i++]); - $c1 |= $c2 >> 4; - $output .= $itoa64[$c1]; - $c1 = ($c2 & 0x0f) << 2; - - $c2 = ord($input[$i++]); - $c1 |= $c2 >> 6; - $output .= $itoa64[$c1]; - $output .= $itoa64[$c2 & 0x3f]; - } while (1); - - return $output; - } - - function HashPassword($password) - { - $random = ''; - - if (CRYPT_BLOWFISH == 1 && !$this->portable_hashes) { - $random = $this->get_random_bytes(16); - $hash = - crypt($password, $this->gensalt_blowfish($random)); - if (strlen($hash) == 60) - return $hash; - } - - if (CRYPT_EXT_DES == 1 && !$this->portable_hashes) { - if (strlen($random) < 3) - $random = $this->get_random_bytes(3); - $hash = - crypt($password, $this->gensalt_extended($random)); - if (strlen($hash) == 20) - return $hash; - } - - if (strlen($random) < 6) - $random = $this->get_random_bytes(6); - $hash = - $this->crypt_private($password, - $this->gensalt_private($random)); - if (strlen($hash) == 34) - return $hash; - - # Returning '*' on error is safe here, but would _not_ be safe - # in a crypt(3)-like function used _both_ for generating new - # hashes and for validating passwords against existing hashes. - return '*'; - } - - function CheckPassword($password, $stored_hash) - { - $hash = $this->crypt_private($password, $stored_hash); - if ($hash[0] == '*') - $hash = crypt($password, $stored_hash); - - return $hash == $stored_hash; - } -} - -?> diff --git a/modules/importerosc/translations/index.php b/modules/importerosc/translations/index.php deleted file mode 100644 index 3f6561f72..000000000 --- a/modules/importerosc/translations/index.php +++ /dev/null @@ -1,35 +0,0 @@ - -* @copyright 2007-2013 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); - -header("Cache-Control: no-store, no-cache, must-revalidate"); -header("Cache-Control: post-check=0, pre-check=0", false); -header("Pragma: no-cache"); - -header("Location: ../"); -exit; \ No newline at end of file diff --git a/modules/shopimporter/ajax.php b/modules/shopimporter/ajax.php deleted file mode 100644 index ad972cb56..000000000 --- a/modules/shopimporter/ajax.php +++ /dev/null @@ -1,214 +0,0 @@ -supportedImports as $key => $import) - if (array_key_exists('alterTable', $import)) - $columns = Db::getInstance()->executeS('SHOW COLUMNS FROM `'._DB_PREFIX_.bqSQL($import['table']).'`'); - foreach ($columns as $column) - if ($column['Field'] == $import['identifier'].'_'.$moduleName) - Db::getInstance()->execute('ALTER IGNORE TABLE `'._DB_PREFIX_.bqSQL($import['table']).'` DROP `'.bqSQL($import['identifier'].'_'.$moduleName).'`'); - if ($link = @mysql_connect(Tools::getValue('server'), Tools::getValue('user'), Tools::getValue('password'))) - { - if (!@mysql_select_db(Tools::getValue('database'), $link)) - die('{"hasError" : true, "error" : ["'.$shop_importer->l('The database selection cannot be made.', 'ajax').'"]}'); - else - { - @mysql_close($link); - die('{"hasError" : false, "error" : []}'); - } - } - else - die('{"hasError" : true, "error" : ["'.$shop_importer->l('Link to database cannot be established.', 'ajax').'"]}'); - -} - -if (Tools::isSubmit('getData') || Tools::isSubmit('syncLang') || Tools::isSubmit('syncCurrency')) -{ - if (Tools::isSubmit('syncLang')) - $save = true; - - if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php')) - { - require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php'); - $importModule = new $moduleName(); - $importModule->server = $server; - $importModule->user = $user; - $importModule->passwd = $password; - $importModule->database = $database; - $importModule->prefix = $prefix; - if (!method_exists($importModule, $getMethod)) - die('{"hasError" : true, "error" : ["not_exist"], "datas" : []}'); - else - { - $return = call_user_func_array(array($importModule, $getMethod), array($limit, $nbr_import)); - $shop_importer = new shopImporter(); - $shop_importer->genericImport($className, $return, (bool)$save); - } - } -} -if (Tools::isSubmit('getDataWS') || Tools::isSubmit('syncLangWS') || Tools::isSubmit('syncCurrencyWS')) -{ - if (Tools::isSubmit('syncLangWS')) - $save = true; - - if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php')) - { - require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php'); - - try - { - $importModule = new $moduleName(); - $importModule->connect($url,$loginws,$apikey); - - if (!method_exists($importModule, $getMethod)) - die('{"hasError" : true, "error" : ["not_exist"], "datas" : []}'); - else - { - $return = call_user_func_array(array($importModule, $getMethod), array($limit, $nbr_import)); - $shop_importer = new shopImporter(); - $shop_importer->genericImport($className, $return, (bool)$save); - } - die('{"hasError" : false, "error" : []}'); - } catch (Exception $e) - { - die('{"hasError" : true, "error" : ['.json_encode($e->getMessage()).'], "datas" : []}'); - } - } -} - -if (Tools::isSubmit('truncatTable')) -{ - $shop_importer = new shopImporter(); - if ($shop_importer->truncateTable($className)) - die('{"hasError" : false, "error" : []}'); - else - die('{"hasError" : true, "error" : ["'.$className.'"]}'); - -} - -if (Tools::isSubmit('alterTable')) -{ - $shop_importer = new shopImporter(); - if ($shop_importer->alterTable($className)) - die('{"hasError" : false, "error" : []}'); - else - die('{"hasError" : true, "error" : ["'.$className.'"]}'); - -} - -if (Tools::isSubmit('displaySpecificOptions')) -{ - if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php')) - { - $shop_importer = new shopImporter(); - require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php'); - $importModule = new $moduleName(); - $importModule->server = $server; - $importModule->user = $user; - $importModule->passwd = $password; - $importModule->database = $database; - $importModule->prefix = $prefix; - if ($link = @mysql_connect(Tools::getValue('server'), Tools::getValue('user'), Tools::getValue('password'))) - { - if(!@mysql_select_db(Tools::getValue('database'), $link)) - die($shop_importer->l('The database selection cannot be made.', 'ajax')); - elseif (method_exists($importModule, 'displaySpecificOptions')) - die($importModule->displaySpecificOptions()); - else - die('not_exist'); - } - else - die($shop_importer->l('Link to database cannot be established.', 'ajax')); - } -} -elseif (Tools::isSubmit('displaySpecificOptionsWsdl')) -{ - if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php')) - { - require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php'); - $importModule = new $moduleName(); - - try - { - if (method_exists($importModule, 'displaySpecificOptions')) - die($importModule->displaySpecificOptions()); - else - die('not_exist'); - } catch (Exception $e) - { - die('{"hasError" : true, "error" : ['.json_encode($e->getMessage()).'], "datas" : []}'); - } - } -} -if (Tools::isSubmit('connexionWs')) -{ - if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php')) - { - require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php'); - try - { - - $importModule = new $moduleName(); - $importModule->connect($url,$loginws,$apikey); - die('{"hasError" : false, "error" : []}'); - } catch (Exception $e) - { - die('{"hasError" : true, "error" : ['.json_encode($e->getMessage()).'], "datas" : []}'); - } - } -} - -if (Tools::isSubmit('validateSpecificOptions')) -{ - if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php')) - { - require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php'); - $importModule = new $moduleName(); - if (!method_exists($importModule, 'validateSpecificOptions')) - die('{"hasError" : true, "error" : ["not_exist"]}'); - else - die($importModule->validateSpecificOptions()); - } -} -if (Tools::isSubmit('displayConfigConnector')) -{ - if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php')) - { - require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php'); - $importModule = new $moduleName(); - if (!method_exists($importModule, 'displayConfigConnector')) - die('{"hasError" : true, "error" : ["not_exist"]}'); - else - die($importModule->displayConfigConnector()); - } -} -?> \ No newline at end of file diff --git a/modules/shopimporter/config.xml b/modules/shopimporter/config.xml deleted file mode 100644 index ba6f59e5f..000000000 --- a/modules/shopimporter/config.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - shopimporter - - - - - - 1 - 0 - - \ No newline at end of file diff --git a/modules/shopimporter/img/ajax-loader.gif b/modules/shopimporter/img/ajax-loader.gif deleted file mode 100644 index 3dba96d65fcf86a59969c1c991ffad3ac7294f83..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1849 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 Cz9@ERCLGF#WBR9cWH1mSCfN??c}I{+uoj@ zcb!;t6<6qFaxeQaQCg?Pvi3wraGG+g#Ejn-{W}esR4!!~t$%&%Xh(s}@>_XjavqNg zZWZUKOlS5y^lp>ge17GxFH5f7d;2|Yo_O;EgP81}?2ZCI-1PPdMNIoD-`J(IJF`;8 zU4e5_8cU%}=1wMQ;V+D{7k{tj{IsWG%BRJ0EdTP^RUZCcEtl%#W%o&`e2i}kD@MLAs Y*M4#`ErB`v0??lfp00i_>zopr0KT_>NB{r; diff --git a/modules/shopimporter/img/force.gif b/modules/shopimporter/img/force.gif deleted file mode 100644 index d876e5e9c066ae926e6125ffd1ca9d58de9f2c9b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 971 zcmZ?wbhEHb6krfwXlG#f#c=laa-BOXwC}CfzPm!_?rPn8tMu-#*S^0__x?KlyQ>WD zt~R^3*7W`ctA|_kUvJZYu)*-*W~0YDjUVqYeX`s5$u9G!dw~q=C%bK*?zMcj-}>&p#~7e^D{o=$pktm567 zg7+t@-d`yAaHi(txw?<%>px%3`*<_u^Y!{qw@SZ1EP8#W`OW#xkLMabU26Vxx#jcq zwlCK^zTE8mdb{iE?e4F4y1w4&`F6kW>xkS{xCTws>Y&+0y@$5+9VYc2G`qp|jA}idw<|sR-?BJN}a>%XG{8otKr^l=_ z)Fk}4-Y_or5ReF5c3}eN0k@gPPDv{`4kz>Y%jWkme4MzbyO~2kNJL-*g9D#d_N5t& zk6XLNH2h}da42kO -* @copyright 2007-2013 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); - -header("Cache-Control: no-store, no-cache, must-revalidate"); -header("Cache-Control: post-check=0, pre-check=0", false); -header("Pragma: no-cache"); - -header("Location: ../"); -exit; \ No newline at end of file diff --git a/modules/shopimporter/img/ok.png b/modules/shopimporter/img/ok.png deleted file mode 100644 index 4207a363cb342cb68a8cff0b5678e692091ba0af..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1162 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 KMNUMnLSTZf56)Kr diff --git a/modules/shopimporter/img/stop.png b/modules/shopimporter/img/stop.png deleted file mode 100644 index fbc3cee2aff35a84921be69ccf5d513ca1502c54..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1496 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 diff --git a/modules/shopimporter/index.php b/modules/shopimporter/index.php deleted file mode 100644 index 3f6561f72..000000000 --- a/modules/shopimporter/index.php +++ /dev/null @@ -1,35 +0,0 @@ - -* @copyright 2007-2013 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); - -header("Cache-Control: no-store, no-cache, must-revalidate"); -header("Cache-Control: post-check=0, pre-check=0", false); -header("Pragma: no-cache"); - -header("Location: ../"); -exit; \ No newline at end of file diff --git a/modules/shopimporter/logo.gif b/modules/shopimporter/logo.gif deleted file mode 100644 index 263b1e430e35185a34788e038c49ba61f9c4f237..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 379 zcmV->0fhcXNk%w1VGsZi0M$PLgpi&4`ug+s`Tzg_HbG1ht{(sY01BfGg^-*8UI4($ z)&NWZ5NHslw8H!R{k+D|v%k!1bbjLK?*Li=?C$b-f{pX__xbw!{Qdsu?C|XH^8jQ3 z`~3X&`1;e^2rLC{r>&{ zV*mg~0ORND@bmZY@$~WY^#El6eTb6)MF0Rq0O{=STFou>_xb=+0Nvu}>hJUbTmS$` z0RR90A^8LW002J#EC2ui01yBW000J_>4 zqgx zia!{6!4O4B*22;-&DzvETK=t8Yiet&=H{B~XGB|DD=l@dax1kBXQ5e|GUiq!v;dRt zKuj(wfh+JAMSkw(oO{0B_q#u#Uf}}wY~MNeoclfR`+U#$e1D1%0(>co0^emR*!Ar} zO|vZb|JUEeIFHBpvEa4m^Xb*VATExt+(kfpZ^!=Pq=|_uZ4XU@Fa`Rfzz9WEaL(C; zfB$JcT=@E$=jfAXs01wUZZA4)LVb2-dJ3#o3(OD{P>Hy%8>l~f5h~1|K6qp8%21V% zx%uWJG5VdI2ZV=Sx_dpM%cYCX5DM4h`ix^d#~F+QmOk&1rpJR`-9(w=0zznfA0Ge< zXHN&?IS!TEpZoHH$C0zW&NB+mTb8W;)z)&w4ExkkqN_`7nb^z1L1 zkc0&uu_a5~pkxb1fcwO&fRM>GNkHj`fC&6zoERD*jcD@c}(RNm(t%4L*Gk1q_c@O74GEQ3oWT z_@rmt@D(7uhdn@s%A6J-x(BE}THut>d~xn6qve;6!5O3!}9>V!>YUE7Mkj+(Q~Wa zKiK{Ao~+~2u3+}#8}Q8PEb!?21&>2z9-9Xsw^zu{He?k_)g`bk*scJ%M1KfrFcV?z7{?Afyy4Grh$yDB}w zfoIK{g=Nd0#?rh+I8t&Pg#~Y8%a*UPZdE>E;<0z%H)w2Zr2T{@IrFTVk&%HVOP<2w z#d$b*==*X?HHk{^yG;tyh78hgGxEMT^|041iW}~q1Lv-K1h1$9^aMad% zx8ziR)0>;*^Q%4kWRp}?r5&}Ere@>Pr`xu!=U!dA?uE^6w>ys;=I(LD(YH~-3D89q z(cRsH*0#%-9G?O^B|lnm2A7)7W7p0d!#(HZs@YaA1B;4$8{PaH428I=i}H zu~-o`dbCWCL;sPZQFZDMOwYBWx$-#X&3+iM1Q>IQ0m{ZkMv^2Mngl=4EZN=%D8l0-G zTtma}YHUnQTz1Z*`?IpLkU+`U2Pr8j(o@2>S#4=<#>w(>R998nn=W1`V|DI1n)%ET zHz_%JUS{T;B66_iC*XFuq!Mz5)U=z8&W4R`ZLO#2?@lVwiHS*bZE5L6)P))!P)0;X zg5(cO&-A=mUw>xfrIzMOdTnEG1UsDaZ3GqG4kh^r1@l@Ll~yWOIM5I=A{YTbi3ndH r>wRWWc2YMLz0VXmSd3KXKLG{+^bi@kH1E@Z00000NkvXXu0mjfrMJrf diff --git a/modules/shopimporter/shopimporter.js b/modules/shopimporter/shopimporter.js deleted file mode 100644 index 4fc79c6f9..000000000 --- a/modules/shopimporter/shopimporter.js +++ /dev/null @@ -1,910 +0,0 @@ -var shopImporter = { - token: globalAjaxShopImporterToken, - moduleName: $('#import_module_name').val(), - server: $('#server').val(), - user: $('#user').val(), - password: $('#password').val(), - database: $('#database').val(), - prefix: $('#prefix').val(), - url: $('#url').val(), - loginws: $('#loginws').val(), - apikey: $('#apikey').val(), - specificOptions : '', - imagesOptions : '', - output : 1, - hasErrors : 0, - limit: 0, - nbr_import: parseInt($('#nbr_import').val()), - idMethod: 0, - nbrMethod: 0, - save : 0, - srcError : '../modules/shopimporter/img/error.png', - srcConf : '../modules/shopimporter/img/ok.png', - srcImport : '../modules/shopimporter/img/ajax-loader.gif', - srcWarn : '../modules/shopimporter/img/warn.png', - srcDelete : '../modules/shopimporter/img/delete.gif', - - - syncLangWS : function (onComplete) - { - $.ajax({ - type: 'GET', - url: '../modules/shopimporter/ajax.php', - async: false, - cache: false, - dataType : "json", - data: 'ajax=true&syncLangWS&getMethod=getLangagues&token='+this.token+'&className=Language&moduleName='+this.moduleName+'&url='+this.url+'&loginws='+this.loginws+'&apikey='+this.apikey+'&nbr_import='+this.nbr_import , - success: function(jsonData) - { - if (jsonData.hasError) - { - $('#steps').html(''); - $('#lang_feedback').fadeIn('slow'); - onComplete(false); - } - else - onComplete(true); - }, - error: function(XMLHttpRequest, textStatus, errorThrown) - { - $('#steps').html($('#steps').html()+''); - $('#technical_error_feedback').fadeIn('slow'); - onComplete(false); - } - }); - - }, - syncLang : function (onComplete) - { - $.ajax({ - type: 'GET', - url: '../modules/shopimporter/ajax.php', - async: false, - cache: false, - dataType : "json", - data: 'ajax=true&syncLang&getMethod=getLangagues&token='+this.token+'&className=Language&moduleName='+this.moduleName+'&server='+this.server+'&user='+this.user+'&password='+this.password+'&database='+this.database+'&prefix='+prefix+this.specificOptions+'&nbr_import='+this.nbr_import , - success: function(jsonData) - { - if (jsonData.hasError) - { - $('#steps').html(''); - $('#lang_feedback').fadeIn('slow'); - onComplete(false); - } - else - onComplete(true); - }, - error: function(XMLHttpRequest, textStatus, errorThrown) - { - $('#steps').html($('#steps').html()+''); - $('#technical_error_feedback').fadeIn('slow'); - onComplete(false); - } - }); - - }, - syncCurrencyWS : function (onComplete) - { - $.ajax({ - type: 'GET', - url: '../modules/shopimporter/ajax.php', - async: false, - cache: false, - dataType : "json", - data: 'ajax=true&token='+this.token+'&syncCurrencyWS&getMethod=getCurrencies&className=Currency&moduleName='+this.moduleName+'&url='+this.url+'&loginws='+this.loginws+'&apikey='+this.apikey+'&nbr_import='+this.nbr_import , - success: function(jsonData) - { - if (jsonData.hasError) - { - $('#steps').html('
'+jsonData.error+'
'); - $('#currency_feedback').fadeIn('slow'); - onComplete(false); - } - else - onComplete(true); - }, - error: function(XMLHttpRequest, textStatus, errorThrown) - { - $('#steps').html($('#steps').html()+''); - $('#technical_error_feedback').fadeIn('slow'); - onComplete(false); - } - }); - }, - syncCurrency : function (onComplete) - { - $.ajax({ - type: 'GET', - url: '../modules/shopimporter/ajax.php', - async: false, - cache: false, - dataType : "json", - data: 'ajax=true&token='+this.token+'&syncCurrency&getMethod=getCurrencies&className=Currency&moduleName='+this.moduleName+'&server='+this.server+'&user='+this.user+'&password='+this.password+'&database='+this.database+'&prefix='+prefix+this.specificOptions+'&nbr_import='+this.nbr_import , - success: function(jsonData) - { - if (jsonData.hasError) - { - $('#steps').html(''); - $('#currency_feedback').fadeIn('slow'); - onComplete(false); - } - else - onComplete(true); - }, - error: function(XMLHttpRequest, textStatus, errorThrown) - { - $('#steps').html($('#steps').html()+''); - $('#technical_error_feedback').fadeIn('slow'); - onComplete(false); - } - }); - - }, - checkAndSaveConfigWSDL : function (onComplete) - { - $('#checkAndSaveConfig').fadeOut('slow'); - $('#steps').html($('#steps').html()+'
'+wsOk+'
'); - $('#steps').html($('#steps').html()+''); - $('#next').fadeIn('slow', function () { - $('#next').unbind('click').click(function(){ - $('#next').fadeOut('fast', function() { - shopImporter.nbrMethod = conf.length; - shopImporter.getDatasWS(conf[shopImporter.idMethod]); - }); - return false; - }); - }); - $('#database_feedback').fadeIn('slow'); - - }, - checkAndSaveConfigWS : function (save) - { - //sync languages and currency - this.syncLangWS(function(isOk) { - if (isOk) - { - shopImporter.syncCurrencyWS(function(isOk) { - if ($('#technical_error_feedback').length) - $('#technical_error_feedback').fadeIn('slow'); - - - $('#checkAndSaveConfig').fadeOut('slow'); - $('#steps').html($('#steps').html()+'
'+databaseOk+'
'); - $('#steps').html($('#steps').html()+''); - $('#database_feedback').fadeIn('slow', function() { - if (save) - { - shopImporter.idMethod = 0; - shopImporter.limit = 0; - shopImporter.nbrMethod = conf.length; - $('.truncateTable:checked').each(function (){ - shopImporter.truncatTable(this.id, 'add'); - }); - - if($('#truncat_feedback').length != 0) - $('#truncat_feedback').removeClass('import').addClass('conf'); - - shopImporter.getDatasWS(conf[shopImporter.idMethod]); - } - else - { - $('#next').fadeIn('slow', function () { - $('#next').unbind('click').click(function(){ - $('#next').fadeOut('fast', function() { - shopImporter.nbrMethod = conf.length; - shopImporter.getDatasWS(conf[shopImporter.idMethod]); - }); - - }); - }); - } - }); - }); - } - }); - }, - checkAndSaveConfig : function (save) - { - //sync languages and currency - this.syncLang(function(isOk) { - if (isOk) - { - shopImporter.syncCurrency(function(isOk) { - if (isOk) - { - $.ajax({ - type: 'GET', - url: '../modules/shopimporter/ajax.php', - async: true, - cache: false, - dataType : "json", - data: 'ajax=true&token='+this.token+'&checkAndSaveConfig&moduleName='+shopImporter.moduleName+'&server='+shopImporter.server+'&user='+shopImporter.user+'&password='+shopImporter.password+'&database='+shopImporter.database+'&prefix='+prefix+shopImporter.specificOptions+'&nbr_import='+shopImporter.nbr_import , - success: function(jsonData) - { - if ($('#technical_error_feedback').length) - $('#technical_error_feedback').fadeIn('slow'); - - if (!jsonData.hasError) - { - $('#checkAndSaveConfig').fadeOut('slow'); - $('#steps').html($('#steps').html()+''); - $('#steps').html($('#steps').html()+''); - $('#database_feedback').fadeIn('slow', function() { - if (save) - { - shopImporter.idMethod = 0; - shopImporter.limit = 0; - shopImporter.nbrMethod = conf.length; - $('.truncateTable:checked').each(function (){ - shopImporter.truncatTable(this.id, 'add'); - }); - - if($('#truncat_feedback').length != 0) - $('#truncat_feedback').removeClass('import').addClass('conf'); - - shopImporter.getDatas(conf[shopImporter.idMethod]); - } - else - { - $('#next').fadeIn('slow', function () { - $('#next').unbind('click').click(function(){ - $('#next').fadeOut('fast', function() { - shopImporter.nbrMethod = conf.length; - shopImporter.getDatas(conf[shopImporter.idMethod]); - }); - return false; - }); - }); - } - }); - } - else - { - $('#steps').html(''); - $('#database_feedback').fadeIn('slow'); - } - }, - error: function(XMLHttpRequest, textStatus, errorThrown) - { - $('#steps').html($('#steps').html()+'
TECHNICAL ERROR

Details: '+XMLHttpRequest.responseText+'
'); - $('#technical_error_feedback').fadeIn('slow'); - } - }); - } - }); - } - }); - }, - - getDatasWS : function (methodName) - { - //check if method have to be call - if (shopImporter.idMethod >= shopImporter.nbrMethod) - shopImporter.displayEnd(false); - else if ($('input[name='+methodName[0]+']:radio:checked').val() == 0) - { - shopImporter.idMethod ++; - shopImporter.getDatasWS(conf[shopImporter.idMethod]); - return; - } - if (typeof(methodName) != 'undefined') - { - - $('#steps').html($('#steps').html()+'
'+methodName[1]+'
'); - $('#ok_feedback_'+methodName[0]).css('display', ''); - - $('#checkAndSaveConfig').fadeIn('slow'); - $.ajax({ - type: 'GET', - url: '../modules/shopimporter/ajax.php', - async: true, - cache: false, - dataType : "json", - data: 'ajax=true&token='+this.token+'&getDataWS&className='+methodName[2]+'&getMethod='+methodName[0]+'&moduleName='+this.moduleName+'&url='+this.url+'&loginws='+this.loginws+'&apikey='+this.apikey+'&limit='+this.limit+'&nbr_import='+this.nbr_import+'&save='+this.save+'&errors='+this.errors+'&hasErrors='+this.hasErrors+this.specificOptions+this.imagesOptions , - success: function(jsonData) - { - var jsonError; - if (jsonData.hasError) - { - jsonError = ''; - if (jsonData.error == 'not_exist') - { - $('#ok_feedback_'+methodName[0]).removeClass('conf').addClass(function() { - $('#ok_feedback_'+methodName[0]).html(''+methodName[1]+' '+notExist); - return 'warn'; - }); - } - else - { - for (i=0;iId : '+jsonData.error[i]+''; - - if ($('#display_error_'+methodName[0]+'_link').length == 0) - { - $('#ok_feedback_'+methodName[0]).html($('#ok_feedback_'+methodName[0]).html()+''+showErrors+'('+jsonData.error.length+')'+''); - } - else - { - var nbrErrors = $('#nbr_errors_'+methodName[0]).html(); - var newNbrError = parseInt(jsonData.error.length) + parseInt(nbrErrors); - $('#nbr_errors_'+methodName[0]).html(newNbrError); - $('#feedback_'+methodName[0]+'_errors_list > ul').html($('#feedback_'+methodName[0]+'_errors_list > ul').html() + jsonError); - } - } - - if (jsonData.datas.length != parseInt(shopImporter.nbr_import)) - { - if ($('#display_error_'+methodName[0]+'_link').length != 0) - $('#ok_feedback_'+methodName[0]).removeClass('import').addClass( function() { - $('#ok_feedback_'+methodName[0]+' >img:first').attr('src', shopImporter.srcError); - return 'error'; - }); - shopImporter.idMethod ++; - shopImporter.limit = 0; - } - else - shopImporter.limit += parseInt(shopImporter.nbr_import); - if ((shopImporter.idMethod < shopImporter.nbrMethod)) - shopImporter.getDatasWS(conf[shopImporter.idMethod]); - else - shopImporter.displayEnd(false); - } - else - { - if (jsonData.datas.length != parseInt(shopImporter.nbr_import)) - { - if ($('#display_error_'+methodName[0]+'_link').length != 0) - { - $('#ok_feedback_'+methodName[0]).removeClass('import').addClass( function() { - $('#ok_feedback_'+methodName[0]+' >img:first').attr('src', shopImporter.srcError); - return 'error'; - }); - }else - { - $('#ok_feedback_'+methodName[0]).removeClass('import').addClass('conf'); - $('#ok_feedback_'+methodName[0]+'>img:first').attr('src', shopImporter.srcConf); - } - shopImporter.idMethod ++; - shopImporter.limit = 0; - - shopImporter.getDatasWS(conf[shopImporter.idMethod]); - } - else - { - if (shopImporter.idMethod < shopImporter.nbrMethod) - { - shopImporter.limit += parseInt(shopImporter.nbr_import); - shopImporter.getDatasWS(conf[shopImporter.idMethod]); - } - else - shopImporter.displayEnd(true); - } - } - }, - error: function(XMLHttpRequest, textStatus, errorThrown) - { - $('#technical_error_feedback').fadeIn('slow'); - $('#checkAndSaveConfig').fadeIn('slow'); - } - }); - } - }, - getDatas : function (methodName) - { - //check if method have to be call - if (shopImporter.idMethod >= shopImporter.nbrMethod) - shopImporter.displayEnd(false); - else if ($('input[name='+methodName[0]+']:radio:checked').val() == 0) - { - shopImporter.idMethod ++; - shopImporter.getDatas(conf[shopImporter.idMethod]); - return; - } - if (typeof(methodName) != 'undefined') - { - - $('#steps').html($('#steps').html()+''); - $('#ok_feedback_'+methodName[0]).css('display', ''); - - $('#checkAndSaveConfig').fadeIn('slow'); - $.ajax({ - type: 'GET', - url: '../modules/shopimporter/ajax.php', - async: true, - cache: false, - dataType : "json", - data: 'ajax=true&token='+this.token+'&getData&className='+methodName[2]+'&getMethod='+methodName[0]+'&moduleName='+this.moduleName+'&server='+this.server+'&user='+this.user+'&password='+this.password+'&database='+this.database+'&prefix='+prefix+'&limit='+this.limit+'&nbr_import='+this.nbr_import+'&save='+this.save+'&errors='+this.errors+'&hasErrors='+this.hasErrors+this.specificOptions+this.imagesOptions , - success: function(jsonData) - { - var jsonError; - if (jsonData.hasError) - { - jsonError = ''; - if (jsonData.error == 'not_exist') - { - $('#ok_feedback_'+methodName[0]).removeClass('conf').addClass(function() { - $('#ok_feedback_'+methodName[0]).html(''+methodName[1]+' '+notExist); - return 'warn'; - }); - } - else - { - for (i=0;iId : '+jsonData.error[i]+''; - - if ($('#display_error_'+methodName[0]+'_link').length == 0) - { - $('#ok_feedback_'+methodName[0]).html($('#ok_feedback_'+methodName[0]).html()+''+showErrors+'('+jsonData.error.length+')'+''); - } - else - { - var nbrErrors = $('#nbr_errors_'+methodName[0]).html(); - var newNbrError = parseInt(jsonData.error.length) + parseInt(nbrErrors); - $('#nbr_errors_'+methodName[0]).html(newNbrError); - $('#feedback_'+methodName[0]+'_errors_list > ul').html($('#feedback_'+methodName[0]+'_errors_list > ul').html() + jsonError); - } - } - - if (jsonData.datas.length != parseInt(shopImporter.nbr_import)) - { - if ($('#display_error_'+methodName[0]+'_link').length != 0) - $('#ok_feedback_'+methodName[0]).removeClass('import').addClass( function() { - $('#ok_feedback_'+methodName[0]+' >img:first').attr('src', shopImporter.srcError); - return 'error'; - }); - shopImporter.idMethod ++; - shopImporter.limit = 0; - } - else - shopImporter.limit += parseInt(shopImporter.nbr_import); - if ((shopImporter.idMethod < shopImporter.nbrMethod)) - shopImporter.getDatas(conf[shopImporter.idMethod]); - else - shopImporter.displayEnd(false); - } - else - { - if (jsonData.datas.length != parseInt(shopImporter.nbr_import)) - { - if ($('#display_error_'+methodName[0]+'_link').length != 0) - { - $('#ok_feedback_'+methodName[0]).removeClass('import').addClass( function() { - $('#ok_feedback_'+methodName[0]+' >img:first').attr('src', shopImporter.srcError); - return 'error'; - }); - }else - { - $('#ok_feedback_'+methodName[0]).removeClass('import').addClass('conf'); - $('#ok_feedback_'+methodName[0]+'>img:first').attr('src', shopImporter.srcConf); - } - shopImporter.idMethod ++; - shopImporter.limit = 0; - shopImporter.getDatas(conf[shopImporter.idMethod]); - } - else - { - if (shopImporter.idMethod < shopImporter.nbrMethod) - { - shopImporter.limit += parseInt(shopImporter.nbr_import); - shopImporter.getDatas(conf[shopImporter.idMethod]); - } - else - shopImporter.displayEnd(true); - } - } - }, - error: function(XMLHttpRequest, textStatus, errorThrown) - { - $('#steps').html($('#steps').html()+''); - $('#technical_error_feedback').fadeIn('slow'); - $('#checkAndSaveConfig').fadeIn('slow'); - } - }); - } - }, - - truncatTable : function (className) - { - if (!$('#truncat_feedback').length) - { - $('#steps').html($('#steps').html()+''); - $('#truncat_feedback').css('display', ''); - } - - $.ajax({ - type: 'GET', - url: '../modules/shopimporter/ajax.php', - async: false, - cache: false, - dataType : "json", - data: 'ajax=true&token='+this.token+'&truncatTable&className='+className+this.specificOptions , - success: function(jsonData) - { - var jsonError; - if (jsonData.hasError) - { - jsonError = ''; - for (i=0;iTable : '+jsonData.error[i]+''; - $('#truncat_feedback').removeClass('import').addClass('error'); - $('#truncat_feedback >img:first').attr('src', shopImporter.srcError); - if ($('#display_error_truncat_feedback_link').length == 0) - { - $('#truncat_feedback').html($('#truncat_feedback').html()+''+showErrors+''); - } - else - { - var nbrErrors = $('#nbr_errors_'+methodName[0]).html(); - var newNbrError = parseInt(jsonData.error.length) + parseInt(nbrErrors); - $('#nbr_errors_'+methodName[0]).html(newNbrError); - $('#feedback_'+methodName[0]+'_errors_list > ul').html($('#feedback_'+methodName[0]+'_errors_list > ul').html() + jsonError); - } - } - }, - error: function(XMLHttpRequest, textStatus, errorThrown) - { - $('#steps').html($('#steps').html()+''); - $('#technical_error_feedback').fadeIn('slow'); - $('#checkAndSaveConfig').fadeIn('slow'); - } - - }); - }, - - displayEnd : function (finish) - { - - if ((this.hasErrors != 0 || ($('.display_error_link').length == 0 && this.hasErrors == 0)) || (this.hasErrors == 1)) - { - if (this.save) - { - $('#steps').html($('#steps').html()+'
'+importFinish+'
'); - $('#ok_feedback_end').fadeIn('slow'); - } - else - { - $('#steps').html($('#steps').html()+''); - $('#submitImport').fadeIn('slow', function() { - $(this).unbind('click').click(function() { - $.scrollTo($("#steps"), 300 , { - onAfter:function(){ - $('#steps').html(''); - shopImporter.save = 1; - if(type_connector == 'ws') - shopImporter.checkAndSaveConfigWS(shopImporter.save); - else if (type_connector == 'db') - shopImporter.checkAndSaveConfig(shopImporter.save); - } - }); - }); - }); - } - } - else - { - $('#steps').html($('#steps').html()+''); - $('#technical_error_feedback').fadeIn('slow'); - } - $('#checkAndSaveConfig').fadeIn('slow'); - }, - -}; - -function enableShowErrors(methodName) -{ - $(document).find('#feedback_'+methodName+'_errors_list').slideToggle(); - return false; -} - -function enableShowErrorsTruncate() -{ - $(document).find('#feedback_truncat_errors_list').slideToggle(); - return false; -} - -function displaySpecificOptions(moduleName, server, user, password, database, prefix, token) -{ - $.ajax({ - type: 'GET', - url: '../modules/shopimporter/ajax.php', - async: false, - cache: false, - dataType : "html", - data: 'ajax=true&token='+token+'&displaySpecificOptions&moduleName='+moduleName+'&server='+ server+'&user='+user+'&password='+password+'&database='+database+'&prefix='+prefix , - success: function(htmlData) - { - if (htmlData != 'not_exist') - { - $('#specificOptionsContent').html(htmlData); - $('#specificOptions').show(); - $('#importOptions').show(); - } - }, - error: function(XMLHttpRequest, textStatus, errorThrown) - { - alert('TECHNICAL ERROR\nDetails:\nError thrown: ' + XMLHttpRequest + '\n' + 'Text status: ' + textStatus); - } - }); -} -function initConnexion (moduleName, url, loginws, apikey, token) -{ - $.ajax({ - type: 'GET', - url: '../modules/shopimporter/ajax.php', - async: false, - cache: false, - dataType : "json", - data: 'ajax=true&token='+token+'&connexionWs&moduleName='+moduleName+'&url='+ url+'&loginws='+loginws+'&apikey='+apikey , - success: function(jsonData) - { - var jsonError = ''; - $('#connectionInformation').removeAttr('style'); - if (jsonData.hasError) - { - $('#connectionInformation').attr('style','width: 400px;background-color: #FAE2E3;border: 1px solid #EC9B9B'); - for (i=0;i'+jsonData.error[i]+''; - $('#connectionInformation').slideDown('slow'); - $('#connectionInformation').html('
    '+jsonError+'
'); - $('#connectionInformation').show(); - }else - { - - $('#connectionInformation').attr('style','width: 400px;background-color: #DFFAD3;border: 1px solid #72CB67'); - $('#connectionInformation').slideDown('slow'); - $('#connectionInformation').html('
    Connection successful
'); - $('#connectionInformation').show(); - $('#importOptions').show(); - displaySpecificOptionsWsdl(moduleName, token); - } - }, - error: function(XMLHttpRequest, textStatus, errorThrown) - { - alert('TECHNICAL ERROR\nDetails:\nError thrown: ' + XMLHttpRequest + '\n' + 'Text status: ' + textStatus); - } - }); -} - -function displaySpecificOptionsWsdl(moduleName,token) -{ - - $.ajax({ - type: 'GET', - url: '../modules/shopimporter/ajax.php', - async: false, - cache: false, - dataType : 'html', - data: 'ajax=true&token='+token+'&displaySpecificOptionsWsdl&moduleName='+moduleName , - success: function(htmlData) - { - $('#specificOptionsContent').html(htmlData); - $('#specificOptions').hide(); - $('#importOptions').show(); - }, - error: function(XMLHttpRequest, textStatus, errorThrown) - { - alert('TECHNICAL ERROR\nDetails:\nError thrown: ' + XMLHttpRequest + '\n' + 'Text status: ' + textStatus); - } - }); -} -function validateSpecificOptions(moduleName, specificOptions) -{ - $.ajax({ - type: 'GET', - url: '../modules/shopimporter/ajax.php', - async: false, - cache: false, - dataType : 'json', - data: 'ajax=true&token='+token+'&validateSpecificOptions&moduleName='+moduleName+specificOptions , - success: function(jsonData) - { - var jsonError = ''; - if (jsonData.hasError) - { - for (i=0;i'+jsonData.error[i]+''; - $('#specificOptionsErrors').html('
    '+jsonError+'
'); - $('#specificOptionsErrors').fadeIn('slow'); - } - }, - error: function(XMLHttpRequest, textStatus, errorThrown) - { - alert('TECHNICAL ERROR\nDetails:\nError thrown: ' + XMLHttpRequest + '\n' + 'Text status: ' + textStatus); - } - }); - - if ($('#specificOptionsErrors').html().length != 0) - return false; - else - return true; -} - -//init configuration connector (database or webservice) -function initConfigConnector() -{ - if($('#choose_module_name').attr('value')) - { - $('#db_config').hide(); - $('#importOptions').hide(); - $('#steps').html(''); - - if ($('#import_module_name').attr('value') != 0) - { - $('#displayOptions').show(); - $.ajax({ - type: 'GET', - url: '../modules/shopimporter/ajax.php', - async: false, - cache: false, - dataType : 'html', - - data: 'ajax=true&token='+globalAjaxShopImporterToken+'&displayConfigConnector&moduleName='+$('#import_module_name').val() , - success: function(html) - { - $('#config_connector').html(html); - $('#config_connector').show(); - $('#db_config').slideDown('slow'); - $('#displayOptions').show(); - $('#checkAndSaveConfig').show(); - }, - error: function(XMLHttpRequest, textStatus, errorThrown) - { - alert('TECHNICAL ERROR\nDetails:\nError thrown: ' + XMLHttpRequest + '\n' + 'Text status: ' + textStatus); - } - }); - } - else - { - $('#db_config').slideUp('slow'); - $('#checkAndSaveConfig').show(); - - } - } -} - -$(document).ready(function(){ - $('#displayOptions').hide(); - $('#db_input input').each(function () { - $(this).keyup(function () { - $('#steps').fadeOut(200, function () { - $(this).html(''); - $('#steps').fadeIn(); - }); - $('#importOptions').fadeOut('slow'); - $('#displayOptions').show(); - $('#checkAndSaveConfig').show(); - }) - }); - - $('input[name=hasErrors]:radio').change(function () { - if ($(this).val() == 1) - $('#warnSkip').fadeIn('slow'); - else - $('#warnSkip').fadeOut('slow'); - }); - - $('#choose_module_name').unbind('click').click(function(){ - initConfigConnector(); - }); - - $('#displayOptions').unbind('click').click(function(){ - $('#displayOptions').show(); - if(type_connector == 'ws') - { - if($('#loginws').val() == '' || $('#apikey').val() == '' || $('#url').val() == '') - { - $('#connectionInformation').slideDown('slow'); - $('#connectionInformation').html('Url wsdl, User name,API key are required fields'); - $('#connectionInformation').show(); - return false; - }else{ - $('#connectionInformation').hide(); - } - token = globalAjaxShopImporterToken; - initConnexion($('#import_module_name').val(), $('#url').val(), $('#loginws').val(), $('#apikey').val(), token); - - return false; - } - else if (type_connector == 'db') - { - moduleName = $('#import_module_name').val(); - server = $('#server').val(); - user = $('#user').val(); - password = $('#password').val(); - database = $('#database').val(); - prefix = $('#prefix').val(); - token = globalAjaxShopImporterToken; - displaySpecificOptions(moduleName, server, user, password, database, prefix, token); - } - $(this).fadeOut('slow'); - $('#importOptions').slideDown('slow'); - - return false; - }); - - $('#checkAndSaveConfig').unbind('click').click(function(){ - $('#steps, #specificOptionsErrors').html(''); - $('#specificOptionsErrors').hide(); - shopImporter.specificOptions = ''; - $('#specificOptionsContent :input').each(function (){ - shopImporter.specificOptions = shopImporter.specificOptions+'&'+$(this).attr('name')+'='+$(this).attr('value'); - }); - shopImporter.imagesOptions = ''; - $('.importImages:input:checked').each(function (){ - shopImporter.imagesOptions = shopImporter.imagesOptions+'&'+$(this).attr('name'); - }); - moduleName = $('#import_module_name').val(); - if (validateSpecificOptions(moduleName, shopImporter.specificOptions) == true) - { - if(type_connector == 'ws') - { - $.scrollTo($('#steps'), 300 , { - onAfter:function(){ - shopImporter.specificOptions = ''; - $('#specificOptionsContent :input').each(function (){ - shopImporter.specificOptions = shopImporter.specificOptions+'&'+$(this).attr('name')+'='+$(this).attr('value'); - }); - shopImporter.idMethod = 0; - shopImporter.limit = 0; - shopImporter.nbr_import = parseInt($('#nbr_import').val()); - shopImporter.save = 0; - - shopImporter.moduleName = $('#import_module_name').val(); - shopImporter.url = $('#url').val(); - shopImporter.loginws = $('#loginws').val(); - shopImporter.apikey = $('#apikey').val(); - - shopImporter.token = globalAjaxShopImporterToken; - shopImporter.hasErrors = $('input[name=hasErrors]:radio:checked').val(); - - shopImporter.checkAndSaveConfigWS(shopImporter.save); - shopImporter.checkAndSaveConfigWSDL(); - return false; - } - }); - }else if (type_connector == 'db') - { - $.scrollTo($('#steps'), 300 , { - onAfter:function(){ - shopImporter.specificOptions = ''; - $('#specificOptionsContent :input').each(function (){ - shopImporter.specificOptions = shopImporter.specificOptions+'&'+$(this).attr('name')+'='+$(this).attr('value'); - }); - shopImporter.idMethod = 0; - shopImporter.limit = 0; - shopImporter.nbr_import = parseInt($('#nbr_import').val()); - shopImporter.save = 0; - shopImporter.moduleName = $('#import_module_name').val(); - shopImporter.server = $('#server').val(); - shopImporter.user = $('#user').val(); - shopImporter.password = $('#password').val(); - shopImporter.database = $('#database').val(); - shopImporter.prefix = $('#prefix').val(); - shopImporter.token = globalAjaxShopImporterToken; - shopImporter.hasErrors = $('input[name=hasErrors]:radio:checked').val(); - shopImporter.checkAndSaveConfig(shopImporter.save); - return false; - } - }); - } - } - }); - - $('#importOptionsYesNo :radio').change( function () { - $('#steps').html(''); - onThing = false; - - $('#importOptionsYesNo :radio:checked').each( function () { - if ($(this).attr('value') == 1) - onThing = true; - }); - if (onThing) - $('#checkAndSaveConfig').fadeIn(); - else - { - $('#checkAndSaveConfig').fadeOut(); - $('#steps').html('
'+oneThing+'
'); - $('#one_thing_error_feedback').fadeIn('slow'); - } - }); -}); diff --git a/modules/shopimporter/shopimporter.php b/modules/shopimporter/shopimporter.php deleted file mode 100644 index b5d67680d..000000000 --- a/modules/shopimporter/shopimporter.php +++ /dev/null @@ -1,1522 +0,0 @@ - -* @copyright 2007-2013 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -if (!defined('_PS_VERSION_')) - exit; - -class shopimporter extends ImportModule -{ - public $supportedImports = array(); - - public function __construct() - { - $this->name = 'shopimporter'; - $this->tab = 'migration_tools'; - $this->version = '1.0'; - $this->author = 'PrestaShop'; - $this->need_instance = 0; - $this->is_configurable = 1; - - parent::__construct (); - - $this->displayName = $this->l('Shop Importer'); - $this->description = $this->l('This module allows you to import your shop from another system into Prestashop.'); - $this->supportedImports = array( - 'language' => array('methodName' => 'getLangagues', - 'name' => $this->l('Language'), - 'className' => 'Language', - 'label' => $this->l('Import Languages'), - 'table' => 'lang', - 'identifier' => 'id_lang', - 'alterTable' => array('id_lang' => 'int(10)'), - 'info' => $this->l('New languages will automatically add translations.'), - 'defaultId' => 'PS_LANG_DEFAULT' - ), - 'currency' => array('methodName' => 'getCurrencies', - 'name' => $this->l('Currency'), - 'className' => 'Currency', - 'label' => $this->l('Import Currencies'), - 'table' => 'currency', - 'identifier' => 'id_currency', - 'alterTable' => array('id_currency' => 'int(10)'), - 'delete' => true, - 'defaultId' => 'PS_CURRENCY_DEFAULT' - ), - /* - 'tax' => array('methodName' => 'getTaxes', - 'name' => $this->l('Taxes'), - 'className' => 'Tax', - 'label' => $this->l('Import Taxes'), - 'table' => 'tax', - 'identifier' => 'id_tax', - 'alterTable' => array('id_tax' => 'int(10)'), - 'delete' => true - ), - 'tax_rule' => array('methodName' => 'getTaxes rules', - 'name' => $this->l('Taxes rules'), - 'className' => 'TaxRule', - 'label' => $this->l('Import Taxes Rules'), - 'table' => 'tax_rules_group', - 'identifier' => 'id_tax', - 'alterTable' => array('id_tax_rules_group' => 'int(10)'), - 'delete' => true - ), -*/ - 'zone' => array('methodName' => 'getZones', - 'name' => $this->l('Zone'), - 'className' => 'Zone', - 'label' => $this->l('Import Zones'), - 'table' => 'zone', - 'identifier' => 'id_zone', - 'alterTable' => array('id_zone' => 'int(10)'), - 'delete' => true - ), - 'country' => array('methodName' => 'getCountries', - 'name' => $this->l('Country'), - 'className' => 'Country', - 'label' => $this->l('Import Countries'), - 'table' => 'country', - 'identifier' => 'id_country', - 'foreign_key' => array('id_zone', 'id_currency'), - 'alterTable' => array('id_country' => 'int(10)'), - 'delete' => true, - 'defaultId' => 'PS_COUNTRY_DEFAULT' - ), - 'state' => array('methodName' => 'getStates', - 'name' => $this->l('State'), - 'className' => 'State', - 'label' => $this->l('Import States'), - 'table' => 'state', - 'identifier' => 'id_state', - 'foreign_key' => array('id_zone', 'id_country'), - 'alterTable' => array('id_state' => 'int(10)'), - 'delete' => true - ), - 'group' => array('methodName' => 'getGroups', - 'name' => $this->l('Group'), - 'className' => 'Group', - 'label' => $this->l('Import Groups'), - 'table' => 'group', - 'identifier' => 'id_group', - 'alterTable' => array('id_group' => 'int(10)'), - 'delete' => true, - ), - 'customer' => array('methodName' => 'getCustomers', - 'name' => $this->l('Customer'), - 'className' => 'Customer', - 'label' => $this->l('Import Customers'), - 'table' => 'customer', - 'identifier' => 'id_customer', - 'foreign_key' => array('id_group'), - 'alterTable' => array('id_customer' => 'int(10)', 'passwd' => 'varchar(100)'), - 'delete' => true, - 'association' => array( - array( - 'table' => 'customer_group', - 'fields' => array('id_customer', 'id_group'), - 'matchTable' => array('customer', 'group'), - ) - ) - ), - 'address' => array('methodName' => 'getAddresses', - 'name' => $this->l('Address'), - 'className' => 'Address', - 'label' => $this->l('Import Addresses'), - 'table' => 'address', - 'identifier' => 'id_address', - 'foreign_key' => array('id_country', 'id_state', 'id_customer'), - 'alterTable' => array('id_address' => 'int(10)'), - 'delete' => true - ), - 'manufacturer' => array('methodName' => 'getManufacturers', - 'name' => $this->l('Manufacturer'), - 'className' => 'Manufacturer', - 'label' => $this->l('Import Manufacturers'), - 'table' => 'manufacturer', - 'identifier' => 'id_manufacturer', - 'delete' => true, - 'alterTable' => array('id_manufacturer' => 'int(10)'), - 'hasImage' => true - ), - 'supplier' => array('methodName' => 'getSuppliers', - 'name' => $this->l('Supplier'), - 'className' => 'Supplier', - 'label' => $this->l('Import Suppliers'), - 'table' => 'supplier', - 'identifier' => 'id_supplier', - 'delete' => true, - 'alterTable' => array('id_supplier' => 'int(10)'), - 'hasImage' => true - ), - 'category' => array('methodName' => 'getCategories', - 'name' => $this->l('Category'), - 'className' => 'Category', - 'label' => $this->l('Import Categories'), - 'table' => 'category', - 'identifier' => 'id_category', - 'alterTable' => array('id_category' => 'int(10)'), - 'delete' => true, - 'hasImage' => true, - ), - 'attributegroup' => array('methodName' => 'getAttributesGroups', - 'name' => $this->l('AttributeGroup'), - 'className' => 'AttributeGroup', - 'label' => $this->l('Import Attributes Groups'), - 'table' => 'attribute_group', - 'identifier' => 'id_attribute_group', - 'alterTable' => array('id_attribute_group' => 'int(10)'), - 'delete' => true - ), - 'attribute' => array('methodName' => 'getAttributes', - 'name' => $this->l('Attribute'), - 'className' => 'Attribute', - 'label' => $this->l('Import Attributes'), - 'table' => 'attribute', - 'identifier' => 'id_attribute', - 'alterTable' => array('id_attribute' => 'int(10)'), - 'foreign_key' => array('id_attribute_group'), - 'delete' => true - ), - 'product' => array('methodName' => 'getProducts', - 'name' => $this->l('Product'), - 'className' => 'Product', - 'label' => $this->l('Import Products'), - 'table' => 'product', - 'identifier' => 'id_product', - 'alterTable' => array('id_product' => 'int(10)'), - 'foreign_key' => array('id_category', 'id_manufacturer'), - 'delete' => true, - 'association' => array( - array( - 'table' => 'category_product', - 'fields' => array('id_category', 'id_product'), - 'matchTable' => array('category', 'product') - ) - ), - 'hasImage' => true - ), - 'combination' => array('methodName' => 'getProductsCombination', - 'name' => $this->l('Combination'), - 'className' => 'Combination', - 'label' => $this->l('Import Products Combinations'), - 'table' => 'product_attribute', - 'identifier' => 'id_product_attribute', - 'alterTable' => array('id_product_attribute' => 'int(10)', 'id_product' => 'int(10)'), - 'foreign_key' => array('id_product'), - 'delete' => false, - 'association' => array( - array( - 'table' => 'product_attribute_combination', - 'fields' => array('id_attribute', 'id_product_attribute'), - 'matchTable' => array('attribute', 'product_attribute') - ) - ) - ), - 'orderstate' => array('methodName' => 'getOrdersStates', - 'name' => $this->l('Orders States'), - 'className' => 'OrderState', - 'label' => $this->l('Import Orders States'), - 'table' => 'order_state', - 'identifier' => 'id_order_state', - 'alterTable' => array('id_order_state' => 'int(10)') - ), - 'cart' => array('methodName' => 'getOrders', - 'name' => $this->l('Order'), - 'className' => 'Cart', - 'label' => $this->l('Import Orders'), - 'table' => 'cart', - 'identifier' => 'id_cart', - 'foreign_key' => array('id_address_delivery', 'id_address_invoice', 'id_customer'), - 'alterTable' => array('id_cart' => 'int(10)') - ), - 'orderhistory' => array('methodName' => 'getOrdersHistory', - 'name' => $this->l('Order history'), - 'className' => 'Order history', - 'label' => $this->l('Import Order History'), - 'table' => 'order_history', - 'identifier' => 'id_order_history', - 'foreign_key' => array('id_order', 'id_order_state'), - 'alterTable' => array('id_order_history' => 'int(10)'), - 'hidden' => true - ), - 'order' => array('methodName' => 'getOrders', - 'name' => $this->l('Order'), - 'className' => 'Order', - 'label' => $this->l('Import Order History'), - 'table' => 'orders', - 'identifier' => 'id_order', - 'alterTable' => array('id_order' => 'int(10)'), - 'hidden' => true - ) - ); - } - - public function install() - { - return parent::install(); - } - - public function uninstall() - { - return parent::uninstall(); - } - - public function getContent() - { - $exportModules = parent::getImportModulesOnDisk(); - //get installed module only - foreach($exportModules as $key => $module) - if ($module->name == $this->name || !(bool)$module->id) - unset($exportModules[$key]); - $html = ' - - - - -
'.$this->l('Import from another system').' -
- '.$this->l('Before starting the import please backup your database. ').' - '.$this->l(' Click here to backup').' -
-
-
'; - if (sizeof($exportModules)) - { - $html .= ' - -
- -
'; - } - else - $html .= '
'.$this->l('No import module installed').'
'; - $html .= ' - -
-
- -
-
- -
'; - return $html; - } - - public function genericImport($className, $fields, $save = false) - { - $return = ''; - $json = array(); - $errors = array(); - $json['hasError'] = false; - $json['datas'] = array_values($fields); - $languages = array(); - $defaultLanguage = ''; - $table = $this->supportedImports[strtolower($className)]['table']; - - $object = new $className(); - $rules = call_user_func(array($className, 'getValidationRules'), $className); - - if ((sizeof($rules['requiredLang']) || sizeof($rules['sizeLang']) || sizeof($rules['validateLang']) || Tools::isSubmit('syncLang') || Tools::isSubmit('syncCurrency'))) - { - $moduleName = Tools::getValue('moduleName'); - if (Validate::isModuleName($moduleName) && file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php')) - { - require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php'); - $importModule = new $moduleName(); - $importModule->server = Tools::getValue('server'); - $importModule->user = Tools::getValue('user'); - $importModule->passwd = Tools::getValue('password'); - $importModule->database = Tools::getValue('database'); - $importModule->prefix = Tools::getValue('prefix'); - $defaultLanguage = new Language((int)Configuration::get('PS_LANG_DEFAULT')); - $languages = $importModule->getLangagues(0); - if (Tools::isSubmit('syncLang') || Tools::isSubmit('syncLangWS')) - { - $defaultIdLand = $importModule->getDefaultIdLang(); - $defaultLanguageImport = new Language(Language::getIdByIso($languages[$defaultIdLand]['iso_code'])); - if ($defaultLanguage->iso_code != $defaultLanguageImport->iso_code) - $errors[] = $this->l('Default language doesn\'t match : ').'
'.Configuration::get('PS_SHOP_NAME').' : '.$defaultLanguage->name.' ≠ - '.$importModule->displayName.' : '.$defaultLanguageImport->name.'
'.$this->l('Please change default language in your configuration'); - } - - if (Tools::isSubmit('syncCurrency') || Tools::isSubmit('syncCurrencyWS')) - { - $defaultIdCurrency = $importModule->getDefaultIdCurrency(); - $currencies = $importModule->getCurrencies(0); - if(!empty($currencies[$defaultIdCurrency]['iso_code'])) - $defaultCurrencyImport = new Currency((int)Currency::getIdByIsoCode($currencies[$defaultIdCurrency]['iso_code'])); - else - $defaultCurrencyImport = new Currency((int)Currency::getIdByIsoCodeNum($currencies[$defaultIdCurrency]['iso_code_num'])); - - $defaultCurrency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT')); - if ($defaultCurrency->iso_code != $defaultCurrencyImport->iso_code) - $errors[] = $this->l('Default currency doesn\'t match : ').'
'.Configuration::get('PS_SHOP_NAME').' : '.$defaultCurrency->name.' ≠ '.$importModule->displayName.' : '.$defaultCurrencyImport->name.'
'.$this->l('Please change default currency in your configuration'); - } - if (!empty($errors)) - die('{"hasError" : true, "error" : '.Tools::jsonEncode($errors).'}'); - } - else - die('{"hasError" : true, "error" : ["FATAL ERROR"], "datas" : []}'); - } - - foreach($fields as $key => $field) - { - $id = $this->supportedImports[strtolower($className)]['identifier']; - //remove wrong fields (ex : id_toto in Customer) - foreach($field as $name => $value) - if (!array_key_exists($name, get_object_vars($object)) AND ($name != $id) AND ($name != 'association') AND ($name != 'images') AND (strtolower($className) != 'cart')) - unset($field[$name]); - $return = $this->validateRules($rules, $field, $className, $languages, $defaultLanguage); - $fields[$key] = $field; - if (!empty($return)) - { - //skip mode - if (Tools::getValue('hasErrors') == 1) - unset($fields[$key]); - - $errors[] = $return; - array_unshift($errors[sizeof($errors)-1], $field[$id]); - } - } - if (sizeof($errors) > 0) - { - $json['hasError'] = true; - $json['error'] = $errors; - } - - if ($save || Tools::isSubmit('syncLang') || Tools::isSubmit('syncLangWS')) - { - //add language if not exist in prestashop - if ($className == 'Language') - { - if (Tools::isSubmit('syncLang') || Tools::isSubmit('syncLangWS')) - $add = true; - else - $add = false; - $errors = $this->checkAndAddLang($fields, $add); - } - elseif ($className == 'Cart') - { - $this->saveOrders($fields); - } - else - { - $return = $this->saveObject($className, $fields); - $this->cleanPositions($table); - //insert association - if (array_key_exists('association', $this->supportedImports[strtolower($className)])) - $this->insertAssociation(strtolower($className), $fields); - if (!empty($return)) - { - $json['hasError'] = true; - $json['error'] = $return; - } - } - if ($className == 'Category' AND (sizeof($fields) != (int)Tools::getValue('nbr_import'))) - $this->updateCat(); - } - if (sizeof($errors) > 0 AND is_array($errors)) - { - $json['hasError'] = true; - $json['error'] = $errors; - } - die(Tools::jsonEncode($json)); - } - public function genericImportWS($className, $fields, $save = false) - { - - $return = ''; - $json = array(); - $errors = array(); - $json['hasError'] = false; - $json['datas'] = array_values($fields); - $languages = array(); - $defaultLanguage = ''; - $table = $this->supportedImports[strtolower($className)]['table']; - - $object = new $className(); - - $rules = call_user_func(array($className, 'getValidationRules'), $className); - - - if ((sizeof($rules['requiredLang']) || sizeof($rules['sizeLang']) || sizeof($rules['validateLang']) || Tools::isSubmit('syncLangWS') || Tools::isSubmit('syncCurrency'))) - { - $moduleName = Tools::getValue('moduleName'); - if (Validate::isModuleName($moduleName) && file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php')) - { - - require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php'); - $importModule = new $moduleName(); - - $defaultLanguage = new Language((int)Configuration::get('PS_LANG_DEFAULT')); - - $languages = $importModule->getLangagues(); - - if (Tools::isSubmit('syncLangWS')) - { - $defaultIdLand = $importModule->getDefaultIdLang(); - $defaultLanguageImport = new Language(Language::getIdByIso($languages[$defaultIdLand]['iso_code'])); - if ($defaultLanguage->iso_code != $defaultLanguageImport->iso_code) - $errors[] = $this->l('Default language doesn\'t match : ').'
'.Configuration::get('PS_SHOP_NAME').' : '.$defaultLanguage->name.' ≠ - '.$importModule->displayName.' : '.$defaultLanguageImport->name.'
'.$this->l('Please change default language in your configuration'); - } - - if (Tools::isSubmit('syncCurrency')) - { - $defaultIdCurrency = $importModule->getDefaultIdCurrency(); - $currencies = $importModule->getCurrencies(); - if (!empty($currencies[$defaultIdCurrency]['iso_code'])) - $defaultCurrencyImport = new Currency((int)Currency::getIdByIsoCode($currencies[$defaultIdCurrency]['iso_code'])); - else - $defaultCurrencyImport = new Currency((int)Currency::getIdByIsoCodeNum($currencies[$defaultIdCurrency]['iso_code_num'])); - - $defaultCurrency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT')); - if ($defaultCurrency->iso_code != $defaultCurrencyImport->iso_code) - $errors[] = $this->l('Default currency doesn\'t match : ').'
'.Configuration::get('PS_SHOP_NAME').' : '.$defaultCurrency->name.' ≠ '.$importModule->displayName.' : '.$defaultCurrencyImport->name.'
'.$this->l('Please change default currency in your configuration'); - } - if (!empty($errors)) - die('{"hasError" : true, "error" : '.Tools::jsonEncode($errors).'}'); - } - else - die('{"hasError" : true, "error" : ["FATAL ERROR"], "datas" : []}'); - } - - foreach($fields as $key => $field) - { - $id = $this->supportedImports[strtolower($className)]['identifier']; - //remove wrong fields (ex : id_toto in Customer) - foreach($field as $name => $value) - if (!array_key_exists($name, get_object_vars($object)) AND ($name != $id) AND ($name != 'association') AND ($name != 'images') AND (strtolower($className) != 'cart')) - unset($field[$name]); - $return = $this->validateRules($rules, $field, $className, $languages, $defaultLanguage); - $fields[$key] = $field; - if (!empty($return)) - { - //skip mode - if (Tools::getValue('hasErrors') == 1) - unset($fields[$key]); - - $errors[] = $return; - array_unshift($errors[sizeof($errors)-1], $field[$id]); - } - } - if (sizeof($errors) > 0) - { - $json['hasError'] = true; - $json['error'] = $errors; - } - if ($save || Tools::isSubmit('syncLang') || Tools::isSubmit('syncLangWS')) - { - //add language if not exist in prestashop - if ($className == 'Language') - { - if (Tools::isSubmit('syncLang') || Tools::isSubmit('syncLangWS')) - $add = true; - else - $add = false; - $errors = $this->checkAndAddLang($fields, $add); - } - elseif ($className == 'Cart') - { - $this->saveOrders($fields); - } - else - { - $return = $this->saveObject($className, $fields); - $this->cleanPositions($table); - //insert association - if (array_key_exists('association', $this->supportedImports[strtolower($className)])) - $this->insertAssociation(strtolower($className), $fields); - if (!empty($return)) - { - $json['hasError'] = true; - $json['error'] = $return; - } - } - if ($className == 'Category' AND (sizeof($fields) != (int)Tools::getValue('nbr_import'))) - $this->updateCat(); - } - if (sizeof($errors) > 0 AND is_array($errors)) - { - $json['hasError'] = true; - $json['error'] = $errors; - } - die(Tools::jsonEncode($json)); - } - - private function saveObject($className, $items) - { - $return = array(); - $table = $this->supportedImports[strtolower($className)]['table']; - //creating temporary fields for identifiers matching and password - if (array_key_exists('alterTable', $this->supportedImports[strtolower($className)])) - $this->alterTable(strtolower($className)); - $matchIdLang = $this->getMatchIdLang(1); - foreach($items as $item) - { - $object = new $className; - $id = $item[$this->supportedImports[strtolower($className)]['identifier']]; - if (array_key_exists('foreign_key', $this->supportedImports[strtolower($className)])) - $this->replaceForeignKey($item, $table); - - foreach($item as $key => $val) - { - if ($key == 'passwd') - { - $password = $val; - $val = '------'; - } - if (is_array($val) AND $key != 'images') - { - $tmp = array(); - foreach($matchIdLang as $k => $v) - { - if (array_key_exists($k, $val)) - { - $tmp[$v] = $val[$k]; - } - } - - $object->$key = $tmp; - } - else - $object->$key = $val; - } - if (!$object->save(false, false)) - $return[] = array($item[$this->supportedImports[strtolower($className)]['identifier']], $this->l('An error occurred when adding the object')); - else - { - $this->saveMatchId(strtolower($className), (int)$object->id, (int)$id); - if ($className == 'Customer') - Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'customer SET `passwd_'.bqSQL(Tools::getValue('moduleName')).'` = \''.pSQL($password).'\' WHERE id_customer = '.(int)$object->id); - if (array_key_exists('hasImage', $this->supportedImports[strtolower($className)]) AND Tools::isSubmit('images_'.$className)) - $this->copyImg($item, $className); - } - } - return $return; - } - - private function saveOrders($items) - { - $this->saveObject('cart', $items); - //import cart product - $foreignKey = $this->getForeignKey('Cart', array('id_cart', 'id_product', 'id_product_attribute', 'id_customer','id_address_invoice', 'id_address_delivery')); - foreach($items as &$item) - { - foreach($item['cart_products'] as $k => $cart_products) - { - foreach($cart_products as $key => $val) - if (array_key_exists($key, $foreignKey)) - if (array_key_exists($val, $foreignKey[$key])) - $item['cart_products'][$k][$key] = $foreignKey[$key][$val]; - else - $item['cart_products'][$k][$key] = 0; - Db::getInstance()->insert('cart_product', $item['cart_products'][$k]); - } - foreach($item['order_products'] as $k => $order_products) - { - foreach($order_products as $key => $val) - if (array_key_exists($key, $foreignKey) || $key == 'product_id') - //patch to correct a mistake naming column in the database - if ($key == 'product_id') - $item['order_products'][$k]['product_id'] = $foreignKey['id_product'][$val]; - elseif (array_key_exists($val, $foreignKey[$key])) - $item['order_products'][$k][$key] = $foreignKey[$key][$val]; - else - $item['order_products'][$k][$key] = 0; - } - } - //cart to order - $this->cartToOrder($items, $foreignKey); - $foreignKey = array_merge($this->getForeignKey('Cart', array('id_order', 'id_order_state')), $foreignKey); - foreach($items as &$item) - { - //insert product in order detail - foreach($item['order_products'] as $k => $order_products) - { - foreach($order_products as $key => $val) - if (array_key_exists($key, $foreignKey)) - if (array_key_exists($val, $foreignKey[$key])) - $item['order_products'][$k][$key] = $foreignKey[$key][$val]; - else - $item['order_products'][$k][$key] = 0; - Db::getInstance()->insert('order_detail', $item['order_products'][$k]); - } - //save order history - foreach($item['order_history'] as $k => $order_history) - { - foreach($order_history as $key => $val) - if (array_key_exists($key, $foreignKey)) - if (array_key_exists($val, $foreignKey[$key])) - $item['order_history'][$k][$key] = $foreignKey[$key][$val]; - else - $item['order_history'][$k][$key] = 0; - - Db::getInstance()->insert('order_history', $item['order_history'][$k]); - } - } - } - - private function insertAssociation($table, $items) - { - foreach($this->supportedImports[$table]['association'] AS $association) - { - $associatFields = ''; - $associatFieldsName = implode('`, `', $association['fields']); - $tableAssociation = $association['table']; - $matchTable = $association['matchTable']; - if (!empty($items)) - { - $match = array(); - foreach($matchTable as $mTable) - { - $tmp = $this->getForeignKey($mTable, array('id_'.$mTable)); - if (array_key_exists('id_'.$mTable, $tmp)) - $match['id_'.$mTable] = $tmp['id_'.$mTable]; - else - $match['id_'.$mTable] = $this->getDefaultId($table); - } - foreach($items AS $item) - foreach($item AS $key => $val) - if ($key == 'association' AND !empty($key)) - foreach($val[$tableAssociation] AS $k => $v) - { - $associatFields .= ' ('.((array_key_exists($k, $match[$association['fields'][0]])) ? (int)$match[$association['fields'][0]][$k] : '1').', '; - $associatFields .= (int)$match[$association['fields'][1]][$v].'), '; - } - if ($associatFields != '') - Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.bqSQL($tableAssociation).'` (`'.$associatFieldsName.'`) VALUES '.rtrim($associatFields, ', ')); - } - } - } - - private function saveMatchId($className, $psId, $matchId) - { - $table = $this->supportedImports[$className]['table']; - $moduleName = Tools::getValue('moduleName'); - $identifier = $this->supportedImports[$className]['identifier']; - Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.bqSQL($table).'` SET `'.bqSQL($identifier).'_'.bqSQL($moduleName).'` = '.(int)$matchId.' WHERE `'.bqSQL($identifier).'` = '.(int)$psId); - } - - private function getMatchId($className) - { - $table = $this->supportedImports[$className]['table']; - $moduleName = Tools::getValue('moduleName'); - $identifier = $this->supportedImports[$className]['identifier']; - $returns = Db::getInstance()->executeS('SELECT `'.bqSQL($identifier).'_'.bqSQL($moduleName).'`, `'.bqSQL($identifier).'` FROM `'._DB_PREFIX_.bqSQL($table).'` WHERE `'.bqSQL($identifier).'_'.bqSQL($moduleName).'` != 0 '); - $match = array(); - foreach($returns as $return) - $match[$return[$identifier.'_'.$moduleName]] = $return[$identifier]; - return $match; - } - - private function getDefaultId($table) - { - $defaultId = 1; - if (array_key_exists('defaultId', $this->supportedImports[strtolower($table)])) - $defaultId = Configuration::get($this->supportedImports[strtolower($table)]['defaultId']); - return $defaultId; - } - - private function copyImg($item, $className) - { - require_once('../../images.inc.php'); - $identifier = $this->supportedImports[strtolower($className)]['identifier']; - $matchId = $this->getMatchId(strtolower($className)); - $matchIdLang = $this->getMatchIdLang(); - switch($className) - { - default: - case 'Product': - $path = _PS_PROD_IMG_DIR_; - break; - case 'Category': - $path = _PS_CAT_IMG_DIR_; - break; - case 'Manufacturer': - $path = _PS_MANU_IMG_DIR_; - break; - case 'Supplier': - $path = _PS_SUPP_IMG_DIR_; - break; - } - $cover = 1; - if (array_key_exists($item[$identifier], $matchId)) - if(array_key_exists('images', $item) && !is_null($item['images'])) - foreach($item['images'] as $key => $image) - { - $tmpfile = tempnam(_PS_TMP_IMG_DIR_, 'import'); - if (@copy(str_replace(' ', '%20', $image), $tmpfile)) - { - if ($className == 'Product') - { - $image = new Image(); - $image->id_product = (int)($matchId[$item[$identifier]]); - $image->cover = $cover; - $image->position = Image::getHighestPosition((int)$matchId[$item[$identifier]]) + 1; - $legend = array(); - foreach($item['name'] as $key => $val) - if (array_key_exists($key, $matchIdLang)) - $legend[$matchIdLang[$key]] = Tools::link_rewrite($val); - else - $legend[Configuration::get('PS_LANG_DEFAULT')] = Tools::link_rewrite($val); - $image->legend = $legend; - $image->add(); - $path = $image->getPathForCreation(); - ImageManager::resize($tmpfile, $path.'.jpg'); - } - else - { - ImageManager::resize($tmpfile, $path.(int)$matchId[$item[$identifier]].'.jpg'); - } - } - else - @unlink($tmpfile); - @unlink($tmpfile); - $cover = 0; - } - - } - - private function replaceForeignKey(&$item, $table) - { - if ($table == 'product_attribute') - $table2 = 'combination'; - else - $table2 = $table; - - $foreingKey = $this->supportedImports[$table2]['foreign_key']; - $foreingKeyValue = $this->getForeignKey($table, $foreingKey); - foreach($foreingKey as $key) - { - if ($table == 'product' AND $key == 'id_category') - $key2 = 'id_category_default'; - else if ($table == 'customer' AND $key == 'id_group') - $key2 = 'id_default_group'; - else - $key2 = $key; - if (array_key_exists($key, $foreingKeyValue) && $item[$key2] != 0) - $item[$key2] = (array_key_exists($item[$key2], $foreingKeyValue[$key]) ? $item[$key2] = $foreingKeyValue[$key][$item[$key2]] : $item[$key2] = 0); - else - $item[$key2] = $this->getDefaultId($table); - } - } - - private function alterTable($className) - { - $query =''; - $queryTmp = ''; - $from = $this->supportedImports[$className]['table']; - $result = array(); - $result = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.bqSQL($from).'`'); - if (!$result) - $result = array(); - foreach ($this->supportedImports[$className]['alterTable'] AS $name => $type) - { - $moduleName = Tools::getValue('moduleName'); - Db::getInstance()->executeS("SHOW COLUMNS FROM `"._DB_PREFIX_.bqSQL($from)."` LIKE '".pSQL($name).'_'.pSQL($moduleName)."'"); - if (!Db::getInstance()->numRows() AND !array_key_exists($name.'_'.$moduleName, $result)) - $queryTmp .= ' ADD `'.$name.'_'.$moduleName.'` '.$type.' NOT NULL,'; - } - if (!empty($queryTmp)) - { - $query = 'ALTER TABLE `'._DB_PREFIX_.bqSQL($from).'` '; - $query .= rtrim($queryTmp, ','); - Db::getInstance()->execute($query); - } - } - - private function updateCat() - { - $moduleName = Tools::getValue('moduleName'); - Db::getInstance()->execute('UPDATE - '._DB_PREFIX_.'category c - INNER JOIN - '._DB_PREFIX_.'category c2 - ON - c.id_parent = c2.`id_category_'.bqSQL($moduleName).'` - SET - c.id_parent = c2.id_category - WHERE c.`id_category_'.bqSQL($moduleName).'` != 0 - AND c.`id_parent` != 0'); - - // get PS home category - Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'category c - SET c.id_parent = '.Configuration::get('PS_HOME_CATEGORY').' - WHERE c.`id_category_'.bqSQL($moduleName).'` != 0 - AND c.`id_parent` = 0'); - - $category = new Category(); - $cats = $category->getSimpleCategories((int)Configuration::get('PS_LANG_DEFAULT')); - foreach($cats as $cat) - { - $cat = new Category((int)$cat['id_category']); - $cat->level_depth = $cat->calcLevelDepth(); - $cat->update(); - } - } - - private function getForeignKey($className, $foreign_key = null) - { - $moduleName = Tools::getValue('moduleName'); - if (is_null($foreign_key)) - $foreign_key = $this->supportedImports[$className]['foreign_key']; - $match = array(); - foreach($foreign_key AS $key) - { - if (in_array($key , array('id_address_invoice', 'id_address_delivery'))) - $key2 = 'id_address'; - elseif (in_array($key , array('id_category_default'))) - $key2 = 'id_category'; - else - $key2 = $key; - foreach($this->supportedImports AS $table => $conf) - if ($conf['identifier'] == $key2) - $from = $this->supportedImports[$table]['table']; - $return = Db::getInstance()->executeS('SELECT `'.bqSQL($key2).'_'.bqSQL($moduleName).'`, `'.bqSQL($key2).'` FROM `'._DB_PREFIX_.bqSQL($from).'` WHERE `'.bqSQL($key2).'_'.bqSQL($moduleName).'` != 0'); - if (!empty($return)) - foreach($return AS $name => $val) - $match[$key][$val[$key2.'_'.$moduleName]] = $val[$key2]; - } - return $match; - } - - private function getForeignKeyLang($table) - { - $id = $this->supportedImports[$table]['identifier']; - $moduleName = Tools::getValue('moduleName'); - $return = Db::getInstance()->executeS('SELECT `'.bqSQL($id).'_'.bqSQL($moduleName).'`, `'.bqSQL($id).'` FROM `'._DB_PREFIX_.bqSQL($table).'` WHERE `'.bqSQL($id).'_'.bqSQL($moduleName).'` != 0'); - $match = array(); - foreach($return AS $name => $val) - $match[$val[$id.'_'.$moduleName]] = $val[$id]; - return $match; - } - - private function getMatchIdLang($order = 1) - { - $moduleName = Tools::getValue('moduleName'); - $return = Db::getInstance()->executeS('SELECT `id_lang`, `id_lang_'.bqSQL($moduleName).'` FROM `'._DB_PREFIX_.'lang'.'` WHERE `id_lang_'.bqSQL($moduleName).'` != 0'); - $match = array(); - foreach($return AS $name => $val) - if ((bool)$order) - $match[$val['id_lang_'.$moduleName]] = $val['id_lang']; - else - $match[$val['id_lang']] = $val['id_lang_'.$moduleName]; - return $match; - } - - - private function validateRules($rules, &$fields, $className, $languages, $defaultLanguage) - { - $returnErrors = array(); - $hasErrors = Tools::getValue('hasErrors'); - /* Checking for required fields */ - foreach ($rules['required'] AS $field) - if (($value = $fields[$field]) == false AND (string)$value != '0') - if ($hasErrors == 2) - { - if (array_key_exists($field, $rules['size'])) - $size = $rules['size'][$field]; - else - $size = 1; - $fields[$field] = $this->generateData($size, $rules['validate'][$field]); - } - else - $returnErrors[] = sprintf( - $this->l('The field %s is required.'), - call_user_func(array($className, 'displayFieldName'), $field, $className) - ); - - /* Checking for maximum fields sizes */ - foreach ($rules['size'] AS $field => $maxLength) - if (array_key_exists($field, $fields) AND $field != 'passwd') - if ($fields[$field] !== false AND Tools::strlen($fields[$field]) > $maxLength) - if ($hasErrors == 2) - $fields[$field] = substr($fields[$field], 0, $maxLength); - else - $returnErrors[] = sprintf( - $this->l('The field %1$s is too long (%2$d chars max).'), - call_user_func(array($className, 'displayFieldName'), $field, $className), - $maxLength - ); - - /* Checking for fields validity */ - foreach ($rules['validate'] AS $field => $function) - if (array_key_exists($field, $fields)) - if (($value = $fields[$field]) !== false AND ($field != 'passwd')) - if (!Validate::$function($value)) - if ($hasErrors == 2) - { - if (array_key_exists($field, $rules['size'])) - $size = $rules['size'][$field]; - else - $size = 1; - $fields[$field] = $this->generateData($size, $rules['validate'][$field]); - } - else - $returnErrors[] = sprintf( - $this->l('The field %s is invalid.'), - call_user_func(array($className, 'displayFieldName'), $field, $className) - ); - - if ((sizeof($rules['requiredLang']) || sizeof($rules['sizeLang']) || sizeof($rules['validateLang']))) - { - $matchIdLang = $this->getMatchIdLang(0); - /* Checking for multilingual required fields */ - foreach ($rules['requiredLang'] AS $fieldLang) - { - if (($empty = $fields[$fieldLang][$matchIdLang[$defaultLanguage->id]]) === false || empty($empty)) - if ($hasErrors == 2) - { - if (array_key_exists($fieldLang, $rules['sizeLang'])) - $size = $rules['sizeLang'][$fieldLang]; - else - $size = 1; - $fields[$fieldLang][$matchIdLang[$defaultLanguage->id]] = $this->generateData($size, $rules['validateLang'][$fieldLang]); - } - else - $returnErrors[] = sprintf( - $this->l('This field %1$s is required at least in %2$s'), - call_user_func(array($className, 'displayFieldName'), $fieldLang, $className), - $defaultLanguage->name - ); - } - /* Checking for maximum multilingual fields size */ - foreach ($rules['sizeLang'] AS $fieldLang => $maxLength) - foreach ($languages AS $language) - if (isset($fields[$fieldLang][$language['id_lang']]) && $fields[$fieldLang] !== false AND Tools::strlen($fields[$fieldLang][$language['id_lang']]) > $maxLength) - if ($hasErrors == 2) - $fields[$fieldLang] = substr($fields[$fieldLang], 0, $maxLength); - else - $returnErrors[] = sprintf( - $this->l('This field %1$s (%2$s) is too long: %3$d chars max.'), - call_user_func(array($className, 'displayFieldName'), $fieldLang, $className), - $language['name'], - $maxLength - ); - foreach ($rules['validateLang'] AS $fieldLang => $function) - { - foreach ($languages AS $language) - { - if (array_key_exists($fieldLang, $fields) AND array_key_exists($language['id_lang'], $fields[$fieldLang]) AND ($value = $fields[$fieldLang][$language['id_lang']]) !== false AND !empty($value)) - { - if (!Validate::$function($value)) - if ($hasErrors == 2) - { - if (array_key_exists($fieldLang, $rules['sizeLang'])) - $size = $rules['sizeLang'][$fieldLang]; - else - $size = 1; - $fields[$fieldLang][$language['id_lang']] = $this->generateData($size, $rules['validateLang'][$fieldLang]); - } - else - $returnErrors[] = sprintf( - $this->l('The field %1$s (%2$s) is invalid.'), - call_user_func(array($className, 'displayFieldName'), $fieldLang, $className), - $language['name'] - ); - } - } - } - } - return $returnErrors; - } - - private function validateRulesWS($rules, &$fields, $className, $languages, $defaultLanguage) - { - $returnErrors = array(); - $hasErrors = Tools::getValue('hasErrors'); - /* Checking for required fields */ - foreach ($rules['required'] AS $field) - if (($value = $fields[$field]) == false AND (string)$value != '0') - if ($hasErrors == 2) - { - if (array_key_exists($field, $rules['size'])) - $size = $rules['size'][$field]; - else - $size = 1; - $fields[$field] = $this->generateData($size, $rules['validate'][$field]); - } - else - $returnErrors[] = sprintf( - $this->l('The field %s is required.'), - call_user_func(array($className, 'displayFieldName'), $field, $className) - ); - - /* Checking for maximum fields sizes */ - foreach ($rules['size'] AS $field => $maxLength) - if (array_key_exists($field, $fields) AND $field != 'passwd') - if ($fields[$field] !== false AND Tools::strlen($fields[$field]) > $maxLength) - if ($hasErrors == 2) - $fields[$field] = substr($fields[$field], 0, $maxLength); - else - $returnErrors[] = sprintf( - $this->l('The field %1$s is too long (%2$d chars max).'), - call_user_func(array($className, 'displayFieldName'), $field, $className), - $maxLength - ); - - /* Checking for fields validity */ - foreach ($rules['validate'] AS $field => $function) - if (array_key_exists($field, $fields)) - if (($value = $fields[$field]) !== false AND ($field != 'passwd')) - if (!Validate::$function($value)) - if ($hasErrors == 2) - { - if (array_key_exists($field, $rules['size'])) - $size = $rules['size'][$field]; - else - $size = 1; - $fields[$field] = $this->generateData($size, $rules['validate'][$field]); - } - else - $returnErrors[] = sprintf( - $this->l('The field %s is invalid.'), - call_user_func(array($className, 'displayFieldName'), $field, $className) - ); - - return $returnErrors; - } - public function checkAndAddLang ($languages, $add = true) - { - $errors = ''; - $moduleName = Tools::getValue('moduleName'); - $this->alterTable('language'); - foreach($languages as $language) - { - $iso = $language['iso_code']; - if (!Language::isInstalled($iso)) - { - if ($add) - { - if (@fsockopen('www.prestashop.com', 80)) - { - if ($lang_pack = Tools::jsonDecode(Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.$iso))) - { - if ($content = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.$iso.'.gzip')) - { - $file = _PS_TRANSLATIONS_DIR_.$iso.'.gzip'; - if (file_put_contents($file, $content)) - { - require_once('../../tools/tar/Archive_Tar.php'); - $gz = new Archive_Tar($file, true); - if ($gz->extract(_PS_TRANSLATIONS_DIR_.'../', false)) - { - if (!Language::checkAndAddLanguage($iso)) - $errors[] = $this->l('Archive cannot be extracted.'); - else - { - $newId = Language::getIdByIso($iso); - Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'lang` - SET `id_lang_'.bqSQL($moduleName).'` = '.(int)$language['id_lang'].' - WHERE `id_lang` = '.(int)$newId); - } - } - $errors[] = $this->l('Archive cannot be extracted.'); - } - else - $errors[] = $this->l('Server does not have permissions for writing.'); - } - else - $errors[] = $this->l('Language not found'); - } - else - $errors[] = $this->l('archive cannot be downloaded from prestashop.com.'); - } - else - $errors[] = $this->l('archive cannot be downloaded from prestashop.com.'); - } - } - else - { - $newId = Language::getIdByIso($iso); - Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'lang` - SET `id_lang_'.bqSQL($moduleName).'` = '.(int)$language['id_lang'].' - WHERE `id_lang` = '.(int)$newId); - } - } - } - - public function truncateTable($table) - { - switch ($table) - { - case 'customer' : - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'customer'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'customer_group'); - break; - case 'address' : - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'address'); - break; - case 'country' : - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'state'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'country'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'country_lang'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'country'); - case 'group' : - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'customer_group'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'group_lang'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'group'); - break; - case 'combination' : - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_shop'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_combination'); - break; - case 'category' : - Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category` WHERE id_category != 1'); - Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_lang` WHERE id_category != 1'); - Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'category` AUTO_INCREMENT = 2 '); - foreach (scandir(_PS_CAT_IMG_DIR_) AS $d) - if (preg_match('/^[0-9]+(\-(.*))?\.jpg$/', $d)) - unlink(_PS_CAT_IMG_DIR_.$d); - Image::clearTmpDir(); - break; - case 'product' : - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_shop'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'feature_product'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_lang'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'category_product'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_tag'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'image'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'image_lang'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_shop'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_combination'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price_priority'); - - Image::deleteAllImages(_PS_PROD_IMG_DIR_); - Image::clearTmpDir(); - @mkdir(_PS_PROD_IMG_DIR_); - break; - case 'manufacturer' : - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'manufacturer'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'manufacturer_lang'); - foreach (scandir(_PS_MANU_IMG_DIR_) AS $d) - if (preg_match('/^[0-9]+(\-(.*))?\.jpg$/', $d)) - unlink(_PS_MANU_IMG_DIR_.$d); - Image::clearTmpDir(); - break; - case 'Suppliers' : - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'supplier'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'supplier_lang'); - foreach (scandir(_PS_SUPP_IMG_DIR_) AS $d) - if (preg_match('/^[0-9]+(\-(.*))?\.jpg$/', $d)) - unlink(_PS_SUPP_IMG_DIR_.$d); - Image::clearTmpDir(); - break; - case 'attribute' : - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_lang'); - break; - case 'attributegroup' : - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_group'); - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_group_lang'); - break; - case 'currency' : - case 'customer' : - case 'zone' : - case 'state' : - Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.bqSQL($table).'`'); - break; - } - return true; - } - - public function cleanPositions($table, $shopList = null) - { - if ($table == 'category') - { - //clean category position - $cat = Category::getCategories(1, false, false); - foreach($cat AS $i => $categ) - Category::cleanPositions((int)($categ['id_category'])); - } - if ($table == 'product') - { - //clean products position - $cat = Category::getCategories(1, false, false); - foreach($cat AS $i => $categ) - Product::cleanPositions((int)($categ['id_category'])); - } - } - - public function getDefaultIdLang() - { - return; - } - - private function generateData($size = 1, $type) - { - $type = str_replace('is', '', $type); - $dom = array('com', 'net', 'org', 'biz', 'info'); - $alphaNum = '0123456789abcdefghijklmnopqrstuvwxyz'; - $alpha = 'abcdefghijklmnopqrstuvwxyz'; - $num = '0123456789'; - $return = ''; - switch($type) - { - case 'CityName': - case 'Name': - case 'GenericName': - case 'CatalogName': - case 'Address': - case 'LinkRewrite': - case 'String': - $a = mt_rand($size/2, $size); - for ($i = 1; $i <= $a; $i++) - $return .= substr($alpha, mt_rand(0, strlen($alpha)), 1); - break; - case 'LanguageIsoCode': - for ($i = 1; $i <= 2; $i++) - $return .= substr($alpha, mt_rand(0, strlen($alpha)), 1); - break; - case 'LanguageCode': - for ($i = 1; $i <= 2; $i++) - $return .= substr($alphaNum, mt_rand(0, strlen($alphaNum)), 1); - $return .= '-'; - for ($i = 1; $i <= 2; $i++) - $return .= substr($alphaNum, mt_rand(0, strlen($alphaNum)), 1); - break; - case 'Bool': - $return .= mt_rand(0,1); - break; - case 'Int': - case 'UnsignedId': - case 'NumericIsoCode': - case 'PhoneNumber': - case 'PostCode': - $a = mt_rand($size/2, $size); - for ($i = 1; $i <= $a; $i++) - $return .= substr($num, mt_rand(0, strlen($num)), 1); - break; - case 'Price': - case 'Float': - $a = mt_rand(4, 10); - $b = mt_rand(4, 10); - for ($i = 1; $i <= $a; $i++) - $return .= substr($alphaNum, mt_rand(0, strlen($alphaNum)), 1); - $return .= '-'; - for ($i = 1; $i <= $b; $i++) - $return .= substr($alphaNum, mt_rand(0, strlen($alphaNum)), 1); - $return .= '.'.$dom[mt_rand(0, (sizeof($dom)-1))]; - break; - case 'ZipCodeFormat'; - $str = 'NLC -'; - $a = mt_rand($size/2, $size); - for ($i = 1; $i <= $a; $i++) - $return .= substr($str, mt_rand(0, strlen($str)), 1); - break; - case 'StateIsoCode'; - - break; - case 'Email': - $a = mt_rand(4, 10); - $b = mt_rand(4, 10); - for ($i = 1; $i <= $a; $i++) - $return .= substr($alphaNum, mt_rand(0, strlen($alphaNum)), 1); - $return .= '@'; - for ($i = 1; $i <= $b; $i++) - $return .= substr($alphaNum, mt_rand(0, strlen($alphaNum)), 1); - $return .= '.'.$dom[mt_rand(0, (sizeof($dom)-1))]; - break; - case 'Passwd': - $a = mt_rand($size/2, $size); - for ($i = 1; $i <= $a; $i++) - $return .= substr($alphaNum, mt_rand(0, strlen($alphaNum)), 1); - break; - case 'BirthDate': - $return .= '1970-01-01 00:00:00'; - break; - } - return $return; - } - - private function cartToOrder($items, $foreignKey) - { - $this->alterTable('order'); - foreach($items as $item) - { - $order = new Order(); - $order->id_carrier = (int)$item['id_carrier']; - $order->id_customer = (int)$foreignKey['id_customer'][$item['id_customer']]; - $order->id_address_invoice = (int)$foreignKey['id_address_invoice'][$item['id_address_invoice']]; - $order->id_address_delivery = (int)$foreignKey['id_address_delivery'][$item['id_address_delivery']]; - - $vat_address = new Address((int)$foreignKey['id_address_delivery'][$item['id_address_delivery']]); - $id_zone = Address::getZoneById((int)$vat_address->id); - $order->id_currency = (int)$item['id_currency']; - $order->id_lang = (int)$item['id_lang']; - $order->id_cart = (int)$foreignKey['id_cart'][$item['id_cart']]; - - $customer = new Customer((int)$order->id_customer); - $order->secure_key = pSQL($customer->secure_key); - if (!strlen(trim($item['payment']))) - $order->payment = 'payment'.Tools::getValue('moduleName'); - else - $order->payment = utf8_encode(html_entity_decode(strip_tags(Tools::substr($item['payment'], 0, 32)))); - if (isset($this->name)) - $order->module = $this->name; - - $carrier = new Carrier((int)$item['id_carrier']); - - $currency = new Currency($order->id_currency); - $order->conversion_rate = !empty($currency->conversion_rate) ? $currency->conversion_rate : 1; - $order->total_products = (float)$item['total_products']; - $order->total_products_wt = (float)$item['total_products_wt']; - $order->total_discounts = (float)$item['total_discounts']; - $order->total_shipping = (float)$item['total_shipping']; - $order->total_shipping_tax_incl = (float)$item['total_shipping']; - $order->carrier_tax_rate = (float)$carrier->getTaxesRate(new Address((int)$item[Configuration::get('PS_TAX_ADDRESS_TYPE')])); - $order->total_wrapping = (float)$item['total_wrapping']; - $order->total_paid = (float)$item['total_paid']; - $order->total_paid_tax_incl = (float)$item['total_paid']; - $order->total_paid_real = (float)$item['total_paid_real']; - $order->invoice_date = '0000-00-00 00:00:00'; - $order->delivery_date = '0000-00-00 00:00:00'; - if(array_key_exists('date_add', $item)) - $order->date_add = $item['date_add']; - if(array_key_exists('date_upd', $item)) - $order->date_upd = $item['date_upd']; - //test valid paid - if($item['total_paid'] == $item['total_paid_real']) - $order->valid = 1; - else - $order->valid = 0; - - if (array_key_exists('current_state', $item)) - $order->current_state = $item['current_state']; - if (array_key_exists('reference', $item)) - $order->reference = $item['reference']; - if (array_key_exists('invoice_number', $item)) - $order->invoice_number = $item['invoice_number']; - if (array_key_exists('delivery_number', $item)) - $order->delivery_number = $item['delivery_number']; - if (array_key_exists('invoice_date', $item)) - $order->invoice_date = $item['invoice_date']; - if (array_key_exists('delivery_date', $item)) - $order->delivery_date = $item['delivery_date']; - - $order->save(false, false); - - $this->saveMatchId('order', (int)$order->id, (int)$item['id_cart']); - } - } -} diff --git a/modules/shopimporter/translations/index.php b/modules/shopimporter/translations/index.php deleted file mode 100644 index 3f6561f72..000000000 --- a/modules/shopimporter/translations/index.php +++ /dev/null @@ -1,35 +0,0 @@ - -* @copyright 2007-2013 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); - -header("Cache-Control: no-store, no-cache, must-revalidate"); -header("Cache-Control: post-check=0, pre-check=0", false); -header("Pragma: no-cache"); - -header("Location: ../"); -exit; \ No newline at end of file