$cart['payment_method_data'] = fn_get_payment_method_data($cart['payment_id']); } if (!empty($auth['user_id'])) { //if the error occurred during registration, but despite this, the registration was performed, then the variable should be cleared. unset($_SESSION['failed_registration']); if (!empty($_REQUEST['profile_id'])) { $cart['profile_id'] = $_REQUEST['profile_id']; } elseif (!empty($_REQUEST['profile']) && $_REQUEST['profile'] == 'new') { $cart['profile_id'] = 0; } elseif (empty($cart['profile_id'])) { $cart['profile_id'] = db_get_field("SELECT profile_id FROM ?:user_profiles WHERE user_id = ?i AND profile_type='P'", $auth['user_id']); } // Here check the previous and the current checksum of user_data - if they are different, recalculate the cart. $current_state = fn_crc32(serialize($cart['user_data'])); $cart['user_data'] = fn_get_user_info($auth['user_id'], empty($_REQUEST['profile']), $cart['profile_id']); if ($current_state != fn_crc32(serialize($cart['user_data']))) { $cart['recalculate'] = true; } } else { $_user_data = fn_restore_post_data('user_data'); if (!empty($_user_data)) { $_SESSION['failed_registration'] = true; } else { unset($_SESSION['failed_registration']); } fn_add_user_data_descriptions($cart['user_data']); if (!empty($_REQUEST['action'])) { Tygh::$app['view']->assign('checkout_type', $_REQUEST['action']); } } fn_get_default_credit_card($cart, !empty($_user_data) ? $_user_data : $cart['user_data']);
public static function processMessages($messages, $process_messages = true) { $messages_queue = array(); if (!empty($messages)) { if ($process_messages) { $messages_queue = fn_get_storage_data('hd_messages'); } if (empty($messages_queue)) { $messages_queue = array(); } else { $messages_queue = unserialize($messages_queue); } foreach ($messages->Message as $message) { $message_id = empty($message->Id) ? intval(fn_crc32(microtime()) / 2) : (string) $message->Id; $message = array('type' => empty($message->Type) ? 'W' : (string) $message->Type, 'title' => empty($message->Title) ? __('notice') : (string) $message->Title, 'text' => (string) $message->Text); $messages_queue[$message_id] = $message; } if ($process_messages) { fn_set_storage_data('hd_messages', serialize($messages_queue)); } } return $messages_queue; }
function fn_generate_gift_certificate_cart_id($gift_cert_data) { $_gc = array(); $_gc[] = TIME; if (!empty($gift_cert_data)) { foreach ((array) $gift_cert_data as $k => $v) { if ($k == 'products') { if (!empty($v)) { foreach ($v as $product_item) { $_gc[] = $product_item['product_id']; $_gc[] = $product_item['amount']; if (isset($product_item['product_options'])) { $_gc[] = serialize($product_item['product_options']); } } } } elseif ($k == 'extra' && !empty($v)) { if (!empty($v)) { foreach ($v as $field => $data) { $_gc[] = $field; $_gc[] = is_array($data) ? serialize($data) : $data; } } } else { $_gc[] = $v; } } } return fn_crc32(implode('_', $_gc)); }
function content_55db8f5815d397_15312311($_smarty_tpl) { if (!is_callable('smarty_block_hook')) { include '/var/www/html/market/app/functions/smarty_plugins/block.hook.php'; } fn_preload_lang_vars(array('saved_search', 'all', 'more', 'more', 'delete', 'new_saved_search')); $_smarty_tpl->tpl_vars["views"] = new Smarty_variable(fn_get_views($_smarty_tpl->tpl_vars['view_type']->value), null, 0); ?> <?php $_smarty_tpl->tpl_vars["max_items"] = new Smarty_variable("4", null, 0); $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "advanced_search:views")); $_block_repeat = true; echo smarty_block_hook(array('name' => "advanced_search:views"), null, $_smarty_tpl, $_block_repeat); while ($_block_repeat) { ob_start(); ?> <?php if ($_smarty_tpl->tpl_vars['views']->value) { ?> <div class="sidebar-row" id="views"> <h6><?php echo $_smarty_tpl->__("saved_search"); ?> </h6> <ul class="nav nav-list saved-search"> <?php if ($_smarty_tpl->tpl_vars['views']->value) { ?> <li <?php if (!$_smarty_tpl->tpl_vars['search']->value['view_id']) { ?> class="active"<?php } ?> > <a href="<?php echo htmlspecialchars(fn_url((string) $_smarty_tpl->tpl_vars['dispatch']->value . ".reset_view?" . (string) $_smarty_tpl->tpl_vars['view_suffix']->value), ENT_QUOTES, 'UTF-8'); ?> "><?php echo $_smarty_tpl->__("all"); ?> </a> </li> <?php $_smarty_tpl->tpl_vars['view'] = new Smarty_Variable(); $_smarty_tpl->tpl_vars['view']->_loop = false; $_from = $_smarty_tpl->tpl_vars['views']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); } $_smarty_tpl->tpl_vars['view']->total = $_smarty_tpl->_count($_from); $_smarty_tpl->tpl_vars['smarty']->value['foreach']['views']['total'] = $_smarty_tpl->tpl_vars['view']->total; $_smarty_tpl->tpl_vars['smarty']->value['foreach']['views']['index'] = -1; foreach ($_from as $_smarty_tpl->tpl_vars['view']->key => $_smarty_tpl->tpl_vars['view']->value) { $_smarty_tpl->tpl_vars['view']->_loop = true; $_smarty_tpl->tpl_vars['smarty']->value['foreach']['views']['index']++; ?> <?php if ($_smarty_tpl->getVariable('smarty')->value['foreach']['views']['index'] == $_smarty_tpl->tpl_vars['max_items']->value) { ?> <?php $_smarty_tpl->tpl_vars['s_id'] = new Smarty_variable(sprintf("saved_searches_%s", fn_crc32($_smarty_tpl->tpl_vars['dispatch']->value)), null, 0); ?> <li> <span class="more hand"> <a id="on_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['s_id']->value, ENT_QUOTES, 'UTF-8'); ?> " class="collapsed cm-combination cm-save-state <?php if ($_COOKIE[$_smarty_tpl->tpl_vars['s_id']->value]) { ?> hidden<?php } ?> "><?php echo $_smarty_tpl->__("more"); ?> <i class="exicon-collapse"></i></a> <a id="off_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['s_id']->value, ENT_QUOTES, 'UTF-8'); ?> " class="cm-combination cm-save-state <?php if (!$_COOKIE[$_smarty_tpl->tpl_vars['s_id']->value]) { ?> hidden<?php } ?> "><?php echo $_smarty_tpl->__("more"); ?> <i class="exicon-collapse"></i></a> </span> </li> <li id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['s_id']->value, ENT_QUOTES, 'UTF-8'); ?> " class="<?php if (!$_COOKIE[$_smarty_tpl->tpl_vars['s_id']->value]) { ?> hidden<?php } ?> "> <ul class="nav nav-list"> <?php } ?> <li <?php if ($_smarty_tpl->tpl_vars['view']->value['view_id'] == $_smarty_tpl->tpl_vars['search']->value['view_id']) { ?> class="active"<?php } ?> > <?php $_smarty_tpl->tpl_vars["return_current_url"] = new Smarty_variable(fn_query_remove($_smarty_tpl->tpl_vars['config']->value['current_url'], "view_id", "new_view"), null, 0); ?> <?php $_smarty_tpl->tpl_vars["redirect_current_url"] = new Smarty_variable(rawurlencode($_smarty_tpl->tpl_vars['config']->value['current_url']), null, 0); ?> <a href="<?php echo htmlspecialchars(fn_url((string) $_smarty_tpl->tpl_vars['dispatch']->value . ".delete_view?view_id=" . (string) $_smarty_tpl->tpl_vars['view']->value['view_id'] . "&redirect_url=" . (string) $_smarty_tpl->tpl_vars['redirect_current_url']->value), ENT_QUOTES, 'UTF-8'); ?> " class="cm-confirm cm-tooltip icon-trash" title="<?php echo $_smarty_tpl->__("delete"); ?> "></a> <a class="cm-view-name" data-ca-view-id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['view']->value['view_id'], ENT_QUOTES, 'UTF-8'); ?> " href="<?php echo htmlspecialchars(fn_url((string) $_smarty_tpl->tpl_vars['dispatch']->value . "?view_id=" . (string) $_smarty_tpl->tpl_vars['view']->value['view_id'] . "&" . (string) $_smarty_tpl->tpl_vars['view_suffix']->value), ENT_QUOTES, 'UTF-8'); ?> "><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['view']->value['name'], ENT_QUOTES, 'UTF-8'); ?> </a> </li> <?php } ?> <?php if ($_smarty_tpl->getVariable('smarty')->value['foreach']['views']['total'] > $_smarty_tpl->tpl_vars['max_items']->value) { ?> </ul> </li> <?php } ?> <?php } ?> <li class="last"> <?php echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_text' => __("new_saved_search"), 'but_role' => "text", 'but_meta' => "text-button cm-dialog-opener", 'but_target_id' => "adv_search"), 0); ?> </li> </ul> </div> <hr> <?php } $_block_content = ob_get_clean(); $_block_repeat = false; echo smarty_block_hook(array('name' => "advanced_search:views"), $_block_content, $_smarty_tpl, $_block_repeat); } array_pop($_smarty_tpl->smarty->_tag_stack); }
function fn_generate_element_hash($table_id, $element_id, $ids = '') { if (!empty($ids)) { natsort($ids); } else { $ids = array(); } array_unshift($ids, $table_id, $element_id); return fn_crc32(implode('_', $ids)); }
public function AddItems($products = array(), $template, $images_data) { $credentials = $this->credentials; $currency = CART_PRIMARY_CURRENCY; $company = fn_get_company_placement_info(0); $site = $template['site']; $items = ''; $i = 0; $item_hashes = array(); foreach ($products as $k => $product) { $i += 1; $shipping = $this->prepareShipping($product, $template); $price = fn_format_price($product['price']); $uuid = md5($product['product_id'] . Helpdesk::getStoreKey() . $product['ebay_template_id']); $payments = '<PaymentMethods>' . implode("</PaymentMethods>\n<PaymentMethods>", $template['payment_methods']) . '</PaymentMethods>'; if (in_array('PayPal', $template['payment_methods'])) { $payments .= "\n<PayPalEmailAddress>{$template['paypal_email']}</PayPalEmailAddress>"; } if ($product['override'] == "Y") { $title = substr(strip_tags($product['ebay_title']), 0, 80); $description = !empty($product['ebay_description']) ? $product['ebay_description'] : $product['full_description']; } else { $title = substr(strip_tags($product['product']), 0, 80); $description = $product['full_description']; } $hash_data = array('price' => $price, 'title' => $title, 'description' => $description); $picture_details = ''; if (!empty($product['main_pair']) && !empty($product['main_pair']['detailed']) && !empty($product['main_pair']['detailed']['http_image_path'])) { if ($images_data[md5($product['main_pair']['detailed']['http_image_path'])]) { $picture_details .= "<PictureURL>" . $images_data[md5($product['main_pair']['detailed']['http_image_path'])] . "</PictureURL>\n"; } else { $picture_details .= "<PictureURL>" . $product['main_pair']['detailed']['http_image_path'] . "</PictureURL>\n"; } } if ($product['image_pairs']) { foreach ($product['image_pairs'] as $image_pair) { if (!empty($image_pair['detailed']) && !empty($image_pair['detailed']['http_image_path'])) { if ($images_data[md5($image_pair['detailed']['http_image_path'])]) { $picture_details .= "<PictureURL>" . $images_data[md5($image_pair['detailed']['http_image_path'])] . "</PictureURL>\n"; } } } } $picture_details = empty($picture_details) ? '' : "<PictureDetails>\n{$picture_details}</PictureDetails>"; $product_features = ''; if (!empty($product['product_features'])) { $hash_data['product_features'] = serialize($product['product_features']); $product_features = '<ItemSpecifics>' . fn_prepare_xml_product_features($product['product_features']) . '</ItemSpecifics>'; } $product_options = ''; $inventory_combinations = db_get_array("SELECT combination FROM ?:product_options_inventory WHERE product_id = ?i AND amount > 0 AND combination != ''", $product['product_id']); if (!empty($product['product_options']) && !empty($inventory_combinations)) { $params = array('page' => 1, 'product_id' => $product['product_id']); $product_options = '<Variations>' . fn_prepare_xml_product_options($params, $product, $images_data) . '</Variations>'; } if (empty($product_options)) { $start_price = <<<EOT <StartPrice currencyID="{$currency}">{$price}</StartPrice> EOT; $product_quantity = <<<EOT <Quantity>{$product['amount']}</Quantity> EOT; } else { $start_price = ''; $product_quantity = ''; } $product_out_of_weight = array(); if ($product['weight'] == 0) { $product_out_of_weight[] = $product['product_id']; } $location = fn_get_country_name($company['company_country']); $items .= <<<EOT <AddItemRequestContainer> <MessageID>{$i}</MessageID> <Item> <UUID>{$uuid}</UUID> <Site>{$site}</Site> <ListingType>FixedPriceItem</ListingType> <Currency>{$currency}</Currency> <PrimaryCategory> <CategoryID>{$template['category']}</CategoryID> </PrimaryCategory> <SecondaryCategory> <CategoryID>{$template['sec_category']}</CategoryID> </SecondaryCategory> <ConditionID>{$template['condition_id']}</ConditionID> <CategoryMappingAllowed>true</CategoryMappingAllowed> <Country>{$company['company_country']}</Country> <PostalCode>{$company['company_zipcode']}</PostalCode> <Location>{$location}</Location> <Title><![CDATA[{$title}]]></Title> <Description><![CDATA[{$description}]]></Description> {$payments} <ListingDuration>{$template['ebay_duration']}</ListingDuration> <DispatchTimeMax>{$template['dispatch_days']}</DispatchTimeMax> {$shipping} {$picture_details} {$product_features} {$product_options} {$start_price} {$product_quantity} </Item> </AddItemRequestContainer> EOT; $item_hashes[$k] = fn_crc32(implode('_', $hash_data)); } $xml = <<<EOT <?xml version="1.0" encoding="utf-8"?> <AddItemsRequest xmlns="urn:ebay:apis:eBLBaseComponents"> {$credentials} <MessageID>1</MessageID> {$items} </AddItemsRequest> EOT; list($trans_id, $result) = $this->_request($xml, 'AddItems'); $_result = array(); if ($result->Ack != 'Failure') { if ($result->AddItemResponseContainer) { $count = 0; foreach ($result->AddItemResponseContainer as $k => $item) { if (!empty($item->Errors)) { $this->_errors($item, $trans_id, 'AddItems'); } $_result[$count] = (array) $item; $_result[$count]['product_hash'] = $item_hashes[$count]; $count++; } } } if (!empty($product_out_of_weight) && $template['shipping_type'] == 'C') { fn_set_notification('W', __('warning'), __('product_out_of_weight', array("[ids]" => implode(",", $product_out_of_weight)))); } return array($trans_id, $_result); }
function fn_generate_cart_id($product_id, $extra, $only_selectable = false) { $_cid = array(); if (!empty($extra['product_options']) && is_array($extra['product_options'])) { // Try to select all options (including Globals) Registry::set('runtime.skip_sharing_selection', true); foreach ($extra['product_options'] as $k => $v) { if ($only_selectable == true && ((string) intval($v) != $v || db_get_field("SELECT inventory FROM ?:product_options WHERE option_id = ?i", $k) != 'Y')) { continue; } $_cid[] = $v; } Registry::set('runtime.skip_sharing_selection', false); } if (isset($extra['exclude_from_calculate'])) { $_cid[] = $extra['exclude_from_calculate']; } fn_set_hook('generate_cart_id', $_cid, $extra, $only_selectable); natsort($_cid); array_unshift($_cid, $product_id); $cart_id = fn_crc32(implode('_', $_cid)); return $cart_id; }
$items_schema = $schema[CONTROLLER . '.' . MODE]; if (empty($items_schema['func'])) { $c_elm = ''; } else { $c_elm = $items_schema['func']; foreach ($c_elm as $k => $v) { if (strpos($v, '@') !== false) { $ind = str_replace('@', '', $v); if (!empty($auth[$ind]) || !empty($_REQUEST[$ind])) { $c_elm[$k] = $ind == 'user_id' && empty($_REQUEST[$ind]) ? $auth[$ind] : $_REQUEST[$ind]; } } } } $last_item = array('func' => $c_elm, 'url' => Registry::get('config.current_url'), 'icon' => empty($items_schema['icon']) ? '' : $items_schema['icon'], 'text' => empty($items_schema['text']) ? '' : $items_schema['text']); $hash = fn_crc32(!empty($c_elm) ? implode('', $c_elm) : $items_schema['text']); if (!isset($last_edited_items[$hash])) { $last_edited_items[$hash] = $last_item; } if (count($last_edited_items) > $last_items_cnt) { foreach ($last_edited_items as $k => $v) { unset($last_edited_items[$k]); break; } } $_SESSION['last_edited_items'] = $last_edited_items; fn_save_user_additional_data('L', $last_edited_items); } function fn_sort_menu($menu) { foreach ($menu as $root => $data) {
if (Registry::get('settings.General.store_mode') == 'Y') { $sess_data['store_access_key'] = Registry::get('settings.General.store_access_key'); } $areas = array('A' => 'admin', 'V' => 'vendor', 'C' => 'customer'); fn_init_user_session_data($sess_data, $_REQUEST['user_id'], true); $old_sess_id = Session::getId(); $redirect_url = !empty($_REQUEST['redirect_url']) ? $_REQUEST['redirect_url'] : ''; if ($area != 'C') { Session::setName($areas[$area]); $sess_id = Session::regenerateId(); Session::save($sess_id, $sess_data, $area); Session::setName(ACCOUNT_TYPE); Session::setId($old_sess_id, false); } else { // Save unique key for session $key = fn_crc32(microtime()) . fn_crc32(microtime() + 1); fn_set_storage_data('session_' . $key . '_data', serialize($sess_data)); if (fn_allowed_for('ULTIMATE')) { $company_id_in_url = fn_get_company_id_from_uri($redirect_url); if (Registry::get('runtime.company_id') || !empty($user_data['company_id']) || Registry::get('runtime.simple_ultimate') || !empty($company_id_in_url)) { // Redirect to the personal frontend $company_id = !empty($user_data['company_id']) ? $user_data['company_id'] : Registry::get('runtime.company_id'); if (!$company_id && Registry::get('runtime.simple_ultimate')) { $company_id = fn_get_default_company_id(); } elseif (!$company_id) { $company_id = $company_id_in_url; } $url = $area == 'C' ? fn_link_attach($redirect_url, 'skey=' . $key . '&company_id=' . $company_id) : $redirect_url; return array(CONTROLLER_STATUS_REDIRECT, fn_url($url, $area), true); } } else {
function fn_watermarks_generate_thumbnail_post(&$relative_path, &$lazy) { static $init_cache = false; $image_path_info = fn_pathinfo($relative_path); $image_name = $image_path_info['filename']; $key = 'wt_data_' . fn_crc32($image_name); $condition = array('images', 'images_links'); if (fn_allowed_for('ULTIMATE')) { $condition[] = 'products'; $condition[] = 'categories'; } $cache_name = 'watermarks_cache_static'; if (!$init_cache) { Registry::registerCache($cache_name, $condition, Registry::cacheLevel('static'), true); $init_cache = true; } $image_data = Registry::get($cache_name . '.' . $key); if (empty($image_data)) { $image_data = db_get_row("SELECT l.* FROM ?:images AS i, ?:images_links AS l WHERE (l.image_id = i.image_id OR detailed_id = i.image_id) AND image_path LIKE ?l", $image_name . '.%'); if (empty($image_data)) { return true; } if (fn_allowed_for('ULTIMATE')) { $image_data['company_id'] = fn_wt_get_image_company_id($image_data); } Registry::set($cache_name . '.' . $key, $image_data); } $company_id = null; if (fn_allowed_for('ULTIMATE')) { $company_id = Registry::get('runtime.company_id'); if ($company_id == null) { $company_id = $image_data['company_id']; } } if (!empty($image_data['object_type']) && fn_is_need_watermark($image_data['object_type'], $image_data['object_type'] == 'detailed', $company_id)) { $prefix = WATERMARKS_DIR_NAME; if (fn_allowed_for('ULTIMATE') && !Registry::get('runtime.company_id')) { $prefix = WATERMARKS_DIR_NAME . $company_id . '/'; } if (!Storage::instance('images')->isExist($prefix . $relative_path)) { fn_watermark_create($relative_path, $prefix . $relative_path, false, $company_id); } $relative_path = $prefix . $relative_path; } return true; }
/** * Calculate hash * * @return string */ public function getHash() { $data = array('price' => $this->price, 'title' => $this->title, 'description' => $this->description); if (!empty($this->features)) { $data['product_features'] = serialize($this->features); } return fn_crc32(implode('_', $data)); }
function content_55ccecb5093f97_06209276($_smarty_tpl) { if (!is_callable('smarty_function_script')) { include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/function.script.php'; } fn_preload_lang_vars(array('object_exists', 'advanced_search', 'advanced_search', 'cancel', 'save_this_search_as', 'name', 'name', 'save', 'advanced_search_options')); echo smarty_function_script(array('src' => "js/tygh/advanced_search.js"), $_smarty_tpl); ?> <script type="text/javascript"> Tygh.tr('object_exists', '<?php echo strtr($_smarty_tpl->__("object_exists"), array("\\" => "\\\\", "'" => "\\'", "\"" => "\\\"", "\r" => "\\r", "\n" => "\\n", "</" => "<\\/")); ?> '); </script> <input type="hidden" name="is_search" value="Y" /> <?php $_smarty_tpl->tpl_vars["a_id"] = new Smarty_variable(sprintf("s_%s", fn_crc32($_smarty_tpl->tpl_vars['dispatch']->value)), null, 0); $_smarty_tpl->tpl_vars["views"] = new Smarty_variable(fn_get_views($_smarty_tpl->tpl_vars['view_type']->value), null, 0); ?> <?php if (!$_smarty_tpl->tpl_vars['in_popup']->value) { ?> <?php if ($_smarty_tpl->tpl_vars['simple_search']->value) { ?> <div id="simple_search_common"> <div id="simple_search"> <?php echo $_smarty_tpl->tpl_vars['simple_search']->value; ?> </div> </div> <?php } ?> <div class="sidebar-field"> <?php echo $_smarty_tpl->getSubTemplate("buttons/search.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_name' => "dispatch[" . (string) $_smarty_tpl->tpl_vars['dispatch']->value . "]"), 0); ?> <?php if (!$_smarty_tpl->tpl_vars['no_adv_link']->value) { ?> <a class="advanced-search cm-dialog-opener" id="adv_search_opener" data-ca-target-id="adv_search"><?php echo $_smarty_tpl->__("advanced_search"); ?> </a> <?php } ?> </div> <div id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['a_id']->value, ENT_QUOTES, 'UTF-8'); ?> "> <div class="hidden adv-search" id="adv_search" title="<?php echo $_smarty_tpl->__("advanced_search"); ?> "> <?php if ($_smarty_tpl->tpl_vars['simple_search']->value) { ?> <div class="group" id="simple_search_popup"></div> <?php } ?> <?php echo $_smarty_tpl->tpl_vars['advanced_search']->value; ?> <div class="modal-footer buttons-container"> <div class="pull-right"> <a class="cm-dialog-closer cm-cancel tool-link btn" data-dismiss="modal"><?php echo $_smarty_tpl->__("cancel"); ?> </a> <?php echo $_smarty_tpl->getSubTemplate("buttons/search.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_name' => "dispatch[" . (string) $_smarty_tpl->tpl_vars['dispatch']->value . "]", 'but_role' => "submit", 'method' => "GET"), 0); ?> </div> <?php if (!$_smarty_tpl->tpl_vars['not_saved']->value) { ?> <div class="pull-left"> <?php if (strpos($_REQUEST['dispatch'], ".picker") === false) { ?> <span class="pull-left"><?php echo $_smarty_tpl->__("save_this_search_as"); ?> </span> <div class="input-append"> <input type="text" id="view_name" name="new_view" value="<?php if ($_smarty_tpl->tpl_vars['search']->value['view_id'] && $_smarty_tpl->tpl_vars['views']->value[$_smarty_tpl->tpl_vars['search']->value['view_id']]) { echo htmlspecialchars($_smarty_tpl->tpl_vars['views']->value[$_smarty_tpl->tpl_vars['search']->value['view_id']]['name'], ENT_QUOTES, 'UTF-8'); } else { echo $_smarty_tpl->__("name"); } ?> " title="<?php echo $_smarty_tpl->__("name"); ?> " class="input-medium cm-hint" /> <?php echo $_smarty_tpl->getSubTemplate("buttons/button.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_text' => __("save"), 'but_id' => "adv_search_save", 'but_role' => "advanced-search"), 0); ?> </div> <?php } ?> </div> <?php } ?> </div> </div> </div> <?php } else { ?> <?php echo $_smarty_tpl->tpl_vars['simple_search']->value; ?> <div class="sidebar-field in-popup"> <?php echo $_smarty_tpl->getSubTemplate("buttons/search.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('but_name' => "dispatch[" . (string) $_smarty_tpl->tpl_vars['dispatch']->value . "]"), 0); ?> <?php if (trim($_smarty_tpl->tpl_vars['advanced_search']->value) != '') { ?> <a id="sw_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['a_id']->value, ENT_QUOTES, 'UTF-8'); ?> " class="cm-combination cm-save-state" title="<?php echo $_smarty_tpl->__("advanced_search_options"); ?> "> <i id="on_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['a_id']->value, ENT_QUOTES, 'UTF-8'); ?> " class="icon-chevron-down cm-combination cm-save-state <?php if ($_COOKIE[$_smarty_tpl->tpl_vars['a_id']->value]) { ?> hidden<?php } ?> "></i> <i id="off_<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['a_id']->value, ENT_QUOTES, 'UTF-8'); ?> " class="icon-chevron-up cm-combination cm-save-state <?php if (!$_COOKIE[$_smarty_tpl->tpl_vars['a_id']->value]) { ?> hidden<?php } ?> "></i> </a> <?php } ?> </div> <div id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['a_id']->value, ENT_QUOTES, 'UTF-8'); ?> " class="search-advanced <?php if (!$_COOKIE[$_smarty_tpl->tpl_vars['a_id']->value]) { ?> hidden<?php } ?> "> <?php echo $_smarty_tpl->tpl_vars['advanced_search']->value; ?> </div> <?php } }
function fn_ebay_update_product_post($product_data, $product_id, $lang_code, $create) { if (empty($product_id)) { return false; } $auth = $_SESSION['auth']; $product_data = fn_get_product_data($product_id, $auth, CART_LANGUAGE); fn_gather_additional_product_data($product_data, true, true); if ($product_data['override'] == "Y") { $title = substr(strip_tags($product_data['ebay_title']), 0, 80); $description = !empty($product_data['ebay_description']) ? $product_data['ebay_description'] : $product_data['full_description']; } else { $title = substr(strip_tags($product_data['product']), 0, 80); $description = $product_data['full_description']; } $hash_data = array('price' => fn_format_price($product_data['price']), 'title' => $title, 'description' => $description, 'product_features' => serialize($product_data['product_features'])); $product_hash = fn_crc32(implode('_', $hash_data)); db_query('UPDATE ?:products SET product_hash = ?s WHERE product_id = ?i', $product_hash, $product_id); return true; }
/** * Generate unique ID to cache rates calculation results * * @param mixed parameters to generate unique ID from * @return mixed array with rates if calculated, false otherwise */ function fn_generate_cached_rate_id() { $data = array(); $num_args = func_num_args(); for ($i = 0; $i < $num_args; $i++) { $variable = func_get_arg($i); if (is_array($variable)) { $data = fn_array_merge($data, $variable, false); } else { $data[] = $variable; } } natsort($data); return fn_crc32(implode('_', $data)); }
function fn_statistics_track_robots($tpl_output, &$view) { if (strpos($tpl_output, '<title>') === false) { return $tpl_output; } $sess_id = db_get_field('SELECT sess_id FROM ?:stat_sessions WHERE uniq_code = ?i AND timestamp > ?i', fn_crc32($_SERVER['HTTP_USER_AGENT']), TIME - 24 * 60 * 60); if (empty($sess_id)) { $ip = fn_get_ip(true); $referer = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; $parse_url = parse_url($referer); $stat_data = array('user_agent' => $_SERVER['HTTP_USER_AGENT'], 'host_ip' => $ip['host'], 'proxy_ip' => $ip['proxy'], 'client_language' => $_SERVER['HTTP_ACCEPT_LANGUAGE'], 'ip_id' => fn_stat_ip_exist($ip), 'client_type' => 'B', 'robot' => CRAWLER, 'referrer' => $referer, 'timestamp' => TIME, 'referrer_scheme' => empty($parse_url['scheme']) ? '' : $parse_url['scheme'], 'referrer_host' => empty($parse_url['host']) ? '' : $parse_url['host'], 'expiry' => 0, 'uniq_code' => fn_crc32($_SERVER['HTTP_USER_AGENT'])); $request_type = STAT_LAST_REQUEST; $sess_id = db_query('INSERT INTO ?:stat_sessions ?e', $stat_data); $last_url = ''; } else { $last_url = db_get_field("SELECT url FROM ?:stat_requests WHERE sess_id = ?i AND (request_type & ?i) = ?i", $sess_id, STAT_LAST_REQUEST, STAT_LAST_REQUEST); db_query("UPDATE ?:stat_requests SET request_type = request_type & " . STAT_ORDINARY_REQUEST . " WHERE sess_id = ?s", $sess_id); $request_type = STAT_END_REQUEST; } // Add to stat requests $this_url = fn_stat_prepare_url(REAL_URL); if ($last_url != $this_url) { $title = ''; if (preg_match_all('/\\<title\\>(.*?)\\<\\/title\\>/', $tpl_output, $m)) { $title = fn_html_escape($m[1][0], true); } $ve = array('sess_id' => $sess_id, 'timestamp' => TIME, 'url' => $this_url, 'title' => $title, 'https' => defined('HTTPS') ? 'Y' : 'N', 'loadtime' => microtime(true) - MICROTIME, 'request_type' => $request_type); db_query("INSERT INTO ?:stat_requests ?e", $ve); } return $tpl_output; }