squirrelmail-webmail  1.4.22
About: SquirrelMail is a standards-based webmail package with strong MIME support, address books, and folder manipulation (written in PHP4).
  Fossies Dox: squirrelmail-webmail-1.4.22.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

folders_rename_getname.php
Go to the documentation of this file.
1 <?php
2 
16 define('PAGE_NAME', 'folders_rename_getname');
17 
22 define('SM_PATH','../');
23 
24 /* SquirrelMail required files. */
25 require_once(SM_PATH . 'include/validate.php');
26 require_once(SM_PATH . 'functions/global.php');
27 require_once(SM_PATH . 'functions/imap_mailbox.php');
28 require_once(SM_PATH . 'functions/html.php');
29 require_once(SM_PATH . 'functions/display_messages.php');
30 require_once(SM_PATH . 'functions/forms.php');
31 
32 /* get globals we may need */
33 sqgetGlobalVar('key', $key, SQ_COOKIE);
34 sqgetGlobalVar('username', $username, SQ_SESSION);
35 sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION);
36 sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
37 sqgetGlobalVar('old', $old, SQ_POST);
38 /* end of get globals */
39 
40 if ($old == '') {
41  displayPageHeader($color, 'None');
42 
43  plain_error_message(_("You have not selected a folder to rename. Please do so.").
44  '<br /><a href="../src/folders.php">'._("Click here to go back").'</a>.', $color);
45  exit;
46 }
47 
48 if (substr($old, strlen($old) - strlen($delimiter)) == $delimiter) {
49  $isfolder = TRUE;
50  $old = substr($old, 0, strlen($old) - 1);
51 } else {
52  $isfolder = FALSE;
53 }
54 
56 
57 // displayable mailbox format is without folder prefix on front
59 if (substr($old, 0, strlen($folder_prefix)) == $folder_prefix) {
60  $displayable_old = substr($old, strlen($folder_prefix));
61 } else {
62  $displayable_old = $old;
63 }
64 
65 if (strpos($displayable_old, $delimiter)) {
66  $old_name = substr($displayable_old, strrpos($displayable_old, $delimiter)+1);
67  $parent = htmlspecialchars(substr($displayable_old,
68  0,
69  strrpos($displayable_old, $delimiter))
70  . ' ' . $delimiter);
71 } else {
72  $old_name = $displayable_old;
73  $parent = '';
74 }
75 
76 
77 displayPageHeader($color, 'None');
78 echo '<br />' .
79  html_tag( 'table', '', 'center', '', 'width="95%" border="0"' ) .
80  html_tag( 'tr',
81  html_tag( 'td', '<b>' . _("Rename a folder") . '</b>', 'center', $color[0] )
82  ) .
83  html_tag( 'tr' ) .
84  html_tag( 'td', '', 'center', $color[4] ) .
85  addForm('folders_rename_do.php', 'post', '', '', '', '', TRUE).
86  _("New name:").
87  '<br /><b>'. $parent . '</b>'.
88  addInput('new_name', $old_name, 25) . '<br />' . "\n";
89 if ( $isfolder ) {
90  echo addHidden('isfolder', 'true');
91 }
92 echo addHidden('orig', $old).
93  addHidden('old_name', $old_name).
94  '<input type="submit" value="'._("Submit")."\" />\n".
95  '</form><br /></td></tr></table>';
96 
plain_error_message
plain_error_message($message, $color)
Definition: display_messages.php:40
sqgetGlobalVar
sqgetGlobalVar($name, &$value, $search=SQ_INORDER)
Definition: global.php:344
html_tag
html_tag( $tag, $val='', $align='', $bgcolor='', $xtra='')
Definition: html.php:27
$folder_prefix
global $folder_prefix
Definition: folders_rename_getname.php:58
SM_PATH
const SM_PATH
Definition: folders_rename_getname.php:22
SQ_SESSION
const SQ_SESSION
Definition: global.php:18
displayPageHeader
displayPageHeader($color, $mailbox, $xtra='', $session=false)
Definition: page_header.php:105
addForm
addForm($action, $method='post', $name='', $enctype='', $charset='', $extra='', $add_token=FALSE)
Definition: forms.php:150
$username
global $username
Definition: validate.php:55
addInput
addInput($name, $value='', $size=0, $maxlength=0, $extra_attributes='')
Definition: forms.php:65
$parent
$parent
Definition: folders_rename_getname.php:73
addHidden
addHidden($name, $value)
Definition: forms.php:58
$old
$old
Definition: folders_rename_getname.php:55
SQ_POST
const SQ_POST
Definition: global.php:17
exit
exit
Definition: help.php:128
imap_utf7_decode_local
imap_utf7_decode_local($s)
Definition: imap_utf7_local.php:88
_
_($str)
Definition: gettext.php:160
$color
$color
Definition: load_prefs.php:28
$old_name
$old_name
Definition: folders_rename_do.php:59
SQ_COOKIE
const SQ_COOKIE
Definition: global.php:19