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); }
function content_55ccecdc1c5410_56810922($_smarty_tpl) { fn_preload_lang_vars(array('comments_and_reviews', 'discussion_title_product')); if ($_smarty_tpl->tpl_vars['runtime']->value['company_id'] && fn_allowed_for("ULTIMATE") || fn_allowed_for("MULTIVENDOR")) { ?> <?php echo $_smarty_tpl->getSubTemplate("common/subheader.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('title' => __("comments_and_reviews"), 'target' => "#discussion_product_setting"), 0); ?> <div id="discussion_product_setting" class="in collapse"> <fieldset> <?php $_smarty_tpl->tpl_vars['no_hide_input'] = new Smarty_variable(false, null, 0); ?> <?php if (fn_allowed_for("ULTIMATE")) { ?> <?php $_smarty_tpl->tpl_vars['no_hide_input'] = new Smarty_variable(true, null, 0); ?> <?php } ?> <?php echo $_smarty_tpl->getSubTemplate("addons/discussion/views/discussion_manager/components/allow_discussion.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('prefix' => "product_data", 'object_id' => $_smarty_tpl->tpl_vars['product_data']->value['product_id'], 'object_type' => "P", 'title' => __("discussion_title_product"), 'no_hide_input' => $_smarty_tpl->tpl_vars['no_hide_input']->value), 0); ?> </fieldset> </div> <?php } }
/** * 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; }
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 Google Analytics tracking code * * @param mixed $company_id Company identifier to get code for * @return string Google Analytics tracking code */ function fn_google_analytics_get_tracking_code($company_id = null) { if (!fn_allowed_for('ULTIMATE')) { $company_id = null; } return Settings::instance()->getValue('tracking_code', 'google_analytics', $company_id); }
/** * The function checks if an entered percentage discount for the lower limit value equal to 1 to be greater than 0 * * @param array $product_info Product information * @param string $lang_code 2-letter language code * @param bool $skip_record Skip or not current record * @return bool false if the record should be skipped or the "lower_limit" value of the currect record */ function fn_exim_check_discount($product_info, $lang_code, $skip_record) { if (!isset($product_info['percentage_discount'])) { $product_info['percentage_discount'] = 0; } if (!isset($product_info['lower_limit'])) { $skip_record = true; } if (!fn_allowed_for('ULTIMATE:FREE')) { if (!isset($product_info['usergroup_id'])) { $skip_record = true; } $usergroup_id = fn_get_usergroup_id($product_info['usergroup_id'], $lang_code); } if ($product_info['lower_limit'] == 1 && $product_info['percentage_discount'] > 0) { if (!fn_allowed_for('ULTIMATE:FREE')) { if ($usergroup_id == 0) { $skip_record = true; } } if (fn_allowed_for('ULTIMATE:FREE')) { $skip_record = true; } } return $skip_record ? false : $product_info['lower_limit']; }
function fn_get_data_feeds_company_condition($field) { if (fn_allowed_for('ULTIMATE')) { return fn_get_company_condition($field); } return ''; }
function fn_retargeting_get_domain_api_key($company_id = null) { if (!fn_allowed_for('ULTIMATE')) { $company_id = null; } return Settings::instance()->getValue('retargeting_domain_api', 'google_analytics'); }
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 content_55ddd1046dc013_62905884($_smarty_tpl) { if ($_smarty_tpl->tpl_vars['runtime']->value['company_id'] && fn_allowed_for("ULTIMATE") || fn_allowed_for("MULTIVENDOR")) { echo $_smarty_tpl->getSubTemplate("addons/seo/common/seo_name_field.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('object_data' => $_smarty_tpl->tpl_vars['category_data']->value, 'object_name' => "category_data", 'object_id' => $_smarty_tpl->tpl_vars['category_data']->value['category_id'], 'object_type' => "c"), 0); ?> <?php } }
function content_55ddd1047662f0_40149126($_smarty_tpl) { if ($_smarty_tpl->tpl_vars['runtime']->value['company_id'] && fn_allowed_for("ULTIMATE") || !fn_allowed_for("ULTIMATE")) { echo $_smarty_tpl->getSubTemplate("addons/discussion/views/discussion_manager/components/discussion.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('object_company_id' => 0), 0); ?> <?php } }
function content_55deab25405fb7_75452475($_smarty_tpl) { if ($_smarty_tpl->tpl_vars['runtime']->value['company_id'] && fn_allowed_for("ULTIMATE") || fn_allowed_for("MULTIVENDOR")) { echo $_smarty_tpl->getSubTemplate("addons/seo/common/seo_name_field.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('object_data' => $_smarty_tpl->tpl_vars['var']->value, 'object_name' => "feature_data[variants][" . (string) $_smarty_tpl->tpl_vars['num']->value . "]", 'hide_title' => true, 'object_id' => $_smarty_tpl->tpl_vars['var']->value['variant_id'], 'object_type' => "e"), 0); ?> <?php } }
function fn_rus_unisender_update_profile($action, $user_data, $current_user_data) { if ($action == 'add') { if (fn_allowed_for('MULTIVENDOR') || fn_allowed_for('ULTIMATE') && Registry::get('runtime.company_id')) { $arr_id = array($user_data['user_id']); fn_add_users_to_unisender($arr_id, false); } } }
function content_55ccecdc585c28_55038452($_smarty_tpl) { if ($_smarty_tpl->tpl_vars['runtime']->value['company_id'] && fn_allowed_for("ULTIMATE") || fn_allowed_for("MULTIVENDOR")) { echo $_smarty_tpl->getSubTemplate("addons/discussion/views/discussion_manager/components/discussion.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('object_company_id' => $_smarty_tpl->tpl_vars['product_data']->value['company_id']), 0); ?> <?php } }
function content_55e352de43f7e3_67540535($_smarty_tpl) { if ($_smarty_tpl->tpl_vars['runtime']->value['company_id'] && fn_allowed_for("ULTIMATE") || fn_allowed_for("MULTIVENDOR")) { echo $_smarty_tpl->getSubTemplate("addons/seo/common/seo_name_field.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('object_data' => $_smarty_tpl->tpl_vars['page_data']->value, 'object_name' => "page_data", 'object_id' => $_smarty_tpl->tpl_vars['page_data']->value['page_id'], 'object_type' => "a"), 0); ?> <?php } }
/** * Hook for deleting store banners * * @param int $company_id Company id */ function fn_banners_delete_company(&$company_id) { if (fn_allowed_for('ULTIMATE')) { $bannser_ids = db_get_fields("SELECT banner_id FROM ?:banners WHERE company_id = ?i", $company_id); foreach ($bannser_ids as $banner_id) { fn_delete_banner_by_id($banner_id); } } }
function content_55e61f9b350876_29772139($_smarty_tpl) { if ($_smarty_tpl->tpl_vars['view_uri']->value && $_smarty_tpl->tpl_vars['runtime']->value['company_id'] && fn_allowed_for("ULTIMATE") || fn_allowed_for("MULTIVENDOR")) { echo $_smarty_tpl->getSubTemplate("addons/seo/common/seo_name_field.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('object_data' => $_smarty_tpl->tpl_vars['product_data']->value, 'object_name' => "product_data", 'object_id' => $_smarty_tpl->tpl_vars['product_data']->value['product_id'], 'object_type' => "p", 'share_dont_hide' => true), 0); ?> <?php } }
public function getExtraCondition($params) { $condition = []; $table_name = $this->getTableName(); $company_id = 0; if (fn_allowed_for('ULTIMATE') && ($company_id = Registry::get('runtime.company_id'))) { $condition[] = db_quote("{$table_name}.company_id = ?i", $company_id); } return $condition; }
function content_55e61f9b8a37e7_20520187($_smarty_tpl) { if ($_smarty_tpl->tpl_vars['runtime']->value['company_id'] && fn_allowed_for("ULTIMATE") || fn_allowed_for("MULTIVENDOR")) { ?> <?php echo $_smarty_tpl->getSubTemplate("addons/discussion/views/discussion_manager/components/new_discussion_popup.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('object_company_id' => $_smarty_tpl->tpl_vars['product_data']->value['company_id']), 0); ?> <?php } }
/** * Gets cached SEO name * @param string $name cached object (name or path) * @param string $object_type object type * @param mixed $object_id object_id/dispatch * @param integer $company_id company ID * @param string $lang_code language code * @param string $area current working area * @return string cached name */ public static function get($name, $object_type, $object_id, $company_id, $lang_code, $area = AREA) { if (fn_allowed_for('MULTIVENDOR')) { $company_id = 0; } $key = $lang_code . '_' . $object_id . '_' . $object_type . '_' . $company_id; if ($object_type == 's') { return self::getStatic($key, $lang_code, $area); } return isset(self::$cache[$key][$name]) ? self::$cache[$key][$name] : null; }
/** * @return bool Whether user-inputted HTML should be sanitized (true) or used as-is (false). */ public static function shouldSanitizeUserHtml() { static $should = null; if ($should === null) { $should = Registry::get('config.tweaks.sanitize_user_html'); if ($should === 'auto') { $should = fn_allowed_for('MULTIVENDOR'); } } return (bool) $should; }
function content_55db8f5836e306_87643168($_smarty_tpl) { fn_preload_lang_vars(array('search_by_vendor', 'search_by_owner', 'all_vendors')); $_smarty_tpl->tpl_vars["id"] = new Smarty_variable(($tmp = @$_smarty_tpl->tpl_vars['id']->value) === null || $tmp === '' ? "company_id" : $tmp, null, 0); $_smarty_tpl->tpl_vars["name"] = new Smarty_variable(($tmp = @$_smarty_tpl->tpl_vars['name']->value) === null || $tmp === '' ? "company_id" : $tmp, null, 0); ?> <?php if (fn_allowed_for("MULTIVENDOR")) { ?> <?php $_smarty_tpl->tpl_vars["lang_search_by_vendor"] = new Smarty_variable($_smarty_tpl->__("search_by_vendor"), null, 0); } elseif (fn_allowed_for("ULTIMATE")) { ?> <?php $_smarty_tpl->tpl_vars["lang_search_by_vendor"] = new Smarty_variable($_smarty_tpl->__("search_by_owner"), null, 0); } ?> <?php if (!$_smarty_tpl->tpl_vars['runtime']->value['company_id'] && !$_smarty_tpl->tpl_vars['runtime']->value['simple_ultimate']) { ?> <div class="<?php echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['class']->value) === null || $tmp === '' ? "control-group" : $tmp, ENT_QUOTES, 'UTF-8'); ?> "> <input type="hidden" name="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['name']->value, ENT_QUOTES, 'UTF-8'); ?> " id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['id']->value, ENT_QUOTES, 'UTF-8'); ?> " value="<?php echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['search']->value['company_id']) === null || $tmp === '' ? '' : $tmp, ENT_QUOTES, 'UTF-8'); ?> " /> <label class="control-label"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['lang_search_by_vendor']->value, ENT_QUOTES, 'UTF-8'); ?> </label> <div class="controls"> <?php echo $_smarty_tpl->getSubTemplate("common/ajax_select_object.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('data_url' => "companies.get_companies_list?show_all=Y&search=Y", 'text' => ($tmp = @fn_get_company_name($_smarty_tpl->tpl_vars['search']->value['company_id'])) === null || $tmp === '' ? $_smarty_tpl->__("all_vendors") : $tmp, 'result_elm' => $_smarty_tpl->tpl_vars['id']->value, 'id' => (string) $_smarty_tpl->tpl_vars['id']->value . "_selector"), 0); ?> </div> </div> <?php } }
function content_55d2ec43e9dd82_99735809($_smarty_tpl) { fn_preload_lang_vars(array('seo_name')); if ($_smarty_tpl->tpl_vars['runtime']->value['company_id'] && fn_allowed_for("ULTIMATE") || fn_allowed_for("MULTIVENDOR")) { ?> <label class="checkbox" for="seo_name"> <input type="checkbox" value="seo_name" id="seo_name" name="selected_fields[extra][]" checked="checked" class="cm-item-s" /> <?php echo $_smarty_tpl->__("seo_name"); ?> </label> <?php } }
function fn_rus_exim_1c_get_information() { $storefront_url = fn_get_storefront_url(fn_get_storefront_protocol()); if (fn_allowed_for('ULTIMATE')) { if (Registry::get('runtime.company_id') || Registry::get('runtime.simple_ultimate')) { } else { $storefront_url = ''; } } $exim_1c_info = ''; if (!empty($storefront_url)) { $exim_1c_info = __('exim_1c_information', array('[http_location]' => $storefront_url . '/' . 'exim_1c')); } return $exim_1c_info; }
function content_55e61f9b6b3cf4_52024227($_smarty_tpl) { if ($_smarty_tpl->tpl_vars['runtime']->value['company_id'] && fn_allowed_for("ULTIMATE") || fn_allowed_for("MULTIVENDOR")) { ?> <?php if ($_smarty_tpl->tpl_vars['addons']->value['tags']['tags_for_products'] == "Y") { ?> <?php echo $_smarty_tpl->getSubTemplate("addons/tags/views/tags/components/object_tags.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('object' => $_smarty_tpl->tpl_vars['product_data']->value, 'input_name' => "product_data", 'allow_save' => true, 'object_type' => "P", 'object_id' => $_smarty_tpl->tpl_vars['product_data']->value['product_id']), 0); ?> <?php } } }
function content_55dc7cc5df4295_29293057($_smarty_tpl) { if ($_smarty_tpl->tpl_vars['runtime']->value['company_id'] && fn_allowed_for("ULTIMATE") || fn_allowed_for("MULTIVENDOR")) { ?> <?php if ($_smarty_tpl->tpl_vars['addons']->value['tags']['tags_for_pages'] == "Y") { ?> <?php echo $_smarty_tpl->getSubTemplate("addons/tags/views/tags/components/object_tags.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('object' => $_smarty_tpl->tpl_vars['page_data']->value, 'input_name' => "page_data", 'object_type' => "A", 'object_id' => $_smarty_tpl->tpl_vars['page_data']->value['page_id']), 0); ?> <?php } } }
function fn_qty_update_prices($product_id, $data) { $company_id = Registry::get('runtime.company_id'); $prod_company_id = db_get_field("SELECT company_id FROM ?:products WHERE product_id = ?i", $product_id); if (fn_allowed_for('ULTIMATE')) { if (empty($company_id) || !empty($company_id) && $company_id == $prod_company_id) { unset($data['product_code']); unset($data['Language']); unset($data['lang_code']); $data['company_id'] = $prod_company_id; $data['product_id'] = $product_id; db_query("REPLACE INTO ?:ult_product_prices ?e", $data); } } }
function fn_vendor_data_premoderation_update_company_pre(&$company_data, &$company_id, &$lang_code) { if (fn_allowed_for('MULTIVENDOR') && Registry::get('runtime.company_id')) { $orig_company_data = fn_get_company_data($company_id, $lang_code); $vendor_profile_updates_approval = Registry::get('addons.vendor_data_premoderation.vendor_profile_updates_approval'); if ($orig_company_data['status'] == 'A' && ($vendor_profile_updates_approval == 'all' || $vendor_profile_updates_approval == 'custom' && !empty($orig_company_data['pre_moderation_edit_vendors']) && $orig_company_data['pre_moderation_edit_vendors'] == 'Y')) { $logotypes = fn_filter_uploaded_data('logotypes_image_icon'); // FIXME: dirty comparison // check that some data is changed if (array_diff_assoc($company_data, $orig_company_data) || !empty($logotypes)) { $company_data['status'] = 'P'; } } } }
function fn_get_status_params_definition($type) { $status_params = array(); if ($type == STATUSES_ORDER) { $status_params = array('color' => array('type' => 'color', 'label' => 'color'), 'notify' => array('type' => 'checkbox', 'label' => 'notify_customer', 'default_value' => 'Y'), 'notify_department' => array('type' => 'checkbox', 'label' => 'notify_orders_department'), 'notify_vendor' => array('type' => 'checkbox', 'label' => 'notify_vendor'), 'inventory' => array('type' => 'select', 'label' => 'inventory', 'variants' => array('I' => 'increase', 'D' => 'decrease')), 'remove_cc_info' => array('type' => 'checkbox', 'label' => 'remove_cc_info', 'default_value' => 'Y'), 'repay' => array('type' => 'checkbox', 'label' => 'pay_order_again'), 'appearance_type' => array('type' => 'select', 'label' => 'invoice_credit_memo', 'variants' => array('D' => 'default', 'I' => 'invoice', 'C' => 'credit_memo', 'O' => 'order'))); if (fn_allowed_for('ULTIMATE:FREE')) { unset($status_params['notify_vendor']); } elseif (fn_allowed_for('MULTIVENDOR')) { $status_params['calculate_for_payouts'] = array('type' => 'checkbox', 'label' => 'charge_to_vendor_account'); } elseif (fn_allowed_for('ULTIMATE')) { unset($status_params['notify_vendor']); } } fn_set_hook('get_status_params_definition', $status_params, $type); return $status_params; }
function fn_build_link_on_price($link, $mode, $return_url, $lang_code = CART_LANGUAGE) { $text = ''; if (fn_allowed_for('ULTIMATE') && !Registry::get('runtime.company_id')) { $text .= '<ul class="standard-ul">'; foreach (fn_get_all_companies_ids() as $company_id) { $_link = fn_url($link . $mode . '&company_id=' . $company_id, 'C', 'http'); $text .= '<li><a href="' . $_link . '&sl=' . $lang_code . '&return_url=' . urlencode($return_url) . '">' . $_link . '</a></li>'; } $text .= '</ul>'; } else { $_link = fn_url($link, 'C', 'http'); $text .= '<a href="' . $_link . $mode . '&sl=' . $lang_code . '&return_url=' . urlencode($return_url) . '">' . $_link . $mode . '</a><br />'; } return $text; }