You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
153 lines
4.8 KiB
153 lines
4.8 KiB
4 months ago
|
<?php
|
||
|
/*
|
||
|
Copyright Intermesh 2004
|
||
|
Author: Merijn Schering <mschering@intermesh.nl>
|
||
|
Version: 1.0 Release date: 30 March 2004
|
||
|
|
||
|
This program is free software; you can redistribute it and/or modify it
|
||
|
under the terms of the GNU General Public License as published by the
|
||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||
|
option) any later version.
|
||
|
*/
|
||
|
|
||
|
require_once('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=yes,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'].'?initiated=true">';
|
||
|
$height = 0;
|
||
|
//if user uses the calendar then check for events to remind
|
||
|
$calendar_module = isset($GO_MODULES->modules['calendar']) ? $GO_MODULES->modules['calendar'] : false;
|
||
|
if ($calendar_module && $GO_MODULES->modules['calendar']['read_permission'])
|
||
|
{
|
||
|
require_once($calendar_module['class_path'].'calendar.class.inc');
|
||
|
$cal = new calendar();
|
||
|
if($remind_events = $cal->get_events_to_remind($GO_SECURITY->user_id))
|
||
|
{
|
||
|
$height += 160;
|
||
|
}
|
||
|
}else
|
||
|
{
|
||
|
$remind_events = false;
|
||
|
}
|
||
|
|
||
|
$todos_module = isset($GO_MODULES->modules['todos']) ? $GO_MODULES->modules['todos'] : false;
|
||
|
if ($todos_module && $GO_MODULES->modules['todos']['read_permission'])
|
||
|
{
|
||
|
require_once($todos_module['class_path'].'todos.class.inc');
|
||
|
$todos = new todos();
|
||
|
if($remind_todos = $todos->get_todos_to_remind($GO_SECURITY->user_id))
|
||
|
{
|
||
|
$height += 160;
|
||
|
}
|
||
|
}else
|
||
|
{
|
||
|
$remind_todos = false;
|
||
|
}
|
||
|
|
||
|
$_SESSION['notified_new_mail'] = isset($_SESSION['notified_new_mail']) ? $_SESSION['notified_new_mail'] : 0;
|
||
|
$_SESSION['new_mail'] = 0;
|
||
|
$remind_email = false;
|
||
|
if(($_SESSION['GO_SESSION']['start_module'] != 'summary' && $_SESSION['GO_SESSION']['start_module'] != 'email')
|
||
|
|| isset($_REQUEST['initiated']))
|
||
|
{
|
||
|
//check for email
|
||
|
$email_module = $GO_MODULES->get_module('email');
|
||
|
if ($email_module && ($GO_SECURITY->has_permission($GO_SECURITY->user_id, $email_module['acl_read']) ||
|
||
|
$GO_SECURITY->has_permission($GO_SECURITY->user_id, $email_module['acl_write'])))
|
||
|
{
|
||
|
require_once($email_module['class_path'].'email.class.inc');
|
||
|
require_once($GO_CONFIG->class_path.'mail/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'],$account['password'], '', 0, $account['use_ssl'], $account['novalidate_cert']))
|
||
|
{
|
||
|
if ($account['type'] == 'imap')
|
||
|
{
|
||
|
$_SESSION['unseen_in_mailbox'][$account['id']] = 0;
|
||
|
$status = $imap->status('INBOX');
|
||
|
if ($status->unseen > 0)
|
||
|
{
|
||
|
$_SESSION['unseen_in_mailbox'][$account['id']] += $status->unseen;
|
||
|
$_SESSION['new_mail'] += $status->unseen;
|
||
|
}
|
||
|
|
||
|
$email2->get_folders($email1->f('id'));
|
||
|
while($email2->next_record())
|
||
|
{
|
||
|
if ($email2->f('name') != 'INBOX')
|
||
|
{
|
||
|
$status = $imap->status($email2->f('name'));
|
||
|
if ($status->unseen > 0)
|
||
|
{
|
||
|
$_SESSION['unseen_in_mailbox'][$account['id']] += $status->unseen;
|
||
|
$_SESSION['new_mail'] += $status->unseen;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}else
|
||
|
{
|
||
|
$status = $imap->status('INBOX');
|
||
|
$_SESSION['unseen_in_mailbox'][$account['id']] = $status->unseen;
|
||
|
$_SESSION['new_mail'] += $status->unseen;
|
||
|
}
|
||
|
}else
|
||
|
{
|
||
|
$email2->disable_auto_check($account['id']);
|
||
|
echo '<script language="javascript" type="text/javascript">alert("'.$account['host'].' '.$ml_host_unreachable.'");</script>';
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if ($_SESSION['new_mail'] > 0 && $_SESSION['new_mail'] > $_SESSION['notified_new_mail'])
|
||
|
{
|
||
|
$remind_email = true;
|
||
|
$height += 120;
|
||
|
}
|
||
|
if($_SESSION['notified_new_mail'] > $_SESSION['new_mail'])
|
||
|
{
|
||
|
$_SESSION['notified_new_mail'] = $_SESSION['new_mail'];
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if ($remind_events || $remind_todos || $remind_email)
|
||
|
{
|
||
|
echo '<script language="javascript" type="text/javascript">'.
|
||
|
'popup("'.$GO_CONFIG->control_url.'reminder.php", "600", "'.$height.'", "reminder");'.
|
||
|
'</script>';
|
||
|
}
|
||
|
?>
|
||
|
<link rel="shortcut icon" href="<?php echo $GO_CONFIG->host; ?>lib/favicon.ico" />
|
||
|
</head>
|
||
|
<body></body>
|
||
|
</html>
|