#1 (permalink)  
Alt 25.06.2011, 18:58
Neuer Benutzer
 
Registriert seit: 25.09.2005
Beiträge: 1
Standard Wer installiert mir das PayPal Modul?

Hallo,

hat jemand Lust mir ein PayPal Modul zu installieren?
Ich kriege es leider nicht hin!

Ich würde mich über Hilfe sehr freuen!

LG
Christian
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #2 (permalink)  
Alt 28.06.2011, 14:12
Neuer Benutzer
 
Registriert seit: 22.06.2011
Beiträge: 18
Standard

das express ist kein ding so lange du das alte xtc verwendest sag einfach bescheid :-)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #3 (permalink)  
Alt 28.07.2011, 07:21
Neuer Benutzer
 
Registriert seit: 28.07.2011
Beiträge: 3
Standard

hallo speedbike24. Ich könnte auch Hilfe gebrauchen. Was brauchst du für die Installation von Paypal express?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #4 (permalink)  
Alt 28.07.2011, 20:37
Neuer Benutzer
 
Registriert seit: 22.06.2011
Beiträge: 18
Standard Hallo

Also entweder ich sende dir das modul zu und wir machen das zusamen über einen live chat oder ich muss in dein Admin selber rein dafür muss ich mich über deinen ftp zugang und in denn admin berreich deines shops.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #5 (permalink)  
Alt 03.08.2011, 20:05
Neuer Benutzer
 
Registriert seit: 28.07.2011
Beiträge: 3
Standard Paypal Express

Hallo, habe das Modul installiert und bekomme folgende Fehlermeldung nachdem ich die Einstellungen speichern will.

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /mnt/webf/c0/99/51710799/htdocs/shop/admin/configuration.php:1) in /mnt/webf/c0/99/51710799/htdocs/shop/admin/includes/application_top.php on line 338

Warning: Cannot modify header information - headers already sent by (output started at /mnt/webf/c0/99/51710799/htdocs/shop/admin/configuration.php:1) in /mnt/webf/c0/99/51710799/htdocs/shop/admin/includes/functions/general.php on line 130

meine admin/configuration.php
<?php
/* --------------------------------------------------------------
$Id: configuration.php 1125 2005-07-28 09:59:44Z novalis $

XT-Commerce - community made shopping
xt:Commerce - Shopsoftware für Onlineshops und Ecommerce Lösungen

Copyright (c) 2003 XT-Commerce
--------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project (earlier name of osCommerce)
(c) 2002-2003 osCommerce(configuration.php,v 1.40 2002/12/29); osCommerce, Open Source Online Shop E-Commerce Solutions
(c) 2003 nextcommerce (configuration.php,v 1.16 2003/08/19); nextcommerce.org

Released under the GNU General Public License
--------------------------------------------------------------*/

require('includes/application_top.php');

if ($_GET['action']) {
switch ($_GET['action']) {
case 'save':

$configuration_query = xtc_db_query("select configuration_key,configuration_id, configuration_value, use_function,set_function from " . TABLE_CONFIGURATION . " where configuration_group_id = '" . (int)$_GET['gID'] . "' order by sort_order");

while ($configuration = xtc_db_fetch_array($configuration_query))
xtc_db_query("UPDATE ".TABLE_CONFIGURATION." SET configuration_value='".$_POST[$configuration['configuration_key']]."' where configuration_key='".$configuration['configuration_key']."'");

xtc_redirect(FILENAME_CONFIGURATION. '?gID=' . (int)$_GET['gID']);
break;

}
}

$cfg_group_query = xtc_db_query("select configuration_group_title from " . TABLE_CONFIGURATION_GROUP . " where configuration_group_id = '" . (int)$_GET['gID'] . "'");
$cfg_group = xtc_db_fetch_array($cfg_group_query);
?>
<!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 echo $_SESSION['language_charset']; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script type="text/javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
<td class="columnLeft2" width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td class="boxCenter" width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="80" rowspan="2"><?php echo xtc_image(DIR_WS_ICONS.'conf.png'); ?></td>
<td class="pageHeading"><?php echo $cfg_group['configuration_group_title']; ?></td>
</tr>
<tr>
<td class="main" valign="top">xt:Commerce Configuration</td>
</tr>
</table> </td>
</tr>
<tr>
<td style="border-top: 3px solid; border-color: #cccccc;" class="main"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<?php
switch ($_GET['gID']) {
case 21:
echo AFTERBUY_URL;
case 19:

echo '<table width="100%">
<tr class="dataTableHeadingRow">
<td width="150" align="center">
<a class="button" href="'.xtc_href_link(FILENAME_CONFIGURATION, 'gID=21', 'NONSSL').'">Afterbuy</a>
</td>
<td width="1">|
</td>
<td width="150" align="center">
<a class="button" href="'.xtc_href_link(FILENAME_CONFIGURATION, 'gID=19', 'NONSSL').'">Google Conversion</a>
</td>
<td width="1">|
</td>
<td width="150" align="center">
<a class="button" href="'.xtc_href_link(FILENAME_CONFIGURATION, 'gID=24', 'NONSSL').'">x-check</a>
</td>
<td width="1">|
</td>
<td width="150" align="center">
<a class="button" href="'.xtc_href_link(FILENAME_CONFIGURATION, 'gID=25', 'NONSSL').'">Paypal</a>
</td>
<td width="1">|
</td>
<td>
</td>
</tr>
</table>';

break;
}
?>


<tr>
<td valign="top" align="right">

<?php echo xtc_draw_form('configuration', FILENAME_CONFIGURATION, 'gID=' . (int)$_GET['gID'] . '&action=save'); ?>
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<?php
$configuration_query = xtc_db_query("select configuration_key,configuration_id, configuration_value, use_function,set_function from " . TABLE_CONFIGURATION . " where configuration_group_id = '" . (int)$_GET['gID'] . "' order by sort_order");

while ($configuration = xtc_db_fetch_array($configuration_query)) {
if ($_GET['gID'] == 6) {
switch ($configuration['configuration_key']) {
case 'MODULE_PAYMENT_INSTALLED':
if ($configuration['configuration_value'] != '') {
$payment_installed = explode(';', $configuration['configuration_value']);
for ($i = 0, $n = sizeof($payment_installed); $i < $n; $i++) {
include(DIR_FS_CATALOG_LANGUAGES . $language . '/modules/payment/' . $payment_installed[$i]);
}
}
break;

case 'MODULE_SHIPPING_INSTALLED':
if ($configuration['configuration_value'] != '') {
$shipping_installed = explode(';', $configuration['configuration_value']);
for ($i = 0, $n = sizeof($shipping_installed); $i < $n; $i++) {
include(DIR_FS_CATALOG_LANGUAGES . $language . '/modules/shipping/' . $shipping_installed[$i]);
}
}
break;

case 'MODULE_ORDER_TOTAL_INSTALLED':
if ($configuration['configuration_value'] != '') {
$ot_installed = explode(';', $configuration['configuration_value']);
for ($i = 0, $n = sizeof($ot_installed); $i < $n; $i++) {
include(DIR_FS_CATALOG_LANGUAGES . $language . '/modules/order_total/' . $ot_installed[$i]);
}
}
break;
}
}
if (xtc_not_null($configuration['use_function'])) {
$use_function = $configuration['use_function'];
if (ereg('->', $use_function)) {
$class_method = explode('->', $use_function);
if (!is_object(${$class_method[0]})) {
include(DIR_WS_CLASSES . $class_method[0] . '.php');
${$class_method[0]} = new $class_method[0]();
}
$cfgValue = xtc_call_function($class_method[1], $configuration['configuration_value'], ${$class_method[0]});
} else {
$cfgValue = xtc_call_function($use_function, $configuration['configuration_value']);
}
} else {
$cfgValue = $configuration['configuration_value'];
}

if (((!$_GET['cID']) || (@$_GET['cID'] == $configuration['configuration_id'])) && (!$cInfo) && (substr($_GET['action'], 0, 3) != 'new')) {
$cfg_extra_query = xtc_db_query("select configuration_key,configuration_value, date_added, last_modified, use_function, set_function from " . TABLE_CONFIGURATION . " where configuration_id = '" . $configuration['configuration_id'] . "'");
$cfg_extra = xtc_db_fetch_array($cfg_extra_query);

$cInfo_array = xtc_array_merge($configuration, $cfg_extra);
$cInfo = new objectInfo($cInfo_array);
}
if ($configuration['set_function']) {
eval('$value_field = ' . $configuration['set_function'] . '"' . htmlspecialchars($configuration['configuration_value']) . '");');
} else {
$value_field = xtc_draw_input_field($configuration['configuration_key'], $configuration['configuration_value'],'size=40');
}
// add

if (strstr($value_field,'configuration_value')) $value_field=str_replace('configuration_value',$co nfiguration['configuration_key'],$value_field);

echo '
<tr>
<td width="300" valign="top" class="dataTableContent"><b>'.constant(strtoupper( $configuration['configuration_key'].'_TITLE')).'</b></td>
<td valign="top" class="dataTableContent">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="dataTableContentConfig">'.$value_field.'</td>
</tr>
</table>
<br />'.constant(strtoupper( $configuration['configuration_key'].'_DESC')).'</td>
</tr>
';

}
?>
</table>
<?php echo '<input type="submit" class="button" onClick="this.blur();" value="' . BUTTON_SAVE . '"/>'; ?></form>
</td>

</tr>
</table></td>
</tr>
</table></td>
<!-- body_text_eof //-->
</tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br />
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Was ist falsch ?
Gruß Ralf
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #6 (permalink)  
Alt 05.08.2011, 10:53
Neuer Benutzer
 
Registriert seit: 22.06.2011
Beiträge: 18
Standard Hallo

kommt die fehlermeldung auch im adimin oben oder nur auf der seite ?welches paypal modul hast du eingebaut? ich kann dir eins schicken somit der einbau bei mir immer auf anhieb funktioniert hat

lg
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #7 (permalink)  
Alt 05.08.2011, 10:57
Neuer Benutzer
 
Registriert seit: 22.06.2011
Beiträge: 18
Standard

müste aber ein bug sein ich schaue gleich mal rein muss erstmal was anderes fertig machen
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #8 (permalink)  
Alt 05.08.2011, 11:02
Neuer Benutzer
 
Registriert seit: 22.06.2011
Beiträge: 18
Standard

kannst du mal die datein posten damit ich mir die runterladen kann und bearbeiten ich denke lingt an der coniguration.php weil wie die hier gepostet ist sind da ja so schon fehler trinn ich brauche mal das original zum bearbeitn.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #9 (permalink)  
Alt 05.08.2011, 11:12
Neuer Benutzer
 
Registriert seit: 22.06.2011
Beiträge: 18
Standard

ist vor dem <?php am anfang ein leerzeichen oder änliches?
schaue mal bei allen datein die du bearnbeitet hast also bei denn php datein

ob vor dem <?php irgendetwas ist wenn ja löschen

so warte mal deine antwort ab.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
  #10 (permalink)  
Alt 05.08.2011, 17:02
Neuer Benutzer
 
Registriert seit: 28.07.2011
Beiträge: 3
Standard

habe alles durchgesehen in keiner php steht vor <?php etwas.

der fehler tritt im admin bereich auf.

Das Modul habe ich hier runtergeladen.
PayPal Express-Kaufabwicklung für xt:Commerce

dateien:
<?php
/* --------------------------------------------------------------
$Id: application_top.php 1323 2005-10-27 17:58:08Z mz $

XT-Commerce - community made shopping
xt:Commerce - Shopsoftware für Onlineshops und Ecommerce Lösungen

Copyright (c) 2003 XT-Commerce
--------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project (earlier name of osCommerce)
(c) 2002-2003 osCommerce(application_top.php,v 1.158 2003/03/22); osCommerce, Open Source Online Shop E-Commerce Solutions
(c) 2003 nextcommerce (application_top.php,v 1.46 2003/08/24); nextcommerce.org

Released under the GNU General Public License
--------------------------------------------------------------
Third Party contribution:

Customers Status v3.x (c) 2002-2003 Copyright Elari elari@free.fr | unlockgsm.com: The Leading Unlocked GSM Site on the Net | CVS : http://cvs.sourceforge.net/cgi-bin/v...y=date#dirlist

Credit Class/Gift Vouchers/Discount Coupons (Version 5.10)
osCommerce: Credit Class & Gift Voucher
Copyright (c) Strider | Strider@oscworks.com
Copyright (c Nick Stanko of UkiDev.com, nick@ukidev.com
Copyright (c) Andre ambidex@gmx.net
Copyright (c) 2001,2002 Ian C Wilson http://www.phesis.org

Released under the GNU General Public License
--------------------------------------------------------------*/

// Start the clock for the page parse time log
define('PAGE_PARSE_START_TIME', microtime());

