home *** CD-ROM | disk | FTP | other *** search
- <?php
- require('Group-Office.php');
- $GO_SECURITY->authenticate();
- ?>
- <html>
- <head>
- <script language="javascript" type="text/javascript">
- <!-- Centring window Javascipt mods By Muffin Research Labs//-->
-
- function popup(url,w,h,target)
- {
- var centered;
- x = (screen.availWidth - w) / 2;
- y = (screen.availHeight - h) / 2;
- centered =',width=' + w + ',height=' + h + ',left=' + x + ',top=' + y + ',scrollbars=no,resizable=no,status=no';
- popup = window.open(url, target, centered);
- if (!popup.opener) popup.opener = self;
- popup.focus();
- }
- </script>
- <title><?php echo $GO_CONFIG->title; ?>
- </title>
- <?php
- echo '<meta http-equiv="refresh" content="'.$GO_CONFIG->refresh_rate.';url='.$_SERVER['PHP_SELF'].'">';
-
- //if user uses the calendar then check for events to remind
- if ($calendar_module = $GO_MODULES->get_module('calendar'))
- {
- require_once($GO_CONFIG->class_path.'calendar.class.inc');
- $header_cal = new calendar();
-
- $remind_events = $header_cal->get_events_to_remind($GO_SECURITY->user_id);
- if ($remind_events)
- {
- echo '<script language="javascript" type="text/javascript">popup("'.$calendar_module['url'].'reminder.php", "500", "200", "reminder");</script>';
- }
- unset($header_cal);
- }
-
- $_SESSION['notified_new_mail'] = isset($_SESSION['notified_new_mail']) ? $_SESSION['notified_new_mail'] : 0;
- $_SESSION['new_mail'] = 0;
- //check for email
- if ($email_module = $GO_MODULES->get_module('email'))
- {
- require_once($GO_CONFIG->class_path.'email.class.inc');
- require_once($GO_CONFIG->class_path.'imap.class.inc');
- $imap = new imap();
- $email1 = new email();
- $email2 = new email();
-
- $email1->get_accounts($GO_SECURITY->user_id);
-
- while($email1->next_record())
- {
- if ($email1->f('auto_check') == '1')
- {
- $account = $email1->Record;
-
- if ($imap->open($account['host'], $account['type'],$account['port'],$account['username'],$GO_CRYPTO->decrypt($account['password'])))
- {
-
- if ($account['type'] == 'imap')
- {
- $email2->get_folders($email1->f('id'));
- while($email2->next_record())
- {
- $status = $imap->status($email2->f('name'));
- if ($status->unseen > 0)
- {
- $_SESSION['new_mail'] += $status->unseen;
- }
- }
- }else
- {
- $status = $imap->status('INBOX');
- if ($status->unseen > 0)
- {
- $_SESSION['new_mail'] += $status->unseen;
- }
- }
- }else
- {
- $email->disable_auto_check($account['id']);
- echo '<script language="javascript" type="text/javascript">alert("'.$account['host'].' is unreachable. Autocheck disabled.");</script>';
- }
- }
- }
-
- if ($_SESSION['new_mail'] > 0 && $_SESSION['new_mail'] > $_SESSION['notified_new_mail'])
- {
- echo '<script language="javascript" type="text/javascript">popup("'.$email_module['url'].'notify.php", "400", "120", "email_notify");</script>';
- }
- }
- ?>
- </head>
- <body>
- </body>
- </html>