/** * Prepare all settings, wich should be passed to js */ function fn_twg_get_all_settings() { $settings = fn_twg_get_boot_settings(); $addon_settings = TwigmoSettings::get(); $settings['access_id'] = $addon_settings['access_id']; $settings['currency'] = Registry::get('currencies.' . CART_SECONDARY_CURRENCY); $settings['primaryCurrency'] = Registry::get('currencies.' . CART_PRIMARY_CURRENCY); $settings['url_for_facebook'] = isset($addon_settings['url_for_facebook']) ? fn_twg_get_external_info_url($addon_settings['url_for_facebook']) : ''; $settings['url_for_twitter'] = isset($addon_settings['url_for_twitter']) ? fn_twg_get_external_info_url($addon_settings['url_for_twitter']) : ''; $settings['lang'] = array_merge(fn_twg_get_default_customer_langvars(), Lang::getCustomerLangVars()); // Countries/states list($countries) = fn_get_countries(array('only_avail' => true)); $settings = array_merge($settings, Api::getAsList('countries', $countries)); $settings['states'] = fn_twg_get_states(); // Info pages $pages_location = $addon_settings['home_page_content'] == 'tw_home_page_blocks' ? 'twigmo.post' : 'index.index'; $pages = TwigmoBlock::getBlocksForLocation($pages_location, array('pages')); $settings['info_pages'] = array(); foreach ($pages as $page) { $settings['info_pages'] = array_merge($settings['info_pages'], $page['pages']['page']); } // If page link begin with # then interpret this link as twigmo page foreach ($settings['info_pages'] as $k => $page) { if (preg_match('/^\\#.*$/', $page['link'])) { $settings['info_pages'][$k]['twigmo_page'] = substr($page['link'], 1); } } // Only required profile fields $only_required = isset($addon_settings['only_req_profile_fields']) ? $addon_settings['only_req_profile_fields'] : 'N'; $settings['profileFields'] = fn_twg_prepare_profile_fields(fn_get_profile_fields(), $only_required); $settings['profileFieldsCheckout'] = fn_twg_prepare_profile_fields(fn_get_profile_fields('O'), $only_required); $settings['show_product_code'] = isset($addon_settings['show_product_code']) ? $addon_settings['show_product_code'] : 'N'; $settings['titles'] = array(); $settings['profile'] = fn_twg_get_user_info($_SESSION['auth']['user_id']); $settings['cart'] = fn_twg_api_get_session_cart($_SESSION['cart']); $settings['sortings'] = fn_twg_get_sortings(); $settings['security_hash'] = fn_generate_security_hash(); $settings['productType'] = PRODUCT_EDITION; $settings['languages'] = array_values(Lang::getLanguages()); $settings['cart_language'] = CART_LANGUAGE; $settings['cart_prices_w_taxes'] = Registry::get('settings.Appearance.cart_prices_w_taxes'); $settings['show_prices_taxed_clean'] = Registry::get('settings.Appearance.show_prices_taxed_clean'); $settings['no_image_path'] = Registry::get('config.no_image_path'); // Suppliers $settings['suppliers_vendor'] = Registry::get('settings.Suppliers.apply_for_vendor'); $settings['display_supplier'] = Registry::get('settings.Suppliers.display_supplier') === 'Y' || Registry::get('settings.Vendors.display_vendor') === 'Y'; $settings['display_supplier'] = $settings['display_supplier'] ? 'Y' : 'N'; // General section $fields = array('use_email_as_login', 'min_order_amount', 'min_order_amount_type', 'allow_negative_amount', 'inventory_tracking', 'allow_anonymous_shopping', 'tax_calculation'); foreach ($fields as $field) { $settings[$field] = Registry::get('settings.General.' . $field); } $settings = array_merge($settings, fn_twg_get_checkout_settings()); if (version_compare(PRODUCT_VERSION, '4.0.2', '>=')) { $anonymous_shopping_settings_map = array('allow_shopping' => 'Y', 'hide_price_and_add_to_cart' => 'P', 'hide_add_to_cart' => 'B'); $settings['allow_anonymous_shopping'] = $anonymous_shopping_settings_map[$settings['allow_anonymous_shopping']]; } $settings['default_location'] = array('country' => Registry::get('settings.General.default_country'), 'state' => Registry::get('settings.General.default_state')); $settings['show_modifiers'] = Registry::get('settings.General.display_options_modifiers'); $settings['SEOEnabled'] = Registry::get('addons.seo.status') == 'A'; $settings['GATrackEcommerce'] = Registry::get('addons.google_analytics.status') == 'A' && Registry::get('addons.google_analytics.track_ecommerce') == 'Y' && file_exists(Registry::get('config.dir.addons') . 'google_analytics/controllers/frontend/checkout.post.php'); if (fn_allowed_for('MULTIVENDOR')) { $settings['company_data'] = !empty($_SESSION['auth']['company_id']) ? fn_get_company_data($_SESSION['auth']['company_id']) : array(); } else { $settings['company_data'] = array(); } $settings['checkout'] = Registry::get('settings.Checkout'); fn_set_hook('twg_get_all_settings', $settings); $settings['lang'] = fn_twg_process_langvars($settings['lang']); return $settings; }
$response->addError('ERROR_OBJECT_WAS_NOT_FOUND', str_replace('[object]', $object, __('twgadmin_object_was_not_found'))); $response->returnResponse(); } $response->setData($product); $response->returnResponse('product'); } elseif ($object == 'users') { if (fn_allowed_for('ULTIMATE')) { $controller = 'profiles'; Registry::set('runtime.controller', 'profiles'); if (!fn_ult_check_store_permission(array('user_id' => $_REQUEST['id']), $controller)) { $notification = reset(fn_get_notifications()); $response->addError('ERROR_OBJECT_WAS_NOT_FOUND', $notification['message']); $response->returnResponse(); } } $user_data = fn_twg_get_user_info($_REQUEST['id']); $response->setData($user_data); $response->returnResponse(); } } } function fn_twg_get_logs($params = array()) { $items_per_page = TWG_RESPONSE_ITEMS_LIMIT; $page = empty($params['page']) ? 1 : $params['page']; $condition = db_quote(" WHERE type IN('users', 'products', 'orders') AND action != 'session'"); if (Registry::get('runtime.company_id')) { $condition .= db_quote(" AND ?:logs.company_id = ?i", Registry::get('runtime.company_id')); } $limit = ''; if (!empty($items_per_page)) {
$view = fn_twg_get_view_object(); $view->assign('order_info', $order_info); $mode = 'complete'; include_once Registry::get('config.dir.addons') . 'google_analytics/controllers/frontend/checkout.post.php'; foreach ($orders_info as &$order_info) { if (isset($order_info['products'])) { $order_info['items'] = array_values($order_info['products']); unset($order_info['products']); } } $response->setData($orders_info); $response->returnResponse(); } elseif ($meta['object'] == 'users') { $_auth =& $_SESSION['auth']; if (!empty($_auth['user_id'])) { $response->setData(fn_twg_get_user_info($_auth['user_id'])); } else { $response->addError('ERROR_ACCESS_DENIED', __('access_denied')); } } else { $response->addError('ERROR_UNKNOWN_REQUEST', __('unknown_request')); $response->returnResponse(); } if (!empty($object)) { $response->setData($object); } elseif (!empty($title)) { $response->addError('ERROR_OBJECT_WAS_NOT_FOUND', str_replace('[object]', $title, __('twgadmin_object_was_not_found'))); } } elseif ($meta['action'] == 'featured') { $items_qty = !empty($_REQUEST['items']) ? $_REQUEST['items'] : TWG_RESPONSE_ITEMS_LIMIT; $params = $_REQUEST;
Registry::get('view')->assign('order_info', $order_info); $mode = 'complete'; include_once Registry::get('config.dir.addons') . 'google_analytics/controllers/frontend/checkout.post.php'; foreach ($orders_info as &$order_info) { if (isset($order_info['products'])) { $order_info['items'] = array_values($order_info['products']); unset($order_info['products']); } } $response->setData($orders_info); $response->returnResponse(); } elseif ($meta['object'] == 'users') { $_auth =& $_SESSION['auth']; if (!empty($_auth['user_id'])) { $user_info_params = array('mode' => $mode, 'user_id' => $_auth['user_id']); $response->setData(fn_twg_get_user_info($user_info_params)); } else { $response->addError('ERROR_ACCESS_DENIED', __('access_denied')); } } else { $response->addError('ERROR_UNKNOWN_REQUEST', __('unknown_request')); $response->returnResponse(); } if (!empty($object)) { $response->setData($object); } elseif (!empty($title)) { $response->addError('ERROR_OBJECT_WAS_NOT_FOUND', str_replace('[object]', $title, __('twgadmin_object_was_not_found'))); } } elseif ($meta['action'] == 'featured') { $items_qty = !empty($_REQUEST['items']) ? $_REQUEST['items'] : TWG_RESPONSE_ITEMS_LIMIT; $params = $_REQUEST;