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