Example #1
1
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     General::backupSettings();
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     //Find all quick menu linked to the template_editor and change it to file_editor
     $quick_menus = db_get_array("SELECT * FROM ?:quick_menu WHERE url LIKE '%template_editor%'");
     foreach ($quick_menus as $quick_menu) {
         $quick_menu['url'] = str_replace('template_editor', 'file_editor', $quick_menu['url']);
         db_query("REPLACE INTO ?:quick_menu ?e", $quick_menu);
     }
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Example #2
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::processAddons($this->store_data, __CLASS__);
     General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::updateAltLanguages('shipping_service_descriptions', 'service_id');
     General::updateAltLanguages('privilege_descriptions', 'privilege');
     General::updateAltLanguages('privilege_section_descriptions', 'section_id');
     General::updateAltLanguages('state_descriptions', 'state_id');
     General::updateAltLanguages('country_descriptions', 'code');
     General::processBlocks();
     General::setEmptyProgressBar();
     if (db_get_field("SHOW TABLES LIKE '?:mailing_lists'")) {
         db_query("ALTER TABLE ?:mailing_lists DROP `show_on_sidebar`");
     }
     return true;
 }
Example #3
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     General::processAddons($this->store_data, __CLASS__);
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     //        General::restoreSettings();
     if (db_get_field("SELECT status FROM ?:addons WHERE addon = 'searchanise'") != 'D') {
         db_query("UPDATE ?:addons SET status = 'D' WHERE addon = 'searchanise'");
         fn_set_notification('W', __('warning'), General::getUnavailableLangVar('uc_searchanise_disabled'));
     }
     General::setActualLangValues();
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('ult_language_values', array('name', 'company_id'));
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Example #4
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     General::processAddons($this->store_data, __CLASS__);
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::convertPresets403To411();
     General::convertScrollerBlocks();
     db_query("UPDATE ?:sales_reports_tables SET type = 'P' WHERE type = 'C'");
     General::setEmptyProgressBar();
     return true;
 }
Example #5
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     General::backupSettings();
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     $payflow_enabled = db_get_field("SELECT processor_params FROM ?:payments WHERE processor_id = (SELECT processor_id FROM ?:payment_processors WHERE processor_script = 'payflow_pro.php')");
     if (!empty($payflow_enabled)) {
         $payflow_params = unserialize($payflow_enabled);
         unset($payflow_params['country']);
         $payflow_params['currency'] = 840;
         db_query("UPDATE ?:payments SET processor_params = ?s WHERE processor_id = (SELECT processor_id FROM ?:payment_processors WHERE processor_script = 'payflow_pro.php')", serialize($payflow_params));
     }
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Example #6
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::addEsStates();
     General::restoreSettings();
     General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::updateAltLanguages('state_descriptions', 'state_id');
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Example #7
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::restoreSettings();
     db_query("\n            DELETE FROM ?:settings_objects\n            WHERE name IN (\n                'product_notify_vendor',\n                'order_notify_vendor',\n                'page_notify_vendor',\n                'company_discussion_type',\n                'company_only_buyers',\n                'company_posts_per_page',\n                'company_post_approval',\n                'company_post_ip_check',\n                'company_notification_email',\n                'company_notify_vendor',\n                'companies_setting',\n                'include_companies',\n                'companies_change',\n                'companies_priority',\n                'product_share_discussion',\n                'news_share_discussion',\n                'page_share_discussion',\n                'testimonials_from_all_stores'\n            )\n            AND section_id IN (\n                SELECT section_id FROM ?:settings_sections\n                WHERE name IN (\n                    'discussion',\n                    'google_sitemap'\n                )\n            )\n        ");
     General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::updateAltLanguages('state_descriptions', 'state_id');
     db_query('DROP TABLE IF EXISTS ?:se_queue');
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Example #8
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::setEmptyProgressBar();
     General::restoreSettings();
     db_query("\n            DELETE FROM ?:settings_objects\n            WHERE name IN (\n                'product_share_discussion',\n                'news_share_discussion',\n                'page_share_discussion',\n                'testimonials_from_all_stores'\n            )\n            AND section_id IN (\n                SELECT section_id FROM ?:settings_sections\n                WHERE name = 'discussion'\n            )\n        ");
     General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::updateAltLanguages('shipping_service_descriptions', 'service_id');
     General::updateAltLanguages('state_descriptions', 'state_id');
     General::setEmptyProgressBar();
     return true;
 }
