PDF rausgenommen

This commit is contained in:
aschwarz
2023-01-23 11:03:31 +01:00
parent 82d562a322
commit a6523903eb
28078 changed files with 4247552 additions and 2 deletions

View File

@ -0,0 +1,93 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: breadcrumb.php,v 1.3 2003/02/11 00:04:50 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
class breadcrumb {
/**
* @var array Array of individual (linked) html strings created from crumbs
*/
private $links = array();
/**
* Create the breadcrumb
*/
public function __construct() {
$this->reset();
}
/**
* reset
*/
private function reset() {
$this->links = array();
}
/**
* Add Link
*/
public function add($title, $url = '', $icon = '') {
$this->links[] = array('title' => $title, 'url' => $url, 'icon' => $icon );
}
/**
* Create a breadcrumb element string
*
* @return string
*/
public function trail() {
$link_output = '';
$n = sizeof($this->links);
for ($i=0, $n; $i<$n; $i++) {
$link_output .= '<li typeof="v:Breadcrumb">';
if ( isset( $this->links[$i]['url'] ) && ( is_string( $this->links[$i]['url'] ) && $this->links[$i]['url'] !== '' ) ) {
$link_output .= '<a title="' . $this->links[$i]['title'] . '" href="' . $this->links[$i]['url'] . '" rel="v:url" property="v:title">';
} else {
$link_output .= '<span property="v:title">';
}
if (isset($this->links[$i]['icon']) && !empty($this->links[$i]['icon'])) {
$link_output .= '<i class="fa fa-' . $this->links[$i]['icon'] . '" aria-hidden="true"></i>';
}
$link_output .= $this->links[$i]['title'];
if (isset($this->links[$i]['url']) && ( is_string( $this->links[$i]['url'] ) && $this->links[$i]['url'] !== '' ) ) {
$link_output .= '</a>';
} else {
$link_output .= '</span>';
}
$link_output .= '</li>';
}
return $link_output;
}
}

View File

