/**
* folders_rename_getname.php
*
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* Gets folder names and enables renaming
* Called from folders.php
*
- * $Id$
+ * @version $Id$
+ * @package squirrelmail
*/
-/*****************************************************************/
-/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/
-/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/
-/*** + Base level indent should begin at left margin, as ***/
-/*** the require_once below looks. ***/
-/*** + All identation should consist of four space blocks ***/
-/*** + Tab characters are evil. ***/
-/*** + all comments should use "slash-star ... star-slash" ***/
-/*** style -- no pound characters, no slash-slash style ***/
-/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/
-/*** ALWAYS USE { AND } CHARACTERS!!! ***/
-/*** + Please use ' instead of ", when possible. Note " ***/
-/*** should always be used in _( ) function calls. ***/
-/*** Thank you for your help making the SM code more readable. ***/
-/*****************************************************************/
+/**
+ * Path for SquirrelMail required files.
+ * @ignore
+ */
+define('SM_PATH','../');
+
+/* SquirrelMail required files. */
+require_once(SM_PATH . 'include/validate.php');
+require_once(SM_PATH . 'functions/global.php');
+require_once(SM_PATH . 'functions/imap_mailbox.php');
+require_once(SM_PATH . 'functions/html.php');
+require_once(SM_PATH . 'functions/display_messages.php');
+require_once(SM_PATH . 'functions/forms.php');
+
+/* get globals we may need */
+sqgetGlobalVar('key', $key, SQ_COOKIE);
+sqgetGlobalVar('username', $username, SQ_SESSION);
+sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION);
+sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
+sqgetGlobalVar('old', $old, SQ_POST);
+/* end of get globals */
+
+if ($old == '') {
+ displayPageHeader($color, 'None');
+
+ plain_error_message(_("You have not selected a folder to rename. Please do so.").
+ '<br /><a href="../src/folders.php">'._("Click here to go back").'</a>.', $color);
+ exit;
+}
+
+if (substr($old, strlen($old) - strlen($delimiter)) == $delimiter) {
+ $isfolder = TRUE;
+ $old = substr($old, 0, strlen($old) - 1);
+} else {
+ $isfolder = FALSE;
+}
-require_once('../src/validate.php');
-require_once('../functions/imap.php');
+$old = imap_utf7_decode_local($old);
- $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+if (strpos($old, $delimiter)) {
+ $old_name = substr($old, strrpos($old, $delimiter)+1, strlen($old));
+ $old_parent = substr($old, 0, strrpos($old, $delimiter));
+} else {
+ $old_name = $old;
+ $old_parent = '';
+}
- global $delimiter;
- if (substr($old, strlen($old) - strlen($delimiter)) == $delimiter) {
- $isfolder = true;
- $old = substr($old, 0, strlen($old) - 1);
- }
-
- if (strpos($old, $delimiter)) {
- $old_name = substr($old, strrpos($old, $delimiter)+1, strlen($old));
- $old_parent = substr($old, 0, strrpos($old, $delimiter));
- } else {
- $old_name = $old;
- $old_parent = "";
- }
- displayPageHeader($color, 'None');
- echo "<br><TABLE align=center border=0 WIDTH=95% COLS=1>";
- echo "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER><B>";
- echo _("Rename a folder");
- echo "</B></TD></TR>";
- echo "<TR><TD BGCOLOR=\"$color[4]\" ALIGN=CENTER>";
- echo "<FORM ACTION=\"folders_rename_do.php\" METHOD=\"POST\">\n";
- echo _("New name:");
- echo "<br><B>$old_parent . </B><INPUT TYPE=TEXT SIZE=25 NAME=new_name VALUE=\"$old_name\"><BR>\n";
- if (isset($isfolder))
- echo "<INPUT TYPE=HIDDEN NAME=isfolder VALUE=\"true\">";
- printf("<INPUT TYPE=HIDDEN NAME=orig VALUE=\"%s\">\n", $old);
- printf("<INPUT TYPE=HIDDEN NAME=old_name VALUE=\"%s\">\n", $old_name);
- echo "<INPUT TYPE=SUBMIT VALUE=\""._("Submit")."\">\n";
- echo "</FORM><BR></TD></TR>";
- echo "</TABLE>";
+displayPageHeader($color, 'None');
+echo '<br />' .
+ html_tag( 'table', '', 'center', '', 'width="95%" border="0"' ) .
+ html_tag( 'tr',
+ html_tag( 'td', '<b>' . _("Rename a folder") . '</b>', 'center', $color[0] )
+ ) .
+ html_tag( 'tr' ) .
+ html_tag( 'td', '', 'center', $color[4] ) .
+ addForm('folders_rename_do.php').
+ _("New name:").
+ '<br /><b>' . htmlspecialchars($old_parent) . ' ' . htmlspecialchars($delimiter) . '</b>' .
+ addInput('new_name', $old_name, 25) . '<br />' . "\n";
+if ( $isfolder ) {
+ echo addHidden('isfolder', 'true');
+}
+echo addHidden('orig', $old).
+ addHidden('old_name', $old_name).
+ '<input type="submit" value="'._("Submit")."\" />\n".
+ '</form><br /></td></tr></table>';
- /** Log out this session **/
- sqimap_logout($imapConnection);
-?>
+?>
\ No newline at end of file