function fn_get_seo_rules($params = array(), $items_per_page = 0, $lang_code = DESCR_SL) { $lang_code = fn_get_corrected_seo_lang_code($lang_code); $global_total = db_get_fields("SELECT dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' GROUP BY dispatch"); $local_total = db_get_fields("SELECT dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s", $lang_code); if ($diff = array_diff($global_total, $local_total)) { foreach ($diff as $disp) { fn_create_seo_name(0, 's', str_replace('.', '-', $disp), 0, $disp, DESCR_SL); } } // Init filter $params = fn_init_view('seo_rules', $params); // Set default values to input params $params['page'] = empty($params['page']) ? 1 : $params['page']; // default page is 1 $condition = ''; if (isset($params['name']) && fn_string_no_empty($params['name'])) { $condition .= db_quote(" AND name LIKE ?l", "%" . trim($params['name']) . "%"); } if (isset($params['controller']) && fn_string_no_empty($params['controller'])) { $condition .= db_quote(" AND dispatch LIKE ?l", "%" . trim($params['controller']) . "%"); } $limit = ''; if (!empty($items_per_page)) { $total = db_get_field("SELECT COUNT(*) FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p", $lang_code, $condition); $limit = fn_paginate($params['page'], $total, $items_per_page); } $seo_data = db_get_array("SELECT name, dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p ORDER BY dispatch {$limit}", $lang_code, $condition); return array($seo_data, $params); }
function fn_update_epayph_settings($settings) { if (isset($settings['pp_statuses'])) { $settings['pp_statuses'] = serialize($settings['pp_statuses']); } foreach ($settings as $setting_name => $setting_value) { Settings::instance()->updateValue($setting_name, $setting_value); } //Get company_ids for which we should update logos. If root admin click 'update for all', get all company_ids if (isset($settings['pp_logo_update_all_vendors']) && $settings['pp_logo_update_all_vendors'] == 'Y') { $company_ids = db_get_fields('SELECT company_id FROM ?:companies'); $company_id = array_shift($company_ids); } elseif (!Registry::get('runtime.simple_ultimate')) { $company_id = Registry::get('runtime.company_id'); } else { $company_id = 1; } //Use company_id as pair_id fn_attach_image_pairs('epayph_logo', 'epayph_logo', $company_id); if (isset($company_ids)) { foreach ($company_ids as $logo_id) { fn_clone_image_pairs($logo_id, $company_id, 'epayph_logo'); } } }
function fn_projects_remove_pages() { $pages = db_get_fields("SELECT page_id FROM ?:pages WHERE page_type = ?s ", PAGE_TYPE_PROJECTS); foreach ($pages as $page_id) { fn_delete_page($page_id, $recurse = true); } }
function fn_rus_pickpoint_uninstall() { $service_ids = db_get_fields('SELECT service_id FROM ?:shipping_services WHERE module = ?s', 'pickpoint'); db_query('DELETE FROM ?:shipping_services WHERE service_id IN (?a)', $service_ids); db_query('DELETE FROM ?:shipping_service_descriptions WHERE service_id IN (?a)', $service_ids); db_query('DROP TABLE IF EXISTS ?:rus_pickpoint_postamat'); }
function fn_get_seo_rules($params = array(), $items_per_page = 0, $lang_code = DESCR_SL) { $condition = fn_get_seo_company_condition('?:seo_names.company_id'); $lang_code = fn_get_corrected_seo_lang_code($lang_code); $global_total = db_get_fields("SELECT dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' ?p GROUP BY dispatch", $condition); $local_total = db_get_fields("SELECT dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p", $lang_code, $condition); if ($diff = array_diff($global_total, $local_total)) { foreach ($diff as $disp) { fn_create_seo_name(0, 's', str_replace('.', '-', $disp), 0, $disp, '', DESCR_SL); } } // Init filter $params = LastView::instance()->update('seo_rules', $params); // Set default values to input params $default_params = array('page' => 1, 'items_per_page' => $items_per_page); $params = array_merge($default_params, $params); if (isset($params['name']) && fn_string_not_empty($params['name'])) { $condition .= db_quote(" AND name LIKE ?l", "%" . trim($params['name']) . "%"); } if (isset($params['rule_params']) && fn_string_not_empty($params['rule_params'])) { $condition .= db_quote(" AND dispatch LIKE ?l", "%" . trim($params['rule_params']) . "%"); } $limit = ''; if (!empty($params['items_per_page'])) { $params['total_items'] = db_get_field("SELECT COUNT(*) FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p", $lang_code, $condition); $limit = db_paginate($params['page'], $params['items_per_page'], $params['total_items']); } $seo_data = db_get_array("SELECT name, dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p ORDER BY dispatch {$limit}", $lang_code, $condition); return array($seo_data, $params); }
/** * Makes a full backup of store * * @return bool true if successfully created */ public static function backup($params = array()) { $tables = db_get_fields('SHOW TABLES'); $default_params = array('compress' => 'zip', 'db_tables' => $tables, 'db_schema' => true, 'db_data' => true, 'move_progress' => true); $pack_name = !empty($params['pack_name']) ? $params['pack_name'] : date('dMY_His', TIME); $destination_path = fn_get_cache_path(false) . 'tmp/backup/'; $params = array_merge($default_params, $params); $files = self::backupFiles($params); $dump = self::backupDatabase($params); fn_rm($destination_path . $pack_name); fn_mkdir($destination_path . $pack_name); fn_copy($files, $destination_path . $pack_name); fn_mkdir($destination_path . $pack_name . '/var/restore/'); fn_copy($dump, $destination_path . $pack_name . '/var/restore/'); fn_rm($files); fn_rm($dump); if (!empty($params['compress'])) { fn_set_progress('echo', __('compressing_backup'), false); $ext = $params['compress'] == 'tgz' ? '.tgz' : '.zip'; $result = fn_compress_files($pack_name . $ext, $pack_name, $destination_path); fn_rm($destination_path . $pack_name); if ($result) { // Move archive to backups directory $result = fn_rename($destination_path . $pack_name . $ext, Registry::get('config.dir.backups') . $pack_name . $ext); if ($result) { return Registry::get('config.dir.backups') . $pack_name . $ext; } } return false; } else { return $destination_path . $pack_name; } }
function fn_yml_export_update_product_pre(&$product_data, $product_id, $lang_code, $can_update) { if (!empty($product_data['yml2_delivery_options'])) { foreach ($product_data['yml2_delivery_options'] as $index => $delivery_option) { if (fn_is_empty($delivery_option)) { unset($product_data['yml2_delivery_options'][$index]); } } $product_data['yml2_delivery_options'] = array_slice($product_data['yml2_delivery_options'], 0, 5); $product_data['yml2_delivery_options'] = serialize($product_data['yml2_delivery_options']); } $exclude_price_ids = !empty($product_data['yml2_exclude_price_ids']) ? $product_data['yml2_exclude_price_ids'] : array(); $old_price_ids = db_get_fields("SELECT price_id FROM ?:yml_exclude_objects WHERE object_id = ?i AND object_type = 'product'", $product_id); $data = array(); foreach ($exclude_price_ids as $price_id) { $data[] = array('price_id' => $price_id, 'object_id' => $product_id, 'object_type' => 'product'); } if (empty($data)) { db_query("DELETE FROM ?:yml_exclude_objects WHERE object_id = ?i AND object_type = 'product'", $product_id); } else { db_query("INSERT INTO ?:yml_exclude_objects ?m ON DUPLICATE KEY UPDATE price_id=price_id", $data); $delete_prices_ids = array_diff($old_price_ids, $exclude_price_ids); if (!empty($delete_prices_ids)) { db_query("DELETE FROM ?:yml_exclude_objects WHERE price_id IN (?a) AND object_type = 'product'", $delete_prices_ids); } } }
function fn_twigmo_remove_bm() { $location_ids = db_get_fields("SELECT `location_id` FROM `?:bm_locations` WHERE `dispatch` LIKE '%twigmo%';"); if (!empty($location_ids)) { db_query("DELETE FROM `?:bm_locations` WHERE `location_id` IN (?a)", $location_ids); db_query("DELETE FROM `?:bm_locations_descriptions` WHERE `location_id` IN (?a)", $location_ids); } }
function fn_rus_pickup_uninstall() { $service_ids = db_get_fields('SELECT service_id FROM ?:shipping_services WHERE module = ?s', 'pickup'); if (!empty($service_ids)) { db_query('DELETE FROM ?:shipping_services WHERE service_id IN (?a)', $service_ids); db_query('DELETE FROM ?:shipping_service_descriptions WHERE service_id IN (?a)', $service_ids); } }
function fn_rus_spsr_uninstall() { $service_ids = db_get_fields('SELECT service_id FROM ?:shipping_services WHERE module = ?s', 'spsr'); db_query('DELETE FROM ?:shipping_services WHERE service_id IN (?a)', $service_ids); db_query('DELETE FROM ?:shipping_service_descriptions WHERE service_id IN (?a)', $service_ids); db_query('DROP TABLE IF EXISTS ?:rus_spsr_invoices'); db_query('DROP TABLE IF EXISTS ?:rus_spsr_register'); db_query('DROP TABLE IF EXISTS ?:rus_spsr_invoices_items'); db_query('ALTER TABLE ?:products DROP spsr_product_type'); }
function fn_rus_russianpost_uninstall() { $objects = fn_rus_russianpost_schema(); foreach ($objects as $object) { $service_ids = db_get_fields('SELECT service_id FROM ?:shipping_services WHERE module = ?s', $object['module']); if (!empty($service_ids)) { db_query('DELETE FROM ?:shipping_services WHERE service_id IN (?a)', $service_ids); db_query('DELETE FROM ?:shipping_service_descriptions WHERE service_id IN (?a)', $service_ids); } } }
function fn_set_allowed_company_ids(&$conditions) { if (Registry::get('runtime.company_id') && !Registry::get('runtime.simple_ultimate')) { $company_customers_ids = implode(',', db_get_fields("SELECT user_id FROM ?:orders WHERE company_id = ?i", Registry::get('runtime.company_id'))); if (Registry::get('settings.Stores.share_users') == 'Y' && !empty($company_customers_ids)) { $conditions[] = "(users.company_id = " . Registry::get('runtime.company_id') . " OR users.user_id IN ({$company_customers_ids}))"; } else { $conditions[] = "users.company_id = " . Registry::get('runtime.company_id'); } } }
function fn_rus_sdek_uninstall() { $service_ids = db_get_fields('SELECT service_id FROM ?:shipping_services WHERE module = ?s', 'sdek'); db_query('DELETE FROM ?:shipping_services WHERE service_id IN (?a)', $service_ids); db_query('DELETE FROM ?:shipping_service_descriptions WHERE service_id IN (?a)', $service_ids); db_query('DROP TABLE IF EXISTS ?:rus_cities_sdek'); db_query('DROP TABLE IF EXISTS ?:rus_city_sdek_descriptions'); db_query('DROP TABLE IF EXISTS ?:rus_sdek_products'); db_query('DROP TABLE IF EXISTS ?:rus_sdek_register'); db_query('DROP TABLE IF EXISTS ?:rus_sdek_status'); }
function fn_rus_dellin_uninstall() { $service_ids = db_get_fields('SELECT service_id FROM ?:shipping_services WHERE module = ?s', 'dellin'); if (!empty($service_ids)) { db_query('DELETE FROM ?:shipping_services WHERE service_id IN (?a)', $service_ids); db_query('DELETE FROM ?:shipping_service_descriptions WHERE service_id IN (?a)', $service_ids); } db_query('DROP TABLE IF EXISTS ?:rus_dellin_cities'); $file_dir = fn_get_files_dir_path() . "dellin/"; fn_rm($file_dir); }
function fn_import_check_translations_lang_code(&$primary_object_id, &$object, &$processed_data, &$skip_record) { static $valid_codes = array(); if (empty($valid_codes)) { $valid_codes = db_get_fields('SELECT lang_code FROM ?:languages'); } if (!in_array($object['lang_code'], $valid_codes)) { $skip_record = true; $processed_data['S']++; } }
function fn_get_feature_by_id($feature_id, $category_id, $id_path, $number_of_variants) { $feature = array(); $category_ids = db_get_fields("SELECT category_id FROM ?:categories WHERE id_path LIKE ?l", $id_path . '/%'); $category_ids[] = $category_id; $feature['id'] = $feature_id; $feature['name'] = db_get_field('SELECT description FROM ?:product_features_descriptions WHERE feature_id = ?i AND lang_code = ?s', $feature_id, CART_LANGUAGE); $feature['variants'] = db_get_array('SELECT ?:product_features_values.variant_id, ?:product_feature_variant_descriptions.variant FROM ?:product_features_values LEFT JOIN ?:products ON ?:products.product_id = ?:product_features_values.product_id LEFT JOIN ?:product_feature_variants ON ?:product_feature_variants.variant_id = ?:product_features_values.variant_id LEFT JOIN ?:product_feature_variant_descriptions ON ?:product_feature_variant_descriptions.variant_id = ?:product_feature_variants.variant_id AND ?:product_feature_variant_descriptions.lang_code = ?s INNER JOIN ?:products_categories ON ?:products_categories.product_id = ?:products.product_id WHERE ?:product_features_values.feature_id = ?i AND ?:products_categories.category_id IN (?n) GROUP BY ?:product_features_values.variant_id ORDER BY ?:product_feature_variant_descriptions.variant ASC', CART_LANGUAGE, $feature_id, $category_ids); if (!empty($number_of_variants) && !empty($feature['variants']) && count($feature['variants']) > $number_of_variants) { $feature['variants'] = array_slice($feature['variants'], 0, $number_of_variants); $feature['view_all'] = 'Y'; } return $feature; }
function fn_bestsellers_update_product($product_data, $product_id) { if (!isset($product_data['sales_amount'])) { return false; } db_query("DELETE FROM ?:product_sales WHERE product_id = ?i", $product_id); $cids = db_get_fields("SELECT category_id FROM ?:products_categories WHERE product_id = ?i", $product_id); if (!empty($cids)) { foreach ($cids as $category_id) { $_data = array('category_id' => $category_id, 'product_id' => $product_id, 'amount' => $product_data['sales_amount']); db_query("REPLACE INTO ?:product_sales ?e", $_data); } } }
/** * Delete poll * * @param int $page_id ID of the page, poll attached to * @return bool true if poll was deleted, false - otherwise */ function fn_polls_delete_page($page_id) { if (!empty($page_id)) { $item_ids = db_get_fields("SELECT item_id FROM ?:poll_items WHERE page_id = ?i", $page_id); db_query("DELETE FROM ?:polls_answers WHERE item_id IN (?n)", $item_ids); db_query("DELETE FROM ?:poll_items WHERE page_id = ?i", $page_id); db_query("DELETE FROM ?:poll_descriptions WHERE page_id = ?i", $page_id); db_query("DELETE FROM ?:polls WHERE page_id = ?i", $page_id); db_query("DELETE FROM ?:polls_votes WHERE page_id = ?i", $page_id); fn_clean_block_items('polls', $page_id); return true; } return false; }
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; }
function fn_customers_also_bought_place_order(&$order_id) { $product_ids = db_get_fields("SELECT product_id FROM ?:order_details WHERE order_id = ?i GROUP BY product_id", $order_id); if (count($product_ids) < 2) { return; } foreach ($product_ids as $_origin) { foreach ($product_ids as $_target) { if ($_origin != $_target) { $_data = array('product_id' => $_origin, 'related_id' => $_target, 'amount' => db_get_field("SELECT amount FROM ?:also_bought_products WHERE product_id = ?i AND related_id = ?i", $_origin, $_target)); $_data['amount']++; db_query("REPLACE INTO ?:also_bought_products ?e", $_data); } } } }
/** * Gets products default navigation * * @param array $params Request params * @return array navigation data */ function fn_lv_get_product_default_navigation($params) { if (empty($params['product_id'])) { return false; } $update_data = array(); $product_id = $params['product_id']; if (fn_allowed_for('ULTIMATE') && Registry::get('runtime.company_id')) { $company_condition = fn_get_company_condition('c.company_id'); $category_id = db_get_field("SELECT c.category_id, IF(pc.link_type = ?s, 1, 0) as is_main FROM ?:categories AS c LEFT JOIN ?:products_categories AS pc ON c.category_id = pc.category_id WHERE pc.product_id = ?i {$company_condition} ORDER BY is_main DESC", 'M', $product_id); } else { $category_id = db_get_field("SELECT category_id FROM ?:products_categories WHERE product_id = ?i AND link_type = ?s", $product_id, 'M'); } if (empty($category_id)) { return false; } $search_params = array('cid' => $category_id, 'get_conditions' => true); list($fields, $join, $condition) = fn_get_products($search_params); $sorting = "ORDER BY descr1.product asc"; // get product position in full list db_query("SET @r = 0;"); $product_position = db_get_field("SELECT a.row FROM (SELECT products.product_id, @r := @r + 1 as row FROM ?:products as products {$join} WHERE 1 {$condition} GROUP BY products.product_id {$sorting}) AS a WHERE a.product_id = ?i", $product_id); $items_per_page = Registry::get('settings.Appearance.products_per_page'); if (empty($product_position) || empty($items_per_page)) { return false; } $page = ceil($product_position / $items_per_page); $limit = db_paginate($page, $items_per_page); $stored_items_ids[$page] = db_get_fields("SELECT SQL_CALC_FOUND_ROWS products.product_id FROM ?:products as products {$join} WHERE 1 {$condition} GROUP BY products.product_id {$sorting} {$limit}"); $total_items = db_get_found_rows(); $total_pages = ceil($total_items / $items_per_page); unset($search_params['get_conditions']); $update_data['params'] = serialize($search_params); $update_data['view_results'] = array('items_ids' => $stored_items_ids, 'total_pages' => $total_pages, 'items_per_page' => $items_per_page, 'total_items' => $total_items); $update_data['view_results'] = serialize($update_data['view_results']); return $update_data; }
function fn_rma_paypal_get_ipn_order_ids(&$data, &$order_ids) { if (!isset($data['txn_type']) && fn_allowed_for('MULTIVENDOR')) { //in MVE we should process refund ipn only for those orders, which was requested and approved by admin $child_orders_ids = db_get_fields("SELECT order_id FROM ?:orders WHERE parent_order_id = ?i", $order_ids[0]); if (!empty($child_orders_ids)) { $orders_to_be_canceled = db_get_fields("SELECT order_id FROM ?:rma_returns WHERE status IN (SELECT status FROM ?:status_data WHERE type = ?s AND param = 'inventory' and value = 'I' and status != ?s) and order_id in (?n)", STATUSES_RETURN, RMA_DEFAULT_STATUS, $child_orders_ids); $order_ids = !empty($orders_to_be_canceled) ? $orders_to_be_canceled : $order_ids; } } }
function fn_set_1c_tags($product_id = 0, $tags) { if (empty($product_id)) { return false; } fn_update_1c_tags($product_id, $tags); if (Registry::get('addons.1clue_related_products_extended.related_filling') == 'tags') { $_tags = fn_get_1c_tags($product_id); if (!empty($_tags)) { foreach ($_tags as $tag) { $tag_analogues = db_get_fields("SELECT product_id FROM ?:addon_related_products_tags WHERE tag=?s", $tag); fn_set_related($product_id, $tag_analogues, 'cross_linked'); } } } return true; }
function fn_delete_image_pairs($object_id, $object_type, $pair_type = '') { $cond = ''; if ($pair_type === 'A') { $cond .= db_quote("AND type = 'A'"); } elseif ($pair_type === 'M') { $cond .= db_quote("AND type = 'M'"); } $pair_ids = db_get_fields("SELECT pair_id FROM ?:images_links WHERE object_id = ?i AND object_type = ?s ?p", $object_id, $object_type, $cond); foreach ($pair_ids as $pair_id) { fn_delete_image_pair($pair_id, $object_type); } return true; }
/** * Makes diff between original and latest snapshots * @param array $params $_REQUEST params * @return array array with changed data */ public static function changes($params) { $results = array(); $creation_time = 0; $changes_tree = array(); $db_diff = ''; $db_d_diff = ''; $dist_filename = self::getName('dist'); $snapshot_filename = self::getName('current'); if (is_file($dist_filename)) { if (is_file($snapshot_filename)) { include $snapshot_filename; include $dist_filename; list($added, $changed, $deleted) = self::diff($snapshot, $snapshot_dist); foreach ($snapshot['themes'] as $theme_name => $data) { $data_dist = self::buildTheme($theme_name, $snapshot_dist); list($theme_added, $theme_changed, $theme_deleted) = self::diff($data, $data_dist); self::arrayMerge($added, $theme_added); self::arrayMerge($changed, $theme_changed); self::arrayMerge($deleted, $theme_deleted); } $tree = self::buildTree(array('added' => $added, 'changed' => $changed, 'deleted' => $deleted)); $tables = db_get_fields('SHOW TABLES'); $creation_time = $snapshot['time']; $changes_tree = $tree; if (!empty($snapshot_dist['db_scheme'])) { $db_scheme = ''; foreach ($tables as $table) { if (!in_array($table, $snapshot_dist['db_tables'])) { continue; } $db_scheme .= "\nDROP TABLE IF EXISTS `" . $table . "`;\n"; $__scheme = db_get_row("SHOW CREATE TABLE {$table}"); $__scheme = array_pop($__scheme); $replaced_scheme = preg_replace('/ AUTO_INCREMENT=[0-9]*/i', '', $__scheme); if (!empty($replaced_scheme) && is_string($replaced_scheme)) { $__scheme = $replaced_scheme; } $db_scheme .= $__scheme . ";"; } $db_scheme = str_replace('default', 'DEFAULT', $db_scheme); $snapshot_dist['db_scheme'] = str_replace('default', 'DEFAULT', $snapshot_dist['db_scheme']); $db_diff = self::textDiff($snapshot_dist['db_scheme'], $db_scheme); } if (isset($params['db_ready']) && $params['db_ready'] == 'Y') { $snapshot_dir = Registry::get('config.dir.snapshots'); $s_r = fn_get_contents($snapshot_dir . 'cmp_release.sql'); $s_c = fn_get_contents($snapshot_dir . 'cmp_current.sql'); @ini_set('memory_limit', '255M'); $db_d_diff = self::textDiff($s_r, $s_c); } } $dist_filename = ''; } return array('creation_time' => $creation_time, 'changes_tree' => $changes_tree, 'db_diff' => $db_diff, 'db_d_diff' => $db_d_diff, 'dist_filename' => $dist_filename); }
function fn_product_configurator_delete_cart_product(&$cart, &$cart_id, $full_erase) { if ($full_erase == false) { return false; } if (!empty($cart['products'][$cart_id]['extra']['configuration'])) { foreach ($cart['products'] as $key => $item) { if (!empty($item['extra']['parent']['configuration']) && $item['extra']['parent']['configuration'] == $cart_id) { unset($cart['products'][$key]); } } } if (!empty($cart['products'][$cart_id]['extra']['parent']['configuration'])) { // find the group of the product in configuration $product_id = $cart['products'][$cart_id]['product_id']; $conf_id = $cart['products'][$cart['products'][$cart_id]['extra']['parent']['configuration']]['product_id']; $groups = db_get_fields("SELECT group_id FROM ?:conf_group_products WHERE product_id = ?i", $product_id); // If this group is required then do not unset the product $required = db_get_field("SELECT required FROM ?:conf_product_groups WHERE group_id IN (?n) AND product_id = ?i", $groups, $conf_id); if ($required == 'Y') { $product_name = db_get_field("SELECT product FROM ?:product_descriptions WHERE product_id = ?i AND lang_code = ?s", $product_id, CART_LANGUAGE); fn_set_notification('W', fn_get_lang_var('warning'), str_replace('[product_name]', $product_name, fn_get_lang_var('required_configuration_group'))); $cart_id = 0; } } return true; }
} $view_mail->assign('object_data', $object_data); $view_mail->assign('post_data', $post_data); $view_mail->assign('object_name', $object_name); $view_mail->assign('subject', fn_get_lang_var('discussion_title_' . $discussion_object_types[$object['object_type']]) . ' - ' . fn_get_lang_var($discussion_object_types[$object['object_type']])); // Send notification if needed if (!empty($email_from)) { fn_send_mail($email_to, $email_from, 'addons/discussion/notification_subj.tpl', 'addons/discussion/notification.tpl'); } } } if ($mode == 'update_posts') { if (AREA == 'A' && !empty($_REQUEST['posts']) && is_array($_REQUEST['posts'])) { $threads = db_get_hash_single_array("SELECT post_id, thread_id FROM ?:discussion_posts WHERE post_id IN (?n)", array('post_id', 'thread_id'), array_keys($_REQUEST['posts'])); $messages_exist = db_get_fields("SELECT post_id FROM ?:discussion_messages WHERE post_id IN (?n)", array_keys($_REQUEST['posts'])); $rating_exist = db_get_fields("SELECT post_id FROM ?:discussion_rating WHERE post_id IN (?n)", array_keys($_REQUEST['posts'])); foreach ($_REQUEST['posts'] as $p_id => $data) { db_query("UPDATE ?:discussion_posts SET ?u WHERE post_id = ?i", $data, $p_id); if (in_array($p_id, $messages_exist)) { db_query("UPDATE ?:discussion_messages SET ?u WHERE post_id = ?i", $data, $p_id); } else { $data['thread_id'] = $threads[$p_id]; $data['post_id'] = $p_id; db_query("INSERT INTO ?:discussion_messages ?e", $data); } if (in_array($p_id, $rating_exist)) { db_query("UPDATE ?:discussion_rating SET ?u WHERE post_id = ?i", $data, $p_id); } else { $data['thread_id'] = $threads[$p_id]; $data['post_id'] = $p_id; db_query("INSERT INTO ?:discussion_rating ?e", $data);
if (!is_dir(Registry::get('config.dir.backups'))) { fn_mkdir(Registry::get('config.dir.backups')); } if (fn_copy($dump['path'], Registry::get('config.dir.backups') . $dump['name'])) { fn_set_notification('N', __('notice'), __('done')); } else { fn_set_notification('E', __('error'), __('cant_create_backup_file')); } } else { fn_set_notification('E', __('error'), __('cant_upload_file')); } } if ($mode == 'optimize') { // Log database optimization fn_log_event('database', 'optimize'); $all_tables = db_get_fields("SHOW TABLES"); fn_set_progress('parts', sizeof($all_tables)); foreach ($all_tables as $table) { fn_set_progress('echo', __('optimizing_table') . " <b>{$table}</b>...<br />"); db_query("OPTIMIZE TABLE {$table}"); db_query("ANALYZE TABLE {$table}"); $fields = db_get_hash_array("SHOW COLUMNS FROM {$table}", 'Field'); if (!empty($fields['is_global'])) { // Sort table by is_global field fn_echo('.'); db_query("ALTER TABLE {$table} ORDER BY is_global DESC"); } elseif (!empty($fields['position'])) { // Sort table by position field fn_echo('.'); db_query("ALTER TABLE {$table} ORDER BY position"); }
$country_descriptions = fn_get_countries_name(array_keys($countries)); $_SESSION['entry_page'] = true; Tygh::$app['view']->assign('countries', $countries); Tygh::$app['view']->assign('country_descriptions', $country_descriptions); Tygh::$app['view']->display('views/companies/components/entry_page.tpl'); exit; } } if ($mode == 'view') { $company_data = !empty($_REQUEST['company_id']) ? fn_get_company_data($_REQUEST['company_id']) : array(); if (empty($company_data) || empty($company_data['status']) || !empty($company_data['status']) && $company_data['status'] != 'A') { return array(CONTROLLER_STATUS_NO_PAGE); } fn_add_breadcrumb(__('all_vendors'), 'companies.catalog'); fn_add_breadcrumb($company_data['company']); $company_data['total_products'] = count(db_get_fields(fn_get_products(array('get_query' => true, 'company_id' => $_REQUEST['company_id'])))); $company_data['logos'] = fn_get_logos($company_data['company_id']); Registry::set('navigation.tabs', array('description' => array('title' => __('description'), 'js' => true))); $params = array('company_id' => $_REQUEST['company_id']); Tygh::$app['view']->assign('company_data', $company_data); } elseif ($mode == 'catalog') { fn_add_breadcrumb(__('all_vendors')); $params = $_REQUEST; $params['status'] = 'A'; $params['get_description'] = 'Y'; $vendors_per_page = Registry::get('settings.Vendors.vendors_per_page'); list($companies, $search) = fn_get_companies($params, $auth, $vendors_per_page); foreach ($companies as &$company) { $company['logos'] = fn_get_logos($company['company_id']); } Tygh::$app['view']->assign('companies', $companies);
<?php /*************************************************************************** * * * (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev * * * * This is commercial software, only users who have purchased a valid * * license and accept to the terms of the License Agreement can install * * and use this program. * * * **************************************************************************** * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE * * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. * ****************************************************************************/ if (!defined('BOOTSTRAP')) { if (!empty($_REQUEST['conntkt'])) { // Set the connection ticket to the payment params require './init_payment.php'; $payments = db_get_fields("SELECT a.payment_id FROM ?:payments as a LEFT JOIN ?:payment_processors as b ON b.processor_id = a.processor_id WHERE b.processor_script = 'qbms.php'"); foreach ($payments as $payment_id) { $processor_data = fn_get_payment_method_data($payment_id); if ($processor_data["processor_params"]["app_id"] == $_REQUEST['appid']) { $processor_data["processor_params"]["connection_ticket"] = $_REQUEST['conntkt']; $_data = array('params' => serialize($processor_data['processor_params'])); db_query("UPDATE ?:payments SET ?u WHERE payment_id = ?i", $_data, $payment_id); } } } else { die('Access denied'); } }