Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_ST

Hey guys, hope you can help me out. I’m pulling my hair out trying to figure out what’s wrong here…Keep getting this error when I go to edit my UPS module:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘)’ in xxxxxxxxxxxxxxx(ignore the x’s)/public_html/catalog/admin/modules.php(212) : eval()'d code on line 1

[code]<?php
/*
$Id: modules.php,v 1.47 2003/06/29 22:50:52 hpdl Exp $

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

Copyright © 2003 osCommerce

Released under the GNU General Public License
*/

require(‘includes/application_top.php’);

$set = (isset($HTTP_GET_VARS[‘set’]) ? $HTTP_GET_VARS[‘set’] : ‘’);

if (tep_not_null($set)) {
switch ($set) {
case ‘shipping’:
$module_type = ‘shipping’;
$module_directory = DIR_FS_CATALOG_MODULES . ‘shipping/’;
$module_key = ‘MODULE_SHIPPING_INSTALLED’;
define(‘HEADING_TITLE’, HEADING_TITLE_MODULES_SHIPPING);
break;
case ‘ordertotal’:
$module_type = ‘order_total’;
$module_directory = DIR_FS_CATALOG_MODULES . ‘order_total/’;
$module_key = ‘MODULE_ORDER_TOTAL_INSTALLED’;
define(‘HEADING_TITLE’, HEADING_TITLE_MODULES_ORDER_TOTAL);
break;
case ‘payment’:
default:
$module_type = ‘payment’;
$module_directory = DIR_FS_CATALOG_MODULES . ‘payment/’;
$module_key = ‘MODULE_PAYMENT_INSTALLED’;
define(‘HEADING_TITLE’, HEADING_TITLE_MODULES_PAYMENT);
break;
}
}

$action = (isset($HTTP_GET_VARS[‘action’]) ? $HTTP_GET_VARS[‘action’] : ‘’);

if (tep_not_null($action)) {
switch ($action) {
case ‘save’:
while (list($key, $value) = each($HTTP_POST_VARS[‘configuration’])) {
tep_db_query(“update " . TABLE_CONFIGURATION . " set configuration_value = '” . $value . “’ where configuration_key = '” . $key . “’”);
}
tep_redirect(tep_href_link(FILENAME_MODULES, ‘set=’ . $set . ‘&module=’ . $HTTP_GET_VARS[‘module’]));
break;
case ‘install’:
case ‘remove’:
$file_extension = substr($PHP_SELF, strrpos($PHP_SELF, ‘.’));
$class = basename($HTTP_GET_VARS[‘module’]);
if (file_exists($module_directory . $class . $file_extension)) {
include($module_directory . $class . $file_extension);
$module = new $class;
if ($action == ‘install’) {
$module->install();
} elseif ($action == ‘remove’) {
$module->remove();
}
}
tep_redirect(tep_href_link(FILENAME_MODULES, ‘set=’ . $set . ‘&module=’ . $class));
break;
}
}
?>
<!doctype html public “-//W3C//DTD HTML 4.01 Transitional//EN”>

> <?php echo TITLE; ?> <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<?php echo HEADING_TITLE; ?> <?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?>
<?php $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.')); $directory_array = array(); if ($dir = @dir($module_directory)) { while ($file = $dir->read()) { if (!is_dir($module_directory . $file)) { if (substr($file, strrpos($file, '.')) == $file_extension) { $directory_array[] = $file; } } } sort($directory_array); $dir->close(); }

