Make newmail plugin work again, various small cleanup and add ability for admin to...
[squirrelmail.git] / plugins / newmail / newmail.php
CommitLineData
4508b1b6 1<?php
4b4abf93 2
8d6a115b 3/**
ebe02dfc 4 * newmail.php - popup page
8d6a115b 5 *
8d6a115b 6 * Displays all options relating to new mail sounds
7 *
4b5049de 8 * @copyright &copy; 1999-2007 The SquirrelMail Project Team
4b4abf93 9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
ebe02dfc 10 * @version $Id$
ea5f4b8e 11 * @package plugins
12 * @subpackage newmail
8d6a115b 13 */
d0dbdb14 14
202bcbcc 15/**
16 * Path for SquirrelMail required files.
17 * @ignore
18 */
19require('../../include/init.php');
a9aa7ab7 20
c80190fc 21/**
22 * Make sure plugin is activated!
23 */
24global $plugins;
25if (!in_array('newmail', $plugins))
26 exit;
27
28/** load default config */
29if (file_exists(SM_PATH . 'plugins/newmail/config_default.php')) {
30 include_once(SM_PATH . 'plugins/newmail/config_default.php');
31}
32
33/** load config */
34if (file_exists(SM_PATH . 'config/newmail_config.php')) {
35 include_once(SM_PATH . 'config/newmail_config.php');
36} elseif (file_exists(SM_PATH . 'plugins/newmail/config.php')) {
37 include_once(SM_PATH . 'plugins/newmail/config.php');
38}
39
40 sqGetGlobalVar('numnew', $numnew, SQ_GET);
41 $numnew = (int)$numnew;
42
43 global $username, $org_title,
44 $newmail_popup_title_bar_singular, $newmail_popup_title_bar_plural;
45
46 // make sure default strings are in pot file
47 $ignore = _("New Mail");
48
49 $singular_title = "New Mail";
50 $plural_title = "New Mail";
51 if (!empty($newmail_popup_title_bar_singular))
52 $singular_title = $newmail_popup_title_bar_singular;
53 if (!empty($newmail_popup_title_bar_plural))
54 $plural_title = $newmail_popup_title_bar_plural;
55 list($singular_title, $plural_title) = str_replace(array('###USERNAME###', '###ORG_TITLE###'), array($username, $org_title), array($singular_title, $plural_title));
56 $title = sprintf(ngettext($singular_title, $plural_title, $numnew), $numnew);
57
7c15c446 58
c80190fc 59 displayHtmlHeader( $title, '', FALSE );
a9aa7ab7 60
6fd95361 61 echo '<body bgcolor="'.$color[4].'" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0">'."\n".
f265009a 62 '<div style="text-align: center;">'. "\n" .
4cf43843 63 html_tag( 'table', "\n" .
64 html_tag( 'tr', "\n" .
47f7f1e7 65 // i18n: %s inserts the organisation name (typically SquirrelMail)
66 html_tag( 'td', '<b>' . sprintf(_("%s notice:"), $org_name) . '</b>', 'center', $color[0] )
4cf43843 67 ) .
68 html_tag( 'tr', "\n" .
69 html_tag( 'td',
c5a2a440 70 '<br /><big><font color="' . $color[2] . '">'.
71 sprintf(ngettext("You have %s new message","You have %s new messages",$numnew), $numnew ) .
72 '</font><br /></big><br />' . "\n" .
73 '<form name="nm">' . "\n".
74 '<input type="button" name="bt" value="' . _("Close Window") .
c435f076 75 '" onclick="javascript:window.close();" />'."\n".
c5a2a440 76 '</form>',
77 'center' )
78 ) ,
79 '', '', 'width="100%" cellpadding="2" cellspacing="2" border="0"' ) .
f265009a 80 '</div>' .
2c92ea9d 81 "<script type=\"text/javascript\">\n".
c5a2a440 82 "<!--\n".
83 "document.nm.bt.focus();\n".
84 "-->\n".
85 "</script>\n".
86 "</body></html>\n";