popup.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:4k
- <?php
- // +-------------------------------------------------------------+
- // | DeskPRO v [2.0.1 Production]
- // | Copyright (C) 2001 - 2004 Headstart Solutions Limited
- // | Supplied by WTN-WDYL
- // | Nullified by WTN-WDYL
- // | Distribution via WebForum, ForumRU and associated file dumps
- // +-------------------------------------------------------------+
- // | DESKPRO IS NOT FREE SOFTWARE
- // +-------------------------------------------------------------+
- // | License ID : Full Enterprise License =) ...
- // | License Owner : WTN-WDYL Team
- // +-------------------------------------------------------------+
- // | $RCSfile: popup.php,v $
- // | $Date: 2004/02/10 01:34:29 $
- // | $Revision: 1.23 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - Popup alert.
- // +-------------------------------------------------------------+
- error_reporting(E_ALL ^ E_NOTICE);
- include "./../global.php";
- tech_mini_header('Your notifications');
- if ($_REQUEST['time']) {
- $time = $_REQUEST['time'];
- } else {
- $time = mktime() - ($user['alert_frequency'] * 60); $result = 0;
- }
- $newtickets = 0;
- $replycount = 0;
- $pm = 0;
- $tickets = array();
- $msgs = array();
- $replies = array();
- $yourreps = array();
- $db->query("
- SELECT id, subject
- FROM ticket
- WHERE is_open
- AND !tech
- AND date_opened >= '$time'
- ");
- $newtickets = $db->num_rows();
- if ($newtickets) {
- while ($res = $db->row_array() AND $i < 6) {
- $i++;
- $tickets[$res['id']] = $res;
- $matched[] = $res['id'];
- }
- }
- // replies to tickets
- if ($user['alert_reply_all'] == "1") {
-
- $db->query("
- SELECT ticket.id AS id, ticket.subject AS subject
- FROM ticket_message, ticket
- WHERE ticket.id = ticket_message.ticketid
- AND date > '$time'
- AND ticket_message.userid
- GROUP BY ticketid
- ");
- $replycount = $db->num_rows();
- while ($res = $db->row_array()) {
- if (!@in_array($res['id'], $matched)) {
- $replies[$res['id']] = $res;
- } else {
- $replycount--;
- }
- }
- } elseif ($user['alert_reply_your'] == "1") {
-
- $db->query("
- SELECT ticket.id AS id, ticket.subject AS subject
- FROM ticket_message, ticket
- WHERE ticket.id = ticket_message.ticketid
- AND techid = '$user[id]'
- AND date > '$time'
- AND ticket_message.userid
- GROUP BY ticketid
- ");
- $replycount = $db->num_rows();
- while ($res = $db->row_array()) {
- if (!in_array($res['id'], $matched)) {
- $replies[$res['id']] = $res;
- } else {
- $replycount--;
- }
- }
- }
-
- $db->query("
- SELECT pm_source.id AS id, techid, message
- FROM pm_relations, pm_source
- WHERE techid = '$user[id]'
- AND timestamp > '$time'
- AND pm_relations.pmid = pm_source.id
- AND !is_read
- ");
- $pm = $db->num_rows();
- while ($res = $db->row_array()) {
- $msgs[] = $res;
- }
- function display_tickets($tickets) {
- foreach ($tickets AS $key => $var) {
- if (strlen($var['subject']) > 30) {
- $var['subject'] = substr($var['subject'], 0, 30) . '...';
- }
- $ret .= " <A HREF="#" onClick='window.opener.parent.center.location="../tickets/ticketview.php?id=$var[id]"; window.opener.parent.cache.location="autoload.php"; return true;'>$var[subject]</A><BR>";
- }
- return $ret;
- }
- function display_messages($messages) {
- foreach ($messages AS $key => $var) {
- if (strlen($var) > 30) {
- $var = substr($var, 0, 30) . '...';
- }
- $ret .= " <A HREF="#" onClick='window.opener.parent.center.location="../teamwork/pms.php?id=$var[id]"; window.opener.parent.cache.location="autoload.php"; return true;'>$var[subject]</A><BR>";
- }
- return $ret;
- }
- $table[] = array("<br /> <b>$newtickets Tickets</b><br>" . display_tickets($tickets) . '<br />');
- $table[] = array("<br /> <b>$replycount Replies</b><br>" . display_tickets($replies). '<br />');
- $table[] = array("<br /> <b>$pm Messages</b><br>" . display_messages($msgs). '<br />');
- echo table_list("Your Alerts", $table);
- echo "<BR><center><A HREF="#" onClick='window.close()'>Close Window</A></center>";
- ?>