/** returns the value for the pref $string **/
- function getPref($data_dir, $username, $string) {
+ function getPref($data_dir, $username, $string, $default ) {
$db = new dbPrefs;
if(isset($db->error)) {
printf(_("Preference database error (%s). Exiting abnormally"),
session_register("theme_css");
global $use_javascript_addr_book;
- $use_javascript_addr_book = getPref($data_dir, $username, "use_javascript_addr_book");
- if ($use_javascript_addr_book == "")
- $use_javascript_addr_book = $default_use_javascript_addr_book;
+ $use_javascript_addr_book = getPref($data_dir, $username, 'use_javascript_addr_book', $default_use_javascript_addr_book);
-
/** Load the user's sent folder preferences **/
global $move_to_sent, $move_to_trash;
- $move_to_sent = getPref($data_dir, $username, "move_to_sent");
- if ($move_to_sent == "")
- $move_to_sent = $default_move_to_sent;
+ $move_to_sent = getPref($data_dir, $username, 'move_to_sent', $default_move_to_sent);
/** Load the user's trash folder preferences **/
- $move_to_trash = getPref($data_dir, $username, "move_to_trash");
- if ($move_to_trash == "")
- $move_to_trash = $default_move_to_trash;
-
+ $move_to_trash = getPref($data_dir, $username, 'move_to_trash', $default_move_to_trash);
global $unseen_type, $unseen_notify;
- $unseen_type = getPref($data_dir, $username, "unseen_type");
- if ($default_unseen_type == "")
+ if ($default_unseen_type == '')
$default_unseen_type = 1;
- if ($unseen_type == "")
- $unseen_type = $default_unseen_type;
-
- $unseen_notify = getPref($data_dir, $username, "unseen_notify");
- if ($default_unseen_notify == "")
+ $unseen_type = getPref($data_dir, $username, 'unseen_type', $default_unseen_type);
+ if ($default_unseen_notify == '')
$default_unseen_notify = 2;
- if ($unseen_notify == "")
- $unseen_notify = $default_unseen_notify;
-
+ $unseen_notify = getPref($data_dir, $username, 'unseen_notify', $default_unseen_notify);
global $folder_prefix;
- $folder_prefix = getPref($data_dir, $username, "folder_prefix");
- if ($folder_prefix == "") {
- $folder_prefix = $default_folder_prefix;
- }
+ $folder_prefix = getPref($data_dir, $username, 'folder_prefix', $default_folder_prefix);
/** Load special folders **/
global $trash_folder, $sent_folder;
- $new_trash_folder = getPref($data_dir, $username, "trash_folder");
- if (($new_trash_folder == "") && ($move_to_trash == true)) {
+ $new_trash_folder = getPref($data_dir, $username, 'trash_folder');
+ if ( ( $new_trash_folder == '' ) && ( $move_to_trash ) ) {
$trash_folder = $folder_prefix . $trash_folder;
} else {
$trash_folder = $new_trash_folder;
}
/** Load special folders **/
- $new_sent_folder = getPref($data_dir, $username, "sent_folder");
- if (($new_sent_folder == "") && ($move_to_sent == true)) {
+ $new_sent_folder = getPref($data_dir, $username, 'sent_folder');
+ if ( ( $new_sent_folder == '' ) && ( $move_to_sent ) ) {
$sent_folder = $folder_prefix . $sent_folder;
} else {
$sent_folder = $new_sent_folder;
}
global $show_num, $wrap_at, $left_size;
- $show_num = getPref($data_dir, $username, "show_num");
- if ($show_num == "") {
- $show_num = 25;
- }
-
- $wrap_at = getPref($data_dir, $username, "wrap_at");
- if ($wrap_at == "") {
- $wrap_at = 86;
- } else if ($wrap_at < 15) {
+ $show_num = getPref($data_dir, $username, 'show_num', 15 );
+
+ $wrap_at = getPref( $data_dir, $username, 'wrap_at', 86 );
+ if ($wrap_at < 15) {
$wrap_at = 15;
}
- $left_size = getPref($data_dir, $username, "left_size");
+ $left_size = getPref($data_dir, $username, 'left_size');
if ($left_size == "") {
if (isset($default_left_size)) {
$left_size = $default_left_size;
}
global $editor_size, $use_signature, $prefix_sig;
- $editor_size = getPref($data_dir, $username, "editor_size");
- if ($editor_size == "") {
- $editor_size = 76;
- }
+ $editor_size = getPref($data_dir, $username, "editor_size", 76 );
-
- $use_signature = getPref($data_dir, $username, "use_signature");
- if ($use_signature == "") {
- $use_signature = false;
- }
+ $use_signature = getPref($data_dir, $username, 'use_signature', FALSE );
$prefix_sig = getPref($data_dir, $username, "prefix_sig");
/* Load preferences for reply citation style. */
global $reply_citation_style, $reply_citation_start, $reply_citation_end;
- $reply_citation_style = getPref($data_dir, $username, 'reply_citation_style');
- if ($reply_citation_style == '') {
- $reply_citation_style = 'none';
- }
+ $reply_citation_style = getPref($data_dir, $username, 'reply_citation_style', 'none' );
$reply_citation_start = getPref($data_dir, $username, 'reply_citation_start');
$reply_citation_end = getPref($data_dir, $username, 'reply_citation_end');
global $left_refresh, $sort;
- $left_refresh = getPref($data_dir, $username, "left_refresh");
- if ($left_refresh == "") {
- $left_refresh = false;
- }
+ $left_refresh = getPref($data_dir, $username, 'left_refresh', 'None' );
+ $sort = getPref($data_dir, $username, 'sort', 6 );
- $sort = getPref($data_dir, $username, "sort");
- if ($sort == "") {
- $sort = 6;
- }
-
/** Load up the Signature file **/
global $signature_abs;
- if ($use_signature == true) {
+ if ($use_signature) {
$signature_abs = $signature = getSig($data_dir, $username);
} else {
$signature_abs = getSig($data_dir, $username);
global $message_highlight_list;
for ($i=0; $hlt = getPref($data_dir, $username, "highlight$i"); $i++) {
$ary = explode(",", $hlt);
- $message_highlight_list[$i]["name"] = $ary[0];
- $message_highlight_list[$i]["color"] = $ary[1];
- $message_highlight_list[$i]["value"] = $ary[2];
- $message_highlight_list[$i]["match_type"] = $ary[3];
+ $message_highlight_list[$i]['name'] = $ary[0];
+ $message_highlight_list[$i]['color'] = $ary[1];
+ $message_highlight_list[$i]['value'] = $ary[2];
+ $message_highlight_list[$i]['match_type'] = $ary[3];
}
#index order lets you change the order of the message index
global $index_order;
- $order = getPref($data_dir, $username, "order1");
+ $order = getPref($data_dir, $username, 'order1');
for ($i=1; $order; $i++) {
$index_order[$i] = $order;
- $order = getPref($data_dir, $username, "order".($i+1));
+ $order = getPref($data_dir, $username, 'order'.($i+1));
}
if (!isset($index_order)) {
$index_order[1] = 1;
$index_order[4] = 5;
$index_order[5] = 4;
}
-
+
global $alt_index_colors;
- $alt_index_colors = getPref($data_dir, $username, 'alt_index_colors');
- if ($alt_index_colors == 0) {
- $alt_index_colors = false;
- } else {
- $alt_index_colors = true;
- }
-
+ $alt_index_colors = getPref($data_dir, $username, 'alt_index_colors', FALSE );
+
global $location_of_bar, $location_of_buttons;
- $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
- if ($location_of_bar == '')
- $location_of_bar = 'left';
-
- $location_of_buttons = getPref($data_dir, $username, 'location_of_buttons');
- if ($location_of_buttons == '') {
- $location_of_buttons = 'between';
- }
-
+ $location_of_bar = getPref($data_dir, $username, 'location_of_bar', 'left');
+ $location_of_buttons = getPref($data_dir, $username, 'location_of_buttons', 'between' );
+
global $collapse_folders, $show_html_default;
$collapse_folders = getPref($data_dir, $username, 'collapse_folders');
-
- // show_html_default is a int value
- $show_html_default = intval(getPref($data_dir, $username, 'show_html_default'));
+
+ // show_html_default is a int value
+ $show_html_default = intval(getPref($data_dir, $username, 'show_html_default'), 1 );
do_hook("loading_prefs");
-?>
+?>
\ No newline at end of file
require_once('../functions/imap.php');
require_once('../functions/array.php');
require_once('../functions/plugin.php');
-
+ require_once('../functions/options.php');
+
displayPageHeader($color, 'None');
- $chosen_language = getPref($data_dir, $username, 'language');
+ $chosen_language = getPref($data_dir, $username, 'language');
?>
<br>
<table width="95%" align="center" border="0" cellpadding="2" cellspacing="0">
<form name="f" action="options.php" method="post"><br>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
- <tr>
- <td align="right" nowrap><?php echo _("Theme"); ?>:
- </td><td>
-<?php
- echo ' <tt><select name="chosentheme">' . "\n";
- for ($i = 0; $i < count($theme); $i++) {
- if ($theme[$i]['PATH'] == $chosen_theme)
- echo ' <option selected value="'.$theme[$i]['PATH'].'">'.$theme[$i]['NAME']."\n";
- else
- echo ' <option value="'.$theme[$i]['PATH'].'">'.$theme[$i]['NAME']."\n";
- }
- echo ' </select></tt>';
-?>
- </td>
- </tr>
- <tr>
- <td align="right" nowrap><?php echo _("Language"); ?>:
- </td><td>
-<?php
- echo ' <tt><select name="language">' . "\n";
- foreach ($languages as $code => $name) {
- if (! isset($name['ALIAS'])) {
- if ($code==$chosen_language)
- echo ' <OPTION SELECTED VALUE="'.$code.'">'.$name['NAME']."\n";
- else
- echo ' <OPTION VALUE="'.$code.'">'.$name['NAME']."\n";
- }
- }
- echo ' </select></tt>';
- if (! $use_gettext)
- echo '<br><small>This system doesn\'t support multiple languages</small>';
-
-?>
- </td>
- <tr>
- <td align=right nowrap>
- <?php echo _("Use Javascript or HTML addressbook?") . '</td><td>';
- if ($use_javascript_addr_book == true) {
- echo ' <input type="radio" name="javascript_abook" value="1" checked> ' . _("JavaScript") . ' ';
- echo ' <input type="radio" name="javascript_abook" value="0"> ' . _("HTML");
- } else {
- echo ' <input type="radio" name="javascript_abook" value="1"> ' . _("JavaScript") . ' ';
- echo ' <input type="radio" name="javascript_abook" value="0" checked> ' . _("HTML");
- }
- ?>
- </td>
- </tr>
- <tr>
- <td align=right nowrap><?php echo _("Number of Messages to Index"); ?>:
- </td><td>
-<?php
- if (isset($show_num))
- echo ' <tt><input type="text" size="5" name="shownum" value="'.$show_num.'"></tt><br>';
- else
- echo ' <tt><input type="text" size="5" name="shownum" value="25"></tt><br>';
-?>
- </td>
- </tr>
- <tr>
- <td align="right" nowrap><?php echo _("Wrap incoming text at"); ?>:
- </td><td>
-<?php
- if (isset($wrap_at))
- echo ' <tt><input type="text" size="5" name="wrapat" value="'.$wrap_at.'"></tt><br>';
- else
- echo ' <tt><input type="tex" size="5" name="wrapat" value="86"></tt><br>';
-?>
- </td>
- </tr>
- <tr>
- <td align="right" nowrap><?php echo _("Size of editor window"); ?>:
- </td><td>
-<?php
- if ($editor_size >= 10 && $editor_size <= 255)
- echo ' <tt><input type="text" size="5" name="editorsize" value="'.$editor_size.'"></tt><br>';
- else
- echo ' <tt><input type="text" size="5" name="editorsize" value="76"></tt><br>';
-?>
- </td>
- </tr>
- <tr>
- <td align="right" nowrap><?PHP echo _("Location of buttons when composing") ?>:</td>
- <td><select name="button_new_location">
- <option value="top"<?PHP
- if ($location_of_buttons == 'top') echo ' SELECTED';
- ?>><?PHP echo _("Before headers"); ?></option>
- <option value="between"<?PHP
- if ($location_of_buttons == 'between') echo ' SELECTED';
- ?>><?PHP echo _("Between headers and message body"); ?></option>
- <option value="bottom"<?PHP
- if ($location_of_buttons == 'bottom') echo ' SELECTED';
- ?>><?PHP echo _("After message body"); ?></option>
- </select>
- </td>
- </tr>
- <tr>
- <td align="right" nowrap><?PHP echo _("Location of folder list") ?>:</td>
- <td><select name="folder_new_location">
- <option value="left"<?PHP
- if ($location_of_bar != 'right') echo ' SELECTED';
- ?>><?PHP echo _("Left"); ?></option>
- <option value="right"<?PHP
- if ($location_of_bar == 'right') echo ' SELECTED';
- ?>><?PHP echo _("Right"); ?></option>
- </select>
- </td>
- </tr>
- <tr>
- <td align=right nowrap><?php echo _("Width of folder list"); ?>:
- </td><td>
<?php
- echo ' <select name="leftsize">' . "\n";
- for ($i = 100; $i <= 300; $i += 10)
- {
- if ($left_size >= $i && $left_size < $i + 10)
- echo "<option value=\"$i\" selected>$i pixels\n";
- else
- echo "<option value=\"$i\">$i pixels\n";
+ OptionSelect( _("Theme"), 'chosentheme', $theme, $chosen_theme, 'NAME', 'PATH' );
+ OptionSelect( _("Language"), 'language', $languages, $chosen_language, 'NAME' );
+ OptionRadio( _("Use Javascript or HTML addressbook?"),
+ 'javascript_abook',
+ array( '1' => _("JavaScript"),
+ '0' => _("HTML") ),
+ $use_javascript_addr_book );
+ OptionText( _("Number of Messages to Index"), 'shownum', $show_num, 5 );
+ OptionText( _("Wrap incoming text at"), 'wrapat', $wrap_at, 5 );
+ OptionText( _("Size of editor window"), 'editorsize', $editor_size, 5 );
+ OptionSelect( _("Location of buttons when composing"),
+ 'button_new_location',
+ array( 'top' => _("Before headers"),
+ 'between' => _("Between headers and message body"),
+ 'bottom' => _("After message body") ),
+ $location_of_buttons );
+ OptionSelect( _("Location of folder list"),
+ 'folder_new_location',
+ array( '' => _("Left"),
+ 'right' => _("Right") ),
+ $location_of_bar );
+ for ($i = 100; $i <= 300; $i += 10) {
+ $res[$i] = $i . _("pixels");
}
- echo ' </select>';
-?>
- </td>
- </tr>
- <tr>
- <td align="right" nowrap><?php echo _("Auto refresh folder list"); ?>:
- </td><td>
-<?php
- $seconds_str = _("Seconds");
- $none_str = _("None");
- $minute_str = _("Minute");
+ OptionSelect( _("Width of folder list"),
+ 'leftsize',
+ $res,
+ $left_size );
$minutes_str = _("Minutes");
+ OptionSelect( _("Auto refresh folder list"),
+ 'leftrefresh',
+ array( 'None' => _("Never"),
+ 30 => '30 '. _("Seconds"),
+ 60 => '1 ' . _("Minute"),
+ 120 => "2 $minutes_str",
+ 180 => "3 $minutes_str",
+ 300 => "5 $minutes_str",
+ 600 => "10 $minutes_str" ),
+ $left_refresh );
+ OptionRadio( _("Use alternating row colors?"),
+ 'altIndexColors',
+ array( 1 => _("Yes"),
+ 0 => _("No") ),
+ $alt_index_colors );
+ OptionCheck( _("Show HTML version by default"),
+ 'showhtmldefault',
+ $show_html_default,
+ _("Yes, show me the HTML version of a mail message, if it is available.") );
+ OptionCheck( _("Include Self"),
+ 'includeselfreplyall',
+ getPref($data_dir, $username, 'include_self_reply_all', FALSE ),
+ _("Don't remove me from the CC addresses when I use \"Reply All\"") );
+ $psw = getPref($data_dir, $username, 'page_selector_max', 10 );
+ OptionCheck( _("Page Selector"),
+ 'pageselector',
+ !getPref($data_dir, $username, 'page_selector', FALSE ),
+ _("Show page selector") .
+ " <input name=pageselectormax size=3 value=\"$psw\"> " .
+ _("pages max") );
- echo ' <SELECT name="leftrefresh">';
-
- if ($left_refresh == '')
- $left_refresh = 'None';
- if ($left_refresh > 600)
- $left_refresh = 600;
- RefreshOption($left_refresh, '', _("Never"));
- RefreshOption($left_refresh, 30);
- RefreshOption($left_refresh, 60);
- RefreshOption($left_refresh, 120);
- RefreshOption($left_refresh, 180);
- RefreshOption($left_refresh, 300);
- RefreshOption($left_refresh, 600);
- // Refreshes after the session auto-timeout (default 15 min) is pointless
-
-function RefreshOption(&$current, $val, $str = '') {
- static $lastVal = 0;
-
- if (is_int($val) && is_int($current)) {
- if ($current > $lastVal && $current <= $val)
- $current = $val;
- }
-
- if ($str == '') {
- if ($val > 60) {
- $str = ($val / 60) . ' ' . _("Minutes");
- } elseif ($val == 60) {
- $str = '1 ' . _("Minute");
- } else {
- $str = $val . ' ' . _("Seconds");
- }
- }
-
- echo '<option value="' . $val . '"';
- if ($val == $current)
- echo ' SELECTED';
- echo '>' . $str . "\n";
-}
- echo ' </SELECT>';
-?>
- </td>
- </tr>
- <tr>
- <td align="right">
- <?php echo _("Use alternating row colors?") ?>
- </td><td>
-<?php
- if (isset($alt_index_colors) && $alt_index_colors == 1) {
- $a = " checked";
- $b = "";
- } else {
- $a = "";
- $b = " checked";
- }
-?>
- <input type="radio" name="altIndexColors" value="1"<?php echo $a ?>> <?php echo _("Yes") ?>
- <input type="radio" name="altIndexColors" value="0"<?php echo $b ?>> <?php echo _("No") ?><br>
- </td>
- </tr>
- <tr>
- <td align=right>
- <?php echo _("Show HTML version by default"); ?>:
- </td>
- <td>
- <input type=checkbox name=showhtmldefault <?php
- if (isset($show_html_default) && $show_html_default)
- echo " checked"; ?>>
- <?php
-echo _("Yes, show me the HTML version of a mail message, if it is available.");
- ?>
- </td>
- </tr>
- <tr>
- <td align=right valign=middle>
- <?php echo _("Include Self"); ?>:
- </td>
- <td>
- <input type=checkbox name=includeselfreplyall <?php
- if (getPref($data_dir, $username, 'include_self_reply_all') != '')
- echo " checked";
- echo '> ' . _("Don't remove me from the CC addresses when I use \"Reply All\"");
- ?>
- </td>
- </tr>
- <tr>
- <td align=right valign=middle>
- <?php
- echo _("Page Selector") . ': </td><td>';
- echo '<input type=checkbox name=pageselector';
- if (!getPref($data_dir, $username, 'page_selector') )
- echo ' checked';
- echo '> ' . _("Show page selector") . ' ';
- $psw = getPref($data_dir, $username, 'page_selector_max', 10 );
- echo "<input name=pageselectormax size=3 value=\"$psw\">";
- echo ' ' . _("pages max");
- ?>
- </td>
- </tr>
- <?php do_hook('options_display_inside'); ?>
+ do_hook('options_display_inside'); ?>
<tr>
<td>
</td><td>