Code Cleaning
[squirrelmail.git] / src / folders_subscribe.php
CommitLineData
59177427 1<?php
895905c0 2
35586184 3/**
4 * folders_subscribe.php
5 *
15e6162e 6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
35586184 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 */
ef870322 14
35586184 15/*****************************************************************/
16/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/
17/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/
18/*** + Base level indent should begin at left margin, as ***/
19/*** the require_once below looks. ***/
20/*** + All identation should consist of four space blocks ***/
21/*** + Tab characters are evil. ***/
22/*** + all comments should use "slash-star ... star-slash" ***/
23/*** style -- no pound characters, no slash-slash style ***/
24/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/
25/*** ALWAYS USE { AND } CHARACTERS!!! ***/
26/*** + Please use ' instead of ", when possible. Note " ***/
27/*** should always be used in _( ) function calls. ***/
28/*** Thank you for your help making the SM code more readable. ***/
29/*****************************************************************/
30
31require_once('../src/validate.php');
32require_once('../functions/imap.php');
33require_once('../functions/display_messages.php');
11353192 34
35 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
11353192 36
1195c340 37 $location = get_location();
895905c0 38 if ($method == 'sub') {
e9f8ea4e 39 for ($i=0; $i < count($mailbox); $i++) {
40 $mailbox[$i] = trim($mailbox[$i]);
41 sqimap_subscribe ($imapConnection, $mailbox[$i]);
42 header("Location: $location/folders.php?success=subscribe");
43 }
11353192 44 } else {
e9f8ea4e 45 for ($i=0; $i < count($mailbox); $i++) {
46 $mailbox[$i] = trim($mailbox[$i]);
47 sqimap_unsubscribe ($imapConnection, $mailbox[$i]);
48 header("Location: $location/folders.php?success=unsubscribe");
49 }
11353192 50 }
f1177e37 51 if (!isset($mailbox)) {
52 header("Location: $location/folders.php");
53 }
1195c340 54 sqimap_logout($imapConnection);
11353192 55
1195c340 56 /*
2d367c68 57 displayPageHeader($color, 'None');
11353192 58 echo "<BR><BR><BR><CENTER><B>";
59 if ($method == "sub") {
60 echo _("Subscribed Successfully!");
61 echo "</B><BR><BR>";
62 echo _("You have been successfully subscribed.");
63 } else {
64 echo _("Unsubscribed Successfully!");
65 echo "</B><BR><BR>";
66 echo _("You have been successfully unsubscribed.");
67 }
9f2215a1 68 echo "<BR><A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>";
11353192 69 echo _("Click here");
70 echo "</A> ";
71 echo _("to continue.");
72 echo "</CENTER>";
73 echo "</BODY></HTML>";
1195c340 74 */
f1177e37 75?>