From: tokul Date: Wed, 6 Apr 2005 10:36:00 +0000 (+0000) Subject: hiding default prefix in operations with folders. It is not visible in other X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=aa00e64833bf7bfa864f691421fc59a02b712b94 hiding default prefix in operations with folders. It is not visible in other parts of interface git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@9207 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/folder_manip.php b/functions/folder_manip.php index 46ba4b9d..67625d34 100644 --- a/functions/folder_manip.php +++ b/functions/folder_manip.php @@ -1,19 +1,19 @@ '._("Click here to go back").'.', $color); - + sqimap_logout($imapConnection); - exit; + exit; } } @@ -74,7 +74,7 @@ function folders_create ($imapConnection, $delimiter, $folder_name, $subfolder, * folder should be renamed to. */ function folders_rename_getname ($imapConnection, $delimiter, $old) { - global $color; + global $color,$default_folder_prefix; if ( $old == '' ) { plain_error_message(_("You have not selected a folder to rename. Please do so."). @@ -94,7 +94,15 @@ function folders_rename_getname ($imapConnection, $delimiter, $old) { if (strpos($old, $delimiter)) { $old_name = substr($old, strrpos($old, $delimiter)+1, strlen($old)); - $old_parent = substr($old, 0, strrpos($old, $delimiter)); + // hide default prefix (INBOX., mail/ or other) + $quoted_prefix=preg_quote($default_folder_prefix,'/'); + $prefix_length=(preg_match("/^$quoted_prefix/",$old) ? strlen($default_folder_prefix) : 0); + if ($prefix_length>strrpos($old, $delimiter)) { + $old_parent = ''; + } else { + $old_parent = substr($old, $prefix_length, (strrpos($old, $delimiter)-$prefix_length)) + . ' ' . $delimiter; + } } else { $old_name = $old; $old_parent = ''; @@ -110,7 +118,7 @@ function folders_rename_getname ($imapConnection, $delimiter, $old) { addForm('folders.php'). addHidden('smaction', 'rename'). _("New name:"). - '
' . htmlspecialchars($old_parent) . ' ' . htmlspecialchars($delimiter) . '' . + '
' . htmlspecialchars($old_parent) . '' . addInput('new_name', $old_name, 25) . '

' . "\n"; if ( $isfolder ) { echo addHidden('isfolder', 'true'); @@ -170,7 +178,7 @@ function folders_rename_do($imapConnection, $delimiter, $orig, $old_name, $new_n */ function folders_delete_ask ($imapConnection, $folder_name) { - global $color; + global $color,$default_folder_prefix; if ($folder_name == '') { plain_error_message(_("You have not selected a folder to delete. Please do so."). @@ -178,6 +186,12 @@ function folders_delete_ask ($imapConnection, $folder_name) exit; } + // hide default folder prefix (INBOX., mail/ or other) + $visible_folder_name = imap_utf7_decode_local($folder_name); + $quoted_prefix = preg_quote($default_folder_prefix,'/'); + $prefix_length = (preg_match("/^$quoted_prefix/",$visible_folder_name) ? strlen($default_folder_prefix) : 0); + $visible_folder_name = substr($visible_folder_name,$prefix_length); + echo '
' . html_tag( 'table', '', 'center', '', 'width="95%" border="0"' ) . html_tag( 'tr', @@ -186,8 +200,7 @@ function folders_delete_ask ($imapConnection, $folder_name) html_tag( 'tr' ) . html_tag( 'td', '', 'center', $color[4] ) . sprintf(_("Are you sure you want to delete %s?"), - str_replace(array(' ','<','>'),array(' ','<','>'), - imap_utf7_decode_local($folder_name))). + str_replace(array(' ','<','>'),array(' ','<','>'),$visible_folder_name)). addForm('folders.php', 'post')."

\n". addHidden('smaction', 'delete'). addHidden('folder_name', $folder_name).