| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * setup.php -- Sent Subfolders Setup File |
| 5 | * |
| 6 | * This is a standard SquirrelMail 1.2 API for plugins. |
| 7 | * |
| 8 | * @copyright © 1999-2009 The SquirrelMail Project Team |
| 9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 10 | * @version $Id$ |
| 11 | * @package plugins |
| 12 | * @subpackage sent_subfolders |
| 13 | */ |
| 14 | |
| 15 | /** |
| 16 | * Adds plugin to SquirrelMail's hooks |
| 17 | */ |
| 18 | function squirrelmail_plugin_init_sent_subfolders() { |
| 19 | /* Standard initialization API. */ |
| 20 | global $squirrelmail_plugin_hooks; |
| 21 | |
| 22 | /* The hooks to make the sent subfolders display correctly. */ |
| 23 | $squirrelmail_plugin_hooks['check_handleAsSent_result']['sent_subfolders'] |
| 24 | = 'sent_subfolders_check_handleAsSent'; |
| 25 | |
| 26 | /* The hooks to automatically update sent subfolders. */ |
| 27 | // hook isn't in 1.5.x; isn't absolutely necessary to run on the folder list anyway |
| 28 | // $squirrelmail_plugin_hooks['left_main_before']['sent_subfolders'] |
| 29 | // = 'sent_subfolders_update_sentfolder'; |
| 30 | $squirrelmail_plugin_hooks['compose_send']['sent_subfolders'] |
| 31 | = 'sent_subfolders_update_sentfolder'; |
| 32 | |
| 33 | /* The hooks to handle sent subfolders options. */ |
| 34 | $squirrelmail_plugin_hooks['optpage_loadhook_folder']['sent_subfolders'] |
| 35 | = 'sent_subfolders_optpage_loadhook_folders'; |
| 36 | |
| 37 | /* mark base sent folder as special mailbox */ |
| 38 | $squirrelmail_plugin_hooks['special_mailbox']['sent_subfolders'] |
| 39 | = 'sent_subfolders_special_mailbox'; |
| 40 | } |
| 41 | |
| 42 | function sent_subfolders_check_handleAsSent($mailbox) { |
| 43 | include_once(SM_PATH . 'plugins/sent_subfolders/functions.php'); |
| 44 | sent_subfolders_check_handleAsSent_do($mailbox); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Adds sent_subfolders options in folder preferences |
| 49 | */ |
| 50 | function sent_subfolders_optpage_loadhook_folders() { |
| 51 | include_once(SM_PATH . 'plugins/sent_subfolders/functions.php'); |
| 52 | sent_subfolders_optpage_loadhook_folders_do(); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Update sent_subfolders settings |
| 57 | * |
| 58 | * function updates default sent folder value and |
| 59 | * creates required imap folders |
| 60 | */ |
| 61 | function sent_subfolders_update_sentfolder() { |
| 62 | include_once(SM_PATH . 'plugins/sent_subfolders/functions.php'); |
| 63 | sent_subfolders_update_sentfolder_do(); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * detects if mailbox is part of sent_subfolders |
| 68 | * |
| 69 | * @param string $mb imap folder name |
| 70 | * @return boolean 1 - is part of sent_subfolders, 0 - is not part of sent_subfolders |
| 71 | */ |
| 72 | function sent_subfolders_special_mailbox($mb) { |
| 73 | include_once(SM_PATH . 'plugins/sent_subfolders/functions.php'); |
| 74 | return sent_subfolders_special_mailbox_do($mb); |
| 75 | } |