Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

header tags issue


rabbitseffort

Recommended Posts

Posted

I installed the header tags contribution and the install all went well and the shop still works except the admin area...I can not use it at all and this is the error I get when I click on any link in the admin area:

 

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/mindzeye/public_html/catalog/admin/includes/functions/database.php:13) in /home/mindzeye/public_html/catalog/admin/includes/functions/database.php on line 13

 

 

please someone help me sort this out so I can use the header tags, much appreciation! Here is the code from the database.php file in case I get asked for it...I see no problem in it but maybe there is?

<?php
/*
 $Id: database.php,v 1.23 2003/06/20 00:18:30 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {
global $$link;

if (USE_PCONNECT == 'true') {
  $$link = mysql_pconnect($server, $username, $password);
} else {
  $$link = mysql_connect($server, $username, $password);
}

if ($$link) mysql_select_db($database);

return $$link;
 }

 function tep_db_close($link = 'db_link') {
global $$link;

return mysql_close($$link);
 }

 function tep_db_error($query, $errno, $error) { 
die('<font color="#000000"><b>' . $errno . ' - ' . $error . '<br><br>' . $query . '<br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>');
 }

 function tep_db_query($query, $link = 'db_link') {
global $$link, $logger;

if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
  if (!is_object($logger)) $logger = new logger;
  $logger->write($query, 'QUERY');
}

$result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error());

if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
  if (mysql_error()) $logger->write(mysql_error(), 'ERROR');
}

return $result;
 }

 function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') {
reset($data);
if ($action == 'insert') {
  $query = 'insert into ' . $table . ' (';
  while (list($columns, ) = each($data)) {
	$query .= $columns . ', ';
  }
  $query = substr($query, 0, -2) . ') values (';
  reset($data);
  while (list(, $value) = each($data)) {
	switch ((string)$value) {
	  case 'now()':
		$query .= 'now(), ';
		break;
	  case 'null':
		$query .= 'null, ';
		break;
	  default:
		$query .= '\'' . tep_db_input($value) . '\', ';
		break;
	}
  }
  $query = substr($query, 0, -2) . ')';
} elseif ($action == 'update') {
  $query = 'update ' . $table . ' set ';
  while (list($columns, $value) = each($data)) {
	switch ((string)$value) {
	  case 'now()':
		$query .= $columns . ' = now(), ';
		break;
	  case 'null':
		$query .= $columns .= ' = null, ';
		break;
	  default:
		$query .= $columns . ' = \'' . tep_db_input($value) . '\', ';
		break;
	}
  }
  $query = substr($query, 0, -2) . ' where ' . $parameters;
}

return tep_db_query($query, $link);
 }

 function tep_db_fetch_array($db_query) {
return mysql_fetch_array($db_query, MYSQL_ASSOC);
 }

 function tep_db_result($result, $row, $field = '') {
return mysql_result($result, $row, $field);
 }

 function tep_db_num_rows($db_query) {
return mysql_num_rows($db_query);
 }

 function tep_db_data_seek($db_query, $row_number) {
return mysql_data_seek($db_query, $row_number);
 }

 function tep_db_insert_id() {
return mysql_insert_id();
 }

 function tep_db_free_result($db_query) {
return mysql_free_result($db_query);
 }

 function tep_db_fetch_fields($db_query) {
return mysql_fetch_field($db_query);
 }

 function tep_db_output($string) {
return htmlspecialchars($string);
 }

 function tep_db_input($string) {
return addslashes($string);
 }

 function tep_db_prepare_input($string) {
if (is_string($string)) {
  return trim(stripslashes($string));
} elseif (is_array($string)) {
  reset($string);
  while (list($key, $value) = each($string)) {
	$string[$key] = tep_db_prepare_input($value);
  }
  return $string;
} else {
  return $string;
}
 }
?>

"I must admit that I personally measure success in terms of the contributions an individual makes to her or his fellow human beings."

---Margaret Mead---

 

"The answer is never the answer. What's really interesting is the mystery. If you seek the mystery instead of the answer, you'll always be seeking. I've never seen anybody really find the answer -- they think they have, so they stop thinking. But the job is to seek mystery, evoke mystery, plant a garden in which strange plants grow and mysteries bloom. The need for mystery is greater than the need for an answer.

--Ken Kesey"

Posted

check out what file??? application_top?

"I must admit that I personally measure success in terms of the contributions an individual makes to her or his fellow human beings."

---Margaret Mead---

 

"The answer is never the answer. What's really interesting is the mystery. If you seek the mystery instead of the answer, you'll always be seeking. I've never seen anybody really find the answer -- they think they have, so they stop thinking. But the job is to seek mystery, evoke mystery, plant a garden in which strange plants grow and mysteries bloom. The need for mystery is greater than the need for an answer.

--Ken Kesey"

Posted
check out what file??? application_top?

here is the code for admin/includes/application_top if this may help

<?php
/*
 $Id: application_top.php,v 1.162 2003/07/12 09:39:03 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

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

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

// Check if register_globals is enabled.
// Since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.
 if (function_exists('ini_get')) {
ini_get('register_globals') or exit('FATAL ERROR: register_globals is disabled in php.ini, please enable it!');
 }

// Set the local configuration parameters - mainly for developers
 if (file_exists('includes/local/configure.php')) include('includes/local/configure.php');

// Include application configuration parameters
 require('includes/configure.php');

// Define the project version
 define('PROJECT_VERSION', 'osCommerce 2.2-MS2');

// set php_self in the local scope
 $PHP_SELF = (isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']);

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

// include the list of project filenames
 require(DIR_WS_INCLUDES . 'filenames.php');

// include the list of project database tables
 require(DIR_WS_INCLUDES . 'database_tables.php');

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

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

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

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

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

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

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

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

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

// check to see if php implemented session management functions - if not, include php3/php4 compatible session class
 if (!function_exists('session_start')) {
define('PHP_SESSION_NAME', 'osCAdminID');
define('PHP_SESSION_PATH', '/');
define('PHP_SESSION_SAVE_PATH', SESSION_WRITE_DIRECTORY);

include(DIR_WS_CLASSES . 'sessions.php');
 }

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

// set the session name and save path
 tep_session_name('osCAdminID');
 tep_session_save_path(SESSION_WRITE_DIRECTORY);

// set the session cookie parameters
  if (function_exists('session_set_cookie_params')) {
session_set_cookie_params(0, DIR_WS_ADMIN);
 } elseif (function_exists('ini_set')) {
ini_set('session.cookie_lifetime', '0');
ini_set('session.cookie_path', DIR_WS_ADMIN);
 }

// lets start our session
 tep_session_start();

// set the language
 if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {
if (!tep_session_is_registered('language')) {
  tep_session_register('language');
  tep_session_register('languages_id');
}

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

if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
  $lng->set_language($HTTP_GET_VARS['language']);
} else {
  $lng->get_browser_language();
}

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

// include the language translations
 require(DIR_WS_LANGUAGES . $language . '.php');
 $current_page = basename($PHP_SELF);
 if (file_exists(DIR_WS_LANGUAGES . $language . '/' . $current_page)) {
include(DIR_WS_LANGUAGES . $language . '/' . $current_page);
 }

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

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

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

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

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

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

// email classes
 require(DIR_WS_CLASSES . 'mime.php');
 require(DIR_WS_CLASSES . 'email.php');

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

// calculate category path
 if (isset($HTTP_GET_VARS['cPath'])) {
$cPath = $HTTP_GET_VARS['cPath'];
 } else {
$cPath = '';
 }

 if (tep_not_null($cPath)) {
$cPath_array = tep_parse_category_path($cPath);
$cPath = implode('_', $cPath_array);
$current_category_id = $cPath_array[(sizeof($cPath_array)-1)];
 } else {
$current_category_id = 0;
 }

// default open navigation box
 if (!tep_session_is_registered('selected_box')) {
tep_session_register('selected_box');
$selected_box = 'configuration';
 }

 if (isset($HTTP_GET_VARS['selected_box'])) {
$selected_box = $HTTP_GET_VARS['selected_box'];
 }

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

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

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

 if (function_exists('ini_get') && ((bool)ini_get('file_uploads') == false) ) {
$messageStack->add(WARNING_FILE_UPLOADS_DISABLED, 'warning');
 }
?>

"I must admit that I personally measure success in terms of the contributions an individual makes to her or his fellow human beings."

---Margaret Mead---

 

"The answer is never the answer. What's really interesting is the mystery. If you seek the mystery instead of the answer, you'll always be seeking. I've never seen anybody really find the answer -- they think they have, so they stop thinking. But the job is to seek mystery, evoke mystery, plant a garden in which strange plants grow and mysteries bloom. The need for mystery is greater than the need for an answer.

--Ken Kesey"

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...