@ -0,0 +1,353 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: category_tree.php,v 1.2, 2004/10/26 20:07:09 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2001 - 2004 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
class oosCategoryTree {
var $root_category_id = 0,
$max_level = 0,
$data = array(),
$root_start_string = '',
$root_end_string = '',
$parent_start_string = '',
$parent_end_string = '',
$parent_group_start_string = '<ul>',
$parent_group_end_string = '</ul>',
$child_start_string = '<li>',
$child_end_string = '</li>',
$breadcrumb_separator = '_',
$breadcrumb_usage = TRUE,
$spacer_string = '',
$spacer_multiplier = 1,
$follow_cpath = FALSE,
$cpath_array = array(),
$cpath_start_string = '',
$cpath_end_string = '',
$show_category_product_count = FALSE,
$category_product_count_start_string = '&nbsp;(',
$category_product_count_end_string = ')';
public function __construct() {
if (SHOW_COUNTS == 'true') {
$this->show_category_product_count = TRUE;
}
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$nLanguageID = isset($_SESSION['language_id']) ? intval( $_SESSION['language_id'] ) : DEFAULT_LANGUAGE_ID;
$categoriestable = $oostable['categories'];
$categories_descriptionstable = $oostable['categories_description'];
$sql = "SELECT c.categories_id, cd.categories_name, c.parent_id, c.categories_status
FROM $categoriestable c,
$categories_descriptionstable cd
WHERE c.categories_status = '2'
AND c.categories_id = cd.categories_id
AND cd.categories_languages_id = '" . intval($nLanguageID) . "'
ORDER BY c.parent_id, c.sort_order, cd.categories_name";
if (USE_CACHE == 'true') {
$categories_result = $dbconn->CacheExecute(3600, $sql);
} else {
$categories_result = $dbconn->Execute($sql);
}
$this->data = array();
while ($categories = $categories_result->fields) {
$this->data[$categories['parent_id']][$categories['categories_id']] = array('name' => $categories['categories_name'], 'count' => 0);
// Move that ADOdb pointer!
$categories_result->MoveNext();
}
if ($this->show_category_product_count === TRUE) {
$this->calculateCategoryProductCount();
}
}
public function setData(&$data_array) {
if (is_array($data_array)) {
$this->data = array();
for ($i=0, $n=count($data_array); $i<$n; $i++) {
$this->data[$data_array[$i]['parent_id']][$data_array[$i]['categories_id']] = array('name' => $data_array[$i]['categories_name'], 'count' => $data_array[$i]['categories_count']);
}
}
}
public function buildBranch($parent_id, $level = 0) {
$result = $this->parent_group_start_string;
$aContents = oos_get_content();
if (isset($this->data[$parent_id])) {
foreach ($this->data[$parent_id] as $category_id => $category) {
if ($this->breadcrumb_usage == TRUE) {
$category_link = $this->buildBreadcrumb($category_id);
} else {
$category_link = $category_id;
}
$sLink = '<a href="' . oos_href_link($aContents['shop'], 'category=' . $category_link) . '">';
$result .= $this->child_start_string;
if (isset($this->data[$category_id])) {
$result .= $this->parent_start_string;
}
if ($level == 0) {
$result .= $this->root_start_string;
}
$result .= str_repeat($this->spacer_string, $this->spacer_multiplier * $level);
$result .= $sLink;
if ($this->follow_cpath === TRUE) {
if (in_array($category_id, $this->cpath_array)) {
$result .= $this->cpath_start_string . $category['name'] . $this->cpath_end_string;
} else {
$result .= $category['name'];
}
} else {
$result .= $category['name'];
}
$result .= '</a>';
if ($this->show_category_product_count === TRUE) {
$result .= $this->category_product_count_start_string . $category['count'] . $this->category_product_count_end_string;
}
if ($level == 0) {
$result .= $this->root_end_string;
}
if (isset($this->data[$category_id])) {
$result .= $this->parent_end_string;
}
$result .= $this->child_end_string;
if (isset($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {
if ($this->follow_cpath === TRUE) {
if (in_array($category_id, $this->cpath_array)) {
$result .= $this->buildBranch($category_id, $level+1);
}
} else {
$result .= $this->buildBranch($category_id, $level+1);
}
}
}
}
$result .= $this->parent_group_end_string;
return $result;
}
public function buildBranchArray($parent_id, $level = 0, $result = '') {
if (empty($result)) {
$result = array();
}
if (isset($this->data[$parent_id])) {
foreach ($this->data[$parent_id] as $category_id => $category) {
if ($this->breadcrumb_usage == TRUE) {
$category_link = $this->buildBreadcrumb($category_id);
} else {
$category_link = $category_id;
}
$result[] = array('id' => $category_link,
'title' => str_repeat($this->spacer_string, $this->spacer_multiplier * $level) . $category['name']);
if (isset($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {
if ($this->follow_cpath === TRUE) {
if (in_array($category_id, $this->cpath_array)) {
$result = $this->buildBranchArray($category_id, $level+1, $result);
}
} else {
$result = $this->buildBranchArray($category_id, $level+1, $result);
}
}
}
}
return $result;
}
public function buildBreadcrumb($category_id, $level = 0) {
$breadcrumb = '';
foreach ($this->data as $parent => $categories) {
foreach ($categories as $id => $info) {
if ($id == $category_id) {
if ($level < 1) {
$breadcrumb = $id;
} else {
$breadcrumb = $id . $this->breadcrumb_separator . $breadcrumb;
}
if ($parent != $this->root_category_id) {
$breadcrumb = $this->buildBreadcrumb($parent, $level+1) . $breadcrumb;
}
}
}
}
return $breadcrumb;
}
public function buildTree() {
return $this->buildBranch($this->root_category_id);
}
public function getTree($parent_id = '') {
return $this->buildBranchArray((empty($parent_id) ? $this->root_category_id : $parent_id));
}
public function calculateCategoryProductCount() {
foreach ($this->data as $parent => $categories) {
foreach ($categories as $id => $info) {
$this->data[$parent][$id]['count'] = $this->countCategoryProducts($id);
$parent_category = $parent;
while ($parent_category != $this->root_category_id) {
foreach ($this->data as $parent_parent => $parent_categories) {
foreach ($parent_categories as $parent_category_id => $parent_category_info) {
if ($parent_category_id == $parent_category) {
$this->data[$parent_parent][$parent_category_id]['count'] += $this->data[$parent][$id]['count'];
$parent_category = $parent_parent;
break 2;
}
}
}
}
}
}
}
public function countCategoryProducts($category_id) {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$productstable = $oostable['products'];
$products_to_categoriestable = $oostable['products_to_categories'];
$sql = "SELECT COUNT(*) AS total
FROM $productstable p,
$products_to_categoriestable p2c
WHERE p2c.categories_id = '" . intval($category_id) . "'
AND p2c.products_id = p.products_id
AND p.products_status >= 1";
$count_result = $dbconn->Execute($sql);
$count = $count_result->fields['total'];
return $count;
}
public function setRootCategoryID($root_category_id) {
$this->root_category_id = $root_category_id;
}
public function setMaximumLevel($max_level) {
$this->max_level = $max_level;
}
public function setRootString($root_start_string, $root_end_string) {
$this->root_start_string = $root_start_string;
$this->root_end_string = $root_end_string;
}
public function setParentString($parent_start_string, $parent_end_string) {
$this->parent_start_string = $parent_start_string;
$this->parent_end_string = $parent_end_string;
}
public function setParentGroupString($parent_group_start_string, $parent_group_end_string) {
$this->parent_group_start_string = $parent_group_start_string;
$this->parent_group_end_string = $parent_group_end_string;
}
public function setChildString($child_start_string, $child_end_string) {
$this->child_start_string = $child_start_string;
$this->child_end_string = $child_end_string;
}
public function setBreadcrumbSeparator($breadcrumb_separator) {
$this->breadcrumb_separator = $breadcrumb_separator;
}
public function setBreadcrumbUsage($breadcrumb_usage) {
if ($breadcrumb_usage === TRUE) {
$this->breadcrumb_usage = TRUE;
} else {
$this->breadcrumb_usage = FALSE;
}
}
public function setSpacerString($spacer_string, $spacer_multiplier = 2) {
$this->spacer_string = $spacer_string;
$this->spacer_multiplier = $spacer_multiplier;
}
public function setCategoryPath($cpath, $cpath_start_string = '', $cpath_end_string = '') {
$this->follow_cpath = TRUE;
$this->cpath_array = explode($this->breadcrumb_separator, $cpath);
$this->cpath_start_string = $cpath_start_string;
$this->cpath_end_string = $cpath_end_string;
}
public function setFollowCategoryPath($follow_cpath) {
if ($follow_cpath === TRUE) {
$this->follow_cpath = TRUE;
} else {
$this->follow_cpath = FALSE;
}
}
public function setCategoryPathString($cpath_start_string, $cpath_end_string) {
$this->cpath_start_string = $cpath_start_string;
$this->cpath_end_string = $cpath_end_string;
}
public function setShowCategoryProductCount($show_category_product_count) {
if ($show_category_product_count === TRUE) {
$this->show_category_product_count = TRUE;
} else {
$this->show_category_product_count = FALSE;
}
}
public function setCategoryProductCountString($category_product_count_start_string, $category_product_count_end_string) {
$this->category_product_count_start_string = $category_product_count_start_string;
$this->category_product_count_end_string = $category_product_count_end_string;
}
}

View File

@ -0,0 +1,116 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: currencies.php,v 1.14 2003/02/11 00:04:51 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
class currencies {
var $currencies;
public function __construct() {
$this->currencies = array();
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$currenciestable = $oostable['currencies'];
$sql = "SELECT code, title, symbol_left, symbol_right, decimal_point,
thousands_point, decimal_places, value
FROM " . $currenciestable;
if (USE_CACHE == 'true') {
$this->currencies = $dbconn->CacheGetAssoc(3600*24, $sql);
} else {
$this->currencies = $dbconn->GetAssoc($sql);
}
}
public function format($number, $calculate_currency_value = TRUE, $currency_type = '', $currency_value = NULL, $with_symbol = TRUE) {
if (empty($currency_type) || ($this->exists($currency_type) == FALSE)) {
$currency_type = (isset($_SESSION['currency']) ? $_SESSION['currency'] : DEFAULT_CURRENCY);
}
$rate = 1;
if ($calculate_currency_value == TRUE) {
$rate = (oos_is_not_null($currency_value)) ? $currency_value : $this->currencies[$currency_type]['value'];
}
if ($with_symbol == TRUE) {
$format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(oos_round($number * $rate, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . ' ' . $this->currencies[$currency_type]['symbol_right'];
} else {
$format_string = number_format(oos_round($number * $rate, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], '.', '');
}
return $format_string;
}
public function calculate_price($products_price, $products_tax, $quantity = 1) {
$currency_type = (isset($_SESSION['currency']) ? $_SESSION['currency'] : DEFAULT_CURRENCY);
return oos_round(oos_add_tax($products_price, $products_tax), $this->currencies[$currency_type]['decimal_places']) * $quantity;
}
public function exists($code) {
if (isset($this->currencies[$code])) {
return TRUE;
}
return FALSE;
}
public function get_value($code) {
return $this->currencies[$code]['value'];
}
public function get_decimal_places($code) {
return $this->currencies[$code]['decimal_places'];
}
public function get_currencies_info($code) {
return $this->currencies[$code];
}
public function display_price($products_price, $products_tax, $quantity = 1) {
global $oEvent, $aUser, $aLang;
if ($oEvent->installed_plugin('down_for_maintenance')) {
return $aLang['down_for_maintenance_no_prices_display'];
}
if ( LOGIN_FOR_PRICE == 'true' && ($aUser['show_price'] != 1) ) {
return $aLang['no_login_no_prices_display'];
}
return $this->format($this->calculate_price($products_price, $products_tax, $quantity));
}
public function schema_price($products_price, $products_tax, $quantity = 1, $with_symbol = TRUE) {
global $oEvent, $aUser;
if ($oEvent->installed_plugin('down_for_maintenance')) {
return '';
}
if ( LOGIN_FOR_PRICE == 'true' && ($aUser['show_price'] != 1) ) {
return '';
}
return $this->format($this->calculate_price($products_price, $products_tax, $quantity), TRUE, '', NULL, $with_symbol);
}
}

View File

@ -0,0 +1,378 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 - 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
/**
* Google XML Sitemap Feed
*
* The Google sitemap service was announced on 2 June 2005 and represents
* a huge development in terms of crawler technology. This contribution is
* designed to create the sitemap XML feed per the specification delineated
* by Google.
*
* Optimized for use with MyOOS by r23 (info@r23.de)
*
* @package Google-XML-Sitemap-Feed
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @link http://www.google.com/webmasters/sitemaps/docs/en/about.html About Google Sitemap
* @copyright Copyright 2005, Bobby Easland
* @author Bobby Easland
*/
class GoogleSitemap {
/**
* $filename is the base name of the feeds (i.e. - 'sitemap')
*
* @var string
*/
var $filename;
/**
* $savepath is the path where the feeds will be saved - store root
*
* @var string
*/
var $savepath;
/**
* $base_url is the URL for the catalog
*
* @var string
*/
var $base_url;
/**
* $debug holds all the debug data
*
* @var array
*/
var $debug;
/**
* GoogleSitemap class constructor
*/
public function __construct() {
$this->filename = "sitemap";
$this->savepath = OOS_ABSOLUTE_PATH;
$this->base_url = OOS_HTTPS_SERVER . OOS_SHOP;
$this->debug = array();
}
/**
* function to save the sitemap data to file as either XML or XML.GZ format
*
* @param string $data XML data
* @param string $type Feed type (index, products, categories)
* @return boolean
*/
public function SaveFile($data, $type){
$filename = $this->savepath . $this->filename . $type;
$compress = defined('GOOGLE_SITEMAP_COMPRESS') ? GOOGLE_SITEMAP_COMPRESS : 'false';
if ($type == 'index') $compress = 'false';
switch($compress){
case 'true':
$filename .= '.xml.gz';
if ($gz = gzopen($filename,'wb9')){
gzwrite($gz, $data);
gzclose($gz);
$this->debug['SAVE_FILE_COMPRESS'][] = array('file' => $filename, 'status' => 'success', 'file_exists' => 'true');
return TRUE;
} else {
$file_check = file_exists($filename) ? 'true' : 'false';
$this->debug['SAVE_FILE_COMPRESS'][] = array('file' => $filename, 'status' => 'failure', 'file_exists' => $file_check);
return FALSE;
}
break;
default:
$filename .= '.xml';
if ($fp = fopen($filename, 'w+')){
fwrite($fp, $data);
fclose($fp);
$this->debug['SAVE_FILE_XML'][] = array('file' => $filename, 'status' => 'success', 'file_exists' => 'true');
return TRUE;
} else {
$file_check = file_exists($filename) ? 'true' : 'false';
$this->debug['SAVE_FILE_XML'][] = array('file' => $filename, 'status' => 'failure', 'file_exists' => $file_check);
return FALSE;
}
break;
}
}
/**
* public function to compress a normal file
*
* @param string $file
* @return boolean
*/
public function CompressFile($file){
$source = $this->savepath . $file . '.xml';
$filename = $this->savepath . $file . '.xml.gz';
$error_encountered = FALSE;
if ( $gz_out = gzopen($filename, 'wb9') ){
if ($fp_in = fopen($source,'rb')){
while (!feof($fp_in)) gzwrite($gz_out, fread($fp_in, 1024*512));
fclose($fp_in);
} else {
$error_encountered = TRUE;
}
gzclose($gz_out);
} else {
$error_encountered = TRUE;
}
if ($error_encountered){
return FALSE;
} else {
return TRUE;
}
}
/**
* public function to generate sitemap file from data
*
* @param array $data
* @param string $file
*/
public function GenerateSitemap($data, $file) {
$content = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
$content .= '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">' . "\n";
foreach ($data as $url){
$content .= "\t" . '<url>' . "\n";
$content .= "\t\t" . '<loc>'.$url['loc'].'</loc>' . "\n";
$content .= "\t\t" . '<lastmod>'.$url['lastmod'].'</lastmod>' . "\n";
$content .= "\t\t" . '<changefreq>'.$url['changefreq'].'</changefreq>' . "\n";
$content .= "\t\t" . '<priority>'.$url['priority'].'</priority>' . "\n";
$content .= "\t" . '</url>' . "\n";
}
$content .= '</urlset>';
return $this->SaveFile($content, $file);
}
/**
* public function to generate sitemap index file
*
* @return boolean
*/
public function GenerateSitemapIndex(){
$content = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
$content .= '<sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84">' . "\n";
$pattern = defined('GOOGLE_SITEMAP_COMPRESS')
? GOOGLE_SITEMAP_COMPRESS == 'true'
? "{sitemap*.xml.gz}"
: "{sitemap*.xml}"
: "{sitemap*.xml}";
foreach ( glob($this->savepath . $pattern, GLOB_BRACE) as $filename ) {
if ( preg_match('/index/', $filename) ) continue;
$content .= "\t" . '<sitemap>' . "\n";
$content .= "\t\t" . '<loc>'.$this->base_url . basename($filename).'</loc>' . "\n";
$content .= "\t\t" . '<lastmod>'.date ("Y-m-d", filemtime($filename)).'</lastmod>' . "\n";
$content .= "\t" . '</sitemap>' . "\n";
}
$content .= '</sitemapindex>';
return $this->SaveFile($content, 'index');
}
/**
* public function to generate product sitemap data
*
* @return boolean
*/
public function GenerateProductSitemap(){
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$aContents = oos_get_content();
$sql = "SELECT products_id as pid, products_date_added as date_added,
products_last_modified as last_mod, products_ordered
FROM " . $oostable['products'] . "
WHERE products_setting = '2'
ORDER BY products_ordered DESC";
if ( $products_query = $dbconn->Execute($sql) ){
$this->debug['QUERY']['PRODUCTS']['STATUS'] = 'success';
$this->debug['QUERY']['PRODUCTS']['NUM_ROWS'] = $products_query->RecordCount();
$container = array();
$number = 0;
$top = 0;
while ( $result = $products_query->fields ) {
$top = max($top, $result['products_ordered']);
$location = oos_href_link($aContents['product_info'], 'products_id=' . $result['pid'], false, true);
$lastmod = oos_is_not_null($result['last_mod']) ? $result['last_mod'] : $result['date_added'];
$changefreq = GOOGLE_SITEMAP_PROD_CHANGE_FREQ;
$ratio = $top > 0 ? $result['products_ordered']/$top : 0;
$priority = $ratio < .1 ? .1 : number_format($ratio, 1, '.', '');
$container[] = array('loc' => htmlspecialchars(utf8_encode($location)),
'lastmod' => date ("Y-m-d", strtotime($lastmod)),
'changefreq' => $changefreq,
'priority' => $priority);
if ( sizeof($container) >= 50000 ){
$type = $number == 0 ? 'products' : 'products' . $number;
$this->GenerateSitemap($container, $type);
$container = array();
$number++;
}
// Move that ADOdb pointer!
$products_query->MoveNext();
}
if ( sizeof($container) > 1 ) {
$type = $number == 0 ? 'products' : 'products' . $number;
return $this->GenerateSitemap($container, $type);
}
} else {
$this->debug['QUERY']['PRODUCTS']['STATUS'] = 'false';
$this->debug['QUERY']['PRODUCTS']['NUM_ROWS'] = '0';
}
}
/**
* Funciton to generate category sitemap data
*
* @return boolean
*/
public function GenerateCategorySitemap(){
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$aContents = oos_get_content();
$sql = "SELECT categories_id as cid, date_added, last_modified as last_mod
FROM " . $oostable['categories'] . "
WHERE categories_status = '2'
AND access = '0'
ORDER BY parent_id ASC, sort_order ASC, categories_id ASC";
if ( $categories_query = $dbconn->Execute($sql) ){
$this->debug['QUERY']['CATEOGRY']['STATUS'] = 'success';
$this->debug['QUERY']['CATEOGRY']['NUM_ROWS'] = $categories_query->RecordCount();
$container = array();
$number = 0;
while( $result = $categories_query->fields ) {
$location = oos_href_link($aContents['shop'], 'category=' . $this->GetFullcPath($result['cid']), false, true);
$lastmod = oos_is_not_null($result['last_mod']) ? $result['last_mod'] : $result['date_added'];
$changefreq = GOOGLE_SITEMAP_CAT_CHANGE_FREQ;
$priority = .5;
$container[] = array('loc' => htmlspecialchars(utf8_encode($location)),
'lastmod' => date ("Y-m-d", strtotime($lastmod)),
'changefreq' => $changefreq,
'priority' => $priority);
if ( sizeof($container) >= 50000 ){
$type = $number == 0 ? 'categories' : 'categories' . $number;
$this->GenerateSitemap($container, $type);
$container = array();
$number++;
}
// Move that ADOdb pointer!
$categories_query->MoveNext();
}
if ( sizeof($container) > 1 ) {
$type = $number == 0 ? 'categories' : 'categories' . $number;
return $this->GenerateSitemap($container, $type);
}
} else {
$this->debug['QUERY']['CATEOGRY']['STATUS'] = 'false';
$this->debug['QUERY']['CATEOGRY']['NUM_ROWS'] = '0';
}
}
/**
* public function to retrieve full cPath from category ID
*
* @param mixed $cID Could contain cPath or single category_id
* @return string Full cPath string
*/
public function GetFullcPath($cID){
if ( preg_match('/_/', $cID) ){
return $cID;
} else {
$c = array();
$this->GetParentCategories($c, $cID);
$c = array_reverse($c);
$c[] = $cID;
$cID = sizeof($c) > 1 ? implode('_', $c) : $cID;
return $cID;
}
}
/**
* Recursion public function to retrieve parent categories from category ID
*
* @param mixed $categories Passed by reference
* @param integer $categories_id
*/
public function GetParentCategories(&$categories, $categories_id) {
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$sql = "SELECT parent_id
FROM " . $oostable['categories'] . "
WHERE categories_id='" . intval($categories_id) . "'";
$parent_categories_query = $dbconn->Execute($sql);
while ($parent_categories = $parent_categories_query->fields) {
if ($parent_categories['parent_id'] == 0) return TRUE;
$categories[sizeof($categories)] = $parent_categories['parent_id'];
if ($parent_categories['parent_id'] != $categories_id) {
$this->GetParentCategories($categories, $parent_categories['parent_id']);
}
// Move that ADOdb pointer!
$parent_categories_query->MoveNext();
}
}
/**
* Utility public function to read and return the contents of a GZ formatted file
*
* @param string $file File to open
* @return string
*/
public function ReadGZ( $file ){
$file = $this->savepath . $file;
$lines = gzfile($file);
return implode('', $lines);
}
}

View File

@ -0,0 +1,156 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
browser language detection logic
Copyright phpMyAdmin (select_lang.lib.php3 v1.24 04/19/2002)
Copyright Stephane Garin <sgarin@sgarin.com> (detect_language.php v0.1 04/02/2002)
File: language.php,v 1.6 2003/06/28 16:53:09 dgw_
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
class language {
var $languages;
var $_languages = array();
public function __construct() {
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$languagestable = $oostable['languages'];
$languages_sql = "SELECT languages_id, name, iso_639_2, iso_639_1
FROM $languagestable
WHERE status = '1'
ORDER BY sort_order";
if (USE_CACHE == 'true') {
$languages_result = $dbconn->CacheExecute(3600*24, $languages_sql);
} else {
$languages_result = $dbconn->Execute($languages_sql);
}
while ($languages = $languages_result->fields) {
$this->_languages[$languages['iso_639_2']] = array('id' => $languages['languages_id'],
'name' => $languages['name'],
'iso_639_2' => $languages['iso_639_2'],
'iso_639_1' => $languages['iso_639_1']);
// Move that ADOdb pointer!
$languages_result->MoveNext();
}
}
function set_language($sLang = '') {
if ( (oos_is_not_null($sLang)) && ($this->exists($sLang) === TRUE)) {
$this->language = $this->get($sLang);
} else {
$this->language = $this->get(DEFAULT_LANGUAGE);
}
if (isset($_SESSION) && isset($_SESSION['customer_id'])) {
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$sLanguage = oos_var_prep_for_os($this->language['iso_639_2']);
$customerstable = $oostable['customers'];
$query = "UPDATE $customerstable SET customers_language =? WHERE customers_id =?";
$result = $dbconn->Execute($query, array($sLanguage, (int)$_SESSION['customer_id']));
}
}
function get_browser_language() {
$http_accept_language = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
$browser_languages = array(
'af' => 'af|afrikaans',
'ar' => 'ar([-_][[:alpha:]]{2})?|arabic',
'az' => 'az|azerbaijani',
'bg' => 'bg|bulgarian',
'br' => 'pt[-_]br|brazilian portuguese',
'bs' => 'bs|bosnian',
'ca' => 'ca|catalan',
'cs' => 'cs|czech',
'da' => 'da|danish',
'deu' => 'de([-_][[:alpha:]]{2})?|german',
'el' => 'el|greek',
'eng' => 'en([-_][[:alpha:]]{2})?|english',
'spa' => 'es([-_][[:alpha:]]{2})?|spanish',
'et' => 'et|estonian',
'fi' => 'fi|finnish',
'fra' => 'fr([-_][[:alpha:]]{2})?|french',
'gl' => 'gl|galician',
'hu' => 'hu|hungarian',
'ita' => 'it|italian',
'ka' => 'ka|georgian',
'lt' => 'lt|lithuanian',
'nl' => 'nl([-_][[:alpha:]]{2})?|dutch',
'no' => 'no|norwegian',
'pol' => 'pl|polish',
'pt' => 'pt([-_][[:alpha:]]{2})?|portuguese',
'ro' => 'ro|romanian',
'rus' => 'ru|russian',
'sk' => 'sk|slovak',
'sr' => 'sr|serbian',
'sv' => 'sv|swedish',
'tr' => 'tr|turkish',
'uk' => 'uk|ukrainian',
'zh' => 'zh|chinese simplified');
foreach ($http_accept_language as $browser_language) {
foreach ($browser_languages as $key => $value) {
if (preg_match('/^(' . $value . ')(;q=[0-9]\\.[0-9])?$/', $browser_language) && $this->exists($key)) {
$this->set_language($key);
return TRUE;
}
}
}
$this->set_language(DEFAULT_LANGUAGE);
}
function get($sLang) {
return $this->_languages[$sLang];
}
function getAll() {
return $this->_languages;
}
function exists($sLang) {
return array_key_exists($sLang, $this->_languages);
}
function getID() {
return $this->language['id'];
}
function getName() {
return $this->language['name'];
}
function getCode() {
return $this->language['iso_639_2'];
}
}

View File

@ -0,0 +1,89 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: message_stack.php,v 1.5 2002/11/22 18:45:46 dgw_
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
----------------------------------------------------------------------
Example usage:
$oMessage = new messageStack();
$oMessage->add('Error: Error 1', 'error');
$oMessage->add('Error: Error 2', 'warning');
if ($oMessage->size > 0) echo $oMessage->output();
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
class messageStack {
public function __construct() {
$this->messages = array();
if (isset($_SESSION) && isset($_SESSION['messageToStack'])) {
$messageToStack = $_SESSION['messageToStack'];
for ($i=0, $n=count($messageToStack); $i<$n; $i++) {
$this->add($messageToStack[$i]['class'], $messageToStack[$i]['text'], $messageToStack[$i]['type']);
}
unset($_SESSION['messageToStack']);
}
}
// class methods
public function add($class, $message, $type = 'danger') {
$this->messages[] = array('class' => $class, 'type' => $type, 'text' => $message);
}
public function add_session($class, $message, $type = 'danger') {
$messageToStack = array();
if (isset($_SESSION['messageToStack']) && is_array($_SESSION['messageToStack'])) {
$messageToStack = $_SESSION['messageToStack'];
}
$messageToStack[] = array('class' => $class, 'text' => $message, 'type' => $type);
$_SESSION['messageToStack'] = $messageToStack;
$this->add($class, $message, $type);
}
public function reset() {
$this->messages = array();
}
public function output($class) {
$output = array();
for ($i=0, $n=count($this->messages); $i<$n; $i++) {
if ($this->messages[$i]['class'] == $class) {
$output[] = $this->messages[$i];
}
}
return $output;
}
public function size($class) {
$count = 0;
for ($i=0, $n=count($this->messages); $i<$n; $i++) {
if ($this->messages[$i]['class'] == $class) {
$count++;
}
}
return $count;
}
}

View File

@ -0,0 +1,313 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: category_tree.php,v 1.2, 2004/10/26 20:07:09 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2001 - 2004 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
class nav_menu {
var $root_category_id = 0,
$max_level = 0,
$count = 0,
$count_col = 0,
$submenu = 0,
$data = array(),
$root_start_string = '<li class="main-nav-item main-nav-expanded">',
$root_end_string = '</li>',
$parent_start_string = '<li>',
$parent_end_string = '</li>',
$parent_group_start_string = '<ul>',
$parent_group_end_string = '</ul>',
$child_start_string = '<li>',
$child_end_string = '</li>',
$breadcrumb_separator = '_',
$breadcrumb_usage = TRUE,
$spacer_string = '',
$spacer_multiplier = 1,
$follow_cpath = FALSE,
$cpath_array = array(),
$cpath_start_string = '',
$cpath_end_string = '',
$banner_image = '',
$banner_link = '',
$banner_name = '';
public function __construct() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$nLanguageID = isset($_SESSION['language_id']) ? intval( $_SESSION['language_id'] ) : DEFAULT_LANGUAGE_ID;
$categoriestable = $oostable['categories'];
$categories_descriptionstable = $oostable['categories_description'];
$sql = "SELECT c.categories_id, cd.categories_name, c.parent_id, c.categories_banner, c.color, c.menu_type, c.categories_status
FROM $categoriestable c,
$categories_descriptionstable cd
WHERE c.categories_status = '2'
AND c.categories_id = cd.categories_id
AND cd.categories_languages_id = '" . intval($nLanguageID) . "'
ORDER BY c.parent_id, c.sort_order, cd.categories_name";
if (USE_CACHE == 'true') {
$categories_result = $dbconn->CacheExecute(3600, $sql);
} else {
$categories_result = $dbconn->Execute($sql);
}
$this->data = array();
while ($categories = $categories_result->fields) {
$this->data[$categories['parent_id']][$categories['categories_id']] = array('name' => $categories['categories_name'],
'banner' => $categories['categories_banner'],
'color' => $categories['color'],
'menu_type' => $categories['menu_type'],
'count' => 0);
// Move that ADOdb pointer!
$categories_result->MoveNext();
}
}
public function buildBranch($parent_id, $level = 0, $submenu = 0) {
$aContents = oos_get_content();
if (isset($this->data[$parent_id])) {
foreach ($this->data[$parent_id] as $category_id => $category) {
$this->count++;
if ($this->breadcrumb_usage == TRUE) {
$category_link = $this->buildBreadcrumb($category_id);
} else {
$category_link = $category_id;
}
$sLink = '<a href="' . oos_href_link($aContents['shop'], 'category=' . $category_link) . '" title="' . $category['name'] . '">';
if ($category['banner'] != '') {
$this->banner_image = OOS_IMAGES . 'banners/large/' . $category['banner'];
$this->banner_link = oos_href_link($aContents['shop'], 'category=' . $category_link);
$this->banner_name = $category['name'];
}
switch ($level) {
case 0:
$result .= $this->root_start_string;
break;
case 1:
if ($submenu == 0) {
$submenu++;
$this->count = 0;
$this->submenu = 1;
$this->count_col++;
$result .= '<div class="main-nav-submenu">
<div class="row"><div class="col-md-3"><ul class="list-unstyled"><li>';
} else {
$this->count+2;
$result .= '<ul class="list-unstyled"><li>';
}
break;
case 2:
$result .= $this->parent_start_string . "\n";
break;
}
$result .= $sLink;
if ($level == 0) {
$result .= '<i class="fa fa-circle-o-notch ' . $category['color'] . '" aria-hidden="true"></i>';
}
switch ($category['menu_type'] ) {
case 'NEW':
$result .= '<span class="badge badge-danger float-right">NEW</span>';
break;
case 'PROMO':
$result .= '<span class="badge badge-success float-right">PROMO</span>';
break;
}
if ($this->follow_cpath === TRUE) {
if (in_array($category_id, $this->cpath_array)) {
$result .= $this->cpath_start_string . $category['name'] . $this->cpath_end_string;
} else {
$result .= $category['name'];
}
} else {
$result .= $category['name'];
}
$result .= '</a>';
if ($level == 1) {
$result .= '</li>';
}
if ($level == 2) {
if ($this->count > 8) {
$this->count = 0;
$this->count_col++;
$result .= '</li></ul></div><div class="col-md-3">' . "\n";
}
}
if (isset($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {
if ($this->follow_cpath === TRUE) {
if (in_array($category_id, $this->cpath_array)) {
$result .= $this->buildBranch($category_id, $level+1);
}
} else {
$result .= $this->buildBranch($category_id, $level+1, $submenu);
}
}
switch ($level) {
case 0:
if ($this->submenu > 0) {
if (($this->banner_image != '') && ($this->count_col <= 3)) {
if ($this->count_col == 1) {
$result .= '</div><div class="col-md-9 text-right hidden-sm-down">';
} elseif ($this->count_col == 2) {
$result .= '</div><div class="col-md-6 text-right hidden-sm-down">';
} elseif ($this->count_col == 1) {
$result .= '</div><div class="col-md-6 text-right hidden-sm-down">';
}
$result .= '<a class="mt-15 block" href="'. $this->banner_link . '">
<img class="img-fluid" src="' . $this->banner_image . '" alt="' . $this->banner_name .'">
</a>';
}
$result .= '</div></div></div>' . "\n";
}
$this->submenu = 0;
$result .= $this->root_end_string;
break;
case 1:
if ($this->count > 0) {
$result .= '</ul>';
}
break;
case 2:
if ($this->count > 0) {
$result .= $this->parent_end_string;
}
break;
}
}
}
return $result;
}
public function buildBreadcrumb($category_id, $level = 0) {
$breadcrumb = '';
foreach ($this->data as $parent => $categories) {
foreach ($categories as $id => $info) {
if ($id == $category_id) {
if ($level < 1) {
$breadcrumb = $id;
} else {
$breadcrumb = $id . $this->breadcrumb_separator . $breadcrumb;
}
if ($parent != $this->root_category_id) {
$breadcrumb = $this->buildBreadcrumb($parent, $level+1) . $breadcrumb;
}
}
}
}
return $breadcrumb;
}
public function build() {
return $this->buildBranch($this->root_category_id);
}
public function setRootCategoryID($root_category_id) {
$this->root_category_id = $root_category_id;
}
public function setMaximumLevel($max_level) {
$this->max_level = $max_level;
}
public function setRootString($root_start_string, $root_end_string) {
$this->root_start_string = $root_start_string;
$this->root_end_string = $root_end_string;
}
public function setBreadcrumbSeparator($breadcrumb_separator) {
$this->breadcrumb_separator = $breadcrumb_separator;
}
public function setBreadcrumbUsage($breadcrumb_usage) {
if ($breadcrumb_usage === TRUE) {
$this->breadcrumb_usage = TRUE;
} else {
$this->breadcrumb_usage = FALSE;
}
}
public function setCategoryPath($cpath, $cpath_start_string = '', $cpath_end_string = '') {
$this->follow_cpath = TRUE;
$this->cpath_array = explode($this->breadcrumb_separator, $cpath);
$this->cpath_start_string = $cpath_start_string;
$this->cpath_end_string = $cpath_end_string;
}
public function setFollowCategoryPath($follow_cpath) {
if ($follow_cpath === TRUE) {
$this->follow_cpath = TRUE;
} else {
$this->follow_cpath = FALSE;
}
}
public function setCategoryPathString($cpath_start_string, $cpath_end_string) {
$this->cpath_start_string = $cpath_start_string;
$this->cpath_end_string = $cpath_end_string;
}
public function setCategoryProductCountString($category_product_count_start_string, $category_product_count_end_string) {
$this->category_product_count_start_string = $category_product_count_start_string;
$this->category_product_count_end_string = $category_product_count_end_string;
}
}

View File

@ -0,0 +1,88 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: navigation_history.php,v 1.5 2003/02/12 21:07:45 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
/**
* Class Navigation History
*/
class navigationHistory {
var $path;
var $snapshot;
/**
* Constructor of our Class
*/
public function __construct() {
$this->reset();
}
public function reset() {
$this->path = array();
$this->snapshot = array();
}
public function set_snapshot($page = '') {
global $sContent;
if (is_array($page)) {
$this->snapshot = array('content' => $page['content'],
'get' => $page['get']);
} else {
$get_all = '';
if (isset($_GET)) {
$get_all = oos_get_all_get_parameters();
$get_all = oos_remove_trailing($get_all);
}
$this->snapshot = array('content' => $sContent,
'get' => $get_all);
}
}
public function clear_snapshot() {
$this->snapshot = array();
}
public function set_path_as_snapshot($history = 0) {
$pos = (count($this->path)-1-$history);
$this->snapshot = array('content' => $this->path[$pos]['content'],
'get' => $this->path[$pos]['get']);
}
public function debug() {
for ($i=0, $n=count($this->path); $i<$n; $i++) {
echo $this->path[$i]['content'] . '&' . $this->path[$i]['get'] . '<br />';
echo '<br />';
}
echo '<br /><br />';
if (count($this->snapshot) > 0) {
echo $this->snapshot['content'] . '&' . $this->snapshot['get'] . '<br />';
}
}
}

View File

@ -0,0 +1,422 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: order.php,v 1.29 2003/02/11 21:13:39 dgw_
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
class order {
var $info;
var $totals;
var $products;
var $customer;
var $delivery;
var $content_type;
public function __construct( $order_id = '') {
$this->info = array();
$this->totals = array();
$this->products = array();
$this->customer = array();
$this->delivery = array();
if (oos_is_not_null($order_id)) {
$this->query($order_id);
} else {
$this->cart();
}
}
public function query($order_id) {
$order_id = oos_db_prepare_input($order_id);
$nLanguageID = isset($_SESSION['language_id']) ? intval( $_SESSION['language_id'] ) : DEFAULT_LANGUAGE_ID;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$orderstable = $oostable['orders'];
$sql = "SELECT customers_id, customers_name, customers_company, customers_street_address,
customers_city, customers_postcode, customers_state,
customers_country, customers_telephone, customers_email_address,
customers_address_format_id, delivery_name, delivery_company,
delivery_street_address, delivery_city, delivery_postcode,
delivery_state, delivery_country, delivery_address_format_id, billing_name,
billing_company, billing_street_address, billing_city,
billing_postcode, billing_state, billing_country, billing_address_format_id,
payment_method, currency, currency_value,
date_purchased, orders_status, last_modified
FROM $orderstable
WHERE orders_id = '" . intval($order_id) . "'";
$order = $dbconn->GetRow($sql);
$orders_totaltable = $oostable['orders_total'];
$sql = "SELECT title, text
FROM $orders_totaltable
WHERE orders_id = '" . intval($order_id) . "'
ORDER BY sort_order";
$this->totals = $dbconn->GetAll($sql);
$orders_totaltable = $oostable['orders_total'];
$sql = "SELECT text
FROM $orders_totaltable
WHERE orders_id = '" . intval($order_id) . "'
AND class = 'ot_total'";
$order_total_text = $dbconn->GetOne($sql);
$orders_totaltable = $oostable['orders_total'];
$sql = "SELECT title
FROM $orders_totaltable
WHERE orders_id = '" . intval($order_id) . "'
AND class = 'ot_shipping'";
$shipping_method_title = $dbconn->GetOne($sql);
$orders_statustable = $oostable['orders_status'];
$sql = "SELECT orders_status_name
FROM $orders_statustable
WHERE orders_status_id = '" . $order['orders_status'] . "'
AND orders_languages_id = '" . intval($nLanguageID) . "'";
$orders_status_name = $dbconn->GetOne($sql);
$this->info = array('currency' => $order['currency'],
'currency_value' => $order['currency_value'],
'payment_method' => $order['payment_method'],
'cc_type' => $order['cc_type'],
'cc_owner' => $order['cc_owner'],
'cc_number' => $order['cc_number'],
'cc_expires' => $order['cc_expires'],
'date_purchased' => $order['date_purchased'],
'orders_status' => $orders_status_name,
'last_modified' => $order['last_modified'],
'total' => strip_tags($order_total_text),
'shipping_method' => ((substr($shipping_method_title, -1) == ':') ? substr(strip_tags($shipping_method_title), 0, -1) : strip_tags($shipping_method_title)));
$this->customer = array('id' => $order['customers_id'],
'name' => $order['customers_name'],
'company' => $order['customers_company'],
'street_address' => $order['customers_street_address'],
'city' => $order['customers_city'],
'postcode' => $order['customers_postcode'],
'state' => $order['customers_state'],
'country' => $order['customers_country'],
'format_id' => $order['customers_address_format_id'],
'telephone' => $order['customers_telephone'],
'email_address' => $order['customers_email_address']);
$this->delivery = array('name' => $order['delivery_name'],
'company' => $order['delivery_company'],
'street_address' => $order['delivery_street_address'],
'city' => $order['delivery_city'],
'postcode' => $order['delivery_postcode'],
'state' => $order['delivery_state'],
'country' => $order['delivery_country'],
'format_id' => $order['delivery_address_format_id']);
if (empty($this->delivery['name']) && empty($this->delivery['street_address'])) {
$this->delivery = FALSE;
}
$this->billing = array('name' => $order['billing_name'],
'company' => $order['billing_company'],
'street_address' => $order['billing_street_address'],
'city' => $order['billing_city'],
'postcode' => $order['billing_postcode'],
'state' => $order['billing_state'],
'country' => $order['billing_country'],
'format_id' => $order['billing_address_format_id']);
$index = 0;
$orders_productstable = $oostable['orders_products'];
$sql = "SELECT orders_products_id, products_id, products_name, products_model,
products_ean, products_serial_number, products_price, products_tax,
products_quantity, final_price
FROM $orders_productstable
WHERE orders_id = '" . intval($order_id) . "'";
$orders_products_result = $dbconn->Execute($sql);
while ($orders_products = $orders_products_result->fields) {
$this->products[$index] = array('qty' => $orders_products['products_quantity'],
'id' => $orders_products['products_id'],
'name' => $orders_products['products_name'],
'model' => $orders_products['products_model'],
'ean' => $orders_products['products_ean'],
'serial_number' => $orders_products['products_serial_number'],
'tax' => $orders_products['products_tax'],
'price' => $orders_products['products_price'],
'final_price' => $orders_products['final_price']);
$subindex = 0;
$orders_products_attributestable = $oostable['orders_products_attributes'];
$sql = "SELECT products_options, products_options_values, options_values_price, price_prefix
FROM $orders_products_attributestable
WHERE orders_id = '" . intval($order_id) . "'
AND orders_products_id = '" . $orders_products['orders_products_id'] . "'";
$attributes_result = $dbconn->Execute($sql);
if ($attributes_result->RecordCount()) {
while ($attributes = $attributes_result->fields) {
$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
'value' => $attributes['products_options_values'],
'prefix' => $attributes['price_prefix'],
'price' => $attributes['options_values_price']);
$subindex++;
// Move that ADOdb pointer!
$attributes_result->MoveNext();
}
}
$this->info['tax_groups']["{$this->products[$index]['tax']}"] = '1';
$index++;
// Move that ADOdb pointer!
$orders_products_result->MoveNext();
}
}
public function cart() {
global $oCurrencies, $aUser;
$this->content_type = $_SESSION['cart']->get_content_type();
$nLanguageID = isset($_SESSION['language_id']) ? intval( $_SESSION['language_id'] ) : DEFAULT_LANGUAGE_ID;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$customerstable = $oostable['customers'];
$address_booktable = $oostable['address_book'];
$zonestable = $oostable['zones'];
$countriestable = $oostable['countries'];
$sql = "SELECT c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address,
ab.entry_company, ab.entry_street_address, ab.entry_postcode, ab.entry_city,
ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2,
co.countries_iso_code_3, co.address_format_id, ab.entry_state
FROM $customerstable c,
$address_booktable ab LEFT JOIN
$zonestable z
ON (ab.entry_zone_id = z.zone_id) LEFT JOIN
$countriestable co
ON (ab.entry_country_id = co.countries_id)
WHERE c.customers_id = '" . intval($_SESSION['customer_id']) . "' AND
ab.customers_id = '" . intval($_SESSION['customer_id']) . "' AND
c.customers_default_address_id = ab.address_book_id";
$customer_address = $dbconn->GetRow($sql);
$address_booktable = $oostable['address_book'];
$zonestable = $oostable['zones'];
$countriestable = $oostable['countries'];
$sql = "SELECT ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address,
ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name,
ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2,
c.countries_iso_code_3, c.address_format_id, ab.entry_state
FROM $address_booktable ab LEFT JOIN
$zonestable z
ON (ab.entry_zone_id = z.zone_id) LEFT JOIN
$countriestable c ON
(ab.entry_country_id = c.countries_id)
WHERE ab.customers_id = '" . intval($_SESSION['customer_id']) . "' AND
ab.address_book_id = '" . intval($_SESSION['sendto']) . "'";
$shipping_address = $dbconn->GetRow($sql);
$address_booktable = $oostable['address_book'];
$zonestable = $oostable['zones'];
$countriestable = $oostable['countries'];
$sql = "SELECT ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address,
ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name,
ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2,
c.countries_iso_code_3, c.address_format_id, ab.entry_state
FROM $address_booktable ab LEFT JOIN
$zonestable z
ON (ab.entry_zone_id = z.zone_id) LEFT JOIN
$countriestable c ON
(ab.entry_country_id = c.countries_id)
WHERE ab.customers_id = '" . intval($_SESSION['customer_id']) . "' AND
ab.address_book_id = '" . intval($_SESSION['billto']) . "'";
$billing_address = $dbconn->GetRow($sql);
$class =& $_SESSION['payment'];
if ($this->content_type == 'virtual') {
$tax_address = array('entry_country_id' => $billing_address['entry_country_id'],
'entry_zone_id' => $billing_address['entry_zone_id']);
} else {
$tax_address = array('entry_country_id' => $shipping_address['entry_country_id'],
'entry_zone_id' => $shipping_address['entry_zone_id']);
}
$this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,
'currency' => $_SESSION['currency'],
'currency_value' => $oCurrencies->currencies[$_SESSION['currency']]['value'],
'payment_method' => $GLOBALS[$class]->title,
'shipping_method' => $_SESSION['shipping']['title'],
'shipping_cost' => $_SESSION['shipping']['cost'],
'comments' => (isset($_SESSION['comments']) ? $_SESSION['comments'] : ''),
'shipping_class' => ( (strpos($shipping['id'],'_') > 0) ? substr( strrev( strchr(strrev($shipping['id']),'_') ),0,-1) : $shipping['id'] ),
'payment_class' => $_SESSION['payment'],
);
if (isset($GLOBALS['payment']) && is_object($GLOBALS['payment'])) {
$this->info['payment_method'] = $GLOBALS['payment']->title;
if ( isset($GLOBALS['payment']->order_status) && is_numeric($GLOBALS['payment']->order_status) && ($GLOBALS['payment']->order_status > 0) ) {
$this->info['order_status'] = $GLOBALS['payment']->order_status;
}
}
$this->customer = array('firstname' => $customer_address['customers_firstname'],
'lastname' => $customer_address['customers_lastname'],
'company' => $customer_address['entry_company'],
'street_address' => $customer_address['entry_street_address'],
'city' => $customer_address['entry_city'],
'postcode' => $customer_address['entry_postcode'],
'state' => ((oos_is_not_null($customer_address['entry_state'])) ? $customer_address['entry_state'] : $customer_address['zone_name']),
'zone_id' => $customer_address['entry_zone_id'],
'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']),
'format_id' => $customer_address['address_format_id'],
'telephone' => $customer_address['customers_telephone'],
'email_address' => $customer_address['customers_email_address']);
$this->delivery = array('firstname' => $shipping_address['entry_firstname'],
'lastname' => $shipping_address['entry_lastname'],
'company' => $shipping_address['entry_company'],
'street_address' => $shipping_address['entry_street_address'],
'city' => $shipping_address['entry_city'],
'postcode' => $shipping_address['entry_postcode'],
'state' => ((oos_is_not_null($shipping_address['entry_state'])) ? $shipping_address['entry_state'] : $shipping_address['zone_name']),
'zone_id' => $shipping_address['entry_zone_id'],
'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']),
'country_id' => $shipping_address['entry_country_id'],
'format_id' => $shipping_address['address_format_id']);
$this->billing = array('firstname' => $billing_address['entry_firstname'],
'lastname' => $billing_address['entry_lastname'],
'company' => $billing_address['entry_company'],
'street_address' => $billing_address['entry_street_address'],
'city' => $billing_address['entry_city'],
'postcode' => $billing_address['entry_postcode'],
'state' => ((oos_is_not_null($billing_address['entry_state'])) ? $billing_address['entry_state'] : $billing_address['zone_name']),
'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3']),
'country_id' => $billing_address['entry_country_id'],
'format_id' => $billing_address['address_format_id']);
$index = 0;
$products = $_SESSION['cart']->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
$this->products[$index] = array('qty' => $products[$i]['quantity'],
'name' => $products[$i]['name'],
'essential_characteristics' => $products[$i]['essential_characteristics'],
'image' => $products[$i]['image'],
'model' => $products[$i]['model'],
'ean' => $products[$i]['ean'],
'tax' => oos_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $$tax_address['entry_zone_id']),
'price' => $products[$i]['price'],
'final_price' => $products[$i]['price'] + $_SESSION['cart']->attributes_price($products[$i]['id']),
'weight' => $products[$i]['weight'],
'towlid' => $products[$i]['towlid'],
'id' => $products[$i]['id']);
if ($products[$i]['attributes']) {
$subindex = 0;
reset($products[$i]['attributes']);
foreach ($products[$i]['attributes'] as $option => $value) {
$products_optionstable = $oostable['products_options'];
$products_options_valuestable = $oostable['products_options_values'];
$products_attributestable = $oostable['products_attributes'];
// if (($option == 4) || ($option == 3)) {
if ($value == PRODUCTS_OPTIONS_VALUE_TEXT_ID) {
$sql = "SELECT popt.products_options_name, poval.products_options_values_name,
pa.options_values_price, pa.price_prefix
FROM $products_optionstable popt,
$products_options_valuestable poval,
$products_attributestable pa
WHERE
pa.products_id = '" . oos_db_input($products[$i]['id']) . "' AND
pa.options_id = '" . oos_db_input($option) . "' AND
pa.options_id = popt.products_options_id AND
popt.products_options_languages_id = '" . intval($nLanguageID) . "'";
} else {
$sql = "SELECT popt.products_options_name, poval.products_options_values_name,
pa.options_values_price, pa.price_prefix
FROM $products_optionstable popt,
$products_options_valuestable poval,
$products_attributestable pa
WHERE pa.products_id = '" . oos_db_input($products[$i]['id']) . "' AND
pa.options_id = '" . oos_db_input($option) . "' AND
pa.options_id = popt.products_options_id AND
pa.options_values_id = '" . oos_db_input($value) . "' AND
pa.options_values_id = poval.products_options_values_id AND
popt.products_options_languages_id = '" . intval($nLanguageID) . "' AND
poval.products_options_values_languages_id = '" . intval($nLanguageID) . "'";
}
$attributes = $dbconn->GetRow($sql);
if ($value == PRODUCTS_OPTIONS_VALUE_TEXT_ID){
$attr_value = $products[$i]['attributes_values'][$option];
} else {
$attr_value = $attributes['products_options_values_name'];
}
$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'],
'value' => $attr_value,
'option_id' => $option,
'value_id' => $value,
'prefix' => $attributes['price_prefix'],
'price' => $attributes['options_values_price']);
$subindex++;
}
}
$nPrice = $oCurrencies->calculate_price($this->products[$index]['final_price'], $this->products[$index]['tax'], $this->products[$index]['qty']);
$this->info['subtotal'] += $nPrice;
$products_tax = $this->products[$index]['tax'];
if ($aUser['price_with_tax'] == 1) {
$this->info['tax'] += $nPrice - ($nPrice / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
if (isset($this->info['tax_groups']["$products_tax"])) {
$this->info['tax_groups']["$products_tax"] += $nPrice - ($nPrice / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
} else {
$this->info['tax_groups']["$products_tax"] = $nPrice - ($nPrice / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
}
} else {
$this->info['tax'] += ($products_tax / 100) * $nPrice;
if (isset($this->info['tax_groups']["$products_tax"])) {
$this->info['tax_groups']["$products_tax"] += ($products_tax / 100) * $nPrice;
} else {
$this->info['tax_groups']["$products_tax"] = ($products_tax / 100) * $nPrice;
}
}
$index++;
}
if ($aUser['price_with_tax'] == 1) {
$this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
} else {
$this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
}
}
}

