* @subpackage sent_subfolders
*/
+define('SMPREF_SENT_SUBFOLDERS_DISABLED', 0);
+define('SMPREF_SENT_SUBFOLDERS_YEARLY', 1);
+define('SMPREF_SENT_SUBFOLDERS_QUARTERLY', 2);
+define('SMPREF_SENT_SUBFOLDERS_MONTHLY', 3);
+define('SMOPT_GRP_SENT_SUBFOLDERS','SENT_SUBFOLDERS');
+
function sent_subfolders_check_handleAsSent_do($mailbox) {
- global $handleAsSent_result, $sent_subfolders_base,
- $use_sent_subfolders;
+
+ global $handleAsSent_result;
+
+ // don't need to bother if it's already special
+ if ($handleAsSent_result) return;
sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
+ $use_sent_subfolders = getPref($data_dir, $username,
+ 'use_sent_subfolders', SMPREF_OFF);
+ $sent_subfolders_base = getPref($data_dir, $username,
+ 'sent_subfolders_base', SMPREF_NONE);
+
/* Only check the folder string if we have been passed a mailbox. */
if ($use_sent_subfolders && !empty($mailbox)) {
/* Chop up the folder strings as needed. */
$mbox_str = substr($mailbox, 0, strlen($base_str));
/* Perform the comparison. */
- $handleAsSent_result =
- ( $handleAsSent_result
- || ($base_str == $mbox_str)
- || ($sent_subfolders_base == $mailbox)
- );
+ $handleAsSent_result = ( ($base_str == $mbox_str)
+ || ($sent_subfolders_base == $mailbox) );
}
}
-/**
- * Loads sent_subfolders settings
- */
-function sent_subfolders_load_prefs_do() {
- global $use_sent_subfolders, $data_dir, $username,
- $sent_subfolders_setting, $sent_subfolders_base;
-
- $use_sent_subfolders = getPref
- ($data_dir, $username, 'use_sent_subfolders', SMPREF_OFF);
-
- $sent_subfolders_setting = getPref
- ($data_dir, $username, 'sent_subfolders_setting', SMPREF_SENT_SUBFOLDERS_DISABLED);
-
- $sent_subfolders_base = getPref
- ($data_dir, $username, 'sent_subfolders_base', SMPREF_NONE);
-}
-
/**
* Adds sent_subfolders options in folder preferences
*/
function sent_subfolders_optpage_loadhook_folders_do() {
- global $username, $optpage_data, $imapServerAddress, $imapPort, $show_contain_subfolders_option;
+
+ global $username, $optpage_data, $imapServerAddress, $imapPort,
+ $show_contain_subfolders_option;
/* Get some imap data we need later. */
$imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
$optgrp = _("Sent Subfolders Options");
$optvals = array();
+ global $sent_subfolders_setting;
+ $sent_subfolders_setting = getPref($data_dir, $username,
+ 'sent_subfolders_setting',
+ SMPREF_SENT_SUBFOLDERS_DISABLED);
$optvals[] = array(
'name' => 'sent_subfolders_setting',
'caption' => _("Use Sent Subfolders"),
$filtered_folders=array_filter($boxes, "filter_folders");
$sent_subfolders_base_values = array('whatever'=>$filtered_folders);
+ global $sent_subfolders_base;
+ $sent_subfolders_base = getPref($data_dir, $username,
+ 'sent_subfolders_base', SMPREF_NONE);
$optvals[] = array(
'name' => 'sent_subfolders_base',
'caption' => _("Base Sent Folder"),
* Saves sent_subfolder_options
*/
function save_option_sent_subfolders_setting($option) {
- global $data_dir, $username, $use_sent_subfolders;
+ global $data_dir, $username;
/* Set use_sent_subfolders as either on or off. */
if ($option->new_value == SMPREF_SENT_SUBFOLDERS_DISABLED) {
* creates required imap folders
*/
function sent_subfolders_update_sentfolder_do() {
- global $sent_folder, $username;
- global $sent_subfolders_base, $sent_subfolders_setting;
- global $data_dir, $imapServerAddress, $imapPort;
- global $use_sent_subfolders, $move_to_sent;
+ global $sent_folder, $username,
+ $data_dir, $imapServerAddress, $imapPort,
+ $move_to_sent;
sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
+ $use_sent_subfolders = getPref($data_dir, $username,
+ 'use_sent_subfolders', SMPREF_OFF);
+ $sent_subfolders_setting = getPref($data_dir, $username,
+ 'sent_subfolders_setting',
+ SMPREF_SENT_SUBFOLDERS_DISABLED);
+ $sent_subfolders_base = getPref($data_dir, $username,
+ 'sent_subfolders_base', SMPREF_NONE);
+
if ($use_sent_subfolders || $move_to_sent) {
$year = date('Y');
$month = date('m');
sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
- $use_sent_subfolders = getPref
- ($data_dir, $username, 'use_sent_subfolders', SMPREF_OFF);
+ $use_sent_subfolders = getPref($data_dir, $username, 'use_sent_subfolders', SMPREF_OFF);
+
+//FIXME: why "na" as the default? Shouldn't this be SMPREF_NONE as it is elsewhere in this file?
$sent_subfolders_base = getPref($data_dir, $username, 'sent_subfolders_base', 'na');
/**
* @subpackage sent_subfolders
*/
-/**
- */
-define('SMPREF_SENT_SUBFOLDERS_DISABLED', 0);
-define('SMPREF_SENT_SUBFOLDERS_YEARLY', 1);
-define('SMPREF_SENT_SUBFOLDERS_QUARTERLY', 2);
-define('SMPREF_SENT_SUBFOLDERS_MONTHLY', 3);
-define('SMOPT_GRP_SENT_SUBFOLDERS','SENT_SUBFOLDERS');
-
/**
* Adds plugin to SquirrelMail's hooks
*/
global $squirrelmail_plugin_hooks;
/* The hooks to make the sent subfolders display correctly. */
- $squirrelmail_plugin_hooks
- ['check_handleAsSent_result']['sent_subfolders'] =
- 'sent_subfolders_check_handleAsSent';
+ $squirrelmail_plugin_hooks['check_handleAsSent_result']['sent_subfolders']
+ = 'sent_subfolders_check_handleAsSent';
/* The hooks to automatically update sent subfolders. */
- $squirrelmail_plugin_hooks
- ['left_main_before']['sent_subfolders'] =
- 'sent_subfolders_update_sentfolder';
-
- $squirrelmail_plugin_hooks
- ['compose_send']['sent_subfolders'] =
- 'sent_subfolders_update_sentfolder';
-
- /* The hook to load the sent subfolders prefs. */
- $squirrelmail_plugin_hooks
- ['loading_prefs']['sent_subfolders'] =
- 'sent_subfolders_load_prefs';
+ $squirrelmail_plugin_hooks['left_main_before']['sent_subfolders']
+ = 'sent_subfolders_update_sentfolder';
+ $squirrelmail_plugin_hooks['compose_send']['sent_subfolders']
+ = 'sent_subfolders_update_sentfolder';
/* The hooks to handle sent subfolders options. */
- $squirrelmail_plugin_hooks
- ['optpage_loadhook_folder']['sent_subfolders'] =
- 'sent_subfolders_optpage_loadhook_folders';
+ $squirrelmail_plugin_hooks['optpage_loadhook_folder']['sent_subfolders']
+ = 'sent_subfolders_optpage_loadhook_folders';
/* mark base sent folder as special mailbox */
- $squirrelmail_plugin_hooks
- ['special_mailbox']['sent_subfolders'] =
- 'sent_subfolders_special_mailbox';
+ $squirrelmail_plugin_hooks['special_mailbox']['sent_subfolders']
+ = 'sent_subfolders_special_mailbox';
}
function sent_subfolders_check_handleAsSent($mailbox) {
sent_subfolders_check_handleAsSent_do($mailbox);
}
-/**
- * Loads sent_subfolders settings
- */
-function sent_subfolders_load_prefs() {
- include_once(SM_PATH . 'plugins/sent_subfolders/functions.php');
- sent_subfolders_load_prefs_do();
-}
-
/**
* Adds sent_subfolders options in folder preferences
*/