X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fleft_main.php;h=d80fdd781590391ca48b72dd392d791c4aa2c709;hb=f7196031c2f53609c6f0e6886dbd45d5f9b7e914;hp=9e5cbc0379a69e74a2f2be45d13fe70cb3eda2ac;hpb=b9d121d2b12f5c9cc23f5a483b290c1966659114;p=squirrelmail.git diff --git a/src/left_main.php b/src/left_main.php index 9e5cbc03..d80fdd78 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -1,119 +1,92 @@ ', + $color[8], $color[4], $color[7], $color[7], $color[7]); + echo ""; exit; } - // Configure the left frame for the help menu - // Maybe this should be a function but since I haven't done one it isn't - - $ishelp = substr(getenv(REQUEST_URI),-8); // take the right 8 characters from the requested URL - if ($ishelp == "help.php") { - if (!isset($config_php)) - include("../config/config.php"); - if (!isset($i18n_php)) - include("../functions/i18n.php"); - include("../src/load_prefs.php"); - echo ""; - echo "\n"; - $left_size = 250; //doesn't seem to work - /** - ** Array used to list the include .hlp files, we could use a dir function - ** to step through the directory and list its contents but it doesn't order those. - ** This should probably go in config.php but it might mess up conf.pl - **/ - $helpdir[0] = "basic.hlp"; - $helpdir[1] = "main_folder.hlp"; - $helpdir[2] = "read_mail.hlp"; - $helpdir[3] = "addresses.hlp"; - $helpdir[4] = "compose.hlp"; - $helpdir[5] = "folders.hlp"; - $helpdir[6] = "options.hlp"; - $helpdir[7] = "FAQ.hlp"; - - /** - ** Build a menu dynamically for the left frame from the HTML tagged right frame include (.hlp) files listed in the $helpdir var. - ** This is done by first listing all the .hlp files in the $helpdir array. - ** Next, we loop through the array, for every value of $helpdir we loop through the file and look for anchor tags ( or

). - **/ - - if (!file_exists("../help/$user_language")) // If the selected language doesn't exist, use english - $user_language = "en"; - - - while ( list( $key, $val ) = each( $helpdir ) ) { // loop through the array of files - $fcontents = file("../help/$user_language/$val"); // assign each line of the above file to another array - while ( list( $line_num, $line ) = each( $fcontents ) ) { // loop through the second array - $temphed=""; - $tempanc=""; - if ( eregi("", "", $tempanc); - echo ""; - } - if ( eregi("

", $line, $temphed)) { // grab a description for the link made above - $temphed = $line; - $temphed = ereg_replace("

", "", $temphed); - $temphed = ereg_replace("

", "", $temphed); - echo "
"; - echo "" . _("$temphed") . "

\n"; // make it bigger since it is a heading type 1 - } - if ( eregi("

", $line, $temphed)) { // grab a description for the link made above - $temphed = $line; - $temphed = ereg_replace("

", "", $temphed); - $temphed = ereg_replace("