View File

@ -0,0 +1,278 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: order_total.php,v 1.3.2.7 2003/05/14 22:52:58 wilt
orig: order_total.php,v 1.4 2003/02/11 00:04:53 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
class order_total {
var $modules;
// class constructor
public function __construct() {
global $aLang;
if (defined('MODULE_ORDER_TOTAL_INSTALLED') && oos_is_not_null(MODULE_ORDER_TOTAL_INSTALLED)) {
$this->modules = explode(';', MODULE_ORDER_TOTAL_INSTALLED);
$sLanguage = isset($_SESSION['language']) ? $_SESSION['language'] : DEFAULT_LANGUAGE;
reset($this->modules);
foreach ($this->modules as $value) {
include_once MYOOS_INCLUDE_PATH . '/includes/languages/' . $sLanguage . '/modules/order_total/' . $value;
include_once MYOOS_INCLUDE_PATH . '/includes/modules/order_total/' . $value;
$class = substr($value, 0, strrpos($value, '.'));
$GLOBALS[$class] = new $class;
}
}
}
public function process() {
$order_total_array = array();
if (is_array($this->modules)) {
reset($this->modules);
foreach ($this->modules as $value) {
$class = substr($value, 0, strrpos($value, '.'));
if ($GLOBALS[$class]->enabled) {
$GLOBALS[$class]->output = array();
$GLOBALS[$class]->process();
for ($i=0, $n=sizeof($GLOBALS[$class]->output); $i<$n; $i++) {
if (oos_is_not_null($GLOBALS[$class]->output[$i]['title']) && oos_is_not_null($GLOBALS[$class]->output[$i]['text'])) {
$order_total_array[] = array('code' => $GLOBALS[$class]->code,
'title' => $GLOBALS[$class]->output[$i]['title'],
'text' => $GLOBALS[$class]->output[$i]['text'],
'value' => $GLOBALS[$class]->output[$i]['value'],
'sort_order' => $GLOBALS[$class]->sort_order);
}
}
}
}
}
return $order_total_array;
}
public function output() {
$output_string = NULL;
if (is_array($this->modules)) {
reset($this->modules);
foreach ($this->modules as $value) {
$class = substr($value, 0, strrpos($value, '.'));
if ($GLOBALS[$class]->enabled) {
$size = count($GLOBALS[$class]->output);
for ($i=0; $i<$size; $i++) {
$output_string .= ' <tr>' . "\n" .
' <td align="right">' . $GLOBALS[$class]->output[$i]['title'] . '</td>' . "\n" .
' <td align="right">' . $GLOBALS[$class]->output[$i]['text'] . '</td>' . "\n" .
' </tr>';
}
}
}
}
return $output_string;
}
/**
* This public function is called in checkout payment after display of payment methods. It actually calls
* two credit class public functions.
*
* use_credit_amount() is normally a checkbox used to decide whether the credit amount should be applied to reduce
* the order total. Whether this is a Gift Voucher, or discount coupon or reward points etc.
*
* The second public function called is credit_selection(). This in the credit classes already made is usually a redeem box.
* for entering a Gift Voucher number. Note credit classes can decide whether this part is displayed depending on
* E.g. a setting in the admin section.
*/
public function credit_selection() {
global $aLang;
$selection_string = '';
$close_string = '';
$credit_class_string = '';
if ( (MODULE_ORDER_TOTAL_GV_STATUS == 'true') || (MODULE_ORDER_TOTAL_COUPON_STATUS == 'true') ) {
$header_string = '<tr>' . "\n";
$header_string .= ' <td><table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n";
$header_string .= ' <tr>' . "\n";
$header_string .= ' <td class="main"><strong>' . $aLang['table_heading_credit'] . '</strong></td>' . "\n";
$header_string .= ' </tr>' . "\n";
$header_string .= ' </table></td>' . "\n";
$header_string .= ' </tr>' . "\n";
$header_string .= '<tr>' . "\n";
$header_string .= ' <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">' . "\n";
$header_string .= ' <tr class="infoBoxContents"><td><table border="0" width="100%" cellspacing="0" cellpadding="2">' ."\n";
$header_string .= ' <tr><td width="10"></td>' . "\n";
$header_string .= ' <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n";
$close_string = ' </table></td>';
$close_string .= '<td width="10"></td>';
$close_string .= '</tr></table></td></tr></table></td>';
$close_string .= '<tr><td width="100%"></td></tr>';
reset($this->modules);
$output_string = '';
foreach ($this->modules as $value) {
$class = substr($value, 0, strrpos($value, '.'));
if ($GLOBALS[$class]->enabled) {
if ($GLOBALS[$class]->credit_class) {
if ($selection_string =='') $selection_string = $GLOBALS[$class]->credit_selection();
$use_credit_string = $GLOBALS[$class]->use_credit_amount();
$output_string .= '<tr colspan="4"><td colspan="4" width="100%"></td></tr>';
$output_string .= ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" >' . "\n" .
' <td width="10"></td>';
if ( ($use_credit_string !='' ) && (MODULE_ORDER_TOTAL_GV_STATUS == 'true') ) {
$output_string .= ' ' . $use_credit_string;
} elseif ( (MODULE_ORDER_TOTAL_GV_STATUS == 'true') && (MODULE_ORDER_TOTAL_COUPON_STATUS == 'true') ) {
$output_string .= ' <td class="main"></td>';
} else {
$output_string .= ' <td class="main"><strong>' . $GLOBALS[$class]->header . '</strong></td>';
}
$output_string .= '<td width="10"></td>';
$output_string .= ' </tr>' . "\n";
}
}
}
if ($output_string != '') {
$output_string = $header_string . $output_string . $selection_string;
$output_string .= $close_string;
}
}
return $output_string;
}
/**
* update_credit_account is called in checkout process on a per product basis. It's purpose
* is to decide whether each product in the cart should add something to a credit account.
* e.g. for the Gift Voucher it checks whether the product is a Gift voucher and then adds the amount
* to the Gift Voucher account.
* Another use would be to check if the product would give reward points and add these to the points/reward account.
*/
public function update_credit_account($i) {
if (MODULE_ORDER_TOTAL_INSTALLED) {
reset($this->modules);
foreach ($this->modules as $value) {
$class = substr($value, 0, strrpos($value, '.'));
if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {
$GLOBALS[$class]->update_credit_account($i);
}
}
}
}
/**
* This public function is called in checkout confirmation.
* It's main use is for credit classes that use the credit_selection() method. This is usually for
* entering redeem codes(Gift Vouchers/Discount Coupons). This public function is used to validate these codes.
* If they are valid then the necessary actions are taken, if not valid we are returned to checkout payment
* with an error
*/
public function collect_posts() {
if (MODULE_ORDER_TOTAL_INSTALLED) {
reset($this->modules);
foreach ($this->modules as $value) {
$class = substr($value, 0, strrpos($value, '.'));
if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {
$post_var = 'c' . $GLOBALS[$class]->code;
if ($_POST[$post_var]) $_SESSION[$post_var] = oos_var_prep_for_os($_POST[$post_var]);
$GLOBALS[$class]->collect_posts();
}
}
}
}
/**
* pre_confirmation_check is called on checkout confirmation. It's public function is to decide whether the
* credits available are greater than the order total. If they are then a variable (credit_covers) is set to
* true. This is used to bypass the payment method. In other words if the Gift Voucher is more than the order
* total, we don't want to go to paypal etc.
*/
public function pre_confirmation_check() {
global $payment, $oOrder, $credit_covers;
$credit_covers = FALSE;
if (MODULE_ORDER_TOTAL_INSTALLED) {
$total_deductions = 0;
reset($this->modules);
$order_total = $oOrder->info['total'];
foreach ($this->modules as $value) {
$class = substr($value, 0, strrpos($value, '.'));
if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {
$total_deductions += $GLOBALS[$class]->pre_confirmation_check($order_total);
}
}
if ($oOrder->info['total'] - $total_deductions <= 0 ) {
$credit_covers = TRUE;
}
}
return $credit_covers;
}
/**
* this public function is called in checkout process. it tests whether a decision was made at checkout payment to use
* the credit amount be applied aginst the order. If so some action is taken. E.g. for a Gift voucher the account
* is reduced the order total amount.
*/
public function apply_credit() {
if (MODULE_ORDER_TOTAL_INSTALLED) {
reset($this->modules);
foreach ($this->modules as $value) {
$class = substr($value, 0, strrpos($value, '.'));
if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {
$GLOBALS[$class]->apply_credit();
}
}
}
}
/**
* Called in checkout process to clear session variables created by each credit class module.
*/
public function clear_posts() {
if (MODULE_ORDER_TOTAL_INSTALLED) {
reset($this->modules);
foreach ($this->modules as $value) {
$class = substr($value, 0, strrpos($value, '.'));
if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {
$_SESSION[$post_var] = 'c' . $GLOBALS[$class]->code;
}
}
}
}
/**
* Called at various times. This public function calulates the total value of the order that the
* credit will be appled aginst. This varies depending on whether the credit class applies
* to shipping & tax
*/
public function get_order_total_main($class, $order_total) {
global $credit, $oOrder;
if ($GLOBALS[$class]->include_tax == 'false') $order_total=$order_total-$oOrder->info['tax'];
if ($GLOBALS[$class]->include_shipping == 'false') $order_total=$order_total-$oOrder->info['shipping_cost'];
return $order_total;
}
}

