a8993933e953f0f4916ef7557febee9f65437d97
[squirrelmail.git] / src / folders_subscribe.php
1 <?php
2 /**
3 ** folders_subscribe.php
4 **
5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 **
8 ** Subscribe and unsubcribe form folders.
9 ** Called from folders.php
10 **
11 ** $Id$
12 **/
13
14 session_start();
15
16 if (!isset($config_php))
17 include("../config/config.php");
18 if (!isset($strings_php))
19 include("../functions/strings.php");
20 if (!isset($page_header_php))
21 include("../functions/page_header.php");
22 if (!isset($imap_php))
23 include("../functions/imap.php");
24 if (!isset($display_messages_php))
25 include("../functions/display_messages.php");
26
27 include("../src/load_prefs.php");
28
29 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
30 $dm = sqimap_get_delimiter($imapConnection);
31
32 $location = get_location();
33 if ($method == "sub") {
34 for ($i=0; $i < count($mailbox); $i++) {
35 $mailbox[$i] = trim($mailbox[$i]);
36 sqimap_subscribe ($imapConnection, $mailbox[$i]);
37 header("Location: $location/folders.php?success=subscribe");
38 }
39 } else {
40 for ($i=0; $i < count($mailbox); $i++) {
41 $mailbox[$i] = trim($mailbox[$i]);
42 sqimap_unsubscribe ($imapConnection, $mailbox[$i]);
43 header("Location: $location/folders.php?success=unsubscribe");
44 }
45 }
46 sqimap_logout($imapConnection);
47
48 /*
49 displayPageHeader($color, "None");
50 echo "<BR><BR><BR><CENTER><B>";
51 if ($method == "sub") {
52 echo _("Subscribed Successfully!");
53 echo "</B><BR><BR>";
54 echo _("You have been successfully subscribed.");
55 } else {
56 echo _("Unsubscribed Successfully!");
57 echo "</B><BR><BR>";
58 echo _("You have been successfully unsubscribed.");
59 }
60 echo "<BR><A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>";
61 echo _("Click here");
62 echo "</A> ";
63 echo _("to continue.");
64 echo "</CENTER>";
65 echo "</BODY></HTML>";
66 */
67 ?>
68