close.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:3k
- <?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: close.php,v $
- // | $Date: 2004/02/10 01:34:25 $
- // | $Revision: 1.15 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - Old ticket expiration (auto-close).
- // +-------------------------------------------------------------+
- error_reporting(E_ALL ^ E_NOTICE);
- cron_check();
- ############################### CLOSE USER AWAITING REPLY TICKETS ###############################
- if ($options['days_user_reply'] != "0" AND $options['days_user_reply'] != "") {
- $report .= "Auto-closed because last user response was more than $options[days_user_reply] days ago:nn";
-
- $expire_date = mktime() - ($options['days_user_reply'] * 60 * 60 * 24);
-
- $db->query("
- SELECT * FROM ticket
- WHERE !awaiting_tech
- AND date_reply < '$expire_date'
- AND is_open
- ");
-
- while ($ticket = $db->row_array()) {
-
- $user_details = $db2->query("SELECT * user WHERE id = '$ticket[userid]'");
- $db2->query("UPDATE ticket SET
- is_open = '0',
- awaiting_reply = '0'
- WHERE id = '$ticket[id]'
- ");
- ticketlog($id, 'close');
- $report .= "Ticket $ticket[id] closedn";
-
- if ($options['notify_user'] == "1") {
- $user_details = update_user_details($user_details);
- eval(makeemaileval('body', 'BODY_question_closed', $subject));
- dp_mail($user_details['email'], $subject, $body);
- }
- }
- }
- ############################### CLOSE TECH AWAITING REPLY TICKETS ###############################
- if ($options['days_tech_reply'] != "0" AND $options['days_tech_reply'] != "") {
- $report .= "Auto-closed because last technician response was more thann$options[days_user_reply] days ago:nn";
-
- $expire_date = mktime() - ($options['days_tech_reply'] * 60 * 60 * 24);
-
- $db->query("
- SELECT * FROM ticket
- WHERE awaiting_tech
- AND date_reply < '$expire_date'
- AND is_open
- ");
-
- while ($ticket = $db->row_array()) {
-
- $user_details = $db2->query("SELECT * user WHERE id = '$ticket[userid]'");
- $db2->query("UPDATE ticket SET
- is_open = '0',
- awaiting_reply = '0'
- WHERE id = '$ticket[id]'
- ");
- ticketlog($id, 'close');
-
- $report .= "Ticket $ticket[id] closedn";
-
- if ($options['notify_user'] == "1") {
- $user_details = update_user_details($user_details);
- eval(makeemaileval('body', 'BODY_question_closed', $subject));
- dp_mail($ticket['email'], $subject, $body);
- }
- }
- }
- //////////////////// PART 6: SEND EMAIL TO ADMIN ////////////////////
- if ($options['email_log'] AND $report) {
- dp_mail($options['email_log'], "$settings[site_name]Automatic Ticket Closure Report", $report, "From: $email_report");
- }