Example #9
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     //       General::restoreSettings();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Example #10
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     General::processAddons($this->store_data, __CLASS__);
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Example #11
0
 public function import($db_already_cloned)
 {
     Registry::set('runtime.simple_ultimate', true);
     Registry::del('runtime.forced_company_id');
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('shipping_service_descriptions', 'service_id');
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Example #12
0
 private function _processProfileFields()
 {
     $companies = General::getCompanies($this->store_data);
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $profile_field_ids = db_get_fields('SELECT field_id FROM ?:profile_fields');
     foreach ($companies as $company) {
         $query = "INSERT INTO `?:ult_objects_sharing` (`share_company_id`, `share_object_id`, `share_object_type`) VALUES ";
         $data = array();
         foreach ($profile_field_ids as $pid) {
             $data[] = "({$company['company_id']}, '{$pid}', 'profile_fields')";
         }
         $query .= implode(', ', $data);
         db_query($query);
     }
     return true;
 }
Example #13
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Example #14
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::backupSettings();
     General::updateAltLanguages('language_values', 'name');
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Example #15
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     General::processAddons($this->store_data, __CLASS__);
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     //        General::restoreSettings();
     db_query("ALTER TABLE ?:currencies CHANGE `decimals_separator` `decimals_separator` varchar(6) NOT NULL DEFAULT '.'");
     db_query("ALTER TABLE ?:currencies CHANGE `thousands_separator` `thousands_separator` varchar(6) NOT NULL DEFAULT ','");
     db_query("ALTER TABLE ?:bm_locations ADD `custom_html` TEXT NOT NULL");
     db_query("ALTER TABLE ?:order_data CHANGE `data` `data` LONGBLOB  NOT NULL");
     db_query("ALTER TABLE ?:order_details CHANGE `extra` `extra` LONGBLOB  NOT NULL");
     db_query("ALTER TABLE ?:order_transactions CHANGE `extra` `extra` LONGBLOB  NOT NULL");
     db_query('UPDATE ?:shipping_services SET `code` = "Media Mail Parcel" WHERE `module` = "usps" AND `code` = "Media Mail"');
     db_query('UPDATE ?:shipping_services SET `code` = "Library Mail Parcel" WHERE `module` = "usps" AND `code` = "Library Mail"');
     db_query("ALTER TABLE ?:categories ADD `level` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_path`");
     db_query("UPDATE ?:categories AS `c` SET `c`.`level` = ((length(`c`.`id_path`) - length(REPLACE(`c`.`id_path`, '/', ''))) + 1)");
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Example #16
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::updateAltLanguages('privilege_descriptions', 'privilege');
     General::updateAltLanguages('state_descriptions', 'state_id');
     General::updateAltLanguages('shipping_service_descriptions', 'service_id');
     General::setEmptyProgressBar();
     $fields = array('profile_show', 'checkout_show', 'partner_show');
     $billing = db_get_row("SELECT " . implode(', ', $fields) . " FROM ?:profile_fields WHERE field_name = 'email' AND section = 'B'");
     $shipping = array();
     foreach ($fields as $field) {
         $shipping[$field] = $billing[$field] == 'Y' ? 'N' : 'Y';
     }
     db_query("UPDATE ?:profile_fields SET ?u WHERE field_name = 'email' AND section = 'S'", $shipping);
     General::setEmptyProgressBar();
     return true;
 }
