function affiliate_insert($sql_data_array, $affiliate_parent = 0)
{
    // LOCK TABLES
    //   olc_db_query("LOCK TABLES " . TABLE_AFFILIATE . " WRITE");
    if ($affiliate_parent > 0) {
        $affiliate_root_query = olc_db_query("select affiliate_root, affiliate_rgt, affiliate_lft�from  " . TABLE_AFFILIATE . " where affiliate_id = '" . $affiliate_parent . "' ");
        // Check if we have a parent affiliate
        if ($affiliate_root_array = olc_db_fetch_array($affiliate_root_query)) {
            olc_db_query(SQL_UPDATE . TABLE_AFFILIATE . " SET affiliate_lft = affiliate_lft + 2 WHERE affiliate_root  =  '" . $affiliate_root_array['affiliate_root'] . "' and  affiliate_lft > " . $affiliate_root_array['affiliate_rgt'] . "  AND affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . BLANK);
            olc_db_query(SQL_UPDATE . TABLE_AFFILIATE . " SET affiliate_rgt = affiliate_rgt + 2 WHERE affiliate_root  =  '" . $affiliate_root_array['affiliate_root'] . "' and  affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . "  ");
            $sql_data_array['affiliate_root'] = $affiliate_root_array['affiliate_root'];
            $sql_data_array['affiliate_lft'] = $affiliate_root_array['affiliate_rgt'];
            $sql_data_array['affiliate_rgt'] = $affiliate_root_array['affiliate_rgt'] + 1;
            olc_db_perform(TABLE_AFFILIATE, $sql_data_array);
            $affiliate_id = olc_db_insert_id();
        }
        // no parent -> new root
    } else {
        $sql_data_array['affiliate_lft'] = '1';
        $sql_data_array['affiliate_rgt'] = '2';
        olc_db_perform(TABLE_AFFILIATE, $sql_data_array);
        $affiliate_id = olc_db_insert_id();
        olc_db_query(SQL_UPDATE . TABLE_AFFILIATE . " set affiliate_root = '" . $affiliate_id . "' where affiliate_id = '" . $affiliate_id . "' ");
    }
    // UNLOCK TABLES
    olc_db_query("UNLOCK TABLES");
    return $affiliate_id;
}
Пример #2
0
function olc_update_whos_online($url = EMPTY_STRING)
{
    if (ISSET_CUSTOMER_ID) {
        $wo_customer_id = CUSTOMER_ID;
        $customer_query = olc_db_query(SELECT . "customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . $_SESSION['customer_id'] . APOS);
        $customer = olc_db_fetch_array($customer_query);
        $wo_full_name = addslashes($customer['customers_firstname'] . BLANK . $customer['customers_lastname']);
    } else {
        $wo_full_name = $_SESSION['customers_status']['customers_status_name'];
        $wo_customer_id = 0;
    }
    $wo_session_id = olc_session_id();
    //$wo_ip_address = getenv('REMOTE_ADDR');
    olc_get_ip_info(&$smarty);
    $wo_ip_address = $_SESSION['CUSTOMERS_IP'];
    $pos = strpos($wo_ip_address, RPAREN);
    if ($pos !== false) {
        $wo_ip_address = substr($wo_ip_address, 0, $pos + 1);
    }
    if (!$url) {
        $url = addslashes(getenv('REQUEST_URI'));
    }
    $wo_last_page_url = str_replace(DIR_WS_CATALOG, EMPTY_STRING, $url);
    $pos = strpos($wo_last_page_url, 'start_debug');
    //Eliminate debugger parameters
    if ($pos === false) {
        $pos = strpos($wo_last_page_url, 'DBGSESSION');
        //Eliminate debugger parameters
    }
    if ($pos !== false) {
        $wo_last_page_url = substr($wo_last_page_url, 0, $pos - 1);
    }
    if (USE_AJAX) {
        $pos = strpos($wo_last_page_url, AJAX_ID);
        if ($pos !== false) {
            $wo_last_page_url = substr($wo_last_page_url, 0, $pos - 1) . substr($wo_last_page_url, $pos + strlen(AJAX_ID));
        }
    }
    $current_time = time();
    //Do garbage collection in session db
    _sess_gc(EMPTY_STRING);
    //Delete all from "whos_online" without a session entry
    //olc_db_query(DELETE_FROM . TABLE_WHOS_ONLINE. ' WHERE session_id NOT IN (SELECT sesskey FROM '.TABLE_SESSIONS.RPAREN);
    $sesskey = TABLE_SESSIONS . '.sesskey';
    olc_db_query('DELETE ' . TABLE_WHOS_ONLINE . '  FROM ' . TABLE_WHOS_ONLINE . COMMA_BLANK . TABLE_SESSIONS . ' WHERE ' . TABLE_WHOS_ONLINE . '.session_id = ' . $sesskey . ' AND ' . $sesskey . ' IS NULL');
    $sql_data = array('customer_id' => $wo_customer_id, 'full_name' => $wo_full_name, 'session_id' => $wo_session_id, 'time_last_click' => $current_time, 'last_page_url' => $wo_last_page_url);
    $sql_where = "session_id = '" . $wo_session_id . APOS;
    $stored_customer_query = olc_db_query("select count(*) as count from " . TABLE_WHOS_ONLINE . " where " . $sql_where);
    $stored_customer = olc_db_fetch_array($stored_customer_query);
    if ($stored_customer['count'] > 0) {
        $sql_action = 'update';
    } else {
        $sql_data = array_merge($sql_data, array('ip_address' => $wo_ip_address, 'time_entry' => $current_time));
        $sql_action = 'insert';
        $sql_where = EMPTY_STRING;
    }
    olc_db_perform(TABLE_WHOS_ONLINE, $sql_data, $sql_action, $sql_where);
}
     $languages = olc_get_languages();
     for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
         $products_vpe_name_array = $_POST['products_vpe_name'];
         $language_id = $languages[$i]['id'];
         $sql_data_array = array('products_vpe_name' => olc_db_prepare_input($products_vpe_name_array[$language_id]));
         if ($action == 'insert') {
             if (!olc_not_null($products_vpe_id)) {
                 $next_id_query = olc_db_query("select max(products_vpe_id) as products_vpe_id from " . TABLE_PRODUCTS_VPE . "");
                 $next_id = olc_db_fetch_array($next_id_query);
                 $products_vpe_id = $next_id['products_vpe_id'] + 1;
             }
             $insert_sql_data = array('products_vpe_id' => $products_vpe_id, 'language_id' => $language_id);
             $sql_data_array = olc_array_merge($sql_data_array, $insert_sql_data);
             olc_db_perform(TABLE_PRODUCTS_VPE, $sql_data_array);
         } elseif ($action == 'save') {
             olc_db_perform(TABLE_PRODUCTS_VPE, $sql_data_array, 'update', "products_vpe_id = '" . $products_vpe_id . "' and language_id = '" . $language_id . APOS);
         }
     }
     if ($_POST['default'] == 'on') {
         olc_db_query(SQL_UPDATE . str_replace(HASH, $oID, $table_configuration));
         $default_products_vpe_id = $products_vpe_id;
     }
     //olc_redirect(olc_href_link(FILENAME_PRODUCTS_VPE, 'page=' . $_GET['page'] . '&oID=' . $products_vpe_id));
     break;
 case 'deleteconfirm':
     olc_db_query(DELETE_FROM . TABLE_PRODUCTS_VPE . " where products_vpe_id = '" . $oID . APOS);
     if ($default_products_vpe_id == $oID) {
         olc_db_query(SQL_UPDATE . str_replace(HASH, EMPTY_STRING, $table_configuration));
     }
     //olc_redirect(olc_href_link(FILENAME_PRODUCTS_VPE, 'page=' . $_GET['page']));
     break;
//require(DIR_FS_CATALOG . DIR_WS_LANGUAGES . SESSION_LANGUAGE . '/admin/blacklist.php');
switch ($_GET['action']) {
    case 'insert':
    case 'save':
        $blacklist_id = olc_db_prepare_input($_GET['bID']);
        $blacklist_card_number = olc_db_prepare_input($_POST['blacklist_card_number']);
        $sql_data_array = array('blacklist_card_number' => $blacklist_card_number);
        if ($_GET['action'] == 'insert') {
            $insert_sql_data = array('date_added' => 'now()');
            $sql_data_array = olc_array_merge($sql_data_array, $insert_sql_data);
            olc_db_perform(TABLE_BLACKLIST, $sql_data_array);
            $blacklist_id = olc_db_insert_id();
        } elseif ($_GET['action'] == 'save') {
            $update_sql_data = array('last_modified' => 'now()');
            $sql_data_array = olc_array_merge($sql_data_array, $update_sql_data);
            olc_db_perform(TABLE_BLACKLIST, $sql_data_array, 'update', "blacklist_id = '" . olc_db_input($blacklist_id) . APOS);
        }
        /*      $manufacturers_image = olc_get_uploaded_file('manufacturers_image');
              $image_directory = olc_get_local_path(DIR_FS_CATALOG_IMAGES);
        
              if (is_uploaded_file($manufacturers_image['tmp_name'])) {
                if (!is_writeable($image_directory)) {
                  if (is_dir($image_directory)) {
                    $messageStack->add_session(sprintf(ERROR_DIRECTORY_NOT_WRITEABLE, $image_directory), 'error');
                  } else {
                    $messageStack->add_session(sprintf(ERROR_DIRECTORY_DOES_NOT_EXIST, $image_directory), 'error');
                  }
                } else {
                  olc_db_query(SQL_UPDATE . TABLE_MANUFACTURERS . " set manufacturers_image = '" . $manufacturers_image['name'] . "' where manufacturers_id = '" . olc_db_input($manufacturers_id) . APOS);
                  olc_copy_uploaded_file($manufacturers_image, $image_directory);
                }
                // check if cusomer want newsletter
                $select_all = $status_all == 'yes';
                if ($select_all) {
                    $customers_query = olc_db_query($select . " FROM " . TABLE_CUSTOMERS . $where);
                } else {
                    $customers_query = olc_db_query($select . ",mail_key\n                                  FROM " . TABLE_NEWSLETTER_RECIPIENTS . $where . " and mail_status='1'");
                }
                $table = TABLE_MODULE_NEWSLETTER_TEMP . $id_post;
                $group = $groups[$i];
                while ($customers_data = olc_db_fetch_array($customers_query)) {
                    $email = $customers_data['customers_email_address'];
                    if ($select_all) {
                        $customers_data['mail_key'] = olc_encrypt_password($email);
                    }
                    $sql_data_array = array('customers_id' => $customers_data['customers_id'], 'customers_status' => $group, 'customers_firstname' => $customers_data['customers_firstname'], 'customers_lastname' => $customers_data['customers_lastname'], 'customers_email_address' => $email, 'customers_email_type' => $customers_data['customers_email_type'], 'mail_key' => $customers_data['mail_key'], 'date' => 'now()');
                    olc_db_perform($table, $sql_data_array);
                }
            }
            olc_redirect(olc_href_link(FILENAME_MODULE_NEWSLETTER));
        }
        break;
    case 'delete':
        olc_db_query(DELETE_FROM . TABLE_MODULE_NEWSLETTER . " WHERE newsletter_id='" . $id_get . APOS);
        olc_redirect(olc_href_link(FILENAME_MODULE_NEWSLETTER));
        break;
    case 'send':
        // max email package  -> should be in admin area!
        olc_redirect(olc_href_link(FILENAME_MODULE_NEWSLETTER, 'send=0,' . EMAIL_NEWSLETTER_PACAKGE_SIZE . '&id=' . $id_get));
}
// action for sending mails!
if ($_GET['send']) {
                $sql_data_marray[$i] = array('coupon_name' => olc_db_prepare_input($_POST['coupon_name'][$language_id]), 'coupon_description' => olc_db_prepare_input($_POST['coupon_desc'][$language_id]));
            }
            if ($_GET['oldaction'] == 'voucheredit') {
                olc_db_perform(TABLE_COUPONS, $sql_data_array, 'update', "coupon_id='" . $_GET['cid'] . APOS);
                for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
                    $language_id = $languages[$i]['id'];
                    $update = olc_db_query(SQL_UPDATE . TABLE_COUPONS_DESCRIPTION . " set coupon_name = '" . olc_db_prepare_input($_POST['coupon_name'][$language_id]) . "', coupon_description = '" . olc_db_prepare_input($_POST['coupon_desc'][$language_id]) . "' where coupon_id = '" . $_GET['cid'] . "' and language_id = '" . $language_id . APOS);
                }
            } else {
                $query = olc_db_perform(TABLE_COUPONS, $sql_data_array);
                $insert_id = olc_db_insert_id($query);
                for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
                    $language_id = $languages[$i]['id'];
                    $sql_data_marray[$i]['coupon_id'] = $insert_id;
                    $sql_data_marray[$i]['language_id'] = $language_id;
                    olc_db_perform(TABLE_COUPONS_DESCRIPTION, $sql_data_marray[$i]);
                }
            }
        }
}
require DIR_WS_INCLUDES . 'header.php';
/*
if (USE_AJAX_ADMIN)
{
	$document_write=FALSE_STRING_S;
}
else
{
	$document_write=TRUE_STRING_S;
	echo '
<link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
 if (empty($html_text)) {
     if (!($banners_image = new upload('banners_image', DIR_FS_CATALOG_IMAGES . 'banner/' . $banners_image_target))) {
         $banner_error = true;
     }
 }
 if (!$banner_error) {
     $db_image_location = olc_not_null($banners_image_local) ? $banners_image_local : $banners_image_target . $banners_image->filename;
     $sql_data_array = array('banners_title' => $banners_title, 'banners_url' => $banners_url, 'banners_image' => $db_image_location, 'banners_group' => $banners_group, 'banners_html_text' => $html_text);
     if ($action == 'insert') {
         $insert_sql_data = array('date_added' => 'now()', 'status' => '1');
         $sql_data_array = olc_array_merge($sql_data_array, $insert_sql_data);
         olc_db_perform(TABLE_BANNERS, $sql_data_array);
         $banners_id = olc_db_insert_id();
         $messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success');
     } elseif ($action == 'update') {
         olc_db_perform(TABLE_BANNERS, $sql_data_array, 'update', 'banners_id = \'' . $banners_id . '\'');
         $messageStack->add_session(SUCCESS_BANNER_UPDATED, 'success');
     }
     $expires_date = olc_db_prepare_input($_POST['expires_date']);
     if ($expires_date) {
         list($day, $month, $year) = explode('.', $expires_date);
         $expires_date = $year . (strlen($month) == 1 ? '0' . $month : $month) . (strlen($day) == 1 ? '0' . $day : $day);
         $sql_update = " set expires_date = '" . $expires_date . "', expires_impressions = null";
     } else {
         $impressions = olc_db_prepare_input($_POST['impressions']);
         if ($impressions) {
             $sql_update = " set expires_impressions = '" . $impressions . "', expires_date = null";
         }
     }
     $date_scheduled = olc_db_prepare_input($_POST['date_scheduled']);
     if ($date_scheduled) {
if ($_GET['action'] == "product_option_delete") {
    olc_db_query(DELETE_FROM . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . olc_db_input($_POST['oID']) . "' and orders_products_attributes_id = '" . olc_db_input($_POST['opAID']) . APOS);
    $products_query = olc_db_query("select products_id, products_price, products_tax_class_id from " . TABLE_PRODUCTS . " where products_id = '" . $_POST['pID'] . APOS);
    $products = olc_db_fetch_array($products_query);
    $products_a_query = olc_db_query("select options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . $_POST['oID'] . "' and orders_products_id = '" . $_POST['opID'] . APOS);
    while ($products_a = olc_db_fetch_array($products_a_query)) {
        $total_price += $products_a['price_prefix'] . $products_a['options_values_price'];
    }
    $sa_price = olc_oe_get_products_attribute_price($total_price, $products['products_tax_class_id'], $price_special = '0', 1, $_POST['prefix'], $calculate_currencies = TRUE_STRING_S, $customers_status);
    $sp_price = olc_oe_products_price($_POST['pID'], $price_special = '0', 1, $customers_status);
    $inp_price = $sa_price + $sp_price;
    $final_price = $inp_price * $_POST['qTY'];
    $sql_data_array = array('products_price' => olc_db_prepare_input($inp_price));
    $update_sql_data = array('final_price' => olc_db_prepare_input($final_price));
    $sql_data_array = olc_array_merge($sql_data_array, $update_sql_data);
    olc_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array, 'update', 'orders_products_id = \'' . olc_db_input($_POST['opID']) . '\'');
    olc_redirect(olc_href_link(FILENAME_ORDERS_EDIT, 'edit_action=products&cID=' . $_POST['cID'] . '&oID=' . $_POST['oID']));
}
if ($_GET['action'] == "shipping_del") {
    olc_db_query(DELETE_FROM . TABLE_ORDERS_TOTAL . " where orders_total_id = '" . olc_db_input($_POST['otID']) . APOS);
    olc_redirect(olc_href_link(FILENAME_ORDERS_EDIT, 'edit_action=shipping&cID=' . $_POST['cID'] . '&oID=' . $_POST['oID']));
}
if ($_GET['action'] == "cod_del") {
    olc_db_query(DELETE_FROM . TABLE_ORDERS_TOTAL . " where orders_total_id = '" . olc_db_input($_POST['otID']) . APOS);
    olc_redirect(olc_href_link(FILENAME_ORDERS_EDIT, 'edit_action=shipping&cID=' . $_POST['cID'] . '&oID=' . $_POST['oID']));
}
// Löschfunktionen Ende
require DIR_WS_INCLUDES . 'header.php';
?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
   (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
   (c) 2002-2003 osCommercecoding standards www.oscommerce.com
   (c) 2004      XT - Commerce; www.xt-commerce.com

    Released under the GNU General Public License
   --------------------------------------------------------------*/
require 'includes/application_top.php';
include DIR_FS_LANGUAGES . SESSION_LANGUAGE . '/admin/customers.php';
if ($_GET['action']) {
    switch ($_GET['action']) {
        case 'save':
            $memo_title = olc_db_prepare_input($_POST['memo_title']);
            $memo_text = olc_db_prepare_input($_POST['memo_text']);
            if ($memo_text != '' && $memo_title != '') {
                $sql_data_array = array('customers_id' => $_POST['id'], 'memo_date' => date("Y-m-d"), 'memo_title' => $memo_title, 'memo_text' => nl2br($memo_text), 'poster_id' => $_SESSION['customer_id']);
                olc_db_perform(TABLE_CUSTOMERS_MEMO, $sql_data_array);
            }
            break;
        case 'remove':
            olc_db_query(DELETE_FROM . TABLE_CUSTOMERS_MEMO . " WHERE memo_id = '" . $_GET['mID'] . APOS);
            break;
    }
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php 
echo HTML_PARAMS;
?>
>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
     $languages = olc_get_languages();
     for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
         $shipping_status_name_array = $_POST['shipping_status_name'];
         $language_id = $languages[$i]['id'];
         $sql_data_array = array('shipping_status_name' => olc_db_prepare_input($shipping_status_name_array[$language_id]));
         if ($_GET['action'] == 'insert') {
             if (!olc_not_null($shipping_status_id)) {
                 $next_id_query = olc_db_query("select max(shipping_status_id) as shipping_status_id from " . TABLE_SHIPPING_STATUS . "");
                 $next_id = olc_db_fetch_array($next_id_query);
                 $shipping_status_id = $next_id['shipping_status_id'] + 1;
             }
             $insert_sql_data = array('shipping_status_id' => $shipping_status_id, 'language_id' => $language_id);
             $sql_data_array = olc_array_merge($sql_data_array, $insert_sql_data);
             olc_db_perform(TABLE_SHIPPING_STATUS, $sql_data_array);
         } elseif ($_GET['action'] == 'save') {
             olc_db_perform(TABLE_SHIPPING_STATUS, $sql_data_array, 'update', "shipping_status_id = '" . olc_db_input($shipping_status_id) . "' and language_id = '" . $language_id . APOS);
         }
     }
     if ($shipping_status_image = new upload('shipping_status_image', DIR_WS_ICONS)) {
         olc_db_query(SQL_UPDATE . TABLE_SHIPPING_STATUS . " set shipping_status_image = '" . $shipping_status_image->filename . "' where shipping_status_id = '" . olc_db_input($shipping_status_id) . APOS);
     }
     if ($_POST['default'] == 'on') {
         olc_db_query(SQL_UPDATE . TABLE_CONFIGURATION . " set configuration_value = '" . olc_db_input($shipping_status_id) . "' where configuration_key = 'DEFAULT_SHIPPING_STATUS_ID'");
     }
     olc_redirect(olc_href_link(FILENAME_SHIPPING_STATUS, 'page=' . $_GET['page'] . '&oID=' . $shipping_status_id));
     break;
 case 'deleteconfirm':
     $oID = olc_db_prepare_input($_GET['oID']);
     $shipping_status_query = olc_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'DEFAULT_SHIPPING_STATUS_ID'");
     $shipping_status = olc_db_fetch_array($shipping_status_query);
     if ($shipping_status['configuration_value'] == $oID) {
function olc_connect_and_get_config($configuration_groups, $admin_path_prefix)
{
    global $connected;
    if (!$connected) {
        global $prefix_only;
        // include the list of project database tables
        require $admin_path_prefix . DIR_WS_INCLUDES . 'database_tables.php';
        require_once DIR_FS_INC . 'olc_db_connect.inc.php';
        require_once DIR_FS_INC . 'olc_db_error.inc.php';
        require_once DIR_FS_INC . 'olc_db_fetch_array.inc.php';
        require_once DIR_FS_INC . 'olc_db_input.inc.php';
        require_once DIR_FS_INC . 'olc_db_insert_id.inc.php';
        require_once DIR_FS_INC . 'olc_db_data_seek.inc.php';
        require_once DIR_FS_INC . 'olc_db_num_rows.inc.php';
        require_once DIR_FS_INC . 'olc_db_query.inc.php';
        require_once DIR_FS_INC . 'olc_db_close.inc.php';
        require_once DIR_FS_INC . 'olc_db_prepare_input.inc.php';
        require_once DIR_FS_INC . 'olc_db_perform.inc.php';
        require_once DIR_FS_INC . 'olc_db_free_result.inc.php';
        require_once DIR_FS_INC . 'olc_db_close.inc.php';
        require_once DIR_FS_INC . 'olc_db_output.inc.php';
        require_once DIR_FS_INC . 'olc_db_input.inc.php';
        require_once DIR_FS_INC . 'olc_db_prepare_input.inc.php';
        require_once DIR_FS_INC . 'olc_not_null.inc.php';
        include_once DIR_FS_INC . 'olc_error_handler.inc.php';
        // make a connection to the database
        //Multiple DB-servers are not supported (yet!), only multiple DBs on the same server
        //define('MULTI_DB_SERVER',defined('DB_SERVER_1'));
        define('MULTI_DB_SERVER', false);
        $db_connect_error = 'Kann keine Verbindung zur Datenbank "%s" herstellen!/Can not connect to database "%s"!';
        if (MULTI_DB_SERVER) {
            include_once DIR_FS_INC . 'olc_db_get_db_link.inc.php';
            ${$link_1} = olc_db_connect(DB_SERVER_1, DB_SERVER_USERNAME_1, DB_SERVER_PASSWORD_1, DB_DATABASE_1, 'db_link_1') or die(sprintf($db_connect_error, DB_DATABASE_1, DB_DATABASE_1));
        }
        olc_db_connect() or die(sprintf($db_connect_error, DB_DATABASE, DB_DATABASE));
    }
    global $current_template_text, $current_template_db;
    // set the application parameters
    $where = EMPTY_STRING;
    for ($i = 0, $n = sizeof($configuration_groups); $i < $n; $i++) {
        if ($i > 0) {
            $where .= SQL_OR;
        }
        $where .= 'configuration_group_id=' . $configuration_groups[$i];
    }
    if ($n > 0) {
        $where = SQL_WHERE . $where;
    }
    $configuration_text = 'configuration';
    $configuration_u_text = $configuration_text . UNDERSCORE;
    $configuration_value_text = $configuration_u_text . 'value';
    $configuration_key_text = $configuration_u_text . 'key';
    $select = SELECT . $configuration_key_text . COMMA_BLANK;
    $table = TABLE_PREFIX_INDIVIDUAL . $configuration_text;
    $from = SQL_FROM . $table;
    $configuration_query = olc_db_query($select . $configuration_value_text . $from . $where);
    while ($configuration = olc_db_fetch_array($configuration_query)) {
        $s = $configuration[$configuration_key_text];
        $s1 = $configuration[$configuration_value_text];
        if ($s != $current_template_text) {
            define($s, $s1);
        } else {
            $current_template_db = $s1;
        }
    }
    $key = 'olc_CONVERSION_DONE';
    if (!defined($key)) {
        //Adjust "use"- and "set"-function-names form "olc_..." to "olc_"...
        $use_function_text = 'use_function';
        $set_function_text = 'set_function';
        $olc_text = 'olc_';
        $olc_text = 'olc_';
        $configuration_query = olc_db_query($select . $configuration_value_text . COMMA_BLANK . $use_function_text . COMMA_BLANK . $set_function_text . $from . $where);
        while ($configuration = olc_db_fetch_array($configuration_query)) {
            $s = $configuration[$use_function_text];
            $s1 = $configuration[$set_function_text];
            $sql_array = array();
            if ($s) {
                $sql_array[$use_function_text] = str_replace($olc_text, $olc_text, $s);
            }
            if ($s1) {
                $sql_array[$set_function_text] = str_replace($olc_text, $olc_text, $s1);
            }
            if (sizeof($sql_array) > 0) {
                olc_db_perform($table, $sql_array, UPDATE, $configuration_key_text . EQUAL . APOS . $configuration[$configuration_key_text] . APOS);
            }
        }
        $sql_array = array($configuration_key_text => $key, $configuration_value_text => true);
        olc_db_perform($table, $sql_array);
    }
    define('DO_GROUP_CHECK', GROUP_CHECK == TRUE_STRING_S);
    define('DO_IMAGE_ON_THE_FLY', PRODUCT_IMAGE_ON_THE_FLY == TRUE_STRING_S);
    define('CURRENT_SCRIPT', basename($_SERVER['PHP_SELF']));
    define('USE_CACHE', false);
    //Force Smarty cache off (this is a heap of crap!)
}
Пример #12
0
            while (list($name, $value) = each($products)) {
                $sql_data_array[$name] = $value;
            }
            $sql_data_array['customers_basket_id'] = $basket_id;
            olc_db_perform(TABLE_CUSTOMERS_BASKET_SAVE, $sql_data_array);
        }
        //Save cart products attributes
        $product_query = olc_db_query($sql_select . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . $where_cid);
        if (olc_db_num_rows($product_query) > 0) {
            $sql_data_array = array();
            while ($products = olc_db_fetch_array($product_query)) {
                while (list($name, $value) = each($products)) {
                    $sql_data_array[$name] = $value;
                }
                $sql_data_array['customers_basket_id'] = $basket_id;
                olc_db_perform(TABLE_CUSTOMERS_BASKET_ATTRIBUTES_SAVE, $sql_data_array);
            }
        }
        $force_cart_update_only = true;
        unset($_SESSION['checked_saved_carts']);
        $_SESSION[$id_saved_carts_text] = $basket_id;
        $show_form = true;
        $error_message = olc_get_smarty_config_variable($smarty, 'shopping_cart', 'text_saved_cart');
        $error_message = str_replace(HASH, $cart_name, $error_message);
    } else {
        $show_form = true;
        $error_message = olc_get_smarty_config_variable($smarty, 'boxes', 'text_empty_cart');
    }
} else {
    $show_form = true;
}
 $sql_data_array = array('customers_id' => $user_id, 'entry_firstname' => $firstname, 'entry_lastname' => $lastname, 'entry_street_address' => $street_address, 'entry_postcode' => $postcode, 'entry_city' => $city, 'entry_country_id' => $country, 'address_date_added' => 'now()', 'address_last_modified' => 'now()');
 $sql_data_array['entry_gender'] = $gender;
 $sql_data_array['entry_company'] = $company;
 if (ACCOUNT_SUBURB == 'true') {
     $sql_data_array['entry_suburb'] = $suburb;
 }
 if (ACCOUNT_STATE == 'true') {
     if ($zone_id > 0) {
         $sql_data_array['entry_zone_id'] = $zone_id;
         $sql_data_array['entry_state'] = '';
     } else {
         $sql_data_array['entry_zone_id'] = '0';
         $sql_data_array['entry_state'] = $state;
     }
 }
 olc_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
 $address_id = olc_db_insert_id();
 olc_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . $address_id . "' where customers_id = '" . (int) $user_id . "'");
 olc_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int) $user_id . "', '0', now())");
 // create smarty elements
 $smarty = new Smarty();
 $smarty->assign('GENDER', $gender);
 $smarty->assign('FIRSTNAME', $firstname);
 $smarty->assign('LASTNAME', $lastname);
 $smarty->assign('EMAIL', $email_address);
 $smarty->assign('PASSWORT', $password);
 $smarty->caching = false;
 $txt_mail_customer = $smarty->fetch(DIR_FS_CATALOG . 'kunden_import_mail.txt');
 $mail_subject = "Unser neuer Onlineshop";
 /*
 echo "<pre>\n";
            if (ACCOUNT_GENDER == TRUE_STRING_S) {
                $sql_data_array['affiliate_gender'] = $affiliate_gender;
            }
            if (ACCOUNT_COMPANY == TRUE_STRING_S) {
                $sql_data_array['affiliate_company'] = $affiliate_company;
                $sql_data_array['affiliate_company_taxid'] = $affiliate_company_taxid;
            }
            if (ACCOUNT_SUBURB == TRUE_STRING_S) {
                $sql_data_array['affiliate_suburb'] = $affiliate_suburb;
            }
            if (ACCOUNT_STATE == TRUE_STRING_S) {
                $sql_data_array['affiliate_state'] = $affiliate_state;
                $sql_data_array['affiliate_zone_id'] = $affiliate_zone_id;
            }
            $sql_data_array['affiliate_date_account_last_modified'] = 'now()';
            olc_db_perform(TABLE_AFFILIATE, $sql_data_array, 'update', "affiliate_id = '" . olc_db_input($affiliate_id) . APOS);
            olc_redirect(olc_href_link(FILENAME_AFFILIATE, olc_get_all_get_params(array('acID', 'action')) . 'acID=' . $affiliate_id));
            break;
        case 'deleteconfirm':
            $affiliate_id = olc_db_prepare_input($_GET['acID']);
            affiliate_delete(olc_db_input($affiliate_id));
            olc_redirect(olc_href_link(FILENAME_AFFILIATE, olc_get_all_get_params(array('acID', 'action'))));
            break;
    }
}
require DIR_WS_INCLUDES . 'header.php';
?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td class="columnLeft2" nowrap="nowrap" valign="top"><table border="0" cellspacing="1" cellpadding="1" class="columnLeft" nowrap="nowrap">
<!-- left_navigation //-->
        }
        $sql_data_array = array($affiliate . 'id' => $_SESSION[$affiliate . 'ref'], $affiliate . 'clientdate' => $affiliate_clientdate, $affiliate . 'clientbrowser' => $affiliate_clientbrowser, $affiliate . 'clientip' => $affiliate_clientip, $affiliate . 'clientreferer' => $affiliate_clientreferer, $affiliate . 'products_id' => $affiliate_products_id, $affiliate . 'banner_id' => $affiliate_banner_id);
        olc_db_perform(TABLE_AFFILIATE_CLICKTHROUGHS, $sql_data_array);
        $_SESSION[$affiliate . 'clickthroughs_id'] = olc_db_insert_id();
        // Banner has been clicked, update stats:
        if ($affiliate_banner_id && $_SESSION[$affiliate . 'ref']) {
            $today = date('Y-m-d');
            $sql = "select * from " . TABLE_AFFILIATE_BANNERS_HISTORY . " where affiliate_banners_id = '" . $affiliate_banner_id . "' and  affiliate_banners_affiliate_id = '" . $_SESSION[$affiliate . 'ref'] . "' and affiliate_banners_history_date = '" . $today . APOS;
            $banner_stats_query = olc_db_query($sql);
            // Banner has been shown today
            if (olc_db_fetch_array($banner_stats_query)) {
                olc_db_query(SQL_UPDATE . TABLE_AFFILIATE_BANNERS_HISTORY . " set affiliate_banners_clicks = affiliate_banners_clicks + 1 where affiliate_banners_id = '" . $affiliate_banner_id . "' and affiliate_banners_affiliate_id = '" . $_SESSION[$affiliate . 'ref'] . "' and affiliate_banners_history_date = '" . $today . APOS);
                // Initial entry if banner has not been shown
            } else {
                $sql_data_array = array($affiliate . 'banners_id' => $affiliate_banner_id, $affiliate . 'banners_products_id' => $affiliate_products_id, $affiliate . 'banners_affiliate_id' => $_SESSION[$affiliate . 'ref'], $affiliate . 'banners_clicks' => '1', $affiliate . 'banners_history_date' => $today);
                olc_db_perform(TABLE_AFFILIATE_BANNERS_HISTORY, $sql_data_array);
            }
        }
        // Set Cookie if the customer comes back and orders it counts
        setcookie($affiliate . 'ref', $_SESSION[$affiliate . 'ref'], time() + AFFILIATE_COOKIE_LIFETIME);
    }
    if ($_COOKIE[$affiliate . 'ref']) {
        // Customer comes back and is registered in cookie
        $_SESSION[$affiliate . 'ref'] = $_COOKIE[$affiliate . 'ref'];
    }
}
////
// Compatibility to older Snapshots
// set the type of request (secure or not)
if (!isset($request_type)) {
    $request_type = getenv(HTTPS) != null ? SSL : NONSSL;
 function ec_step2()
 {
     global $paypal_ec_token, $customer_id, $customer_first_name, $language;
     global $customer_default_address_id, $sendto;
     //Visitor just came back from PayPal and so we collect all the info returned, create an account if necessary,
     //then log them in, and then send them to checkout_shipping.php.  What a long, strange trip it's been.
     $_SESSION[$his->ec_checkout_text] = true;
     if ($paypal_ec_token == EMPTY_STRING) {
         if (isset($_GET['token'])) {
             $paypal_ec_token = $_GET['token'];
         } else {
             $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_INVALID_RESPONSE, true);
         }
     }
     //Make sure the token is in the correct format
     if (!ereg("([C-E]{2})-([A-Z0-9]{17})", $paypal_ec_token)) {
         $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_INVALID_RESPONSE, true);
     }
     $caller = $this->paypal_init();
     $ecdt =& Services_PayPal::getType('GetExpressCheckoutDetailsRequestType');
     $ecdt->setToken($paypal_ec_token);
     $response = $caller->GetExpressCheckoutDetails($ecdt);
     $response_ack = $response->Ack;
     if (strlen(Services_PayPal::isError($response)) > 0 || $response_ack != 'Success' && $response_ack != 'SuccessWithWarning') {
         if ($this->enableDebugging) {
             /*
             olc_php_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $this->error_dump,
             "In Funktion: ec_step2()\n\n".var_dump($response), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
             */
             olc_php_mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, STORE_NAME, EMPTY_STRING, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, EMPTY_STRING, EMPTY_STRING, $this->error_dump, EMPTY_STRING, str_replace(HASH, 'ec_step2', $this->in_function) . $this->prepare_var_dump($response), EMAIL_TYPE_TEXT);
         }
         $error = $this->prepare_error(MODULE_PAYMENT_PAYPAL_DP_GEN_ERROR, $response);
         $this->away_with_you($error, true);
     } else {
         //This is an array of all the info sent back by PayPal
         $details = $response->getGetExpressCheckoutDetailsResponseDetails();
         $payer_info = $details->getPayerInfo();
         if (MODULE_PAYMENT_PAYPAL_DP_REQ_VERIFIED == 'Yes' && strtolower($payer_info->PayerStatus) != 'verified') {
             $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_TEXT_UNVERIFIED, true);
         }
         $paypal_ec_payer_id = $payer_info->getPayerID();
         $_SESSION[$this->paypal_ec_text . 'payer_id'];
         $_SESSION[$this->paypal_ec_text . 'payer_id'] = $paypal_ec_payer_id;
         $fullname = $payer_info->getPayerName();
         $address_info = $payer_info->getAddress();
         //Hoag: Begin telephone fix (1 of 3)
         $phone = $details->getContactPhone();
         //Hoag: End telephone fix (1 of 3)
         //I didn't include the international variables since PayPal only supports USD at this time
         $paypal_ec_payer_info = array('payer_id' => $payer_info->PayerID, 'payer_email' => $payer_info->Payer, 'payer_firstname' => $fullname->FirstName, 'payer_lastname' => $fullname->LastName, 'payer_business' => $payer_info->PayerBusiness, 'payer_status' => $payer_info->PayerStatus, 'ship_owner' => $address_info->AddressOwner, 'ship_name' => $address_info->Name, 'ship_street_1' => $address_info->Street1, 'ship_street_2' => $address_info->Street2, 'ship_city' => $address_info->CityName, 'ship_state' => $address_info->StateOrProvince, 'ship_postal_code' => $address_info->PostalCode, 'ship_country' => $address_info->Country, 'ship_country_name' => $address_info->CountryName, 'ship_phone' => $address_info->Phone, 'ship_phone' => $phone, 'ship_address_status' => $address_info->AddressStatus);
         //$_SESSION[$this->paypal_ec_text.'payer_info'] = $paypal_ec_payer_info;
         $_SESSION[$this->paypal_ec_text . 'payer_info'];
         //Get the customer's country id.
         $country_query = olc_db_query("SELECT countries_id, address_format_id FROM " . TABLE_COUNTRIES . " WHERE countries_name = '" . $paypal_ec_payer_info['ship_country_name'] . "' LIMIT 1");
         if (olc_db_num_rows($country_query) > 0) {
             $country = olc_db_fetch_array($country_query);
             $country_id = $country['countries_id'];
             $address_format_id = $country['address_format_id'];
         } else {
             $country_id = EMPTY_STRING;
             $address_format_id = '2';
             //2 is the American format
         }
         $states_query = olc_db_query("SELECT zone_id FROM " . TABLE_ZONES . " WHERE zone_code = '" . $paypal_ec_payer_info['ship_state'] . "' AND zone_country_id = '" . $country_id . "' LIMIT 1");
         if (olc_db_num_rows($states_query) > 0) {
             $states = olc_db_fetch_array($states_query);
             $state_id = $states['zone_id'];
         } else {
             $state_id = EMPTY_STRING;
         }
         $order->customer['name'] = trim($paypal_ec_payer_info['payer_firstname'] . BLANK . $paypal_ec_payer_info['payer_lastname']);
         $order->customer['company'] = $paypal_ec_payer_info['payer_business'];
         $order->customer['street_address'] = $paypal_ec_payer_info['ship_street_1'];
         $order->customer['suburb'] = $paypal_ec_payer_info['ship_street_2'];
         $order->customer['city'] = $paypal_ec_payer_info['ship_city'];
         $order->customer['postcode'] = $paypal_ec_payer_info['ship_postal_code'];
         $order->customer['state'] = $paypal_ec_payer_info['ship_state'];
         $order->customer['country'] = $paypal_ec_payer_info['ship_country_name'];
         $order->customer['format_id'] = $address_format_id;
         $order->customer['email_address'] = $paypal_ec_payer_info['payer_email'];
         //Hoag: Begin telephone fix (3 of 3)
         $order->customer['telephone'] = $paypal_ec_payer_info['ship_phone'];
         //Hoag: End telephone fix (3 of 3)
         //For some reason, $order->billing gets erased between here and checkout_confirmation.php
         $order->billing['name'] = trim($paypal_ec_payer_info['payer_firstname'] . BLANK . $paypal_ec_payer_info['payer_lastname']);
         $order->billing['company'] = $paypal_ec_payer_info['payer_business'];
         $order->billing['street_address'] = $paypal_ec_payer_info['ship_street_1'];
         $order->billing['suburb'] = $paypal_ec_payer_info['ship_street_2'];
         $order->billing['city'] = $paypal_ec_payer_info['ship_city'];
         $order->billing['postcode'] = $paypal_ec_payer_info['ship_postal_code'];
         $order->billing['state'] = $paypal_ec_payer_info['ship_state'];
         $order->billing['country'] = $paypal_ec_payer_info['ship_country_name'];
         $order->billing['format_id'] = $address_format_id;
         /*Disabled for now
         		//If they selected an address on PayPal's site with a different zipcode than was previously selected
         		//send them back to the shipping page
         		if ($order->delivery['postcode'] == $paypal_ec_payer_info['ship_postal_code']) {
         		$goto_shipping = false;
         		} else {
         		$goto_shipping = true;
         		}
         		*/
         $order->delivery['name'] = trim($paypal_ec_payer_info['payer_firstname'] . BLANK . $paypal_ec_payer_info['payer_lastname']);
         $order->delivery['company'] = $paypal_ec_payer_info['payer_business'];
         $order->delivery['street_address'] = $paypal_ec_payer_info['ship_street_1'];
         $order->delivery['suburb'] = $paypal_ec_payer_info['ship_street_2'];
         $order->delivery['city'] = $paypal_ec_payer_info['ship_city'];
         $order->delivery['postcode'] = $paypal_ec_payer_info['ship_postal_code'];
         $order->delivery['state'] = $paypal_ec_payer_info['ship_state'];
         $order->delivery['country'] = $paypal_ec_payer_info['ship_country_name'];
         $order->delivery['format_id'] = $address_format_id;
         if (!$_SESSION[$this->paypal_ec_text . 'temp']) {
             $_SESSION[$this->paypal_ec_text . 'temp'];
         }
         if ($_SESSION['customer_first_name'] && $_SESSION['customer_id']) {
             //They're logged in, so forward them straight to checkout_shipping.php
             $order->customer['id'] = $customer_id;
             if (!$_SESSION['sendto']) {
                 $_SESSION['sendto'] = $customer_default_address_id;
             }
             $_SESSION[$this->paypal_ec_text . 'temp'] = false;
             $this->away_with_you();
             /*disabled for now
             		//0.6.2b modification.  If they already have a shipping amount calculated for this zip code, send them on instead of backwards
             		if ($goto_shipping) {
             		$this->away_with_you();
             		} else {
             		$this->away_with_you(EMPTY_STRING, false, FILENAME_CHECKOUT_CONFIRMATION);
             		}
             		*/
         } else {
             //They're not logged in.  Create an account if necessary, and then log them in.
             //First, see if they're an existing customer
             //If Paypal didn't send an email address, something went wrong
             if (trim($paypal_ec_payer_info['payer_email']) == EMPTY_STRING) {
                 $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_INVALID_RESPONSE, true);
             }
             $check_customer_query = olc_db_query("select customers_id, customers_firstname, customers_lastname,\n\t\t\t\tcustomers_paypal_payerid, customers_paypal_ec from " . TABLE_CUSTOMERS . " where customers_email_address = '" . olc_db_input($paypal_ec_payer_info['payer_email']) . APOS);
             $check_customer = olc_db_fetch_array($check_customer_query);
             if (olc_db_num_rows($check_customer_query) > 0) {
                 $check_customer = olc_db_fetch_array($check_customer_query);
                 $acct_exists = true;
                 if ($check_customer['customers_paypal_ec'] == '1') {
                     //Delete the existing temporary account
                     $this->ec_delete_user($check_customer['customers_id']);
                     $acct_exists = false;
                 }
             }
             //Create an account
             if (!$acct_exists) {
                 //Generate a random 8-char password
                 $salt = "46z3haZzegmn676PA3rUw2vrkhcLEn2p1c6gf7vp2ny4u3qqfqBh5j6kDhuLmyv9xf";
                 srand((double) microtime() * 1000000);
                 $password = EMPTY_STRING;
                 for ($x = 0; $x < 7; $x++) {
                     $num = rand() % 33;
                     $tmp = substr($salt, $num, 1);
                     $password = $password . $tmp;
                 }
                 $sql_data_array = array('customers_firstname' => $paypal_ec_payer_info['payer_firstname'], 'customers_lastname' => $paypal_ec_payer_info['payer_lastname'], 'customers_email_address' => $paypal_ec_payer_info['payer_email'], 'customers_telephone' => $paypal_ec_payer_info['ship_phone'], 'customers_fax' => EMPTY_STRING, 'customers_newsletter' => '0', 'customers_password' => olc_encrypt_password($password), 'customers_paypal_payerid' => $paypal_ec_payer_id);
                 olc_db_perform(TABLE_CUSTOMERS, $sql_data_array);
                 $customer_id = olc_db_insert_id();
                 $sql_data_array = array('customers_id' => $customer_id, 'entry_firstname' => $paypal_ec_payer_info['payer_firstname'], 'entry_lastname' => $paypal_ec_payer_info['payer_lastname'], 'entry_street_address' => $paypal_ec_payer_info['ship_street_1'], 'entry_suburb' => $paypal_ec_payer_info['ship_street_2'], 'entry_city' => $paypal_ec_payer_info['ship_city'], 'entry_zone_id' => $state_id, 'entry_postcode' => $paypal_ec_payer_info['ship_postal_code'], 'entry_country_id' => $country_id);
                 olc_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
                 $address_id = olc_db_insert_id();
                 olc_db_query(SQL_UPDATE . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int) $address_id . "' where customers_id = '" . (int) $customer_id . APOS);
                 olc_db_query(INSERT_INTO . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int) $customer_id . "', '0', now())");
                 if (MODULE_PAYMENT_PAYPAL_DP_NEW_ACCT_NOTIFY == 'Yes') {
                     require DIR_WS_LANGUAGES . SESSION_LANGUAGE . SLASH . FILENAME_CREATE_ACCOUNT;
                     $email_text = sprintf(EMAIL_GREET_NONE, $paypal_ec_payer_info['payer_firstname']) . EMAIL_WELCOME . EMAIL_TEXT;
                     $email_text .= EMAIL_EC_ACCOUNT_INFORMATION . "Username: "******"\nPassword: "******"\n\n";
                     $email_text .= EMAIL_CONTACT;
                     /*
                     
                     olc_php_mail($paypal_ec_payer_info['payer_firstname']." " .
                     $paypal_ec_payer_info['payer_lastname'],
                     $paypal_ec_payer_info['payer_email'], EMAIL_SUBJECT, $email_text, STORE_OWNER,
                     STORE_OWNER_EMAIL_ADDRESS);
                     */
                     olc_php_mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, $paypal_ec_payer_info['payer_email'], trim($paypal_ec_payer_info['payer_firstname'] . BLANK . $paypal_ec_payer_info['payer_lastname']), EMPTY_STRING, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, EMPTY_STRING, EMPTY_STRING, EMAIL_SUBJECT, EMPTY_STRING, $email_text, EMAIL_TYPE_TEXT);
                     $_SESSION[$this->paypal_ec_text . 'temp'] = false;
                 } else {
                     //Make it a temporary account that'll be deleted once they've checked out
                     olc_db_query(SQL_UPDATE . TABLE_CUSTOMERS . " SET customers_paypal_ec = '1' WHERE customers_id = '" . (int) $customer_id . APOS);
                     $_SESSION[$this->paypal_ec_text . 'temp'] = true;
                 }
             } else {
                 $_SESSION[$this->paypal_ec_text . 'temp'] = false;
             }
             $sendto = $address_id;
             if (!$_SESSION['sendto']) {
                 $_SESSION['sendto'];
             }
             $this->user_login($_SESSION[$this->paypal_ec_text . 'payer_info']['payer_email']);
         }
     }
 }