View File

@ -0,0 +1,215 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: payment.php,v 1.3.2.1 2003/05/03 23:41:23 wilt
orig: payment.php,v 1.36 2003/02/11 00:04:53 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
class payment {
var $modules, $selected_module;
// class constructor
public function __construct($module = '') {
global $aUser, $aLang, $GLOBALS;
if (defined('MODULE_PAYMENT_INSTALLED') && oos_is_not_null($aUser['payment'])) {
$this->modules = explode(';', $aUser['payment']);
$include_modules = array();
if ( (oos_is_not_null($module)) ) {
$this->selected_module = $module;
$include_modules[] = array('class' => $module, 'file' => $module . '.php');
} else {
foreach ($this->modules as $value) {
$class = basename($value, '.php');
$include_modules[] = array('class' => $class, 'file' => $value);
}
}
$sLanguage = isset($_SESSION['language']) ? $_SESSION['language'] : DEFAULT_LANGUAGE;
for ($i=0, $n=sizeof($include_modules); $i<$n; $i++) {
include_once MYOOS_INCLUDE_PATH . '/includes/languages/' . $sLanguage . '/modules/payment/' . $include_modules[$i]['file'];
include_once MYOOS_INCLUDE_PATH . '/includes/modules/payment/' . $include_modules[$i]['file'];
$GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'];
}
// if there is only one payment method, select it as default because in
// checkout_confirmation.php the $payment variable is being assigned the
if ( (oos_count_payment_modules() == 1) && (!is_object($_SESSION['payment'])) ) {
$_SESSION['payment'] = $include_modules[0]['class'];
}
if ( (oos_is_not_null($module)) && (in_array($module, $this->modules)) && (isset($GLOBALS[$module]->form_action_url)) ) {
$this->form_action_url = $GLOBALS[$module]->form_action_url;
}
}
}
// class methods
/* The following method is needed in the checkout_confirmation.php page
due to a chicken and egg problem with the payment class and order class.
The payment modules needs the order destination data for the dynamic status
feature, and the order class needs the payment module title.
The following method is a work-around to implementing the method in all
payment modules available which would break the modules in the contributions
section. This should be looked into again post 2.2.
*/
public function update_status() {
if (is_array($this->modules)) {
if (is_object($GLOBALS[$this->selected_module])) {
if (function_exists('method_exists')) {
if (method_exists($GLOBALS[$this->selected_module], 'update_status')) {
$GLOBALS[$this->selected_module]->update_status();
}
}
}
}
}
public function javascript_validation() {
global $aLang;
$js = '';
if (is_array($this->modules)) {
$js = '<script language="javascript"><!-- ' . "\n" .
'public function check_form() {' . "\n" .
' var error = 0;' . "\n" .
' var error_message = "' . $aLang['js_error'] . '";' . "\n" .
' var payment_value = null;' . "\n" .
' if (document.checkout_payment.payment.length) {' . "\n" .
' for (var i=0; i<document.checkout_payment.payment.length; i++) {' . "\n" .
' if (document.checkout_payment.payment[i].checked) {' . "\n" .
' payment_value = document.checkout_payment.payment[i].value;' . "\n" .
' }' . "\n" .
' }' . "\n" .
' } else if (document.checkout_payment.payment.checked) {' . "\n" .
' payment_value = document.checkout_payment.payment.value;' . "\n" .
' } else if (document.checkout_payment.payment.value) {' . "\n" .
' payment_value = document.checkout_payment.payment.value;' . "\n" .
' }' . "\n\n";
reset($this->modules);
foreach ($this->modules as $value) {
$class = substr($value, 0, strrpos($value, '.'));
if ($GLOBALS[$class]->enabled) {
$js .= $GLOBALS[$class]->javascript_validation();
}
}
$js .= "\n" . ' if (payment_value == null && submitter != 1) {' . "\n" .
' error_message = error_message + "' . $aLang['js_error_no_payment_module_selected'] . '";' . "\n" .
' error = 1;' . "\n" .
' }' . "\n\n" .
' if (error == 1 && submitter != 1) {' . "\n" .
' alert(error_message);' . "\n" .
' return FALSE;' . "\n" .
' } else {' . "\n" .
' return TRUE;' . "\n" .
' }' . "\n" .
'}' . "\n" .
'//--></script>' . "\n";
}
return $js;
}
public function selection() {
global $aUser, $aLang;
$selection_array = array();
if (is_array($this->modules)) {
foreach ($this->modules as $value) {
$class = basename($value, '.php');
if ($GLOBALS[$class]->enabled) {
$selection = $GLOBALS[$class]->selection();
if (is_array($selection)) $selection_array[] = $selection;
}
}
}
return $selection_array;
}
public function pre_confirmation_check() {
global $credit_covers, $payment_modules;
if (is_array($this->modules)) {
if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) {
if ($credit_covers) {
$GLOBALS[$this->selected_module]->enabled = FALSE;
$GLOBALS[$this->selected_module] = NULL;
$payment_modules = '';
} else {
$GLOBALS[$this->selected_module]->pre_confirmation_check();
}
}
}
}
public function confirmation() {
if (is_array($this->modules)) {
if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) {
return $GLOBALS[$this->selected_module]->confirmation();
}
}
}
public function process_button() {
if (is_array($this->modules)) {
if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) {
return $GLOBALS[$this->selected_module]->process_button();
}
}
}
public function before_process() {
if (is_array($this->modules)) {
if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) {
return $GLOBALS[$this->selected_module]->before_process();
}
}
}
public function after_process() {
if (is_array($this->modules)) {
if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) {
return $GLOBALS[$this->selected_module]->after_process();
}
}
}
public function get_error() {
if (is_array($this->modules)) {
if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) {
return $GLOBALS[$this->selected_module]->get_error();
}
}
}
}

