Forgot to add file before last commit...
[squirrelmail.git] / plugins / sent_subfolders / setup.php
CommitLineData
a3439b27 1<?php
2
3/**
4 * setup.php -- Sent Subfolders Setup File
5 *
598294a7 6 * This is a standard SquirrelMail 1.2 API for plugins.
a3439b27 7 *
4b5049de 8 * @copyright &copy; 1999-2007 The SquirrelMail Project Team
4b4abf93 9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
4f51df66 10 * @version $Id$
ea5f4b8e 11 * @package plugins
12 * @subpackage sent_subfolders
a3439b27 13 */
14
91e0dccc 15/**
ea5f4b8e 16 */
a3439b27 17define('SMPREF_SENT_SUBFOLDERS_DISABLED', 0);
18define('SMPREF_SENT_SUBFOLDERS_YEARLY', 1);
19define('SMPREF_SENT_SUBFOLDERS_QUARTERLY', 2);
20define('SMPREF_SENT_SUBFOLDERS_MONTHLY', 3);
21define('SMOPT_GRP_SENT_SUBFOLDERS','SENT_SUBFOLDERS');
22
bb58f260 23/**
598294a7 24 * Adds plugin to SquirrelMail's hooks
bb58f260 25 */
a3439b27 26function squirrelmail_plugin_init_sent_subfolders() {
27 /* Standard initialization API. */
28 global $squirrelmail_plugin_hooks;
29
30 /* The hooks to make the sent subfolders display correctly. */
31 $squirrelmail_plugin_hooks
32 ['check_handleAsSent_result']['sent_subfolders'] =
33 'sent_subfolders_check_handleAsSent';
34
35 /* The hooks to automatically update sent subfolders. */
36 $squirrelmail_plugin_hooks
37 ['left_main_before']['sent_subfolders'] =
38 'sent_subfolders_update_sentfolder';
39
40 $squirrelmail_plugin_hooks
41 ['compose_send']['sent_subfolders'] =
42 'sent_subfolders_update_sentfolder';
43
44 /* The hook to load the sent subfolders prefs. */
45 $squirrelmail_plugin_hooks
46 ['loading_prefs']['sent_subfolders'] =
47 'sent_subfolders_load_prefs';
48
49 /* The hooks to handle sent subfolders options. */
50 $squirrelmail_plugin_hooks
51 ['optpage_loadhook_folder']['sent_subfolders'] =
52 'sent_subfolders_optpage_loadhook_folders';
bb58f260 53
54 /* mark base sent folder as special mailbox */
55 $squirrelmail_plugin_hooks
91e0dccc 56 ['special_mailbox']['sent_subfolders'] =
57 'sent_subfolders_special_mailbox';
a3439b27 58}
59
60function sent_subfolders_check_handleAsSent() {
d21b4338 61 include_once(SM_PATH . 'plugins/sent_subfolders/functions.php);
62 sent_subfolders_check_handleAsSent_do();
a3439b27 63}
64
bb58f260 65/**
66 * Loads sent_subfolders settings
67 */
a3439b27 68function sent_subfolders_load_prefs() {
d21b4338 69 include_once(SM_PATH . 'plugins/sent_subfolders/functions.php);
70 sent_subfolders_load_prefs_do();
a3439b27 71}
72
bb58f260 73/**
74 * Adds sent_subfolders options in folder preferences
75 */
a3439b27 76function sent_subfolders_optpage_loadhook_folders() {
d21b4338 77 include_once(SM_PATH . 'plugins/sent_subfolders/functions.php);
78 sent_subfolders_optpage_loadhook_folders_do();
a3439b27 79}
80
bb58f260 81/**
82 * Update sent_subfolders settings
83 *
91e0dccc 84 * function updates default sent folder value and
bb58f260 85 * creates required imap folders
86 */
a3439b27 87function sent_subfolders_update_sentfolder() {
d21b4338 88 include_once(SM_PATH . 'plugins/sent_subfolders/functions.php);
89 sent_subfolders_update_sentfolder_do();
a3439b27 90}
91
bb58f260 92/**
93 * detects if mailbox is part of sent_subfolders
94 *
95 * @param string $mb imap folder name
96 * @return boolean 1 - is part of sent_subfolders, 0 - is not part of sent_subfolders
97 */
98function sent_subfolders_special_mailbox($mb) {
d21b4338 99 include_once(SM_PATH . 'plugins/sent_subfolders/functions.php);
100 return sent_subfolders_special_mailbox_do($mb);
bb58f260 101}