errors.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:5k
- <?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: errors.php,v $
- // | $Date: 2004/02/11 01:28:14 $
- // | $Revision: 1.23 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - View and purge e-mail gateway error logs (administration
- // | interface)
- // +-------------------------------------------------------------+
- error_reporting(E_ALL & ~E_NOTICE);
- require_once('./global.php');
- //Nullify WTN-WDYL Team
- if ($_REQUEST['do'] == 'clearall') {
- $db->query("SELECT sourceid FROM gateway_error");
- $sources = array();
- while ($res = $db->row_array()) {
- $sources[] = $res['sourceid'];
- }
- if (count($sources)) {
- $sources = array2sql($sources);
- $db->query("DELETE FROM gateway_source WHERE id IN $sources");
- $db->query("DELETE FROM gateway_error");
- $db->query("UPDATE ticket_message SET sourceid = 0 WHERE sourceid IN $sources");
- $db->query("DELETE FROM gateway_auto");
- }
- $alert = 'Gateway errors and related source messages deleted.';
-
- alert($alert);
- unset($_REQUEST['do']);
- }
- if ($_REQUEST['do'] == 'clearpop') {
- unset($_REQUEST['do']);
- $db->query("DELETE FROM gateway_pop_failures");
- alert('POP3 Errors Deleted');
- }
- if (!$_REQUEST['do']) {
- admin_header('E-mail Gateway', 'View Errors');
- $show_field_name[] = "Date";
- $show_field_name[] = "Error Type";
- $show_field_name[] = "View Source Message";
-
- $db->query("SELECT * FROM gateway_error");
-
- while ($error = $db->row_array()) {
- if (!$error['sourceid']) {
- next;
- }
- $array = array();
- if ($error['timestamp']) {
- $array[] = our_date($error['timestamp'], 'full');
- } else {
- $array[] = "";
- }
- switch ($error['error']) {
- case 'autoerror':
- $array[] = 'Auto Error';
- break;
- case 'autoresponds_reply':
- $array[] = 'Auto Reply';
- break;
- case 'banned_email':
- $array[] = 'Banned E-mail';
- break;
- case 'no_subject':
- $array[] = 'No Subject';
- break;
- case 'no_message':
- $array[] = 'Empty Body';
- break;
- case 'unregistered':
- $array[] = 'Unregistered';
- break;
- case 'no_email':
- $array[] = 'No "From:" Address';
- break;
- case 'no_ticket':
- $array[] = 'No Such Ticket';
- break;
- case 'ticket_closed':
- $array[] = 'Closed Ticket';
- break;
- case 'attachment_too_big':
- $array[] = 'Attachment too big';
- break;
- case 'message_too_big':
- $array[] = 'Attachment too big';
- break;
- case 'no_gateway':
- $array[] = 'No gateways are configured';
- break;
- case 'no_gateway':
- $array[] = 'No gateways are configured';
- break;
- case 'invalid_email':
- $array[] = 'Invalid e-mail address';
- break;
- case 'duplicate_subject':
- $array[] = 'Rejected; duplicate subject';
- break;
- default:
- $array[] = $error['error'];
- break;
- }
- $array[] = "<center><a href="errors.php?do=source&id=$error[sourceid]">View Source Message</a></center>";
-
- $table[] = $array;
-
- }
- if (!count($table)) {
- $table[] = array('<center>No logged errors</center>');
- } else {
- $table[] = array('<center><A HREF="errors.php?do=clearall">Clear All Errors and Related Source Messages</A></center>');
- }
-
- table_header("Gateway Errors");
- table_content($show_field_name, $table);
- table_footer('');
- $show_field_name[] = "Date";
- $show_field_name[] = "Mailbox Message ID (if available)";
- $show_field_name[] = "Message";
-
- $pop3_errors = $db->query_return_array_id("SELECT * FROM gateway_pop_failures");
- if ($db->num_rows()) {
- $table = array();
- foreach ($pop3_errors AS $error) {
- $table[] = array(our_date($error['stamp'], 1), $error['messageid'], $error['reason']);
- }
- $table[] = array('<center><A HREF="errors.php?do=clearpop">Clear All Errors</A></center>');
- table_header("POP3 Errors");
- table_content($show_field_name, $table);
- table_footer('');
- }
-
- } elseif ($_REQUEST['do'] == "source") {
-
- admin_header('E-mail Gateway', 'View Source Message');
- $db->query("SELECT source FROM gateway_source WHERE id = '$_REQUEST[id]'");
- $error = $db->row_array();
- echo '<A HREF="errors.php">Back to Error List.</A></P>';
- echo "<PRE>n" . htmlspecialchars($error['source']) . "n</PRE>";
- }