Remove unused graphics file.
[squirrelmail.git] / src / folders_subscribe.php
1 <?php
2
3 /**
4 * folders_subscribe.php
5 *
6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * Subscribe and unsubcribe form folders.
10 * Called from folders.php
11 *
12 * $Id$
13 */
14
15 /* Path for SquirrelMail required files. */
16 define('SM_PATH','../');
17
18 /* SquirrelMail required files. */
19 require_once(SM_PATH . 'include/validate.php');
20 require_once(SM_PATH . 'functions/imap.php');
21 require_once(SM_PATH . 'functions/display_messages.php');
22
23 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
24
25 $location = get_location();
26
27 if (!isset($mailbox) || !isset($mailbox[0]) || $mailbox[0] == "") {
28 header("Location: $location/folders.php");
29 sqimap_logout($imapConnection);
30 exit(0);
31 }
32
33 if ($method == 'sub') {
34 if($no_list_for_subscribe && $imap_server_type == 'cyrus') {
35 /* Cyrus, atleast, does not typically allow subscription to
36 * nonexistent folders (this is an optional part of IMAP),
37 * lets catch it here and report back cleanly. */
38 if(!sqimap_mailbox_exists($imapConnection, $mailbox[0])) {
39 header("Location: $location/folders.php?success=subscribe-doesnotexist");
40 sqimap_logout($imapConnection);
41 exit(0);
42 }
43 }
44
45 for ($i=0; $i < count($mailbox); $i++) {
46 $mailbox[$i] = trim($mailbox[$i]);
47 sqimap_subscribe ($imapConnection, $mailbox[$i]);
48 header("Location: $location/folders.php?success=subscribe");
49 }
50 } else {
51 for ($i=0; $i < count($mailbox); $i++) {
52 $mailbox[$i] = trim($mailbox[$i]);
53 sqimap_unsubscribe ($imapConnection, $mailbox[$i]);
54 header("Location: $location/folders.php?success=unsubscribe");
55 }
56 }
57 sqimap_logout($imapConnection);
58
59 /*
60 displayPageHeader($color, 'None');
61 echo "<BR><BR><BR><CENTER><B>";
62 if ($method == "sub") {
63 echo _("Subscribed Successfully!");
64 echo "</B><BR><BR>";
65 echo _("You have been successfully subscribed.");
66 } else {
67 echo _("Unsubscribed Successfully!");
68 echo "</B><BR><BR>";
69 echo _("You have been successfully unsubscribed.");
70 }
71 echo "<BR><A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>";
72 echo _("Click here");
73 echo "</A> ";
74 echo _("to continue.");
75 echo "</CENTER>";
76 echo "</BODY></HTML>";
77 */
78 ?>