X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Ffolders.php;h=92c2d2ead1282a745f1c7278625b8ee53c8fa599;hb=041d360b6d4e68428aa55fdc08940938535886f9;hp=1d7e29dd6e8887e768b4f3f869a3f42713e38fba;hpb=82d304a0501324b276cabab1870755d5352bd21c;p=squirrelmail.git
diff --git a/src/folders.php b/src/folders.php
index 1d7e29dd..92c2d2ea 100644
--- a/src/folders.php
+++ b/src/folders.php
@@ -1,341 +1,220 @@
' .
- html_tag( 'table', '', 'center', $color[0], 'width="95%" cellpadding="1" cellspacing="0" border="0"' ) .
- html_tag( 'tr' ) .
- html_tag( 'td', '', 'center' ) . '' . _("Folders") . '' .
- html_tag( 'table', '', 'center', '', 'width="100%" cellpadding="5" cellspacing="0" border="0"' ) .
- html_tag( 'tr' ) .
- html_tag( 'td', '', 'center', $color[4] );
+global $imap_stream_options; // in case not defined in config
+$imapConnection = sqimap_login ($username, false, $imapServerAddress, $imapPort, 0, $imap_stream_options);
-if ( isset($success) && $success ) {
+/* switch to the right function based on what the user selected */
+if ( sqgetGlobalVar('smaction', $action, SQ_POST) ) {
+ switch ($action)
+ {
+ case 'create':
- $td_str = '';
+ // first, validate security token
+ sm_validate_security_token($submitted_token, -1, TRUE);
- switch ($success)
- {
- case 'subscribe':
- $td_str .= _("Subscribed successfully!");
+ sqgetGlobalVar('folder_name', $folder_name, SQ_POST);
+ sqgetGlobalVar('subfolder', $subfolder, SQ_POST);
+ sqgetGlobalVar('contain_subs', $contain_subs, SQ_POST);
+ folders_create($imapConnection, $delimiter, $folder_name, $subfolder, $contain_subs);
+ $td_str = _("Created folder successfully.");
break;
- case 'unsubscribe':
- $td_str .= _("Unsubscribed successfully!");
+ case 'rename':
+ if ( sqgetGlobalVar('cancelbutton', $dummy, SQ_POST) ) {
+ break;
+ }
+ if ( ! sqgetGlobalVar('new_name', $new_name, SQ_POST) ) {
+ sqgetGlobalVar('old_name', $old_name, SQ_POST);
+ folders_rename_getname($imapConnection, $delimiter, $old_name);
+ } else {
+
+ // first, validate security token
+ sm_validate_security_token($submitted_token, -1, TRUE);
+
+ sqgetGlobalVar('orig', $orig, SQ_POST);
+ sqgetGlobalVar('old_name', $old_name, SQ_POST);
+ folders_rename_do($imapConnection, $delimiter, $orig, $old_name, $new_name);
+ $td_str = _("Renamed successfully.");
+ }
break;
case 'delete':
- $td_str .= _("Deleted folder successfully!");
+ if ( sqgetGlobalVar('cancelbutton', $dummy, SQ_POST) ) {
+ break;
+ }
+ sqgetGlobalVar('folder_name', $folder_name, SQ_POST);
+ if ( sqgetGlobalVar('confirmed', $dummy, SQ_POST) ) {
+
+ // first, validate security token
+ sm_validate_security_token($submitted_token, -1, TRUE);
+
+ folders_delete_do($imapConnection, $delimiter, $folder_name);
+ $td_str = _("Deleted folder successfully.");
+ } else {
+ folders_delete_ask($imapConnection, $folder_name);
+ }
break;
- case 'create':
- $td_str .= _("Created folder successfully!");
+ case 'subscribe':
+
+ // first, validate security token
+ sm_validate_security_token($submitted_token, -1, TRUE);
+
+ sqgetGlobalVar('folder_names', $folder_names, SQ_POST);
+ folders_subscribe($imapConnection, $folder_names);
+ $td_str = _("Subscribed successfully.");
break;
- case 'rename':
- $td_str .= _("Renamed successfully!");
+ case 'unsubscribe':
+
+ // first, validate security token
+ sm_validate_security_token($submitted_token, -1, TRUE);
+
+ sqgetGlobalVar('folder_names', $folder_names, SQ_POST);
+ folders_unsubscribe($imapConnection, $folder_names);
+ $td_str = _("Unsubscribed successfully.");
break;
- case 'subscribe-doesnotexist':
- $td_str .= _("Subscription Unsuccessful - Folder does not exist.");
+ default:
+// TODO: this is a new hook for plugin action processing that has not been TESTED.
+ $td_str = do_hook('folder_action', $action);
break;
}
- $td_str .= '
';
-
-
- echo html_tag( 'table',
- html_tag( 'tr',
- html_tag( 'td', $td_str .
- '' .
- _("refresh folder list") . '' ,
- 'center' )
- ) ,
- 'center', '', 'width="100%" cellpadding="4" cellspacing="0" border="0"' );
}
-echo "\n
";
+if (isset($td_str)) {
+ $oTemplate->assign('note', sm_encode_html_special_chars($td_str));
+ $oTemplate->display('note.tpl');
+}
-$imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0);
-$boxes = sqimap_mailbox_list($imapConnection);
+$boxes = sqimap_mailbox_list($imapConnection,true);
/** CREATING FOLDERS **/
-echo html_tag( 'table', '', 'center', '', 'width="70%" cellpadding="4" cellspacing="0" border="0"' ) .
- html_tag( 'tr',
- html_tag( 'td', '' . _("Create Folder") . '', 'center', $color[9] )
- ) .
- html_tag( 'tr' ) .
- html_tag( 'td', '', 'center', $color[0] ) .
-
- "