", "", $temphed); - echo "" . _("$temphed") . "
\n"; // keep same size since it is a normal entry - } - } - } - } else { + + if (!isset($strings_php)) + include("../functions/strings.php"); if (!isset($config_php)) include("../config/config.php"); if (!isset($array_php)) include("../functions/array.php"); - if (!isset($strings_php)) - include("../functions/strings.php"); if (!isset($imap_php)) include("../functions/imap.php"); if (!isset($page_header_php)) include("../functions/page_header.php"); if (!isset($i18n_php)) include("../functions/i18n.php"); + if (!isset($plugin_php)) + include("../functions/plugin.php"); + // open a connection on the imap port (143) + $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output + + /** If it was a successful login, lets load their preferences **/ + include("../src/load_prefs.php"); displayHtmlHeader(); function formatMailboxName($imapConnection, $mailbox, $real_box, $delimeter, $unseen) { - global $folder_prefix, $trash_folder, $sent_folder; - global $color, $move_to_sent, $move_to_trash; - + global $folder_prefix, $trash_folder, $sent_folder; + global $color, $move_to_sent, $move_to_trash; + global $unseen_notify, $unseen_type; + $mailboxURL = urlencode($real_box); - if($real_box=="INBOX") { - $unseen = sqimap_unseen_messages($imapConnection, $numUnseen, $real_box); - } - - $line .= ""; + + if ($unseen_notify == 2 && $real_box == "INBOX") { + $unseen = sqimap_unseen_messages($imapConnection, $numUnseen, $real_box); + if ($unseen_type == 1 && $unseen > 0) { + $unseen_string = "($unseen)"; + $unseen_found = true; + } else if ($unseen_type == 2) { + $numMessages = sqimap_get_num_messages($imapConnection, $real_box); + $unseen_string = "($unseen/$numMessages)"; + $unseen_found = true; + } + } else if ($unseen_notify == 3) { + $unseen = sqimap_unseen_messages($imapConnection, $numUnseen, $real_box); + if ($unseen_type == 1 && $unseen > 0) { + $unseen_string = "($unseen)"; + $unseen_found = true; + } else if ($unseen_type == 2) { + $numMessages = sqimap_get_num_messages($imapConnection, $real_box); + $unseen_string = "($unseen/$numMessages)"; + $unseen_found = true; + } + } + + $line = ""; if ($unseen > 0) $line .= ""; $special_color = false; - if ((strtolower($real_box) == "inbox") || - (($real_box == $trash_folder) && ($move_to_trash)) || - (($real_box == $sent_folder) && ($move_to_sent))) - $special_color = true; - + if ((strtolower($real_box) == "inbox") || + (($real_box == $trash_folder) && ($move_to_trash)) || + (($real_box == $sent_folder) && ($move_to_sent))) + $special_color = true; + if ($special_color == true) { $line .= ""; $line .= replace_spaces($mailbox); @@ -126,34 +99,30 @@ if ($unseen > 0) $line .= ""; - - if ($unseen > 0) { - $line .= " ($unseen)"; + + if (isset($unseen_found) && $unseen_found) { + $line .= " $unseen_string"; } if (($move_to_trash == true) && ($real_box == $trash_folder)) { $urlMailbox = urlencode($real_box); $line .= "\n\n"; - $line .= "     ("._("purge").")"; + $line .= "   ("._("purge").")"; $line .= "\n\n"; } $line .= ""; return $line; } - // open a connection on the imap port (143) - $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output - - /** If it was a successful login, lets load their preferences **/ - include("../src/load_prefs.php"); - if (isset($left_refresh) && ($left_refresh != "None") && ($left_refresh != "")) { echo "\n"; echo "\n"; echo "\n"; } - echo "\n\n\n"; + echo "\n\n"; + + do_hook("left_main_before"); $boxes = sqimap_mailbox_list($imapConnection); @@ -168,29 +137,19 @@ for ($i = 0;$i < count($boxes); $i++) { $line = ""; $mailbox = $boxes[$i]["formatted"]; - - if ($boxes[$i]["flags"]) { - $noselect = false; - for ($h = 0; $h < count($boxes[$i]["flags"]); $h++) { - if (strtolower($boxes[$i]["flags"][$h]) == "noselect") - $noselect = true; - } - if ($noselect == true) { - $line .= ""; - $line .= replace_spaces(readShortMailboxName($mailbox, $delimeter)); - $line .= ""; - } else { - $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $boxes[$i]["unseen"]); - } + + if (in_array('noselect', $boxes[$i]['flags'])) { + $line .= ""; + $line .= replace_spaces($mailbox); + $line .= ''; } else { + if (! isset($boxes[$i]['unseen'])) + $boxes[$i]['unseen'] = ''; $line .= formatMailboxName($imapConnection, $mailbox, $boxes[$i]["unformatted"], $delimeter, $boxes[$i]["unseen"]); } - echo "\n$line
\n"; + echo "$line
\n"; } - - - fclose($imapConnection); - - } + sqimap_logout($imapConnection); + do_hook("left_main_after"); ?>