| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * folders_rename_getname.php |
| 5 | * |
| 6 | * Copyright (c) 1999-2003 The SquirrelMail Project Team |
| 7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | * |
| 9 | * Gets folder names and enables renaming |
| 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/global.php'); |
| 21 | require_once(SM_PATH . 'functions/imap_mailbox.php'); |
| 22 | require_once(SM_PATH . 'functions/html.php'); |
| 23 | require_once(SM_PATH . 'functions/display_messages.php'); |
| 24 | |
| 25 | /* get globals we may need */ |
| 26 | sqgetGlobalVar('key', $key, SQ_COOKIE); |
| 27 | sqgetGlobalVar('username', $username, SQ_SESSION); |
| 28 | sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION); |
| 29 | sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION); |
| 30 | sqgetGlobalVar('old', $old, SQ_POST); |
| 31 | /* end of get globals */ |
| 32 | |
| 33 | if ($old == '') { |
| 34 | displayPageHeader($color, 'None'); |
| 35 | |
| 36 | plain_error_message(_("You have not selected a folder to rename. Please do so."). |
| 37 | '<BR><A HREF="../src/folders.php">'._("Click here to go back").'</A>.', $color); |
| 38 | exit; |
| 39 | } |
| 40 | |
| 41 | if (substr($old, strlen($old) - strlen($delimiter)) == $delimiter) { |
| 42 | $isfolder = TRUE; |
| 43 | $old = substr($old, 0, strlen($old) - 1); |
| 44 | } else { |
| 45 | $isfolder = FALSE; |
| 46 | } |
| 47 | |
| 48 | $old = imap_utf7_decode_local($old); |
| 49 | |
| 50 | if (strpos($old, $delimiter)) { |
| 51 | $old_name = substr($old, strrpos($old, $delimiter)+1, strlen($old)); |
| 52 | $old_parent = substr($old, 0, strrpos($old, $delimiter)); |
| 53 | } else { |
| 54 | $old_name = $old; |
| 55 | $old_parent = ''; |
| 56 | } |
| 57 | |
| 58 | |
| 59 | displayPageHeader($color, 'None'); |
| 60 | echo '<br>' . |
| 61 | html_tag( 'table', '', 'center', '', 'width="95%" border="0"' ) . |
| 62 | html_tag( 'tr', |
| 63 | html_tag( 'td', '<b>' . _("Rename a folder") . '</b>', 'center', $color[0] ) |
| 64 | ) . |
| 65 | html_tag( 'tr' ) . |
| 66 | html_tag( 'td', '', 'center', $color[4] ) . |
| 67 | '<FORM ACTION="folders_rename_do.php" METHOD="POST">'. |
| 68 | _("New name:"). |
| 69 | '<br><b>' . htmlspecialchars($old_parent) . ' ' . htmlspecialchars($delimiter) . '</b>' . |
| 70 | '<INPUT TYPE="TEXT" SIZE="25" NAME="new_name" VALUE="' . htmlspecialchars($old_name) . '"><BR>' . "\n"; |
| 71 | if ( $isfolder ) { |
| 72 | echo '<INPUT TYPE=HIDDEN NAME="isfolder" VALUE="true">'; |
| 73 | } |
| 74 | printf("<INPUT TYPE=HIDDEN NAME=\"orig\" VALUE=\"%s\">\n", htmlspecialchars($old)); |
| 75 | printf("<INPUT TYPE=HIDDEN NAME=\"old_name\" VALUE=\"%s\">\n", htmlspecialchars($old_name)); |
| 76 | echo '<INPUT TYPE=SUBMIT VALUE="'._("Submit")."\">\n". |
| 77 | '</FORM><BR></td></tr></table>'; |
| 78 | |
| 79 | ?> |