-
Notifications
You must be signed in to change notification settings - Fork 6
/
do_indiv_mail.php
129 lines (113 loc) · 4.77 KB
/
do_indiv_mail.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
/**
* @package do_indiv_mail.php
* @author John Doe <[email protected]>
* @since 2009-08-17
* @version 2011-03-15
*/
/*
8/17/09 initial release
7/28/10 Added inclusion of startup.inc.php for checking of network status and setting of file name variables to support no-maps versions of scripts.
3/15/11 changed stylesheet.php to stylesheet.php
*/
error_reporting(E_ALL); //
@session_start();
require_once($_SESSION['fip']); //7/28/10
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE><?php print LessExtension(basename(__FILE__));?> </TITLE>
<META NAME="Description" CONTENT="Email to units" />
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" />
<META HTTP-EQUIV="Expires" CONTENT="0" />
<META HTTP-EQUIV="Cache-Control" CONTENT="NO-CACHE" />
<META HTTP-EQUIV="Pragma" CONTENT="NO-CACHE" />
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript" />
<META HTTP-EQUIV="Script-date" CONTENT="<?php print date("n/j/y G:i", filemtime(basename(__FILE__)));?>" />
<LINK REL="StyleSheet" HREF="stylesheet.php?version=<?php print time();?>" TYPE="text/css" /> <!-- 3/15/11 -->
<STYLE>
#.plain { background-color: #FFFFFF;}
</STYLE>
<?php
//dump($_POST);
if (empty($_POST)) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]responder` WHERE `id` = " . quote_smart(trim($_GET['the_id'])). " LIMIT 1";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename( __FILE__), __LINE__);
$row = mysql_fetch_assoc($result);
?>
<SCRIPT>
/**
*
* @returns {unresolved}
*/
String.prototype.trim = function () {
return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
};
/**
*
* @returns {Array}
*/
function $() {
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string')
element = document.getElementById(element);
if (arguments.length == 1)
return element;
elements.push(element);
}
return elements;
}
/**
*
* @returns {Boolean}
*/
function validate() {
var errmsg="";
if (document.mail_form.frm_addr.value.trim()=="") {errmsg+="<?php print gettext('Message address is required');?>";}
if (document.mail_form.frm_subj.value.trim()=="") {errmsg+="<?php print gettext('Message subject is required');?>";}
if (document.mail_form.frm_text.value.trim()=="") {errmsg+="<?php print gettext('Message text is required');?>";}
if (!(errmsg=="")) {
alert ("<?php print gettext('Please correct the following and re-submit');?>:\n\n" + errmsg);
return false;
}
else {
document.mail_form.submit();
}
} // end function validate()
</SCRIPT>
</HEAD>
<BODY><CENTER> <!-- 1/12/09 -->
<CENTER><H3><?php print gettext('Mail to Unit');?></H3>
<P>
<FORM NAME='mail_form' METHOD='post' ACTION='<?php print basename(__FILE__); ?>'>
<INPUT TYPE='hidden' NAME='frm_add_str' VALUE=''> <!-- for pipe-delim'd addr string -->
<TABLE BORDER = 0>
<TR CLASS= 'even'>
<TD ALIGN='right'><?php print gettext('To');?>:</TD><TD><INPUT NAME='frm_name' SIZE=32 VALUE = '<?php print $row['contact_name'];?>' /></TD>
</TR>
<TR CLASS= 'odd'>
<TD ALIGN='right'><?php print gettext('Addr');?>:</TD><TD><INPUT NAME='frm_addr' SIZE=32 VALUE = '<?php print $row['contact_via'];?>' /></TD>
</TR>
<TR CLASS='even'><TD ALIGN='right'><?php print gettext('Subject');?>: </TD><TD COLSPAN=2><INPUT TYPE = 'text' NAME = 'frm_subj' SIZE = 60 /></TD></TR>
<TR CLASS='odd'><TD ALIGN='right'><?php print gettext('Message');?>:</TD><TD COLSPAN=2> <TEXTAREA NAME='frm_text' COLS=60 ROWS=4></TEXTAREA></TD></TR>
<TR CLASS='even'><TD ALIGN='center' COLSPAN=3><BR /><BR />
<INPUT TYPE='button' VALUE='<?php print gettext('Send');?>' onClick = "validate();"/>
<INPUT TYPE='reset' VALUE='<?php print gettext('Reset');?>'/>
<INPUT TYPE='button' VALUE='<?php print gettext('Cancel');?>' onClick = 'window.close();'/><BR /><BR />
</TD></TR>
</TABLE></FORM>
<?php
} // end if (empty($_POST)) {
else {
do_send ($_POST['frm_addr'], $_POST['frm_subj'], $_POST['frm_text'], 0, quote_smart(trim($_GET['the_id']))); // ($to_str, $subject_str, $text_str )
?>
<BODY><CENTER>
<CENTER><BR /><BR /><BR /><H3><?php print gettext('Mail sent');?></H3>
<BR /><BR /><BR /><INPUT TYPE='button' VALUE='<?php print gettext('Finished');?>' onClick = 'window.close();'/><BR /><BR />
<?php
} // end else
?> </BODY>
</HTML>