/
proc.php
203 lines (194 loc) · 8 KB
/
proc.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<!DOCTYPE html>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="icon" type="image/png" href="favicon.png" />
<link rel="apple-touch-icon" href="favicon.png" />
<link href="" rel="apple-touch-startup-image" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<meta name="apple-mobile-web-app-capable" content="no" />
<meta name="viewport" content="initial-scale=1, width=device-width, user-scalable=no" />
<!--==========================================-->
<?php
$isLoc = true;
$ini = parse_ini_file("paging.ini");
$cdnJqm = $ini['jqm'];
$cdnJQ = $ini['jquery'];
$instr = $ini['copyright'];
?>
<link rel="stylesheet" href="<?php echo (($isLoc) ? './jqm' : 'http://code.jquery.com/mobile/'.$cdnJqm).'/jquery.mobile-'.$cdnJqm;?>.min.css" />
<script src="<?php echo (($isLoc) ? './jqm/' : 'http://code.jquery.com/').'jquery-'.$cdnJQ;?>.min.js"></script>
<script src="<?php echo (($isLoc) ? './jqm' : 'http://code.jquery.com/mobile/'.$cdnJqm).'/jquery.mobile-'.$cdnJqm;?>.min.js"></script>
<!--==========================================-->
<script type="text/javascript">
// from http://web.enavu.com/daily-tip/maxlength-for-textarea-with-jquery/
$(document).ready(function() {
$('textarea[maxlength]').keyup(function(){ //get the limit from maxlength attribute
var limit = parseInt($(this).attr('maxlength')); //get the current text inside the textarea
var text = $(this).val(); //count the number of characters in the text
var chars = text.length; //check if there are more characters then allowed
if(chars > limit){ //and if there are use substr to get the text before the limit
var new_text = text.substr(0, limit); //and change the current text with the new text
$(this).val(new_text);
}
});
});
</script>
<title>Heart Center Paging</title>
</HEAD>
<BODY>
<?php
function simple_encrypt($text, $salt = "") {
if (!$salt) {
global $instr; $salt = $instr;
}
if (!$text) {
return $text;
}
return openssl_encrypt(
$text,
'AES-128-CBC',
$salt);
}
function simple_decrypt($text, $salt = "") {
if (!$salt) {
global $instr; $salt = $instr;
}
if (!$text) {
return $text;
}
return openssl_decrypt(
$text,
'AES-128-CBC',
$salt);
}
$grp = filter_input(INPUT_GET,'group');
$uid = filter_input(INPUT_GET,'id');
$modDate = date ("m/d/Y", filemtime("list.xml"));
$xml = simplexml_load_file("list.xml");
$groups = $xml->groups;
$groupfull = array();
foreach ($groups->children() as $grp0) {
$groupfull[$grp0->getName()] = $grp0->attributes()->full;
}
$group = $xml->groups->$grp;
$numsec = count($group->xpath("user[@sec]"));
?>
<!-- Start of first page -->
<div data-role="page" id="procmain" data-dom-cache="true"> <!-- page -->
<div data-role="header" data-theme="b" data-add-back-btn="true" >
<a href="index.php" data-ajax="false" class="ui-btn ui-shadow ui-icon-arrow-l ui-btn-icon-notext ui-corner-all" ><small>Back</small></a>
<h3><?php echo $groupfull[$grp]; ?></h3>
</div><!-- /header -->
<form action="submit.php" method="POST" name="sendForm" id="sendForm" data-prefetch>
<div data-role="content">
<div data-role="fieldcontain" >
<label for="NUMBER" >To:</label>
<select name="NUMBER" id="NUMBER" data-native-menu="true">
<?php
echo '<option value="">'.($grp=='MLP'?'::: Inpatient ARNP 7-4594 :::':'::: Choose one... :::').'</option>'."\r\n";
foreach($group->user as $liUser) {
$liUid = $liUser['uid'];
$liNameL = $liUser['last'];
$liNameF = $liUser['first'];
if ($liUser['sec']){
if ($numsec==1){
continue;
}
echo '<optgroup label="'.$liUser['sec'].'">'."\r\n";
continue;
} else {
$liSec = '';
$liOpt = $liUser->option['mode'];
$liOptStr = substr(uniqid("",true),-(rand(10,20)));
if (($liOpt == "B") || ($liOpt == "C")) {
$liOptSvc = $liUser->option['sys'];
if ($liOptSvc == "sms") {
$liOptStr = simple_decrypt($liUser->option->sms['num']).
(($liUser->option->sms['sys']=="A") ? "@txt.att.net":'').
(($liUser->option->sms['sys']=="V") ? "@vtext.com":'').
(($liUser->option->sms['sys']=="T") ? "@tmomail.net":'');
}
if ($liOptSvc == "pbl") {
$liOptStr = simple_decrypt($liUser->option->pushbul['eml']);
}
if ($liOptSvc == "pov") {
$liOptStr = simple_decrypt($liUser->option->pushover['num']);
}
if ($liOptSvc == "bxc") {
$liOptStr = simple_decrypt($liUser->option->boxcar['num']);
}
if ($liOptSvc == "tgt") {
$liOptStr = simple_decrypt($liUser->option->tigertext['num']);
}
}
$pagerline = array(
$liUid,
$liUser->pager['sys'],
simple_decrypt($liUser->pager['num']),
$liOpt,
$liOptSvc,
$liOptStr,
simple_decrypt($liUser->auth['cis'])
);
$liName = $liNameF.' '.$liNameL;
}
if ($liUser->pager['num']) {
echo '<option value="'. simple_encrypt(implode(",",$pagerline)).'" '.(($liUid==$uid)?'selected="selected"':'').'>'.$liName.'</option>'."\r\n";
}
}
?>
</select>
<label for="MYNAME">From:</label>
<input type="text" name="MYNAME" id="MYNAME" value="" placeholder="REQUIRED" maxlength="20"/>
</div>
<div data-role="fieldcontain" style="text-align: right">
<textarea name="MESSAGE" id="MESSAGE" maxlength="200"></textarea>
</div>
<input type="hidden" name="GROUP" value="<?php echo $grp; ?>">
<div style="text-align: center">
<input type="submit" value="SUBMIT!" data-inline="true" data-theme="b" />
</div>
<script type="text/javascript">
$('#sendForm').submit(function()
{
if ($.trim($("#MYNAME").val()) === "") {
$("#emptyFrom").popup("open");
return false;
}
if ($.trim($("#NUMBER").val()) === "") {
$("#emptyNum").popup("open");
return false;
}
});
</script>
<div data-role="popup" id="emptyFrom" data-overlay-theme="b">
<div data-role="header" style="background: red">
<h4>ERROR</h4>
</div>
<div data-role="main" class="ui-content">
<p style="text-align: center">FROM field is required.</p>
</div>
</div>
<div data-role="popup" id="emptyNum" data-overlay-theme="b" >
<div data-role="header" style="background: red">
<h4>ERROR</h4>
</div>
<div data-role="main" class="ui-content">
<p style="text-align: center">Must select a valid recipient.</p>
</div>
</div>
</div>
</form>
<div data-role="footer" data-position="fixed">
<?php
?>
<h5><small>
©(2007-<?php echo date('Y');?>) Terrence Chun, MD<br>
Data revised: <?php echo $modDate; ?><br>
</small></h5>
</div><!-- /footer -->
</div><!-- /page -->
<!-- Last revised 01/15/15 -->
</BODY>
</HTML>