VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Quality & Testing VirtueMart 1.1.x => Virtuemart 1.1 Development (Archiv) => Q&T Resolved => Topic started by: El Fanjo on November 17, 2007, 14:20:58 PM

Title: [FIXED] Shop offline - Error in virtuemart.cfg.php
Post by: El Fanjo on November 17, 2007, 14:20:58 PM
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 (http://dev.virtuemart.net/cb/proj/tracker/itemDetails.do?task_id=1540)

System info:
xp sp2 with latest wamp.
Title: Re: [1540] Shop offline - Error in virtuemart.cfg.php
Post by: jenkinhill on November 17, 2007, 19:30:03 PM
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
Title: Re: [1540] Shop offline - Error in virtuemart.cfg.php
Post by: aravot on November 22, 2007, 03:55:32 AM
Fixed in SVN 1046