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; }
function fn_ebay_check_license($silent = false, $skip_messages = false) { // addons.ebay.ebay_license_number $license_number = Registry::get(str_rot13('nqqbaf.ronl.ronl_yvprafr_ahzore')); $_SESSION['eauth'] = time(); if (empty($license_number)) { if (!$silent) { // ebay_empty_license_number fn_set_notification('E', __('error'), __(str_rot13('ronl_rzcgl_yvprafr_ahzore'))); } return false; } else { // Some HD checking code $data = Helpdesk::getLicenseInformation($license_number, array('edition' => 'EBAY')); list($license_status, , $messages) = Helpdesk::parseLicenseInformation($data, array(), false); if (!empty($messages) && !$skip_messages) { foreach ($messages as $message) { fn_set_notification($message['type'], $message['title'], $message['text']); } } if ($license_status == 'ACTIVE') { return 'A'; } elseif ($license_status == '') { // Timeout fn_set_notification('E', __('error'), __('unable_to_check_license')); return 'T'; } else { return 'I'; } } }
/** * Gets theme patterns * @param string $style_id style ID * @return array theme patterns */ public static function get($style_id) { $style_id = fn_basename($style_id); $url = Registry::get('config.current_location') . '/' . fn_get_theme_path('[relative]/[theme]/media/images/patterns/' . $style_id . '/'); $patterns = self::getPath($style_id); return fn_get_dir_contents($patterns, false, true, '', $url); }
public function index($id = 0, $params = array()) { $lang_code = $this->safeGet($params, 'lang_code', DEFAULT_LANGUAGE); if ($this->getParentName() == 'categories') { $parent_category = $this->getParentData(); $params['cid'] = $parent_category['category_id']; } if (!empty($id)) { $data = fn_get_product_data($id, $this->auth, $lang_code, '', true, true, true, false, false, false, false); if (empty($data)) { $status = Response::STATUS_NOT_FOUND; } else { $status = Response::STATUS_OK; } } else { $items_per_page = $this->safeGet($params, 'items_per_page', Registry::get('settings.Appearance.admin_products_per_page')); $params['extend'][] = 'categories'; list($products, $search) = fn_get_products($params, $items_per_page, $lang_code); $params['get_options'] = $this->safeGet($params, 'get_options', false); $params['get_features'] = $this->safeGet($params, 'get_features', true); $params['get_detailed'] = $this->safeGet($params, 'get_detailed', true); $params['get_icon'] = $this->safeGet($params, 'get_icon', true); $params['get_additional'] = $this->safeGet($params, 'get_additional', true); $params['detailed_params'] = $this->safeGet($params, 'detailed_params', false); $params['features_display_on'] = 'A'; fn_gather_additional_products_data($products, $params); $data = array('products' => array_values($products), 'params' => $search); $status = Response::STATUS_OK; } return array('status' => $status, 'data' => $data); }
/** * Gets settings list * * @param int $id Settings identifier * @param array $params Filter params * @return array */ public function index($id = 0, $params = array()) { $company_id = $this->safeGet($params, 'company_id', null); $lang_code = $this->safeGet($params, 'lang_code', DEFAULT_LANGUAGE); if (!empty($id)) { $data = CartSettings::instance()->getData($id, $company_id); if (empty($data)) { $status = Response::STATUS_NOT_FOUND; } else { $status = Response::STATUS_OK; } } else { $section_id = $this->safeGet($params, 'section_id', 0); $section_tab_id = $this->safeGet($params, 'section_tab_id', 0); $items_per_page = $this->safeGet($params, 'items_per_page', Registry::get('settings.Appearance.admin_elements_per_page')); $page = $this->safeGet($params, 'page', 1); $data = CartSettings::instance()->getList($section_id, $section_tab_id, true, $company_id, $lang_code); if ($items_per_page) { $data = array_slice($data, ($page - 1) * $items_per_page, $items_per_page); } $data = array('settings' => $data, 'params' => array('section_id' => $section_id, 'section_tab_id' => $section_tab_id, 'items_per_page' => $items_per_page, 'page' => $page, 'total_items' => count($data))); $status = Response::STATUS_OK; } return array('status' => $status, 'data' => $data); }
function fn_bestsellers_get_products_pre(&$params, &$items_per_page, &$lang_code) { if (!empty($params['bestsellers'])) { $params['extend'][] = 'categories'; } elseif (empty($params['sort_by']) || empty($sortings[$params['sort_by']])) { $default_sorting_params = fn_get_default_products_sorting(); if (!empty($params['sort_by']) && $params['sort_by'] == 'bestsellers' || $default_sorting_params['sort_by'] == 'bestsellers' || isset($params['sales_amount_from']) || isset($params['sales_amount_to'])) { $params['extend'][] = 'categories'; $params['extend'][] = 'sales'; } elseif (!empty($params['sort_by']) && $params['sort_by'] == 'on_sale' || $default_sorting_params['sort_by'] == 'on_sale') { $params['extend'][] = 'on_sale'; } } if (!empty($params['similar'])) { $product = Registry::get('view')->getTemplateVars('product'); if (!empty($params['main_product_id'])) { $params['exclude_pid'] = $params['main_product_id']; } if (!empty($params['similar_category']) && $params['similar_category'] == 'Y') { $params['cid'] = $product['main_category']; if (!empty($params['similar_subcats']) && $params['similar_subcats'] == 'Y') { $params['subcats'] = 'Y'; } } if (!empty($product['price'])) { if (!empty($params['percent_range'])) { $range = $product['price'] / 100 * $params['percent_range']; $params['price_from'] = $product['price'] - $range; $params['price_to'] = $product['price'] + $range; } } } }
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; }
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; }
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; }
public function generate($force = false) { $filename = $this->getFileName(); if (!is_dir(dirname($filename))) { fn_mkdir(dirname($filename)); } if ($force) { fn_rm($filename); } if (!file_exists($filename)) { fn_set_progress('echo', __('generating_xls'), false); $header = $data = array(); $currencies = Registry::get('currencies'); $currency = $currencies[CART_SECONDARY_CURRENCY]; $currency_format = '#' . $currency['thousands_separator'] . '##0.' . str_repeat('0', $currency['decimals']); $currency_format = $currency['after'] == 'Y' ? $currency_format . $currency['symbol'] : $currency['symbol'] . $currency_format; foreach ($this->selected_fields as $field_id => $field_value) { $header[$this->price_schema['fields'][$field_id]['title']] = $field_id == 'price' ? $currency_format : 'string'; } $this->writer->writeSheetHeader($this->sheet, $header); $this->render(); $this->writer->writeToFile($filename); } return $filename; }
/** * Gets current company ID * @param integer $company_id company ID * @return integer company ID */ private static function getCompany($company_id = 0) { if (empty($company_id) && Registry::get('runtime.company_id')) { $company_id = Registry::get('runtime.company_id'); } return intval($company_id); }
/** * Smarty plugin * @package Smarty * @subpackage plugins */ function smarty_function_script($params, &$smarty) { static $scripts = array(); if (!isset($scripts[$params['src']])) { if (strpos($params['src'], '//') === false) { $src = Registry::get('config.current_location') . '/' . fn_link_attach($params['src'], 'ver=' . PRODUCT_VERSION); } else { $src = $params['src']; } $scripts[$params['src']] = '<script type="text/javascript"' . (!empty($params['class']) ? ' class="' . $params['class'] . '" ' : '') . ' src="' . $src . '" ' . (isset($params['charset']) ? 'charset="' . $params['charset'] . '"' : '') . (isset($params['escape']) ? '><\\/script>' : '></script>'); if (defined('AJAX_REQUEST') || Registry::get('runtime.inside_scripts')) { return $scripts[$params['src']]; } else { if (isset($params['no-defer']) && $params['no-defer']) { return $scripts[$params['src']]; } else { $cache_name = $smarty->getTemplateVars('block_cache_name'); if (!empty($cache_name)) { $cached_content = Registry::get($cache_name); if (!isset($cached_content['javascript'])) { $cached_content['javascript'] = ''; } $cached_content['javascript'] .= $scripts[$params['src']]; Registry::set($cache_name, $cached_content, true); } $repeat = false; $smarty->loadPlugin('smarty_block_inline_script'); smarty_block_inline_script(array(), $scripts[$params['src']], $smarty, $repeat); return '<!-- Inline script moved to the bottom of the page -->'; } } } }
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; }
public function index($id = 0, $params = array()) { $lang_code = $this->safeGet($params, 'lang_code', DEFAULT_LANGUAGE); if (!empty($id)) { $data = fn_get_category_data($id, $lang_code); if (empty($data)) { $status = Response::STATUS_NOT_FOUND; } else { $status = Response::STATUS_OK; } } else { if (!empty($params['category_ids']) && is_array($params['category_ids'])) { $params['item_ids'] = $params['category_ids']; } $params['plain'] = $this->safeGet($params, 'plain', true); $params['simple'] = $this->safeGet($params, 'simple', false); $params['group_by_level'] = $this->safeGet($params, 'group_by_level', false); $items_per_page = $this->safeGet($params, 'items_per_page', Registry::get('settings.Appearance.admin_products_per_page')); $page = $this->safeGet($params, 'page', 1); list($data, $params) = fn_get_categories($params, $lang_code); $params['items_per_page'] = $items_per_page; $params['page'] = $page; $params['total_items'] = count($data); if ($items_per_page) { $data = array_slice($data, ($page - 1) * $items_per_page, $items_per_page); } $data = array('categories' => $data, 'params' => $params); $status = Response::STATUS_OK; } return array('status' => $status, 'data' => $data); }
public function index($id = 0, $params = array()) { if (fn_allowed_for('MULTIVENDOR') && $this->auth['user_type'] == 'V' && $this->getParentName() != 'products') { return array('status' => Response::STATUS_FORBIDDEN); } $data = array(); if ($this->getParentName() == 'products') { $parent_product = $this->getParentData(); $params['object_id'] = $parent_product['product_id']; $params['object_type'] = 'P'; unset($params['thread_id']); } if (!empty($id)) { $data = $this->getPost($id, $params); if ($data) { $status = Response::STATUS_OK; } else { $status = Response::STATUS_NOT_FOUND; } } else { $items_per_page = $this->safeGet($params, 'items_per_page', Registry::get('settings.Appearance.admin_elements_per_page')); list($discussions, $search) = fn_get_discussions($params, $items_per_page); $data = array('discussions' => array_values($discussions), 'params' => $search); $status = Response::STATUS_OK; } return array('status' => $status, 'data' => $data); }
public function create($params) { $status = Response::STATUS_BAD_REQUEST; $data = array(); $valid_params = true; unset($params['category_id']); if (empty($params['feature_type'])) { $data['message'] = __('api_required_field', array('[field]' => 'feature_type')); $valid_params = false; } if (empty($params['description'])) { $data['message'] = __('api_required_field', array('[field]' => 'description')); $valid_params = false; } if (fn_allowed_for('ULTIMATE')) { if (empty($params['company_id']) && Registry::get('runtime.company_id') == 0) { $data['message'] = __('api_need_store'); $valid_params = false; } } if ($valid_params) { $feature_id = fn_update_product_feature($params, 0); if ($feature_id) { $status = Response::STATUS_CREATED; $data = array('feature_id' => $feature_id); } } return array('status' => $status, 'data' => $data); }
/** * Gets products for printing and print them * @param array $params product search params */ protected function processProducts($params) { $total = static::ITEMS_PER_PAGE; while (static::ITEMS_PER_PAGE * ($params['page'] - 1) <= $total) { list($products, $search) = fn_get_products($params, static::ITEMS_PER_PAGE); $total = $search['total_items']; if ($params['page'] == 1) { fn_set_progress('parts', $total); } $get_images = !empty($this->selected_fields['image']); $_params = array('get_icon' => $get_images, 'get_detailed' => $get_images, 'get_options' => Registry::get('addons.price_list.include_options') == 'Y' ? true : false, 'get_discounts' => false); fn_gather_additional_products_data($products, $_params); $params['page']++; $this->printProductsBatch(true); foreach ($products as $product) { fn_set_progress('echo'); if (Registry::get('addons.price_list.include_options') == 'Y' && $product['has_options']) { $product = fn_price_list_get_combination($product); foreach ($product['combinations'] as $c_id => $c_value) { $product['price'] = $product['combination_prices'][$c_id]; $product['weight'] = $product['combination_weight'][$c_id]; $product['amount'] = $product['combination_amount'][$c_id]; $product['product_code'] = $product['combination_code'][$c_id]; $this->printProductRow($product, $c_value); } } else { $this->printProductRow($product); } } $this->printProductsBatch(); } }
/** * Smarty plugin * ------------------------------------------------------------- * Type: modifier<br> * Name: price<br> * Purpose: getting formatted price with grouped thousands and * decimal separators * Example: {$price|price:"2":".":","} * ------------------------------------------------------------- */ function smarty_modifier_format_price($price, $currency, $span_id = '', $class = '', $is_secondary = false, $live_editor_name = '', $live_editor_phrase = '') { $value = fn_format_rate_value($price, $number_type, $currency['decimals'], $currency['decimals_separator'], $currency['thousands_separator'], $currency['coefficient']); if (!empty($span_id) && $is_secondary) { $span_id = 'sec_' . $span_id; } $span_id = !empty($span_id) ? ' id="' . $span_id . '"' : ''; $class = !empty($class) ? ' class="' . $class . '"' : ''; $live_editor_attrs = ''; if (Registry::get('runtime.customization_mode.live_editor') && !empty($live_editor_name)) { $live_editor_attrs = ' data-ca-live-editor-obj="' . $live_editor_name . '"'; if (!empty($live_editor_phrase)) { $live_editor_attrs .= ' data-ca-live-editor-phrase="' . $live_editor_phrase . '"'; } } if ($class) { $currency['symbol'] = '<span' . $class . '>' . $currency['symbol'] . '</span>'; } $data = array('<span' . $span_id . $class . $live_editor_attrs . '>', $value, '</span>'); if ($currency['after'] == 'Y') { array_push($data, ' ' . $currency['symbol']); } else { array_unshift($data, $currency['symbol']); } return implode('', $data); }
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; }
function fn_api_auth_routines($request, $auth) { $status = true; $user_login = !empty($request['user_login']) ? trim($request['user_login']) : ''; $password = !empty($request['password']) ? $request['password'] : ''; $field = 'email'; $condition = ''; if (fn_allowed_for('ULTIMATE')) { if (Registry::get('settings.Stores.share_users') == 'N' && AREA != 'A') { $condition = fn_get_company_condition('?:users.company_id'); } } $user_data = db_get_row("SELECT * FROM ?:users WHERE {$field} = ?s" . $condition, $user_login); if (empty($user_data)) { $user_data = db_get_row("SELECT * FROM ?:users WHERE {$field} = ?s AND user_type IN ('A', 'V', 'P')", $user_login); } if (!empty($user_data)) { $user_data['usergroups'] = fn_get_user_usergroups($user_data['user_id']); } if (!empty($user_data['status']) && $user_data['status'] == 'D') { fn_set_notification('E', __('error'), __('error_account_disabled')); $status = false; } $salt = isset($user_data['salt']) ? $user_data['salt'] : ''; return array($status, $user_data, $user_login, $password, $salt); }
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; }
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; }
/** * Smarty plugin * @package Smarty * @subpackage plugins */ function smarty_block_styles($params, $content, &$smarty, &$repeat) { if ($repeat == true) { return; } $prepend_prefix = Embedded::isEnabled() ? 'html#tygh_html body#tygh_body .tygh' : ''; $styles = array(); $internal_styles = ''; //if (preg_match_all('/\<link(.*?href ?= ?"([^"]+)")?[^\>]*\>/is', $content, $m)) { if (preg_match_all('/\\<link(.*?href\\s?=\\s?(?:"|\')([^"]+)(?:"|\'))?[^\\>]*\\>/is', $content, $m)) { foreach ($m[2] as $k => $v) { $v = preg_replace('/\\?.*?$/', '', $v); $media = ''; if (strpos($m[1][$k], 'media=') !== false && preg_match('/media="(.*?)"/', $m[1][$k], $_m)) { $media = $_m[1]; } $styles[] = array('file' => str_replace(Registry::get('config.current_location'), Registry::get('config.dir.root'), $v), 'relative' => str_replace(Registry::get('config.current_location') . '/', '', $v), 'media' => $media); } } if (preg_match_all('/\\<style.*\\>(.*)\\<\\/style\\>/isU', $content, $m)) { $internal_styles = implode("\n\n", $m[1]); } if (!empty($styles) || !empty($internal_styles)) { fn_set_hook('styles_block_files', $styles); list($_area) = Registry::get('view')->getArea(); $filename = fn_merge_styles($styles, $internal_styles, $prepend_prefix, $params, $_area); $content = '<link type="text/css" rel="stylesheet" href="' . $filename . '" />'; } return $content; }
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; }
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; }
public function index($id = 0, $params = array()) { $status = Response::STATUS_OK; $data = \Tygh\Languages\Languages::getAll(); if ($data && $id) { foreach ($data as $lang_data) { if ($lang_data['lang_id'] == $id) { $data = $lang_data; break; } else { $data = array(); } } } elseif ($data && ($lang_code = $this->safeGet($params, 'lang_code', ''))) { if (!empty($data[$lang_code])) { $data = $data[$lang_code]; } else { $status = Response::STATUS_NOT_FOUND; $data = array(); } } else { $items_per_page = $this->safeGet($params, 'items_per_page', Registry::get('settings.Appearance.admin_products_per_page')); $page = $this->safeGet($params, 'page', 1); if ($items_per_page) { $data = array_slice($data, ($page - 1) * $items_per_page, $items_per_page); } $data = array('languages' => $data, 'params' => array('items_per_page' => $items_per_page, 'page' => $page, 'total_items' => count($data))); } if (!$data) { $status = Response::STATUS_NOT_FOUND; } return array('status' => $status, 'data' => $data); }
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; }
/** * Gets mobile product url * * @param $product_id * @param string $lang_code * @return bool */ function fn_twg_exim_get_product_mobile_url($product_id, $lang_code = '') { $company_id = 0; $company_url = ''; if (fn_allowed_for('ULTIMATE')) { if (Registry::get('runtime.company_id')) { $company_id = Registry::get('runtime.company_id'); } else { $company_id = db_get_field('SELECT company_id FROM ?:products WHERE product_id = ?i', $product_id); } $company_url = '&company_id=' . $company_id; } else { $company_url = ''; } $settings = TwigmoSettings::get('customer_connections.' . $company_id); $use_twg = !empty($settings['access_id']) && ($settings['use_for_phones'] == 'Y' || $settings['use_for_tablets'] == 'Y'); if ($use_twg && fn_twg_use_https_for_customer($company_id)) { $protocol = 'https'; } else { $protocol = 'http'; } $url = fn_url('products.view?product_id=' . $product_id . $company_url, 'C', $protocol, $lang_code); fn_set_hook('exim_get_product_url', $url, $product_id, $options, $lang_code); return $url; }
function fn_update_product_filter($filter_data, $filter_id, $lang_code = DESCR_SL) { if (fn_allowed_for('ULTIMATE') && Registry::get('runtime.company_id')) { if (!empty($filter_id) && !fn_check_company_id('product_filters', 'filter_id', $filter_id)) { fn_company_access_denied_notification(); return false; } if (!empty($filter_id)) { unset($filter_data['company_id']); } } // Parse filter type if (strpos($filter_data['filter_type'], 'FF-') === 0 || strpos($filter_data['filter_type'], 'RF-') === 0 || strpos($filter_data['filter_type'], 'DF-') === 0) { $filter_data['feature_id'] = str_replace(array('RF-', 'FF-', 'DF-'), '', $filter_data['filter_type']); $filter_data['feature_type'] = db_get_field("SELECT feature_type FROM ?:product_features WHERE feature_id = ?i", $filter_data['feature_id']); } else { $filter_data['field_type'] = str_replace(array('R-', 'B-'), '', $filter_data['filter_type']); $filter_fields = fn_get_product_filter_fields(); } if (!empty($filter_id)) { db_query('UPDATE ?:product_filters SET ?u WHERE filter_id = ?i', $filter_data, $filter_id); db_query('UPDATE ?:product_filter_descriptions SET ?u WHERE filter_id = ?i AND lang_code = ?s', $filter_data, $filter_id, $lang_code); } else { $filter_data['filter_id'] = $filter_id = db_query('INSERT INTO ?:product_filters ?e', $filter_data); foreach (fn_get_translation_languages() as $filter_data['lang_code'] => $_d) { db_query("INSERT INTO ?:product_filter_descriptions ?e", $filter_data); } } fn_set_hook('update_product_filter', $filter_data, $filter_id, $lang_code); return $filter_id; }
function fn_settings_variants_addons_email_marketing_em_madmimi_list() { if (Registry::get('addons.email_marketing.status') == 'A' && Registry::get('addons.email_marketing.em_madmimi_api_key')) { return EmailSync::instance('madmimi')->getLists(); } return array('' => __('email_marketing.enter_api_key_and_save')); }