define('SMOPT_TYPE_BOOLEAN', 5);
define('SMOPT_TYPE_HIDDEN', 6);
define('SMOPT_TYPE_COMMENT', 7);
+define('SMOPT_TYPE_TITLE', 128);
/* Define constants for the options refresh levels. */
define('SMOPT_REFRESH_NONE', 0);
}
asort( $language_values );
-$namcfg = array( '$config_version' => array( 'name' => _("Config File Version"),
- 'type' => 'string',
+$defcfg = array( '$config_version' => array( 'name' => _("Config File Version"),
+ 'type' => SMOPT_TYPE_COMMENT,
'size' => 7 ),
- '$org_logo' => array( 'name' => _("Organization Logo"),
+ /* --------------------------------------------------------*/
+ 'Group1' => array( 'name' => _("Organization Preferences"),
+ 'type' => SMOPT_TYPE_TITLE ),
+ '$org_name' => array( 'name' => _("Organization Name"),
'type' => SMOPT_TYPE_STRING,
'size' => 40 ),
- '$org_name' => array( 'name' => _("Organization Name"),
+ '$org_logo' => array( 'name' => _("Organization Logo"),
'type' => SMOPT_TYPE_STRING,
'size' => 40 ),
- '$org_title' => array( 'name' => _("Organization Name"),
+ '$org_title' => array( 'name' => _("Organization Title"),
'type' => SMOPT_TYPE_STRING,
'size' => 40 ),
+ '$signout_page' => array( 'name' => _("Signout Page"),
+ 'type' => SMOPT_TYPE_STRING,
+ 'size' => 40 ),
'$squirrelmail_default_language' => array( 'name' => _("Default Language"),
'type' => SMOPT_TYPE_STRLIST,
'size' => 7,
'posvals' => $language_values ),
+ /* --------------------------------------------------------*/
+ 'Group2' => array( 'name' => _("Server Settings"),
+ 'type' => SMOPT_TYPE_TITLE ),
+ '$domain' => array( 'name' => _("Mail Domain"),
+ 'type' => SMOPT_TYPE_STRING,
+ 'size' => 40 ),
'$imapServerAddress' => array( 'name' => _("IMAP Server Address"),
'type' => SMOPT_TYPE_STRING,
'size' => 40 ),
'$imapPort' => array( 'name' => _("IMAP Server Port"),
'type' => SMOPT_TYPE_INTEGER ),
- '$domain' => array( 'name' => _("Mail Domain"),
- 'type' => SMOPT_TYPE_STRING,
- 'size' => 40 ),
+ '$imap_server_type' => array( 'name' => _("IMAP Server Type"),
+ 'type' => SMOPT_TYPE_STRLIST,
+ 'size' => 7,
+ 'posvals' => array( 'cyrus' => _("Cyrus IMAP server"),
+ 'uw' => _("University of Washington's IMAP server"),
+ 'exchange' => _("Microsoft Exchange IMAP server"),
+ 'courier' => _("Courier IMAP server"),
+ 'other' => _("Not one of the above servers") ) ),
+ '$optional_delimiter' => array( 'name' => _("IMAP Folder Delimiter"),
+ 'type' => SMOPT_TYPE_STRING,
+ 'size' => 2 ),
+ '$useSendmail' => array( 'name' => _("Use Sendmail"),
+ 'type' => SMOPT_TYPE_BOOLEAN ),
'$smtpServerAddress' => array( 'name' => _("SMTP Server Address"),
'type' => SMOPT_TYPE_STRING,
'size' => 40 ),
'$smtpPort' => array( 'name' => _("SMTP Server Port"),
'type' => SMOPT_TYPE_INTEGER ),
+ '$use_authenticated_smtp' => array( 'name' => _("Authenticated SMTP"),
+ 'type' => SMOPT_TYPE_BOOLEAN ),
+ '$invert_time' => array( 'name' => _("Invert Time"),
+ 'type' => SMOPT_TYPE_BOOLEAN ),
+ /* --------------------------------------------------------*/
+ 'Group3' => array( 'name' => _("Folders Defaults"),
+ 'type' => SMOPT_TYPE_TITLE ),
'$motd' => array( 'name' => _("Message of the Day"),
'type' => SMOPT_TYPE_STRING,
'size' => 40 ),
+
);
?>
\ No newline at end of file
$cfgfile = '../config/config.php';
$cfg_defaultfile = '../config/config_default.php';
$cfg = file( $cfg_defaultfile );
-$newcfg = $defcfg = array( );
+$newcfg = $dfncfg = array( );
$cm = FALSE;
+
+foreach ( $defcfg as $key => $def ) {
+ $newcfg[$key] = '';
+}
+
foreach ( $cfg as $l ) {
+ // Remove inline /* */ Blocks
$l = preg_replace( '/\/\*.*\*\//', '', $l );
$l = preg_replace( '/#.*$/', '', $l );
$l = preg_replace( '/\/\/.*$/', '', $l );
$key = trim( substr( $v, 0, $i - 1 ) );
$val = str_replace( ';', '', trim( substr( $v, $i + 1 ) ) );
$newcfg[$key] = $val;
- $defcfg[$key] = $val;
+ $dfncfg[$key] = $val;
}
}
$cfg = file( $cfgfile );
-asort( $cfg );
$cm = FALSE;
foreach ( $cfg as $l ) {
}
echo "<form action=$PHP_SELF method=post>" .
- '<table width=100%>' ,
+ "<br><center><table width=95% bgcolor=\"$color[5]\"><tr><td>".
+ "<table width=100% cellspacing=0 bgcolor=\"$color[4]\">" ,
"<tr bgcolor=\"$color[5]\"><th colspan=2>" . _("Configuration Administrator") . "</th></tr>";
foreach ( $newcfg as $k => $v ) {
$l = strtolower( $v );
$e = 'adm_' . $n;
$name = $k;
$size = 50;
- if ( isset( $namcfg[$k] ) ) {
- $name = $namcfg[$k]['name'];
- $type = $namcfg[$k]['type'];
- $size = $namcfg[$k]['size'];
+ if ( isset( $defcfg[$k] ) ) {
+ $name = $defcfg[$k]['name'];
+ $type = $defcfg[$k]['type'];
+ $size = $defcfg[$k]['size'];
} else if ( $l == 'true' ) {
$v = 'TRUE';
$type = SMOPT_TYPE_BOOLEAN;
$type = SMOPT_TYPE_STRING;
}
- echo "<tr><td>$name</td><td>";
-
switch ( $type ) {
+ case SMOPT_TYPE_TITLE:
+ echo "<tr bgcolor=\"$color[5]\"><th colspan=2>$name</th></tr>";
+ break;
+ case SMOPT_TYPE_COMMENT:
+ $v = substr( $v, 1, strlen( $v ) - 2 );
+ echo "<tr><td>$name</td><td>";
+ echo "<b>$v</b>";
+ $newcfg[$k] = "'$v'";
+ break;
case SMOPT_TYPE_INTEGER:
if ( isset( $HTTP_POST_VARS[$e] ) ) {
$v = intval( $HTTP_POST_VARS[$e] );
$newcfg[$k] = $v;
}
+ echo "<tr><td>$name</td><td>";
echo "<input size=10 name=\"adm_$n\" value=\"$v\">";
break;
case SMOPT_TYPE_STRLIST:
$v = '"' . $HTTP_POST_VARS[$e] . '"';
$newcfg[$k] = $v;
}
+ echo "<tr><td>$name</td><td>";
echo "<select name=\"adm_$n\">";
- foreach ( $namcfg[$k]['posvals'] as $kp => $vp ) {
+ foreach ( $defcfg[$k]['posvals'] as $kp => $vp ) {
echo "<option value=\"$kp\"";
if ( $kp == substr( $v, 1, strlen( $v ) - 2 ) ) {
echo ' selected';
$v = '"' . $HTTP_POST_VARS[$e] . '"';
$newcfg[$k] = $v;
}
+ echo "<tr><td>$name</td><td>";
echo "<input size=\"$size\" name=\"adm_$n\" value=\"" . substr( $v, 1, strlen( $v ) - 2 ) . "\">";
break;
case SMOPT_TYPE_BOOLEAN:
$ct = '';
$cf = ' checked';
}
+ echo "<tr><td>$name</td><td>";
echo "<INPUT$ct type=radio NAME=\"adm_$n\" value=\"TRUE\">" . _("Yes") .
"<INPUT$cf type=radio NAME=\"adm_$n\" value=\"FALSE\">" . _("No");
break;
default:
+ echo "<tr><td>$name</td><td>";
echo "<b><i>$v</i></b>";
}
echo "</td></tr>\n";
}
echo "<tr bgcolor=\"$color[5]\"><th colspan=2><input value=\"" .
_("Change Settings") . "\" type=submit></th></tr>" ,
- '</table></form>';
+ '</table></td></tr></table></form>';
/*
Write the options to the file.
fwrite( $fp, 'GLOBAL ' );
$not_first = FALSE;
foreach ( $newcfg as $k => $v ) {
- if( $i = strpos( $k, '[' ) ) {
- if( strpos( $k, '[0]' ) ) {
+ if ( $k{0} == '$' ) {
+ if( $i = strpos( $k, '[' ) ) {
+ if( strpos( $k, '[0]' ) ) {
+ if( $not_first ) {
+ fwrite( $fp, ', ' );
+ }
+ fwrite( $fp, substr( $k, 0, $i) );
+ $not_first = TRUE;
+ }
+ } else {
if( $not_first ) {
fwrite( $fp, ', ' );
}
- fwrite( $fp, substr( $k, 0, $i) );
+ fwrite( $fp, $k );
$not_first = TRUE;
}
- } else {
- if( $not_first ) {
- fwrite( $fp, ', ' );
- }
- fwrite( $fp, $k );
- $not_first = TRUE;
}
}
fwrite( $fp, ";\n" );
foreach ( $newcfg as $k => $v ) {
- fwrite( $fp, "$k = $v;\n" );
+ if ( $k{0} == '$' ) {
+ fwrite( $fp, "$k = $v;\n" );
+ }
}
fwrite( $fp, '?>' );
fclose( $fp );