From 2d4c15d6b854bc84614efe8560f5ac5c83ba0595 Mon Sep 17 00:00:00 2001 From: philippe_mingo Date: Thu, 15 Nov 2001 17:06:22 +0000 Subject: [PATCH] Officialization step 1 git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1763 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- plugins/newmail/newmail.php | 68 +++++++------- plugins/newmail/newmail_opt.php | 17 ++-- plugins/newmail/setup.php | 159 ++++++++++++++++---------------- plugins/newmail/testsound.php | 20 +++- 4 files changed, 145 insertions(+), 119 deletions(-) diff --git a/plugins/newmail/newmail.php b/plugins/newmail/newmail.php index 4a9ab308..ce3a9247 100644 --- a/plugins/newmail/newmail.php +++ b/plugins/newmail/newmail.php @@ -1,36 +1,40 @@ - -New Mail - topmargin=0 leftmargin=0 -rightmargin=0 marginwidth=0 marginheight=0> -
- - - - - - -
> -
SquirrelMail Notice:
-
-
-
- >You have new -mail!
-
- -
-
-
-
- - + + echo "\n". + '' . _("New Mail") . "\n". + "\n". + '
'. + "\n". + "\n". + "\n". + "\n". + "
\n". + '
' . _("SquirrelMail Notice:") . "
\n". + "

" . + _("You have new mail!") . "
\n". + "
\n". + ''. + "
\n". + "\n". + "\n"; + +?> \ No newline at end of file diff --git a/plugins/newmail/newmail_opt.php b/plugins/newmail/newmail_opt.php index 0f942fc8..8266f3f5 100644 --- a/plugins/newmail/newmail_opt.php +++ b/plugins/newmail/newmail_opt.php @@ -1,18 +1,23 @@ 0) { - $unseen_found = 1; - } - } - return $unseen_found; - } + if ($unseen > 0) { + $unseen_found = 1; + } + } + return( $unseen_found ); + } function squirrelmail_plugin_init_newmail() { global $squirrelmail_plugin_hooks; @@ -123,41 +127,41 @@ function newmail_sav() { } else { setPref($data_dir,$username,"newmail_media",""); } - echo "
New Mail Notification options saved
"; + echo '
' . _("New Mail Notification options saved") . '
'; } } -function newmail_pref() { - - global $username,$data_dir; - global $newmail_media,$newmail_enable,$newmail_popup,$newmail_allbox; - global $newmail_recent, $newmail_changetitle; - - $newmail_recent = getPref($data_dir,$username,"newmail_recent"); - $newmail_enable = getPref($data_dir,$username,"newmail_enable"); - $newmail_media = getPref($data_dir, $username, "newmail_media"); - $newmail_popup = getPref($data_dir, $username, "newmail_popup"); - $newmail_allbox = getPref($data_dir, $username, "newmail_allbox"); - $newmail_changetitle = getPref($data_dir, $username, "newmail_changetitle"); - - if ($newmail_media == "") - { - $newmail_media = "../plugins/newmail/sounds/Notify.wav"; - } - -} + function newmail_pref() { + + global $username,$data_dir; + global $newmail_media,$newmail_enable,$newmail_popup,$newmail_allbox; + global $newmail_recent, $newmail_changetitle; + + $newmail_recent = getPref($data_dir,$username,'newmail_recent'); + $newmail_enable = getPref($data_dir,$username,'newmail_enable'); + $newmail_media = getPref($data_dir, $username, 'newmail_media'); + $newmail_popup = getPref($data_dir, $username, 'newmail_popup'); + $newmail_allbox = getPref($data_dir, $username, 'newmail_allbox'); + $newmail_changetitle = getPref($data_dir, $username, 'newmail_changetitle'); + + if ($newmail_media == '') { + $newmail_media = '../plugins/newmail/sounds/Notify.wav'; + } + + } function newmail_plugin() { global $username,$key,$imapServerAddress,$imapPort; global $newmail_media,$newmail_enable,$newmail_popup,$newmail_recent; global $newmail_changetitle; + global $imapConnection; - if ($newmail_enable == "on" || $newmail_popup == "on" || $newmail_changetitle) { + if ($newmail_enable == 'on' || $newmail_popup == 'on' || $newmail_changetitle) { // open a connection on the imap port (143) - $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output + // $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10); // the 10 is to hide the output $boxes = sqimap_mailbox_list($imapConnection); $delimeter = sqimap_get_delimiter($imapConnection); @@ -166,54 +170,55 @@ function newmail_plugin() { $totalNew = 0; for ($i = 0;$i < count($boxes); $i++) { - $line = ""; - $mailbox = $boxes[$i]["formatted"]; + + $line = ''; + $mailbox = $boxes[$i]['formatted']; if (! isset($boxes[$i]['unseen'])) $boxes[$i]['unseen'] = ''; - if ($boxes[$i]["flags"]) { + if ($boxes[$i]['flags']) { $noselect = false; - for ($h = 0; $h < count($boxes[$i]["flags"]); $h++) { - if (strtolower($boxes[$i]["flags"][$h]) == "noselect") + for ($h = 0; $h < count($boxes[$i]['flags']); $h++) { + if (strtolower($boxes[$i]["flags"][$h]) == 'noselect') $noselect = true; } if (! $noselect) { $status = $status + CheckNewMailboxSound($imapConnection, $mailbox, - $boxes[$i]["unformatted"], $delimeter, $boxes[$i]["unseen"], + $boxes[$i]['unformatted'], $delimeter, $boxes[$i]['unseen'], $totalNew); } } else { - $status = $status + CheckNewMailboxSound($imapConnection, $mailbox, $boxes[$i]["unformatted"], - $delimeter, $boxes[$i]["unseen"], $totalNew); + $status = $status + CheckNewMailboxSound($imapConnection, $mailbox, $boxes[$i]['unformatted'], + $delimeter, $boxes[$i]['unseen'], $totalNew); } } - sqimap_logout($imapConnection); + + // sqimap_logout($imapConnection); // If we found unseen messages, then we // will play the sound as follows: - if ($newmail_changetitle) { -?> - - 0 && $newmail_enable == "on") { - echo ""; - } - if ($status >0 && $newmail_popup == "on") { + if ($newmail_changetitle) { + echo "\n"; + } + + if ($status > 0 && $newmail_enable == 'on') { + echo ""; + } + if ($status >0 && $newmail_popup == 'on') { ?>