Example #17
0
 protected function _updateCompanyId($default_company_id)
 {
     $limit = 50;
     $prefix = General::formatPrefix();
     $tables = array($prefix . 'orders', $prefix . 'products', $prefix . 'product_options', $prefix . 'pages', $prefix . 'users', $prefix . 'settings_vendor_values', $prefix . 'vendor_payouts');
     $tables = db_get_fields("SELECT TABLE_NAME " . "FROM INFORMATION_SCHEMA.COLUMNS " . "WHERE TABLE_SCHEMA = ?s AND COLUMN_NAME = ?s AND TABLE_NAME LIKE ?s AND TABLE_NAME IN (?a)", Registry::get('config.db_name'), 'company_id', $prefix . '%', $tables);
     foreach ($tables as $table_name) {
         if ($table_name !== $prefix . 'users') {
             db_query("UPDATE `?p` SET `company_id` = ?i WHERE `company_id` = ?i", $table_name, $default_company_id, 0);
         } else {
             db_query("UPDATE `?p` SET `company_id` = ?i WHERE `company_id` = ?i AND `user_type` = 'V'", $table_name, $default_company_id, 0);
         }
     }
     $count_product_orders = db_get_field("SELECT COUNT(*) FROM ?:order_details");
     if ($count_product_orders > 0) {
         for ($i = 0; $i <= floor($count_product_orders / $limit); $i++) {
             $products = db_get_array("SELECT item_id, order_id, extra FROM ?:order_details LIMIT ?i, ?i", $i * $limit, $limit);
             if (is_array($products)) {
                 foreach ($products as $product) {
                     $extra = unserialize($product['extra']);
                     $extra['company_id'] = empty($extra['company_id']) ? $default_company_id : $extra['company_id'];
                     $product['extra'] = serialize($extra);
                     db_query("UPDATE ?:order_details SET extra = ?s WHERE item_id = ?i AND order_id = ?i", $product['extra'], $product['item_id'], $product['order_id']);
                 }
             }
         }
     }
     //Hack for the root admin.
     db_query("UPDATE ?:users SET company_id = 0 WHERE user_type = 'A' AND is_root = 'Y'");
 }
        $si_data['store_data'] = $store_data;
        $si_data['step'] = $step;
        $si_data['import_date'] = time();
        General::updateStoreimportSetting($si_data);
        if (defined('AJAX_REQUEST')) {
            Registry::get('ajax')->assign('non_ajax_notifications', true);
            Registry::get('ajax')->assign('force_redirection', fn_url('store_import.index.step_4'));
        }
        return array(CONTROLLER_STATUS_REDIRECT, 'store_import.index.step_4');
    } else {
        fn_set_notification('E', __('error'), __('store_import.import_failed'));
    }
}
$si_data = unserialize(Settings::instance()->getValue('si_data', 'store_import'));
$si_data['store_data'] = $store_data;
$si_data['step'] = $step;
General::updateStoreimportSetting($si_data);
if ($step !== 1) {
    list($text_from, $text_to) = General::getFromToText($store_data);
    Registry::get('view')->assign('text_from', $text_from);
    Registry::get('view')->assign('text_to', $text_to);
}
Registry::get('view')->assign('step', $step);
Registry::get('view')->assign('import_date', $si_data['import_date']);
Registry::get('view')->assign('store_data', $store_data);
Registry::get('view')->assign('steps', array('1' => array('name' => __('store_import.first_step'), 'href' => ''), '2' => array('name' => __('store_import.second_step'), 'href' => ''), '4' => array('name' => __('store_import.configure_store'), 'href' => fn_url('store_import.index.step_4')), '5' => array('name' => __('store_import.actualize_data'), 'href' => fn_url('store_import.index.step_5')), '6' => array('name' => __('store_import.finish_store'), 'href' => fn_url('store_import.index.step_6'))));
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (defined('AJAX_REQUEST')) {
        exit;
    }
}
Example #19
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     General::processAddons($this->store_data, __CLASS__);
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     db_query("INSERT INTO ?:payment_processors (processor, processor_script, processor_template, admin_template, callback, `type`) VALUES ('Realex Payments Remote', 'realex_remote.php', 'views/orders/components/payments/cc.tpl', 'realex_remote.tpl', 'N', 'P')");
     db_query("INSERT INTO ?:payment_processors (processor, processor_script, processor_template, admin_template, callback, `type`) VALUES ('Realex Payments Redirect', 'realex_redirect.php', 'views/orders/components/payments/cc_outside.tpl', 'realex_redirect.tpl', 'N', 'P')");
     db_query("UPDATE ?:settings_sections SET `edition_type` = 'ROOT,VENDOR' WHERE `name` = 'Security' AND `type` = 'CORE'");
     General::addIpv6Support();
     $paypal_enabled = db_get_fields("SELECT payment_id FROM ?:payments WHERE processor_id IN (SELECT processor_id FROM ?:payment_processors WHERE processor_script IN ('paypal.php', 'payflow_pro.php', 'paypal_advanced.php', 'paypal_express.php', 'paypal_pro.php'))");
     if (!empty($paypal_enabled)) {
         db_query("INSERT INTO ?:addons (`addon`, `status`, `version`, `priority`, `dependencies`, `conflicts`, `separate`, `unmanaged`, `has_icon`) VALUES ('paypal', 'A', '1.0', 100, '', '', 0, 0, 0)");
         db_query("INSERT INTO ?:settings_sections (`parent_id`, `edition_type`, `name`, `position`, `type`) VALUES (0, 'ROOT,ULT:VENDOR', 'paypal', 0, 'ADDON')");
         $section_id = db_get_field("SELECT section_id FROM ?:settings_sections WHERE name = 'paypal' AND type = 'ADDON'");
         db_query("INSERT INTO ?:settings_sections (`parent_id`, `edition_type`, `name`, `position`, `type`) VALUES ({$section_id}, 'ROOT,ULT:VENDOR', 'general', 0, 'TAB')");
         $parent_id = db_get_field("SELECT section_id FROM ?:settings_sections WHERE parent_id = {$section_id}");
         db_query("INSERT INTO ?:settings_objects (`edition_type`, `name`, `section_id`, `section_tab_id`, `type`, `value`, `position`, `is_global`, `handler`, `parent_id`) VALUES\n                ('ROOT,ULT:VENDOR', 'paypal_ipn_settings', {$section_id}, {$parent_id}, 'H', '', 0, 'N', '', 0),\n                ('ROOT,ULT:VENDOR', 'override_customer_info', {$section_id}, {$parent_id}, 'C', 'Y', 10, 'N', '', 0),\n                ('ROOT', 'test_mode', {$section_id}, {$parent_id}, 'C', 'N', 20, 'N', '', 0),\n                ('ROOT,ULT:VENDOR', 'template', {$section_id}, {$parent_id}, 'Z', 'statuses_map.tpl', 30, 'N', '', 0),\n                ('ROOT,ULT:VENDOR', 'template', {$section_id}, {$parent_id}, 'Z', 'logo_uploader.tpl', 40, 'N', '', 0),\n                ('ROOT,ULT:VENDOR', 'pp_statuses', {$section_id}, {$parent_id}, 'D', 'a:10:{s:8:\"refunded\";s:1:\"I\";s:9:\"completed\";s:1:\"P\";s:7:\"pending\";s:1:\"O\";s:17:\"canceled_reversal\";s:1:\"I\";s:7:\"created\";s:1:\"O\";s:6:\"denied\";s:1:\"I\";s:7:\"expired\";s:1:\"F\";s:8:\"reversed\";s:1:\"I\";s:9:\"processed\";s:1:\"P\";s:6:\"voided\";s:1:\"P\";}', 50, 'N', '', 0)\n            ");
         $pp_standart_params = db_get_field("SELECT processor_params FROM ?:payments WHERE processor_id = (SELECT processor_id FROM ?:payment_processors WHERE processor_script = 'paypal.php')");
         if (!empty($pp_standart_params)) {
             $pp_standart_params = unserialize($pp_standart_params);
             if (!empty($pp_standart_params['statuses'])) {
                 db_query("UPDATE ?:settings_objects SET value = ?s WHERE name = 'pp_statuses'", serialize($pp_standart_params['statuses']));
                 unset($pp_standart_params['statuses']);
                 $pp_standart_params = serialize($pp_standart_params);
                 db_query("UPDATE ?:payments SET processor_params = ?s WHERE processor_id = (SELECT processor_id FROM ?:payment_processors WHERE processor_script = 'paypal.php')", $pp_standart_params);
             }
         }
         $languages = db_get_fields("SELECT lang_code FROM ?:languages");
         $addon_scheme = AddonSchemesManager::getScheme('paypal');
         $language_variables = $addon_scheme->getLanguageValues();
         if (!empty($language_variables)) {
             db_query('REPLACE INTO ?:language_values ?m', $language_variables);
         }
         $settings_descr = array('paypal_ipn_settings' => 'Instant payment notification settings', 'override_customer_info' => 'Override customer info', 'test_mode' => 'Test mode');
         foreach ($languages as $lang_code) {
             $description = $addon_scheme->getDescription($lang_code);
             $addon_name = $addon_scheme->getName($lang_code);
             db_query("INSERT INTO ?:addon_descriptions (addon, name, description, lang_code) VALUES ('paypal', ?s, ?s, ?s) ON DUPLICATE KEY UPDATE ?:addon_descriptions.addon = ?:addon_descriptions.addon", $addon_name, $description, $lang_code);
             foreach ($settings_descr as $setting_name => $descr) {
                 db_query("REPLACE INTO ?:settings_descriptions VALUES ((SELECT object_id FROM ?:settings_objects WHERE name = ?s), 'O', ?s, ?s, '')", $setting_name, $lang_code, $descr);
             }
         }
     } else {
         db_query("DELETE FROM ?:payment_processors WHERE processor_script IN ('paypal.php', 'payflow_pro.php', 'paypal_advanced.php', 'paypal_express.php', 'paypal_pro.php')");
     }
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Example #20
0
 public static function convertNewsToBlog()
 {
     $table_prefix = General::formatPrefix();
     $tables = self::getTables(Registry::get('config.db_name'), $table_prefix);
     $languages = db_get_array("SELECT lang_code FROM ?:languages");
     if (!in_array($table_prefix . 'blog_authors', $tables)) {
         db_query("CREATE TABLE ?:blog_authors (\n                `page_id` mediumint(8) unsigned NOT NULL DEFAULT '0',\n                `user_id` mediumint(8) unsigned NOT NULL DEFAULT '0',\n                PRIMARY KEY (`page_id`,`user_id`)\n            ) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
     }
     db_query("INSERT INTO ?:addons (addon, status, version, priority) VALUES ('blog', 'A', '1.0', 2400)");
     foreach ($languages as $language) {
         db_query("INSERT INTO ?:addon_descriptions (addon, name, description, lang_code) VALUES ('blog', 'Blog', 'Lets you start your blog easily', '" . $language['lang_code'] . "')");
     }
     if (in_array($table_prefix . 'news', $tables)) {
         $company_ids = array();
         $news = db_get_array("SELECT news_id, status, date, company_id FROM ?:news");
         foreach ($news as $news_data) {
             $company_ids[$news_data['company_id']] = 0;
         }
         $pos = 100;
         foreach ($company_ids as $company_id => $root) {
             db_query("INSERT INTO ?:pages (parent_id, status, page_type, timestamp, company_id, position) VALUES (0, 'A', 'B', " . time() . ", " . $company_id . ", " . $pos . ")");
             $insert_info = db_get_row("SELECT LAST_INSERT_ID() as id");
             db_query("UPDATE ?:pages SET id_path = " . $insert_info['id'] . " WHERE page_id = " . $insert_info['id']);
             db_query("REPLACE INTO ?:blog_authors (page_id, user_id) VALUES (" . $insert_info['id'] . ", 1)");
             foreach ($languages as $language) {
                 db_query("INSERT INTO ?:page_descriptions (page_id, page, description, lang_code) VALUES (" . $insert_info['id'] . ", 'News', '', '" . $language['lang_code'] . "')");
             }
             $company_ids[$company_id] = $insert_info['id'];
             if (in_array($table_prefix . 'ult_objects_sharing', $tables)) {
                 db_query("INSERT INTO ?:ult_objects_sharing (`share_company_id`, `share_object_id`, `share_object_type`) VALUES (" . $company_id . ", " . $insert_info['id'] . ", 'pages')");
             }
         }
         foreach ($news as $news_data) {
             $pos += 100;
             db_query("INSERT INTO ?:pages (parent_id, status, page_type, timestamp, company_id, position) VALUES (" . $company_ids[$news_data['company_id']] . ", '" . $news_data['status'] . "', 'B', " . $news_data['date'] . ", " . $news_data['company_id'] . ", " . $pos . ")");
             $insert_info = db_get_row("SELECT LAST_INSERT_ID() as id");
             db_query("UPDATE ?:pages SET id_path = '" . $company_ids[$news_data['company_id']] . "/" . $insert_info['id'] . "' WHERE page_id = " . $insert_info['id']);
             db_query("REPLACE INTO ?:blog_authors (page_id, user_id) VALUES (" . $insert_info['id'] . ", 1)");
             $news_descriptions = db_get_array("SELECT * FROM ?:news_descriptions WHERE news_id = " . $news_data['news_id']);
             foreach ($news_descriptions as $desc) {
                 db_query("INSERT INTO ?:page_descriptions (page_id, page, description, lang_code) VALUES (" . $insert_info['id'] . ", '" . addslashes($desc['news']) . "', '" . addslashes($desc['description']) . "', '" . $desc['lang_code'] . "')");
             }
             if (in_array($table_prefix . 'ult_objects_sharing', $tables)) {
                 db_query("INSERT INTO ?:ult_objects_sharing (`share_company_id`, `share_object_id`, `share_object_type`) VALUES (" . $news_data['company_id'] . ", " . $insert_info['id'] . ", 'pages')");
             }
             if (in_array($table_prefix . 'seo_redirects', $tables)) {
                 $seo_names = db_get_array("SELECT name, lang_code FROM ?:seo_names WHERE object_id = " . $news_data['news_id'] . " AND type = 'n'");
                 if (!empty($seo_names)) {
                     $default = reset($seo_names);
                     $converted = array();
                     foreach ($languages as $language) {
                         $found = false;
                         foreach ($seo_names as $_name) {
                             if ($_name['lang_code'] == $language['lang_code']) {
                                 $found = true;
                                 $converted[$language['lang_code']] = $_name;
                                 break;
                             }
                         }
                         if (!$found) {
                             $converted[$language['lang_code']] = array('name' => $default['name'], 'lang_code' => $language['lang_code']);
                         }
                     }
                     $seo_settings = db_get_row("SELECT value FROM ?:settings_objects WHERE name = 'seo_other_type'");
                     foreach ($languages as $language) {
                         $old_url = '/' . $converted[$language['lang_code']]['name'] . ($seo_settings['value'] == 'file' ? '.html' : '');
                         db_query("INSERT INTO ?:seo_redirects (src, type, object_id, company_id, lang_code) VALUES ('" . addslashes($old_url) . "', 'a', " . $insert_info['id'] . ", " . $news_data['company_id'] . ", '" . $language['lang_code'] . "')");
                     }
                 }
             }
             if (in_array($table_prefix . 'discussion', $tables)) {
                 db_query("UPDATE ?:discussion SET object_id = " . $insert_info['id'] . ", object_type = 'A' WHERE object_id = " . $news_data['news_id'] . " AND object_type = 'N'");
             }
         }
         if (in_array($table_prefix . 'seo_names', $tables)) {
             db_query("DELETE FROM ?:seo_names WHERE type = 'n'");
         }
         db_query("DROP TABLE ?:news");
         db_query("DROP TABLE ?:news_descriptions");
     }
     $news = db_get_array("SELECT * FROM ?:bm_blocks WHERE type = 'news'");
     $blog_page = db_get_row("SELECT page_id FROM ?:pages WHERE page_type = 'B' AND parent_id = 0 LIMIT 1");
     if (!empty($news)) {
         foreach ($news as $news_block) {
             $props = unserialize($news_block['properties']);
             $props['filling'] = 'blog.text_links';
             $props['template'] = 'addons/blog/blocks/text_links.tpl';
             db_query("UPDATE ?:bm_blocks SET type = 'blog', properties = '" . addslashes(serialize($props)) . "' WHERE block_id = " . $news_block['block_id']);
             $settings = db_get_array("SELECT * FROM ?:bm_blocks_content WHERE block_id = " . $news_block['block_id']);
             if (!empty($settings)) {
                 foreach ($settings as $settings_data) {
                     $content = unserialize($settings_data['content']);
                     if (!empty($content)) {
                         $content = array('items' => array('filling' => 'blog.text_links', 'parent_page_id' => $blog_page['page_id'], 'limit' => 3));
                         db_query("UPDATE ?:bm_blocks_content SET content = '" . addslashes(serialize($content)) . "' WHERE block_id = " . $settings_data['block_id'] . " AND snapping_id = " . $settings_data['snapping_id'] . " AND lang_code = '" . $settings_data['lang_code'] . "' AND object_id = " . $settings_data['object_id'] . " AND object_type = '" . $settings_data['object_type'] . "'");
                     }
                 }
             }
         }
     }
 }
Example #21
0
 protected function _fillSharingTable()
 {
     $companies = db_get_fields("SELECT company_id FROM ?:companies");
     $objects = array();
     $addons_objects = array('banners' => array('banners' => 'banner_id'), 'news_and_emails' => array('mailing_lists' => 'list_id'), 'store_locator' => array('store_locations' => 'store_location_id'));
     $addons = General::getInstalledAddons();
     foreach ($addons_objects as $addon => $data) {
         if (in_array($addon, $addons)) {
             $objects = fn_array_merge($data, $objects);
         }
     }
     if (!empty($objects)) {
         foreach ($companies as $company_id) {
             foreach ($objects as $object => $field) {
                 db_query("REPLACE INTO ?:ult_objects_sharing (share_company_id, share_object_id, share_object_type) SELECT '{$company_id}', {$field}, '{$object}' FROM ?:{$object}");
             }
         }
     }
     return true;
 }
Example #22
0
 public static function checkRussianEdition($store_data)
 {
     if (in_array($store_data['product_version'], array('2.2.4', '2.2.5', '3.0.1'))) {
         return false;
     }
     $addons_to_check = array('exim_1c', 'kupivkredit', 'loginza', 'kupivkredit', 'yandex_market');
     $result = false;
     General::connectToOriginalDB();
     $addons_to_check_status = db_get_fields("SELECT status FROM ?:addons WHERE addon IN (?a)", $addons_to_check);
     if (!empty($addons_to_check_status)) {
         $result = true;
     }
     $shippings_to_check = array('russian_post', 'ems', 'edost');
     $russian_shippings = db_get_fields("SELECT service_id FROM ?:shipping_services WHERE module IN (?a)", $shippings_to_check);
     if (!empty($russian_shippings)) {
         $result = true;
     }
     return $result;
 }
Example #23
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     General::processAddons($this->store_data, __CLASS__);
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     General::backupSettings();
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     $seo_status = db_get_field("SELECT status FROM ?:addons WHERE addon = 'seo'");
     if (!empty($seo_status)) {
         $seo_multi_language = db_get_field("SELECT value FROM ?:settings_objects_upg WHERE name = 'multi_language'");
         $seo_multi_language_vendor = db_get_hash_single_array("SELECT company_id, value FROM ?:settings_vendor_values_upg WHERE object_id = (SELECT object_id FROM ?:settings_objects_upg WHERE name = 'multi_language')", array('company_id', 'value'));
         db_query("UPDATE ?:settings_objects_upg SET value = 'category_nohtml' WHERE value = 'category' AND name = 'seo_category_type'");
         db_query("UPDATE ?:settings_vendor_values_upg SET value = 'category_nohtml' WHERE value = 'category' AND object_id = (SELECT object_id FROM ?:settings_objects_upg WHERE name = 'seo_category_type')");
         db_query("UPDATE ?:settings_objects_upg SET value = 'category' WHERE value = 'file' AND name = 'seo_category_type'");
         db_query("UPDATE ?:settings_vendor_values_upg SET value = 'category' WHERE value = 'file' AND object_id = (SELECT object_id FROM ?:settings_objects_upg WHERE name = 'seo_category_type')");
         $categories = db_get_fields("SELECT object_id FROM ?:seo_names WHERE type='c' AND lang_code = (SELECT value FROM ?:settings_objects WHERE name='frontend_default_language')");
         if (!empty($categories)) {
             foreach ($categories as $category_id) {
                 $path = db_get_field("SELECT id_path FROM ?:categories WHERE category_id = ?i", $category_id);
                 $apath = explode('/', $path);
                 array_pop($apath);
                 db_query("UPDATE ?:seo_names SET path = ?s WHERE type='c' AND object_id = ?i", implode('/', $apath), $category_id);
             }
         }
         $products = db_get_fields("SELECT object_id FROM ?:seo_names RIGHT JOIN ?:products ON ?:seo_names.object_id = ?:products.product_id WHERE type='p' AND lang_code = (SELECT value FROM ?:settings_objects WHERE name='frontend_default_language')");
         if (!empty($products)) {
             $condition = '';
             if (fn_allowed_for('ULTIMATE')) {
                 $condition = fn_get_company_condition('c.company_id', false);
                 $condition = !empty($condition) ? " AND ({$condition} OR {$field} = 0)" : '';
             }
             foreach ($products as $product_id) {
                 $path = db_get_hash_single_array("SELECT c.id_path, p.link_type FROM ?:categories as c LEFT JOIN ?:products_categories as p ON p.category_id = c.category_id WHERE p.product_id = ?i ?p", array('link_type', 'id_path'), $product_id, $condition);
                 $_path = !empty($path['M']) ? $path['M'] : $path['A'];
                 db_query("UPDATE ?:seo_names SET path = ?s WHERE type='p' AND object_id = ?i", $_path, $product_id);
             }
         }
         $pages = db_get_fields("SELECT object_id FROM ?:seo_names WHERE type='a' AND lang_code = (SELECT value FROM ?:settings_objects WHERE name='frontend_default_language')");
         if (!empty($pages)) {
             foreach ($pages as $page_id) {
                 $path = db_get_field("SELECT id_path FROM ?:pages WHERE page_id = ?i", $page_id);
                 $apath = explode('/', $path);
                 array_pop($apath);
                 db_query("UPDATE ?:seo_names SET path = ?s WHERE type='a' AND object_id = ?i", implode('/', $apath), $page_id);
             }
         }
     }
     General::restoreSettings();
     if (!empty($seo_status)) {
         db_query("UPDATE ?:settings_objects SET value = ?s WHERE name = 'non_latin_symbols'", $seo_multi_language);
         foreach ($seo_multi_language_vendor as $company_id => $value) {
             db_query("REPLACE INTO ?:settings_vendor_values VALUES ((SELECT object_id FROM ?:settings_objects WHERE name = 'non_latin_symbols'), ?i, ?s)", $company_id, $value);
         }
         $map = array('product_file' => 'file', 'product_category' => 'page');
         $setting = db_get_field("SELECT value FROM ?:settings_objects WHERE name = 'seo_product_type'");
         db_query("UPDATE ?:settings_objects SET value = ?s WHERE name = 'seo_page_type'", $map[$setting]);
         $obj_id = db_get_field("SELECT object_id FROM ?:settings_objects WHERE name = 'seo_page_type'");
         $settings = db_get_array("SELECT * FROM ?:settings_vendor_values WHERE object_id = (SELECT object_id FROM ?:settings_objects WHERE name = 'seo_product_type')");
         if (!empty($settings)) {
             foreach ($settings as $vendor_setting) {
                 db_query("UPDATE ?:settings_vendor_values SET value = ?s WHERE object_id = ?i AND company_id = ?i", $map[$vendor_setting['value']], $obj_id, $vendor_setting['company_id']);
             }
         }
         db_query("UPDATE ?:settings_objects SET value = 'file' WHERE name = 'seo_other_type'");
         db_query("UPDATE ?:settings_vendor_values SET value = 'file' WHERE object_id = (SELECT object_id FROM ?:settings_objects WHERE name = 'seo_other_type')");
         $empty_product_seo_names = db_get_fields("SELECT object_id FROM ?:seo_names WHERE type = 'p' AND object_id NOT IN (SELECT product_id FROM ?:products)");
         if ($empty_product_seo_names) {
             db_query("DELETE FROM ?:seo_names WHERE object_id IN (?n)", $empty_product_seo_names);
         }
         $empty_pages_seo_names = db_get_fields("SELECT object_id FROM ?:seo_names WHERE type = 'a' AND object_id NOT IN (SELECT page_id FROM ?:pages)");
         if ($empty_product_seo_names) {
             db_query("DELETE FROM ?:seo_names WHERE object_id IN (?n)", $empty_product_seo_names);
         }
         $empty_categories_seo_names = db_get_fields("SELECT object_id FROM ?:seo_names WHERE type = 'c' AND object_id NOT IN (SELECT category_id FROM ?:categories)");
         if ($empty_categories_seo_names) {
             db_query("DELETE FROM ?:seo_names WHERE object_id IN (?n)", $empty_categories_seo_names);
         }
         $empty_features_seo_names = db_get_fields("SELECT object_id FROM ?:seo_names WHERE type = 'e' AND object_id NOT IN (SELECT feature_id FROM ?:product_features)");
         if ($empty_features_seo_names) {
             db_query("DELETE FROM ?:seo_names WHERE object_id IN (?n)", $empty_features_seo_names);
         }
         $_empty_product_seo_names = db_get_array("\n                SELECT ?:seo_names.*\n                FROM ?:categories\n                RIGHT JOIN ?:products_categories ON ?:categories.category_id = ?:products_categories.category_id\n                RIGHT JOIN ?:seo_names ON ?:products_categories.product_id = ?:seo_names.object_id AND ?:categories.company_id = ?:seo_names.company_id\n                WHERE ?:categories.category_id IS NULL AND ?:seo_names.type = 'p'");
         foreach ($_empty_product_seo_names as $value) {
             db_query("DELETE FROM ?:seo_names WHERE object_id = ?i AND company_id = ?i AND type = 'p'", $value['object_id'], $value['company_id']);
         }
     }
     if (db_get_field("SELECT status FROM ?:addons WHERE addon = 'suppliers'")) {
         $query_parts = array();
         $shippings = fn_get_shippings(true);
         foreach ($shippings as $shipping_id => $shipping_name) {
             $query_parts[] = db_quote('(?i, ?i, ?s)', 0, $shipping_id, 'S');
         }
         if (!empty($query_parts)) {
             db_query('REPLACE INTO ?:supplier_links VALUES ' . implode(', ', $query_parts));
         }
     }
     $products_with_empty_categories = db_get_array("SELECT category_id, product_id FROM ?:products_categories WHERE category_id NOT IN (SELECT category_id FROM ?:categories)");
     db_query("DELETE FROM ?:products_categories WHERE category_id NOT IN (SELECT category_id FROM ?:categories)");
     foreach ($products_with_empty_categories as $k => $data) {
         $product_to_delete = db_get_field("SELECT product_id FROM ?:products_categories WHERE product_id = ?i", $data['product_id']);
         if (!$product_to_delete) {
             fn_delete_product($data['product_id']);
         } else {
             $product_category = db_get_field("SELECT category_id FROM ?:products_categories WHERE product_id = ?i", $product_to_delete);
             $company_id = db_get_field("SELECT company_id FROM ?:categories WHERE category_id = ?i", $product_category);
             db_query("UPDATE ?:products_categories SET link_type = 'A' WHERE product_id = ?i", $product_to_delete);
             db_query("UPDATE ?:products_categories SET link_type = 'M' WHERE product_id = ?i AND category_id = ?i", $product_to_delete, $product_category);
             db_query("UPDATE ?:products SET company_id = ?i WHERE product_id = ?i", $company_id, $product_to_delete);
         }
     }
     $products_with_category = db_get_hash_array("SELECT ?:products_categories.product_id, ?:categories.company_id  FROM ?:products_categories LEFT JOIN ?:categories ON ?:categories.category_id = ?:products_categories.category_id LEFT JOIN ?:products ON ?:products.product_id = ?:products_categories.product_id WHERE ?:products.company_id = ?:categories.company_id", 'product_id');
     $products_with_foreign_category = db_get_array("SELECT ?:products_categories.product_id, ?:categories.company_id, ?:products.company_id as old_company_id  FROM ?:products_categories LEFT JOIN ?:categories ON ?:categories.category_id = ?:products_categories.category_id LEFT JOIN ?:products ON ?:products.product_id = ?:products_categories.product_id WHERE ?:products.company_id != ?:categories.company_id AND ?:products_categories.product_id NOT IN (?n)", array_keys($products_with_category));
     if (!empty($products_with_foreign_category)) {
         foreach ($products_with_foreign_category as $key => $data) {
             db_query("UPDATE ?:products SET company_id = ?i WHERE product_id = ?i", $data['company_id'], $data['product_id']);
             if (!empty($seo_status)) {
                 db_query("DELETE FROM ?:seo_names WHERE type = 'p' AND object_id = ?i AND company_id = ?i", $data['product_id'], $data['old_company_id']);
             }
         }
     }
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }
Example #24
0
 protected function _fixLanguagesMissedInImported($copy_from_language)
 {
     General::connectToImportedDB($this->store_data);
     $languages = db_get_hash_array('SELECT * FROM ?:languages', 'lang_code');
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     $existing = db_get_hash_array('SELECT * FROM ?:languages', 'lang_code');
     $missed_languages = array_diff_key($existing, $languages);
     if (!empty($missed_languages)) {
         foreach ($missed_languages as $lang_code => $language_data) {
             fn_clone_language($language_data['lang_code'], $copy_from_language);
         }
     }
     return true;
 }
