[pLog-svn] r3804 - plog/trunk/class/config
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Wed Jul 26 03:48:10 GMT 2006
Author: jondaley
Date: 2006-07-26 03:48:08 +0000 (Wed, 26 Jul 2006)
New Revision: 3804
Modified:
plog/trunk/class/config/configfilestorage.class.php
Log:
fixes problem with the single and double quotes. configfilestorage can now handle either. I thought about writing a test case for this, but I think it is significantly hard -- to have a test case that makes different config files, and then overwrites them and checks to see if the data is valid, etc.
Modified: plog/trunk/class/config/configfilestorage.class.php
===================================================================
--- plog/trunk/class/config/configfilestorage.class.php 2006-07-25 18:21:17 UTC (rev 3803)
+++ plog/trunk/class/config/configfilestorage.class.php 2006-07-26 03:48:08 UTC (rev 3804)
@@ -89,12 +89,12 @@
#
# database settings
#
- $config["db_host"] = "";
- $config["db_username"] = "";
- $config["db_password"] = "";
- $config["db_database"] = "";
- $config["db_character_set"] = "default";
- $config["db_persistent"] = true;
+ $config[\'db_host\'] = \'\';
+ $config[\'db_username\'] = \'\';
+ $config[\'db_password\'] = \'\';
+ $config[\'db_database\'] = \'\';
+ $config[\'db_character_set\'] = \'default\';
+ $config[\'db_persistent\'] = true;
#
# the database prefix will be appended to the name of each database tables in case you want
# to have more than one version of plog running at the same time, such as the stable and
@@ -102,7 +102,7 @@
# coexist in the same unique database. If you change this after the initial configuration done
# with the installation wizard, please make sure that you also rename the tables.
#
- $config["db_prefix"] = "";
+ $config[\'db_prefix\'] = \'\';
?>';
include_once( PLOG_CLASS_PATH."class/file/file.class.php" );
@@ -149,7 +149,7 @@
$dataString = "false";
}
elseif( $this->_getType( $data ) == TYPE_STRING ) {
- $dataString = "\"$data\"";
+ $dataString = "'".$data."'";
}
elseif( $this->_getType( $data ) == TYPE_ARRAY ) {
// arrays can be recursive, so...
@@ -158,7 +158,7 @@
if( $key != "" ) {
if( !is_numeric($key)) {
- $dataString .= "\"$key\" => ";
+ $dataString .= "'".$key."' => ";
}
}
@@ -169,7 +169,7 @@
else
$dataString .= ")";
- print("dataString = ".$dataString."<br/>");
+ // print("dataString = ".$dataString."<br/>");
}
elseif( $this->_getType( $data ) == TYPE_OBJECT ) {
$dataString = serialize( $data );
@@ -210,12 +210,12 @@
// depending if it's a string or not, we need a different regexp and a
// expression that will replace the original
if( $this->_getType( $value ) == TYPE_STRING ) {
- $regexp = "/ *\\\$config\[\"$name\"\] *= *\"(.*)\"; */";
- $replaceWith = "\$config[\"$name\"] = $valueString;";
+ $regexp = "/ *\\\$config\[[\"']".$name."[\"']\] *= *[\"'](.*)[\"']; */";
+ $replaceWith = "\$config['".$name."'] = ".$valueString.";";
}
else {
- $regexp = "/ *\\\$config\[\"$name\"\] *= *(.*); */";
- $replaceWith = "\$config[\"$name\"] = $valueString;";
+ $regexp = "/ *\\\$config\[[\"']".$name."[\"']\] *= *(.*); */";
+ $replaceWith = "\$config['".$name."'] = ".$valueString.";";
}
while( $i < count($contents)) {
@@ -277,7 +277,7 @@
function save()
{
foreach( $this->_props->getAsArray() as $key => $value ) {
- print("saving: $key - ".htmlspecialchars($value)."<br/>");
+ //print("saving: $key - ".htmlspecialchars($value)."<br/>");
$this->saveValue( $key, $value );
}
More information about the pLog-svn
mailing list