$j + 1 && $line{$j}.$line{$j+1} == '*/' ) { $mode = ''; $j++; } break; case 'D': // Delimiter detect switch ( $line{$j} ) { case '"': case "'": // Double quote string $delimiter = $value = $line{$j}; $mode = 'S'; break; case ' ': // Nothing yet break; default: if ( strtoupper( substr( $line, $j, 4 ) ) == 'TRUE' ) { // Boolean TRUE $newcfg{$key} = 'TRUE'; $key = ''; $mode = ';'; } else if ( strtoupper( substr( $line, $j, 5 ) ) == 'FALSE' ) { $newcfg{$key} = 'FALSE'; $key = ''; $mode = ';'; } else { // Number or function call $mode = 'N'; $value = $line{$j}; } } break; default: if ( $line{$j} == '$' ) { // We must detect $key name $mode = 'K'; $key = '$'; } else if ( $s < $j + 2 ) { } else if ( strtoupper( substr( $line, $j, 7 ) ) == 'GLOBAL ' ) { // Skip untill next ; $mode = ';'; $j += 6; } else if ( $line{$j}.$line{$j+1} == '/*' ) { $mode = 'C'; $j++; } else if ( $line{$j} == '#' || $line{$j}.$line{$j+1} == '//' ) { // Delete till the end of the line $j = $s; } } } } } /* ---------------------- main -------------------------- */ chdir('..'); chdir('..'); define('SM_PATH','../'); /* SquirrelMail required files. */ require_once(SM_PATH . 'include/validate.php'); require_once(SM_PATH . 'functions/page_header.php'); require_once(SM_PATH . 'functions/imap.php'); require_once(SM_PATH . 'include/load_prefs.php'); require_once(SM_PATH . 'plugins/administrator/defines.php'); require_once(SM_PATH . 'plugins/administrator/auth.php'); GLOBAL $data_dir, $username; if ( !adm_check_user() ) { header("Location: ../../src/options.php") ; exit; } displayPageHeader($color, 'None'); $newcfg = array( ); foreach ( $defcfg as $key => $def ) { $newcfg[$key] = ''; } $cfgfile = '../config/config.php'; parseConfig( '../config/config_default.php' ); parseConfig( $cfgfile ); $colapse = array( 'Titles' => 'off', 'Group1' => getPref($data_dir, $username, 'adm_Group1', 'off' ), 'Group2' => getPref($data_dir, $username, 'adm_Group2', 'on' ), 'Group3' => getPref($data_dir, $username, 'adm_Group3', 'on' ), 'Group4' => getPref($data_dir, $username, 'adm_Group4', 'on' ), 'Group5' => getPref($data_dir, $username, 'adm_Group5', 'on' ), 'Group6' => getPref($data_dir, $username, 'adm_Group6', 'on' ), 'Group7' => getPref($data_dir, $username, 'adm_Group7', 'on' ), 'Group8' => getPref($data_dir, $username, 'adm_Group8', 'on' ) ); if ( isset( $switch ) ) { if ( $colapse[$switch] == 'on' ) { $colapse[$switch] = 'off'; } else { $colapse[$switch] = 'on'; } setPref($data_dir, $username, "adm_$switch", $colapse[$switch] ); } echo "
'; /* Write the options to the file. */ if( $fp = @fopen( $cfgfile, 'w' ) ) { fwrite( $fp, " $v ) { if ( $k{0} == '$' && $v <> '' ) { 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, '?>' ); fclose( $fp ); } else { echo '