diff options
author | Brice Maron <brice@bmaron.net> | 2012-06-22 12:44:17 +0200 |
---|---|---|
committer | Brice Maron <brice@bmaron.net> | 2012-06-22 12:46:21 +0200 |
commit | 72fe463f7f20ee23521666cdca4141dc584ec722 (patch) | |
tree | 18ab5daaf0c622fe75cfce9803ab1d6850b3fbc5 /lib/config.php | |
parent | bef9b671ee6beb36a0f10ac755b32477ef5f77e6 (diff) | |
download | nextcloud-server-72fe463f7f20ee23521666cdca4141dc584ec722.tar.gz nextcloud-server-72fe463f7f20ee23521666cdca4141dc584ec722.zip |
Correct OC_Config writer. Use var_export (has support for array,...)
Diffstat (limited to 'lib/config.php')
-rw-r--r-- | lib/config.php | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/lib/config.php b/lib/config.php index 9279549b1bb..65f9fdc06ba 100644 --- a/lib/config.php +++ b/lib/config.php @@ -152,23 +152,12 @@ class OC_Config{ * * Saves the config to the config file. * - * Known flaws: Strings are not escaped properly */ public static function writeData(){ // Create a php file ... - $content = "<?php\n\$CONFIG = array(\n"; - - foreach( self::$cache as $key => $value ){ - if( is_bool( $value )){ - $value = $value ? 'true' : 'false'; - $content .= "\"$key\" => $value,\n"; - } - else{ - $value = str_replace( "'", "\\'", $value ); - $content .= "\"$key\" => '$value',\n"; - } - } - $content .= ");\n?>\n"; + $content = "<?php\n\$CONFIG = "; + $content .= var_export(self::$cache, true); + $content .= ";\n?>\n"; $filename = OC::$SERVERROOT."/config/config.php"; // Write the file |