// security
define('_VALID_XTC',true);

// Set the level of error reporting
error_reporting(E_ALL & ~E_NOTICE);

// Disable use_trans_sid as xtc_href_link() does this manually
if (function_exists('ini_set')) {
ini_set('session.use_trans_sid', 0);
}

// Set the local configuration parameters - mainly for developers or the main-configure
if (file_exists('includes/local/configure.php')) {
include('includes/local/configure.php');
} else {
require('includes/configure.php');
}

define('SQL_CACHEDIR',DIR_FS_CATALOG.'cache/');

// Define the project version
define('PROJECT_VERSION', 'xt:Commerce v3.0.4 SP2.1');

// Set the length of the redeem code, the longer the more secure
define('SECURITY_CODE_LENGTH', '6');

// Used in the "Backup Manager" to compress backups
define('LOCAL_EXE_GZIP', '/usr/bin/gzip');
define('LOCAL_EXE_GUNZIP', '/usr/bin/gunzip');
define('LOCAL_EXE_ZIP', '/usr/local/bin/zip');
define('LOCAL_EXE_UNZIP', '/usr/local/bin/unzip');

// define the filenames used in the project
define('FILENAME_ACCOUNTING', 'accounting.php');
define('FILENAME_BACKUP', 'backup.php');
define('FILENAME_BANNER_MANAGER', 'banner_manager.php');
define('FILENAME_BANNER_STATISTICS', 'banner_statistics.php');
define('FILENAME_CACHE', 'cache.php');
define('FILENAME_CAMPAIGNS', 'campaigns.php');
define('FILENAME_CATALOG_ACCOUNT_HISTORY_INFO', 'account_history_info.php');
define('FILENAME_CATALOG_NEWSLETTER', 'newsletter.php');
define('FILENAME_CATEGORIES', 'categories.php');
define('FILENAME_CONFIGURATION', 'configuration.php');
define('FILENAME_COUNTRIES', 'countries.php');
define('FILENAME_CURRENCIES', 'currencies.php');
define('FILENAME_CUSTOMERS', 'customers.php');
define('FILENAME_CUSTOMERS_STATUS', 'customers_status.php');
define('FILENAME_DEFAULT', 'start.php');
define('FILENAME_DEFINE_LANGUAGE', 'define_language.php');
define('FILENAME_FORMS', 'forms.php');
define('FILENAME_FORM_VALUES', 'form_values.php');
define('FILENAME_GEO_ZONES', 'geo_zones.php');
define('FILENAME_LANGUAGES', 'languages.php');
define('FILENAME_MAIL', 'mail.php');
define('FILENAME_MANUFACTURERS', 'manufacturers.php');
define('FILENAME_MODULES', 'modules.php');
define('FILENAME_ORDERS', 'orders.php');
define('FILENAME_ORDERS_INVOICE', 'invoice.php');
define('FILENAME_ORDERS_PACKINGSLIP', 'packingslip.php');
define('FILENAME_ORDERS_STATUS', 'orders_status.php');
define('FILENAME_ORDERS_EDIT', 'orders_edit.php');
define('FILENAME_POPUP_IMAGE', 'popup_image.php');
define('FILENAME_PRODUCTS_ATTRIBUTES', 'products_attributes.php');
define('FILENAME_PRODUCTS_EXPECTED', 'products_expected.php');
define('FILENAME_REVIEWS', 'reviews.php');
define('FILENAME_SERVER_INFO', 'server_info.php');
define('FILENAME_SHIPPING_MODULES', 'shipping_modules.php');
define('FILENAME_SPECIALS', 'specials.php');
define('FILENAME_STATS_CUSTOMERS', 'stats_customers.php');
define('FILENAME_STATS_PRODUCTS_PURCHASED', 'stats_products_purchased.php');
define('FILENAME_STATS_PRODUCTS_VIEWED', 'stats_products_viewed.php');
define('FILENAME_TAX_CLASSES', 'tax_classes.php');
define('FILENAME_TAX_RATES', 'tax_rates.php');
define('FILENAME_WHOS_ONLINE', 'whos_online.php');
define('FILENAME_ZONES', 'zones.php');
define('FILENAME_START', 'start.php');
define('FILENAME_STATS_STOCK_WARNING', 'stats_stock_warning.php');
define('FILENAME_TPL_BOXES','templates_boxes.php') ;
define('FILENAME_TPL_MODULES','templates_modules.p hp');
define('FILENAME_NEW_ATTRIBUTES','new_attributes.p hp');
define('FILENAME_LOGOUT','../logoff.php');
define('FILENAME_LOGIN','../login.php');
define('FILENAME_CREATE_ACCOUNT','create_account.p hp');
define('FILENAME_CREATE_ACCOUNT_SUCCESS','create_a ccount_success.php');
define('FILENAME_CUSTOMER_MEMO','customer_memo.php ');
define('FILENAME_CONTENT_MANAGER','content_manager .php');
define('FILENAME_CONTENT_PREVIEW','content_preview .php');
define('FILENAME_SECURITY_CHECK','security_check.p hp');
define('FILENAME_PRINT_ORDER','print_order.php');
define('FILENAME_CREDITS','credits.php');
define('FILENAME_PRINT_PACKINGSLIP','print_packing slip.php');
define('FILENAME_MODULE_NEWSLETTER','module_newsle tter.php');
define('FILENAME_GV_QUEUE', 'gv_queue.php');
define('FILENAME_GV_MAIL', 'gv_mail.php');
define('FILENAME_GV_SENT', 'gv_sent.php');
define('FILENAME_COUPON_ADMIN', 'coupon_admin.php');
define('FILENAME_POPUP_MEMO', 'popup_memo.php');
define('FILENAME_SHIPPING_STATUS', 'shipping_status.php');
define('FILENAME_SALES_REPORT','stats_sales_report .php');
define('FILENAME_MODULE_EXPORT','module_export.php ');
define('FILENAME_EASY_POPULATE','easypopulate.php' );
define('FILENAME_BLACKLIST', 'blacklist.php');
define('FILENAME_PRODUCTS_VPE','products_vpe.php') ;
define('FILENAME_CAMPAIGNS_REPORT','stats_campaign s.php');
define('FILENAME_XSELL_GROUPS','cross_sell_groups. php');

// define the database table names used in the project
define('TABLE_ADDRESS_BOOK', 'address_book');
define('TABLE_ADDRESS_FORMAT', 'address_format');
define('TABLE_ADMIN_ACCESS', 'admin_access');
define('TABLE_BANNERS', 'banners');
define('TABLE_BANNERS_HISTORY', 'banners_history');
define('TABLE_CAMPAIGNS', 'campaigns');
define('TABLE_CATEGORIES', 'categories');
define('TABLE_CATEGORIES_DESCRIPTION', 'categories_description');
define('TABLE_CONFIGURATION', 'configuration');
define('TABLE_CONFIGURATION_GROUP', 'configuration_group');
define('TABLE_TPL_MODULES_CONFIGURATION', 'tpl_modules_configuration ');
define('TABLE_COUNTRIES', 'countries');
define('TABLE_CURRENCIES', 'currencies');
define('TABLE_CUSTOMERS', 'customers');
define('TABLE_CUSTOMERS_BASKET', 'customers_basket');
define('TABLE_CUSTOMERS_BASKET_ATTRIBUTES', 'customers_basket_attributes');
define('TABLE_CUSTOMERS_INFO', 'customers_info');
define('TABLE_CUSTOMERS_IP', 'customers_ip');
define('TABLE_CUSTOMERS_STATUS', 'customers_status');
define('TABLE_CUSTOMERS_STATUS_HISTORY', 'customers_status_history');
define('TABLE_FORMS', 'forms');
define('TABLE_LANGUAGES', 'languages');
define('TABLE_MANUFACTURERS', 'manufacturers');
define('TABLE_MANUFACTURERS_INFO', 'manufacturers_info');
define('TABLE_NEWSLETTERS', 'newsletters');
define('TABLE_NEWSLETTERS_HISTORY', 'newsletters_history');
define('TABLE_NEWSLETTER_RECIPIENTS', 'newsletter_recipients');
define('TABLE_ORDERS', 'orders');
define('TABLE_ORDERS_PRODUCTS', 'orders_products');
define('TABLE_ORDERS_PRODUCTS_ATTRIBUTES', 'orders_products_attributes');
define('TABLE_ORDERS_PRODUCTS_DOWNLOAD', 'orders_products_download');
define('TABLE_ORDERS_STATUS', 'orders_status');
define('TABLE_ORDERS_STATUS_HISTORY', 'orders_status_history');
define('TABLE_ORDERS_TOTAL', 'orders_total');
define('TABLE_ORDERS_RECALCULATE', 'orders_recalculate');
define('TABLE_PERSONAL_OFFERS_BY','personal_offers _by_customers_status_');
define('TABLE_PRODUCTS', 'products');
define('TABLE_PRODUCTS_ATTRIBUTES', 'products_attributes');
define('TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD', 'products_attributes_download');
define('TABLE_PRODUCTS_CONTENT','products_content' );
define('TABLE_PRODUCTS_DESCRIPTION', 'products_description');
define('TABLE_PRODUCTS_NOTIFICATIONS', 'products_notifications');
define('TABLE_PRODUCTS_IMAGES', 'products_images');
define('TABLE_PRODUCTS_OPTIONS', 'products_options');
define('TABLE_PRODUCTS_OPTIONS_VALUES', 'products_options_values');
define('TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_ OPTIONS', 'products_options_values_to_products_options');
define('TABLE_PRODUCTS_TO_CATEGORIES', 'products_to_categories');
define('TABLE_PRODUCTS_VPE','products_vpe');
define('TABLE_PRODUCTS_XSELL','products_xsell');
define('TABLE_PRODUCTS_XSELL_GROUPS','products_xse ll_grp_name');
define('TABLE_REVIEWS', 'reviews');
define('TABLE_REVIEWS_DESCRIPTION', 'reviews_description');
define('TABLE_SESSIONS', 'sessions');
define('TABLE_SPECIALS', 'specials');
define('TABLE_TAX_CLASS', 'tax_class');
define('TABLE_TAX_RATES', 'tax_rates');
define('TABLE_TPL_MODULES_CONFIGURATION', 'tpl_modules_configuration');
define('TABLE_GEO_ZONES', 'geo_zones');
define('TABLE_ZONES_TO_GEO_ZONES', 'zones_to_geo_zones');
define('TABLE_WHOS_ONLINE', 'whos_online');
define('TABLE_ZONES', 'zones');
define('TABLE_BOX_ALIGN','box_align');
define('TABLE_CUSTOMERS_MEMO','customers_memo');
define('TABLE_CONTENT_MANAGER','content_manager');
define('TABLE_MEDIA_CONTENT','media_content');
define('TABLE_MODULE_NEWSLETTER','module_newslette r');
define('TABLE_CM_FILE_FLAGS', 'cm_file_flags');
define('TABLE_COUPON_GV_QUEUE', 'coupon_gv_queue');
define('TABLE_COUPON_GV_CUSTOMER', 'coupon_gv_customer');
define('TABLE_COUPON_EMAIL_TRACK', 'coupon_email_track');
define('TABLE_COUPON_REDEEM_TRACK', 'coupon_redeem_track');
define('TABLE_COUPONS', 'coupons');
define('TABLE_COUPONS_DESCRIPTION', 'coupons_description');
define('TABLE_SERVER_TRACKING', 'server_tracking');
define('TABLE_SHIPPING_STATUS', 'shipping_status');
define('TABLE_BLACKLIST', 'card_blacklist');
define('TABLE_CAMPAIGNS_IP','campaigns_ip');


// include needed functions
require_once(DIR_FS_INC . 'xtc_db_connect.inc.php');
require_once(DIR_FS_INC . 'xtc_db_close.inc.php');
require_once(DIR_FS_INC . 'xtc_db_error.inc.php');
require_once(DIR_FS_INC . 'xtc_db_query.inc.php');
require_once(DIR_FS_INC . 'xtc_db_queryCached.inc.php');
require_once(DIR_FS_INC . 'xtc_db_perform.inc.php');
require_once(DIR_FS_INC . 'xtc_db_fetch_array.inc.php');
require_once(DIR_FS_INC . 'xtc_db_num_rows.inc.php');
require_once(DIR_FS_INC . 'xtc_db_data_seek.inc.php');
require_once(DIR_FS_INC . 'xtc_db_insert_id.inc.php');
require_once(DIR_FS_INC . 'xtc_db_free_result.inc.php');
require_once(DIR_FS_INC . 'xtc_db_fetch_fields.inc.php');
require_once(DIR_FS_INC . 'xtc_db_output.inc.php');
require_once(DIR_FS_INC . 'xtc_db_input.inc.php');
require_once(DIR_FS_INC . 'xtc_db_prepare_input.inc.php');
require_once(DIR_FS_INC . 'xtc_get_ip_address.inc.php');
require_once(DIR_FS_INC . 'xtc_setcookie.inc.php');
require_once(DIR_FS_INC . 'xtc_validate_email.inc.php');
require_once(DIR_FS_INC . 'xtc_not_null.inc.php');
require_once(DIR_FS_INC . 'xtc_add_tax.inc.php');
require_once(DIR_FS_INC . 'xtc_get_tax_rate.inc.php');
require_once(DIR_FS_INC . 'xtc_get_qty.inc.php');
require_once(DIR_FS_INC . 'xtc_product_link.inc.php');
require_once(DIR_FS_INC . 'xtc_cleanName.inc.php');


