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_do.php
Go to the documentation of this file.
1 <?php
2 
16 define('PAGE_NAME', 'folders_rename_do');
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.php');
28 require_once(SM_PATH . 'functions/display_messages.php');
29 
30 /* globals */
31 sqgetGlobalVar('key', $key, SQ_COOKIE);
32 sqgetGlobalVar('username', $username, SQ_SESSION);
33 sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
34 sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION);
35 sqgetGlobalVar('orig', $orig, SQ_POST);
36 sqgetGlobalVar('old_name', $old_name, SQ_POST);
37 sqgetGlobalVar('new_name', $new_name, SQ_POST);
38 if (!sqgetGlobalVar('smtoken',$submitted_token, SQ_POST)) {
39  $submitted_token = '';
40 }
41 /* end globals */
42 
43 // first, validate security token
44 sm_validate_security_token($submitted_token, 3600, TRUE);
45 
47 
48 if (substr_count($new_name, '"') || substr_count($new_name, "\\") ||
49  substr_count($new_name, $delimiter) || ($new_name == '')) {
50  displayPageHeader($color, 'None');
51 
52  plain_error_message(_("Illegal folder name. Please select a different name.").
53  '<br /><a href="../src/folders.php">'._("Click here to go back").'</a>.', $color);
54 
55  exit;
56 }
57 
61 
62 if ($old_name <> $new_name) {
63 
65 
66  if (strpos($orig, $delimiter)) {
67  $old_dir = substr($orig, 0, strrpos($orig, $delimiter));
68  } else {
69  $old_dir = '';
70  }
71 
72  if ($old_dir != '') {
73  $newone = $old_dir . $delimiter . $new_name;
74  } else {
75  $newone = $new_name;
76  }
77 
78  // Renaming a folder doesn't rename the folder but leaves you unsubscribed
79  // at least on Cyrus IMAP servers.
80  if (isset($isfolder)) {
81  $newone = $newone.$delimiter;
82  $orig = $orig.$delimiter;
83  }
85 
86  // Log out this session
88 
89 }
90 
91 header ('Location: ' . get_location() . '/folders.php?success=rename');
92 
plain_error_message
plain_error_message($message, $color)
Definition: display_messages.php:40
sqgetGlobalVar
sqgetGlobalVar($name, &$value, $search=SQ_INORDER)
Definition: global.php:344
$new_name
$new_name
Definition: folders_rename_do.php:46
$imapConnection
$imapConnection
Definition: message_details_bottom.php:74
$imapServerAddress
$imapServerAddress
Definition: config_default.php:202
sqimap_login
sqimap_login($username, $password, $imap_server_address, $imap_port, $hide)
Definition: imap_general.php:481
SQ_SESSION
const SQ_SESSION
Definition: global.php:18
displayPageHeader
displayPageHeader($color, $mailbox, $xtra='', $session=false)
Definition: page_header.php:105
$username
global $username
Definition: validate.php:55
sqimap_mailbox_rename
sqimap_mailbox_rename( $imap_stream, $old_name, $new_name)
Definition: imap_mailbox.php:361
sm_validate_security_token
sm_validate_security_token($token, $validity_period=0, $show_error=FALSE)
Definition: strings.php:1405
sqimap_logout
sqimap_logout($imap_stream)
Definition: imap_general.php:639
$orig
if(substr_count($new_name, '"') || substr_count($new_name, "\\") || substr_count($new_name, $delimiter) || ($new_name == '')) $orig
Definition: folders_rename_do.php:58
SQ_POST
const SQ_POST
Definition: global.php:17
exit
exit
Definition: help.php:128
_
_($str)
Definition: gettext.php:160
imap_utf7_encode_local
imap_utf7_encode_local($s)
Definition: imap_utf7_local.php:35
$imapPort
$imapPort
Definition: config_default.php:210
$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
get_location
get_location()
Definition: strings.php:340
SM_PATH
const SM_PATH
Definition: folders_rename_do.php:22