View File

@ -0,0 +1,95 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
class plugin_event {
var $aEventPlugins, $aPlugins;
public function __construct() {
$this->aEventPlugins = explode(';', MODULE_PLUGIN_EVENT_INSTALLED);
}
public function getInstance() {
$this->aPlugins = array();
foreach ($this->aEventPlugins as $event) {
$this->load_plugin($event);
}
}
public function load_plugin($sInstance, $sPluginPath = '') {
$sName = 'oos_event_' . $sInstance;
if (!class_exists($sName)) {
if (empty($sPluginPath)) {
if (empty($sPluginPath)) {
$sPluginPath = $sName;
}
}
$sPluginPath = oos_var_prep_for_os($sPluginPath);
$sName = oos_var_prep_for_os($sName);
if (file_exists('includes/plugins/' . $sPluginPath . '/' . $sName . '.php')) {
include_once 'includes/plugins/' . $sPluginPath . '/' . $sName . '.php';
}
if (isset($_SESSION['language']) && file_exists('includes/plugins/' . $sPluginPath . '/lang/' . oos_var_prep_for_os($_SESSION['language']) . '.php')) {
include_once 'includes/plugins/' . $sPluginPath . '/lang/' . oos_var_prep_for_os($_SESSION['language']) . '.php';
} elseif (file_exists('includes/plugins/' . $sPluginPath . '/lang/' . DEFAULT_LANGUAGE . '.php')) {
include_once 'includes/plugins/' . $sPluginPath . '/lang/' . DEFAULT_LANGUAGE . '.php';
}
if (!class_exists($sName)) {
return FALSE;
}
}
if (@call_user_func(array('oos_event_' . $sInstance, 'create_plugin_instance'))) {
$this->aPlugins[] = $sName;
}
return TRUE;
}
public function introspect() {
$this->aPlugins = array();
foreach ($this->aEventPlugins as $event) {
$this->get_intro($event);
}
}
public function get_intro($event) {
@call_user_func(array('oos_event_' . $event, 'intro'));
}
public function installed_plugin($event) {
return in_array($event, $this->aEventPlugins);
}
}

View File

@ -0,0 +1,110 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
/**
* Class Products History
*
*
* @link https://www.oos-shop.de Latest release of this class
* @package Products History
* @copyright Copyright (c) 2003 - 2004 r23.de. All rights reserved.
* @author r23 <info@r23.de>
* @version $Revision: 1.1 $ - changed by $Author: r23 $ on $Date: 2007/06/07 16:06:31 $
* @access public
*/
class oosProductsHistory {
/**
* @access private
* @var int
*/
var $products_history;
/**
* Constructor of our Class
*
* @access public
* @author r23 <info@r23.de>
*/
public function __construct() {
$this->reset();
}
/**
* @param $products_id
*/
public function add_current_products($products_id) {
if (!$this->in_history($products_id)) {
if ($this->count_history() >= MAX_DISPLAY_PRODUCTS_IN_PRODUCTS_HISTORY_BOX) {
$temp = array_shift($this->products_history);
}
array_push($this->products_history, $products_id);
}
}
/**
* @param $products_id
* @return boolean
*/
public function in_history($products_id) {
if (in_array ($products_id, $this->products_history)) {
return TRUE;
} else {
return FALSE;
}
}
/**
* get total number of products
*/
public function count_history() {
return count($this->products_history);
}
/**
* get Product's id
*/
public function get_product_id_list() {
$product_id_list = '';
if (is_array($this->products_history)) {
reset($this->products_history);
foreach ($this->products_history as $key => $products_id) {
$product_id_list .= ', ' . $products_id;
}
}
return substr($product_id_list, 2);
}
/**
*
*/
public function reset() {
$this->products_history = array();
}
}

View File