// customization for the design layout
define('BOX_WIDTH', 125); // how wide the boxes should be in pixels (default: 125)

// Define how do we update currency exchange rates
// Possible values are 'oanda' 'xe' or ''
define('CURRENCY_SERVER_PRIMARY', 'oanda');
define('CURRENCY_SERVER_BACKUP', 'xe');

// Use the DB-Logger
define('STORE_DB_TRANSACTIONS', 'false');

// include the database functions
// require(DIR_WS_FUNCTIONS . 'database.php');

// make a connection to the database... now
xtc_db_connect() or die('Unable to connect to database server!');

// set application wide parameters
$configuration_query = xtc_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION . '');
while ($configuration = xtc_db_fetch_array($configuration_query)) {
define($configuration['cfgKey'], $configuration['cfgValue']);
}

define('FILENAME_IMAGEMANIPULATOR',IMAGE_MANIPULAT OR);
function xtDBquery($query) {
if (DB_CACHE=='true') {
$result=xtc_db_queryCached($query);
//echo 'cached query: '.$query.'<br>';
} else {
$result=xtc_db_query($query);
}
return $result;
}


// initialize the logger class
require(DIR_WS_CLASSES . 'logger.php');

// include shopping cart class
require(DIR_WS_CLASSES . 'shopping_cart.php');

// some code to solve compatibility issues
require(DIR_WS_FUNCTIONS . 'compatibility.php');

require(DIR_WS_FUNCTIONS . 'general.php');


// define how the session functions will be used
require(DIR_WS_FUNCTIONS . 'sessions.php');

// define our general functions used application-wide
require(DIR_WS_FUNCTIONS . 'html_output.php');

// set the session name and save path
session_name('XTCsid');
if (STORE_SESSIONS != 'mysql') session_save_path(SESSION_WRITE_DIRECTORY);

// set the session cookie parameters
if (function_exists('session_set_cookie_params')) {
session_set_cookie_params(0, '/', (xtc_not_null($current_domain) ? '.' . $current_domain : ''));
} elseif (function_exists('ini_set')) {
ini_set('session.cookie_lifetime', '0');
ini_set('session.cookie_path', '/');
ini_set('session.cookie_domain', (xtc_not_null($current_domain) ? '.' . $current_domain : ''));
}

// set the session ID if it exists
if (isset($_POST[session_name()])) {
session_id($_POST[session_name()]);
} elseif ( ($request_type == 'SSL') && isset($_GET[session_name()]) ) {
session_id($_GET[session_name()]);
}

// start the session
$session_started = false;
if (SESSION_FORCE_COOKIE_USE == 'True') {
xtc_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, '/', $current_domain);

if (isset($HTTP_COOKIE_VARS['cookie_test'])) {
session_start();
$session_started = true;
}
} elseif (CHECK_CLIENT_AGENT == 'True') {
$user_agent = strtolower(getenv('HTTP_USER_AGENT'));
$spider_flag = false;

if ($spider_flag == false) {
session_start();
$session_started = true;
}
} else {
session_start();
$session_started = true;
}

// verify the ssl_session_id if the feature is enabled
if ( ($request_type == 'SSL') && (SESSION_CHECK_SSL_SESSION_ID == 'True') && (ENABLE_SSL == true) && ($session_started == true) ) {
$ssl_session_id = getenv('SSL_SESSION_ID');
if (!session_is_registered('SSL_SESSION_ID')) {
$_SESSION['SESSION_SSL_ID'] = $ssl_session_id;
}

if ($_SESSION['SESSION_SSL_ID'] != $ssl_session_id) {
session_destroy();
xtc_redirect(xtc_href_link(FILENAME_SSL_CHECK));
}
}

// verify the browser user agent if the feature is enabled
if (SESSION_CHECK_USER_AGENT == 'True') {
$http_user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
$http_user_agent2 = strtolower(getenv("HTTP_USER_AGENT"));
$http_user_agent = ($http_user_agent == $http_user_agent2) ? $http_user_agent : $http_user_agent.';'.$http_user_agent2;
if (!isset($_SESSION['SESSION_USER_AGENT'])) {
$_SESSION['SESSION_USER_AGENT'] = $http_user_agent;
}

if ($_SESSION['SESSION_USER_AGENT'] != $http_user_agent) {
session_destroy();
xtc_redirect(xtc_href_link(FILENAME_LOGIN));
}
}


// verify the IP address if the feature is enabled
if (SESSION_CHECK_IP_ADDRESS == 'True') {
$ip_address = xtc_get_ip_address();
if (!xtc_session_is_registered('SESSION_IP_ADDRESS')) {
$_SESSION['SESSION_IP_ADDRESS'] = $ip_address;
}

if ($_SESSION['SESSION_IP_ADDRESS'] != $ip_address) {
session_destroy();
xtc_redirect(xtc_href_link(FILENAME_LOGIN));
}
}

// set the language
if (!isset($_SESSION['language']) || isset($_GET['language'])) {

include(DIR_WS_CLASSES . 'language.php');
$lng = new language($_GET['language']);

if (!isset($_GET['language'])) $lng->get_browser_language();

$_SESSION['language'] = $lng->language['directory'];
$_SESSION['languages_id'] = $lng->language['id'];
}

// include the language translations
require(DIR_FS_LANGUAGES . $_SESSION['language'] . '/admin/'.$_SESSION['language'] . '.php');
require(DIR_FS_LANGUAGES . $_SESSION['language'] . '/admin/buttons.php');
$current_page = split('\?', basename($_SERVER['PHP_SELF'])); $current_page = $current_page[0]; // for BadBlue(Win32) webserver compatibility
if (file_exists(DIR_FS_LANGUAGES . $_SESSION['language'] . '/admin/'.$current_page)) {
include(DIR_FS_LANGUAGES . $_SESSION['language'] . '/admin/'. $current_page);
}

// write customers status in session
require('../' . DIR_WS_INCLUDES . 'write_customers_status.php');


// for tracking of customers
$_SESSION['user_info'] = array();
if (!$_SESSION['user_info']['user_ip']) {
$_SESSION['user_info']['user_ip'] = $_SERVER['REMOTE_ADDR'];
// $user_info['user_ip_date'] = value will be in fact added when login ;
$_SESSION['user_info']['user_host'] = gethostbyaddr( $_SERVER['REMOTE_ADDR'] );;
$_SESSION['user_info']['advertiser'] = $_GET['ad'];
$_SESSION['user_info']['referer_url'] = $_SERVER['HTTP_REFERER'];
}


// define our localization functions
require(DIR_WS_FUNCTIONS . 'localization.php');

// Include validation functions (right now only email address)
//require(DIR_WS_FUNCTIONS . 'validations.php');

// setup our boxes
require(DIR_WS_CLASSES . 'table_block.php');
require(DIR_WS_CLASSES . 'box.php');

// initialize the message stack for output messages
require(DIR_WS_CLASSES . 'message_stack.php');
$messageStack = new messageStack;

// split-page-results
require(DIR_WS_CLASSES . 'split_page_results.php');

// entry/item info classes
require(DIR_WS_CLASSES . 'object_info.php');


// file uploading class
require(DIR_WS_CLASSES . 'upload.php');

// calculate category path
if (isset($_GET['cPath'])) {
$cPath = $_GET['cPath'];
} else {
$cPath = '';
}
if (strlen($cPath) > 0) {
$cPath_array = explode('_', $cPath);
$current_category_id = $cPath_array[(sizeof($cPath_array)-1)];
} else {
$current_category_id = 0;
}

// default open navigation box
if (!isset($_SESSION['selected_box'])) {
$_SESSION['selected_box'] = 'configuration';
}
if (isset($_GET['selected_box'])) {
$_SESSION['selected_box'] = $_GET['selected_box'];
}

// the following cache blocks are used in the Tools->Cache section
// ('language' in the filename is automatically replaced by available languages)
$cache_blocks = array(array('title' => TEXT_CACHE_CATEGORIES, 'code' => 'categories', 'file' => 'categories_box-language.cache', 'multiple' => true),
array('title' => TEXT_CACHE_MANUFACTURERS, 'code' => 'manufacturers', 'file' => 'manufacturers_box-language.cache', 'multiple' => true),
array('title' => TEXT_CACHE_ALSO_PURCHASED, 'code' => 'also_purchased', 'file' => 'also_purchased-language.cache', 'multiple' => true)
);

// check if a default currency is set
if (!defined('DEFAULT_CURRENCY')) {
$messageStack->add(ERROR_NO_DEFAULT_CURRENCY_DEFINED, 'error');
}

