- fixed bugs in sorting by from and subject
[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
12 session_start();
13
14 if (!isset($config_php))
15 include("../config/config.php");
16 if (!isset($strings_php))
17 include("../functions/strings.php");
18 if (!isset($page_header_php))
19 include("../functions/page_header.php");
20 if (!isset($imap_php))
21 include("../functions/imap.php");
22 if (!isset($display_messages_php))
23 include("../functions/display_messages.php");
24
25 include("../src/load_prefs.php");
26
27 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
28 $dm = sqimap_get_delimiter($imapConnection);
29
30 $location = get_location();
31 if ($method == "sub") {
32 for ($i=0; $i < count($mailbox); $i++) {
33 $mailbox[$i] = trim($mailbox[$i]);
34 sqimap_subscribe ($imapConnection, $mailbox[$i]);
35 header("Location: $location/folders.php?success=subscribe");
36 }
37 } else {
38 for ($i=0; $i < count($mailbox); $i++) {
39 $mailbox[$i] = trim($mailbox[$i]);
40 sqimap_unsubscribe ($imapConnection, $mailbox[$i]);
41 header("Location: $location/folders.php?success=unsubscribe");
42 }
43 }
44 sqimap_logout($imapConnection);
45
46 /*
47 displayPageHeader($color, "None");
48 echo "<BR><BR><BR><CENTER><B>";
49 if ($method == "sub") {
50 echo _("Subscribed Successfully!");
51 echo "</B><BR><BR>";
52 echo _("You have been successfully subscribed.");
53 } else {
54 echo _("Unsubscribed Successfully!");
55 echo "</B><BR><BR>";
56 echo _("You have been successfully unsubscribed.");
57 }
58 echo "<BR><A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>";
59 echo _("Click here");
60 echo "</A> ";
61 echo _("to continue.");
62 echo "</CENTER>";
63 echo "</BODY></HTML>";
64 */
65 ?>
66