Example #1
0
     if ($product['products_status'] == '1') {
         $smarty->assign('product_status_image', xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_status_green.gif', ICON_TITLE_STATUS_GREEN));
     } else {
         $smarty->assign('product_status_image', xos_image(DIR_WS_ADMIN_IMAGES . ADMIN_TPL . '/icon_status_red.gif', ICON_TITLE_STATUS_RED));
     }
     $smarty->assign(array('add_relating_products' => true, 'form_begin_add_relating_products' => xos_draw_form('runing_update', FILENAME_XSELL_PRODUCTS, xos_get_all_get_params()), 'hidden_field_run_update' => xos_draw_hidden_field('run_update', $_POST['run_update'] == true ? 'true' : 'false'), 'hidden_field_categories_or_pages_id' => xos_draw_hidden_field('categories_or_pages_id', $categories_or_pages_id), 'hidden_field_manufacturers_id' => xos_draw_hidden_field('manufacturers_id', $manufacturers_id), 'hidden_field_add_related_product_ID' => xos_draw_hidden_field('add_related_product_ID', $_GET['add_related_product_ID']), 'link_to_relating_products' => xos_href_link(FILENAME_XSELL_PRODUCTS, 'categories_or_pages_id=' . $categories_or_pages_id . '&manufacturers_id=' . $manufacturers_id . '&max_rows=' . $_GET['max_rows']), 'product_id' => $product['products_id'], 'product_name' => $product['products_name'], 'product_model' => $product['products_model'], 'product_image' => xos_info_image('products/small/' . $product_image['name'], $product['products_name'])));
 }
 //////////////////////////////////////////////////////////////////////////////////
 if ($_GET['sort'] == 1 && !$_GET['first_entrance']) {
     $product_query = xos_db_query("select a.products_id, a.products_status, b.products_name, a.products_model, a.products_image from " . TABLE_PRODUCTS . " a, " . TABLE_PRODUCTS_DESCRIPTION . " b where b.products_id = a.products_id and b.language_id = '" . (int) $_SESSION['used_lng_id'] . "' and a.products_id = '" . $_GET['add_related_product_ID'] . "'");
     $product = xos_db_fetch_array($product_query);
     $product_image = xos_get_product_images($product['products_image']);
     // first lets take care of the DB update.
     if ($_POST) {
         foreach ($_POST as $key_a => $value_a) {
             xos_db_connect();
             $query = "UPDATE " . TABLE_PRODUCTS_XSELL . " SET sort_order = '" . $value_a . "' WHERE products_id ='" . $product['products_id'] . "' and xsell_id= '{$key_a}' ";
             if ($value_a != 'Update') {
                 if (!xos_db_query($query)) {
                     exit('Could not UPDATE DB');
                 }
             }
         }
         $smarty_cache_control->clearCache(null, 'L3|cc_product_info');
     }
     $cross_query = xos_db_query("select xsell_id, sort_order from " . TABLE_PRODUCTS_XSELL . " WHERE products_id = '" . $_GET['add_related_product_ID'] . "' ORDER BY sort_order");
     $ordering_size = xos_db_num_rows($cross_query);
     $cross_products_array = array();
     while ($cross = xos_db_fetch_array($cross_query)) {
         $cross_products_query = xos_db_query("select a.products_id, a.products_status, b.products_name, a.products_model, a.products_image from " . TABLE_PRODUCTS . " a, " . TABLE_PRODUCTS_DESCRIPTION . " b where b.products_id = a.products_id and b.language_id = '" . (int) $_SESSION['used_lng_id'] . "' and a.products_id = " . $cross['xsell_id'] . "");
         $cross_products = xos_db_fetch_array($cross_products_query);
Example #2
0
// this file is based on:
//              osCommerce, Open Source E-Commerce Solutions
//              http://www.oscommerce.com
//              Copyright (c) 2003 osCommerce
//              filename: install_6.php
//
//              Released under the GNU General Public License
////////////////////////////////////////////////////////////////////////////////
$dir_fs_document_root = $_POST['DIR_FS_DOCUMENT_ROOT'];
$db = array();
$db['DB_SERVER'] = trim(stripslashes($_POST['DB_SERVER']));
$db['DB_SERVER_USERNAME'] = trim(stripslashes($_POST['DB_SERVER_USERNAME']));
$db['DB_SERVER_PASSWORD'] = trim(stripslashes($_POST['DB_SERVER_PASSWORD']));
$db['DB_DATABASE'] = trim(stripslashes($_POST['DB_DATABASE']));
$db_error = false;
xos_db_connect($db['DB_SERVER'], $db['DB_SERVER_USERNAME'], $db['DB_SERVER_PASSWORD']);
if ($db_error == false) {
    xos_db_test_connection($db['DB_DATABASE']);
}
if ($db_error != false) {
    reset($_POST);
    $hidden_fields = '';
    while (list($key, $value) = each($_POST)) {
        if ($key != 'x' && $key != 'y') {
            if (is_array($value)) {
                for ($i = 0; $i < sizeof($value); $i++) {
                    $hidden_fields .= xos_draw_hidden_field($key . '[]', $value[$i]);
                }
            } else {
                $hidden_fields .= xos_draw_hidden_field($key, $value);
            }
}
// define the project version
define('PROJECT_VERSION', 'XOS-Shop version 1.0.1');
// set the type of request (secure or not)
$request_type = isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on' || $_SERVER['HTTPS'] == '1') || isset($_SERVER['HTTP_X_FORWARDED_BY']) && strpos(strtoupper($_SERVER['HTTP_X_FORWARDED_BY']), 'SSL') !== false || isset($_SERVER['HTTP_X_FORWARDED_HOST']) && strpos(strtoupper($_SERVER['HTTP_X_FORWARDED_HOST']), 'SSL') !== false || isset($_SERVER['HTTP_X_FORWARDED_HTTPS']) && ($_SERVER['HTTP_X_FORWARDED_HTTPS'] == 'on' || strtolower($_SERVER['HTTP_X_FORWARDED_HTTPS']) == '1') || isset($_SERVER['HTTP_X_FORWARDED_SSL']) && ($_SERVER['HTTP_X_FORWARDED_SSL'] == 'on' || strtolower($_SERVER['HTTP_X_FORWARDED_SSL']) == '1') || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && (strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'ssl' || strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') || isset($_SERVER['HTTP_SSLSESSIONID']) && $_SERVER['HTTP_SSLSESSIONID'] != '' || isset($_SERVER['SCRIPT_URI']) && strtolower(substr($_SERVER['SCRIPT_URI'], 0, 6)) == 'https:' || isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443' ? 'SSL' : 'NONSSL';
// include the list of project filenames
require DIR_WS_INCLUDES . 'filenames.php';
// include the list of project database tables
require DIR_WS_INCLUDES . 'database_tables.php';
// include the database functions and make a connection to the database
if (class_exists('mysqli') && version_compare(PHP_VERSION, '5.3.0', '>=')) {
    require DIR_WS_FUNCTIONS . 'database_mysqli.php';
    xos_db_connect();
} else {
    require DIR_WS_FUNCTIONS . 'database_mysql.php';
    xos_db_connect() or die('Unable to connect to database server!');
}
// set the application parameters
$configuration_query = xos_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
while ($configuration = xos_db_fetch_array($configuration_query)) {
    if (($configuration['cfgKey'] == 'SESSION_FORCE_COOKIE_USE' || $configuration['cfgKey'] == 'SESSION_RECREATE') && $configuration['cfgValue'] == 'true' && ENABLE_SSL == 'true' && HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
        define($configuration['cfgKey'], 'false');
    } else {
        define($configuration['cfgKey'], $configuration['cfgValue']);
    }
}
// require the smarty class and create an instance
require DIR_FS_SMARTY . 'Smarty-3.1.27/Smarty.class.php';
$smarty = new Smarty();
$smarty->setTemplateDir(DIR_FS_SMARTY . 'catalog/templates/');
$smarty->setCompileDir(DIR_FS_SMARTY . 'catalog/templates_c/');