// check if a default language is set
if (!defined('DEFAULT_LANGUAGE')) {
$messageStack->add(ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
}

// for Customers Status
xtc_get_customers_statuses();



$pagename = strtok($current_page, '.');
if (!isset($_SESSION['customer_id'])) {
xtc_redirect(xtc_href_link(FILENAME_LOGIN));
}

if (xtc_check_permission($pagename) == '0') {
xtc_redirect(xtc_href_link(FILENAME_LOGIN));
}


// Include Template Engine
require(DIR_FS_CATALOG.DIR_WS_CLASSES . 'Smarty_2.6.14/Smarty.class.php');


?>


dateien:
<?php

/* --------------------------------------------------------------
$Id: general.php 1316 2005-10-21 15:30:58Z mz $

XT-Commerce - community made shopping
xt:Commerce - Shopsoftware für Onlineshops und Ecommerce Lösungen

Copyright (c) 2003 XT-Commerce
--------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project (earlier name of osCommerce)
(c) 2002-2003 osCommerce(general.php,v 1.156 2003/05/29); osCommerce, Open Source Online Shop E-Commerce Solutions
(c) 2003 nextcommerce (general.php,v 1.35 2003/08/1); nextcommerce.org

Released under the GNU General Public License
--------------------------------------------------------------
Third Party contributions:

Customers Status v3.x (c) 2002-2003 Copyright Elari elari@free.fr | unlockgsm.com: The Leading Unlocked GSM Site on the Net | CVS : http://cvs.sourceforge.net/cgi-bin/v...y=date#dirlist

Enable_Disable_Categories 1.3 Autor: Mikel Williams | mikel@ladykatcostumes.com

Category Descriptions (Version: 1.5 MS2) Original Author: Brian Lowe <blowe@wpcusrgrp.org> | Editor: Lord Illicious <shaolin-venoms@illicious.net>

Credit Class/Gift Vouchers/Discount Coupons (Version 5.10)
osCommerce: Credit Class & Gift Voucher
Copyright (c) Strider | Strider@oscworks.com
Copyright (c Nick Stanko of UkiDev.com, nick@ukidev.com
Copyright (c) Andre ambidex@gmx.net
Copyright (c) 2001,2002 Ian C Wilson http://www.phesis.org

Released under the GNU General Public License
--------------------------------------------------------------*/
defined( '_VALID_XTC' ) or die( 'Direct Access to this location is not allowed.' );
function clear_string($value) {

$string = str_replace("'", '', $value);
$string = str_replace(')', '', $string);
$string = str_replace('(', '', $string);
$array = explode(',', $string);
return $array;

}

function check_stock($products_id) {
unset ($stock_flag);
$stock_query = xtc_db_query("SELECT products_quantity FROM ".TABLE_PRODUCTS." where products_id = '".$products_id."'");
$stock_values = xtc_db_fetch_array($stock_query);
if ($stock_values['products_quantity'] <= '0') {
$stock_flag = 'true';
$stock_warn = TEXT_WARN_MAIN;

$attribute_stock_query = xtc_db_query("SELECT attributes_stock, options_values_id FROM ".TABLE_PRODUCTS_ATTRIBUTES." where products_id = '".$products_id."'");
while ($attribute_stock_values = xtc_db_fetch_array($attribute_stock_query)) {
if ($attribute_stock_values['attributes_stock'] <= '0') {
$stock_flag = 'true';
$which_attribute_query = xtDBquery("SELECT products_options_values_name FROM ".TABLE_PRODUCTS_OPTIONS_VALUES." WHERE products_options_values_id = '".$attribute_stock_values['options_values_id']."' AND language_id = '".$_SESSION['languages_id']."'");
$which_attribute = xtc_db_fetch_array($which_attribute_query);
$stock_warn .= ', '.$which_attribute['products_options_values_name'];
}
}
}
if ($stock_flag == 'true' && $products_id != '') {
return '<div class="stock_warn">'.$stock_warn.'</div>';
} else {
return xtc_image(DIR_WS_IMAGES.'icon_status_green.gif', $stock_values['products_quantity'].' '.IMAGE_ICON_STATUS_GREEN_STOCK, 10, 10);
}
}

// Set Categorie Status
function xtc_set_categories_status($categories_id, $status) {
if ($status == '1') {
return xtc_db_query("update ".TABLE_CATEGORIES." set categories_status = '1' where categories_id = '".$categories_id."'");
}
elseif ($status == '0') {
return xtc_db_query("update ".TABLE_CATEGORIES." set categories_status = '0' where categories_id = '".$categories_id."'");
} else {
return -1;
}
}

function xtc_set_groups($categories_id, $permission_array) {

// get products in categorie
$products_query = xtc_db_query("SELECT products_id FROM ".TABLE_PRODUCTS_TO_CATEGORIES." where categories_id='".$categories_id."'");
while ($products = xtc_db_fetch_array($products_query)) {
xtc_db_perform(TABLE_PRODUCTS, $permission_array, 'update', 'products_id = \''.$products['products_id'].'\'');
}
// set status of categorie
xtc_db_perform(TABLE_CATEGORIES, $permission_array, 'update', 'categories_id = \''.$categories_id.'\'');
// look for deeper categories and go rekursiv
$categories_query = xtc_db_query("SELECT categories_id FROM ".TABLE_CATEGORIES." where parent_id='".$categories_id."'");
while ($categories = xtc_db_fetch_array($categories_query)) {
xtc_set_groups($categories['categories_id'], $permission_array);
}

}

// Set Admin Access Rights
function xtc_set_admin_access($fieldname, $status, $cID) {
if ($status == '1') {
return xtc_db_query("update ".TABLE_ADMIN_ACCESS." set ".$fieldname." = '1' where customers_id = '".$cID."'");
} else {
return xtc_db_query("update ".TABLE_ADMIN_ACCESS." set ".$fieldname." = '0' where customers_id = '".$cID."'");
}
}

// Check whether a referer has enough permission to open an admin page
function xtc_check_permission($pagename) {
if ($pagename != 'index') {
$access_permission_query = xtc_db_query("select ".$pagename." from ".TABLE_ADMIN_ACCESS." where customers_id = '".$_SESSION['customer_id']."'");
$access_permission = xtc_db_fetch_array($access_permission_query);

if (($_SESSION['customers_status']['customers_status_id'] == '0') && ($access_permission[$pagename] == '1')) {
return true;
} else {
return false;
}
} else {
xtc_redirect(xtc_href_link(FILENAME_LOGIN));
}
}

////
// Redirect to another page or site
function xtc_redirect($url) {
global $logger;

header('Location: '.$url);

if (STORE_PAGE_PARSE_TIME == 'true') {
if (!is_object($logger))
$logger = new logger;
$logger->timer_stop();
}

exit;
}

function xtc_customers_name($customers_id) {
$customers = xtc_db_query("select customers_firstname, customers_lastname from ".TABLE_CUSTOMERS." where customers_id = '".$customers_id."'");
$customers_values = xtc_db_fetch_array($customers);

return $customers_values['customers_firstname'].' '.$customers_values['customers_lastname'];
}

function xtc_get_path($current_category_id = '') {
global $cPath_array;

if ($current_category_id == '') {
$cPath_new = implode('_', $cPath_array);
} else {
if (sizeof($cPath_array) == 0) {
$cPath_new = $current_category_id;
} else {
$cPath_new = '';
$last_category_query = xtc_db_query("select parent_id from ".TABLE_CATEGORIES." where categories_id = '".$cPath_array[(sizeof($cPath_array) - 1)]."'");
$last_category = xtc_db_fetch_array($last_category_query);
$current_category_query = xtc_db_query("select parent_id from ".TABLE_CATEGORIES." where categories_id = '".$current_category_id."'");
$current_category = xtc_db_fetch_array($current_category_query);
if ($last_category['parent_id'] == $current_category['parent_id']) {
for ($i = 0, $n = sizeof($cPath_array) - 1; $i < $n; $i ++) {
$cPath_new .= '_'.$cPath_array[$i];
}
} else {
for ($i = 0, $n = sizeof($cPath_array); $i < $n; $i ++) {
$cPath_new .= '_'.$cPath_array[$i];
}
}
$cPath_new .= '_'.$current_category_id;
if (substr($cPath_new, 0, 1) == '_') {
$cPath_new = substr($cPath_new, 1);
}
}
}

return 'cPath='.$cPath_new;
}

function xtc_get_all_get_params($exclude_array = '') {

if ($exclude_array == '')
$exclude_array = array ();

$get_url = '';

reset($_GET);
while (list ($key, $value) = each($_GET)) {
if (($key != session_name()) && ($key != 'error') && (!xtc_in_array($key, $exclude_array)))
$get_url .= $key.'='.$value.'&';
}

return $get_url;
}

function xtc_date_long($raw_date) {
if (($raw_date == '0000-00-00 00:00:00') || ($raw_date == ''))
return false;

$year = (int) substr($raw_date, 0, 4);
$month = (int) substr($raw_date, 5, 2);
$day = (int) substr($raw_date, 8, 2);
$hour = (int) substr($raw_date, 11, 2);
$minute = (int) substr($raw_date, 14, 2);
$second = (int) substr($raw_date, 17, 2);

return strftime(DATE_FORMAT_LONG, mktime($hour, $minute, $second, $month, $day, $year));
}

////
// Output a raw date string in the selected locale date format
// $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS
// NOTE: Includes a workaround for dates before 01/01/1970 that fail on windows servers
function xtc_date_short($raw_date) {
if (($raw_date == '0000-00-00 00:00:00') || ($raw_date == ''))
return false;

$year = substr($raw_date, 0, 4);
$month = (int) substr($raw_date, 5, 2);
$day = (int) substr($raw_date, 8, 2);
$hour = (int) substr($raw_date, 11, 2);
$minute = (int) substr($raw_date, 14, 2);
$second = (int) substr($raw_date, 17, 2);

if (@ date('Y', mktime($hour, $minute, $second, $month, $day, $year)) == $year) {
return date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, $year));
} else {
return ereg_replace('2037'.'$', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037)));
}

}

function xtc_datetime_short($raw_datetime) {
if (($raw_datetime == '0000-00-00 00:00:00') || ($raw_datetime == ''))
return false;

$year = (int) substr($raw_datetime, 0, 4);
$month = (int) substr($raw_datetime, 5, 2);
$day = (int) substr($raw_datetime, 8, 2);
$hour = (int) substr($raw_datetime, 11, 2);
$minute = (int) substr($raw_datetime, 14, 2);
$second = (int) substr($raw_datetime, 17, 2);

return strftime(DATE_TIME_FORMAT, mktime($hour, $minute, $second, $month, $day, $year));
}

