From c05c489a2b4b236748bc272da93b853a67eb423a Mon Sep 17 00:00:00 2001 From: philippe_mingo Date: Wed, 13 Feb 2002 12:40:57 +0000 Subject: [PATCH] Now check config.php before trying to write. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2428 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- plugins/administrator/options.php | 52 +++++++++++++++++-------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/plugins/administrator/options.php b/plugins/administrator/options.php index f9f06add..1a9baab4 100644 --- a/plugins/administrator/options.php +++ b/plugins/administrator/options.php @@ -484,46 +484,52 @@ echo " $v ) { + /* + fwrite( $fp, 'GLOBAL ' ); + $not_first = FALSE; + foreach ( $newcfg as $k => $v ) { if ( $k{0} == '$' ) { - if( $i = strpos( $k, '[' ) ) { + if( $i = strpos( $k, '[' ) ) { if( strpos( $k, '[0]' ) ) { - if( $not_first ) { + if( $not_first ) { fwrite( $fp, ', ' ); - } - fwrite( $fp, substr( $k, 0, $i) ); + } + fwrite( $fp, substr( $k, 0, $i) ); } - } else { + } else { if( $not_first ) { - fwrite( $fp, ', ' ); + fwrite( $fp, ', ' ); } fwrite( $fp, $k ); - } - $not_first = TRUE; + } + $not_first = TRUE; } -} -fwrite( $fp, ";\n" ); -*/ -foreach ( $newcfg as $k => $v ) { + } + fwrite( $fp, ";\n" ); + */ + foreach ( $newcfg as $k => $v ) { if ( $k{0} == '$' && $v <> '' ) { - if ( substr( $k, 1, 11 ) == 'ldap_server' ) { + if ( substr( $k, 1, 11 ) == 'ldap_server' ) { $v = substr( $v, 0, strlen( $v ) - 1 ) . "\n)"; $v = str_replace( 'array(', "array(\n\t", $v ); $v = str_replace( "',", "',\n\t", $v ); - } - fwrite( $fp, "$k = $v;\n" ); + } + fwrite( $fp, "$k = $v;\n" ); + } } + fwrite( $fp, '?>' ); + fclose( $fp ); +} else { + echo '
'. + _("Config file can't be opened. Please check config.php."). + '
'; } -fwrite( $fp, '?>' ); -fclose( $fp ); + ?> \ No newline at end of file -- 2.25.1