$installed_modules = array();
for ($i=0, $n=sizeof($directory_array); $i<$n; $i++) {
$file = $directory_array[$i];

include(DIR_FS_CATALOG_LANGUAGES . $language . '/modules/' . $module_type . '/' . $file);
include($module_directory . $file);

$class = substr($file, 0, strrpos($file, '.'));
if (tep_class_exists($class)) {
  $module = new $class;
  if ($module->check() > 0) {
    if ($module->sort_order > 0) {
      $installed_modules[$module->sort_order] = $file;
    } else {
      $installed_modules[] = $file;
    }
  }

  if ((!isset($HTTP_GET_VARS['module']) || (isset($HTTP_GET_VARS['module']) && ($HTTP_GET_VARS['module'] == $class))) && !isset($mInfo)) {
    $module_info = array('code' => $module->code,
                         'title' => $module->title,
                         'description' => $module->description,
                         'status' => $module->check());

    $module_keys = $module->keys();

    $keys_extra = array();
    for ($j=0, $k=sizeof($module_keys); $j<$k; $j++) {
      $key_value_query = tep_db_query("select configuration_title, configuration_value, configuration_description, use_function, set_function from " . TABLE_CONFIGURATION . " where configuration_key = '" . $module_keys[$j] . "'");
      $key_value = tep_db_fetch_array($key_value_query);

      $keys_extra[$module_keys[$j]]['title'] = $key_value['configuration_title'];
      $keys_extra[$module_keys[$j]]['value'] = $key_value['configuration_value'];
      $keys_extra[$module_keys[$j]]['description'] = $key_value['configuration_description'];
      $keys_extra[$module_keys[$j]]['use_function'] = $key_value['use_function'];
      $keys_extra[$module_keys[$j]]['set_function'] = $key_value['set_function'];
    }

    $module_info['keys'] = $keys_extra;

    $mInfo = new objectInfo($module_info);
  }

  if (isset($mInfo) && is_object($mInfo) && ($class == $mInfo->code) ) {
    if ($module->check() > 0) {
      echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class . '&action=edit') . ''">' . "n";
    } else {
      echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "n";
    }
  } else {
    echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class) . ''">' . "n";
  }

?>




<?php } } ksort($installed_modules); $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = '" . $module_key . "'"); if (tep_db_num_rows($check_query)) { $check = tep_db_fetch_array($check_query); if ($check['configuration_value'] != implode(';', $installed_modules)) { tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . implode(';', $installed_modules) . "', last_modified = now() where configuration_key = '" . $module_key . "'"); } } else { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Installed Modules', '" . $module_key . "', '" . implode(';', $installed_modules) . "', 'This is automatically updated. No need to edit.', '6', '0', now())"); } ?>
          <tr>
            <td colspan="3" class="smallText"><?php echo TEXT_MODULE_DIRECTORY . ' ' . $module_directory; ?></td>
          </tr>
        </table></td>
<?php $heading = array(); $contents = array(); switch ($action) { case 'edit': $keys = ''; reset($mInfo->keys); while (list($key, $value) = each($mInfo->keys)) { $keys .= '' . $value['title'] . '
' . $value['description'] . '
'; if ($value['set_function']) { eval('$keys .= ' . $value['set_function'] . "'" . $value['value'] . "', '" . $key . "');"); } else { $keys .= tep_draw_input_field('configuration[' . $key . ']', $value['value']); } $keys .= '

'; } $keys = substr($keys, 0, strrpos($keys, '

')); $heading[] = array('text' => '' . $mInfo->title . ''); $contents = array('form' => tep_draw_form('modules', FILENAME_MODULES, 'set=' . $set . '&module=' . $HTTP_GET_VARS['module'] . '&action=save')); $contents[] = array('text' => $keys); $contents[] = array('align' => 'center', 'text' => '
' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; default: $heading[] = array('text' => '' . $mInfo->title . ''); if ($mInfo->status == '1') { $keys = ''; reset($mInfo->keys); while (list(, $value) = each($mInfo->keys)) { $keys .= '' . $value['title'] . '
'; if ($value['use_function']) { $use_function = $value['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](); } $keys .= tep_call_function($class_method[1], $value['value'], ${$class_method[0]}); } else { $keys .= tep_call_function($use_function, $value['value']); } } else { $keys .= $value['value']; } $keys .= '

'; } $keys = substr($keys, 0, strrpos($keys, '

