From d56050e17bf919a100069eee0a454083bb9b0a05 Mon Sep 17 00:00:00 2001 From: kink Date: Mon, 3 Sep 2007 11:51:57 +0000 Subject: [PATCH 1/1] Bring defaults for the folder selection pref in line. Create constants for their values, not use the semantically irrelevant SMPREF_{ON,OFF} git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12670 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_mailbox.php | 6 +++--- include/constants.php | 4 ++++ include/load_prefs.php | 2 +- include/options/folder.php | 10 +++++++--- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index e7c41309..df369204 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -685,7 +685,7 @@ function sqimap_mailbox_option_array($imap_stream, $folder_skip = 0, $boxes = 0, if ( $use_long_format ) { $shorten_box_names = 0; } else { - $shorten_box_names = getPref($data_dir, $username, 'mailbox_select_style', SMPREF_OFF); + $shorten_box_names = getPref($data_dir, $username, 'mailbox_select_style', SMPREF_MAILBOX_SELECT_INDENTED); } if ($boxes == 0) { @@ -710,7 +710,7 @@ function sqimap_mailbox_option_array($imap_stream, $folder_skip = 0, $boxes = 0, } else { switch ($shorten_box_names) { - case 2: /* delimited, style = 2 */ + case SMPREF_MAILBOX_SELECT_DELIMITED: if ($translate_special_folders && $boxes_part['unformatted-dm']==$sent_folder) { /* * calculate pad level from number of delimiters. do it inside if control in order @@ -731,7 +731,7 @@ function sqimap_mailbox_option_array($imap_stream, $folder_skip = 0, $boxes = 0, $box2 = str_replace('  ', '. ', htmlspecialchars($boxes_part['formatted'])); } break; - case 1: /* indent, style = 1 */ + case SMPREF_MAILBOX_SELECT_INDENTED: if ($translate_special_folders && $boxes_part['unformatted-dm']==$sent_folder) { $pad = str_pad('',12 * (count(explode($delimiter,$boxes_part['unformatted-dm']))-1),'  '); $box2 = $pad . _("Sent"); diff --git a/include/constants.php b/include/constants.php index 62e50752..5faea986 100644 --- a/include/constants.php +++ b/include/constants.php @@ -57,6 +57,10 @@ define('SMPREF_UNSEEN_NORMAL', 5); // Only normal folders (since 1.2.5) define('SMPREF_UNSEEN_ONLY', 1); define('SMPREF_UNSEEN_TOTAL', 2); +define('SMPREF_MAILBOX_SELECT_LONG', 0); +define('SMPREF_MAILBOX_SELECT_INDENTED', 1); +define('SMPREF_MAILBOX_SELECT_DELIMITED', 2); + /** * Define constants for time/date display preferences. * @since 1.2.0 diff --git a/include/load_prefs.php b/include/load_prefs.php index cc73748b..8321ab6e 100644 --- a/include/load_prefs.php +++ b/include/load_prefs.php @@ -321,7 +321,7 @@ $forward_cc = getPref($data_dir, $username, 'forward_cc', SMPREF_OFF); /* How are mailbox select lists displayed: 0. full names, 1. indented (default), * 3. delimited) */ -$mailbox_select_style = getPref($data_dir, $username, 'mailbox_select_style', SMPREF_ON); +$mailbox_select_style = getPref($data_dir, $username, 'mailbox_select_style', SMPREF_MAILBOX_SELECT_INDENTED); /* Allow user to customize, and display the full date, instead of day, or time based on time distance from date of message */ diff --git a/include/options/folder.php b/include/options/folder.php index ead93b86..c2f7639e 100644 --- a/include/options/folder.php +++ b/include/options/folder.php @@ -234,9 +234,13 @@ function load_optpage_data_folder() { 'caption' => _("Selection List Style"), 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_NONE, - 'posvals' => array( 0 => _("Long:") . ' "' . _("Folder") . $delim . _("Subfolder") . '"', - 1 => _("Indented:") . " \"$nbsp$nbsp$nbsp$nbsp" . _("Subfolder") . '"', - 2 => _("Delimited:") . " \".$nbsp" . _("Subfolder") . '"'), + 'posvals' => array( + SMPREF_MAILBOX_SELECT_LONG => + _("Long:") . ' "' . _("Folder") . $delim . _("Subfolder") . '"', + SMPREF_MAILBOX_SELECT_INDENTED => + _("Indented:") . " \"$nbsp$nbsp$nbsp$nbsp" . _("Subfolder") . '"', + SMPREF_MAILBOX_SELECT_DELIMITED => + _("Delimited:") . " \".$nbsp" . _("Subfolder") . '"'), 'htmlencoded' => true ); -- 2.25.1