Example #25
0
 protected function _setStorefromUrl($company_id, $store_data)
 {
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     db_query("UPDATE ?:companies SET storefront = ?s, secure_storefront = ?s WHERE company_id = ?i", $store_data['new_storefront_url'], $store_data['new_secure_storefront_url'], $company_id);
     return true;
 }
Example #26
0
 public function import($db_already_cloned)
 {
     General::setProgressTitle(__CLASS__);
     if (!$db_already_cloned) {
         if (!General::cloneImportedDB($this->store_data)) {
             return false;
         }
     } else {
         General::setEmptyProgressBar(__('importing_data'));
         General::setEmptyProgressBar(__('importing_data'));
     }
     General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
     General::processAddons($this->store_data, __CLASS__);
     $main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
     if (is_file($main_sql)) {
         //Process main sql
         if (!db_import_sql_file($main_sql)) {
             return false;
         }
     }
     $this->_edpProducts();
     $this->_bmNewLinkField();
     $this->_addNewLocation();
     $this->_removeShippingSettings();
     $this->_convertImageVerification();
     $this->_mveConvertImageVerification();
     //        $this->_addNewSettingTimeframe();
     $this->_newFieldInProcessor();
     $this->_renameCategoryTableFields();
     $this->_updatePayPalPayments();
     $this->_addNewFieldToMenu();
     General::setCustomCssClassForResponsive();
     General::addCheckoutSection();
     General::coreCheckoutSettings();
     General::removeNullTextFields();
     General::filtersRefactoring();
     $this->_mveFiltersRefactoring();
     General::removeNewsLogger();
     General::convertNewsToBlog();
     General::pagesRemoveShowInPopup();
     General::removeTplDebugSetting();
     $this->_removeCheckoutStyleSetting();
     General::revertSearchFieldBlock();
     General::addFullHttps();
     General::removeUseEmailAsLoginSetting();
     General::removeUserLoginEximField();
     $this->coreLogosLinkedToStyles();
     db_query("ALTER TABLE ?:vendor_payouts CHANGE `comments` `comments` text");
     db_query("UPDATE ?:usergroup_privileges SET privilege = 'backup_restore' WHERE privilege = 'database_maintenance'");
     db_query("UPDATE ?:privileges SET privilege = 'backup_restore' WHERE privilege = 'database_maintenance'");
     //        General::restoreSettings();
     if (db_get_field("SELECT status FROM ?:addons WHERE addon = 'searchanise'") != 'D') {
         db_query("UPDATE ?:addons SET status = 'D' WHERE addon = 'searchanise'");
         fn_set_notification('W', __('warning'), General::getUnavailableLangVar('uc_searchanise_disabled'));
     }
     General::setActualLangValues();
     General::updateAltLanguages('language_values', 'name');
     General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     General::setEmptyProgressBar();
     return true;
 }