59177427 |
1 | <?php |
895905c0 |
2 | |
35586184 |
3 | /** |
4 | * folders_rename_getname.php |
5 | * |
76911253 |
6 | * Copyright (c) 1999-2003 The SquirrelMail Project Team |
35586184 |
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$ |
8f6f9ba5 |
13 | * @package squirrelmail |
35586184 |
14 | */ |
ef870322 |
15 | |
8f6f9ba5 |
16 | /** Path for SquirrelMail required files. */ |
86725763 |
17 | define('SM_PATH','../'); |
18 | |
19 | /* SquirrelMail required files. */ |
08185f2a |
20 | require_once(SM_PATH . 'include/validate.php'); |
8650e9e1 |
21 | require_once(SM_PATH . 'functions/global.php'); |
68f2ce7a |
22 | require_once(SM_PATH . 'functions/imap_mailbox.php'); |
86725763 |
23 | require_once(SM_PATH . 'functions/html.php'); |
483ddadc |
24 | require_once(SM_PATH . 'functions/display_messages.php'); |
d3cdb279 |
25 | |
a32985a5 |
26 | /* get globals we may need */ |
1e12d1ff |
27 | sqgetGlobalVar('key', $key, SQ_COOKIE); |
28 | sqgetGlobalVar('username', $username, SQ_SESSION); |
29 | sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION); |
30 | sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION); |
31 | sqgetGlobalVar('old', $old, SQ_POST); |
a32985a5 |
32 | /* end of get globals */ |
33 | |
0037f048 |
34 | if ($old == '') { |
35 | displayPageHeader($color, 'None'); |
b7f83b61 |
36 | |
37 | plain_error_message(_("You have not selected a folder to rename. Please do so."). |
38 | '<BR><A HREF="../src/folders.php">'._("Click here to go back").'</A>.', $color); |
0037f048 |
39 | exit; |
40 | } |
41 | |
1c52ba77 |
42 | if (substr($old, strlen($old) - strlen($delimiter)) == $delimiter) { |
43 | $isfolder = TRUE; |
44 | $old = substr($old, 0, strlen($old) - 1); |
45 | } else { |
46 | $isfolder = FALSE; |
47 | } |
be69e508 |
48 | |
68f2ce7a |
49 | $old = imap_utf7_decode_local($old); |
50 | |
1c52ba77 |
51 | if (strpos($old, $delimiter)) { |
52 | $old_name = substr($old, strrpos($old, $delimiter)+1, strlen($old)); |
53 | $old_parent = substr($old, 0, strrpos($old, $delimiter)); |
54 | } else { |
55 | $old_name = $old; |
56 | $old_parent = ''; |
57 | } |
58 | |
68f2ce7a |
59 | |
1c52ba77 |
60 | displayPageHeader($color, 'None'); |
3530b83b |
61 | echo '<br>' . |
b7f83b61 |
62 | html_tag( 'table', '', 'center', '', 'width="95%" border="0"' ) . |
3530b83b |
63 | html_tag( 'tr', |
64 | html_tag( 'td', '<b>' . _("Rename a folder") . '</b>', 'center', $color[0] ) |
65 | ) . |
66 | html_tag( 'tr' ) . |
67 | html_tag( 'td', '', 'center', $color[4] ) . |
b7f83b61 |
68 | '<FORM ACTION="folders_rename_do.php" METHOD="POST">'. |
1c52ba77 |
69 | _("New name:"). |
75717629 |
70 | '<br><b>' . htmlspecialchars($old_parent) . ' ' . htmlspecialchars($delimiter) . '</b>' . |
71 | '<INPUT TYPE="TEXT" SIZE="25" NAME="new_name" VALUE="' . htmlspecialchars($old_name) . '"><BR>' . "\n"; |
1c52ba77 |
72 | if ( $isfolder ) { |
b7f83b61 |
73 | echo '<INPUT TYPE=HIDDEN NAME="isfolder" VALUE="true">'; |
1c52ba77 |
74 | } |
75717629 |
75 | printf("<INPUT TYPE=HIDDEN NAME=\"orig\" VALUE=\"%s\">\n", htmlspecialchars($old)); |
76 | printf("<INPUT TYPE=HIDDEN NAME=\"old_name\" VALUE=\"%s\">\n", htmlspecialchars($old_name)); |
b7f83b61 |
77 | echo '<INPUT TYPE=SUBMIT VALUE="'._("Submit")."\">\n". |
78 | '</FORM><BR></td></tr></table>'; |
1c52ba77 |
79 | |
0037f048 |
80 | ?> |