Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

errors in admin/configuration.php line 119


MikeMike

Recommended Posts

Posted

This is a snapshot from 12/14/02

 

When I am setting the configuration up in admin I keep getting errors in admin/configuration.php line 119 which is this part:

 

if ($cInfo->set_function) {

eval('$value_field = ' . $cInfo->set_function . "'" . $cInfo->configuration_value . "');");

} else {

$value_field = tep_draw_input_field('configuration_value', $cInfo->configuration_value);

}

 

 

The errors are:

 

unexpected $

and

unexpected T_STRING, expecting ')'

 

Are there any errors in the code above or is it something else?

Posted

I'm lost on this one so I will try and post the whole configuration.php and hope someone will check it out. It is however, the exact same as the current cvs file.

 

Here is the error I get when I click on the edit button for the SE friendly URL:

 

Parse error: parse error, unexpected T_STRING, expecting ')' in /home/virtual/site3/fst/var/www/html/adm1/configuration.php(119) : eval()'d code on line 1

 

I get the same error for some of the other settings.

 

Here is the entire configuration.php

 

 

<?php

/*

$Id: configuration.php,v 1.39 2002/08/13 18:53:04 dgw_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

if ($HTTP_GET_VARS['action']) {

switch ($HTTP_GET_VARS['action']) {

case 'save':

$configuration_value = tep_db_prepare_input($HTTP_POST_VARS['configuration_value']);

$cID = tep_db_prepare_input($HTTP_GET_VARS['cID']);

 

tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_db_input($configuration_value) . "', last_modified = now() where configuration_id = '" . tep_db_input($cID) . "'");

tep_redirect(tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cID));

break;

}

}

 

$cfg_group_query = tep_db_query("select configuration_group_title from " . TABLE_CONFIGURATION_GROUP . " where configuration_group_id = '" . $HTTP_GET_VARS['gID'] . "'");

$cfg_group = tep_db_fetch_array($cfg_group_query);

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

<script language="javascript" src="includes/general.js"></script>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo $cfg_group['configuration_group_title']; ?></td>

<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CONFIGURATION_TITLE; ?></td>

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CONFIGURATION_VALUE; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>

</tr>

<?php

$configuration_query = tep_db_query("select configuration_id, configuration_title, configuration_value, use_function from " . TABLE_CONFIGURATION . " where configuration_group_id = '" . $HTTP_GET_VARS['gID'] . "' order by sort_order");

while ($configuration = tep_db_fetch_array($configuration_query)) {

if (tep_not_null($configuration['use_function'])) {

$use_function = $configuration['use_function'];

if (ereg('->', $use_function)) {

$class_method = explode('->', $use_function);

if (!is_object(${$class_method[0]})) {

include(DIR_WS_CLASSES . $class_method[0] . '.php');

${$class_method[0]} = new $class_method[0]();

}

$cfgValue = tep_call_function($class_method[1], $configuration['configuration_value'], ${$class_method[0]});

} else {

$cfgValue = tep_call_function($use_function, $configuration['configuration_value']);

}

} else {

$cfgValue = $configuration['configuration_value'];

}

 

if (((!$HTTP_GET_VARS['cID']) || (@$HTTP_GET_VARS['cID'] == $configuration['configuration_id'])) && (!$cInfo) && (substr($HTTP_GET_VARS['action'], 0, 3) != 'new')) {

$cfg_extra_query = tep_db_query("select configuration_key, configuration_description, date_added, last_modified, use_function, set_function from " . TABLE_CONFIGURATION . " where configuration_id = '" . $configuration['configuration_id'] . "'");

$cfg_extra = tep_db_fetch_array($cfg_extra_query);

 

$cInfo_array = tep_array_merge($configuration, $cfg_extra);

$cInfo = new objectInfo($cInfo_array);

}

 

if ( (is_object($cInfo)) && ($configuration['configuration_id'] == $cInfo->configuration_id) ) {

echo ' <tr class="dataTableRowSelected" onmouseover="this.style.cursor='hand'" onclick="document.location.href='' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cInfo->configuration_id . '&action=edit') . ''">' . "n";

} else {

echo ' <tr class="dataTableRow" onmouseover="this.className='dataTableRowOver';this.style.cursor='hand'" onmouseout="this.className='dataTableRow'" onclick="document.location.href='' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $configuration['configuration_id']) . ''">' . "n";

}

?>

<td class="dataTableContent"><?php echo $configuration['configuration_title']; ?></td>

<td class="dataTableContent"><?php echo htmlspecialchars($cfgValue); ?></td>

<td class="dataTableContent" align="right"><?php if ( (is_object($cInfo)) && ($configuration['configuration_id'] == $cInfo->configuration_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $configuration['configuration_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>

</tr>

<?php

}

?>

</table></td>

<?php

$heading = array();

$contents = array();

switch ($HTTP_GET_VARS['action']) {

case 'edit':

$heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');

 

if ($cInfo->set_function) {

eval('$value_field = ' . $cInfo->set_function . "'" . $cInfo->configuration_value . "');");

} else {

$value_field = tep_draw_input_field('configuration_value', $cInfo->configuration_value);

}

 

$contents = array('form' => tep_draw_form('configuration', FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cInfo->configuration_id . '&action=save'));

$contents[] = array('text' => TEXT_INFO_EDIT_INTRO);

$contents[] = array('text' => '<br><b>' . $cInfo->configuration_title . '</b><br>' . $cInfo->configuration_description . '<br>' . $value_field);

$contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cInfo->configuration_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');

break;

default:

if (is_object($cInfo)) {

$heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');

 

$contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cInfo->configuration_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a>');

$contents[] = array('text' => '<br>' . $cInfo->configuration_description);

$contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . tep_date_short($cInfo->date_added));

if (tep_not_null($cInfo->last_modified)) $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . tep_date_short($cInfo->last_modified));

}

break;

}

 

if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {

echo ' <td width="25%" valign="top">' . "n";

 

$box = new box;

echo $box->infoBox($heading, $contents);

 

echo ' </td>' . "n";

}

?>

</tr>

</table></td>

</tr>

</table></td>

<!-- body_text_eof //-->

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

I hope someone can help me with this.

 

Regards

Michael

Posted

I finally found the error.

I upgraded a 2.2 snapshot from Sept 2001 to the latest snapshot. I used the included DB upgrade tool.

In the DB configuration table the set_function was set to varchar(32) instead of varchar(255) so a lot of the code was cut off.

Posted
I finally found the error.

I upgraded a 2.2 snapshot from Sept 2001 to the latest snapshot. I used the included DB upgrade tool.

In the DB configuration table the set_function was set to varchar(32) instead of varchar(255) so a lot of the code was cut off.

 

Good work to find the solution :)

 

There is a perl script in the Extras directory called mysql_diff, that will show you the difference between two mysql databases (either as real databases or dump files).

 

I'd suggest using this script to find out what else has been changed, as the upgrade function on the installation module is for 2.1->2.2 only, not 2.2-CVS->2.2-CVS.

:heart:, osCommerce

Posted

Ok, I found a easy way that seems to work for a upgrade between a older and current v.2.2.

 

1. backup your database, just in case everything screws up.

 

2. upgrade the database with upgrade.php in the install directory.

 

3. from phpadmin I do a "View dump (schema) of database" with data only and save it.

 

4. Delete the whole database and create a new empty one.

 

5. Import the oscommerce.sql database in the install directory.

 

6. empty all tables in:

 

address_book

banners

banners_history

categories

categories_description

counter

counter_history

customers

customers_basket

customers_basket_attributes

customers_info

manufacturers

manufacturers_info

orders

orders_products

orders_products_attributes

orders_products_download

orders_status

orders_status_history

orders_total

products

products_attributes

products_attributes_download

products_description

products_notifications

products_options

products_options_values

products_options_values_to_products_options

products_to_categories

reviews

reviews_description

specials

 

7. Import the same tables from the "View dump (schema) of database" you made.

 

8. Run through the configurations in your admin.

 

This worked for me and so far there are no problems.

 

 

All this might be obvious to many in this forum, but I am sure it will be a help for other non-programmers like me.

 

Regards

Michael

Archived

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

×
×
  • Create New...