')); $contents[] = array('align' => 'center', 'text' => '' . tep_image_button('button_module_remove.gif', IMAGE_MODULE_REMOVE) . '' . tep_image_button('button_edit.gif', IMAGE_EDIT) . ''); $contents[] = array('text' => '
' . $mInfo->description); $contents[] = array('text' => '
' . $keys); } else { $contents[] = array('align' => 'center', 'text' => '' . tep_image_button('button_module_install.gif', IMAGE_MODULE_INSTALL) . ''); $contents[] = array('text' => '
' . $mInfo->description); } break; } if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { echo ' ' . "n"; } ?>
      </tr>
    </table></td>
  </tr>
</table></td>
<?php echo TABLE_HEADING_MODULES; ?> <?php echo TABLE_HEADING_SORT_ORDER; ?> <?php echo TABLE_HEADING_ACTION; ?> 
<?php echo $module->title; ?> <?php if (is_numeric($module->sort_order)) echo $module->sort_order; ?> <?php if (isset($mInfo) && is_object($mInfo) && ($class == $mInfo->code) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); } else { echo '' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . ''; } ?>  ' . "n"; $box = new box; echo $box->infoBox($heading, $contents); echo '
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> [/code]

I would look at the eval statement on line 212. It looks to me as though it is missing the left parenthese. You have the one within quotes for the right, but nothing in quotes for the left.

Not sure if this is the problem, but just thought I would point that out.

I’m a total newb at this, but where would that parentheses go exactly?

eval('$keys .= ' . $value['set_function'] . "'" . $value['value'] . "', '" . $key . "');");

Try:

