-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdo_direcs_mail.php
145 lines (122 loc) · 4.88 KB
/
do_direcs_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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
/*
9/17/09 initial release - Email directions to Facilty to responding unit.
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['frm_u_id'])) {
print "<CENTER>You must select a Unit first</BR></BR>";
print "<A href='javascript: self.close ()'>Close</A></CENTER>";
exit();
}
$direcs = $_POST['frm_direcs'];
$tick_name = $_POST['frm_scope']; //10/29/09
$unit_id = $_POST['frm_u_id'];
$mail_subject = $_POST['frm_mail_subject'];
$direcs = str_replace(" ",' ',$direcs);
$direcs = strip_tags($direcs);
$direcs = stripslashes($direcs);
//$direcs = html_entity_decode($direcs);
unset($_POST['frm_direcs']);
unset($_POST['frm_u_id']);
unset($_POST['frm_mail_subject']);
unset($_POST['frm_scope']); //10/29/09
if (empty($_POST)) {
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]responder` WHERE `id` = $unit_id";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename( __FILE__), __LINE__);
while ($row = stripslashes_deep(mysql_fetch_array($result))) {
$contact_email = $row['contact_via'];
$contact_name = $row['contact_name'];
}
?>
<SCRIPT>
String.prototype.trim = function () {
return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
};
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;
}
function validate() {
var errmsg="";
if (document.mail_form.frm_addr.value.trim()=="") {errmsg+="Message address is required";}
if (document.mail_form.frm_subj.value.trim()=="") {errmsg+="Message subject is required";}
if (document.mail_form.frm_text.value.trim()=="") {errmsg+="Message text is required";}
if (!(errmsg=="")){
alert ("Please correct the following and re-submit:\n\n" + errmsg);
return false;
}
else {
document.mail_form.submit();
}
} // end function validate()
function back_to_routes() {
window.location.href("fac_routes.php");
}
</SCRIPT>
</HEAD>
<BODY><CENTER> <!-- 1/12/09 -->
<CENTER><H3>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'>To:</TD><TD><INPUT NAME='frm_name' SIZE=32 VALUE = '<?php print $contact_name;?>'></TD>
</TR>
<TR CLASS= 'odd'>
<TD ALIGN='right'>Addr:</TD><TD><INPUT NAME='frm_addr' SIZE=32 VALUE = '<?php print $contact_email;?>'></TD>
</TR>
<TR CLASS='even'><TD ALIGN='right'>Subject: </TD><TD COLSPAN=2><INPUT TYPE = 'text' NAME = 'frm_subj' SIZE = 60 VALUE = '<?php print $mail_subject;?> - <?php print $tick_name;?>'></TD></TR> <!-- 10/29/09 -->
<TR CLASS='odd'><TD ALIGN='right'>Message:</TD><TD COLSPAN=2> <TEXTAREA NAME='frm_text' COLS=60 ROWS=4><?php print $direcs;?></TEXTAREA></TD></TR>
<TR CLASS='even'><TD ALIGN='center' COLSPAN=3><BR /><BR />
<INPUT TYPE="hidden" NAME="frm_direcs" VALUE="">
<INPUT TYPE="hidden" NAME="frm_u_id" VALUE='<?php print $unit_id;?>'>
<INPUT TYPE="hidden" NAME="frm_mail_subject" VALUE="">
<INPUT TYPE="hidden" NAME="frm_scope" VALUE=""> <!-- 10/29/09 -->
<INPUT TYPE='button' VALUE='Send' onClick = "validate()">
<INPUT TYPE='reset' VALUE='Reset'>
<INPUT TYPE='button' VALUE='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'] ); // ($to_str, $subject_str, $text_str )
?>
<BODY><CENTER>
<CENTER><BR /><BR /><BR /><H3>Mail sent</H3>
<BR /><BR /><BR /><INPUT TYPE='button' VALUE='Finished' onClick = 'window.close();'><BR /><BR />
<?php
} // end else
?> </BODY>
</HTML>