function xtc_array_merge($array1, $array2, $array3 = '') {
if (!is_array($array1)) { $array1 = array (); }
if (!is_array($array2)) { $array2 = array (); }
if (!is_array($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;
}

function xtc_in_array($lookup_value, $lookup_array) {
if (function_exists('in_array')) {
if (in_array($lookup_value, $lookup_array))
return true;
} else {
reset($lookup_array);
while (list ($key, $value) = each($lookup_array)) {
if ($value == $lookup_value)
return true;
}
}

return false;
}

function xtc_get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false) {

if (!is_array($category_tree_array))
$category_tree_array = array ();
if ((sizeof($category_tree_array) < 1) && ($exclude != '0'))
$category_tree_array[] = array ('id' => '0', 'text' => TEXT_TOP);

if ($include_itself) {
$category_query = xtc_db_query("select cd.categories_name from ".TABLE_CATEGORIES_DESCRIPTION." cd where cd.language_id = '".$_SESSION['languages_id']."' and cd.categories_id = '".$parent_id."'");
$category = xtc_db_fetch_array($category_query);
$category_tree_array[] = array ('id' => $parent_id, 'text' => $category['categories_name']);
}

$categories_query = xtc_db_query("select c.categories_id, cd.categories_name, c.parent_id from ".TABLE_CATEGORIES." c, ".TABLE_CATEGORIES_DESCRIPTION." cd where c.categories_id = cd.categories_id and cd.language_id = '".$_SESSION['languages_id']."' and c.parent_id = '".$parent_id."' order by c.sort_order, cd.categories_name");
while ($categories = xtc_db_fetch_array($categories_query)) {
if ($exclude != $categories['categories_id'])
$category_tree_array[] = array ('id' => $categories['categories_id'], 'text' => $spacing.$categories['categories_name']);
$category_tree_array = xtc_get_category_tree($categories['categories_id'], $spacing.'&nbsp;&nbsp;&nbsp;', $exclude, $category_tree_array);
}

return $category_tree_array;
}

function xtc_draw_products_pull_down($name, $parameters = '', $exclude = '') {
global $currencies;

if ($exclude == '') {
$exclude = array ();
}
$select_string = '<select name="'.$name.'"';
if ($parameters) {
$select_string .= ' '.$parameters;
}
$select_string .= '>';
$products_query = xtc_db_query("select p.products_id, pd.products_name,p.products_tax_class_id, p.products_price from ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_DESCRIPTION." pd where p.products_id = pd.products_id and pd.language_id = '".$_SESSION['languages_id']."' order by products_name");
while ($products = xtc_db_fetch_array($products_query)) {
if (!xtc_in_array($products['products_id'], $exclude)) {
//brutto admin:
if (PRICE_IS_BRUTTO == 'true') {
$products['products_price'] = xtc_round($products['products_price'] * ((100 + xtc_get_tax_rate($products['products_tax_class_id'])) / 100), PRICE_PRECISION);
}
$select_string .= '<option value="'.$products['products_id'].'">'.$products['products_name'].' ('.xtc_round($products['products_price'], PRICE_PRECISION).')</option>';
}
}
$select_string .= '</select>';

return $select_string;
}

function xtc_options_name($options_id) {

$options = xtc_db_query("select products_options_name from ".TABLE_PRODUCTS_OPTIONS." where products_options_id = '".$options_id."' and language_id = '".$_SESSION['languages_id']."'");
$options_values = xtc_db_fetch_array($options);

return $options_values['products_options_name'];
}

function xtc_values_name($values_id) {

$values = xtc_db_query("select products_options_values_name from ".TABLE_PRODUCTS_OPTIONS_VALUES." where products_options_values_id = '".$values_id."' and language_id = '".$_SESSION['languages_id']."'");
$values_values = xtc_db_fetch_array($values);

return $values_values['products_options_values_name'];
}

function xtc_info_image($image, $alt, $width = '', $height = '') {
if (($image) && (file_exists(DIR_FS_CATALOG_IMAGES.$image))) {
$image = xtc_image(DIR_WS_CATALOG_IMAGES.$image, $alt, $width, $height);
} else {
$image = TEXT_IMAGE_NONEXISTENT;
}

return $image;
}

function xtc_info_image_c($image, $alt, $width = '', $height = '') {
if (($image) && (file_exists(DIR_FS_CATALOG_IMAGES.'categories/'.$image))) {
$image = xtc_image(DIR_WS_CATALOG_IMAGES.'categories/'.$image, $alt, $width, $height);
} else {
$image = TEXT_IMAGE_NONEXISTENT;
}

return $image;
}

function xtc_product_thumb_image($image, $alt, $width = '', $height = '') {
if (($image) && (file_exists(DIR_FS_CATALOG_THUMBNAIL_IMAGES.$imag e))) {
$image = xtc_image(DIR_WS_CATALOG_THUMBNAIL_IMAGES.$image, $alt, $width, $height);
} else {
$image = TEXT_IMAGE_NONEXISTENT;
}

return $image;
}

function xtc_break_string($string, $len, $break_char = '-') {
$l = 0;
$output = '';
for ($i = 0; $i < strlen($string); $i ++) {
$char = substr($string, $i, 1);
if ($char != ' ') {
$l ++;
} else {
$l = 0;
}
if ($l > $len) {
$l = 1;
$output .= $break_char;
}
$output .= $char;
}

return $output;
}

function xtc_get_country_name($country_id) {
$country_query = xtc_db_query("select countries_name from ".TABLE_COUNTRIES." where countries_id = '".$country_id."'");

if (!xtc_db_num_rows($country_query)) {
return $country_id;
} else {
$country = xtc_db_fetch_array($country_query);
return $country['countries_name'];
}
}

function xtc_get_zone_name($country_id, $zone_id, $default_zone) {
$zone_query = xtc_db_query("select zone_name from ".TABLE_ZONES." where zone_country_id = '".$country_id."' and zone_id = '".$zone_id."'");
if (xtc_db_num_rows($zone_query)) {
$zone = xtc_db_fetch_array($zone_query);
return $zone['zone_name'];
} else {
return $default_zone;
}
}

function xtc_browser_detect($component) {

return stristr($_SERVER['HTTP_USER_AGENT'], $component);
}

function xtc_tax_classes_pull_down($parameters, $selected = '') {
$select_string = '<select '.$parameters.'>';
$classes_query = xtc_db_query("select tax_class_id, tax_class_title from ".TABLE_TAX_CLASS." order by tax_class_title");
while ($classes = xtc_db_fetch_array($classes_query)) {
$select_string .= '<option value="'.$classes['tax_class_id'].'"';
if ($selected == $classes['tax_class_id'])
$select_string .= ' SELECTED';
$select_string .= '>'.$classes['tax_class_title'].'</option>';
}
$select_string .= '</select>';

return $select_string;
}

function xtc_geo_zones_pull_down($parameters, $selected = '') {
$select_string = '<select '.$parameters.'>';
$zones_query = xtc_db_query("select geo_zone_id, geo_zone_name from ".TABLE_GEO_ZONES." order by geo_zone_name");
while ($zones = xtc_db_fetch_array($zones_query)) {
$select_string .= '<option value="'.$zones['geo_zone_id'].'"';
if ($selected == $zones['geo_zone_id'])
$select_string .= ' SELECTED';
$select_string .= '>'.$zones['geo_zone_name'].'</option>';
}
$select_string .= '</select>';

return $select_string;
}

function xtc_get_geo_zone_name($geo_zone_id) {
$zones_query = xtc_db_query("select geo_zone_name from ".TABLE_GEO_ZONES." where geo_zone_id = '".$geo_zone_id."'");

if (!xtc_db_num_rows($zones_query)) {
$geo_zone_name = $geo_zone_id;
} else {
$zones = xtc_db_fetch_array($zones_query);
$geo_zone_name = $zones['geo_zone_name'];
}

return $geo_zone_name;
}

function xtc_address_format($address_format_id, $address, $html, $boln, $eoln) {
$address_format_query = xtc_db_query("select address_format as format from ".TABLE_ADDRESS_FORMAT." where address_format_id = '".$address_format_id."'");
$address_format = xtc_db_fetch_array($address_format_query);

$company = addslashes($address['company']);
$firstname = addslashes($address['firstname']);
$cid = addslashes($address['csID']);
$lastname = addslashes($address['lastname']);
$street = addslashes($address['street_address']);
$suburb = addslashes($address['suburb']);
$city = addslashes($address['city']);
$state = addslashes($address['state']);
$country_id = $address['country_id'];
$zone_id = $address['zone_id'];
$postcode = addslashes($address['postcode']);
$zip = $postcode;
$country = xtc_get_country_name($country_id);
$state = xtc_get_zone_code($country_id, $zone_id, $state);

if ($html) {
// HTML Mode
$HR = '<hr />';
$hr = '<hr />';
if (($boln == '') && ($eoln == "\n")) { // Values not specified, use rational defaults
$CR = '<br />';
$cr = '<br />';
$eoln = $cr;
} else { // Use values supplied
$CR = $eoln.$boln;
$cr = $CR;
}
} else {
// Text Mode
$CR = $eoln;
$cr = $CR;
$HR = '----------------------------------------';
$hr = '----------------------------------------';
}

$statecomma = '';
$streets = $street;
if ($suburb != '')
$streets = $street.$cr.$suburb;
if ($firstname == '')
$firstname = addslashes($address['name']);
if ($country == '')
$country = addslashes($address['country']);
if ($state != '')
$statecomma = $state.', ';

$fmt = $address_format['format'];
eval ("\$address = \"$fmt\";");
$address = stripslashes($address);

if ((ACCOUNT_COMPANY == 'true') && (xtc_not_null($company))) {
$address = $company.$cr.$address;
}

return $address;
}

////////////////////////////////////////////////////////////////////////////////////////////////
//
// Function : xtc_get_zone_code
//
// Arguments : country country code string
// zone state/province zone_id
// def_state default string if zone==0
//
// Return : state_prov_code state/province code
//
// Description : Function to retrieve the state/province code (as in FL for Florida etc)
//
////////////////////////////////////////////////////////////////////////////////////////////////
function xtc_get_zone_code($country, $zone, $def_state) {

$state_prov_query = xtc_db_query("select zone_code from ".TABLE_ZONES." where zone_country_id = '".$country."' and zone_id = '".$zone."'");

if (!xtc_db_num_rows($state_prov_query)) {
$state_prov_code = $def_state;
} else {
$state_prov_values = xtc_db_fetch_array($state_prov_query);
$state_prov_code = $state_prov_values['zone_code'];
}

return $state_prov_code;
}

function xtc_get_uprid($prid, $params) {
$uprid = $prid;
if ((is_array($params)) && (!strstr($prid, '{'))) {
while (list ($option, $value) = each($params)) {
$uprid = $uprid.'{'.$option.'}'.$value;
}
}

return $uprid;
}

function xtc_get_prid($uprid) {
$pieces = explode('{', $uprid);

return $pieces[0];
}

function xtc_get_languages() {
$languages_query = xtc_db_query("select languages_id, name, code, image, directory from ".TABLE_LANGUAGES." order by sort_order");
while ($languages = xtc_db_fetch_array($languages_query)) {
$languages_array[] = array ('id' => $languages['languages_id'], 'name' => $languages['name'], 'code' => $languages['code'], 'image' => $languages['image'], 'directory' => $languages['directory']);
}

return $languages_array;
}

function xtc_get_categories_name($category_id, $language_id) {
$category_query = xtc_db_query("select categories_name from ".TABLE_CATEGORIES_DESCRIPTION." where categories_id = '".$category_id."' and language_id = '".$language_id."'");
$category = xtc_db_fetch_array($category_query);

return $category['categories_name'];
}

function xtc_get_categories_heading_title($category_id, $language_id) {
$category_query = xtc_db_query("select categories_heading_title from ".TABLE_CATEGORIES_DESCRIPTION." where categories_id = '".$category_id."' and language_id = '".$language_id."'");
$category = xtc_db_fetch_array($category_query);
return $category['categories_heading_title'];
}

function xtc_get_categories_description($category_id, $language_id) {
$category_query = xtc_db_query("select categories_description from ".TABLE_CATEGORIES_DESCRIPTION." where categories_id = '".$category_id."' and language_id = '".$language_id."'");
$category = xtc_db_fetch_array($category_query);

return $category['categories_description'];
}

function xtc_get_categories_meta_title($category_id, $language_id) {
$category_query = xtc_db_query("select categories_meta_title from ".TABLE_CATEGORIES_DESCRIPTION." where categories_id = '".$category_id."' and language_id = '".$language_id."'");
$category = xtc_db_fetch_array($category_query);

return $category['categories_meta_title'];
}

function xtc_get_categories_meta_description($category_id, $language_id) {
$category_query = xtc_db_query("select categories_meta_description from ".TABLE_CATEGORIES_DESCRIPTION." where categories_id = '".$category_id."' and language_id = '".$language_id."'");
$category = xtc_db_fetch_array($category_query);

return $category['categories_meta_description'];
}

function xtc_get_categories_meta_keywords($category_id, $language_id) {
$category_query = xtc_db_query("select categories_meta_keywords from ".TABLE_CATEGORIES_DESCRIPTION." where categories_id = '".$category_id."' and language_id = '".$language_id."'");
$category = xtc_db_fetch_array($category_query);

return $category['categories_meta_keywords'];
}

function xtc_get_orders_status_name($orders_status_id, $language_id = '') {

if (!$language_id)
$language_id = $_SESSION['languages_id'];
$orders_status_query = xtc_db_query("select orders_status_name from ".TABLE_ORDERS_STATUS." where orders_status_id = '".$orders_status_id."' and language_id = '".$language_id."'");
$orders_status = xtc_db_fetch_array($orders_status_query);

return $orders_status['orders_status_name'];
}

function xtc_get_cross_sell_name($cross_sell_group, $language_id = '') {

if (!$language_id)
$language_id = $_SESSION['languages_id'];
$cross_sell_query = xtc_db_query("select groupname from ".TABLE_PRODUCTS_XSELL_GROUPS." where products_xsell_grp_name_id = '".$cross_sell_group."' and language_id = '".$language_id."'");
$cross_sell = xtc_db_fetch_array($cross_sell_query);

return $cross_sell['groupname'];
}



function xtc_get_shipping_status_name($shipping_status_id, $language_id = '') {

if (!$language_id)
$language_id = $_SESSION['languages_id'];
$shipping_status_query = xtc_db_query("select shipping_status_name from ".TABLE_SHIPPING_STATUS." where shipping_status_id = '".$shipping_status_id."' and language_id = '".$language_id."'");
$shipping_status = xtc_db_fetch_array($shipping_status_query);

return $shipping_status['shipping_status_name'];
}

function xtc_get_orders_status() {

$orders_status_array = array ();
$orders_status_query = xtc_db_query("select orders_status_id, orders_status_name from ".TABLE_ORDERS_STATUS." where language_id = '".$_SESSION['languages_id']."' order by orders_status_id");
while ($orders_status = xtc_db_fetch_array($orders_status_query)) {
$orders_status_array[] = array ('id' => $orders_status['orders_status_id'], 'text' => $orders_status['orders_status_name']);
}

return $orders_status_array;
}

function xtc_get_cross_sell_groups() {

$cross_sell_array = array ();
$cross_sell_query = xtc_db_query("select products_xsell_grp_name_id, groupname from ".TABLE_PRODUCTS_XSELL_GROUPS." where language_id = '".$_SESSION['languages_id']."' order by products_xsell_grp_name_id");
while ($cross_sell = xtc_db_fetch_array($cross_sell_query)) {
$cross_sell_array[] = array ('id' => $cross_sell['products_xsell_grp_name_id'], 'text' => $cross_sell['groupname']);
}

return $cross_sell_array;
}



function xtc_get_products_vpe_name($products_vpe_id, $language_id = '') {

if (!$language_id)
$language_id = $_SESSION['languages_id'];
$products_vpe_query = xtc_db_query("select products_vpe_name from ".TABLE_PRODUCTS_VPE." where products_vpe_id = '".$products_vpe_id."' and language_id = '".$language_id."'");
$products_vpe = xtc_db_fetch_array($products_vpe_query);

return $products_vpe['products_vpe_name'];
}

function xtc_get_shipping_status() {

$shipping_status_array = array ();
$shipping_status_query = xtc_db_query("select shipping_status_id, shipping_status_name from ".TABLE_SHIPPING_STATUS." where language_id = '".$_SESSION['languages_id']."' order by shipping_status_id");
while ($shipping_status = xtc_db_fetch_array($shipping_status_query)) {
$shipping_status_array[] = array ('id' => $shipping_status['shipping_status_id'], 'text' => $shipping_status['shipping_status_name']);
}

return $shipping_status_array;
}

function xtc_get_products_name($product_id, $language_id = 0) {

if ($language_id == 0)
$language_id = $_SESSION['languages_id'];
$product_query = xtc_db_query("select products_name from ".TABLE_PRODUCTS_DESCRIPTION." where products_id = '".$product_id."' and language_id = '".$language_id."'");
$product = xtc_db_fetch_array($product_query);

return $product['products_name'];
}

function xtc_get_products_description($product_id, $language_id) {
$product_query = xtc_db_query("select products_description from ".TABLE_PRODUCTS_DESCRIPTION." where products_id = '".$product_id."' and language_id = '".$language_id."'");
$product = xtc_db_fetch_array($product_query);

return $product['products_description'];
}

function xtc_get_products_short_description($product_id, $language_id) {
$product_query = xtc_db_query("select products_short_description from ".TABLE_PRODUCTS_DESCRIPTION." where products_id = '".$product_id."' and language_id = '".$language_id."'");
$product = xtc_db_fetch_array($product_query);

return $product['products_short_description'];
}

function xtc_get_products_keywords($product_id, $language_id) {
$product_query = xtc_db_query("select products_keywords from ".TABLE_PRODUCTS_DESCRIPTION." where products_id = '".$product_id."' and language_id = '".$language_id."'");
$product = xtc_db_fetch_array($product_query);

return $product['products_keywords'];
}

function xtc_get_products_meta_title($product_id, $language_id) {
$product_query = xtc_db_query("select products_meta_title from ".TABLE_PRODUCTS_DESCRIPTION." where products_id = '".$product_id."' and language_id = '".$language_id."'");
$product = xtc_db_fetch_array($product_query);

return $product['products_meta_title'];
}

function xtc_get_products_meta_description($product_id, $language_id) {
$product_query = xtc_db_query("select products_meta_description from ".TABLE_PRODUCTS_DESCRIPTION." where products_id = '".$product_id."' and language_id = '".$language_id."'");
$product = xtc_db_fetch_array($product_query);

return $product['products_meta_description'];
}

function xtc_get_products_meta_keywords($product_id, $language_id) {
$product_query = xtc_db_query("select products_meta_keywords from ".TABLE_PRODUCTS_DESCRIPTION." where products_id = '".$product_id."' and language_id = '".$language_id."'");
$product = xtc_db_fetch_array($product_query);

return $product['products_meta_keywords'];
}

function xtc_get_products_url($product_id, $language_id) {
$product_query = xtc_db_query("select products_url from ".TABLE_PRODUCTS_DESCRIPTION." where products_id = '".$product_id."' and language_id = '".$language_id."'");
$product = xtc_db_fetch_array($product_query);

return $product['products_url'];
}

////
// Return the manufacturers URL in the needed language
// TABLES: manufacturers_info
function xtc_get_manufacturer_url($manufacturer_id, $language_id) {
$manufacturer_query = xtc_db_query("select manufacturers_url from ".TABLE_MANUFACTURERS_INFO." where manufacturers_id = '".$manufacturer_id."' and languages_id = '".$language_id."'");
$manufacturer = xtc_db_fetch_array($manufacturer_query);

return $manufacturer['manufacturers_url'];
}

////
// Wrapper for class_exists() function
// This function is not available in all PHP versions so we test it before using it.
function xtc_class_exists($class_name) {
if (function_exists('class_exists')) {
return class_exists($class_name);
} else {
return true;
}
}

////
// Returns an array with countries
// TABLES: countries
function xtc_get_countries($default = '') {
$countries_array = array ();
if ($default) {
$countries_array[] = array ('id' => STORE_COUNTRY, 'text' => $default);
}
$countries_query = xtc_db_query("select countries_id, countries_name from ".TABLE_COUNTRIES." order by countries_name");
while ($countries = xtc_db_fetch_array($countries_query)) {
$countries_array[] = array ('id' => $countries['countries_id'], 'text' => $countries['countries_name']);
}

return $countries_array;
}



////
// return an array with country zones
function xtc_get_country_zones($country_id) {
$zones_array = array ();
$zones_query = xtc_db_query("select zone_id, zone_name from ".TABLE_ZONES." where zone_country_id = '".$country_id."' order by zone_name");
while ($zones = xtc_db_fetch_array($zones_query)) {
$zones_array[] = array ('id' => $zones['zone_id'], 'text' => $zones['zone_name']);
}

return $zones_array;
}

function xtc_prepare_country_zones_pull_down($country_id = '') {
// preset the width of the drop-down for Netscape
$pre = '';
if ((!xtc_browser_detect('MSIE')) && (xtc_browser_detect('Mozilla/4'))) {
for ($i = 0; $i < 45; $i ++)
$pre .= '&nbsp;';
}

$zones = xtc_get_country_zones($country_id);

if (sizeof($zones) > 0) {
$zones_select = array (array ('id' => '', 'text' => PLEASE_SELECT));
$zones = xtc_array_merge($zones_select, $zones);
} else {
$zones = array (array ('id' => '', 'text' => TYPE_BELOW));
// create dummy options for Netscape to preset the height of the drop-down
if ((!xtc_browser_detect('MSIE')) && (xtc_browser_detect('Mozilla/4'))) {
for ($i = 0; $i < 9; $i ++) {
$zones[] = array ('id' => '', 'text' => $pre);
}
}
}

return $zones;
}

////
// Get list of address_format_id's
function xtc_get_address_formats() {
$address_format_query = xtc_db_query("select address_format_id from ".TABLE_ADDRESS_FORMAT." order by address_format_id");
$address_format_array = array ();
while ($address_format_values = xtc_db_fetch_array($address_format_query)) {
$address_format_array[] = array ('id' => $address_format_values['address_format_id'], 'text' => $address_format_values['address_format_id']);
}
return $address_format_array;
}

////
// Alias function for Store configuration values in the Administration Tool
function xtc_cfg_pull_down_country_list($country_id) {
return xtc_draw_pull_down_menu('configuration_value', xtc_get_countries(), $country_id);
}

function xtc_cfg_pull_down_zone_list($zone_id) {
return xtc_draw_pull_down_menu('configuration_value', xtc_get_country_zones(STORE_COUNTRY), $zone_id);
}

function xtc_cfg_pull_down_tax_classes($tax_class_id, $key = '') {
$name = (($key) ? 'configuration['.$key.']' : 'configuration_value');

$tax_class_array = array (array ('id' => '0', 'text' => TEXT_NONE));
$tax_class_query = xtc_db_query("select tax_class_id, tax_class_title from ".TABLE_TAX_CLASS." order by tax_class_title");
while ($tax_class = xtc_db_fetch_array($tax_class_query)) {
$tax_class_array[] = array ('id' => $tax_class['tax_class_id'], 'text' => $tax_class['tax_class_title']);
}

return xtc_draw_pull_down_menu($name, $tax_class_array, $tax_class_id);
}

////
// Function to read in text area in admin
function xtc_cfg_textarea($text) {
return xtc_draw_textarea_field('configuration_value', false, 35, 5, $text);
}

function xtc_cfg_get_zone_name($zone_id) {
$zone_query = xtc_db_query("select zone_name from ".TABLE_ZONES." where zone_id = '".$zone_id."'");

if (!xtc_db_num_rows($zone_query)) {
return $zone_id;
} else {
$zone = xtc_db_fetch_array($zone_query);
return $zone['zone_name'];
}
}

////
// Sets the status of a banner
function xtc_set_banner_status($banners_id, $status) {
if ($status == '1') {
return xtc_db_query("update ".TABLE_BANNERS." set status = '1', expires_impressions = NULL, expires_date = NULL, date_status_change = NULL where banners_id = '".$banners_id."'");
}
elseif ($status == '0') {
return xtc_db_query("update ".TABLE_BANNERS." set status = '0', date_status_change = now() where banners_id = '".$banners_id."'");
} else {
return -1;
}
}

////
// Sets the status of a product on special
function xtc_set_specials_status($specials_id, $status) {
if ($status == '1') {
return xtc_db_query("update ".TABLE_SPECIALS." set status = '1', expires_date = NULL, date_status_change = NULL where specials_id = '".$specials_id."'");
}
elseif ($status == '0') {
return xtc_db_query("update ".TABLE_SPECIALS." set status = '0', date_status_change = now() where specials_id = '".$specials_id."'");
} else {
return -1;
}
}

////
// Sets timeout for the current script.
// Cant be used in safe mode.
function xtc_set_time_limit($limit) {
if (!get_cfg_var('safe_mode')) {
@ set_time_limit($limit);
}
}

////
// Alias function for Store configuration values in the Administration Tool
function xtc_cfg_select_option($select_array, $key_value, $key = '') {
for ($i = 0, $n = sizeof($select_array); $i < $n; $i ++) {
$name = (($key) ? 'configuration['.$key.']' : 'configuration_value');
$string .= '<br><input type="radio" name="'.$name.'" value="'.$select_array[$i].'"';
if ($key_value == $select_array[$i])
$string .= ' CHECKED';
$string .= '> '.$select_array[$i];
}

return $string;
}

////
// Alias function for module configuration keys
function xtc_mod_select_option($select_array, $key_name, $key_value) {
reset($select_array);
while (list ($key, $value) = each($select_array)) {
if (is_int($key))
$key = $value;
$string .= '<br><input type="radio" name="configuration['.$key_name.']" value="'.$key.'"';
if ($key_value == $key)
$string .= ' CHECKED';
$string .= '> '.$value;
}

return $string;
}

////
// Retreive server information
function xtc_get_system_information() {

$db_query = xtc_db_query("select now() as datetime");
$db = xtc_db_fetch_array($db_query);

list ($system, $host, $kernel) = preg_split('/[\s,]+/', @ exec('uname -a'), 5);

return array ('date' => xtc_datetime_short(date('Y-m-d H:i:s')), 'system' => $system, 'kernel' => $kernel, 'host' => $host, 'ip' => gethostbyname($host), 'uptime' => @ exec('uptime'), 'http_server' => $_SERVER['SERVER_SOFTWARE'], 'php' => PHP_VERSION, 'zend' => (function_exists('zend_version') ? zend_version() : ''), 'db_server' => DB_SERVER, 'db_ip' => gethostbyname(DB_SERVER), 'db_version' => 'MySQL '. (function_exists('mysql_get_server_info') ? mysql_get_server_info() : ''), 'db_date' => xtc_datetime_short($db['datetime']));
}

function xtc_array_shift(& $array) {
if (function_exists('array_shift')) {
return array_shift($array);
} else {
$i = 0;
$shifted_array = array ();
reset($array);
while (list ($key, $value) = each($array)) {
if ($i > 0) {
$shifted_array[$key] = $value;
} else {
$return = $array[$key];
}
$i ++;
}
$array = $shifted_array;

return $return;
}
}

function xtc_array_reverse($array) {
if (function_exists('array_reverse')) {
return array_reverse($array);
} else {
$reversed_array = array ();
for ($i = sizeof($array) - 1; $i >= 0; $i --) {
$reversed_array[] = $array[$i];
}
return $reversed_array;
}
}

function xtc_generate_category_path($id, $from = 'category', $categories_array = '', $index = 0) {

if (!is_array($categories_array))
$categories_array = array ();

if ($from == 'product') {
$categories_query = xtc_db_query("select categories_id from ".TABLE_PRODUCTS_TO_CATEGORIES." where products_id = '".$id."'");
while ($categories = xtc_db_fetch_array($categories_query)) {
if ($categories['categories_id'] == '0') {
$categories_array[$index][] = array ('id' => '0', 'text' => TEXT_TOP);
} else {
$category_query = xtc_db_query("select cd.categories_name, c.parent_id from ".TABLE_CATEGORIES." c, ".TABLE_CATEGORIES_DESCRIPTION." cd where c.categories_id = '".$categories['categories_id']."' and c.categories_id = cd.categories_id and cd.language_id = '".$_SESSION['languages_id']."'");
$category = xtc_db_fetch_array($category_query);
$categories_array[$index][] = array ('id' => $categories['categories_id'], 'text' => $category['categories_name']);
if ((xtc_not_null($category['parent_id'])) && ($category['parent_id'] != '0'))
$categories_array = xtc_generate_category_path($category['parent_id'], 'category', $categories_array, $index);
$categories_array[$index] = xtc_array_reverse($categories_array[$index]);
}
$index ++;
}
}
elseif ($from == 'category') {
$category_query = xtc_db_query("select cd.categories_name, c.parent_id from ".TABLE_CATEGORIES." c, ".TABLE_CATEGORIES_DESCRIPTION." cd where c.categories_id = '".$id."' and c.categories_id = cd.categories_id and cd.language_id = '".$_SESSION['languages_id']."'");
$category = xtc_db_fetch_array($category_query);
$categories_array[$index][] = array ('id' => $id, 'text' => $category['categories_name']);
if ((xtc_not_null($category['parent_id'])) && ($category['parent_id'] != '0'))
$categories_array = xtc_generate_category_path($category['parent_id'], 'category', $categories_array, $index);
}

return $categories_array;
}

function xtc_output_generated_category_path($id, $from = 'category') {
$calculated_category_path_string = '';
$calculated_category_path = xtc_generate_category_path($id, $from);
for ($i = 0, $n = sizeof($calculated_category_path); $i < $n; $i ++) {
for ($j = 0, $k = sizeof($calculated_category_path[$i]); $j < $k; $j ++) {
$calculated_category_path_string .= $calculated_category_path[$i][$j]['text'].'&nbsp;&gt;&nbsp;';
}
$calculated_category_path_string = substr($calculated_category_path_string, 0, -16).'<br>';
}
$calculated_category_path_string = substr($calculated_category_path_string, 0, -4);

if (strlen($calculated_category_path_string) < 1)
$calculated_category_path_string = TEXT_TOP;

return $calculated_category_path_string;
}

//deletes all product image files by filename
function xtc_del_image_file($image) {
if (file_exists(DIR_FS_CATALOG_POPUP_IMAGES.$image)) {
@ unlink(DIR_FS_CATALOG_POPUP_IMAGES.$image);
}
if (file_exists(DIR_FS_CATALOG_ORIGINAL_IMAGES.$image )) {
@ unlink(DIR_FS_CATALOG_ORIGINAL_IMAGES.$image);
}
if (file_exists(DIR_FS_CATALOG_THUMBNAIL_IMAGES.$imag e)) {
@ unlink(DIR_FS_CATALOG_THUMBNAIL_IMAGES.$image);
}
if (file_exists(DIR_FS_CATALOG_INFO_IMAGES.$image)) {
@ unlink(DIR_FS_CATALOG_INFO_IMAGES.$image);
}
}

function xtc_remove_order($order_id, $restock = false) {
if ($restock == 'on') {
$order_query = xtc_db_query("select products_id, products_quantity from ".TABLE_ORDERS_PRODUCTS." where orders_id = '".xtc_db_input($order_id)."'");
while ($order = xtc_db_fetch_array($order_query)) {
xtc_db_query("update ".TABLE_PRODUCTS." set products_quantity = products_quantity + ".$order['products_quantity'].", products_ordered = products_ordered - ".$order['products_quantity']." where products_id = '".$order['products_id']."'");
}
}

xtc_db_query("delete from ".TABLE_ORDERS." where orders_id = '".xtc_db_input($order_id)."'");
xtc_db_query("delete from ".TABLE_ORDERS_PRODUCTS." where orders_id = '".xtc_db_input($order_id)."'");
xtc_db_query("delete from ".TABLE_ORDERS_PRODUCTS_ATTRIBUTES." where orders_id = '".xtc_db_input($order_id)."'");
xtc_db_query("delete from ".TABLE_ORDERS_STATUS_HISTORY." where orders_id = '".xtc_db_input($order_id)."'");
xtc_db_query("delete from ".TABLE_ORDERS_TOTAL." where orders_id = '".xtc_db_input($order_id)."'");
}

function xtc_reset_cache_block($cache_block) {
global $cache_blocks;

for ($i = 0, $n = sizeof($cache_blocks); $i < $n; $i ++) {
if ($cache_blocks[$i]['code'] == $cache_block) {
if ($cache_blocks[$i]['multiple']) {
if ($dir = @ opendir(DIR_FS_CACHE)) {
while ($cache_file = readdir($dir)) {
$cached_file = $cache_blocks[$i]['file'];
$languages = xtc_get_languages();
for ($j = 0, $k = sizeof($languages); $j < $k; $j ++) {
$cached_file_unlink = ereg_replace('-language', '-'.$languages[$j]['directory'], $cached_file);
if (ereg('^'.$cached_file_unlink, $cache_file)) {
@ unlink(DIR_FS_CACHE.$cache_file);
}
}
}
closedir($dir);
}
} else {
$cached_file = $cache_blocks[$i]['file'];
$languages = xtc_get_languages();
for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {
$cached_file = ereg_replace('-language', '-'.$languages[$i]['directory'], $cached_file);
@ unlink(DIR_FS_CACHE.$cached_file);
}
}
break;
}
}
}

function xtc_get_file_permissions($mode) {
// determine type
if (($mode & 0xC000) == 0xC000) { // unix domain socket
$type = 's';
}
elseif (($mode & 0x4000) == 0x4000) { // directory
$type = 'd';
}
elseif (($mode & 0xA000) == 0xA000) { // symbolic link
$type = 'l';
}
elseif (($mode & 0x8000) == 0x8000) { // regular file
$type = '-';
}
elseif (($mode & 0x6000) == 0x6000) { //bBlock special file
$type = 'b';
}
elseif (($mode & 0x2000) == 0x2000) { // character special file
$type = 'c';
}
elseif (($mode & 0x1000) == 0x1000) { // named pipe
$type = 'p';
} else { // unknown
$type = '?';
}

// determine permissions
$owner['read'] = ($mode & 00400) ? 'r' : '-';
$owner['write'] = ($mode & 00200) ? 'w' : '-';
$owner['execute'] = ($mode & 00100) ? 'x' : '-';
$group['read'] = ($mode & 00040) ? 'r' : '-';
$group['write'] = ($mode & 00020) ? 'w' : '-';
$group['execute'] = ($mode & 00010) ? 'x' : '-';
$world['read'] = ($mode & 00004) ? 'r' : '-';
$world['write'] = ($mode & 00002) ? 'w' : '-';
$world['execute'] = ($mode & 00001) ? 'x' : '-';

// adjust for SUID, SGID and sticky bit
if ($mode & 0x800)
$owner['execute'] = ($owner['execute'] == 'x') ? 's' : 'S';
if ($mode & 0x400)
$group['execute'] = ($group['execute'] == 'x') ? 's' : 'S';
if ($mode & 0x200)
$world['execute'] = ($world['execute'] == 'x') ? 't' : 'T';

return $type.$owner['read'].$owner['write'].$owner['execute'].$group['read'].$group['write'].$group['execute'].$world['read'].$world['write'].$world['execute'];
}

function xtc_array_slice($array, $offset, $length = '0') {
if (function_exists('array_slice')) {
return array_slice($array, $offset, $length);
} else {
$length = abs($length);
if ($length == 0) {
$high = sizeof($array);
} else {
$high = $offset + $length;
}

for ($i = $offset; $i < $high; $i ++) {
$new_array[$i - $offset] = $array[$i];
}

return $new_array;
}
}

function xtc_remove($source) {
global $messageStack, $xtc_remove_error;

if (isset ($xtc_remove_error))
$xtc_remove_error = false;

if (is_dir($source)) {
$dir = dir($source);
while ($file = $dir->read()) {
if (($file != '.') && ($file != '..')) {
if (is_writeable($source.'/'.$file)) {
xtc_remove($source.'/'.$file);
} else {
$messageStack->add(sprintf(ERROR_FILE_NOT_REMOVEABLE, $source.'/'.$file), 'error');
$xtc_remove_error = true;
}
}
}
$dir->close();

if (is_writeable($source)) {
rmdir($source);
} else {
$messageStack->add(sprintf(ERROR_DIRECTORY_NOT_REMOVEABLE, $source), 'error');
$xtc_remove_error = true;
}
} else {
if (is_writeable($source)) {
unlink($source);
} else {
$messageStack->add(sprintf(ERROR_FILE_NOT_REMOVEABLE, $source), 'error');
$xtc_remove_error = true;
}
}
}

////
// Wrapper for constant() function
// Needed because its only available in PHP 4.0.4 and higher.
function xtc_constant($constant) {
if (function_exists('constant')) {
$temp = constant($constant);
} else {
eval ("\$temp=$constant;");
}
return $temp;
}

////
// Output the tax percentage with optional padded decimals
function xtc_display_tax_value($value, $padding = TAX_DECIMAL_PLACES) {
if (strpos($value, '.')) {
$loop = true;
while ($loop) {
if (substr($value, -1) == '0') {
$value = substr($value, 0, -1);
} else {
$loop = false;
if (substr($value, -1) == '.') {
$value = substr($value, 0, -1);
}
}
}
}

if ($padding > 0) {
if ($decimal_pos = strpos($value, '.')) {
$decimals = strlen(substr($value, ($decimal_pos +1)));
for ($i = $decimals; $i < $padding; $i ++) {
$value .= '0';
}
} else {
$value .= '.';
for ($i = 0; $i < $padding; $i ++) {
$value .= '0';
}
}
}

return $value;
}

function xtc_get_tax_class_title($tax_class_id) {
if ($tax_class_id == '0') {
return TEXT_NONE;
} else {
$classes_query = xtc_db_query("select tax_class_title from ".TABLE_TAX_CLASS." where tax_class_id = '".$tax_class_id."'");
$classes = xtc_db_fetch_array($classes_query);

return $classes['tax_class_title'];
}
}

function xtc_banner_image_extension() {
if (function_exists('imagetypes')) {
if (imagetypes() & IMG_PNG) {
return 'png';
}
elseif (imagetypes() & IMG_JPG) {
return 'jpg';
}
elseif (imagetypes() & IMG_GIF) {
return 'gif';
}
}
elseif (function_exists('imagecreatefrompng') && function_exists('imagepng')) {
return 'png';
}
elseif (function_exists('imagecreatefromjpeg') && function_exists('imagejpeg')) {
return 'jpg';
}
elseif (function_exists('imagecreatefromgif') && function_exists('imagegif')) {
return 'gif';
}

return false;
}

////
// Wrapper function for round()
function xtc_round($value, $precision) {
return round($value, $precision);
}



// Calculates Tax rounding the result
function xtc_calculate_tax($price, $tax) {
global $currencies;
return xtc_round($price * $tax / 100, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
}



function xtc_call_function($function, $parameter, $object = '') {
if ($object == '') {
return call_user_func($function, $parameter);
} else {
return call_user_func(array ($object, $function), $parameter);
}
}

function xtc_get_zone_class_title($zone_class_id) {
if ($zone_class_id == '0') {
return TEXT_NONE;
} else {
$classes_query = xtc_db_query("select geo_zone_name from ".TABLE_GEO_ZONES." where geo_zone_id = '".$zone_class_id."'");
$classes = xtc_db_fetch_array($classes_query);

return $classes['geo_zone_name'];
}
}

function xtc_cfg_pull_down_template_sets() {
$name = (($key) ? 'configuration['.$key.']' : 'configuration_value');
if ($dir = opendir(DIR_FS_CATALOG.'templates/')) {
while (($templates = readdir($dir)) !== false) {
if (is_dir(DIR_FS_CATALOG.'templates/'."//".$templates) and ($templates != "CVS") and ($templates != ".") and ($templates != "..")) {
$templates_array[] = array ('id' => $templates, 'text' => $templates);
}
}
closedir($dir);
sort($templates_array);
return xtc_draw_pull_down_menu($name, $templates_array, CURRENT_TEMPLATE);
}
}

function xtc_cfg_pull_down_zone_classes($zone_class_id, $key = '') {
$name = (($key) ? 'configuration['.$key.']' : 'configuration_value');

$zone_class_array = array (array ('id' => '0', 'text' => TEXT_NONE));
$zone_class_query = xtc_db_query("select geo_zone_id, geo_zone_name from ".TABLE_GEO_ZONES." order by geo_zone_name");
while ($zone_class = xtc_db_fetch_array($zone_class_query)) {
$zone_class_array[] = array ('id' => $zone_class['geo_zone_id'], 'text' => $zone_class['geo_zone_name']);
}

return xtc_draw_pull_down_menu($name, $zone_class_array, $zone_class_id);
}

function xtc_cfg_pull_down_order_statuses($order_status_id, $key = '') {

$name = (($key) ? 'configuration['.$key.']' : 'configuration_value');

$statuses_array = array (array ('id' => '1', 'text' => TEXT_DEFAULT));
$statuses_query = xtc_db_query("select orders_status_id, orders_status_name from ".TABLE_ORDERS_STATUS." where language_id = '".$_SESSION['languages_id']."' order by orders_status_name");
while ($statuses = xtc_db_fetch_array($statuses_query)) {
$statuses_array[] = array ('id' => $statuses['orders_status_id'], 'text' => $statuses['orders_status_name']);
}

return xtc_draw_pull_down_menu($name, $statuses_array, $order_status_id);
}

function xtc_get_order_status_name($order_status_id, $language_id = '') {

if ($order_status_id < 1)
return TEXT_DEFAULT;

if (!is_numeric($language_id))
$language_id = $_SESSION['languages_id'];

$status_query = xtc_db_query("select orders_status_name from ".TABLE_ORDERS_STATUS." where orders_status_id = '".$order_status_id."' and language_id = '".$language_id."'");
$status = xtc_db_fetch_array($status_query);

return $status['orders_status_name'];
}

////
// Return a random value
function xtc_rand($min = null, $max = null) {
static $seeded;

if (!$seeded) {
mt_srand((double) microtime() * 1000000);
$seeded = true;
}

if (isset ($min) && isset ($max)) {
if ($min >= $max) {
return $min;
} else {
return mt_rand($min, $max);
}
} else {
return mt_rand();
}
}

// nl2br() prior PHP 4.2.0 did not convert linefeeds on all OSs (it only converted \n)
function xtc_convert_linefeeds($from, $to, $string) {
if ((PHP_VERSION < "4.0.5") && is_array($from)) {
return ereg_replace('('.implode('|', $from).')', $to, $string);
} else {
return str_replace($from, $to, $string);
}
}

// Return all customers statuses for a specified language_id and return an array(array())
// Use it to make pull_down_menu, checkbox....
function xtc_get_customers_statuses() {

$customers_statuses_array = array (array ());
$customers_statuses_query = xtc_db_query("select customers_status_id, customers_status_name, customers_status_image, customers_status_discount, customers_status_ot_discount_flag, customers_status_ot_discount from ".TABLE_CUSTOMERS_STATUS." where language_id = '".$_SESSION['languages_id']."' order by customers_status_id");
$i = 1; // this is changed from 0 to 1 in cs v1.2
while ($customers_statuses = xtc_db_fetch_array($customers_statuses_query)) {
$i = $customers_statuses['customers_status_id'];
$customers_statuses_array[$i] = array ('id' => $customers_statuses['customers_status_id'], 'text' => $customers_statuses['customers_status_name'], 'csa_public' => $customers_statuses['customers_status_public'], 'csa_image' => $customers_statuses['customers_status_image'], 'csa_discount' => $customers_statuses['customers_status_discount'], 'csa_ot_discount_flag' => $customers_statuses['customers_status_ot_discount_flag'], 'csa_ot_discount' => $customers_statuses['customers_status_ot_discount'], 'csa_graduated_prices' => $customers_statuses['customers_status_graduated_prices']);
}
return $customers_statuses_array;
}

function xtc_get_customer_status($customers_id) {

$customer_status_array = array ();
$customer_status_query = xtc_db_query("select customers_status, member_flag, customers_status_name, customers_status_public, customers_status_image, customers_status_discount, customers_status_ot_discount_flag, customers_status_ot_discount, customers_status_graduated_prices FROM ".TABLE_CUSTOMERS." left join ".TABLE_CUSTOMERS_STATUS." on customers_status = customers_status_id where customers_id='".$customers_id."' and language_id = '".$_SESSION['languages_id']."'");
$customer_status_array = xtc_db_fetch_array($customer_status_query);
return $customer_status_array;
}

function xtc_get_customers_status_name($customers_status_id , $language_id = '') {

if (!$language_id)
$language_id = $_SESSION['languages_id'];
$customers_status_query = xtc_db_query("select customers_status_name from ".TABLE_CUSTOMERS_STATUS." where customers_status_id = '".$customers_status_id."' and language_id = '".$language_id."'");
$customers_status = xtc_db_fetch_array($customers_status_query);
return $customers_status['customers_status_name'];
}

//to set customers status in admin for default value, newsletter, guest...
function xtc_cfg_pull_down_customers_status_list($customers _status_id, $key = '') {
$name = (($key) ? 'configuration['.$key.']' : 'configuration_value');
return xtc_draw_pull_down_menu($name, xtc_get_customers_statuses(), $customers_status_id);
}

// Function for collecting ip
// return all log info for a customer_id
function xtc_get_user_info($customer_id) {
$user_info_array = xtc_db_query("select customers_ip, customers_ip_date, customers_host, customers_advertiser, customers_referer_url FROM ".TABLE_CUSTOMERS_IP." where customers_id = '".$customer_id."'");
return $user_info_array;
}

//---------------------------------------------------------------kommt wieder raus spaeter!!
function xtc_get_uploaded_file($filename) {
if (isset ($_FILES[$filename])) {
$uploaded_file = array ('name' => $_FILES[$filename]['name'], 'type' => $_FILES[$filename]['type'], 'size' => $_FILES[$filename]['size'], 'tmp_name' => $_FILES[$filename]['tmp_name']);
}
elseif (isset ($_FILES[$filename])) {
$uploaded_file = array ('name' => $_FILES[$filename]['name'], 'type' => $_FILES[$filename]['type'], 'size' => $_FILES[$filename]['size'], 'tmp_name' => $_FILES[$filename]['tmp_name']);
} else {
$uploaded_file = array ('name' => $GLOBALS[$filename.'_name'], 'type' => $GLOBALS[$filename.'_type'], 'size' => $GLOBALS[$filename.'_size'], 'tmp_name' => $GLOBALS[$filename]);
}

return $uploaded_file;
}

function get_group_price($group_id, $product_id) {
// well, first try to get group price from database
$group_price_query = xtc_db_query("SELECT personal_offer FROM ".TABLE_PERSONAL_OFFERS_BY.$group_id." WHERE products_id = '".$product_id."' and quantity=1");
$group_price_data = xtc_db_fetch_array($group_price_query);
// if we found a price, everything is ok if not, we will create new entry

// if there is no entry, create one. if there are more entries. keep one, dropp rest.
if (!xtc_db_num_rows($group_price_query)) {
xtc_db_query("INSERT INTO ".TABLE_PERSONAL_OFFERS_BY.$group_id." (price_id, products_id, quantity, personal_offer) VALUES ('', '".$product_id."', '1', '0.00')");
$group_price_query = xtc_db_query("SELECT personal_offer FROM ".TABLE_PERSONAL_OFFERS_BY.$group_id." WHERE products_id = '".$product_id."' ORDER BY quantity ASC");
$group_price_data = xtc_db_fetch_array($group_price_query);

} else
if (xtc_db_num_rows($group_price_query) > 1) {
while ($data = xtc_db_fetch_array($group_price_query)) {
$group_price_data['personal_offer'] = $data['personal_offer'];
}
xtc_db_query("DELETE FROM ".TABLE_PERSONAL_OFFERS_BY.$group_id." WHERE products_id='".$product_id."' and quantity=1");
xtc_db_query("INSERT INTO ".TABLE_PERSONAL_OFFERS_BY.$group_id." (price_id, products_id, quantity, personal_offer) VALUES ('', '".$product_id."', '1', '".$group_price_data['personal_offer']."')");
$group_price_query = xtc_db_query("SELECT personal_offer FROM ".TABLE_PERSONAL_OFFERS_BY.$group_id." WHERE products_id = '".$product_id."' ORDER BY quantity ASC");
$group_price_data = xtc_db_fetch_array($group_price_query);
}

return $group_price_data['personal_offer'];
}

function format_price($price_string, $price_special, $currency, $allow_tax, $tax_rate) {
// calculate currencies
$currencies_query = xtc_db_query("SELECT
symbol_left,
symbol_right,
decimal_places,
value
FROM
".TABLE_CURRENCIES."
WHERE
code = '".$currency."'");
$currencies_value = xtc_db_fetch_array($currencies_query);
$currencies_data = array ();
$currencies_data = array ('SYMBOL_LEFT' => $currencies_value['symbol_left'], 'SYMBOL_RIGHT' => $currencies_value['symbol_right'], 'DECIMAL_PLACES' => $currencies_value['decimal_places'], 'VALUE' => $currencies_value['value']);

// round price
if ($allow_tax == 1)
$price_string = $price_string / ((100 + $tax_rate) / 100);
$price_string = precision($price_string, $currencies_data['DECIMAL_PLACES']);
if ($price_special == '1') {
$price_string = $currencies_data['SYMBOL_LEFT'].' '.$price_string.' '.$currencies_data['SYMBOL_RIGHT'];
}
return $price_string;
}

function precision($number, $places) {
$number = number_format($number, $places, '.', '');
return $number;
}

function xtc_get_lang_definition($search_lang, $lang_array, $modifier) {
$search_lang = $search_lang.$modifier;
return $lang_array[$search_lang];
}

function xtc_CheckExt($filename, $ext) {
$passed = FALSE;
$testExt = "\.".$ext."$";
if (eregi($testExt, $filename)) {
$passed = TRUE;
}
return $passed;
}

function xtc_get_status_users($status_id) {
$status_query = xtc_db_query("SELECT count(customers_status) as count FROM ".TABLE_CUSTOMERS." WHERE customers_status = '".$status_id."'");
$status_data = xtc_db_fetch_array($status_query);
return $status_data['count'];
}
function xtc_mkdirs($path, $perm) {

if (is_dir($path)) {
return true;
} else {

//$path=dirname($path);
if (!mkdir($path, $perm))
return false;
mkdir($path, $perm);
return true;
}
}

function xtc_spaceUsed($dir) {
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if (is_dir($dir.$file) && $file != '.' && $file != '..') {
xtc_spaceUsed($dir.$file.'/');
} else {
$GLOBALS['total'] += filesize($dir.$file);
}
}
closedir($dh);
}
}
}

function create_coupon_code($salt = "secret", $length = SECURITY_CODE_LENGTH) {
$ccid = md5(uniqid("", "salt"));
$ccid .= md5(uniqid("", "salt"));
$ccid .= md5(uniqid("", "salt"));
$ccid .= md5(uniqid("", "salt"));
srand((double) microtime() * 1000000); // seed the random number generator
$random_start = @ rand(0, (128 - $length));
$good_result = 0;
while ($good_result == 0) {
$id1 = substr($ccid, $random_start, $length);
$query = xtc_db_query("select coupon_code from ".TABLE_COUPONS." where coupon_code = '".$id1."'");
if (xtc_db_num_rows($query) == 0)
$good_result = 1;
}
return $id1;
}

// Update the Customers GV account
function xtc_gv_account_update($customer_id, $gv_id) {
$customer_gv_query = xtc_db_query("select amount from ".TABLE_COUPON_GV_CUSTOMER." where customer_id = '".$customer_id."'");
$coupon_gv_query = xtc_db_query("select coupon_amount from ".TABLE_COUPONS." where coupon_id = '".$gv_id."'");
$coupon_gv = xtc_db_fetch_array($coupon_gv_query);
if (xtc_db_num_rows($customer_gv_query) > 0) {
$customer_gv = xtc_db_fetch_array($customer_gv_query);
$new_gv_amount = $customer_gv['amount'] + $coupon_gv['coupon_amount'];
$gv_query = xtc_db_query("update ".TABLE_COUPON_GV_CUSTOMER." set amount = '".$new_gv_amount."' where customer_id = '".$customer_id."'");
} else {
$gv_query = xtc_db_query("insert into ".TABLE_COUPON_GV_CUSTOMER." (customer_id, amount) values ('".$customer_id."', '".$coupon_gv['coupon_amount']."')");
}
}

// Output a day/month/year dropdown selector
function xtc_draw_date_selector($prefix, $date = '') {
$month_array = array ();
$month_array[1] = _JANUARY;
$month_array[2] = _FEBRUARY;
$month_array[3] = _MARCH;
$month_array[4] = _APRIL;
$month_array[5] = _MAY;
$month_array[6] = _JUNE;
$month_array[7] = _JULY;
$month_array[8] = _AUGUST;
$month_array[9] = _SEPTEMBER;
$month_array[10] = _OCTOBER;
$month_array[11] = _NOVEMBER;
$month_array[12] = _DECEMBER;
$usedate = getdate($date);
$day = $usedate['mday'];
$month = $usedate['mon'];
$year = $usedate['year'];
$date_selector = '<select name="'.$prefix.'_day">';
for ($i = 1; $i < 32; $i ++) {
$date_selector .= '<option value="'.$i.'"';
if ($i == $day)
$date_selector .= 'selected';
$date_selector .= '>'.$i.'</option>';
}
$date_selector .= '</select>';
$date_selector .= '<select name="'.$prefix.'_month">';
for ($i = 1; $i < 13; $i ++) {
$date_selector .= '<option value="'.$i.'"';
if ($i == $month)
$date_selector .= 'selected';
$date_selector .= '>'.$month_array[$i].'</option>';
}
$date_selector .= '</select>';
$date_selector .= '<select name="'.$prefix.'_year">';
for ($i = 2001; $i < 2019; $i ++) {
$date_selector .= '<option value="'.$i.'"';
if ($i == $year)
$date_selector .= 'selected';
$date_selector .= '>'.$i.'</option>';
}
$date_selector .= '</select>';
return $date_selector;
}

function xtc_getDownloads() {

$files = array ();

$dir = DIR_FS_CATALOG.'download/';
if ($fp = opendir($dir)) {
while ($file = readdir($fp)) {
if (is_file($dir.$file) && $file != '.htaccess') {
$size = filesize($dir.$file);
$files[] = array ('id' => $file, 'text' => $file.' | '.xtc_format_filesize($size), 'size' => $size, 'date' => date("F d Y H:i:s.", filemtime($dir.$file)));
} //if
} // while
closedir($fp);
}
return $files;
}

function xtc_try_upload($file = '', $destination = '', $permissions = '777', $extensions = '') {
$file_object = new upload($file, $destination, $permissions, $extensions);
if ($file_object->filename != '')
return $file_object;
else
return false;
}

function xtc_button($value, $type='submit', $parameter='') {
return '<input type="'.$type.'" class="button" onClick="this.blur();" value="' . $value . '" ' . $parameter . ' >';
}

function xtc_button_link($value, $href='javascript:void(null)', $parameter='') {
return '<a href="'.$href.'" class="button" onClick="this.blur()" '.$parameter.' >'.$value.'</a>';
}



//--------------------------------------------------------------------------------------Ende
?>

Danke. Vieleicht solltest du mir dein Modul mailen.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!
Mit Zitat antworten
Antwort

Lesezeichen

Stichworte
installiert, mir, modul, paypal

Themen-Optionen
Ansicht

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are aus
Pingbacks are aus
Refbacks are aus


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Paypal Sandbox wie soll das funktionieren? hksuperstar Fragen zur Software 1 14.12.2010 22:52
Einbruch in Paypal Modul franky_n Shopbereich 0 10.02.2010 14:15
Standard PayPal Modul Media-Products Allgemeine Diskussionen 0 23.09.2008 16:04


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:30 Uhr.

Copyright © 2011 xt:Commerce GmbH / xt:Commerce International Ltd. - All Rights Reserved

xt:Commerce is a SafeCharge brand