News:

Looking for documentation? Take a look on our wiki

Main Menu

[FIXED] Shop offline - Error in virtuemart.cfg.php

Started by El Fanjo, November 17, 2007, 14:20:58 PM

Previous topic - Next topic

El Fanjo

Here is the bug I found, it happens all the time I save the config.

Description:
This bug happens when I  modify virtuemart's configuration in Joomla back-end to change the off-line message (and put the shop offline obviously). Every single quote ( ' ) of the offline message is saved as " //' " in virtuemart.cfg.php (around line 57) instead of " /' " . This is not a biggy but can be quite anoying for the non-programmer as an error message is displayed in front/back ends instead off the desired offline message.

VirtueMart Version:
VirtueMart 1.1.0

Joomla/Mambo Version:
Joomla 1.5 RC3 legacy mode (fresh install, only VM component is installed)

Steps to replicate:
simply put the shop offline with one or several ' in your offline message, save and try to access VM in front or back end. You will soon see what I am talking about ;o)

Proposed fix(es):
in ps_config line 65 single quote are escaped with addslashes function :
$d['conf_PSHOP_OFFLINE_MESSAGE'] = addslashes( vmGet($d, 'conf_PSHOP_OFFLINE_MESSAGE' ));
then in line 215 the whole config file is looped and single quotes are escaped again :
$config .= "define('ENCODE_KEY', '".str_replace('\'', "\'", $encode_key )."');\n";

removing addslashes in line 65 fix the bug :
$d['conf_PSHOP_OFFLINE_MESSAGE'] = vmGet($d, 'conf_PSHOP_OFFLINE_MESSAGE' );

Bugtracker task 1540:
http://dev.virtuemart.net/cb/proj/tracker/itemDetails.do?task_id=1540

System info:
xp sp2 with latest wamp.

jenkinhill

Confirmed. Error message:

Parse error: syntax error, unexpected T_FOR in /var/www/html/joomla3/administrator/components/com_virtuemart/virtuemart.cfg.php on line 53

When entering a ' after "down" virtuemart.cfg.php line 53 reads:

define('PSHOP_OFFLINE_MESSAGE', 'Our Shop is currently down\\' for maintenance. Please check back again soon.');

Database Version: 4.1.22
PHP Version: 4.4.4
Web Server: Apache
VirtueMart 1.1: Ver. 1037
Joomla! Version: Joomla! 1.5 Beta3+ Rev 9328 9 November
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum