From 345e009b020f655b95313947e05399798045e41e Mon Sep 17 00:00:00 2001 From: tokul Date: Fri, 7 Jul 2006 19:14:06 +0000 Subject: [PATCH] prevent setting INBOX as Draft, Sent or Trash folder (#1242346) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11364 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 1 + include/options/folder.php | 53 ++++++++++++++++++++++++++------------ 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index c941db27..effe7077 100644 --- a/ChangeLog +++ b/ChangeLog @@ -90,6 +90,7 @@ Version 1.5.2 - CVS - Added line length setting in local_file address book backend (#1181561). - Removed proprietary wrap attribute from compose form (#1512681). - Fix URL for Read Receipts being incorrect in some cases (#1177518). + - Don't allow selecting INBOX as Sent, Draft or Trash folder (#1242346). Version 1.5.1 (branched on 2006-02-12) -------------------------------------- diff --git a/include/options/folder.php b/include/options/folder.php index 844ce54c..b17ccec0 100644 --- a/include/options/folder.php +++ b/include/options/folder.php @@ -254,44 +254,65 @@ function load_optpage_data_folder() { /** * Saves the trash folder option. + * @param object $option SquirrelOption object + * @since 1.3.2 */ function save_option_trash_folder($option) { global $data_dir, $username; - /* Set move to trash on or off. */ - $trash_on = ($option->new_value == SMPREF_NONE ? SMPREF_OFF : SMPREF_ON); - setPref($data_dir, $username, 'move_to_trash', $trash_on); + if (strtolower($option->new_value)=='inbox') { + // make sure that it is not INBOX + error_option_save(_("You can't select INBOX as Trash folder.")); + } else { + /* Set move to trash on or off. */ + $trash_on = ($option->new_value == SMPREF_NONE ? SMPREF_OFF : SMPREF_ON); + setPref($data_dir, $username, 'move_to_trash', $trash_on); - /* Now just save the option as normal. */ - save_option($option); + /* Now just save the option as normal. */ + save_option($option); + } } /** * Saves the sent folder option. + * @param object $option SquirrelOption object + * @since 1.3.2 */ function save_option_sent_folder($option) { global $data_dir, $username; - /* Set move to sent on or off. */ - $sent_on = ($option->new_value == SMPREF_NONE ? SMPREF_OFF : SMPREF_ON); - setPref($data_dir, $username, 'move_to_sent', $sent_on); + if (strtolower($option->new_value)=='inbox') { + // make sure that it is not INBOX + error_option_save(_("You can't select INBOX as Sent folder.")); + } else { + /* Set move to sent on or off. */ + $sent_on = ($option->new_value == SMPREF_NONE ? SMPREF_OFF : SMPREF_ON); + setPref($data_dir, $username, 'move_to_sent', $sent_on); - /* Now just save the option as normal. */ - save_option($option); + /* Now just save the option as normal. */ + save_option($option); + } } /** * Saves the draft folder option. + * @param object $option SquirrelOption object + * @since 1.3.2 */ function save_option_draft_folder($option) { global $data_dir, $username; - /* Set move to draft on or off. */ - $draft_on = ($option->new_value == SMPREF_NONE ? SMPREF_OFF : SMPREF_ON); - setPref($data_dir, $username, 'save_as_draft', $draft_on); - - /* Now just save the option as normal. */ - save_option($option); + if (strtolower($option->new_value)=='inbox') { + // make sure that it is not INBOX + error_option_save(_("You can't select INBOX as Draft folder.")); + } else { + /* Set move to draft on or off. */ + $draft_on = ($option->new_value == SMPREF_NONE ? SMPREF_OFF : SMPREF_ON); + setPref($data_dir, $username, 'save_as_draft', $draft_on); + + /* Now just save the option as normal. */ + save_option($option); + } } ?> \ No newline at end of file -- 2.25.1