html_tag( 'tr' ) .
html_tag( 'td', '', 'center', $color[4] );
-if ((isset($success) && $success) ||
- (isset($sent_create) && $sent_create == 'true') ||
- (isset($trash_create) && $trash_create == 'true')) {
- if ($success == "subscribe") {
- $td_str = "<b>" . _("Subscribed successfully!") . "</b><br>";
- } else if ($success == "unsubscribe") {
- $td_str = "<b>" . _("Unsubscribed successfully!") . "</b><br>";
- } else if ($success == "delete") {
- $td_str = "<b>" . _("Deleted folder successfully!") . "</b><br>";
- } else if ($success == "create") {
- $td_str = "<b>" . _("Created folder successfully!") . "</b><br>";
- } else if ($success == "rename") {
- $td_str = "<b>" . _("Renamed successfully!") . "</b><br>";
- } else if ($success == "subscribe-doesnotexist") {
- $td_str = "<b>" .
- _("Subscription Unsuccessful - Folder does not exist.") .
- "</b><br>";
+if ( isset($success) && $success ) {
+
+ $td_str = '<b>';
+
+ switch ($success)
+ {
+ case 'subscribe':
+ $td_str .= _("Subscribed successfully!");
+ break;
+ case 'unsubscribe':
+ $td_str .= _("Unsubscribed successfully!");
+ break;
+ case 'delete':
+ $td_str .= _("Deleted folder successfully!");
+ break;
+ case 'create':
+ $td_str .= _("Created folder successfully!");
+ break;
+ case 'rename':
+ $td_str .= _("Renamed successfully!");
+ break;
+ case 'subscribe-doesnotexist':
+ $td_str .= _("Subscription Unsuccessful - Folder does not exist.");
+ break;
}
+ $td_str .= '</b><br>';
+
+
echo html_tag( 'table',
html_tag( 'tr',
html_tag( 'td', $td_str .
- "<a href=\"../src/left_main.php\" target=left>" . _("refresh folder list") . "</a>" ,
+ '<a href="../src/left_main.php" target=left>' .
+ _("refresh folder list") . '</a>' ,
'center' )
) ,
- 'center', '', 'width="100%" cellpadding="4" cellspacing="0" border="0"' ) . "<br>\n";
-} else {
- echo "<br>";
+ 'center', '', 'width="100%" cellpadding="4" cellspacing="0" border="0"' );
}
+
+echo "\n<br>";
+
$imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0);
$boxes = sqimap_mailbox_list($imapConnection);
"<FORM NAME=cf ACTION=\"folders_create.php\" METHOD=\"POST\">\n".
"<input type=TEXT SIZE=25 NAME=folder_name><BR>\n".
_("as a subfolder of").
- "<BR>".
+ '<BR>'.
"<TT><SELECT NAME=subfolder>\n";
if ($default_sub_of_inbox == false) {
echo '<OPTION SELECTED VALUE="">[ '._("None")." ]\n";
}
echo "</SELECT></TT>\n";
if ($show_contain_subfolders_option) {
- echo "<br><input type=CHECKBOX NAME=\"contain_subs\"> ";
- echo _("Let this folder contain subfolders");
- echo "<BR>";
+ echo '<br><input type=CHECKBOX NAME="contain_subs"> '
+ . _("Let this folder contain subfolders")
+ . '<BR>';
}
echo "<input type=SUBMIT VALUE=\""._("Create")."\">\n";
echo "</FORM></td></tr>\n";
"\">\n".
"</FORM></td></tr>\n";
} else {
- echo _("No folders found") . "<br><br></td></tr>";
+ echo _("No folders found") . '<br><br></td></tr>';
}
$boxes_sub = $boxes;
echo " <OPTION VALUE=\"$box\">$box2</option>\n";
}
}
- echo "</SELECT></TT>\n";
- echo "<input type=SUBMIT VALUE=\"";
- echo _("Delete");
- echo "\">\n";
- echo "</form></td></tr>\n";
+ echo "</SELECT></TT>\n"
+ . '<input type=SUBMIT VALUE="'
+ . _("Delete")
+ . "\">\n"
+ . "</form></td></tr>\n";
} else {
echo _("No folders found") . "<br><br></td></tr>";
}
html_tag( 'td', '', 'center', $color[0], 'width="50%"' );
if ($count_special_folders < count($boxes)) {
- echo "<FORM ACTION=\"folders_subscribe.php?method=unsub\" METHOD=\"POST\">\n";
- echo "<TT><SELECT NAME=\"mailbox[]\" multiple size=8>\n";
+ echo "<FORM ACTION=\"folders_subscribe.php?method=unsub\" METHOD=\"POST\">\n"
+ . "<TT><SELECT NAME=\"mailbox[]\" multiple size=8>\n";
for ($i = 0; $i < count($boxes); $i++) {
$use_folder = true;
if ((strtolower($boxes[$i]["unformatted"]) != "inbox") &&
echo " <OPTION VALUE=\"$box\">$box2\n";
}
}
- echo "</SELECT></TT><br><br>\n";
- echo "<input type=SUBMIT VALUE=\"";
- echo _("Unsubscribe");
- echo "\">\n";
- echo "</FORM></td>\n";
+ echo "</SELECT></TT><br><br>\n"
+ . '<input type=SUBMIT VALUE="'
+ . _("Unsubscribe")
+ . "\">\n"
+ . "</FORM></td>\n";
} else {
- echo _("No folders were found to unsubscribe from!") . "</td>";
+ echo _("No folders were found to unsubscribe from!") . '</td>';
}
$boxes_sub = $boxes;
if(!$no_list_for_subscribe) {
$boxes_all = sqimap_mailbox_list_all ($imapConnection);
- $box = "";
- $box2 = "";
+ $box = '';
+ $box2 = '';
for ($i = 0, $q = 0; $i < count($boxes_all); $i++) {
$use_folder = true;
for ($p = 0; $p < count ($boxes); $p++) {
- if ($boxes_all[$i]["unformatted"] == $boxes[$p]["unformatted"]) {
+ if ($boxes_all[$i]['unformatted'] == $boxes[$p]['unformatted']) {
$use_folder = false;
continue;
- } else if ($boxes_all[$i]["unformatted-dm"] == $folder_prefix) {
+ } else if ($boxes_all[$i]['unformatted-dm'] == $folder_prefix) {
$use_folder = false;
}
}
if ($use_folder == true) {
- $box[$q] = $boxes_all[$i]["unformatted-dm"];
- $box2[$q] = imap_utf7_decode_local($boxes_all[$i]["unformatted-disp"]);
+ $box[$q] = $boxes_all[$i]['unformatted-dm'];
+ $box2[$q] = imap_utf7_decode_local($boxes_all[$i]['unformatted-disp']);
$q++;
}
}
if ($box && $box2) {
- echo "<FORM ACTION=\"folders_subscribe.php?method=sub\" METHOD=\"POST\">\n";
- echo "<tt><select name=\"mailbox[]\" multiple size=8>";
+ echo "<FORM ACTION=\"folders_subscribe.php?method=sub\" METHOD=\"POST\">\n"
+ . '<tt><select name="mailbox[]" multiple size=8>';
for ($q = 0; $q < count($box); $q++) {
echo " <OPTION VALUE=\"$box[$q]\">".$box2[$q]."\n";
}
- echo "</select></tt><br><br>";
- echo "<input type=SUBMIT VALUE=\"". _("Subscribe") . "\">\n";
- echo "</FORM></td></tr></table><BR>\n";
+ echo '</select></tt><br><br>'
+ . '<input type=SUBMIT VALUE="'. _("Subscribe") . "\">\n"
+ . "</FORM></td></tr></table><BR>\n";
} else {
- echo _("No folders were found to subscribe to!") . "</td></tr></table>";
+ echo _("No folders were found to subscribe to!") . '</td></tr></table>';
}
} else {
/* don't perform the list action -- this is much faster */
- echo "<FORM ACTION=\"folders_subscribe.php?method=sub\" METHOD=\"POST\">\n";
- echo _("Subscribe to:") . "<br>";
- echo "<tt><input type=\"text\" name=\"mailbox[]\" size=35>";
- echo "<INPUT TYPE=SUBMIT VALUE=\"". _("Subscribe") . "\">\n";
- echo "</FORM></TD></TR></TABLE><BR>\n";
+ echo "<FORM ACTION=\"folders_subscribe.php?method=sub\" METHOD=\"POST\">\n"
+ . _("Subscribe to:") . '<br>'
+ . '<tt><input type="text" name="mailbox[]" size=35>'
+ . '<INPUT TYPE=SUBMIT VALUE="'. _("Subscribe") . "\">\n"
+ . "</FORM></TD></TR></TABLE><BR>\n";
}
-do_hook("folders_bottom");
+do_hook('folders_bottom');
?>
-
</td></tr>
</table>
/* end of get globals */
-$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
-
$folder_name = trim($folder_name);
-if (substr_count($folder_name, "\"") || substr_count($folder_name, "\\") ||
- substr_count($folder_name, "'") || substr_count($folder_name, "$delimiter") ||
- ($folder_name == '')) {
+if (substr_count($folder_name, '"') || substr_count($folder_name, "\\") ||
+ substr_count($folder_name, $delimiter) || ($folder_name == '')) {
displayPageHeader($color, 'None');
- plain_error_message(_("Illegal folder name. Please select a different name.")."<BR><A HREF=\"../src/folders.php\">"._("Click here to go back")."</A>.", $color);
- sqimap_logout($imapConnection);
+ plain_error_message(_("Illegal folder name. Please select a different name.").
+ '<BR><A HREF="../src/folders.php">'._("Click here to go back").'</A>.', $color);
+
exit;
}
if (isset($contain_subs) && $contain_subs ) {
- $folder_name = "$folder_name$delimiter";
+ $folder_name = $folder_name . $delimiter;
}
if ($folder_prefix && (substr($folder_prefix, -1) != $delimiter)) {
$subfolder_orig = $subfolder;
}
+$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+
if (trim($subfolder_orig) == '') {
sqimap_mailbox_create ($imapConnection, $folder_prefix.$folder_name, '');
} else {
sqimap_mailbox_create ($imapConnection, $subfolder.$delimiter.$folder_name, '');
}
+sqimap_logout($imapConnection);
+
$location = get_location();
header ("Location: $location/folders.php?success=create");
-sqimap_logout($imapConnection);
+
?>
* Copyright (c) 1999-2002 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
- * Deltes folders from the IMAP server.
+ * Deletes folders from the IMAP server.
* Called from the folders.php
*
* $Id$
require_once(SM_PATH . 'functions/array.php');
require_once(SM_PATH . 'functions/tree.php');
require_once(SM_PATH . 'functions/display_messages.php');
+require_once(SM_PATH . 'functions/html.php');
/*
-* Incoming values:
-* $mailbox - selected mailbox from the form
-*/
+ * Incoming values:
+ * $mailbox - selected mailbox from the form
+ */
/* globals */
$username = $_SESSION['username'];
if ($mailbox == '') {
displayPageHeader($color, 'None');
- echo "<html><body bgcolor=$color[4]>";
- plain_error_message(_("You have not selected a folder to delete. Please do so.")."<BR><A HREF=\"../src/folders.php\">"._("Click here to go back")."</A>.", $color);
+
+ plain_error_message(_("You have not selected a folder to delete. Please do so.").
+ '<BR><A HREF="../src/folders.php">'._("Click here to go back").'</A>.', $color);
+ exit;
+}
+
+if (isset($_POST['backingout'])) {
+ $location = get_location();
+ header ("Location: $location/folders.php");
exit;
}
+if(!isset($_POST['confirmed'])) {
+ displayPageHeader($color, 'None');
+
+ echo '<br>' .
+ html_tag( 'table', '', 'center', '', 'width="95%" border="0"' ) .
+ html_tag( 'tr',
+ html_tag( 'td', '<b>' . _("Delete Folder") . '</b>', 'center', $color[0] )
+ ) .
+ html_tag( 'tr' ) .
+ html_tag( 'td', '', 'center', $color[4] ) .
+ sprintf(_("Are you sure you want to delete %s?"), $mailbox).
+ '<FORM ACTION="folders_delete.php" METHOD="POST"><p>'.
+
+ '<INPUT TYPE=HIDDEN NAME="mailbox" VALUE="'.$mailbox."\">\n" .
+ '<INPUT TYPE=SUBMIT NAME="confirmed" VALUE="'._("Yes")."\">\n".
+ '<INPUT TYPE=SUBMIT NAME="backingout" VALUE="'._("No")."\">\n".
+ '</p></FORM><BR></td></tr></table>';
+
+ exit;
+}
$imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+
$boxes = sqimap_mailbox_list ($imap_stream);
+$numboxes = count($boxes);
+
global $delete_folder;
if (substr($mailbox, -1) == $delimiter)
/** lets see if we CAN move folders to the trash.. otherwise,
** just delete them **/
-/* Courier IMAP doesn't like subfolders of Trash */
-if (strtolower($imap_server_type) == "courier") {
- $can_move_to_trash = false;
-}
-
-/* If global options say we can't move it into Trash */
-else if(isset($delete_folder) && $delete_folder == true) {
- $can_move_to_trash = false;
-}
-
-/* If it's already a subfolder of trash, we'll have to delete it */
-else if(eregi("^".$trash_folder.".+", $mailbox)) {
-
- $can_move_to_trash = false;
-
+/* Courier IMAP doesn't like subfolders of Trash
+ * If global options say we can't move it into Trash
+ * If it's already a subfolder of trash, we'll have to delete it */
+if (strtolower($imap_server_type) == 'courier' ||
+ (isset($delete_folder) && $delete_folder) ||
+ eregi('^'.$trash_folder.'.+', $mailbox) )
+{
+ $can_move_to_trash = FALSE;
}
/* Otherwise, check if trash folder exits and support sub-folders */
else {
- for ($i = 0; $i < count($boxes); $i++) {
- if ($boxes[$i]["unformatted"] == $trash_folder) {
+ for ($i = 0; $i < $numboxes; $i++) {
+ if ($boxes[$i]['unformatted'] == $trash_folder) {
$can_move_to_trash = !in_array('noinferiors', $boxes[$i]['flags']);
}
}
}
/** First create the top node in the tree **/
-for ($i = 0;$i < count($boxes);$i++) {
- if (($boxes[$i]["unformatted-dm"] == $mailbox) && (strlen($boxes[$i]["unformatted-dm"]) == strlen($mailbox))) {
- $foldersTree[0]["value"] = $mailbox;
- $foldersTree[0]["doIHaveChildren"] = false;
+for ($i = 0; $i < $numboxes; $i++) {
+ if (($boxes[$i]['unformatted-dm'] == $mailbox) && (strlen($boxes[$i]['unformatted-dm']) == strlen($mailbox))) {
+ $foldersTree[0]['value'] = $mailbox;
+ $foldersTree[0]['doIHaveChildren'] = false;
continue;
}
}
+
/* Now create the nodes for subfolders of the parent folder
You can tell that it is a subfolder by tacking the mailbox delimiter
on the end of the $mailbox string, and compare to that. */
-$j = 0;
-for ($i = 0;$i < count($boxes);$i++) {
- if (substr($boxes[$i]["unformatted"], 0, strlen($mailbox_no_dm . $delimiter)) == ($mailbox_no_dm . $delimiter)) {
- addChildNodeToTree($boxes[$i]["unformatted"], $boxes[$i]["unformatted-dm"], $foldersTree);
+for ($i = 0; $i < $numboxes; $i++) {
+ if (substr($boxes[$i]['unformatted'], 0, strlen($mailbox_no_dm . $delimiter)) == ($mailbox_no_dm . $delimiter)) {
+ addChildNodeToTree($boxes[$i]["unformatted"], $boxes[$i]['unformatted-dm'], $foldersTree);
}
}
-/* simpleWalkTreePre(0, $foldersTree); */
/** Lets start removing the folders and messages **/
if (($move_to_trash == true) && ($can_move_to_trash == true)) { /** if they wish to move messages to the trash **/
$location = get_location();
header ("Location: $location/folders.php?success=delete");
-/*
-echo "<BR><BR><BR><CENTER><B>";
-echo _("Folder Deleted!");
-echo "</B><BR><BR>";
-echo _("The folder has been successfully deleted.");
-echo "<BR><A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>";
-echo _("Click here");
-echo "</A> ";
-echo _("to continue.");
-echo "</CENTER>";
-
-echo "</BODY></HTML>";
-*/
+
?>
/* SquirrelMail required files. */
require_once(SM_PATH . 'include/validate.php');
require_once(SM_PATH . 'functions/imap.php');
+require_once(SM_PATH . 'functions/display_messages.php');
/* globals */
$username = $_SESSION['username'];
$key = $_COOKIE['key'];
$delimiter = $_SESSION['delimiter'];
$onetimepad = $_SESSION['onetimepad'];
-$base_uri = $_SESSION['base_uri'];
$orig = $_POST['orig'];
$old_name = $_POST['old_name'];
$new_name = trim($new_name);
+if (substr_count($new_name, '"') || substr_count($new_name, "\\") ||
+ substr_count($new_name, $delimiter) || ($new_name == '')) {
+ displayPageHeader($color, 'None');
+
+ plain_error_message(_("Illegal folder name. Please select a different name.").
+ '<BR><A HREF="../src/folders.php">'._("Click here to go back").'</A>.', $color);
+
+ exit;
+}
+
if ($old_name <> $new_name) {
$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
$newone = $new_name;
}
- // Renaming a folder doesn't renames the folder but leaves you unsubscribed
+ // Renaming a folder doesn't rename the folder but leaves you unsubscribed
// at least on Cyrus IMAP servers.
if (isset($isfolder)) {
$newone = $newone.$delimiter;
sqimap_logout($imapConnection);
}
-header ('Location: ' . $base_uri . 'src/folders.php?success=rename');
+
+header ('Location: ' . get_location() . '/folders.php?success=rename');
+
?>
/* SquirrelMail required files. */
require_once(SM_PATH . 'include/validate.php');
-require_once(SM_PATH . 'functions/imap.php');
require_once(SM_PATH . 'functions/html.php');
require_once(SM_PATH . 'functions/display_messages.php');
if ($old == '') {
displayPageHeader($color, 'None');
- echo "<html><body bgcolor=$color[4]>";
- plain_error_message(_("You have not selected a folder to rename. Please do so.")."<BR><A HREF=\"../src/folders.php\">"._("Click here to go back")."</A>.", $color);
+
+ plain_error_message(_("You have not selected a folder to rename. Please do so.").
+ '<BR><A HREF="../src/folders.php">'._("Click here to go back").'</A>.', $color);
exit;
}
-
-$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
-
if (substr($old, strlen($old) - strlen($delimiter)) == $delimiter) {
$isfolder = TRUE;
$old = substr($old, 0, strlen($old) - 1);
displayPageHeader($color, 'None');
echo '<br>' .
- html_tag( 'table', '', 'center', '', 'width="95%" cols="1" border="0"' ) .
+ html_tag( 'table', '', 'center', '', 'width="95%" border="0"' ) .
html_tag( 'tr',
html_tag( 'td', '<b>' . _("Rename a folder") . '</b>', 'center', $color[0] )
) .
html_tag( 'tr' ) .
html_tag( 'td', '', 'center', $color[4] ) .
- "<FORM ACTION=\"folders_rename_do.php\" METHOD=\"POST\">\n".
+ '<FORM ACTION="folders_rename_do.php" METHOD="POST">'.
_("New name:").
"<br><B>$old_parent $delimiter </B><INPUT TYPE=TEXT SIZE=25 NAME=new_name VALUE=\"$old_name\"><BR>\n";
if ( $isfolder ) {
- echo "<INPUT TYPE=HIDDEN NAME=isfolder VALUE=\"true\">";
+ echo '<INPUT TYPE=HIDDEN NAME="isfolder" VALUE="true">';
}
-printf("<INPUT TYPE=HIDDEN NAME=orig VALUE=\"%s\">\n", $old);
-printf("<INPUT TYPE=HIDDEN NAME=old_name VALUE=\"%s\">\n", $old_name);
-echo "<INPUT TYPE=SUBMIT VALUE=\""._("Submit")."\">\n".
- "</FORM><BR></td></tr>".
- "</table>";
+printf("<INPUT TYPE=HIDDEN NAME=\"orig\" VALUE=\"%s\">\n", $old);
+printf("<INPUT TYPE=HIDDEN NAME=\"old_name\" VALUE=\"%s\">\n", $old_name);
+echo '<INPUT TYPE=SUBMIT VALUE="'._("Submit")."\">\n".
+ '</FORM><BR></td></tr></table>';
-/** Log out this session **/
-sqimap_logout($imapConnection);
?>
* Copyright (c) 1999-2002 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
- * Subscribe and unsubcribe form folders.
+ * Subscribe and unsubcribe from folders.
* Called from folders.php
*
* $Id$
/* end globals */
-$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
-
$location = get_location();
-if (!isset($mailbox) || !isset($mailbox[0]) || $mailbox[0] == "") {
+if (!isset($mailbox) || !isset($mailbox[0]) || $mailbox[0] == '') {
header("Location: $location/folders.php");
- sqimap_logout($imapConnection);
+
exit(0);
}
+$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+
if ($method == 'sub') {
if($no_list_for_subscribe && $imap_server_type == 'cyrus') {
/* Cyrus, atleast, does not typically allow subscription to
exit(0);
}
}
-
for ($i=0; $i < count($mailbox); $i++) {
$mailbox[$i] = trim($mailbox[$i]);
sqimap_subscribe ($imapConnection, $mailbox[$i]);
- header("Location: $location/folders.php?success=subscribe");
}
+ $success = 'subscribe';
} else {
for ($i=0; $i < count($mailbox); $i++) {
$mailbox[$i] = trim($mailbox[$i]);
sqimap_unsubscribe ($imapConnection, $mailbox[$i]);
- header("Location: $location/folders.php?success=unsubscribe");
}
+ $success = 'unsubscribe';
}
+
sqimap_logout($imapConnection);
+header("Location: $location/folders.php?success=$success");
-/*
-displayPageHeader($color, 'None');
-echo "<BR><BR><BR><CENTER><B>";
-if ($method == "sub") {
- echo _("Subscribed Successfully!");
- echo "</B><BR><BR>";
- echo _("You have been successfully subscribed.");
-} else {
- echo _("Unsubscribed Successfully!");
- echo "</B><BR><BR>";
- echo _("You have been successfully unsubscribed.");
-}
-echo "<BR><A HREF=\"webmail.php?right_frame=folders.php\" TARGET=_top>";
-echo _("Click here");
-echo "</A> ";
-echo _("to continue.");
-echo "</CENTER>";
-echo "</BODY></HTML>";
-*/
?>