@ -0,0 +1,135 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: shipping.php,v 1.21 2003/02/11 00:04:53 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
class shipping {
var $modules;
// class constructor
public function __construct($module = '') {
global $aLang;
if (defined('MODULE_SHIPPING_INSTALLED') && oos_is_not_null(MODULE_SHIPPING_INSTALLED)) {
$this->modules = explode(';', MODULE_SHIPPING_INSTALLED);
$include_modules = array();
if ( (oos_is_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($_SERVER['PHP_SELF'], (strrpos($_SERVER['PHP_SELF'], '.')+1)), $this->modules)) ) {
$include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($_SERVER['PHP_SELF'], (strrpos($_SERVER['PHP_SELF'], '.')+1)));
} else {
foreach ($this->modules as $value) {
$class = basename($value, '.php');
$include_modules[] = array('class' => $class, 'file' => $value);
}
}
$sLanguage = isset($_SESSION['language']) ? $_SESSION['language'] : DEFAULT_LANGUAGE;
for ($i=0, $n=count($include_modules); $i<$n; $i++) {
include_once MYOOS_INCLUDE_PATH . '/includes/languages/' . $sLanguage . '/modules/shipping/' . $include_modules[$i]['file'];
include_once MYOOS_INCLUDE_PATH . '/includes/modules/shipping/' . $include_modules[$i]['file'];
$GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'];
}
}
}
public function quote($method = '', $module = '') {
global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;
$quotes_array = array();
if (is_array($this->modules)) {
$shipping_quoted = '';
$shipping_num_boxes = 1;
$shipping_weight = $total_weight;
if ($total_weight > SHIPPING_MAX_WEIGHT) { // Split into many boxes
$shipping_num_boxes = ceil($total_weight/SHIPPING_MAX_WEIGHT);
$shipping_weight = $total_weight/$shipping_num_boxes;
}
if (SHIPPING_BOX_WEIGHT >= $shipping_weight*SHIPPING_BOX_PADDING/100) {
$shipping_weight = $shipping_weight+SHIPPING_BOX_WEIGHT;
} else {
$shipping_weight = $shipping_weight + ($shipping_weight*SHIPPING_BOX_PADDING/100);
}
$include_quotes = array();
foreach ($this->modules as $value) {
$class = basename($value, '.php');
if (oos_is_not_null($module)) {
if ( ($module == $class) && ($GLOBALS[$class]->enabled) ) {
$include_quotes[] = $class;
}
} elseif ($GLOBALS[$class]->enabled) {
$include_quotes[] = $class;
}
}
$size = count($include_quotes);
for ($i=0; $i<$size; $i++) {
$quotes = $GLOBALS[$include_quotes[$i]]->quote($method);
if (is_array($quotes)) $quotes_array[] = $quotes;
}
}
return $quotes_array;
}
public function cheapest() {
if (is_array($this->modules)) {
$rates = array();
foreach ($this->modules as $value) {
$class = basename($value, '.php');
if ($GLOBALS[$class]->enabled) {
$quotes = $GLOBALS[$class]->quotes;
$size = count($quotes['methods']);
for ($i=0; $i<$size; $i++) {
if ($quotes['methods'][$i]['cost']) {
$rates[] = array('id' => $quotes['id'] . '_' . $quotes['methods'][$i]['id'],
'title' => $quotes['module'] . ' (' . $quotes['methods'][$i]['title'] . ')',
'cost' => $quotes['methods'][$i]['cost']);
}
}
}
}
$cheapest = FALSE;
$size = count($rates);
for ($i=0; $i<$size; $i++) {
if (is_array($cheapest)) {
if ($rates[$i]['cost'] < $cheapest['cost']) {
$cheapest = $rates[$i];
}
} else {
$cheapest = $rates[$i];
}
}
return $cheapest;
}
}
}

View File

