| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * folders_rename_getname.php |
| 5 | * |
| 6 | * Copyright (c) 1999-2004 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 | * @version $Id$ |
| 13 | * @package squirrelmail |
| 14 | */ |
| 15 | |
| 16 | /** |
| 17 | * Path for SquirrelMail required files. |
| 18 | * @ignore |
| 19 | */ |
| 20 | define('SM_PATH','../'); |
| 21 | |
| 22 | /* SquirrelMail required files. */ |
| 23 | require_once(SM_PATH . 'include/validate.php'); |
| 24 | require_once(SM_PATH . 'functions/global.php'); |
| 25 | require_once(SM_PATH . 'functions/imap_mailbox.php'); |
| 26 | require_once(SM_PATH . 'functions/html.php'); |
| 27 | require_once(SM_PATH . 'functions/display_messages.php'); |
| 28 | require_once(SM_PATH . 'functions/forms.php'); |
| 29 | |
| 30 | /* get globals we may need */ |
| 31 | sqgetGlobalVar('key', $key, SQ_COOKIE); |
| 32 | sqgetGlobalVar('username', $username, SQ_SESSION); |
| 33 | sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION); |
| 34 | sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION); |
| 35 | sqgetGlobalVar('old', $old, SQ_POST); |
| 36 | /* end of get globals */ |
| 37 | |
| 38 | if ($old == '') { |
| 39 | displayPageHeader($color, 'None'); |
| 40 | |
| 41 | plain_error_message(_("You have not selected a folder to rename. Please do so."). |
| 42 | '<br /><a href="../src/folders.php">'._("Click here to go back").'</a>.', $color); |
| 43 | exit; |
| 44 | } |
| 45 | |
| 46 | if (substr($old, strlen($old) - strlen($delimiter)) == $delimiter) { |
| 47 | $isfolder = TRUE; |
| 48 | $old = substr($old, 0, strlen($old) - 1); |
| 49 | } else { |
| 50 | $isfolder = FALSE; |
| 51 | } |
| 52 | |
| 53 | $old = imap_utf7_decode_local($old); |
| 54 | |
| 55 | if (strpos($old, $delimiter)) { |
| 56 | $old_name = substr($old, strrpos($old, $delimiter)+1, strlen($old)); |
| 57 | $old_parent = substr($old, 0, strrpos($old, $delimiter)); |
| 58 | } else { |
| 59 | $old_name = $old; |
| 60 | $old_parent = ''; |
| 61 | } |
| 62 | |
| 63 | |
| 64 | displayPageHeader($color, 'None'); |
| 65 | echo '<br />' . |
| 66 | html_tag( 'table', '', 'center', '', 'width="95%" border="0"' ) . |
| 67 | html_tag( 'tr', |
| 68 | html_tag( 'td', '<b>' . _("Rename a folder") . '</b>', 'center', $color[0] ) |
| 69 | ) . |
| 70 | html_tag( 'tr' ) . |
| 71 | html_tag( 'td', '', 'center', $color[4] ) . |
| 72 | addForm('folders_rename_do.php'). |
| 73 | _("New name:"). |
| 74 | '<br /><b>' . htmlspecialchars($old_parent) . ' ' . htmlspecialchars($delimiter) . '</b>' . |
| 75 | addInput('new_name', $old_name, 25) . '<br />' . "\n"; |
| 76 | if ( $isfolder ) { |
| 77 | echo addHidden('isfolder', 'true'); |
| 78 | } |
| 79 | echo addHidden('orig', $old). |
| 80 | addHidden('old_name', $old_name). |
| 81 | '<input type="submit" value="'._("Submit")."\" />\n". |
| 82 | '</form><br /></td></tr></table>'; |
| 83 | |
| 84 | ?> |