Enjoy an ad free experience by logging in. Not a member yet?
Register .
05-25-2004, 11:09 AM
PM User |
#1
New Coder
Join Date: May 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Parse error in configuration.php(125) : eval()'d code on line 1
I get this error after install
http://www.oscommerce.com/community/contributions,1255/ on osCommerce 2.2MS2
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in c:\programmer\easyphp1-7\www\catalog\admin\configuration.php(125) : eval()'d code on line
can anybody see a code mistake?
Code:
switch ($action) {
case 'edit':
$heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');
if ($cInfo->set_function) {
eval('$value_field = ' . $cInfo->set_function . '"' . htmlspecialchars($cInfo->configuration_value) . '");');
} else {
$value_field = tep_draw_input_field('configuration_value', $cInfo->configuration_value);
}
05-25-2004, 01:59 PM
PM User |
#2
New Coder
Join Date: May 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
now i get error:
Parse error: parse error, unexpected T_DEFAULT in c:\programmer\easyphp1-7\www\catalog\admin\configuration.php on line 137
Code:
switch ($action) {
case 'edit':
$heading = array('text' => '<b>' . $cInfo->configuration_title . '</b>');
if ($cInfo->set_function) {
eval('$value_field = ' . $cInfo->set_function . '"' . htmlspecialchars($cInfo->configuration_value) . '");');
} else {
$value_field = tep_draw_input_field('configuration_value', $cInfo->configuration_value);
}
break;
default: break;
}
$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 (isset($cInfo) && 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";
}
?>
05-25-2004, 02:26 PM
PM User |
#3
Senior Coder
Join Date: Jun 2002
Location: frankfurt, german banana republic
Posts: 1,848
Thanks: 0
Thanked 0 Times in 0 Posts
You have two "default", statements in your snippet and the second is outside of any switch block. Fix your switch statement, it seems to end to soon.
__________________
De gustibus non est disputandum.
05-25-2004, 02:30 PM
PM User |
#4
New Coder
Join Date: May 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
better you get all, because i don't have any ideer
PHP Code:
<?php
/*
$Id: configuration.php,v 1.43 2003/06/29 22:50:51 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
[url]http://www.oscommerce.com[/url]
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
require( 'includes/application_top.php' );
$action = (isset( $HTTP_GET_VARS [ 'action' ]) ? $HTTP_GET_VARS [ 'action' ] : '' );
if ( tep_not_null ( $action )) {
switch ( $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 = '" . (int) $cID . "'" );
tep_redirect ( tep_href_link ( FILENAME_CONFIGURATION , 'gID=' . $HTTP_GET_VARS [ 'gID' ] . '&cID=' . $cID ));
break;
}
}
$gID = (isset( $HTTP_GET_VARS [ 'gID' ])) ? $HTTP_GET_VARS [ 'gID' ] : 1 ;
$cfg_group_query = tep_db_query ( "select configuration_group_title from " . TABLE_CONFIGURATION_GROUP . " where configuration_group_id = '" . (int) $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 = '" . (int) $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 ((!isset( $HTTP_GET_VARS [ 'cID' ]) || (isset( $HTTP_GET_VARS [ 'cID' ]) && ( $HTTP_GET_VARS [ 'cID' ] == $configuration [ 'configuration_id' ]))) && !isset( $cInfo ) && ( substr ( $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 = '" . (int) $configuration [ 'configuration_id' ] . "'" );
$cfg_extra = tep_db_fetch_array ( $cfg_extra_query );
$cInfo_array = array_merge ( $configuration , $cfg_extra );
$cInfo = new objectInfo ( $cInfo_array );
}
if ( (isset( $cInfo ) && is_object ( $cInfo )) && ( $configuration [ 'configuration_id' ] == $cInfo -> configuration_id ) ) {
echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" 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="rowOverEffect(this)" onmouseout="rowOutEffect(this)" 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 ( (isset( $cInfo ) && 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 ( $action ) {
case 'edit' :
$heading = array( 'text' => '<b>' . $cInfo -> configuration_title . '</b>' );
if ( $cInfo -> set_function ) {
eval( '$value_field = ' . $cInfo -> set_function . '"' . htmlspecialchars ( $cInfo -> configuration_value ) . '");' );
} else {
$value_field = tep_draw_input_field ( 'configuration_value' , $cInfo -> configuration_value );
}
break;
default: break;
}
$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 (isset( $cInfo ) && 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' ); ?>
05-25-2004, 03:07 PM
PM User |
#5
Regular Coder
Join Date: May 2004
Location: sweden
Posts: 236
Thanks: 0
Thanked 0 Times in 0 Posts
Yes, as mentioned your switch block is not formed correctly. try:
Code:
switch ($action) {
case 'edit':
$heading = array('text' => '<b>' . $cInfo->configuration_title . '</b>');
if ($cInfo->set_function) {
eval('$value_field = ' . $cInfo->set_function . '"' . htmlspecialchars($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 (isset($cInfo) && 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;
}
Last edited by carl_mcdade; 05-25-2004 at 03:09 PM ..
05-25-2004, 03:10 PM
PM User |
#6
New Coder
Join Date: May 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in c:\programmer\easyphp1-7\www\catalog\admin\configuration.php(125) : eval()'d code on line 1
PHP Code:
<?php
$heading = array();
$contents = array();
switch ( $action ) {
case 'edit' :
$heading = array( 'text' => '<b>' . $cInfo -> configuration_title . '</b>' );
if ( $cInfo -> set_function ) {
eval( '$value_field = ' . $cInfo -> set_function . '"' . htmlspecialchars ( $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 (isset( $cInfo ) && 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" ;
}
?>
05-25-2004, 05:13 PM
PM User |
#7
Regular Coder
Join Date: May 2004
Location: sweden
Posts: 236
Thanks: 0
Thanked 0 Times in 0 Posts
Oops!
I forgot about that part when I saw the switch syntax.
Code:
$value_field = ' . $cInfo->set_function . '"' . htmlspecialchars($cInfo->configuration_value) . '");
is not a valid PHP statement try:
Code:
$value_field = $cInfo->set_function . '"' . htmlspecialchars($cInfo->configuration_value) . '"';
is okay then wrap it in the eval(); Since you are using single quotes.
Code:
eval ($value_field = $cInfo->set_function . '"' . htmlspecialchars($cInfo->configuration_value) . '"';);
Then I examined the string further. escaping the first $ should fix the problem
Code:
eval('\$value_field = ' . $cInfo->set_function . '"' . htmlspecialchars($cInfo->configuration_value) . '");');
Last edited by carl_mcdade; 05-25-2004 at 05:24 PM ..
05-25-2004, 05:29 PM
PM User |
#8
New Coder
Join Date: May 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Carl you are the man of the day
That worked
this is the one I use now
PHP Code:
$value_field = $cInfo -> set_function . '"' . htmlspecialchars ( $cInfo -> configuration_value ) . '"' ;
(but) now in Shipping/Packaging-->Dimensional Weight-->edit theis is the text:
Please make any necessary changes
Dimensional Weight
Do you want to use Dimensional weight if it exceeds actual weight?
tep_cfg_select_option(array('true', 'false')""
update -- cancel buttoms and update don't work!!!
whay the tep_cfg_select_option(array('true', 'false')"" ?????
Thank you so muths
Last edited by avu; 05-25-2004 at 05:46 PM ..
05-25-2004, 06:38 PM
PM User |
#9
Regular Coder
Join Date: May 2004
Location: sweden
Posts: 236
Thanks: 0
Thanked 0 Times in 0 Posts
I wish i could help more directly but templating systems like osCommerces, PHPNuke and Smarty I try to avoid. The code always seems overly complicated and seperation of content is still terrible even with the template system.
The best thing to do is to try and find someone that has done a mod or translation of the software.
05-25-2004, 07:08 PM
PM User |
#10
New Coder
Join Date: May 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
unfortunately there not many there have used this mod, and there not realy any help so fare on the osCommerces forum.
And I also need to add a script there can calculate
I'm looking after a module there work simmuler to Products Price (Net): and Products Price (Gross): where if you write in one field another field change.
I need it fore Dimensional Weight = Length x Height x Width in cm
so when I can put in Weight xxx cm, Length xxx cm and Height xxx cm it automatik calculate the total volume
anyway thanks alot fore your help
05-26-2004, 05:09 AM
PM User |
#11
Super Moderator
Join Date: May 2002
Location: Perth Australia
Posts: 3,942
Thanks: 7
Thanked 82 Times in 81 Posts
Quote:
Originally Posted by carl_mcdade
...but templating systems like osCommerces, PHPNuke and Smarty I try to avoid. The code always seems overly complicated and seperation of content is still terrible even with the template system.
.. and often defeating the object of templating at the same time !
__________________
resistance is...
MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
Jump To Top of Thread
Thread Tools
Rate This Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT +1. The time now is 07:58 AM .
Advertisement
Log in to turn off these ads.