-echo '<br>' .
- html_tag( 'table', '', 'center', $color[0], 'width="95%" cellpadding="1" cellspacing="0" border="0"' ) .
- html_tag( 'tr' ) .
- html_tag( 'td', '', 'center' ) . '<b>' . _("Folders") . '</b>' .
- html_tag( 'table', '', 'center', '', 'width="100%" cellpadding="5" cellspacing="0" border="0"' ) .
- 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>";
- }
-
- echo html_tag( 'table',
- html_tag( 'tr',
- html_tag( 'td', $td_str .
- "<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>";
-}
-$imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0);
-$boxes = sqimap_mailbox_list($imapConnection);
+$imapConnection = sqimap_login ($username, false, $imapServerAddress, $imapPort, 0);
+
+/* switch to the right function based on what the user selected */
+if ( sqgetGlobalVar('smaction', $action, SQ_POST) ) {
+ switch ($action)
+ {
+ case 'create':
+
+ // first, validate security token
+ sm_validate_security_token($submitted_token, 3600, TRUE);
+
+ 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 '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, 3600, 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':
+ if ( sqgetGlobalVar('cancelbutton', $dummy, SQ_POST) ) {
+ break;
+ }
+ sqgetGlobalVar('folder_name', $folder_name, SQ_POST);
+ if ( sqgetGlobalVar('confirmed', $dummy, SQ_POST) ) {