function addNewUser($buyer_values, &$customer_id)
{
    $names = explode(BLANK, $buyer_values['buyer_name']);
    $lastname = EMPTY_STRING;
    for ($i = 1, $n = count($names); $i <= $n; $i++) {
        $lastname .= $names[$i];
        if ($i < $n) {
            $lastname .= BLANK;
        }
    }
    $sql_data_array = array('customers_firstname' => $names[0], 'customers_lastname' => $lastname, 'customers_email_address' => $buyer_values['buyer_email'], 'customers_telephone' => EMPTY_STRING, 'customers_fax' => EMPTY_STRING, 'customers_newsletter' => EMPTY_STRING, 'customers_password' => olc_encrypt_password($buyer_values['buyer_id']), 'customers_gender' => EMPTY_STRING, 'customers_dob' => date("Y-m-d"));
    olc_db_perform(TABLE_CUSTOMERS, $sql_data_array);
    $customer_id = olc_db_insert_id();
    $buyer_countrycode = $buyer_values['buyer_countrycode'];
    if ($buyer_countrycode) {
        $sqlstring = SELECT_ALL . TABLE_COUNTRIES . " WHERE `countries_iso_code_2` = '" . $buyer_countrycode . APOS;
        $mycountry = olc_db_fetch_array(olc_db_query($sqlstring));
        //echo $mycountry['countries_id']."<hr/>";
    }
    $sql_data_array = array('customers_id' => $customer_id, 'entry_firstname' => $names[0], 'entry_lastname' => $lastname, 'entry_street_address' => $buyer_values['buyer_street'], 'entry_postcode' => $buyer_values['buyer_zip'], 'entry_city' => $buyer_values['buyer_city'], 'entry_country_id' => $mycountry['countries_id'], 'entry_gender' => EMPTY_STRING, 'entry_company' => EMPTY_STRING, 'entry_suburb' => EMPTY_STRING, 'entry_zone_id' => EMPTY_STRING, 'entry_state' => $buyer_values['buyer_land']);
    olc_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
    $address_id = olc_db_insert_id();
    //update customer table with address id
    olc_db_query(SQL_UPDATE . TABLE_CUSTOMERS . " set customers_default_address_id = '" . $address_id . "'\n\twhere customers_id = '" . $customer_id . APOS);
    //update customer_info table
    olc_db_query(INSERT_INTO . TABLE_CUSTOMERS_INFO . "\n\t(customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values\n\t('" . $customer_id . "', '0', now())");
    $_SESSION['customer_default_address_id'] = $address_id;
}
        }
    } else {
        $main_content .= '
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
      	<tr>
          <td>
          	<br>
          	<font style="font-size:12;font-weight:bold">
          		<a href="../export/' . basename($export->filename) . '">Export-Datei laden</a>
						</font>
					</td>
        </tr>
      </table>';
    }
    $sql_data = array($configuration_key_text => $csv_assoc_file, $configuration_value_text => $map_file);
    olc_db_perform(TABLE_CONFIGURATION, $sql_data, $db_mapfile_action, $configuration_key_text . EQUAL . APOS . $csv_assoc_file . APOS);
}
if ($import_file) {
    $import_file_display = '<span style="font-size:6pt;font-weight:normal">' . str_replace(DIR_FS_CATALOG, EMPTY_STRING, $import_file) . '</span>' . olc_draw_hidden_field($import_file_hidden_text, $import_file);
} else {
    $import_file = EMPTY_STRING;
}
if ($map_file) {
    $map_file_display = '<span style="font-size:6pt;font-weight:normal">' . str_replace(DIR_FS_CATALOG, EMPTY_STRING, $map_file) . '</span>' . olc_draw_hidden_field($map_file_hidden_text, $map_file);
} else {
    $map_file_display = EMPTY_STRING;
}
if ($not_is_customers) {
    if ($user_filter_file) {
        $user_filter_file_display = '<span style="font-size:6pt;font-weight:normal">' . str_replace(DIR_FS_CATALOG, EMPTY_STRING, $user_filter_file) . '</span>' . olc_draw_hidden_field($user_filter_file_hidden_text, $user_filter_file);
    } else {
 function import()
 {
     $this->time_start = time();
     $lines = 1;
     $lines_ok = 0;
     // sonstige variablen
     $newsletter = 0;
     $set_suburb = ACCOUNT_SUBURB == TRUE_STRING_S;
     $set_state = ACCOUNT_STATE == TRUE_STRING_S;
     $email_adresses = array();
     $error = EMPTY_STRING;
     define('INSERT_INTO_CUSTOMERS_INFO_SQL', INSERT_INTO . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('");
     define('SELECT_COUNTRY_SQL', SELECT_ALL . "`countries` WHERE `countries_iso_code_2` = '");
     $check_email_sql = SELECT_COUNT . "as total from " . TABLE_CUSTOMERS . " where customers_email_address = '";
     $update_table_customers = SQL_UPDATE . TABLE_CUSTOMERS . " set customers_default_address_id = '";
     $fh = fopen($this->filename, "r");
     if ($fh) {
         $zeile = fgets($fh);
         while (!feof($fh)) {
             // zeile einlesen & werte zuweisen
             $zeile = trim(fgets($fh));
             if ($zeile) {
                 $dataArray = explode(SEMI_COLON, $zeile);
                 for ($j = 0, $m = sizeof($this->dataArray); $j < $m; $j++) {
                     $data = $this->dataArray[$j];
                     if (substr($data, -1) == CSV_TEXTSIGN) {
                         $dataArray[$j] = substr($data, 1, strlen($data) - 2);
                     }
                 }
                 list($cid, $gruppe, $anrede, $email_address, $company, $lkz, $lastname, $city, $postcode, $password, $street_address, $fax, $telephone, $firstname, $d_company, $d_lkz, $d_lastname, $d_city, $d_postcode, $d_street_address, $d_fax, $d_telephone, $d_firstname) = $dataArray;
                 $lines++;
                 if (!$password) {
                     // neues zufallspasswort erstelllen.
                     $password = getpass(10);
                 }
                 // vorhandene Daten aufbereiten.
                 $gruppe = trim($gruppe);
                 switch ($gruppe) {
                     case "Registriert":
                         $customers_status = DEFAULT_CUSTOMERS_STATUS_ID_CUSTOMER;
                         break;
                     case "Merchant":
                         $customers_status = DEFAULT_CUSTOMERS_STATUS_ID_DEALER;
                         break;
                     default:
                         $customers_status = DEFAULT_CUSTOMERS_STATUS_ID_GUEST;
                 }
                 $anrede = trim($anrede);
                 switch ($anrede) {
                     case "Herr":
                         $gender = "m";
                         break;
                     case "Frau":
                         $gender = "f";
                         break;
                     default:
                         $gender = "m";
                 }
                 $country = set_country_info($lkz);
                 $geburtsdatum = trim($geburtsdatum);
                 if ($geburtsdatum != EMPTY_STRING && $geburtsdatum != ".000000000") {
                     list($jahr, $monat, $tag) = sscanf($geburtsdatum, "%4d%2d%2d.%d");
                     $dob = sprintf("%02d.%02d.%4d", $tag, $monat, $jahr);
                 } else {
                     $dob = EMPTY_STRING;
                 }
                 // daten in db eintragen
                 $vatID = new vat_validation($vat, EMPTY_STRING, EMPTY_STRING, $country);
                 $customers_status = $vatID->vat_info['status'];
                 $customers_vat_id_status = $vatID->vat_info['vat_id_status'];
                 if ($vatID->vat_info['error']) {
                     $error .= ENTRY_VAT_ERROR;
                 }
                 $email_address = trim($email_address);
                 $check_email_query = olc_db_query($check_email_sql . olc_db_input($email_address) . "' and account_type = '0'");
                 $check_email = olc_db_fetch_array($check_email_query);
                 $s = QUOTE . $email_address . QUOTE . ' -- ';
                 if ($check_email['total'] > 0) {
                     $error .= $s . ENTRY_EMAIL_ADDRESS_ERROR_EXISTS . LPAREN . EMAIL_ALREADY_USED . $email_adresses[$email_address] . RPAREN;
                 } elseif (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
                     $error .= $s . ENTRY_EMAIL_ADDRESS_ERROR;
                 } elseif (olc_validate_email($email_address) == false) {
                     $error .= $s . ENTRY_EMAIL_ADDRESS_CHECK_ERROR;
                     /*
                     $fp3 = fopen("kunden_import_mail-check-fail.csv", "a");
                     fputs($fp3, $zeile);
                     fclose ($fp3);
                     */
                 }
                 if ($email_adresses[$email_address]) {
                     $email_adresses[$email_address] .= COMMA_BLANK;
                 }
                 $email_adresses[$email_address] .= $lines;
                 if ($dob != EMPTY_STRING) {
                     $date_raw = olc_date_raw($dob);
                     if (checkdate(substr($date_raw, 4, 2), substr($date_raw, 6, 2), substr($date_raw, 0, 4)) == false) {
                         $error .= QUOTE . $dob . QUOTE . ' -- ' . ENTRY_DATE_OF_BIRTH_ERROR;
                     }
                 }
                 if ($error) {
                     $this->errorLog[] = sprintf(TEXT_ERROR, $error, $lines);
                     $error = EMPTY_STRING;
                 } else {
                     $lines_ok++;
                     $cid = trim($cid);
                     $firstname = trim($firstname);
                     $lastname = trim($lastname);
                     $telephone = trim($telephone);
                     $fax = trim($fax);
                     $street_address = trim($street_address);
                     $company = trim($company);
                     $postcode = trim($postcode);
                     $city = trim($city);
                     $sql_data_array = array('customers_cid' => $cid, 'customers_vat_id' => $vat, 'customers_vat_id_status' => $customers_vat_id_status, 'customers_status' => $customers_status, 'customers_firstname' => $firstname, 'customers_lastname' => $lastname, 'customers_email_address' => $email_address, 'customers_telephone' => $telephone, 'customers_fax' => $fax, 'customers_newsletter' => $newsletter, 'customers_password' => olc_encrypt_password($password), 'customers_gender' => $gender, 'customers_dob' => $date_raw, 'customers_date_added' => 'now()', 'customers_last_modified' => 'now()');
                     olc_db_perform(TABLE_CUSTOMERS, $sql_data_array);
                     $user_id = olc_db_insert_id();
                     $sql_data_array = array('customers_id' => $user_id, 'entry_firstname' => $firstname, 'entry_lastname' => $lastname, 'entry_street_address' => $street_address, 'entry_postcode' => $postcode, 'entry_city' => $city, 'entry_country_id' => $country, 'entry_gender' => $gender, 'entry_company' => $company, 'address_date_added' => 'now()', 'address_last_modified' => 'now()');
                     olc_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
                     $address_id = olc_db_insert_id();
                     olc_db_query($update_table_customers . $address_id . "' where customers_id = '" . (int) $user_id . APOS);
                     olc_db_query(INSERT_INTO_CUSTOMERS_INFO_SQL . (int) $user_id . "', '0', now())");
                     if ($d_lkz) {
                         //Separate delivery-adress.
                         $country = set_country_info($d_lkz);
                         $firstname = trim($d_firstname);
                         $lastname = trim($d_lastname);
                         $telephone = trim($d_telephone);
                         $fax = trim($d_fax);
                         $street_address = trim($d_street_address);
                         $company = trim($d_company);
                         $postcode = trim($d_postcode);
                         $city = trim($d_city);
                         $sql_data_array = array('customers_id' => $user_id, 'entry_firstname' => $firstname, 'entry_lastname' => $lastname, 'entry_street_address' => $street_address, 'entry_postcode' => $postcode, 'entry_city' => $city, 'entry_country_id' => $country, 'entry_gender' => $gender, 'entry_company' => $company, 'address_date_added' => 'now()', 'address_last_modified' => 'now()');
                         olc_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
                     }
                     // create smarty elements
                     if ($send_mail) {
                         $this->smarty->assign('GENDER', $gender);
                         $this->smarty->assign('FIRSTNAME', $firstname);
                         $this->smarty->assign('LASTNAME', $lastname);
                         $this->smarty->assign('EMAIL', $email_address);
                         $this->smarty->assign('PASSWORT', $password);
                         $this->smarty->caching = false;
                         $txt_mail_customer = $this->smarty->fetch($this->email_template);
                         // mail versenden
                         olc_php_mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, $email_address, $firstname . BLANK . $lastname, EMPTY_STRING, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, EMPTY_STRING, EMPTY_STRING, TEXT_MAIL_SUBJECT, EMPTY_STRING, $txt_mail_customer);
                     }
                 }
                 flush();
             }
         }
         fclose($fh);
     } else {
         $file_error = TEXT_FILE_ERROR_OPEN;
     }
     if ($file_error) {
         $this->errorLog[] = sprintf(TEXT_ERROR_FILE, $file_error);
     }
     $this->result = array(array('prod_new' => $lines_ok . " von " . ($lines - 1)), $this->errorLog, $this->calcElapsedTime($this->time_start));
     return $this->result;
 }
Пример #20
0
         olc_db_perform(TABLE_SHIPPING_STATUS, $shipping_status);
     }
     // create content manager data
     $content_manager_query = olc_db_query(SELECT_ALL . TABLE_CONTENT_MANAGER . $where_languages_id);
     while ($content_manager = olc_db_fetch_array($content_manager_query)) {
         $content_manager[$languages_id_text] = $insert_id;
         unset($content_manager['content_id']);
         olc_db_perform(TABLE_CONTENT_MANAGER, $content_manager);
     }
     // create product_content data
     $product_content_query = olc_db_query(SELECT_ALL . TABLE_PRODUCTS_CONTENT . $where_languages_id);
     while ($product_content = olc_db_fetch_array($product_content_query)) {
         $product_content[$languages_id_text] = $insert_id;
         unset($product_content['content_id']);
         $product_content['content_read'] = 0;
         olc_db_perform(TABLE_CONTENT_MANAGER, $product_content);
     }
     if ($_POST['default'] == 'on') {
         olc_db_query(SQL_UPDATE . TABLE_CONFIGURATION . " set configuration_value = '" . olc_db_input($code) . "' where configuration_key = 'DEFAULT_LANGUAGE'");
     }
     //olc_redirect(olc_href_link(FILENAME_LANGUAGES, 'page=' . $page . '&lID=' . $insert_id));
     break;
 case 'save':
     $name = $_POST['name'];
     $code = $_POST['code'];
     $image = $_POST['image'];
     $directory = $_POST['directory'];
     $sort_order = $_POST['sort_order'];
     $charset = $_POST['charset'];
     olc_db_query(SQL_UPDATE . TABLE_LANGUAGES . " set\n\t\tname = '" . olc_db_input($name) . "',\n\t\tcode = '" . olc_db_input($code) . "',\n\t\timage = '" . olc_db_input($image) . "',\n\t\tdirectory = '" . olc_db_input($directory) . "',\n\t\tsort_order = '" . olc_db_input($sort_order) . "',\n\t\tlanguage_charset = '" . olc_db_input($charset) . "'\n\t\twhere languages_id = " . olc_db_input($lID));
     if ($_POST['default'] == 'on') {
         if ($manufacturers_image->filename) {
             olc_db_query(SQL_UPDATE . TABLE_MANUFACTURERS . "\n\t\t\t\tset manufacturers_image ='manufacturers/" . $manufacturers_image->filename . "' where " . $manufacturers_id_sql);
         }
     }
     $languages = olc_get_languages();
     $manufacturers_url_array = $_POST['manufacturers_url'];
     for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
         $language_id = $languages[$i]['id'];
         $sql_data_array = array('manufacturers_url' => olc_db_prepare_input($manufacturers_url_array[$language_id]));
         if ($is_insert) {
             $insert_sql_data = array('manufacturers_id' => $manufacturers_id, 'languages_id' => $language_id);
             $sql_data_array = olc_array_merge($sql_data_array, $insert_sql_data);
             olc_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array);
         } else {
             //if ($action == 'save') {
             olc_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array, 'update', $manufacturers_id_sql . " and languages_id = '" . $language_id . APOS);
         }
     }
     if (USE_CACHE == TRUE_STRING_S) {
         olc_reset_cache_block('manufacturers');
     }
     //olc_redirect(olc_href_link(FILENAME_MANUFACTURERS, $page_parameter.'&mID='.$manufacturers_id));
     $mID = $manufacturers_id;
     break;
 case 'deleteconfirm':
     $manufacturers_id = $mID;
     $manufacturers_id_sql = " where manufacturers_id = '" . olc_db_input($manufacturers_id) . APOS;
     if ($_POST['delete_image'] == 'on') {
         $manufacturer_query = olc_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . $manufacturers_id_sql);
         $manufacturer = olc_db_fetch_array($manufacturer_query);
         $image_location = DIR_FS_DOCUMENT_ROOT . DIR_WS_IMAGES . $manufacturer['manufacturers_image'];