@ -0,0 +1,836 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: shopping_cart.php,v 1.2 2003/01/09 09:40:08 elarifr
shopping_cart.php,v 1.3.2.6 2003/05/12 23:11:20 wilt
orig: shopping_cart.php,v 1.32 2003/02/11 00:04:53 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
class shoppingCart {
var $contents;
var $total;
var $weight;
var $cartID;
var $content_type;
public function __construct() {
$this->reset();
}
public function restore_contents() {
if (!isset($_SESSION['customer_id'])) return FALSE;
// insert current cart contents in database
if (is_array($this->contents)) {
reset($this->contents);
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
foreach ( array_keys($this->contents) as $products_id ) {
$qty = $this->contents[$products_id]['qty'];
$towlid = $this->contents[$products_id]['towlid'];
if ($_SESSION['customer_wishlist_link_id'] == $towlid) {
$towlid = '';
$customers_wishlisttable = $oostable['customers_wishlist'];
$dbconn->Execute("DELETE FROM $customers_wishlisttable WHERE customers_id= '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oos_db_input($products_id) . "'");
$customers_wishlist_attributestable = $oostable['customers_wishlist_attributes'];
$dbconn->Execute("DELETE FROM $customers_wishlist_attributestable WHERE customers_id= '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oos_db_input($products_id) . "'");
}
$customers_baskettable = $oostable['customers_basket'];
$product_sql = "SELECT products_id
FROM $customers_baskettable
WHERE customers_id = '" . intval($_SESSION['customer_id']) . "'
AND products_id = '" . intval($products_id) . "'";
$product_result = $dbconn->Execute($product_sql);
if (!$product_result->RecordCount()) {
$customers_baskettable = $oostable['customers_basket'];
$dbconn->Execute("INSERT INTO $customers_baskettable
(customers_id,
to_wishlist_id,
products_id,
customers_basket_quantity,
customers_basket_date_added) VALUES ('" . intval($_SESSION['customer_id']) . "',
'" . oos_db_input($towlid) . "',
'" . oos_db_input($products_id) . "',
'" . oos_db_input($qty) . "',
'" . oos_db_input(date('Ymd')) . "')");
if (isset($this->contents[$products_id]['attributes'])) {
reset($this->contents[$products_id]['attributes']);
foreach ($this->contents[$products_id]['attributes'] as $option => $value) {
$attr_value = $this->contents[$products_id]['attributes_values'][$option];
$customers_basket_attributestable = $oostable['customers_basket_attributes'];
$dbconn->Execute("INSERT INTO $customers_basket_attributestable
(customers_id,
products_id,
products_options_id,
products_options_value_id,
products_options_value_text) VALUES ('" . intval($_SESSION['customer_id']) . "',
'" . oos_db_input($products_id) . "',
'" . oos_db_input($option) . "',
'" . oos_db_input($value) . "',
'" . oos_db_input($attr_value) . "')");
}
}
} else {
$customers_baskettable = $oostable['customers_basket'];
$dbconn->Execute("UPDATE $customers_baskettable
SET customers_basket_quantity = '" . intval($qty) . "'
WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND
products_id = '" . oos_db_input($products_id) . "'");
}
}
if (isset($_SESSION['gv_id'])) {
$remote = oos_server_get_remote();
$coupon_redeem_tracktable = $oostable['coupon_redeem_track'];
$gv_result = $dbconn->Execute("INSERT INTO $coupon_redeem_tracktable
(coupon_id,
customer_id,
redeem_date,
redeem_ip) VALUES ('" . oos_db_input($_SESSION['gv_id']) . "',
'" . intval($_SESSION['customer_id']) . "',
now(),
'" . oos_db_input($remote) . "')");
$couponstable = $oostable['coupons'];
$gv_update = $dbconn->Execute("UPDATE $couponstable
SET coupon_active = 'N'
WHERE coupon_id = '" . oos_db_input($_SESSION['gv_id']) . "'");
oos_gv_account_update($_SESSION['customer_id'], $_SESSION['gv_id']);
unset($_SESSION['gv_id']);
}
}
// reset per-session cart contents, but not the database contents
$this->reset(false);
$customers_baskettable = $oostable['customers_basket'];
$sql = "SELECT products_id, to_wishlist_id, customers_basket_quantity
FROM $customers_baskettable
WHERE customers_id = '" . intval($_SESSION['customer_id']) . "'";
$products_result = $dbconn->Execute($sql);
while ($products = $products_result->fields) {
$this->contents[$products['products_id']] = array('qty' => $products['customers_basket_quantity'],
'towlid' => $products['to_wishlist_id']);
// attributes
$customers_basket_attributestable = $oostable['customers_basket_attributes'];
$sql = "SELECT products_options_id, products_options_value_id, products_options_value_text
FROM $customers_basket_attributestable
WHERE customers_id = '" . intval($_SESSION['customer_id']) . "'
AND products_id = '" . $products['products_id'] . "'";
$attributes_result = $dbconn->Execute($sql);
while ($attributes = $attributes_result->fields) {
$this->contents[$products['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
if ($attributes['products_options_value_id'] == PRODUCTS_OPTIONS_VALUE_TEXT_ID) {
$this->contents[$products['products_id']]['attributes_values'][$attributes['products_options_id']] = $attributes['products_options_value_text'];
}
// Move that ADOdb pointer!
$attributes_result->MoveNext();
}
// Move that ADOdb pointer!
$products_result->MoveNext();
}
$this->cleanup();
}
public function reset($reset_database = FALSE) {
$this->contents = array();
$this->total = 0;
$this->weight = 0;
$this->content_type = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
if (isset($_SESSION['customer_id']) && ($reset_database == TRUE)) {
$customers_baskettable = $oostable['customers_basket'];
$dbconn->Execute("DELETE FROM $customers_baskettable WHERE customers_id = '" . intval($_SESSION['customer_id']) . "'");
$customers_basket_attributestable = $oostable['customers_basket_attributes'];
$dbconn->Execute("DELETE FROM $customers_basket_attributestable WHERE customers_id = '" . intval($_SESSION['customer_id']) . "'");
}
unset($this->cartID);
if (isset($_SESSION['cartID'])) unset($_SESSION['cartID']);
}
public function add_cart($products_id, $nQuantity = '1', $attributes = '', $notify = TRUE, $towlid = '') {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$sProductsId = oos_get_uprid($products_id, $attributes);
$nProductsID = oos_get_product_id($sProductsId);
if (is_numeric($nProductsID) && is_numeric($nQuantity)) {
$productstable = $oostable['products'];
$check_product_sql = "SELECT products_status
FROM $productstable
WHERE products_id = '" . intval($nProductsID) . "'";
$products_status = $dbconn->GetOne($check_product_sql);
if ($products_setting = '2') {
$nQuantity = intval($nQuantity);
if ($notify == TRUE) {
$_SESSION['new_products_id_in_cart'] = $sProductsId;
}
if (isset($_SESSION['customer_wishlist_link_id']) && ($_SESSION['customer_wishlist_link_id'] == $towlid)) {
$towlid = '';
$customers_wishlisttable = $oostable['customers_wishlist'];
$dbconn->Execute("DELETE FROM $customers_wishlisttable WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oos_db_input($sProductsId) . "'");
$customers_wishlist_attributestable = $oostable['customers_wishlist_attributes'];
$dbconn->Execute("DELETE FROM $customers_wishlist_attributestable WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oos_db_input($sProductsId) . "'");
}
if ($this->in_cart($sProductsId)) {
$this->update_quantity($sProductsId, $nQuantity, $attributes, $towlid);
} else {
$this->contents[] = array($sProductsId);
$this->contents[$sProductsId] = array('qty' => $nQuantity,
'towlid' => $towlid);
// insert into database
if (isset($_SESSION['customer_id'])) {
$customers_baskettable = $oostable['customers_basket'];
$dbconn->Execute("INSERT INTO $customers_baskettable
(customers_id,
to_wishlist_id,
products_id,
customers_basket_quantity,
customers_basket_date_added) VALUES (" . $dbconn->qstr($_SESSION['customer_id']) . ','
. $dbconn->qstr($towlid) . ','
. $dbconn->qstr($sProductsId) . ','
. $dbconn->qstr($nQuantity) . ','
. $dbconn->qstr(date('Ymd')) . ")");
}
if (is_array($attributes)) {
reset($attributes);
foreach ($attributes as $option => $value) {
$attr_value = NULL;
$blank_value = FALSE;
if (strstr($option, TEXT_PREFIX)) {
if (trim($value) == NULL) {
$blank_value = TRUE;
} else {
$option = substr($option, strlen(TEXT_PREFIX));
$attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES);
$value = PRODUCTS_OPTIONS_VALUE_TEXT_ID;
$this->contents[$sProductsId]['attributes_values'][$option] = $attr_value;
}
}
if (!$blank_value) {
$this->contents[$sProductsId]['attributes'][$option] = $value;
// insert into database
if (isset($_SESSION['customer_id'])) {
$customers_basket_attributestable = $oostable['customers_basket_attributes'];
$dbconn->Execute("INSERT INTO $customers_basket_attributestable
(customers_id,
products_id,
products_options_id,
products_options_value_id,
products_options_value_text) VALUES (" . $dbconn->qstr($_SESSION['customer_id']) . ','
. $dbconn->qstr($sProductsId) . ','
. $dbconn->qstr($option) . ','
. $dbconn->qstr($value) . ','
. $dbconn->qstr($attr_value) . ")");
}
}
}
}
}
$this->cleanup();
// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
$this->cartID = $this->generate_cart_id();
}
}
}
public function update_quantity($products_id, $nQuantity = '', $attributes = '', $towlid = '') {
$sProductsId = oos_get_uprid($products_id, $attributes);
$nProductsID = oos_get_product_id($sProductsId);
if (is_numeric($nProductsID) && isset($this->contents[$sProductsId]) && is_numeric($nQuantity)) {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$nQuantity = intval($nQuantity);
$this->contents[$sProductsId] = array('qty' => $nQuantity,
'towlid' => $towlid);
if (isset($_SESSION['customer_id'])) {
$customers_baskettable = $oostable['customers_basket'];
$dbconn->Execute("UPDATE $customers_baskettable
SET customers_basket_quantity = '" . oos_db_input($nQuantity) . "'
WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND
products_id = '" . oos_db_input($sProductsId) . "'");
}
if (is_array($attributes)) {
reset($attributes);
foreach ($attributes as $option => $value) {
$attr_value = NULL;
$blank_value = FALSE;
if (strstr($option, TEXT_PREFIX)) {
if (trim($value) == NULL) {
$blank_value = TRUE;
} else {
$option = substr($option, strlen(TEXT_PREFIX));
// $attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES);
$attr_value = stripslashes($value);
$value = PRODUCTS_OPTIONS_VALUE_TEXT_ID;
$this->contents[$sProductsId]['attributes_values'][$option] = $attr_value;
}
}
if (!$blank_value) {
$this->contents[$sProductsId]['attributes'][$option] = $value;
// update database
if (isset($_SESSION['customer_id'])) {
$customers_basket_attributestable = $oostable['customers_basket_attributes'];
$dbconn->Execute("UPDATE $customers_basket_attributestable
SET products_options_value_id = '" . oos_db_input($value) . "',
products_options_value_text = '" . oos_db_input($attr_value) . "'
WHERE customers_id = '" . intval($_SESSION['customer_id']) . "'
AND products_id = '" . oos_db_input($sProductsId) . "'
AND products_options_id = '" . oos_db_input($option) . "'");
}
}
}
}
}
}
public function cleanup() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$check_quantity = 1;
reset($this->contents);
foreach ( array_keys($this->contents) as $key ) {
if ($this->contents[$key]['qty'] < $check_quantity) {
unset($this->contents[$key]);
// remove from database
if (isset($_SESSION['customer_id'])) {
$customers_baskettable = $oostable['customers_basket'];
$dbconn->Execute("DELETE FROM $customers_baskettable WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oos_db_input($key) . "'");
$customers_basket_attributestable = $oostable['customers_basket_attributes'];
$dbconn->Execute("DELETE FROM $customers_basket_attributestable WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oos_db_input($key) . "'");
}
}
}
}
public function count_contents() { // get total number of items in cart
$total_items = 0;
if (is_array($this->contents)) {
reset($this->contents);
foreach ( array_keys($this->contents) as $products_id ) {
$total_items += $this->get_quantity($products_id);
}
}
return $total_items;
}
public function get_quantity($products_id) {
if (isset($this->contents[$products_id])) {
$nQuantity = $this->contents[$products_id]['qty'];
$nQuantity = intval($nQuantity);
return $nQuantity;
} else {
return 0;
}
}
public function in_cart($products_id) {
if (isset($this->contents[$products_id])) {
return TRUE;
} else {
return FALSE;
}
}
public function remove($products_id) {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
unset($this->contents[$products_id]);
// remove from database
if (isset($_SESSION['customer_id'])) {
$customers_baskettable = $oostable['customers_basket'];
$dbconn->Execute("DELETE FROM $customers_baskettable WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oos_db_input($products_id) . "'");
$customers_basket_attributestable = $oostable['customers_basket_attributes'];
$dbconn->Execute("DELETE FROM $customers_basket_attributestable WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oos_db_input($products_id) . "'");
}
// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
$this->cartID = $this->generate_cart_id();
}
public function remove_all() {
$this->reset();
}
public function get_product_id_list() {
$product_id_list = '';
if (is_array($this->contents)) {
reset($this->contents);
foreach ( array_keys($this->contents) as $products_id ) {
$product_id_list .= ', ' . $products_id;
}
}
return substr($product_id_list, 2);
}
public function get_numeric_product_id_list() {
$product_id_list = '';
if (is_array($this->contents)) {
reset($this->contents);
foreach ( array_keys($this->contents) as $products_id ) {
$product_id_list .= ', ' . oos_get_product_id($products_id);
}
}
return substr($product_id_list, 2);
}
public function calculate() {
global $aUser, $oCurrencies;
$this->total_virtual = 0; // Gift Voucher System
$this->weight_virtual = 0;
$this->total = 0;
$this->weight = 0;
if (!is_array($this->contents)) return 0;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
reset($this->contents);
foreach ( array_keys($this->contents) as $products_id ) {
$nQuantity = $this->contents[$products_id]['qty'];
// products price
$productstable = $oostable['products'];
$product_sql = "SELECT products_id, products_model, products_price, products_tax_class_id, products_weight
FROM $productstable
WHERE products_id='" . oos_get_product_id($products_id) . "'";
$product_result = $dbconn->Execute($product_sql);
if ($product = $product_result->fields) {
$no_count = 1;
if (preg_match('/^GIFT/', $product['products_model'])) {
$no_count = 0;
}
$prid = $product['products_id'];
$products_tax = oos_get_tax_rate($product['products_tax_class_id']);
if ($aUser['qty_discounts'] == 1) {
$products_price = $this->products_price_actual($prid, $product['products_price'], $nQuantity);
} else {
$products_price = $product['products_price'];
}
$products_weight = $product['products_weight'];
$bSpezialPrice = FALSE;
$specialstable = $oostable['specials'];
$sql = "SELECT specials_new_products_price
FROM $specialstable
WHERE products_id = '" . intval($prid) . "'
AND status = '1'";
$specials_result = $dbconn->Execute($sql);
if ($specials_result->RecordCount()) {
$specials = $specials_result->fields;
$products_price = $specials['specials_new_products_price'];
$bSpezialPrice = TRUE;
}
$this->total_virtual += oos_add_tax($products_price, $products_tax) * $nQuantity * $no_count;
$this->weight_virtual += ($nQuantity * $products_weight) * $no_count;
$this->total += $oCurrencies->calculate_price($products_price, $products_tax, $nQuantity);
$this->weight += ($nQuantity * $products_weight);
}
// attributes price
if (isset($this->contents[$products_id]['attributes'])) {
reset($this->contents[$products_id]['attributes']);
foreach ($this->contents[$products_id]['attributes'] as $option => $value) {
$products_attributestable = $oostable['products_attributes'];
$sql = "SELECT options_values_price, price_prefix
FROM $products_attributestable
WHERE products_id = '" . intval($prid) . "'
AND options_id = '" . intval($option) . "'
AND options_values_id = '" . intval($value) . "'";
$attribute_price = $dbconn->GetRow($sql);
$sAttributesPrice = $attribute_price['options_values_price'];
if ($bSpezialPrice === FALSE) {
$sAttributesPrice = $sAttributesPrice*(100-$max_product_discount)/100;
}
if ($attribute_price['price_prefix'] == '+') {
$this->total += $oCurrencies->calculate_price($sAttributesPrice, $products_tax, $nQuantity);
} else {
$this->total -= $oCurrencies->calculate_price($sAttributesPrice, $products_tax, $nQuantity);
}
}
}
}
}
public function products_price_actual($product_id, $actual_price, $products_qty) {
$new_price = $actual_price;
if ($new_special_price = oos_get_products_special_price($product_id)) {
$new_price = $new_special_price;
}
if ($new_discounts_price = oos_get_products_price_quantity_discount($product_id, $products_qty, $new_price)){
$new_price = $new_discounts_price;
}
return $new_price;
}
public function attributes_price($products_id) {
$attributes_price = 0;
if (isset($this->contents[$products_id]['attributes'])) {
reset($this->contents[$products_id]['attributes']);
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
foreach ($this->contents[$products_id]['attributes'] as $option => $value) {
$products_attributestable = $oostable['products_attributes'];
$attribute_price_sql = "SELECT options_values_price, price_prefix
FROM $products_attributestable
WHERE products_id = '" . intval($products_id) . "'
AND options_id = '" . intval($option) . "'
AND options_values_id = '" . intval($value) . "'";
$attribute_price = $dbconn->GetRow($attribute_price_sql);
if ($attribute_price['price_prefix'] == '+') {
$attributes_price += $attribute_price['options_values_price'];
} else {
$attributes_price -= $attribute_price['options_values_price'];
}
}
}
return $attributes_price;
}
public function get_products() {
global $aUser;
if (!is_array($this->contents)) return FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$nLanguageID = isset($_SESSION['language_id']) ? intval( $_SESSION['language_id'] ) : DEFAULT_LANGUAGE_ID;
$aProducts = array();
reset($this->contents);
foreach ( array_keys($this->contents) as $products_id ) {
$nQuantity = $this->contents[$products_id]['qty'];
$productstable = $oostable['products'];
$products_descriptiontable = $oostable['products_description'];
$sql = "SELECT p.products_id, pd.products_name, pd.products_essential_characteristics, p.products_image, p.products_model,
p.products_ean, p.products_price, p.products_weight, p.products_tax_class_id, p.products_quantity
FROM $productstable p,
$products_descriptiontable pd
WHERE p.products_id = '" . oos_get_product_id($products_id) . "' AND
pd.products_id = p.products_id AND
pd.products_languages_id = '" . intval($nLanguageID) . "'";
$products_result = $dbconn->Execute($sql);
if ($products = $products_result->fields) {
$prid = $products['products_id'];
if ($aUser['qty_discounts'] == 1) {
$products_price = $this->products_price_actual($prid, $products['products_price'], $nQuantity);
} else {
$products_price = $products['products_price'];
}
$bSpezialPrice = FALSE;
$specialstable = $oostable['specials'];
$sql = "SELECT specials_new_products_price
FROM $specialstable
WHERE products_id = '" . intval($prid) . "' AND
status = '1'";
$specials_result = $dbconn->Execute($sql);
if ($specials_result->RecordCount()) {
$bSpezialPrice = TRUE;
$specials = $specials_result->fields;
$products_price = $specials['specials_new_products_price'];
}
$attributes_price = $this->attributes_price($products_id);
$aProducts[] = array('id' => $products_id,
'name' => $products['products_name'],
'essential_characteristics' => $products['products_essential_characteristics'],
'model' => $products['products_model'],
'image' => $products['products_image'],
'ean' => $products['products_ean'],
'price' => $products_price,
'spezial' => $bSpezialPrice,
'quantity' => $this->contents[$products_id]['qty'],
'stock' => $products['products_quantity'],
'weight' => $products['products_weight'],
'final_price' => ($products_price + $attributes_price),
'tax_class_id' => $products['products_tax_class_id'],
'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''),
'attributes_values' => (isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : ''),
'towlid' => $this->contents[$products_id]['towlid']);
}
}
return $aProducts;
}
public function show_total() {
$this->calculate();
return $this->total;
}
public function show_weight() {
$this->calculate();
return $this->weight;
}
public function show_total_virtual() {
$this->calculate();
return $this->total_virtual;
}
public function show_weight_virtual() {
$this->calculate();
return $this->weight_virtual;
}
public function generate_cart_id($length = 5) {
return oos_create_random_value($length, 'digits');
}
public function get_content_type() {
$this->content_type = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
if ( (DOWNLOAD_ENABLED == 'true') && ($this->count_contents() > 0) || ($this->show_weight() == 0 )&& ($this->count_contents() > 0) ) {
reset($this->contents);
foreach ( array_keys($this->contents) as $products_id ) {
if (isset($this->contents[$products_id]['attributes'])) {
reset($this->contents[$products_id]['attributes']);
foreach ($this->contents[$products_id]['attributes'] as $value) {
$products_attributestable = $oostable['products_attributes'];
$products_attributes_downloadtable = $oostable['products_attributes_download'];
$sql = "SELECT COUNT(*) AS total
FROM $products_attributestable pa,
$products_attributes_downloadtable pad
WHERE pa.products_id = '" . intval($products_id) . "'
AND pa.options_values_id = '" . intval($value) . "'
AND pa.products_attributes_id = pad.products_attributes_id";
$virtual_check = $dbconn->GetRow($sql);
if ($virtual_check['total'] > 0) {
switch ($this->content_type) {
case 'physical':
$this->content_type = 'mixed';
return $this->content_type;
break;
default:
$this->content_type = 'virtual';
break;
}
} else {
switch ($this->content_type) {
case 'virtual':
$this->content_type = 'mixed';
return $this->content_type;
break;
default:
$this->content_type = 'physical';
break;
}
}
}
} elseif ($this->show_weight() == 0) {
reset($this->contents);
foreach ( array_keys($this->contents) as $products_id ) {
$productstable = $oostable['products'];
$sql = "SELECT products_weight
FROM $productstable
WHERE products_id = '" . intval($products_id) . "'";
$virtual_check_result = $dbconn->Execute($sql);
$virtual_check = $virtual_check_result->fields;
if ($virtual_check['products_weight'] == 0) {
switch ($this->content_type) {
case 'physical':
$this->content_type = 'mixed';
return $this->content_type;
break;
default:
$this->content_type = 'virtual_weight';
break;
}
} else {
switch ($this->content_type) {
case 'virtual':
$this->content_type = 'mixed';
return $this->content_type;
break;
default:
$this->content_type = 'physical';
break;
}
}
}
} else {
switch ($this->content_type) {
case 'virtual':
$this->content_type = 'mixed';
return $this->content_type;
break;
default:
$this->content_type = 'physical';
break;
}
}
}
} else {
$this->content_type = 'physical';
}
return $this->content_type;
}
public function unserialize($broken) {
for(reset($broken);$kv=each($broken);) {
$key=$kv['key'];
if (gettype($this->$key)!="user public function")
$this->$key=$kv['value'];
}
}
/**
* ICWILSON CREDIT CLASS Gift Voucher Addittion Start
* amend count_contents to show nil contents for shipping
* as we don't want to quote for 'virtual' item
* GLOBAL CONSTANTS if NO_COUNT_ZERO_WEIGHT is true then we don't count any product with a weight
* which is less than or equal to MINIMUM_WEIGHT
* otherwise we just don't count gift certificates
*/
public function count_contents_virtual() { // get total number of items in cart disregard gift vouchers
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$total_items = 0;
if (is_array($this->contents)) {
reset($this->contents);
foreach ( array_keys($this->contents) as $products_id ) {
$no_count = FALSE;
$productstable = $oostable['products'];
$sql = "SELECT products_model
FROM $productstable
WHERE products_id = '" . intval($products_id) . "'";
$gv_result = $dbconn->GetRow($sql);
if (preg_match('/^GIFT/', $gv_result['products_model'])) {
$no_count = TRUE;
}
if (NO_COUNT_ZERO_WEIGHT == 1) {
$productstable = $oostable['products'];
$sql = "SELECT products_weight
FROM $productstable
WHERE products_id = '" . oos_get_product_id($products_id) . "'";
$gv_result = $dbconn->GetRow($sql);
if ($gv_result['products_weight']<=MINIMUM_WEIGHT) {
$no_count = TRUE;
}
}
if (!$no_count) $total_items += $this->get_quantity($products_id);
}
}
return $total_items;
}
}

View File

@ -0,0 +1,173 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: split_page_results.php,v 1.11 2003/02/13 04:23:23 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
/**
* Page Navigation
*
* @package kernel
* @version $Revision: 1.2 $ - changed by $Author: r23 $ on $Date: 2007/12/11 08:12:54 $
*/
class splitPageResults {
var $sql_query;
var $number_of_rows;
var $current_page_number;
var $number_of_pages;
var $number_of_rows_per_page;
var $page_name;
/**
* Constructor
*/
public function __construct($query, $max_rows, $count_key = '*', $page_holder = 'page') {
$max_rows = ($max_rows == '' || $max_rows == 0) ? 20 : $max_rows;
$this->sql_query = preg_replace("/\n\r|\r\n|\n|\r/", " ", $query);
$this->page_name = $page_holder;
if (isset($_GET[$page_holder])) {
$page = $_GET[$page_holder];
} elseif (isset($_POST[$page_holder])) {
$page = $_POST[$page_holder];
} else {
$page = 1;
}
if (empty($page) || !is_numeric($page) || $page < 0) $page = 1;
$this->current_page_number = $page;
$this->number_of_rows_per_page = $max_rows;
$pos_to = strlen($this->sql_query);
$pos_from = strpos($this->sql_query, 'FROM', 0);
$pos_group_by = strpos($this->sql_query, ' GROUP BY', $pos_from);
if (($pos_group_by < $pos_to) && ($pos_group_by != false)) $pos_to = $pos_group_by;
$pos_having = strpos($this->sql_query, ' HAVING', $pos_from);
if (($pos_having < $pos_to) && ($pos_having != false)) $pos_to = $pos_having;
$pos_order_by = strpos($this->sql_query, ' ORDER BY', $pos_from);
if (($pos_order_by < $pos_to) && ($pos_order_by != false)) $pos_to = $pos_order_by;
$dbconn =& oosDBGetConn();
$sql = "SELECT COUNT(" . oos_db_input($count_key) . ") AS total " . substr($this->sql_query, $pos_from, ($pos_to - $pos_from));
$count = $dbconn->Execute($sql);
$this->number_of_rows = $count->fields['total'];
if ($this->number_of_rows_per_page > 0) {
$this->number_of_pages = ceil($this->number_of_rows / $this->number_of_rows_per_page);
} else {
$this->number_of_pages = 0;
}
if ($this->current_page_number > $this->number_of_pages) {
$this->current_page_number = $this->number_of_pages;
}
$offset = ($this->number_of_rows_per_page * ($this->current_page_number - 1));
if ($offset <= 0) { $offset = 0; }
if ($this->current_page_number <=0) {$this->current_page_number = 1;}
# $this->sql_query .= " LIMIT " . ($offset > 0 ? $offset . ", " : '') . $this->number_of_rows_per_page;
$this->sql_query .= " LIMIT " . max($offset, 0) . ", " . $this->number_of_rows_per_page;
}
/**
* display split-page-number-links
*
* @param $this->number_of_rows
* @param $this->number_of_rows_per_page
* @param $max_page_links
* @param $current_page_number
* @param $parameters
* @return string
*/
public function display_links($max_page_links, $parameters = '') {
global $aLang, $sContent;
$display_link = '';
if ( oos_is_not_null($parameters) && (substr($parameters, -5) != '&amp;') ) $parameters .= '&amp;';
// previous button - not displayed on first page
if ($this->current_page_number > 1) {
$display_link .= '<li class="page-item"><a class="page-link" href="' . oos_href_link($sContent, $parameters . $this->page_name . '=' . ($this->current_page_number - 1)) . '" aria-label="' . $aLang['prevnext_button_prev'] . '"><span aria-hidden="true">&laquo;</span><span class="sr-only">' . $aLang['prevnext_button_prev'] . '</span></a></li>';
}
// check if num_pages > $max_page_links
$cur_window_num = intval($this->current_page_number / $max_page_links);
if ($this->current_page_number % $max_page_links) $cur_window_num++;
$max_window_num = intval($this->number_of_pages / $max_page_links);
if ($this->number_of_pages % $max_page_links) $max_window_num++;
// previous window of pages
if ($cur_window_num > 1) $display_link .= '<li class="page-item"><a class="page-link"' . oos_href_link($sContent, $parameters . $this->page_name . '=' . (($cur_window_num - 1) * $max_page_links)) . '">...</a></li>';
// page nn button
for ($jump_to_page = 1 + (($cur_window_num - 1) * $max_page_links); ($jump_to_page <= ($cur_window_num * $max_page_links)) && ($jump_to_page <= $this->number_of_pages); $jump_to_page++) {
if ($jump_to_page == $this->current_page_number) {
// $display_link .= '<li class="page-item active"><a class="page-link" href="' . oos_href_link($sContent, $parameters . $this->page_name . '=' . $jump_to_page) . '">' . $jump_to_page . '<span class="sr-only"></span></a></li>';
$display_link .= '<li class="page-item active"><span class="page-link">' . $jump_to_page . '<span class="sr-only">(current)</span></span></li>';
} else {
$display_link .= '<li class="page-item"><a class="page-link" href="' . oos_href_link($sContent, $parameters . $this->page_name . '=' . $jump_to_page) . '">' . $jump_to_page . '</a></li>';
}
}
// next window of pages
if ($cur_window_num < $max_window_num) $display_link .= '<li class="page-item"><a class="page-link" href="' . oos_href_link($sContent, $parameters . $this->page_name . '=' . (($cur_window_num) * $max_page_links + 1)) . '">...</a></li>';
// next button
if (($this->current_page_number < $this->number_of_pages) && ($this->number_of_pages != 1)) $display_link .= '<li class="page-item"><a class="page-link" href="' . oos_href_link($sContent, $parameters . $this->page_name . '=' . ($this->current_page_number + 1)) . '"><span aria-hidden="true">&raquo;</span><span class="sr-only">' . $aLang['prevnext_button_next'] . '</span></a></li>';
return $display_link;
}
/**
* display number of total products found
*
* @return string
*/
public function display_count($text_output) {
$to_num = ($this->number_of_rows_per_page * $this->current_page_number);
if ($to_num > $this->number_of_rows) $to_num = $this->number_of_rows;
$from_num = ($this->number_of_rows_per_page * ($this->current_page_number - 1));
if ($to_num == 0) {
$from_num = 0;
} else {
$from_num++;
}
return sprintf($text_output, $from_num, $to_num, $this->number_of_rows);
}
}

View File

@ -0,0 +1,65 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
/**
* @see libs/Smarty/Smarty.class.php
* @link http://smarty.net
*/
/**
* Smarty class
*
* @package myOOS
* @subpackage myOOS_Smarty
* @see Smarty, libs/Smarty/Smarty.class.php
* @link http://smarty.net/manual/en/
*/
class myOOS_Smarty extends Smarty {
function trigger_error($error_msg, $error_type = E_USER_WARNING) {
throw new SmartyException($error_msg);
}
public function __construct() {
// Class Constructor.
// These automatically get set with each new instance.
parent::__construct();
$this->left_delimiter = '{';
$this->right_delimiter = '}';
$dir = OOS_TEMP_PATH;
if (substr($dir, -1) != "/") {
$dir = $dir."/";
}
$this->setTemplateDir(MYOOS_INCLUDE_PATH . '/templates/')
->setCompileDir( $dir . 'shop/templates_c/')
->setCacheDir($dir . 'shop/cache/');
// set multiple directories where plugins are stored
$this->setPluginsDir(array(
MYOOS_INCLUDE_PATH . '/vendor/smarty/smarty/libs/plugins',
MYOOS_INCLUDE_PATH . '/includes/lib/smarty-plugins'
));
$this->use_sub_dirs = FALSE;
}
}

View File

@ -0,0 +1,196 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: upload.php,v 1.2 2003/06/20 00:18:30 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
class upload {
var $file;
var $filename;
var $destination;
var $permissions;
var $extensions;
var $tmp_filename;
var $message_location;
public function __construct($file = '', $destination = '', $permissions = '644', $extensions = array('jpg', 'jpeg', 'gif', 'png', 'eps', 'cdr', 'ai', 'pdf', 'tif', 'tiff', 'bmp')) {
$this->set_file($file);
$this->set_destination($destination);
$this->set_permissions($permissions);
$this->set_extensions($extensions);
$this->set_output_messages('direct');
if (oos_is_not_null($this->file) && oos_is_not_null($this->destination)) {
$this->set_output_messages('session');
if ( ($this->parse() == TRUE) && ($this->save() == TRUE) ) {
return TRUE;
} else {
return FALSE;
}
}
}
public function parse() {
global $oMessage, $aLang;
$file = array();
if (isset($_FILES[$this->file])) {
$file = array('name' => $_FILES[$this->file]['name'],
'type' => $_FILES[$this->file]['type'],
'size' => $_FILES[$this->file]['size'],
'tmp_name' => $_FILES[$this->file]['tmp_name']);
}
if ( isset($file['tmp_name']) && oos_is_not_null($file['tmp_name']) && ($file['tmp_name'] != 'none') && is_uploaded_file($file['tmp_name']) ) {
if (oos_is_not_null($file['size']) and ($file['size'] > 2048000)) {
if ($this->message_location == 'direct') {
$oMessage->add('upload', $aLang['error_file_too_big'], 'error');
} else {
$oMessage->add_session('upload', $aLang['error_file_too_big'], 'error');
}
return FALSE;
}
if (sizeof($this->extensions) > 0) {
if (!in_array(strtolower(substr($file['name'], strrpos($file['name'], '.')+1)), $this->extensions)) {
if ($this->message_location == 'direct') {
$oMessage->add('upload', $aLang['error_filetype_not_allowed'], 'error');
} else {
$oMessage->add_session('upload', $aLang['error_filetype_not_allowed'], 'error');
}
return FALSE;
}
}
$this->set_file($file);
$this->set_filename($file['name']);
$this->set_tmp_filename($file['tmp_name']);
return $this->check_destination();
} else {
if ($this->message_location == 'direct') {
$oMessage->add('upload', $aLang['warning_no_file_uploaded'], 'warning');
} else {
$oMessage->add_session('upload', $aLang['warning_no_file_uploaded'], 'warning');
}
return FALSE;
}
}
public function save() {
global $oMessage, $aLang;
if (substr($this->destination, -1) != '/') $this->destination .= '/';
if (move_uploaded_file($this->file['tmp_name'], $this->destination . $this->filename)) {
chmod($this->destination . $this->filename, $this->permissions);
$oMessage->add_session('upload', $aLang['success_file_saved_successfully'], 'success');
return TRUE;
} else {
if ($this->message_location == 'direct') {
$oMessage->add('upload', $aLang['error_file_not_saved'], 'error');
} else {
$oMessage->add_session('upload', $aLang['error_file_not_saved'], 'error');
}
return FALSE;
}
}
public function set_file($file) {
$this->file = $file;
}
public function set_destination($destination) {
$this->destination = $destination;
}
public function set_permissions($permissions) {
$this->permissions = octdec($permissions);
}
public function set_filename($filename) {
$this->filename = $filename;
}
public function set_tmp_filename($filename) {
$this->tmp_filename = $filename;
}
public function set_extensions($extensions) {
if (oos_is_not_null($extensions)) {
if (is_array($extensions)) {
$this->extensions = $extensions;
} else {
$this->extensions = array($extensions);
}
} else {
$this->extensions = array();
}
}
public function check_destination() {
global $oMessage, $aLang;
if (!is_writeable($this->destination)) {
if (is_dir($this->destination)) {
if ($this->message_location == 'direct') {
$oMessage->add('upload', $aLang['error_destination_not_writeable'], 'error');
} else {
$oMessage->add_session('upload', $aLang['error_destination_not_writeable'], 'error');
}
} else {
if ($this->message_location == 'direct') {
$oMessage->add('upload', $aLang['error_destination_does_not_exist'], 'error');
} else {
$oMessage->add_session('upload', $aLang['error_destination_does_not_exist'], 'error');
}
}
return FALSE;
} else {
return TRUE;
}
}
public function set_output_messages($location) {
switch ($location) {
case 'session':
$this->message_location = 'session';
break;
case 'direct':
default:
$this->message_location = 'direct';
break;
}
}
}

View File

@ -0,0 +1,125 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
class url_rewrite{
function transform_uri($param) {
global $session;
unset($path);
unset($url);
$uri = explode("index.php/", $param);
$path = $uri[1];
$base = $uri[0];
$url_array = explode('/', $path);
$aContents = oos_get_content();
if ( (in_array('category', $url_array)) || (in_array($aContents['product_info'], $url_array) && in_array($url_array)) ) {
$_filter = array('content', $aContents['shop'], $session->getName(), $session->getId());
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$nLanguageID = isset($_SESSION['language_id']) ? intval( $_SESSION['language_id'] ) : DEFAULT_LANGUAGE_ID;
$path = '';
$extention = '.html';
for ($i=0; $i < count($url_array); $i++){
switch ($url_array[$i]) {
case 'category':
unset($category);
$category = '';
$i++;
if(preg_match('/[_0-9]/', $url_array[$i])){
if($category_array = explode('_', $url_array[$i])){
foreach($category_array as $value){
$categoriestable = $oostable['categories'];
$categories_descriptiontable = $oostable['categories_description'];
$category_result = $dbconn->Execute("SELECT c.categories_id, cd.categories_name FROM $categoriestable c, $categories_descriptiontable cd WHERE c.categories_id = '" . intval($value) . "' AND c.categories_id = cd.categories_id AND cd.categories_languages_id = '" . intval($nLanguageID) . "'");
$category .= oos_make_filename($category_result->fields['categories_name']) . '/';
}
$category = substr($category, 0, -1);
$category .= '-c-' . $url_array[$i]. '/';
} else {
$category .= 'category/' . $url_array[$i] . '/';
}
}
$path .= $category;
break;
case 'products_id':
unset($product);
$i++;
if ($url_array[$i]) {
$products_descriptiontable = $oostable['products_description'];
$product_result = $dbconn->Execute("SELECT products_name FROM $products_descriptiontable WHERE products_id = '" . intval($url_array[$i]) . "' AND products_languages_id = '" . intval($nLanguageID) . "'");
$product = oos_make_filename($product_result->fields['products_name']);
$path .= $product . '-p-' . $url_array[$i] . '/';
}
break;
case 'manufacturers_id':
unset($manufacturer);
$i++;
if ($url_array[$i]) {
$manufacturerstable = $oostable['manufacturers'];
$manufacturer_result = $dbconn->Execute("SELECT manufacturers_name FROM $manufacturerstable WHERE manufacturers_id = '" . intval($url_array[$i]) . "'");
$manufacturer = oos_make_filename($manufacturer_result->fields['manufacturers_name']);
$path .= $manufacturer . '-m-' . $url_array[$i] . '/';
}
break;
default:
if (!in_array($url_array[$i], $_filter)) {
$path .= $url_array[$i] . '/';
}
break;
}
}
$pos = strpos ($path, "-p-");
if ($pos === FALSE) {
// $remove = array('-c-');
} else {
$remove = array('-m-', '-c-');
}
$path = str_replace($remove, '-', $path);
if (strpos($path, '//') !== FALSE) $path = str_replace('//', '/', $path);
if (substr($path, -1) == '/') $path = substr($path, 0, -1);
$url = $base . $path . $extention;
} else {
$url = $param;
}
return $url;
}
}

View File

@ -0,0 +1,114 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
Customers_status v3.x / Catalog part
Copyright elari@free.fr
Contribution based on:
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 - 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
class oosUser {
var $group;
var $groupID;
public function __construct() {
$this->reset();
}
public function anonymous() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$nLanguageID = isset($_SESSION['language_id']) ? intval( $_SESSION['language_id'] ) : DEFAULT_LANGUAGE_ID;
$customers_statustable = $oostable['customers_status'];
$sql = "SELECT customers_status_id, customers_status_name, customers_status_public,
customers_status_show_price, customers_status_show_price_tax,
customers_status_ot_discount_flag, customers_status_ot_discount,
customers_status_ot_minimum, customers_status_qty_discounts, customers_status_payment
FROM $customers_statustable
WHERE customers_status_id = '" . DEFAULT_CUSTOMERS_STATUS_ID . "' AND
customers_status_languages_id = '" . intval($nLanguageID) . "'";
$customer_status = $dbconn->GetRow($sql);
$this->group = array('id' => $customer_status['customers_status_id'],
'text' => $customer_status['customers_status_name'],
'public' => $customer_status['customers_status_public'],
'show_price' => $customer_status['customers_status_show_price'],
'price_with_tax' => $customer_status['customers_status_show_price_tax'],
'ot_discount_flag' => $customer_status['customers_status_ot_discount_flag'],
'ot_discount' => $customer_status['customers_status_ot_discount'],
'ot_minimum' => $customer_status['customers_status_ot_minimum'],
'qty_discounts' => $customer_status['customers_status_qty_discounts'],
'payment' => $customer_status['customers_status_payment']);
}
public function restore_group() {
if (!isset($_SESSION['customer_id'])) return FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$nLanguageID = isset( $_SESSION['language_id']) ? intval( $_SESSION['language_id'] ) : 1;
$customerstable = $oostable['customers'];
$customers_statustable = $oostable['customers_status'];
$sql = "SELECT c.customers_status, cs.customers_status_id, cs.customers_status_name, cs.customers_status_public,
cs.customers_status_show_price, cs.customers_status_show_price_tax,
cs.customers_status_ot_discount_flag, cs.customers_status_ot_minimum,
cs.customers_status_ot_discount, cs.customers_status_qty_discounts, cs.customers_status_payment
FROM $customerstable AS c LEFT JOIN
$customers_statustable AS cs
ON customers_status = customers_status_id
WHERE c.customers_id='" . intval($_SESSION['customer_id']) . "' AND
cs.customers_status_languages_id = '" . intval($nLanguageID) . "'";
$customer_status = $dbconn->GetRow($sql);
$this->group = array('id' => $customer_status['customers_status_id'],
'text' => $customer_status['customers_status_name'],
'public' => $customer_status['customers_status_public'],
'show_price' => $customer_status['customers_status_show_price'],
'price_with_tax' => $customer_status['customers_status_show_price_tax'],
'ot_discount_flag' => $customer_status['customers_status_ot_discount_flag'],
'ot_discount' => $customer_status['customers_status_ot_discount'],
'ot_minimum' => $customer_status['customers_status_ot_minimum'],
'qty_discounts' => $customer_status['customers_status_qty_discounts'],
'payment' => $customer_status['customers_status_payment']);
$this->groupID = $this->generate_group_id();
}
public function reset() {
$this->group = array();
unset($this->groupID);
if (isset($_SESSION['groupID'])) unset($_SESSION['groupID']);
}
public function generate_group_id($length = 24) {
return oos_create_random_value($length, 'digits');
}
}