eval(’($keys .= ’

Only guessing.

try
[php]eval(’$keys .= ’ . $value[‘set_function’] . “(’” . $value[‘value’] . “’, '” . $key . “’);”);[/php]

if not try:
[php]echo(’$keys .= ’ . $value[‘set_function’] . “’” . $value[‘value’] . “’, '” . $key . “’);”);[/php]
and post the result here.

The first way gave me about 10 of these errors: Parse error: syntax error, unexpected ‘,’ in public_html/catalog/admin/modules.php(212) : eval()'d code on line 1

The second way gave me $keys .= tep_cfg_select_option(array(‘True’, ‘False’),‘True’, ‘MODULE_SHIPPING_UPSXML_RATES_STATUS’);$keys .= tep_cfg_select_option(array(‘Daily Pickup’, ‘Customer Counter’, ‘One Time Pickup’, ‘On Call Air Pickup’, ‘Letter Center’, ‘Air Service Center’, ‘Suggested Retail Rates (UPS Store)’),‘Daily Pickup’, ‘MODULE_SHIPPING_UPSXML_RATES_PICKUP_METHOD’);$keys .= tep_cfg_select_option(array(‘Package’, ‘UPS Letter’, ‘UPS Tube’, ‘UPS Pak’, ‘UPS Express Box’, ‘UPS 25kg Box’, ‘UPS 10kg box’),‘Package’, ‘MODULE_SHIPPING_UPSXML_RATES_PACKAGE_TYPE’);$keys .= tep_cfg_select_option(array(‘01’, ‘03’, ‘04’),‘01’, ‘MODULE_SHIPPING_UPSXML_RATES_CUSTOMER_CLASSIFICATION_CODE’);$keys .= tep_cfg_select_option(array(‘US Origin’, ‘Canada Origin’, ‘European Union Origin’, ‘Puerto Rico Origin’, ‘Mexico Origin’, ‘All other origins’),‘US Origin’, ‘MODULE_SHIPPING_UPSXML_RATES_ORIGIN’);$keys .= tep_cfg_select_option(array(‘Test’, ‘Production’),‘Test’, ‘MODULE_SHIPPING_UPSXML_RATES_MODE’);$keys .= tep_cfg_select_option(array(‘LBS’, ‘KGS’),‘LBS’, ‘MODULE_SHIPPING_UPSXML_RATES_UNIT_WEIGHT’);$keys .= tep_cfg_select_option(array(‘IN’, ‘CM’),‘IN’, ‘MODULE_SHIPPING_UPSXML_RATES_UNIT_LENGTH’);$keys .= tep_cfg_select_option(array(‘No’, ‘Ready-to-ship only’, ‘With product dimensions’),‘No’, ‘MODULE_SHIPPING_UPSXML_DIMENSIONS_SUPPORT’);$keys .= tep_cfg_select_option(array(‘Commercial’, ‘Residential’),‘Commercial’, ‘MODULE_SHIPPING_UPSXML_RATES_QUOTE_TYPE’);$keys .= tep_cfg_select_option(array(‘True’, ‘False’),‘False’, ‘MODULE_SHIPPING_UPSXML_RATES_USE_NEGOTIATED_RATES’);$keys .= tep_cfg_select_option(array(‘Flat Fee’, ‘Percentage’),‘Flat Fee’, ‘MODULE_SHIPPING_UPSXML_HANDLING_TYPE’);$keys .= tep_cfg_select_option(array(‘True’, ‘False’),‘True’, ‘MODULE_SHIPPING_UPSXML_INSURE’);$keys .= tep_cfg_pull_down_tax_classes(‘0’, ‘MODULE_SHIPPING_UPSXML_RATES_TAX_CLASS’);$keys .= tep_cfg_pull_down_zone_classes(‘0’, ‘MODULE_SHIPPING_UPSXML_RATES_ZONE’);$keys .= tep_cfg_select_multioption(array(‘Next Day Air’, ‘2nd Day Air’, ‘Ground’, ‘Worldwide Express’, ‘Worldwide Express Plus’, ‘Worldwide Expedited’, ‘Express’, ‘Standard’, ‘3 Day Select’, ‘Next Day Air Saver’, ‘Next Day Air Early A.M.’, ‘Expedited’, ‘2nd Day A’’, ‘MODULE_SHIPPING_UPSXML_TYPES’);$keys .= tep_cfg_select_option(array(‘Yes’, ‘No’),‘Yes’, ‘MODULE_SHIPPING_UPSXML_EMAIL_ERRORS’);$keys .= tep_cfg_select_option(array(‘Yes’, ‘No’),‘No’, ‘MODULE_SHIPPING_UPSXML_RATES_TIME_IN_TRANSIT_DISPLAY’);$keys .= tep_cfg_select_option(array(‘Raw’, ‘Detailed’),‘Raw’, ‘MODULE_SHIPPING_UPSXML_RATES_TIME_IN_TRANSIT_VIEW’);

I tried a third way by replacing your “echo” with “eval” and it gave me:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘)’ in public_html/catalog/admin/modules.php(212) : eval()'d code on line 1

Tried that and it gives me about ten of these:

Parse error: syntax error, unexpected ‘;’ in /public_html/catalog/admin/modules.php(212) : eval()'d code on line 1

and one of these:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘)’ in public_html/catalog/admin/modules.php(212) : eval()'d code on line 1

we are getting closer to the problem: only one of there evals is producing an error.

as the error will always say line 1, i wasn’t able to find the right one.

could u put both (echo and eval) in the same file, and run it again?
[php]echo(’$keys .= ’ . $value[‘set_function’] . “’” . $value[‘value’] . “’, '” . $key . “’);”);
eval(’$keys .= ’ . $value[‘set_function’] . “’” . $value[‘value’] . “’, '” . $key . “’);”);[/php]

then we know that the one in front of the error is the one we have to take a closser look at.

I think I may have figured out what is causing the problem. I installed a UPS module and if I don’t do this step it says it will give me the error I am getting.

I’m trying to set up the dimensions and it says to:

[i]Modify your database tables using the install_upsxml.sql instructions.

This modification will create several new columns in the products table, as well as
create a whole new table to house the package definitions.[/i]

I haven’t a clue how to do that. I can do all of the other directions it lists but I think this is what is holding me up and causing the error I’m getting (according to the readme.txt file).

I can’t even read the install_upsxml.sql file. What program do I use to read it? Or is that a file I need to copy to the server and somehow run?

use notepad to read sql files What kind of a UPS module is this?

a .sql file is a textfile containing sql.

it can be opend with any text-editor e.g. notpad

what are u using to administrate ur database?

with PHPMyAdmin u just have to go to the sql-tab and then just copy and pased the code in there (or to the import-tab an choose the file)

hope this helps

Sponsor our Newsletter | Privacy Policy | Terms of Service