function cw_fbauth_user_login($user) { global $tables, $current_area; cw_load('crypt', 'user', 'mail'); $user_data = cw_query_first("SELECT customer_id, email, password\n\t\t\t\t\t\t\t\t\tFROM {$tables['customers']} \n\t\t\t\t\t\t\t\t\tWHERE oauth_uid='" . $user['id'] . "' AND oauth_type='F' \n\t\t\t\t\t\t\t\t\t\tAND usertype='" . $current_area . "' \n\t\t\t\t\t\t\t\t\t\tAND status='Y'"); if (!empty($user_data)) { // login user global $email, $password, $action; $email = $user_data['email']; $password = text_decrypt($user_data['password']); $action = 'login'; cw_include('include/login.php'); } else { // create user $register = array(); $register['email'] = $user['email']; if (strpos($user['email'], "proxymail.facebook.com") !== FALSE) { cw_header_location("index.php?target=fb_auth_get_email", TRUE); } $register['password'] = $register['password2'] = md5(uniqid('cw_', TRUE), TRUE); $register['usertype'] = $current_area; $partner_membership =& cw_session_register('partner_membership'); $register['membership_id'] = $partner_membership; $customer_id = cw_user_create_profile($register); $identifiers =& cw_session_register('identifiers', array()); $identifiers[$current_area] = array('customer_id' => $customer_id); $customer = array('oauth_uid' => $user['id']); cw_array2update('customers', $customer, "customer_id='{$customer_id}'"); $address = array('main' => 1, 'firstname' => $user['first_name'], 'lastname' => $user['last_name']); $additional_info = array('sex' => $user['gender'] == 'male' ? 1 : 0); $userinfo = array('addresses' => $address, 'additional_info' => $additional_info); cw_user_update($userinfo, $customer_id, $customer_id); cw_user_send_modification_mail($customer_id, TRUE); } }
function cw_google_base_cron() { global $domain_id; cw_include('addons/google_base/gb_attributes_map.php'); $log = array(); $domains = cw_func_call('cw_md_get_domains'); foreach ($domains as $domain) { $domain_id = $domain['domain_id']; $count = cw_include('addons/google_base/create_gb_xml.php'); $log[] = $count . ' records were exported to feed'; } return join("\n", $log); }
function cw_checkout_login_prepare() { global $smarty, $user_account, $customer_id, $user_address; $customer_id =& cw_session_register('customer_id', 0); $fields_area = cw_profile_fields_get_area($customer_id, $salesman_membership, 1); list($profile_sections, $profile_fields, $additional_fields) = cw_profile_fields_get_sections('U', true, $fields_area); # kornev, the login information is not required here. if ($customer_id) { unset($profile_sections['web']); } $smarty->assign('profile_fields', $profile_fields); $smarty->assign('profile_sections', $profile_sections); cw_include('include/check_userdata.php'); cw_include('include/check_usercart.php'); $userinfo = cw_call('cw_checkout_userinfo', array($user_account)); $smarty->assign('userinfo', $userinfo); $smarty->assign('user_account', $user_account); }
function cw_googleplus_on_logout() { $googleplus_login_info =& cw_session_register('googleplus_login_info'); unset($googleplus_login_info['token']); $google_client_id = '376787991969-2c127o3n2vollhqfla26q1mfu1qi7n8s.apps.googleusercontent.com'; $google_client_secret = '25mdbO_DAlPE_aST_hErSzDN'; $google_redirect_url = 'http://dev.cartworks.com/product_stages/index.php'; //path to your script $google_developer_key = 'AIzaSyAOCvjaVfFFiL4OnlI8du8pHHNZGPsY3iU'; cw_include('addons/googleplus_login/include/src/Google_Client.php'); cw_include('addons/googleplus_login/include/src/contrib/Google_Oauth2Service.php'); $gClient = new Google_Client(); $gClient->setApplicationName('Test Google+ Login CW'); $gClient->setClientId($google_client_id); $gClient->setClientSecret($google_client_secret); $gClient->setRedirectUri($google_redirect_url); $gClient->setDeveloperKey($google_developer_key); $gClient->revokeToken(); }
<?php /* * Vendor: cw * addon: twitter_login */ /* * init.php * this file only defines constants, variables, functinos, hooks and event hanlers * no real routine must be here on init stage */ // Use namespace for your own addon as vendor\addon_name //namespace cw\twitter_login; // Constants definition // these constants are defined in scope of addon's namespace //const addon_name = 'twitter_login'; // Include functions cw_include('addons/twitter_login/include/func.php'); if (APP_AREA == 'customer') { cw_set_controller('include/check_useraccount.php', 'addons/twitter_login/post_init.php', EVENT_POST); cw_set_controller(APP_AREA . '/twitter_login_verified.php', 'addons/twitter_login/customer/twitter_login_verified.php', EVENT_REPLACE); cw_event_listen('on_logout', 'cw_twitter_on_logout'); cw_addons_set_template(array('post', 'buttons/social_media_panel.tpl', 'addons/twitter_login/customer/auth-button.tpl')); }
$product_list_template = 2; } $identifiers[$current_area == 'R' ? 'C' : $current_area] = array('customer_id' => $user_data['customer_id']); $customer_id = $user_data['customer_id']; if (in_array($current_area, array("C", "R"))) { cw_session_register("login_redirect"); $login_redirect = 1; } // Update addresses in session from database $user_address =& cw_session_register('user_address', array()); $user_address['current_address'] = cw_user_get_address($customer_id, 'current'); $user_address['main_address'] = cw_user_get_address($customer_id, 'main'); db_query("update {$tables['customers_system_info']} set last_login='******' where customer_id='{$customer_id}'"); $current_language = $user_data['language']; $items_per_page_targets = cw_core_restore_navigation($customer_id); cw_include('init/lng.php'); $cart =& cw_session_register('cart', array()); if ($current_area == "C" && cw_is_cart_empty($cart)) { $cart = cw_user_get_stored_cart($customer_id); } $userinfo = cw_user_get_info($customer_id); $products = cw_call('cw_products_in_cart', array($cart, $userinfo)); $cart = cw_func_call('cw_cart_calc', array('cart' => $cart, 'products' => $products, 'userinfo' => $userinfo)); cw_event('on_login', array($customer_id, $current_area, 0)); if (!empty($instagram_login_info['return_url'])) { cw_header_location($instagram_login_info['return_url']); } else { cw_header_location($instagram_redirect_url); } } } else {
<?php if ($mode == 'add' || !empty($contentsection_id)) { cw_include('addons/cms/cs_banner.php'); } else { cw_include('addons/cms/cs_banners.php'); }
} $disabled = cw_query_column("select addon from {$tables['addons']} where active = 0"); db_query("update {$tables['addons']} set active=0 where parent in ('" . implode("', '", $disabled) . "')"); cw_header_location("index.php?target={$target}&mode=addons"); } if ($action == 'ajax_update') { db_query("update {$tables['addons']} set active=abs(active-1) where addon='{$addon}' and status>'" . constant('ADDON_TYPE_CORE') . "'"); $active = cw_query_first_cell("select active from {$tables['addons']} where addon='{$addon}'"); cw_add_ajax_block(array('id' => 'script', 'content' => '$("#' . $addon . '").removeClass("on").removeClass("off").addClass("' . ($active == 1 ? 'on' : 'off') . '");')); cw_add_ajax_block(array('id' => 'script', 'content' => '$("[parent=' . $addon . ']").parent().removeClass("addon_locked")' . ($active == 1 ? '' : '.addClass("addon_locked")') . ';')); } $addon = $_GET['addon']; if (!empty($addon) && $mode == 'addons') { # kornev, TOFIX generally this should be removed if (is_file($app_main_dir . '/addons/' . $addon . '/admin/settings.php')) { cw_include('addons/' . $addon . '/admin/settings.php'); } if ($REQUEST_METHOD == 'POST') { cw_header_location("index.php?target={$target}&mode=addons&addon={$addon}"); } $smarty->assign('addon', $addon); $smarty->assign('addon_name', cw_get_langvar_by_name('addon_name_' . $addon)); $location[] = array(cw_get_langvar_by_name('lbl_addons'), 'index.php?target=' . $target); $location[] = array($addon, ''); $smarty->assign('main', 'addon_settings'); } elseif (empty($addon)) { $addons = cw_addons_get(); if (!isset($status) || empty($status)) { $status = constant('ADDON_TYPE_GENERAL'); } foreach ($addons as $k => $v) {
<?php cw_include('addons/paypal_express/include/func.paypal_express.php'); cw_addons_set_template(array('post', 'customer/cart/buttons.tpl', 'addons/paypal_express/customer/buttons.tpl')); cw_addons_set_controllers(array('replace', 'customer/paypal_express.php', 'addons/paypal_express/customer/paypal_express.php')); cw_addons_set_hooks(array('post', 'cw_payment_search', 'cw_paypal_express_payment_search'), array('pre', 'cw_payment_get_label', 'cw_paypal_express_payment_get_label'));
<?php cw_include('addons/paypal/include/func.paypal.php'); cw_addons_set_controllers(array('replace', 'customer/paypal.php', 'addons/paypal/customer/paypal.php')); cw_addons_set_template(array('post', 'main/docs/notes.tpl@doc_process_other', 'addons/paypal/admin/doc_process_data.tpl')); cw_addons_set_hooks(array('post', 'cw_payment_get_methods', 'cw_payment_paypal_get_methods'), array('post', 'cw_payment_run_processor', 'cw_payment_paypal_run_processor'));
<?php cw_include('addons/shipping_fedex/include/func.fedex.php'); /* cw_addons_set_template( array('pre', 'admin/configuration/addon_settings.tpl', 'addons/shipping_fedex/admin/configuration/addon_settings.tpl') ); */ cw_addons_set_hooks(array('post', 'cw_shipping_get_rates', 'cw_fedex_shipping_get_rates'));
<?php /* * Vendor: CW * addon: ebay */ namespace CW\ebay; const addon_name = 'ebay'; const addon_target = 'ebay_export'; const addon_version = '0.1'; const addon_files_location_path = 'files/ebay/'; const addon_conditions_data_file_name = 'ConditionIDs_by_Category.csv'; if (APP_AREA == 'admin' && $target == addon_target && !empty($addons[addon_name])) { $ebay_config = array('ebay_action' => 'Add', 'ebay_category' => 1, 'ebay_condition_id' => 1000, 'ebay_duration' => 1, 'ebay_format' => 'Auction (default)', 'ebay_immediate_pay_required' => 0, 'ebay_location' => '', 'ebay_paypal_accepted' => 0, 'ebay_paypal_email_address' => '', 'ebay_dispatch_time_max' => 1, 'ebay_returns_accepted_option' => 'ReturnsAccepted'); cw_addons_set_controllers(array('replace', 'admin/' . addon_target . '.php', 'addons/' . addon_name . '/' . addon_target . '.php')); cw_include('addons/' . addon_name . '/func.php'); cw_addons_set_template(array('replace', 'admin/main/ebay_export.tpl', 'addons/ebay/ebay_export.tpl'), array('replace', 'admin/import_export/ebay_export.tpl', 'addons/ebay/ebay_export.tpl')); } if (APP_AREA == 'admin') { cw_set_controller('admin/ajax_ebay_category_select.php', 'addons/ebay/ebay_attributes_modify.php', EVENT_REPLACE); cw_addons_set_template(array('post', 'main/attributes/default_types.tpl', 'addons/ebay/types/ebay_category_selector.tpl')); cw_addons_add_js('jquery/dynatree-1.2.4/jquery.dynatree.min.js'); cw_addons_add_css('jquery/dynatree-1.2.4/ui.dynatree.css'); }
<?php global $self_modification; $self_modification = 1; cw_include('include/users/info.php');
<?php cw_include('addons/mailchimp_subscription/include/MCAPI.class.php'); cw_include('addons/mailchimp_subscription/include/func.mailchimp.php'); cw_set_controller('include/settings.php', 'addons/mailchimp_subscription/admin/settings.php', EVENT_PRE); cw_addons_set_hooks(array('pre', 'cw_payment_run_processor', 'cw_post_mailchimp_subscribe')); cw_addons_set_template(array('post', 'customer/checkout/notes.tpl', 'addons/mailchimp_subscription/mailchimp_subscription.tpl'));
case 'add_new_content_section': if ($action == 'update_content_section' && empty($contentsection_id)) { cw_header_location('index.php?target=cms&mode=add'); } if (!empty($content_section) && is_array($content_section)) { //$content_section = array_map('trim', $content_section); cw_core_process_date_fields($content_section, array(0 => array('start_date' => 0, 'end_date' => 1))); $content_section['orderby'] = intval($content_section['orderby']); $content_section['display_on_404'] = empty($content_section['display_on_404']) ? 'N' : 'Y'; $content_section['active'] = empty($content_section['active']) ? 'N' : 'Y'; $content_section['parse_smarty_tags'] = !empty($content_section['parse_smarty_tags']); $presaved_content_section = $content_section; /* * Validation */ cw_include('include/lib/formvalidator/formvalidator.php', INCLUDE_NO_GLOBALS); // Errors $validator = new FormValidator(); $validator->addValidation("service_code", "req", cw_get_langvar_by_name('msg_ab_err_servicecode_is_empty')); $validator->addValidation("service_code", "varname", cw_get_langvar_by_name('msg_ab_err_wrong_servicecode_format')); if (!$validator->ValidateForm($content_section)) { cw_add_top_message($validator->GetErrors(), 'E'); cw_header_location('index.php?target=cms&edit=Y&mode=' . ($action == 'add_new_content_section' ? 'add' : 'update&contentsection_id=' . $contentsection_id)); } // Warnings $validator = new FormValidator(); $validator->addValidation("name", "req", cw_get_langvar_by_name('msg_ab_warn_empty_contentsection_name')); if ($content_section['type'] == 'html' || $content_section['type'] == 'image') { $validator->addValidation("url", "req", cw_get_langvar_by_name('msg_ab_warn_empty_contentsection_url')); } // $validator->addValidation("url","url",'Invalid URL');
<?php cw_include('include/login.php');
<?php $tables['flexible_import_profiles'] = 'cw_flexible_import_profiles'; $tables['flexible_import_files'] = 'cw_flexible_import_files'; $var_dirs['flex_import_test'] = $app_dir . '/files/flex_import_test'; define("fi_files_path", "./files/flexible_import/"); global $csvxc_field_types; $csvxc_field_types = array('PRICE' => "decimal(12,2) NOT NULL DEFAULT '0.00'", 'PRICE_MODIFIER' => "decimal(12,2) NOT NULL DEFAULT '0.00'", 'DESCR' => "text NOT NULL DEFAULT ''", 'FULLDESCR' => "text NOT NULL DEFAULT ''", 'PRODUCTID' => "int(11) NOT NULL DEFAULT '0'", 'PRODUCTID_TO' => "int(11) NOT NULL DEFAULT '0'", 'OPTIONID' => "int(11) NOT NULL DEFAULT '0'", 'CLASSID' => "int(11) NOT NULL DEFAULT '0'", 'ADD_DATE' => "int(11) NOT NULL DEFAULT '0'", 'WEIGHT' => "decimal(12,2) NOT NULL DEFAULT '0.00'", 'LIST_PRICE' => "decimal(12,2) NOT NULL DEFAULT '0.00'", 'AVAIL' => "int(11) NOT NULL DEFAULT '0'", 'MIN_AMOUNT' => "int(11) NOT NULL DEFAULT '0'", 'LOW_AVAIL_LIMIT' => "int(11) NOT NULL DEFAULT '0'", 'default' => "varchar(255) NOT NULL DEFAULT ''"); global $tmp_load_tables; $tmp_load_tables = array('CATEGORIES' => array('CATEGORYID' => array('type' => 'int', 'key' => true), 'CATEGORY' => array('type' => 'text', 'key' => true), 'DESCR' => array('type' => 'longtext'), 'META_DESCR' => array('type' => 'longtext'), 'AVAIL' => array('type' => 'bool'), 'ORDERBY' => array('type' => 'int'), 'META_KEYWORDS' => array('type' => 'text'), 'ICON' => array('type' => 'text', 'file_path' => true)), 'PRODUCTS' => array('PRODUCTID' => array('type' => 'int', 'key' => true), 'PRODUCTCODE' => array('type' => 'text', 'key' => true), 'PRODUCT' => array('type' => 'text', 'key' => true), 'WEIGHT' => array('type' => 'text'), 'LIST_PRICE' => array('type' => 'text'), 'DESCR' => array('type' => 'longtext'), 'FULLDESCR' => array('type' => 'longtext'), 'KEYWORDS' => array('type' => 'text'), 'AVAIL' => array('type' => 'text'), 'RATING' => array('type' => 'text'), 'FORSALE' => array('type' => 'text'), 'SHIPPING_FREIGHT' => array('type' => 'text'), 'FREE_SHIPPING' => array('type' => 'text'), 'DISCOUNT_AVAIL' => array('type' => 'text'), 'MIN_AMOUNT' => array('type' => 'text'), 'DIM_X' => array('type' => 'text'), 'DIM_Y' => array('type' => 'text'), 'DIM_Z' => array('type' => 'text'), 'LOW_AVAIL_LIMIT' => array('type' => 'text'), 'FREE_TAX' => array('type' => 'text'), 'CATEGORYID' => array('type' => 'int', 'grouped_key' => array('CATEGORY')), 'CATEGORY' => array('type' => 'text', 'grouped_key' => array('CATEGORYID')), 'MEMBERSHIP' => array('type' => 'text', 'grouped_key' => array('MEMBERSHIPID')), 'PRICE' => array('type' => 'text'), 'THUMBNAIL' => array('type' => 'text'), 'IMAGE' => array('type' => 'text'), 'TAXES' => array('type' => 'text'), 'ADD_DATE' => array('type' => 'text'), 'MANUFACTURERID' => array('type' => 'int', 'grouped_key' => array('MANUFACTURER')), 'MANUFACTURER' => array('type' => 'text', 'grouped_key' => array('MANUFACTURERID')), 'MEMBERSHIPID' => array('type' => 'int', 'grouped_key' => array('MEMBERSHIP')), 'SUPPLIERID' => array('type' => 'text'), 'COST' => array('type' => 'text')), 'PRODUCTS_EXTRA_FIELD_VALUES' => array('PRODUCTID' => array('type' => 'int', 'key' => true), 'PRODUCTCODE' => array('type' => 'text', 'key' => true), 'PRODUCT' => array('type' => 'text', 'key' => true), 'dynamic_field_set' => array('query' => "select field from {$tables['attributes']} where item_type='P' and addon in ('', 'custom_saratogawine_magazines','custom_saratogawine_backorder','clean_urls')"))); if (APP_AREA == 'admin') { cw_include('addons/flexible_import/include/func.flexible_import.php'); cw_include('addons/flexible_import/include/func.import.csvxcart.php'); cw_include('addons/flexible_import/include/csv_def_arrays.php'); cw_set_controller('admin/import.php', 'addons/flexible_import/admin/flexible_import.php', EVENT_POST); cw_set_controller('admin/import.php', 'addons/flexible_import/admin/flexible_import_profile.php', EVENT_POST); cw_addons_set_template(array('replace', 'admin/import_export/flexible_import.tpl', 'addons/flexible_import/flexible_import.tpl'), array('replace', 'admin/import_export/flexible_import_profile.tpl', 'addons/flexible_import/add_modify_import_profile.tpl')); cw_addons_add_js('addons/flexible_import/flexible_import.js'); cw_addons_add_css('addons/flexible_import/flexible_import.css'); cw_set_hook('cw_error_check', 'cw_flexible_import_validate_import_file', EVENT_POST); }
<?php cw_include('addons/detailed_product_images/func.hooks.php'); cw_addons_set_controllers(array('pre', 'include/products/modify.php', 'addons/detailed_product_images/product_images_modify.php'), array('pre', 'include/products/modify.php', 'addons/detailed_product_images/product_images.php'), array('post', 'customer/product.php', 'addons/detailed_product_images/product_images.php')); cw_addons_set_template(array('replace', 'customer/products/thumbnail.tpl', 'addons/detailed_product_images/popup_image.tpl', 'images')); cw_addons_set_hooks(array('post', 'cw_tabs_js_abstract', 'cw_dpi_tabs_js_abstract')); cw_set_hook('cw_delete_product', 'cw_dpi_delete_product', EVENT_POST); if (APP_AREA == 'customer') { cw_addons_add_css('addons/detailed_product_images/css/dpi.css'); }
if (!$addons['Gift_Registry']) { cw_header_location('index.php'); } $access_status =& cw_session_register("access_status", array()); if ($mode == "preview") { $html_content = cw_query_first_cell("SELECT html_content FROM {$tables['giftreg_events']} WHERE event_id='{$eventid}'"); if (!empty($html_content)) { echo $html_content; } else { echo "<br /><br /><br /><br /><h3 align=\"center\">" . cw_get_langvar_by_name("lbl_no_html_content", false, false, true) . "</h3>"; } exit; } if (!empty($cc)) { # Confirm/Decline the participation by recipient # $cc - is a confirmation code passed via GET request cw_include('addons/Gift_Registry/giftreg_confirm.php'); } if (!empty($eventid)) { if (!empty($wlid)) { if (cw_query_first_cell("SELECT event_id FROM {$tables['wishlist']} WHERE wishlist_id='{$wild}'") == $eventid) { $wlid_eventid =& cw_session_register("wlid_eventid"); $wlid_eventid = $eventid; cw_session_save("wlid_eventid"); } } cw_include('addons/Gift_Registry/event_guestbook.php'); cw_include('addons/Gift_Registry/giftreg_display.php'); } else { cw_include('addons/Gift_Registry/giftreg_search.php'); }
<?php /* * Vendor: CW * addon: Authorize.net - SIM */ const authorize_sim_addon_name = 'payment_authorize_sim'; const authorize_sim_addon_target = 'authorize_sim'; cw_include('addons/' . authorize_sim_addon_name . '/include/anet_php_sdk/AuthorizeNet.php'); cw_include('addons/' . authorize_sim_addon_name . '/include/func.php'); cw_addons_set_controllers(array('replace', 'customer/' . authorize_sim_addon_target . '.php', 'addons/' . authorize_sim_addon_name . '/customer/' . authorize_sim_addon_target . '.php')); cw_addons_set_hooks(array('post', 'cw_payment_get_methods', 'cw_payment_authorize_sim_get_methods'), array('post', 'cw_payment_run_processor', 'cw_payment_authorize_sim_run_processor'));
<?php global $docs_type; $docs_type = 'O'; cw_load('doc'); if ($action == 'add') { $doc_id = cw_doc_create_empty($docs_type . '_'); // Create temporary doc_type until first POST request cw_header_location("index.php?target={$target}&doc_id={$doc_id}&mode=edit"); } elseif ($doc_id) { cw_include('include/orders/order.php'); } else { cw_include('include/orders/orders.php'); } $smarty->assign('page_acl', '__18');
$query_data['details'] = cw_crypt_text($details); } cw_doc_update_info($doc_data['doc_info_id'], $query_data); cw_doc_update_quotes($doc_id, $quote); cw_call('cw_doc_change_status', array($doc_id, $status)); $top_message['content'] = cw_get_langvar_by_name('txt_order_has_been_changed'); cw_header_location("index.php?target={$target}&mode=details&doc_id=" . $doc_id); } if (in_array($current_area, array('A', 'P')) && $action == "delete") { cw_call('cw_doc_delete', array($doc_id)); cw_header_location("index.php?target={$target}" . $query_string); } $smarty->assign('main', 'document'); $predefined_lng_variables[] = 'lbl_doc_info_' . $doc_data['type']; if ($mode == 'edit' && $current_area == 'A') { cw_include('include/orders/order_edit.php'); return; } else { $relations = cw_doc_get_relations($doc_id); $items_for_relations = cw_doc_get_relations_items($doc_id); $smarty->assign('relations', $relations); $smarty->assign('items_for_relations', $items_for_relations); $quotes = cw_doc_get_quotes($doc_id); $smarty->assign('quotes', $quotes); } if (in_array($current_area, array('A', 'P')) && $addons['stop_list'] && $action == "block_ip") { cw_add_ip_to_slist($order['extra']['ip']); $top_message['content'] = cw_get_langvar_by_name("msg_stoplist_ip_added"); $top_message['type'] = "I"; cw_header_location("index.php?target={$target}&mode=details&doc_id=" . $doc_id); }
<?php if (defined('IS_AJAX')) { cw_load('warehouse', 'image', 'product'); global $config, $products, $search_data, $use_search_conditions, $mode; $prod_resp = array(); $substring = $_GET['search']; $search_data['products']['ajax_search']['substring'] = $substring; $search_data['products']['ajax_search']['flat_search'] = 1; $search_data['products']['ajax_search']['sort_field'] = 'productcode'; $search_data['products']['ajax_search']['info_type'] = 0; $search_data['products']['ajax_search']['limit'] = $config['ajax_search']['as_suggested_products']; $mode = 'search'; $use_search_conditions = 'ajax_search'; cw_include('include/products/search.php'); if (count($products) == 0) { array_push($prod_resp, array('value' => '', 'label' => '<i>no suggestions</i>')); } else { foreach ($products as $product) { $substring = str_replace('/', '\\/', $substring); $substring = str_replace("\\'", "'", $substring); $label = preg_replace('/' . $substring . '/i', '<span class="search_match">$0</span>', $product['product']); if ($label == '') { $label = $product['product']; } array_push($prod_resp, array('value' => $product['product'], 'label' => $label)); if (count($prod_resp) >= $config['ajax_search']['as_suggested_products']) { break; } } }
$location[] = array(cw_get_langvar_by_name('lbl_user_type_' . $usertype), ''); $smarty->assign('main', 'modify'); } elseif ($user && ($mode == 'modify' || $action == 'update')) { cw_include('include/users/modify.php'); $location[] = array(cw_get_langvar_by_name('lbl_users_' . $usertype), 'index.php?target=' . $target); $location[] = array(cw_get_langvar_by_name('lbl_user_type_' . $usertype), ''); $smarty->assign('main', 'modify'); } elseif ($mode == 'process' || $mode == 'delete') { cw_include('include/users/process.php'); } elseif ($mode == 'contracts') { cw_include('include/users/contracts.php'); } elseif ($mode == 'activities') { cw_include('include/users/activities.php'); } elseif ($mode == 'addresses') { cw_include('include/users/addresses.php'); } elseif ($mode == 'contact_dates') { cw_include('include/users/contact_dates.php'); } elseif ($mode == 'contacts') { cw_include('include/users/contacts.php'); } elseif ($mode == 'purchased_products') { cw_include('include/users/purchased_products.php'); } elseif ($mode == 'docs') { cw_include('include/users/docs.php'); } elseif ($mode == 'photos') { cw_include('include/users/photos.php'); } else { cw_include('include/users/search.php'); $location[] = array(cw_get_langvar_by_name('lbl_users_' . $usertype), 'index.php?target=' . $target); $smarty->assign('main', 'search'); } $smarty->assign('mode', $mode);
$smarty->assign('allow_edit', false); $smarty->assign('main', 'friends'); } elseif ($mode == 'giftcert' || $mode == 'preview' || $mode == 'gc2cart' || $mode == 'modify_gc' || $action == 'delgc' || $action == "addgc2wl") { cw_include('addons/estore_gift/cert.php'); } elseif ($mode == 'gifts') { $access_status =& cw_session_register('access_status', array()); if (!empty($cc)) { cw_include("addons/estore_gift/giftreg_confirm.php"); } if (!empty($eventid)) { if (!empty($wlid)) { if (cw_query_first_cell("SELECT event_id FROM {$tables['wishlist']} WHERE wishlist_id='{$wild}'") == $eventid) { $wlid_eventid =& cw_session_register("wlid_eventid"); $wlid_eventid = $eventid; cw_session_save("wlid_eventid"); } } cw_include("addons/estore_gift/event_guestbook.php"); cw_include("addons/estore_gift/giftreg_display.php"); } else { cw_include("addons/estore_gift/giftreg_search.php"); } } elseif ($mode == 'events') { if (isset($_GET['event_id'])) { cw_include('addons/estore_gift/event.php'); } else { cw_include('addons/estore_gift/events.php'); } } else { cw_include('addons/estore_gift/wishlist.php'); }
function cw_ps_aom_recalculate_totals($order) { if (defined('AOM') && constant('AOM')) { global $cart; $cart = $order; $cart['info']['use_shipping_cost_alt'] = 'N'; cw_include('addons/promotion_suite/customer/cart_init.php'); } }
} if ($mode == 'wishlist') { $options = unserialize(cw_query_first_cell("SELECT options FROM {$tables['wishlist']} WHERE wishlist_id = '{$id}' AND event_id = '{$eventid}'")); } else { $options = $cart['products'][$cartindex]['options']; } if (!empty($options)) { foreach ($options as $k => $v) { $options[$k] = stripslashes($v); } } cw_load('product', 'warehouse', 'cart'); $product_info = cw_func_call('cw_product_get', array('id' => $product_id, 'user_account' => $user_account)); $smarty->assign('product', $product_info); //include $app_main_dir.'/addons/product_options/customer/product.php'; cw_include('addons/product_options/customer/product.php'); if ($REQUEST_METHOD == "POST" && $action == "update") { $poptions = $_POST['product_options']; if (!cw_check_product_options($product_id, $poptions)) { cw_header_location("index.php?target=popup_poptions&target={$target}&id={$id}&err=exception"); } if ($mode == 'wishlist') { db_query("UPDATE {$tables['wishlist']} SET options = '" . addslashes(serialize($poptions)) . "' WHERE wishlist_id = '{$id}' AND event_id = '{$eventid}'"); } else { $variant_id = cw_get_variant_id($product_options, $product_id); $amount = cw_warehouse_get_warehouse_avail($cart['products'][$cartindex]['warehouse'], $product_id, null, $variant_id); // $amount = cw_get_options_amount($poptions, $cart['products'][$cartindex]['product_id']); if ($amount >= $cart['products'][$cartindex]['amount']) { $cart['products'][$cartindex]['options'] = $poptions; cw_unset($cart['products'][$cartindex], 'variant_id'); } else {
<?php # [TOFIX] # kornev, fix the whole area - move to addon define('AREA_TYPE', 'B'); $current_area = AREA_TYPE; $customer_id =& cw_session_register('customer_id'); $top_message =& cw_session_register('top_message', array()); if (!empty($top_message)) { $smarty->assign('top_message', $top_message); $top_message = ''; } cw_include('init/lng.php'); cw_include('include/check_useraccount.php'); cw_include('include/area_sections.php'); $smarty->assign('current_target', $target); if (!$addons['salesman']) { cw_header_location($app_catalogs['customer']); } $location = array(); $location[] = array(cw_get_langvar_by_name('lbl_area_salesman'), 'index.php'); cw_call('cw_auth_security');
<?php cw_load('map'); if ($mode == 'cities' && $country) { cw_include('include/map/cities.php'); $smarty->assign('main', 'cities'); $location[] = array(cw_get_langvar_by_name('lbl_cities'), ''); } elseif ($mode == 'regions' && $country) { cw_include('include/map/regions.php'); $smarty->assign('main', 'regions'); $location[] = array(cw_get_langvar_by_name('lbl_regions'), ''); } elseif ($mode == 'states' && $country) { cw_include('include/map/states.php'); $smarty->assign('main', 'states'); $location[] = array(cw_get_langvar_by_name('lbl_states'), ''); } elseif ($mode == 'counties' && $country) { cw_include('include/map/counties.php'); $smarty->assign('main', 'counties'); $location[] = array(cw_get_langvar_by_name('lbl_counties'), ''); } else { cw_include('include/map/countries.php'); $smarty->assign('main', 'countries'); $location[] = array(cw_get_langvar_by_name('lbl_countries_management'), ''); }
cw_header_location("index.php?target={$target}&list_id=" . $list_id . "&js_tab=message&messageid=" . $message['news_id']); } else { $nwslt_object =& cw_session_register('nwslt_object'); $nwslt_object['fill_error'] = 'error'; $nwslt_object['message'] = $message; cw_header_location("index.php?target={$target}&list_id=" . $list_id . "&js_tab=add_message&messageid=" . $message['news_id']); } } elseif ($action == "send" || $action == "send_continue") { if (AREA_TYPE == 'B') { cw_load('mail'); $salesman_email = cw_query_first_cell("select email from {$tables['customers']} where customer_id='{$customer_id}'"); $smarty->assign('list_id', $list_id); cw_call('cw_send_mail', array($salesman_email, $config['Company']['site_administrator'], "mail/salesman_news_notification_subj.tpl", "mail/salesman_news_notification.tpl")); db_query("update {$tables['newsletter']} set status='A' where news_id='{$messageid}'"); } else { cw_include('include/news/send.php'); } $top_message['content'] = cw_get_langvar_by_name("msg_adm_news_message_sent"); } elseif ($action == "delete" && is_array($to_delete)) { foreach ($to_delete as $k => $v) { db_query("DELETE FROM {$tables['newsletter']} WHERE news_id='{$k}'"); } $top_message['content'] = cw_get_langvar_by_name("msg_adm_news_message_del"); } cw_header_location("index.php?target={$target}&js_tab=messages&list_id=" . $list_id); } if ($action == 'delete' && is_array($to_delete)) { foreach ($to_delete as $k => $v) { if (AREA_TYPE == 'B') { $is_list_count = cw_query_first_cell("select count(*) from {$tables['newslists']} where list_id='{$k}' {$salesman_condition}"); if (!$is_list_count) {