function fn_se_send_request($url_part, $private_key, $data) { if (empty($private_key)) { return; } $params = array('private_key' => $private_key) + $data; Registry::set('log_cut', true); $result = Http::post(SE_SERVICE_URL . $url_part, $params, array('timeout' => SE_REQUEST_TIMEOUT)); $response = fn_se_parse_response($result, false); fn_se_set_simple_setting('last_request', TIME); return $response; }
} } db_query("INSERT INTO ?:se_queue (`data`, `action`, `company_id`, `lang_code`) VALUES ('N;', 'pages_update', '{$company_id}', '{$lang_code}')"); db_query("INSERT INTO ?:se_queue (`data`, `action`, `company_id`, `lang_code`) VALUES ('N;', 'categories_update', '{$company_id}', '{$lang_code}')"); db_query("INSERT INTO ?:se_queue (`data`, `action`, `company_id`, `lang_code`) VALUES ('N;', 'end_full_import', '{$company_id}', '{$lang_code}')"); $status = true; } elseif ($q['action'] == 'start_full_import') { $status = fn_se_send_request('/api/state/update/json', $private_key, array('full_import' => 'start')); if ($status == true) { fn_se_set_import_status('processing', $company_id, $lang_code); } } elseif ($q['action'] == 'end_full_import') { $status = fn_se_send_request('/api/state/update/json', $private_key, array('full_import' => 'done')); if ($status == true) { fn_se_set_import_status('sent', $company_id, $lang_code); fn_se_set_simple_setting('last_resync', TIME); } } elseif ($q['action'] == 'categories_update') { $data = fn_se_get_categories_data($data, $company_id, $lang_code); if (!empty($data)) { $data = json_encode(array_merge($json_header, array('categories' => $data))); $status = fn_se_send_request('/api/items/update/json', $private_key, array('data' => $data)); } } elseif ($q['action'] == 'pages_update') { $data = fn_se_get_pages_data($data, $company_id, $lang_code); if (!empty($data)) { $data = json_encode(array_merge($json_header, array('pages' => $data))); $status = fn_se_send_request('/api/items/update/json', $private_key, array('data' => $data)); } } elseif ($q['action'] == 'facet_update') { list($filters, ) = fn_get_product_filters(array('filter_id' => $filter_ids, 'get_variants' => true), 0, $lang_code);
/*************************************************************************** * * * (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')) { die('Access denied'); } if ($mode == 'export') { fn_se_signup(fn_se_get_company_id(), NULL, true); fn_se_queue_import(fn_se_get_company_id(), NULL, true); return array(CONTROLLER_STATUS_OK, 'addons.update?addon=searchanise'); } elseif ($mode == 'options') { if (isset($_REQUEST['snize_use_navigation'])) { $is_navigation = $_REQUEST['snize_use_navigation'] == 'true' ? 'Y' : 'N'; fn_se_set_simple_setting('use_navigation', $is_navigation); } exit; } elseif ($mode == 'signup') { if (fn_se_signup() == true) { fn_se_queue_import(); } return array(CONTROLLER_STATUS_OK, 'addons.update?addon=searchanise'); }