📄 email.php
字号:
<?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: email.php,v $
// | $Date: 2004/02/10 01:34:32 $
// | $Revision: 1.7 $
// +-------------------------------------------------------------+
// | File Details:
// | - User notes management.
// +-------------------------------------------------------------+
error_reporting(E_ALL ^ E_NOTICE);
include "./../global.php";
tech_nav('users');
// default do
$_REQUEST['do'] = trim($_REQUEST['do']);
if (!isset($_REQUEST['do']) or $_REQUEST['do'] == "") {
$_REQUEST['do'] = "view";
}
// globalise variables
$global = array (
array('id')
);
rg($global);
################################### VIEW EMAILS ###################################
if ($_REQUEST['do'] == 'view') {
if ($settings[send_email_gateway] == "1") {
// emails awaiting reply:
$db->query("SELECT date_sent, subject, to_email, id FROM tech_sendmail WHERE techid = '$user[id]' AND parent = '0' AND awaiting_reply = '1' AND tracking = '1'");
while ($email = $db->row_array()) {
$table[] = array(
our_date($email[date_sent]),
$email[subject],
$email[to_email],
"<a href=\"email.php?do=mark_read&id=$email[id]\">mark read</a>",
jprompt( 'Are you sure you want to delete this email?', "email.php?do=delete&id=$email[id]",'delete'),
"<a href=\"email.php?do=display&id=$email[id]\">view</a>",
);
}
$cols = array('Date', 'Subject', 'Sent To:', 'Mark Read', 'Delete', 'View');
table_header('Emails awaiting reply (and being tracked through DeskPRO)');
table_content($cols, $table);
table_footer();
// emails not awaiting reply:
$db->query("SELECT date_sent, subject, to_email, id FROM tech_sendmail WHERE techid = '$user[id]' AND parent = '0' AND awaiting_reply = '0' AND tracking = '1'");
unset($table, $cols);
while ($email = $db->row_array()) {
$table[] = array(
our_date($email[date_sent]),
$email[subject],
$email[to_email],
"<a href=\"email.php?do=mark_unread&id=$email[id]\">mark unread</a>",
jprompt( 'Are you sure you want to delete this email?', "email.php?do=delete&id=$email[id]",'delete'),
"<a href=\"email.php?do=display&id=$email[id]\">view</a>",
);
}
$cols = array('Date', 'Subject', 'Sent To:', 'Mark Un Read', 'Delete', 'View');
table_header('Emails awaiting reply (and being tracked through DeskPRO)');
table_content($cols, $table);
table_footer();
}
// now tracked through DeskPRO
$db->query("SELECT date_sent, subject, to_email, id FROM tech_sendmail WHERE techid = '$user[id]' AND parent = '0' AND tracking = '0'");
while ($email = $db->row_array()) {
$table[] = array(
our_date($email[date_sent]),
$email[subject],
$email[to_email],
jprompt( 'Are you sure you want to delete this email?', "email.php?do=delete&id=$email[id]",'delete'),
"<a href=\"email.php?do=display&id=$email[id]\">view</a>"
);
}
$cols = array("Date", "Subject", "Sent To", "delete", "view");
table_header('Emails sent but not being tracked through DeskPRO');
table_content($cols, $table);
table_footer();
echo "<center><b><a href=\"email.php?do=send\">Send Email</a></b></center>";
}
################################### SEND EMAIL (1) ###################################
if ($_REQUEST['do'] == 'send') {
$table[] = array('<b>Email Address</b><br />Email address of the person you are emailing', form_input('to_email'));
$table[] = array('<b>Subject</b><br />Email subject', form_input('subject'));
$table[] = array('<b>Message</b><br />Your email message', form_textarea('message', 60, 8));
if ($settings[send_email_gateway] == "1") {
$table[] = array('<b>Track through DeskPRO</b><br />Track this email through DeskPRO?', form_radio_yn('tracking'));
}
$table[] = array('<b>Email Address</b><br />' . iff($settings[send_email_gateway], 'Email to send from if you are <b>NOT</b> tracking through DeskPRO', 'Your email address to send from'), form_input('from_email', $user[email]));
table_header('Send an email', 'email.php', array('do' => 'send2'));
table_content($cols, $table);
table_footer('Send Email');
}
################################### SEND EMAIL (2) ###################################
if ($_REQUEST['do'] == "send2") {
if ($settings[send_email_gateway] != "1") {
$_REQUEST['tracking'] = 0;
}
$pass = substr(md5(time()),0,7);
$db->query("
INSERT INTO tech_sendmail SET
techid = '$user[id]',
date_sent = '" . mktime() . "',
subject = '" . addslashes($_REQUEST[subject]) . "',
message = '" . addslashes($_REQUEST[message]) . "',
from_email = '" . addslashes($_REQUEST[from_email]) . "',
to_email = '" . addslashes($_REQUEST[to_email]) . "',
tracking = '" . addslashes($_REQUEST[tracking]) . "',
pass = '" . addslashes($pass) . "'
");
$id = $db->last_id();
$subject = $subject . " [" . $id . "--" . $pass . "]";
if ($_REQUEST['tracking']) {
$from = $settings[tech_send_email];
} else {
$from = $_REQUEST['from_email'];
}
dp_mail($_REQUEST['to_email'], $_REQUEST[subject], $_REQUEST[message], $from);
jump("email.php", 'Email sent');
}
################################### MARK READ ###################################
if ($_REQUEST['do'] == "mark_read") {
$db->query("
SELECT id
FROM tech_sendmail
WHERE id = '$id'
AND techid = '$user[id]'");
if ($db->num_rows() < 1) {
jump('email.php', 'This email does not exist or you do not have permission to edit it');
}
$db->query("
UPDATE tech_sendmail
SET awaiting_reply = '0'
WHERE id = '$id'
");
jump("email.php", 'Email has been marked as read');
}
################################### MARK UNREAD ###################################
if ($_REQUEST['do'] == "mark_unread") {
$db->query("
SELECT id
FROM tech_sendmail
WHERE id = '$id'
AND techid = '$user[id]'
");
if ($db->num_rows() < 1) {
jump("email.php", 'This email does not exist or you do not have permission to edit it');
}
$db->query("
UPDATE tech_sendmail
SET awaiting_reply = '1'
WHERE id = '$id'
");
jump("email.php", 'Email has been marked as unread');
}
################################### DELETE ###################################
if ($_REQUEST['do'] == "delete") {
$db->query("
SELECT id
FROM tech_sendmail
WHERE id = '$id'
AND techid = '$user[id]'
");
if ($db->num_rows() < 1) {
jump("email.php", 'This email does not exist or you do not have permission to edit it');
}
$db->query("
DELETE FROM tech_sendmail
WHERE id = '$id'
OR parent = '$id'
");
jump("email.php", 'Email has been deleted');
}
################################### VIEW EMAIL ###################################
if ($_REQUEST['do'] == "display") {
$email = $db->query_return("
SELECT *
FROM tech_sendmail
WHERE id = '$id'
AND techid = '$user[id]'
");
if ($db->num_rows() < 1) {
jump("email.php", 'This email does not exist or you do not have permission to view it');
}
$to_email = $email[to_email];
$subject = "Re: $email[subject]";
$tracking = $email[tracking];
$table[] = array('<b>Subject :</b>', $email[subject]);
$table[] = array('<b>From :</b>', $email[to_email]);
$table[] = array('<b>Date Sent :</b>', our_date($email[date_sent]));
$table[] = array('<b>Message :</b>', dp_code($email[message]));
echo table_list("Original Message : $email[subject]", $table, '100%');
unset($table);
$tracking = 1;
if ($tracking) {
echo "<br /><br />";
$db->query("
SELECT *
FROM tech_sendmail
WHERE parent = '$id'
");
while ($email = $db->row_array()) {
if ($email[techid]) {
$reply_type = 'Your reply on ' . our_date($email[date_sent]);
} elseif ($email[from_email] != "") {
$reply_type = 'User reply on' . our_date($email[date_sent]);
}
echo table_list($reply_type, array(dp_code($email[message])), '100%');
echo "<br />";
}
$table[] = array('<b>Message</b><br />Your email message', form_textarea('message', 60, 8));
table_header('Send a reply', 'email.php', array('do' => 'reply', 'id' => $id));
table_content($cols, $table);
table_footer('Send Email');
}
}
################################### REPLY TO EMAIL ###################################
if ($_REQUEST['do'] == "reply") {
$db->query("
SELECT *
FROM tech_sendmail
WHERE id = '$id'
AND techid = '$user[id]'
");
if ($db->num_rows() < 1) {
jump("email.php", 'This email does not exist or you do not have permission to edit it');
}
$email = $db->row_array();
$db->query("
INSERT INTO tech_sendmail SET
techid = '$user[id]',
date_sent = '" . mktime() . "',
parent = '$id',
message = '" . addslashes($_REQUEST[message]) . "'
");
$db->query("
UPDATE tech_sendmail SET
awaiting_reply = '0'
WHERE id = '$id'
");
$subject = $subject . " [" . $email[id] . "--" . $email[pass] . "]";
$from_email = $settings[tech_send_email];
dp_mail($_REQUEST['email'], $subject, $_REQUEST[message]);
jump("email.php", 'Email sent');
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -