Escape theme name so it can be "Admin's Favourite" without parse errors in config.php
authorkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 1 May 2004 13:33:34 +0000 (13:33 +0000)
committerkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 1 May 2004 13:33:34 +0000 (13:33 +0000)
(closes #805309)

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@7335 7612ce4b-ef26-0410-bec9-ea0150e637f0

config/conf.pl

index 8ee43ff8631a375fb43b68aa7e62b4c751215f45..436388b8288c9de7da8b45f586e3865a4e1e07d0 100755 (executable)
@@ -171,6 +171,9 @@ while ( $line = <FILE> ) {
         $options[1] =~ s/[\'|\"];\s*$//;
         $options[1] =~ s/;$//;
         $options[1] =~ s/^[\'|\"]//;
+        # de-escape escaped strings
+        $options[1] =~ s/\\'/'/g;
+        $options[1] =~ s/\\\\/\\/g;
 
         if ( $options[0] =~ /^theme\[[0-9]+\]\[['|"]PATH['|"]\]/ ) {
             $sub = $options[0];
@@ -3155,7 +3158,11 @@ sub save_data {
 
         for ( $count = 0 ; $count <= $#theme_name ; $count++ ) {
             print CF "\$theme[$count]['PATH'] = " . &change_to_SM_path($theme_path[$count]) . ";\n";
-            print CF "\$theme[$count]['NAME'] = '$theme_name[$count]';\n";
+            # escape theme name so it can contain single quotes.
+            $esc_name =  $theme_name[$count];
+            $esc_name =~ s/\\/\\\\/g;
+            $esc_name =~ s/'/\\'/g;
+            print CF "\$theme[$count]['NAME'] = '$esc_name';\n";
         }
         print CF "\n";