[TEP-COMMIT] [CVS catalog] introduction of new service modules
anonymous-OfajU3CKLf1/[email protected] 13 Apr 2004 08:02:29 -0000
| Newsgroups | gmane.comp.web.oscommerce.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit in catalog/catalog/includes/modules/services on MAIN
banner.php +45 added 1.1
breadcrumb.php +97 added 1.1
category_path.php +65 added 1.1
currencies.php +59 added 1.1
debug.php +110 added 1.1
language.php +64 added 1.1
output_compression.php +89 added 1.1
sefu.php +70 added 1.1
session.php +167 added 1.1
simple_counter.php +73 added 1.1
specials.php +44 added 1.1
whos_online.php +114 added 1.1
+997
12 added files
introduction of new service modules
----------
catalog /catalog /includes /modules /services
banner.php added at 1.1
diff -N banner.php
--- /dev/null Tue Apr 13 10:02:19 2004
+++ /tmp/cvsAAAkdaaJK Tue Apr 13 10:02:19 2004
@@ -0,0 +1,45 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ class osC_Services_banner {
+ var $title = 'Banner',
+ $description = 'Banner management features for the catalog.',
+ $uninstallable = true,
+ $depends,
+ $preceeds;
+
+ function start() {
+ include('includes/functions/banner.php');
+
+ tep_activate_banners();
+ tep_expire_banners();
+
+ return true;
+ }
+
+ function stop() {
+ return true;
+ }
+
+ function install() {
+ return false;
+ }
+
+ function remove() {
+ return false;
+ }
+
+ function keys() {
+ return false;
+ }
+ }
+?>
----------
catalog /catalog /includes /modules /services
breadcrumb.php added at 1.1
diff -N breadcrumb.php
--- /dev/null Tue Apr 13 10:02:19 2004
+++ /tmp/cvsAAAAkaGJK Tue Apr 13 10:02:19 2004
@@ -0,0 +1,97 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ class osC_Services_breadcrumb {
+ var $title = 'Breadcrumb',
+ $description = 'Breadcrumb builder for easy navigation.',
+ $uninstallable = true,
+ $depends,
+ $preceeds;
+
+ function start() {
+ if (PHP_VERSION < 4.1) {
+ global $_GET;
+ }
+
+ global $breadcrumb, $osC_Session, $osC_Database, $cPath, $cPath_array;
+
+ include('includes/classes/breadcrumb.php');
+ $breadcrumb = new breadcrumb;
+
+ $breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
+ $breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));
+
+// add category names or the manufacturer name to the breadcrumb trail
+ if (isset($cPath_array) && (sizeof($cPath_array) > 0)) {
+ $Qcategories = $osC_Database->query('select categories_id, categories_name from :table_categories_description where categories_id in (:categories_id) and language_id = :language_id');
+ $Qcategories->bindRaw(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION);
+ $Qcategories->bindRaw(':categories_id', implode(',', $cPath_array));
+ $Qcategories->bindInt(':language_id', $osC_Session->value('languages_id'));
+ $Qcategories->execute();
+
+ $categories = array();
+ while ($Qcategories->next()) {
+ $categories[$Qcategories->value('categories_id')] = $Qcategories->valueProtected('categories_name');
+ }
+
+ $Qcategories->freeResult();
+
+ for ($i=0, $n=sizeof($cPath_array); $i<$n; $i++) {
+ $breadcrumb->add($categories[$cPath_array[$i]], tep_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, ($i+1)))));
+ }
+ } elseif (isset($_GET['manufacturers_id']) && is_numeric($_GET['manufacturers_id'])) {
+ $Qmanufacturers = $osC_Database->query('select manufacturers_name from :table_manufacturers where manufacturers_id = :manufacturers_id');
+ $Qmanufacturers->bindRaw(':table_manufacturers', TABLE_MANUFACTURERS);
+ $Qmanufacturers->bindInt(':manufacturers_id', $_GET['manufacturers_id']);
+ $Qmanufacturers->execute();
+
+ if ($Qmanufacturers->numberOfRows()) {
+ $breadcrumb->add($Qmanufacturers->valueProtected('manufacturers_name'), tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $_GET['manufacturers_id']));
+ }
+
+ $Qmanufacturers->freeResult();
+ }
+
+// add the products model to the breadcrumb trail
+ if (isset($_GET['products_id']) && is_numeric($_GET['products_id'])) {
+ $Qmodel = $osC_Database->query('select products_model from :table_products where products_id = :products_id');
+ $Qmodel->bindRaw(':table_products', TABLE_PRODUCTS);
+ $Qmodel->bindInt(':products_id', $_GET['products_id']);
+ $Qmodel->execute();
+
+ if ($Qmodel->numberOfRows() > 0) {
+ $breadcrumb->add($Qmodel->valueProtected('products_model'), tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $_GET['products_id']));
+ }
+
+ $Qmodel->freeResult();
+ }
+
+ return true;
+ }
+
+ function stop() {
+ return true;
+ }
+
+ function install() {
+ return false;
+ }
+
+ function remove() {
+ return false;
+ }
+
+ function keys() {
+ return false;
+ }
+ }
+?>
----------
catalog /catalog /includes /modules /services
category_path.php added at 1.1
diff -N category_path.php
--- /dev/null Tue Apr 13 10:02:19 2004
+++ /tmp/cvsAAA8saaKK Tue Apr 13 10:02:20 2004
@@ -0,0 +1,65 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ class osC_Services_category_path {
+ var $title = 'Category Path',
+ $description = 'Parses the category path.',
+ $uninstallable = false,
+ $depends,
+ $preceeds;
+
+ function start() {
+ if (PHP_VERSION < 4.1) {
+ global $_GET;
+ }
+
+ global $cPath, $cPath_array, $current_category_id;
+
+ if (isset($_GET['cPath'])) {
+ $cPath = $_GET['cPath'];
+ } elseif (isset($_GET['products_id']) && !isset($_GET['manufacturers_id'])) {
+ $cPath = tep_get_product_path($_GET['products_id']);
+ } else {
+ $cPath = '';
+ }
+
+ if (!empty($cPath)) {
+ $cPath_array = tep_parse_category_path($cPath);
+ $cPath = implode('_', $cPath_array);
+
+ $current_category_id = end($cPath_array);
+ } else {
+ $current_category_id = 0;
+ }
+
+ include('includes/classes/category_tree.php');
+
+ return true;
+ }
+
+ function stop() {
+ return true;
+ }
+
+ function install() {
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Show Number Of Products In Each Category', 'SHOW_COUNTS', 'true', 'Recursively count how many products are in each category.', '6', '0', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
+ }
+
+ function remove() {
+ tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ function keys() {
+ return array('SHOW_COUNTS');
+ }
+ }
+?>
----------
catalog /catalog /includes /modules /services
currencies.php added at 1.1
diff -N currencies.php
--- /dev/null Tue Apr 13 10:02:20 2004
+++ /tmp/cvsAAAhwaGKK Tue Apr 13 10:02:20 2004
@@ -0,0 +1,59 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ class osC_Services_currencies {
+ var $title = 'Currencies',
+ $description = 'Set the default or selected currency.',
+ $uninstallable = false,
+ $depends = 'language',
+ $preceeds;
+
+ function start() {
+ if (PHP_VERSION < 4.1) {
+ global $_GET;
+ }
+
+ global $osC_Currencies, $osC_Session;
+
+ include('includes/classes/currencies.php');
+ $osC_Currencies = new osC_Currencies;
+
+ if (($osC_Session->exists('currency') == false) || isset($_GET['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $osC_Session->value('currency')) ) ) {
+ if (isset($_GET['currency']) && $osC_Currencies->exists($_GET['currency'])) {
+ $currency = $_GET['currency'];
+ } else {
+ $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
+ }
+
+ $osC_Session->set('currency', $currency);
+ }
+
+ return true;
+ }
+
+ function stop() {
+ return true;
+ }
+
+ function install() {
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Use Default Language Currency', 'USE_DEFAULT_LANGUAGE_CURRENCY', 'false', 'Automatically use the currency set with the language (eg, German->Euro).', '6', '0', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
+ }
+
+ function remove() {
+ tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ function keys() {
+ return array('USE_DEFAULT_LANGUAGE_CURRENCY');
+ }
+ }
+?>
----------
catalog /catalog /includes /modules /services
debug.php added at 1.1
diff -N debug.php
--- /dev/null Tue Apr 13 10:02:21 2004
+++ /tmp/cvsAAACCaaLK Tue Apr 13 10:02:21 2004
@@ -0,0 +1,110 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ class osC_Services_debug {
+ var $title = 'Debug',
+ $description = 'Display collected debug information.',
+ $uninstallable = true,
+ $depends,
+ $preceeds;
+
+ function start() {
+ if (PHP_VERSION < 4.1) {
+ global $_SERVER;
+ }
+
+ global $messageStack, $osC_Session;
+
+ if (SERVICE_DEBUG_SHOW_DEVELOPMENT_WARNING == 'True') {
+ $messageStack->add('debug', 'This is a development version of osCommerce - please use it for testing purposes only! [' . PROJECT_VERSION . ']');
+ }
+
+ if ((SERVICE_DEBUG_CHECK_INSTALLATION_MODULE == 'True') && file_exists(dirname($_SERVER['SCRIPT_FILENAME']) . '/install')) {
+ $messageStack->add('debug', WARNING_INSTALL_DIRECTORY_EXISTS . ' [' . __CLASS__ . ']', 'warning');
+ }
+
+ if ((SERVICE_DEBUG_CHECK_CONFIGURATION == 'True') && file_exists(dirname($_SERVER['SCRIPT_FILENAME']) . '/includes/configure.php') && is_writeable(dirname($_SERVER['SCRIPT_FILENAME']) . '/includes/configure.php')) {
+ $messageStack->add('debug', WARNING_CONFIG_FILE_WRITEABLE . ' [' . __CLASS__ . ']', 'warning');
+ }
+
+ if ((SERVICE_DEBUG_CHECK_SESSION_DIRECTORY == 'True') && (STORE_SESSIONS == '')) {
+ if (!is_dir($osC_Session->save_path)) {
+ $messageStack->add('debug', WARNING_SESSION_DIRECTORY_NON_EXISTENT . ' [' . __CLASS__ . ']', 'warning');
+ } elseif (!is_writeable($osC_Session->save_path)) {
+ $messageStack->add('debug', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE . ' [' . __CLASS__ . ']', 'warning');
+ }
+ }
+
+ if ((SERVICE_DEBUG_CHECK_SESSION_AUTOSTART == 'True') && (bool)ini_get('session.auto_start')) {
+ $messageStack->add('debug', WARNING_SESSION_AUTO_START . ' [' . __CLASS__ . ']', 'warning');
+ }
+
+ if ((SERVICE_DEBUG_CHECK_DOWNLOAD_DIRECTORY == 'True') && (DOWNLOAD_ENABLED == 'true')) {
+ if (!is_dir(DIR_FS_DOWNLOAD)) {
+ $messageStack->add('debug', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT . ' [' . __CLASS__ . ']', 'warning');
+ }
+ }
+
+ return true;
+ }
+
+ function stop() {
+ if (PHP_VERSION < 4.1) {
+ global $_SERVER;
+ }
+
+ global $messageStack;
+
+ $time_start = explode(' ', PAGE_PARSE_START_TIME);
+ $time_end = explode(' ', microtime());
+ $parse_time = number_format(($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0])), 3);
+
+ if (tep_not_null(SERVICE_DEBUG_EXECUTION_TIME_LOG)) {
+ if (!@error_log(strftime('%c') . ' - ' . $_SERVER['REQUEST_URI'] . ' (' . $parse_time . 's)' . "\n", 3, SERVICE_DEBUG_EXECUTION_TIME_LOG)) {
+ if (!file_exists(SERVICE_DEBUG_EXECUTION_TIME_LOG) || !is_writable(SERVICE_DEBUG_EXECUTION_TIME_LOG)) {
+ $messageStack->add('debug', 'Error: Execution time log file not writeable: ' . SERVICE_DEBUG_EXECUTION_TIME_LOG . ' [' . __CLASS__ . ']', 'error');
+ }
+ }
+ }
+
+ if (SERVICE_DEBUG_EXECUTION_DISPLAY == 'True') {
+ $messageStack->add('debug', 'Execution Time: ' . $parse_time . 's [' . __CLASS__ . ']', 'warning');
+ }
+
+ if ($messageStack->size('debug') > 0) {
+ echo $messageStack->output('debug');
+ }
+
+ return true;
+ }
+
+ function install() {
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Page Execution Time Log File', 'SERVICE_DEBUG_EXECUTION_TIME_LOG', '', 'Location of the page execution time log file (eg, /www/log/page_parse.log).', '6', '0', now())");
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Show The Page Execution Time', 'SERVICE_DEBUG_EXECUTION_DISPLAY', 'True', 'Show the page execution time.', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Log Database Queries', 'SERVICE_DEBUG_LOG_DB_QUERIES', 'False', 'Log all database queries in the page execution time log file.', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Show Development Version Warning', 'SERVICE_DEBUG_SHOW_DEVELOPMENT_WARNING', 'True', 'Show an osCommerce development version warning message.', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Check Installation Module', 'SERVICE_DEBUG_CHECK_INSTALLATION_MODULE', 'True', 'Show a warning message if the installation module exists.', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Check Configuration File', 'SERVICE_DEBUG_CHECK_CONFIGURATION', 'True', 'Show a warning if the configuration file is writeable.', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Check Sessions Directory', 'SERVICE_DEBUG_CHECK_SESSION_DIRECTORY', 'True', 'Show a warning if the file-based session directory does not exist.', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Check Sessions Auto Start', 'SERVICE_DEBUG_CHECK_SESSION_AUTOSTART', 'True', 'Show a warning if PHP is configured to automatically start sessions.', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Check Download Directory', 'SERVICE_DEBUG_CHECK_DOWNLOAD_DIRECTORY', 'True', 'Show a warning if the digital product download directory does not exist.', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ }
+
+ function remove() {
+ tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ function keys() {
+ return array('SERVICE_DEBUG_EXECUTION_TIME_LOG', 'SERVICE_DEBUG_EXECUTION_DISPLAY', 'SERVICE_DEBUG_LOG_DB_QUERIES', 'SERVICE_DEBUG_SHOW_DEVELOPMENT_WARNING', 'SERVICE_DEBUG_CHECK_INSTALLATION_MODULE', 'SERVICE_DEBUG_CHECK_CONFIGURATION', 'SERVICE_DEBUG_CHECK_SESSION_DIRECTORY', 'SERVICE_DEBUG_CHECK_SESSION_AUTOSTART', 'SERVICE_DEBUG_CHECK_DOWNLOAD_DIRECTORY');
+ }
+ }
+?>
----------
catalog /catalog /includes /modules /services
language.php added at 1.1
diff -N language.php
--- /dev/null Tue Apr 13 10:02:21 2004
+++ /tmp/cvsAAA_KaGLK Tue Apr 13 10:02:21 2004
@@ -0,0 +1,64 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ class osC_Services_language {
+ var $title = 'Language',
+ $description = 'Include the default or selected language files.',
+ $uninstallable = false,
+ $depends = 'session',
+ $preceeds;
+
+ function start() {
+ if (PHP_VERSION < 4.1) {
+ global $_GET;
+ }
+
+ global $osC_Session, $lng;
+
+ if (($osC_Session->exists('language') == false) || isset($_GET['language'])) {
+ include('includes/classes/language.php');
+ $lng = new language;
+
+ if (isset($_GET['language']) && tep_not_null($_GET['language'])) {
+ $lng->set_language($_GET['language']);
+ } else {
+ $lng->get_browser_language();
+ }
+
+ $osC_Session->set('language', $lng->language['directory']);
+ $osC_Session->set('languages_id', $lng->language['id']);
+ }
+
+ require('includes/languages/' . $osC_Session->value('language') . '.php');
+
+ header("Content-Type: text/html; charset=" . CHARSET);
+
+ return true;
+ }
+
+ function stop() {
+ return true;
+ }
+
+ function install() {
+ return false;
+ }
+
+ function remove() {
+ return false;
+ }
+
+ function keys() {
+ return false;
+ }
+ }
+?>
----------
catalog /catalog /includes /modules /services
output_compression.php added at 1.1
diff -N output_compression.php
--- /dev/null Tue Apr 13 10:02:21 2004
+++ /tmp/cvsAAAfRaaMK Tue Apr 13 10:02:22 2004
@@ -0,0 +1,89 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ class osC_Services_output_compression {
+ var $title = 'Output Compression',
+ $description = 'Compress the content with GZIP.',
+ $uninstallable = true,
+ $depends,
+ $preceeds = 'session';
+
+ function start() {
+ if (extension_loaded('zlib')) {
+ if ((int)ini_get('zlib.output_compression') < 1) {
+ if (function_exists('ob_gzhandler')) {
+ ini_set('zlib.output_compression_level', SERVICE_OUTPUT_COMPRESSION_GZIP_LEVEL);
+ ob_start('ob_gzhandler');
+
+ return false; // no call to stop() is needed
+ } else {
+ ob_start();
+ ob_implicit_flush();
+ }
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ function stop() {
+ if (PHP_VERSION < 4.1) {
+ global $_SERVER;
+ }
+
+ $encoding = false;
+ if (!headers_sent() && !connection_aborted()) {
+ if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') !== false)) {
+ $encoding = 'x-gzip';
+ } elseif (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false)) {
+ $encoding = 'gzip';
+ }
+ }
+
+ if ($encoding !== false) {
+ $contents = ob_get_contents();
+ ob_end_clean();
+
+ header('Content-Encoding: ' . $encoding);
+
+ $size = strlen($contents);
+ $crc = crc32($contents);
+
+ $contents = gzcompress($contents, SERVICE_OUTPUT_COMPRESSION_GZIP_LEVEL);
+ $contents = substr($contents, 0, strlen($contents) - 4);
+
+ echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
+ echo $contents;
+ echo pack('V', $crc);
+ echo pack('V', $size);
+ } else {
+ ob_end_flush();
+ }
+
+ return true;
+ }
+
+ function install() {
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('GZIP Compression Level', 'SERVICE_OUTPUT_COMPRESSION_GZIP_LEVEL', '5', 'Set the GZIP compression level to this value (0=min, 9=max).', '6', '0', 'tep_cfg_select_option(array(\'0\', \'1\', \'2\', \'3\', \'4\', \'5\', \'6\', \'7\', \'8\', \'9\'), ', now())");
+ }
+
+ function remove() {
+ tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ function keys() {
+ return array('SERVICE_OUTPUT_COMPRESSION_GZIP_LEVEL');
+ }
+ }
+?>
----------
catalog /catalog /includes /modules /services
sefu.php added at 1.1
diff -N sefu.php
--- /dev/null Tue Apr 13 10:02:21 2004
+++ /tmp/cvsAAAaYaOMK Tue Apr 13 10:02:22 2004
@@ -0,0 +1,70 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ class osC_Services_sefu {
+ var $title = 'Search Engine Friendly URLs',
+ $description = 'Search engine friendly urls.',
+ $uninstallable = true,
+ $depends,
+ $preceeds = 'session';
+
+ function start() {
+ if (PHP_VERSION < 4.1) {
+ global $_SERVER, $_GET;
+ }
+
+ if (isset($_SERVER['PATH_INFO']) && (strlen($_SERVER['PATH_INFO']) > 1)) {
+ $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);
+
+ $parameters = explode('/', substr($_SERVER['PATH_INFO'], 1));
+
+ $GET_array = array();
+
+ for ($i=0, $n=sizeof($parameters); $i<$n; $i++) {
+ if (!isset($parameters[$i+1])) $parameters[$i+1] = '';
+
+ if (strpos($parameters[$i], '[]')) {
+ $GET_array[substr($parameters[$i], 0, -2)][] = $parameters[$i+1];
+ } else {
+ $_GET[$parameters[$i]] = $parameters[$i+1];
+ }
+
+ $i++;
+ }
+
+ if (sizeof($GET_array) > 0) {
+ foreach ($GET_array as $key => $value) {
+ $_GET[$key] = $value;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ function stop() {
+ return true;
+ }
+
+ function install() {
+ return false;
+ }
+
+ function remove() {
+ return false;
+ }
+
+ function keys() {
+ return false;
+ }
+ }
+?>
----------
catalog /catalog /includes /modules /services
session.php added at 1.1
diff -N session.php
--- /dev/null Tue Apr 13 10:02:21 2004
+++ /tmp/cvsAAAi3aqNK Tue Apr 13 10:02:22 2004
@@ -0,0 +1,167 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ class osC_Services_session {
+ var $title = 'Session',
+ $description = 'The session manager for guests, customers, and spider robots.',
+ $uninstallable = false,
+ $depends,
+ $preceeds;
+
+ function start() {
+ if (PHP_VERSION < 4.1) {
+ global $_COOKIE, $_SERVER;
+ }
+
+ global $request_type, $cookie_path, $cookie_domain, $SID, $osC_Session, $cart, $osC_Customer, $navigation, $messageStack;
+
+ if (PHP_VERSION < 4.1) {
+ include('includes/classes/session_compatible.php');
+ } else {
+ include('includes/classes/session.php');
+ }
+ $osC_Session = new osC_Session;
+
+ if (SERVICE_SESSION_FORCE_COOKIE_USAGE == 'True') {
+ tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain);
+
+ if (isset($_COOKIE['cookie_test'])) {
+ $osC_Session->start();
+ }
+ } elseif (SERVICE_SESSION_BLOCK_SPIDERS == 'True') {
+ $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
+ $spider_flag = false;
+
+ if (tep_not_null($user_agent)) {
+ $spiders = file('includes/spiders.txt');
+
+ foreach ($spiders as $spider) {
+ if (tep_not_null($spider)) {
+ if (strpos($user_agent, trim($spider)) !== false) {
+ $spider_flag = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if ($spider_flag == false) {
+ $osC_Session->start();
+ }
+ } else {
+ $osC_Session->start();
+ }
+
+ $SID = (defined('SID') ? SID : '');
+
+// verify the ssl_session_id
+ if ( ($request_type == 'SSL') && (SERVICE_SESSION_CHECK_SSL_SESSION_ID == 'True') && (ENABLE_SSL == true) && ($osC_Session->is_started == true) ) {
+ if (isset($_SERVER['SSL_SESSION_ID'])) {
+ $ssl_session_id = $_SERVER['SSL_SESSION_ID'];
+
+ if ($osC_Session->exists('SESSION_SSL_ID') == false) {
+ $osC_Session->set('SESSION_SSL_ID', $ssl_session_id);
+ }
+
+ if ($osC_Session->value('SESSION_SSL_ID') != $ssl_session_id) {
+ $osC_Session->destroy();
+
+ tep_redirect(tep_href_link(FILENAME_SSL_CHECK));
+ }
+ }
+ }
+
+// verify the browser user agent
+ if (SERVICE_SESSION_CHECK_USER_AGENT == 'True') {
+ $http_user_agent = (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '');
+
+ if ($osC_Session->exists('SESSION_USER_AGENT') == false) {
+ $osC_Session->set('SESSION_USER_AGENT', $http_user_agent);
+ } elseif ($osC_Session->value('SESSION_USER_AGENT') != $http_user_agent) {
+ $osC_Session->destroy();
+
+ tep_redirect(tep_href_link(FILENAME_LOGIN));
+ }
+ }
+
+// verify the IP address
+ if (SERVICE_SESSION_CHECK_IP_ADDRESS == 'True') {
+ $ip_address = tep_get_ip_address();
+
+ if ($osC_Session->exists('SESSION_IP_ADDRESS') == false) {
+ $osC_Session->set('SESSION_IP_ADDRESS', $ip_address);
+ }
+
+ if ($osC_Session->value('SESSION_IP_ADDRESS') != $ip_address) {
+ $osC_Session->destroy();
+
+ tep_redirect(tep_href_link(FILENAME_LOGIN));
+ }
+ }
+
+// create an instance of the shopping cart
+ if ($osC_Session->exists('cart')) {
+ $cart =& $osC_Session->value('cart');
+ } else {
+ $cart = new shoppingCart;
+ $osC_Session->set('cart', $cart);
+ }
+
+// create an instance of the customer class
+ if ($osC_Session->exists('osC_Customer')) {
+ $osC_Customer =& $osC_Session->value('osC_Customer');
+ } else {
+ $osC_Customer = new osC_Customer;
+ $osC_Session->set('osC_Customer', $osC_Customer);
+ }
+
+// navigation history
+ if ($osC_Session->exists('navigation')) {
+ $navigation =& $osC_Session->value('navigation');
+ } else {
+ $navigation = new navigationHistory;
+ $osC_Session->set('navigation', $navigation);
+ }
+ $navigation->add_current_page();
+
+// add messages in the session to the message stack
+ $messageStack->loadFromSession();
+
+ return true;
+ }
+
+ function stop() {
+ global $osC_Session;
+
+ $osC_Session->close();
+
+ return true;
+ }
+
+ function install() {
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Force Cookie Usage', 'SERVICE_SESSION_FORCE_COOKIE_USAGE', 'False', 'Only start a session when cookies are enabled.', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Block Search Engine Spiders', 'SERVICE_SESSION_BLOCK_SPIDERS', 'False', 'Block search engine spider robots from starting a session.', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Check SSL Session ID', 'SERVICE_SESSION_CHECK_SSL_SESSION_ID', 'False', 'Check the SSL_SESSION_ID on every secure HTTPS page request.', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Check User Agent', 'SERVICE_SESSION_CHECK_USER_AGENT', 'False', 'Check the browser user agent on every page request.', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Check IP Address', 'SERVICE_SESSION_CHECK_IP_ADDRESS', 'False', 'Check the IP address on every page request.', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Regenerate Session ID', 'SERVICE_SESSION_REGENERATE_ID', 'False', 'Regenerate the session ID when a customer logs on or creates an account (requires PHP >= 4.1).', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ }
+
+ function remove() {
+ tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ function keys() {
+ return array('SERVICE_SESSION_FORCE_COOKIE_USAGE', 'SERVICE_SESSION_BLOCK_SPIDERS', 'SERVICE_SESSION_CHECK_SSL_SESSION_ID', 'SERVICE_SESSION_CHECK_USER_AGENT', 'SERVICE_SESSION_CHECK_IP_ADDRESS', 'SERVICE_SESSION_REGENERATE_ID');
+ }
+ }
+?>
----------
catalog /catalog /includes /modules /services
simple_counter.php added at 1.1
diff -N simple_counter.php
--- /dev/null Tue Apr 13 10:02:22 2004
+++ /tmp/cvsAAAA9a4NK Tue Apr 13 10:02:23 2004
@@ -0,0 +1,73 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ class osC_Services_simple_counter {
+ var $title = 'Simple Counter',
+ $description = 'Count the number of page requests made.',
+ $uninstallable = true,
+ $depends,
+ $preceeds;
+
+ function start() {
+ global $osC_Database, $messageStack;
+
+ $Qcounter = $osC_Database->query('select startdate, counter from :table_counter');
+ $Qcounter->bindRaw(':table_counter', TABLE_COUNTER);
+ $Qcounter->execute();
+
+ if ($Qcounter->numberOfRows()) {
+ $counter_startdate = $Qcounter->value('startdate');
+ $counter_now = $Qcounter->valueInt('counter') + 1;
+
+ $Qcounterupdate = $osC_Database->query('update :table_counter set counter = counter+1');
+ $Qcounterupdate->bindRaw(':table_counter', TABLE_COUNTER);
+ $Qcounterupdate->execute();
+
+ $Qcounterupdate->freeResult();
+ } else {
+ $counter_startdate = date('Ymd');
+ $counter_now = 1;
+
+ $Qcounterupdate = $osC_Database->query('insert into :table_counter (startdate, counter) values (:start_date, 1)');
+ $Qcounterupdate->bindRaw(':table_counter', TABLE_COUNTER);
+ $Qcounterupdate->bindValue(':start_date', $counter_startdate);
+ $Qcounterupdate->execute();
+
+ $Qcounterupdate->freeResult();
+ }
+
+ $Qcounter->freeResult();
+
+ $counter_startdate_formatted = strftime(DATE_FORMAT_LONG, mktime(0, 0, 0, substr($counter_startdate, 4, 2), substr($counter_startdate, -2), substr($counter_startdate, 0, 4)));
+
+ $messageStack->add('counter', number_format($counter_now) . ' ' . FOOTER_TEXT_REQUESTS_SINCE . ' ' . $counter_startdate_formatted);
+
+ return true;
+ }
+
+ function stop() {
+ return true;
+ }
+
+ function install() {
+ return false;
+ }
+
+ function remove() {
+ return false;
+ }
+
+ function keys() {
+ return false;
+ }
+ }
+?>
----------
catalog /catalog /includes /modules /services
specials.php added at 1.1
diff -N specials.php
--- /dev/null Tue Apr 13 10:02:22 2004
+++ /tmp/cvsAAAzdaGOK Tue Apr 13 10:02:23 2004
@@ -0,0 +1,44 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ class osC_Services_specials {
+ var $title = 'Specials',
+ $description = 'Prepare the products that are on special.',
+ $uninstallable = true,
+ $depends,
+ $preceeds;
+
+ function start() {
+ include('includes/functions/specials.php');
+
+ tep_expire_specials();
+
+ return true;
+ }
+
+ function stop() {
+ return true;
+ }
+
+ function install() {
+ return false;
+ }
+
+ function remove() {
+ return false;
+ }
+
+ function keys() {
+ return false;
+ }
+ }
+?>
----------
catalog /catalog /includes /modules /services
whos_online.php added at 1.1
diff -N whos_online.php
--- /dev/null Tue Apr 13 10:02:22 2004
+++ /tmp/cvsAAA8iaaPK Tue Apr 13 10:02:23 2004
@@ -0,0 +1,114 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ class osC_Services_whos_online {
+ var $title = 'Who\'s Online',
+ $description = 'See who is currently online.',
+ $uninstallable = true,
+ $depends = 'session',
+ $preceeds;
+
+ function start() {
+ if (PHP_VERSION < 4.1) {
+ global $_SERVER;
+ }
+
+ global $osC_Session, $osC_Customer, $osC_Database;
+
+ if ($osC_Customer->isLoggedOn()) {
+ $wo_customer_id = $osC_Customer->id;
+ $wo_full_name = $osC_Customer->full_name;
+ } else {
+ $wo_customer_id = '';
+ $wo_full_name = 'Guest';
+
+ if (SERVICE_WHOS_ONLINE_SPIDER_DETECTION == 'True') {
+ $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
+
+ if (tep_not_null($user_agent)) {
+ $spiders = file('includes/spiders.txt');
+
+ foreach ($spiders as $spider) {
+ if (tep_not_null($spider)) {
+ if ((strpos($user_agent, trim($spider))) !== false) {
+ $wo_full_name = $spider;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $wo_session_id = $osC_Session->id;
+ $wo_ip_address = tep_get_ip_address();
+ $wo_last_page_url = $_SERVER['REQUEST_URI'];
+
+ $current_time = time();
+ $xx_mins_ago = ($current_time - 900);
+
+// remove entries that have expired
+ $Qwhosonline = $osC_Database->query('delete from :table_whos_online where time_last_click < :time_last_click');
+ $Qwhosonline->bindRaw(':table_whos_online', TABLE_WHOS_ONLINE);
+ $Qwhosonline->bindValue(':time_last_click', $xx_mins_ago);
+ $Qwhosonline->execute();
+
+ $Qwhosonline = $osC_Database->query('select count(*) as count from :table_whos_online where session_id = :session_id');
+ $Qwhosonline->bindRaw(':table_whos_online', TABLE_WHOS_ONLINE);
+ $Qwhosonline->bindValue(':session_id', $wo_session_id);
+ $Qwhosonline->execute();
+
+ if ($Qwhosonline->valueInt('count') > 0) {
+ $Qwhosonline = $osC_Database->query('update :table_whos_online set customer_id = :customer_id, full_name = :full_name, ip_address = :ip_address, time_last_click = :time_last_click, last_page_url = :last_page_url where session_id = :session_id');
+ $Qwhosonline->bindRaw(':table_whos_online', TABLE_WHOS_ONLINE);
+ $Qwhosonline->bindInt(':customer_id', $wo_customer_id);
+ $Qwhosonline->bindValue(':full_name', $wo_full_name);
+ $Qwhosonline->bindValue(':ip_address', $wo_ip_address);
+ $Qwhosonline->bindValue(':time_last_click', $current_time);
+ $Qwhosonline->bindValue(':last_page_url', $wo_last_page_url);
+ $Qwhosonline->bindValue(':session_id', $wo_session_id);
+ $Qwhosonline->execute();
+ } else {
+ $Qwhosonline = $osC_Database->query('insert into :table_whos_online (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url) values (:customer_id, :full_name, :session_id, :ip_address, :time_entry, :time_last_click, :last_page_url)');
+ $Qwhosonline->bindRaw(':table_whos_online', TABLE_WHOS_ONLINE);
+ $Qwhosonline->bindInt(':customer_id', $wo_customer_id);
+ $Qwhosonline->bindValue(':full_name', $wo_full_name);
+ $Qwhosonline->bindValue(':session_id', $wo_session_id);
+ $Qwhosonline->bindValue(':ip_address', $wo_ip_address);
+ $Qwhosonline->bindValue(':time_entry', $current_time);
+ $Qwhosonline->bindValue(':time_last_click', $current_time);
+ $Qwhosonline->bindValue(':last_page_url', $wo_last_page_url);
+ $Qwhosonline->execute();
+ }
+
+ $Qwhosonline->freeResult();
+
+ return true;
+ }
+
+ function stop() {
+ return true;
+ }
+
+ function install() {
+ tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Detect Search Engine Spider Robots', 'SERVICE_WHOS_ONLINE_SPIDER_DETECTION', 'True', 'Detect search engine spider robots (GoogleBot, Yahoo, etc).', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
+ }
+
+ function remove() {
+ tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ function keys() {
+ return array('SERVICE_WHOS_ONLINE_SPIDER_DETECTION');
+ }
+ }
+?>
CVSspam 0.2.8
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click