Пример #22
0
 function perform($strTable, $arrData, $strAction = 'insert', $strParams = '')
 {
     return olc_db_perform($strTable, $arrData, $strAction, $strParams);
 }
         $customers_fsk18_display = $_POST['customers_fsk18_display'];
         $language_id = $languages[$i]['id'];
         $sql_data_array = array('customers_status_name' => olc_db_prepare_input($customers_status_name_array[$language_id]), 'customers_status_public' => olc_db_prepare_input($customers_status_public), 'customers_status_show_price' => olc_db_prepare_input($customers_status_show_price), 'customers_status_show_price_tax' => olc_db_prepare_input($customers_status_show_price_tax), 'customers_status_discount' => olc_db_prepare_input($customers_status_discount), 'customers_status_ot_discount_flag' => olc_db_prepare_input($customers_status_ot_discount_flag), 'customers_status_ot_discount' => olc_db_prepare_input($customers_status_ot_discount), 'customers_status_graduated_prices' => olc_db_prepare_input($customers_status_graduated_prices), 'customers_status_add_tax_ot' => olc_db_prepare_input($customers_status_add_tax_ot), 'customers_status_payment_unallowed' => olc_db_prepare_input($customers_status_payment_unallowed), 'customers_status_shipping_unallowed' => olc_db_prepare_input($customers_status_shipping_unallowed), 'customers_fsk18' => olc_db_prepare_input($customers_fsk18), 'customers_fsk18_display' => olc_db_prepare_input($customers_fsk18_display), 'customers_status_discount_attributes' => olc_db_prepare_input($customers_status_discount_attributes));
         if ($_GET['action'] == 'insert') {
             if (!olc_not_null($customers_status_id)) {
                 $next_id_query = olc_db_query("select max(customers_status_id) as customers_status_id from " . TABLE_CUSTOMERS_STATUS);
                 $next_id = olc_db_fetch_array($next_id_query);
                 $customers_status_id = $next_id['customers_status_id'] + 1;
                 // We want to create a personal offer table corresponding to each customers_status
                 olc_db_query("create table " . TABLE_PERSONAL_OFFERS_BY_CUSTOMERS_STATUS . $customers_status_id . " (price_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, products_id int NOT NULL, quantity int,\n            \tpersonal_offer decimal(15,4))");
             }
             $insert_sql_data = array('customers_status_id' => olc_db_prepare_input($customers_status_id), 'language_id' => olc_db_prepare_input($language_id));
             $sql_data_array = olc_array_merge($sql_data_array, $insert_sql_data);
             olc_db_perform(TABLE_CUSTOMERS_STATUS, $sql_data_array);
         } elseif ($_GET['action'] == 'save') {
             olc_db_perform(TABLE_CUSTOMERS_STATUS, $sql_data_array, 'update', "customers_status_id = '" . olc_db_input($customers_status_id) . "' and language_id = '" . $language_id . APOS);
         }
     }
     if ($customers_status_image = new upload('customers_status_image', DIR_WS_ICONS)) {
         olc_db_query(SQL_UPDATE . TABLE_CUSTOMERS_STATUS . " set customers_status_image = '" . $customers_status_image->filename . "' where customers_status_id = '" . olc_db_input($customers_status_id) . APOS);
     }
     if ($_POST['default'] == 'on') {
         olc_db_query(SQL_UPDATE . TABLE_CONFIGURATION . " set configuration_value = '" . olc_db_input($customers_status_id) . "' where configuration_key = 'DEFAULT_CUSTOMERS_STATUS_ID'");
     }
     olc_redirect(olc_href_link(FILENAME_CUSTOMERS_STATUS, 'page=' . $_GET['page'] . '&cID=' . $customers_status_id));
     break;
 case 'deleteconfirm':
     $cID = olc_db_prepare_input($_GET['cID']);
     $customers_status_query = olc_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'DEFAULT_CUSTOMERS_STATUS_ID'");
     $customers_status = olc_db_fetch_array($customers_status_query);
     if ($customers_status['configuration_value'] == $cID) {
 /**
  *   Match and insert Categories
  *   @param array $this->dataArray data array
  *   @param string $mode insert mode
  *   @param int $pID  products ID
  */
 function insertCategory($pID)
 {
     $cat = array();
     for ($cat_level = 0; $cat_level < CAT_DEPTH; $cat_level++) {
         $p_cat = CAT . $cat_level;
         $index = $this->field_index[$p_cat];
         if ($index !== false) {
             $p_cat = trim($this->dataArray[$index]);
             if ($p_cat) {
                 $p_cat = addslashes($p_cat);
                 $cat[$cat_level] = $p_cat;
             } else {
                 break;
             }
         } else {
             break;
         }
     }
     $cat_0 = $cat[0];
     if (strpos($cat_0, '|') !== false) {
         //Cats are separated by '|'!!!! (1&1 shop export)
         $cat = explode('|', $cat_0);
     }
     if ($cat) {
         $catTree = implode($cat, TILDE);
     } else {
         $catTree = ZERO_STRING;
     }
     $cat_id = $this->CatTreeId[$catTree];
     if (!isset($cat_id)) {
         $cat_levels = $cat_level - 1;
         $catTree = EMPTY_STRING;
         $parent = 0;
         $cat_id = 0;
         for ($cat_level = 0; $cat_level <= $cat_levels; $cat_level++) {
             $cat_name = $cat[$cat_level];
             if ($catTree) {
                 $catTree .= TILDE;
             }
             $catTree .= $cat_name;
             $cat_id = $this->CatTreeId[$catTree];
             if (isset($cat_id)) {
                 $this->counter['cat_touched']++;
             } else {
                 // insert categorie
                 $this->counter['cat_new']++;
                 $this->categorie_data[PARENT_ID] = $parent;
                 if (DO_GROUP_CHECK) {
                     //Allow category access for all groups
                     $categorie_data = array_merge($this->categorie_data, $this->cat_permission_array);
                 }
                 if ($cat_level == $cat_levels) {
                     //On last cat level, check if cat-description is defined
                     //If yes, add all categories info
                     $index = $this->field_index[CAT_DESCRIPTION];
                     if ($index !== false) {
                         for ($i = 0; $i < CAT_FIELDS; $i++) {
                             $field_name = $this->cat_fields_array[$i];
                             $index = $this->field_index[$field_name];
                             if ($index !== false) {
                                 $real_field_name = $this->fields_assoc[$field_name];
                                 $categorie_data[$real_field_name] = $this->dataArray[$index];
                             }
                         }
                     }
                 }
                 olc_db_perform(TABLE_CATEGORIES, $categorie_data);
                 $cat_id = mysql_insert_id();
                 for ($lang = 0; $lang < LANGUAGES; $lang++) {
                     $categorie_data = array(LANG_ID => $this->languages[$lang][ID], CAT_ID => $cat_id, CAT_NAME => stripslashes($cat[$cat_level]));
                     olc_db_perform(TABLE_CATEGORIES_DESCRIPTION, $categorie_data);
                 }
                 $this->CatTreeId[$catTree] = $cat_id;
             }
             $parent = $cat_id;
             $parTree = $catTree;
         }
         olc_db_perform(TABLE_PRODUCTS_TO_CATEGORIES, array(P_ID => $pID, CAT_ID => $cat_id));
     }
 }
Пример #25
0
function olc_array_merge($array1, $array2, $array3 = '')
{
    if ($array3 == '') {
        $array3 = array();
    }
    if (function_exists('array_merge')) {
        $array_merged = array_merge($array1, $array2, $array3);
    } else {
        while (list($key, $val) = each($array1)) {
            $array_merged[$key] = $val;
        }
        while (list($key, $val) = each($array2)) {
            $array_merged[$key] = $val;
        }
        if (sizeof($array3) > 0) {
            while (list($key, $val) = each($array3)) {
                $array_merged[$key] = $val;
            }
        }
    }
    return (array) $array_merged;
}
$cn_query = olc_db_query("select * from " . TABLE_CUSTOMERS . " where customers_newsletter= '1' ");
while ($cn = olc_db_fetch_array($cn_query)) {
    $key = olc_encrypt_password($cn['customers_email_address']);
    $sql_data_array = array('customers_email_address' => olc_db_prepare_input($cn['customers_email_address']), 'customers_id' => olc_db_prepare_input($cn['customers_id']), 'customers_status' => olc_db_prepare_input($cn['customers_status']), 'customers_firstname' => olc_db_prepare_input($cn['customers_firstname']), 'customers_lastname' => olc_db_prepare_input($cn['customers_lastname']), 'mail_status' => '1', 'mail_key' => $key);
    $insert_sql_data = array('date_added' => 'now()');
    $sql_data_array = olc_array_merge($sql_data_array, $insert_sql_data);
    olc_db_perform(TABLE_NEWSLETTER_RECIPIENTS, $sql_data_array);
}
echo 'DONE';
            if ($download_enabled) {
                $attributes_query = "select\n\t\t\t\tpopt.products_options_name,\n\t\t\t\tpoval.products_options_values_name,\n\t\t\t\tpa.options_values_price,\n\t\t\t\tpa.price_prefix,\n\t\t\t\tpad.products_attributes_maxdays,\n\t\t\t\tpad.products_attributes_maxcount,\n\t\t\t\tpad.products_attributes_filename\n\t\t\t\tfrom " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n\t\t\t\tleft join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n\t\t\t\ton pa.products_attributes_id=pad.products_attributes_id\n\t\t\t\twhere\n\t\t\t\tpa.products_id = '" . $current_product_id . "'\n\t\t\t\tand pa.options_id = '" . $current_product_attribute_option_id . "'\n\t\t\t\tand pa.options_id = popt.products_options_id\n\t\t\t\tand pa.options_values_id = '" . $current_product_attribute_value_id . "'\n\t\t\t\tand pa.options_values_id = poval.products_options_values_id\n\t\t\t\tand popt.language_id = '" . SESSION_LANGUAGE_ID . "'\n\t\t\t\tand poval.language_id = '" . SESSION_LANGUAGE_ID . APOS;
                $attributes = olc_db_query($attributes_query);
            } else {
                $attributes = olc_db_query("\n\t\t\t\tselect popt.products_options_name,\n\t\t\t\tpoval.products_options_values_name,\n\t\t\t\tpa.options_values_price,\n\t\t\t\tpa.price_prefix\n\t\t\t\tfrom " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n\t\t\t\twhere pa.products_id = '" . $current_product_id . "'\n\t\t\t\tand pa.options_id = '" . $current_product_attribute_option_id . "'\n\t\t\t\tand pa.options_id = popt.products_options_id\n\t\t\t\tand pa.options_values_id = '" . $current_product_attribute_value_id . "'\n\t\t\t\tand pa.options_values_id = poval.products_options_values_id\n\t\t\t\tand popt.language_id = '" . SESSION_LANGUAGE_ID . "'\n\t\t\t\tand poval.language_id = '" . SESSION_LANGUAGE_ID . APOS);
            }
            // update attribute stock
            olc_db_query(SQL_UPDATE . TABLE_PRODUCTS_ATTRIBUTES . " set\n       attributes_stock=attributes_stock - '" . $current_product_qty . "'\n       where\n       products_id='" . $current_product_id . "'\n       and options_values_id='" . $current_product_attribute_value_id . "'\n       and options_id='" . $current_product_attribute_option_id . "'\n       ");
            $attributes_values = olc_db_fetch_array($attributes);
            $sql_data_array = array('orders_id' => $orders_id, 'orders_products_id' => $order_products_id, 'products_options' => $attributes_values['products_options_name'], 'products_options_values' => $attributes_values['products_options_values_name'], 'options_values_price' => $attributes_values['options_values_price'], 'price_prefix' => $attributes_values['price_prefix']);
            olc_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);
            if ($download_enabled) {
                $products_attributes_filename = $attributes_values['products_attributes_filename'];
                if ($products_attributes_filename) {
                    $sql_data_array = array('orders_id' => $orders_id, 'orders_products_id' => $order_products_id, 'orders_products_filename' => $products_attributes_filename, 'download_maxdays' => $attributes_values['products_attributes_maxdays'], 'download_count' => $attributes_values['products_attributes_maxcount']);
                    olc_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
                }
            }
        }
    }
    //------insert customer choosen option eof ----
    $total_weight += $current_product_qty * $current_product['weight'];
    $total_tax += olc_calculate_tax($total_products_price, $products_tax) * $current_product_qty;
    $total_cost += $total_products_price;
}
// load the after_process function from the payment modules
$payment_modules->after_process();
// NEW EMAIL configuration !
$order_totals = $order_total_modules->apply_credit();
if ($real_checkout || $is_auction) {
    include 'send_order.php';
		}
	}
}
if(is_callable(array($order_total_modules, 'apply_credit')))
$order_total_modules->apply_credit();
*/
// store the session info for notification update - gsb
$sql_data_array = array('sendto' => $sendto, 'billto' => $billto, 'firstname' => $order->billing['firstname'], 'lastname' => $order->billing['lastname'], 'payment' => $payment, 'payment_title' => $this->codeTitle, 'payment_amount' => $this->grossPaymentAmount($this->currency()), 'payment_currency' => $this->currency(), 'payment_currency_val' => $currencies->get_value($this->currency()), 'language' => SESSION_LANGUAGE, 'language_id' => SESSION_LANGUAGE_ID, 'currency' => $currency, 'currency_value' => $currencies->get_value($currency), 'content_type' => $order->content_type, 'txn_signature' => $this->setTransactionID());
if (SHOW_AFFILIATE) {
    // inclusion for affiliate program
    global $affiliate_ref, $affiliate_clickthroughs_id, $affiliate_clientdate, $affiliate_clientbrowser, $affiliate_clientip;
    if (olc_not_null($affiliate_ref)) {
        if (olc_session_is_registered('affiliate_ref')) {
            $sql_data_array['affiliate_id'] = $affiliate_ref;
            $sql_data_array['affiliate_clickthroughs_id'] = $affiliate_clickthroughs_id;
            $sql_data_array['affiliate_date'] = $affiliate_clientdate;
            $sql_data_array['affiliate_browser'] = $affiliate_clientbrowser;
            $sql_data_array['affiliate_ipaddress'] = $affiliate_clientip;
        }
    }
}
if ($session_exists) {
    olc_db_perform(TABLE_ORDERS_SESSION_INFO, $sql_data_array, 'update', $orders_id_param);
    $PayPal_osC->txn_signature = $this->digest;
} else {
    $sql_data_array['orders_id'] = $orders_id;
    olc_db_perform(TABLE_ORDERS_SESSION_INFO, $sql_data_array);
    $PayPal_osC = new PayPal_osC($orders_id, $this->digest);
    olc_session_register('PayPal_osC');
}
//require(PAYPAL_IPN_DIR.'catalog/checkout_splash.inc.php');
         $sql = "\n        SELECT sum(affiliate_payment) as affiliate_payment\n          FROM " . TABLE_AFFILIATE_SALES . "\n          WHERE affiliate_id='" . $affiliate_payment['affiliate_id'] . "' and  affiliate_billing_status=99\n        ";
         $affiliate_billing_query = olc_db_query($sql);
         $affiliate_billing = olc_db_fetch_array($affiliate_billing_query);
         // Get affiliate Informations
         $sql = "\n        SELECT a.*, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id\n          from " . TABLE_AFFILIATE . " a\n          left join " . TABLE_ZONES . " z on (a.affiliate_zone_id  = z.zone_id)\n          left join " . TABLE_COUNTRIES . " c on (a.affiliate_country_id = c.countries_id)\n          WHERE affiliate_id = '" . $affiliate_payment['affiliate_id'] . "'\n        ";
         $affiliate_query = olc_db_query($sql);
         $affiliate = olc_db_fetch_array($affiliate_query);
         // Get need tax informations for the affiliate
         $affiliate_tax_rate = olc_get_affiliate_tax_rate(AFFILIATE_TAX_ID, $affiliate['affiliate_country_id'], $affiliate['affiliate_zone_id']);
         $affiliate_tax = olc_round($affiliate_billing['affiliate_payment'] * $affiliate_tax_rate / 100, 2);
         // Netto-Provision
         $affiliate_payment_total = $affiliate_billing['affiliate_payment'] + $affiliate_tax;
         // Bill the order
         $affiliate['affiliate_state'] = olc_get_zone_code($affiliate['affiliate_country_id'], $affiliate['affiliate_zone_id'], $affiliate['affiliate_state']);
         $sql_data_array = array('affiliate_id' => $affiliate_payment['affiliate_id'], 'affiliate_payment' => $affiliate_billing['affiliate_payment'], 'affiliate_payment_tax' => $affiliate_tax, 'affiliate_payment_total' => $affiliate_payment_total, 'affiliate_payment_date' => 'now()', 'affiliate_payment_status' => '0', 'affiliate_firstname' => $affiliate['affiliate_firstname'], 'affiliate_lastname' => $affiliate['affiliate_lastname'], 'affiliate_street_address' => $affiliate['affiliate_street_address'], 'affiliate_suburb' => $affiliate['affiliate_suburb'], 'affiliate_city' => $affiliate['affiliate_city'], 'affiliate_country' => $affiliate['countries_name'], 'affiliate_postcode' => $affiliate['affiliate_postcode'], 'affiliate_company' => $affiliate['affiliate_company'], 'affiliate_state' => $affiliate['affiliate_state'], 'affiliate_address_format_id' => $affiliate['address_format_id']);
         olc_db_perform(TABLE_AFFILIATE_PAYMENT, $sql_data_array);
         $insert_id = olc_db_insert_id();
         // Set the Sales to Final State
         olc_db_query(SQL_UPDATE . TABLE_AFFILIATE_SALES . " set affiliate_payment_id = '" . $insert_id . "', affiliate_billing_status = 1, affiliate_payment_date = now() where affiliate_id = '" . $affiliate_payment['affiliate_id'] . "' and affiliate_billing_status = 99");
         // Notify Affiliate
         if (AFFILIATE_NOTIFY_AFTER_BILLING == TRUE_STRING_S) {
             $check_status_query = olc_db_query("select af.affiliate_email_address, ap.affiliate_lastname, ap.affiliate_firstname, ap.affiliate_payment_status, ap.affiliate_payment_date, ap.affiliate_payment_date from " . TABLE_AFFILIATE_PAYMENT . " ap, " . TABLE_AFFILIATE . " af where affiliate_payment_id  = '" . $insert_id . "' and af.affiliate_id = ap.affiliate_id ");
             $check_status = olc_db_fetch_array($check_status_query);
             $email = STORE_NAME . NEW_LINE . EMAIL_SEPARATOR . NEW_LINE . EMAIL_TEXT_AFFILIATE_PAYMENT_NUMBER . BLANK . $insert_id . NEW_LINE . EMAIL_TEXT_INVOICE_URL . BLANK . olc_catalog_href_link(FILENAME_CATALOG_AFFILIATE_PAYMENT_INFO, 'payment_id=' . $insert_id, SSL) . NEW_LINE . EMAIL_TEXT_PAYMENT_BILLED . BLANK . olc_date_long($check_status['affiliate_payment_date']) . "\n\n" . EMAIL_TEXT_NEW_PAYMENT;
             olc_mail($check_status['affiliate_firstname'] . BLANK . $check_status['affiliate_lastname'], $check_status['affiliate_email_address'], EMAIL_TEXT_SUBJECT, nl2br($email), STORE_OWNER, AFFILIATE_EMAIL_ADDRESS);
         }
     }
     $messageStack->add_session(SUCCESS_BILLING, 'success');
     olc_redirect(olc_href_link(FILENAME_AFFILIATE_PAYMENT, olc_get_all_get_params(array('action')) . 'action=edit'));
     break;
 case 'update_payment':
             }
             $sql_data_array = array('affiliate_banners_title' => $affiliate_banners_title, 'affiliate_products_id' => $affiliate_products_id, 'affiliate_banners_image' => $db_image_location, 'affiliate_banners_group' => $affiliate_banners_group);
             if ($_GET['action'] == 'insert') {
                 $insert_sql_data = array('affiliate_date_added' => 'now()', 'affiliate_status' => '1');
                 $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
                 olc_db_perform(TABLE_AFFILIATE_BANNERS, $sql_data_array);
                 $affiliate_banners_id = olc_db_insert_id();
                 // Banner id 1 is generic Product Banner
                 if ($affiliate_banners_id == 1) {
                     olc_db_query(SQL_UPDATE . TABLE_AFFILIATE_BANNERS . " set affiliate_banners_id = affiliate_banners_id + 1");
                 }
                 $messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success');
             } elseif ($_GET['action'] == 'update') {
                 $insert_sql_data = array('affiliate_date_status_change' => 'now()');
                 $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
                 olc_db_perform(TABLE_AFFILIATE_BANNERS, $sql_data_array, 'update', 'affiliate_banners_id = \'' . $affiliate_banners_id . '\'');
                 $messageStack->add_session(SUCCESS_BANNER_UPDATED, 'success');
             }
             olc_redirect(olc_href_link(FILENAME_AFFILIATE_BANNER_MANAGER, 'page=' . $_GET['page'] . '&abID=' . $affiliate_banners_id));
         }
     }
     break;
 case 'deleteconfirm':
     $affiliate_banners_id = olc_db_prepare_input($_GET['abID']);
     $delete_image = olc_db_prepare_input($_POST['delete_image']);
     if ($delete_image == 'on') {
         $affiliate_banner_query = olc_db_query("select affiliate_banners_image from " . TABLE_AFFILIATE_BANNERS . " where affiliate_banners_id = '" . olc_db_input($affiliate_banners_id) . APOS);
         $affiliate_banner = olc_db_fetch_array($affiliate_banner_query);
         if (file_exists(DIR_FS_CATALOG_IMAGES . $affiliate_banner['affiliate_banners_image'])) {
             if (is_writeable(DIR_FS_CATALOG_IMAGES . $affiliate_banner['affiliate_banners_image'])) {
                 unlink(DIR_FS_CATALOG_IMAGES . $affiliate_banner['affiliate_banners_image']);
function CustomersUpdate()
{
    global $_POST, $Lang_folder;
    $customers_id = -1;
    // include PW function
    require_once DIR_FS_INC . 'olc_encrypt_password.inc.php';
    if (isset($_POST['cID'])) {
        $customers_id = olc_db_prepare_input($_POST['cID']);
    }
    // security check, if user = admin, dont allow to perform changes
    if ($customers_id != -1) {
        $sec_query = olc_db_query("SELECT customers_status FROM " . TABLE_CUSTOMERS . " where customers_id='" . $customers_id . "'");
        $sec_data = olc_db_fetch_array($sec_query);
        if ($sec_data['customers_status'] == 0) {
            print_xml_status(120, $_POST['action'], 'CAN NOT CHANGE ADMIN USER!', '', '', '');
            return;
        }
    }
    $sql_customers_data_array = array();
    if (isset($_POST['customers_cid'])) {
        $sql_customers_data_array['customers_cid'] = $_POST['customers_cid'];
    }
    if (isset($_POST['customers_firstname'])) {
        $sql_customers_data_array['customers_firstname'] = $_POST['customers_firstname'];
    }
    if (isset($_POST['customers_lastname'])) {
        $sql_customers_data_array['customers_lastname'] = $_POST['customers_lastname'];
    }
    if (isset($_POST['customers_dob'])) {
        $sql_customers_data_array['customers_dob'] = $_POST['customers_dob'];
    }
    if (isset($_POST['customers_email'])) {
        $sql_customers_data_array['customers_email_address'] = $_POST['customers_email'];
    }
    if (isset($_POST['customers_tele'])) {
        $sql_customers_data_array['customers_telephone'] = $_POST['customers_tele'];
    }
    if (isset($_POST['customers_fax'])) {
        $sql_customers_data_array['customers_fax'] = $_POST['customers_fax'];
    }
    if (isset($_POST['customers_gender'])) {
        $sql_customers_data_array['customers_gender'] = $_POST['customers_gender'];
    }
    if (isset($_POST['customers_password'])) {
        $sql_customers_data_array['customers_password'] = olc_encrypt_password($_POST['customers_password']);
    }
    $sql_address_data_array = array();
    if (isset($_POST['customers_firstname'])) {
        $sql_address_data_array['entry_firstname'] = $_POST['customers_firstname'];
    }
    if (isset($_POST['customers_lastname'])) {
        $sql_address_data_array['entry_lastname'] = $_POST['customers_lastname'];
    }
    if (isset($_POST['customers_company'])) {
        $sql_address_data_array['entry_company'] = $_POST['customers_company'];
    }
    if (isset($_POST['customers_street'])) {
        $sql_address_data_array['entry_street_address'] = $_POST['customers_street'];
    }
    if (isset($_POST['customers_city'])) {
        $sql_address_data_array['entry_city'] = $_POST['customers_city'];
    }
    if (isset($_POST['customers_postcode'])) {
        $sql_address_data_array['entry_postcode'] = $_POST['customers_postcode'];
    }
    if (isset($_POST['customers_gender'])) {
        $sql_address_data_array['entry_gender'] = $_POST['customers_gender'];
    }
    if (isset($_POST['customers_country_id'])) {
        $country_code = $_POST['customers_country_id'];
    }
    $country_query = "SELECT countries_id FROM " . TABLE_COUNTRIES . " WHERE countries_iso_code_2 = '" . $country_code . "' LIMIT 1";
    $country_result = olc_db_query($country_query);
    $row = olc_db_fetch_array($country_result);
    $sql_address_data_array['entry_country_id'] = $row['countries_id'];
    $count_query = olc_db_query("SELECT count(*) as count FROM " . TABLE_CUSTOMERS . " WHERE customers_id='" . (int) $customers_id . "' LIMIT 1");
    $check = olc_db_fetch_array($count_query);
    if ($check['count'] > 0) {
        $mode = 'SQL_UPDATE';
        $address_book_result = olc_db_query("SELECT customers_default_address_id FROM " . TABLE_CUSTOMERS . " WHERE customers_id = '" . (int) $customers_id . "' LIMIT 1");
        $customer = olc_db_fetch_array($address_book_result);
        olc_db_perform(TABLE_CUSTOMERS, $sql_customers_data_array, 'update', "customers_id = '" . olc_db_input($customers_id) . "' LIMIT 1");
        olc_db_perform(TABLE_ADDRESS_BOOK, $sql_address_data_array, 'update', "customers_id = '" . olc_db_input($customers_id) . "' AND address_book_id = '" . $customer['customers_default_address_id'] . "' LIMIT 1");
        olc_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_account_last_modified = now() where customers_info_id = '" . (int) $customers_id . "'  LIMIT 1");
    } else {
        $mode = 'APPEND';
        if (strlen($_POST['customers_password']) == 0) {
            // generate PW if empty
            $pw = olc_RandomString(8);
            $sql_customers_data_array['customers_password'] = olc_create_password($pw);
        }
        olc_db_perform(TABLE_CUSTOMERS, $sql_customers_data_array);
        $customers_id = olc_db_insert_id();
        $sql_address_data_array['customers_id'] = $customers_id;
        olc_db_perform(TABLE_ADDRESS_BOOK, $sql_address_data_array);
        $address_id = olc_db_insert_id();
        olc_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int) $address_id . "' where customers_id = '" . (int) $customers_id . "'");
        olc_db_query("update " . TABLE_CUSTOMERS . " set customers_status = '" . STANDARD_GROUP . "' where customers_id = '" . (int) $customers_id . "'");
        olc_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int) $customers_id . "', '0', now())");
    }
    if (SEND_ACCOUNT_MAIL == true && $mode == 'APPEND' && $sql_customers_data_array['customers_email_address'] != '') {
        // generate mail for customer if customer=new
        require_once DIR_WS_CLASSES . 'class.phpmailer.php';
        require_once DIR_FS_INC . 'olc_php_mail.inc.php';
        require_once DIR_FS_INC . 'olc_add_tax.inc.php';
        require_once DIR_FS_INC . 'olc_not_null.inc.php';
        require_once DIR_FS_INC . 'changedataout.inc.php';
        require_once DIR_FS_INC . 'olc_href_link.inc.php';
        require_once DIR_FS_INC . 'olc_date_long.inc.php';
        require_once DIR_FS_INC . 'olc_check_agent.inc.php';
        $smarty = new Smarty();
        //$smarty->assign('language', $check_status['language']);
        $smarty->assign('language', $Lang_folder);
        $smarty->caching = false;
        $smarty->template_dir = DIR_FS_CATALOG . 'templates';
        $smarty->compile_dir = DIR_FS_CATALOG . 'cache/templates_c';
        $smarty->config_dir = DIR_FS_CATALOG . 'lang';
        $smarty->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
        $smarty->assign('logo_path', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/images/');
        $smarty->assign('NAME', $sql_customers_data_array['customers_lastname'] . ' ' . $sql_customers_data_array['customers_firstname']);
        $smarty->assign('EMAIL', $sql_customers_data_array['customers_email_address']);
        $smarty->assign('PASSWORD', $pw);
        //$smarty->assign('language', $Lang_folder);
        $smarty->assign('content', $module_content);
        $smarty->caching = false;
        $html_mail = $smarty->fetch(CURRENT_TEMPLATE . '/admin/mail/' . $Lang_folder . '/create_account_mail.html');
        $txt_mail = $smarty->fetch(CURRENT_TEMPLATE . '/admin/mail/' . $Lang_folder . '/create_account_mail.txt');
        // send mail with html/txt template
        olc_php_mail(EMAIL_SUPPORT_ADDRESS, EMAIL_SUPPORT_NAME, $sql_customers_data_array['customers_email_address'], $sql_customers_data_array['customers_lastname'] . ' ' . $sql_customers_data_array['customers_firstname'], '', EMAIL_SUPPORT_REPLY_ADDRESS, EMAIL_SUPPORT_REPLY_ADDRESS_NAME, '', '', EMAIL_SUPPORT_SUBJECT, $html_mail, $txt_mail);
    }
    print_xml_status(0, $_POST['action'], 'OK', $mode, 'CUSTOMERS_ID', $customers_id);
}