-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ajax.php
executable file
·390 lines (341 loc) · 17.8 KB
/
Ajax.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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
<?php
#**************************************************************************
# openSIS is a free student information system for public and non-public
# schools from Open Solutions for Education, Inc. web: www.os4ed.com
#
# openSIS is web-based, open source, and comes packed with features that
# include student demographic info, scheduling, grade book, attendance,
# report cards, eligibility, transcripts, parent portal,
# student portal and more.
#
# Visit the openSIS web site at http://www.opensis.com to learn more.
# If you have question regarding this system or the license, please send
# an email to info@os4ed.com.
#
# This program is released under the terms of the GNU General Public License as
# published by the Free Software Foundation, version 2 of the License.
# See license.txt.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#***************************************************************************************
include("functions/ParamLibFnc.php");
echo '<script type="text/javascript" src="assets/js/pages/components_popups.js"></script>';
echo '<script type="text/javascript" src="assets/js/pages/picker_date.js"></script>';
echo '<script type="text/javascript" src="assets/js/pages/form_checkboxes_radios.js"></script>';
echo '<script type="text/javascript" src="assets/js/plugins/forms/inputs/jquery.creditCardValidator.js"></script>';
echo '<script>';
echo '$(document).ready(function() {
// Animate loader off screen
$("#loading-image").hide();
if($(".clockpicker").length>0){
$(".clockpicker").clockpicker({
twelvehour: true,
donetext: \'Done\'
}).find("input").change(function () {
//alert(this.value);
});
}
if($(".switch-fake-title").length > 0){
$(".switch-fake-title").each(function(){
var check = $(this).closest("label").children("input[type=checkbox]");
if(check.is(":checked")){
$(this).text("Yes");
}else{
$(this).text("No");
}
});
}
/*if(hasScrollBar(".table-responsive", "horizontal")){
$(".table-responsive").mousewheel(function (e, delta) {
this.scrollLeft -= (delta * 40);
e.preventDefault();
});
}*/
$(".switch-fake-title").closest("label").children("input[type=checkbox]").change(function(){
if($(this).is(":checked")){
$(this).closest("label").children(".switch-fake-title").text("Yes");
}else{
$(this).closest("label").children(".switch-fake-title").text("No");
}
});
$("body").removeClass("sidebar-mobile-main");
// Scroll page to top after ajax call
//$("html, body").animate({ scrollTop: 0 }, "200");
$(\'body\').on(\'click\', \'div.sidebar-overlay\', function () {
$(\'body\').toggleClass(\'sidebar-mobile-main\');
});
$(\'body\').removeClass(\'sidebar-mobile-main\');
// Initializing Tooltips & Popovers after ajax call
$(\'[data-toggle="tooltip"], [data-popup="tooltip"]\').tooltip();
$(\'[data-popup="popover"]\').popover();
});';
echo '</script>';
$url = validateQueryString(curPageURL());
if ($url === FALSE) {
header('Location: index.php');
}
error_reporting(E_ERROR);
$isajax = "ajax";
$start_time = time();
include 'Warehouse.php';
array_rwalk($_REQUEST, 'strip_tags');
$title_set = '';
if (UserStudentID() && User('PROFILE') != 'parent' && User('PROFILE') != 'student' && substr(clean_param($_REQUEST['modname'], PARAM_NOTAGS), 0, 5) != 'Atten' && substr(clean_param($_REQUEST['modname'], PARAM_NOTAGS), 0, 5) != 'users' && clean_param($_REQUEST['modname'], PARAM_NOTAGS) != 'students/AddUsers.php' && $_REQUEST['modname']!= 'tools/Backup.php' && (substr(clean_param($_REQUEST['modname'], PARAM_NOTAGS), 0, 10) != 'attendance' || clean_param($_REQUEST['modname'], PARAM_NOTAGS) == 'attendance/StudentSummary.php' || clean_param($_REQUEST['modname'], PARAM_NOTAGS) == 'attendance/DailySummary.php' || clean_param($_REQUEST['modname'], PARAM_NOTAGS) == 'attendance/AddAbsences.php')) {
$RET = DBGet(DBQuery("SELECT FIRST_NAME,LAST_NAME,MIDDLE_NAME,NAME_SUFFIX FROM students WHERE STUDENT_ID='" . UserStudentID() . "'"));
$count_student_RET = DBGet(DBQuery("SELECT COUNT(*) AS NUM FROM students"));
$allow_buffer_list = array(
// For Students
'students/Student.php',
// 'students/AssignOtherInfo.php',
// 'students/StudentReenroll.php',
'students/AdvancedReport.php',
'students/Letters.php',
'students/MailingLabels.php',
'students/StudentLabels.php',
'students/PrintStudentInfo.php',
'students/PrintStudentContactInfo.php',
'students/GoalReport.php',
'students/EnrollmentReport.php',
// For Scheduling
'scheduling/Schedule.php',
'scheduling/ViewSchedule.php',
'scheduling/Requests.php',
// 'scheduling/MassSchedule.php',
// 'scheduling/MassRequests.php',
'scheduling/PrintSchedules.php',
// 'scheduling/PrintRequests.php',
// 'scheduling/UnfilledRequests.php',
// 'scheduling/IncompleteSchedules.php',
// For Grades
'grades/ReportCards.php',
'grades/Transcripts.php',
'grades/FinalGrades.php',
'grades/GPARankList.php',
'grades/AdminProgressReports.php',
'grades/ProgressReports.php',
// 'grades/HonorRoll.php',
'grades/EditReportCardGrades.php',
// 'grades/GraduationProgress.php',
// For Attendance
'attendance/AddAbsences.php',
// 'attendance/DailySummary.php',
// 'attendance/StudentSummary.php',
// 'attendance/DuplicateAttendance.php',
// For Eligibility
'eligibility/Student.php',
// 'eligibility/AddActivity.php',
// 'eligibility/StudentList.php'
);
$allow_back_to_student_list = array(
// For Students
'students/Student.php',
// For Scheduling
'scheduling/Schedule.php',
'scheduling/ViewSchedule.php',
'scheduling/Requests.php',
// For Grades
'grades/EditReportCardGrades.php',
// For Eligibility
'eligibility/Student.php'
);
// echo "<pre>";print_r($_REQUEST);echo "</pre>";
if ($count_student_RET[1]['NUM'] > 1) {
$title_set = 'y';
if(in_array($_REQUEST['modname'], $allow_buffer_list))
{
if(in_array($_REQUEST['modname'], $allow_back_to_student_list))
{
DrawHeaderHome('<div class="panel"><div class="panel-heading"><h6 class="panel-title">'._selectedStudent.' : ' . $RET[1]['FIRST_NAME'] . ' ' . ($RET[1]['MIDDLE_NAME'] ? $RET[1]['MIDDLE_NAME'] . ' ' : '') . $RET[1]['LAST_NAME'] . ' ' . $RET[1]['NAME_SUFFIX'] . '</h6> <div class="heading-elements clearfix"><span class="heading-text"><A HREF=Modules.php?modname=' . clean_param($_REQUEST['modname'], PARAM_NOTAGS) . '&search_modfunc=list&next_modname=Students/Student.php&ajax=true&bottom_back=true&return_session=true target=body><i class="icon-square-left"></i> '._backToStudentList.'</A></span><div class="btn-group heading-btn"><A HREF=SideForStudent.php?student_id=new&modcat=' . clean_param($_REQUEST['modcat'], PARAM_NOTAGS) . '&modname=' . $_REQUEST['modname'] . ' class="btn btn-danger btn-xs">'._deselect.'</A></div></div></div></div>');
}
else
{
DrawHeaderHome('<div class="panel"><div class="panel-heading"><h6 class="panel-title">'._selectedStudent.' : ' . $RET[1]['FIRST_NAME'] . ' ' . ($RET[1]['MIDDLE_NAME'] ? $RET[1]['MIDDLE_NAME'] . ' ' : '') . $RET[1]['LAST_NAME'] . ' ' . $RET[1]['NAME_SUFFIX'] . '</h6> <div class="heading-elements clearfix"><div class="btn-group heading-btn"><A HREF=SideForStudent.php?student_id=new&modcat=' . clean_param($_REQUEST['modcat'], PARAM_NOTAGS) . '&modname=' . $_REQUEST['modname'] . ' class="btn btn-danger btn-xs">'._deselect.'</A></div></div></div></div>');
}
}
} else if ($count_student_RET[1]['NUM'] == 1) {
$title_set = 'y';
if(in_array($_REQUEST['modname'], $allow_buffer_list))
{
DrawHeaderHome('<div class="panel"><div class="panel-heading"><h6 class="panel-title">'._selectedStudent.' : ' . $RET[1]['FIRST_NAME'] . ' ' . ($RET[1]['MIDDLE_NAME'] ? $RET[1]['MIDDLE_NAME'] . ' ' : '') . $RET[1]['LAST_NAME'] . ' ' . $RET[1]['NAME_SUFFIX'] . '</h6> <div class="heading-elements clearfix"><A HREF=SideForStudent.php?student_id=new&modcat=' . clean_param($_REQUEST['modcat'], PARAM_NOTAGS) . '&modname=' . $_REQUEST['modname'] . ' class="btn btn-danger btn-xs">'._deselect.'</A></div></div></div>');
}
}
}
$title_set_staff = '';
if (UserStaffID() && User('PROFILE') == 'admin' && substr(clean_param($_REQUEST['modname'], PARAM_NOTAGS), 0, 6) != 'grades' && substr(clean_param($_REQUEST['modname'], PARAM_NOTAGS), 0, 8) != 'students' && substr(clean_param($_REQUEST['modname'], PARAM_NOTAGS), 0, 10) != 'attendance') {
$Modname_Attn = 'users/TeacherPrograms.php';
$Modname_Pro = 'users/TeacherPrograms.php?include=grades/ProgressReports.php';
if ((!UserStudentID() || substr(clean_param($_REQUEST['modname'], PARAM_NOTAGS), 0, 5) == 'users') && substr(clean_param($_REQUEST['modname'], PARAM_NOTAGS), 0, 25) != $Modname_Attn && clean_param($_REQUEST['modname'], PARAM_NOTAGS) != 'users/AddStudents.php' && !clean_param($_REQUEST['miss_attn'], PARAM_NOTAGS)) {
$title_set_staff = 'y';
if ($_REQUEST['modname'] != 'users/User.php') {
$RET = DBGet(DBQuery("SELECT FIRST_NAME,LAST_NAME FROM staff WHERE STAFF_ID='" . UserStaffID() . "'"));
echo '<div class="panel panel-default">';
DrawHeader(''._selectedStaff.' : ' . $RET[1]['FIRST_NAME'] . ' ' . $RET[1]['LAST_NAME'], '<span class="heading-text"><A HREF=Modules.php?modname=' . clean_param($_REQUEST['modname'], PARAM_NOTAGS) . '&search_modfunc=list&next_modname=users/User.php&ajax=true&bottom_back=true&return_session=true target=body><i class="icon-square-left"></i> '._backToUserList.'</A></span><div class="btn-group heading-btn"><A HREF=Side.php?staff_id=new&modcat=' . clean_param($_REQUEST['modcat'], PARAM_NOTAGS) . ' class="btn btn-danger btn-xs">'._deselect.'</A></div>');
echo '</div>';
}
}
}
echo "<div id=\"divErr\"></div>";
if (!isset($_REQUEST['_openSIS_PDF'])) {
Warehouse('header');
// if (strpos(clean_param($_REQUEST['modname'], PARAM_NOTAGS), 'miscellaneous/') === false)
// echo '<script language="JavaScript">if(window == top && (!window.opener || window.opener.location.href.substring(0,(window.opener.location.href.indexOf("&")!=-1?window.opener.location.href.indexOf("&"):window.opener.location.href.replace("#","").length))!=window.location.href.substring(0,(window.location.href.indexOf("&")!=-1?window.location.href.indexOf("&"):window.location.href.replace("#","").length)))) window.location.href = "index.php";</script>';
echo "<BODY marginwidth=0 leftmargin=0 border=0 onload='doOnload();' background=assets/bg.gif>";
echo '<DIV id="Migoicons" style="visibility:hidden;position:absolute;z-index:1000;top:-100"></DIV>';
}
$ajax_to_sign_in = "";
$ajax_to_sign_out = "";
if (clean_param($_REQUEST['modname'], PARAM_NOTAGS)) {
if ($_REQUEST['_openSIS_PDF'] == 'true')
ob_start();
if (strpos($_REQUEST['modname'], '?') !== false) {
$vars = substr($_REQUEST['modname'], (strpos($_REQUEST['modname'], '?') + 1));
$modname = substr($_REQUEST['modname'], 0, strpos($_REQUEST['modname'], '?'));
$vars = explode('?', $vars);
foreach ($vars as $code) {
$arr_ind = substr($code, 0, strpos($code, '='));
$arr_val = substr($code, (strpos($code, '=') + 1));
$_REQUEST[$arr_ind] = $arr_val;
}
} else
$modname = $_REQUEST['modname'];
if ($_REQUEST['LO_save'] != '1' && !isset($_REQUEST['_openSIS_PDF']) && (strpos($modname, 'miscellaneous/') === false || $modname == 'misc/Registration.php' || $modname == 'miscellaneous/Export.php' || $modname == 'miscellaneous/Portal.php'))
$_SESSION['_REQUEST_vars'] = $_REQUEST;
$allowed = false;
include 'Menu.php';
foreach ($_openSIS['Menu'] as $modcat => $programs) {
if (clean_param($_REQUEST['modname'], PARAM_NOTAGS) == $modcat . '/Search.php') {
$allowed = true;
break;
}
foreach ($programs as $program => $title) {
if (clean_param($_REQUEST['modname'], PARAM_NOTAGS) == $program) {
$allowed = true;
break;
}
}
}
if (substr(clean_param($_REQUEST['modname'], PARAM_NOTAGS), 0, 14) == 'miscellaneous/'){
$allowed = true;
}
//ADDED BY Africa's Hope - Evan Stewart - 07-27-2021 - include the new module AppUpgradeProcess.php
if (optional_param('modname', '', PARAM_NOTAGS) == 'tools/AppUpgradeProcess.php'){
echo "<h1>Found it </h1>";
$allowed = true;
}
//END Africa's Hope addition
if ($allowed || $_SESSION['take_mssn_attn']) {
if (Preferences('SEARCH') != 'Y' && substr(clean_param($modname, PARAM_NOTAGS), 0, 6) != 'users/')
$_REQUEST['search_modfunc'] = 'list';
include('modules/' . $modname);
}
else {
if (User('USERNAME')) {
if ($_SERVER['HTTP_X_FORWARDED_FOR']) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
echo ""._youReNotAllowedToUseThisProgram."! "._thisAttemptedViolationHasBeenLoggedAndYourIpAddressWasCaptured.".";
DBQuery("INSERT INTO hacking_log (HOST_NAME,IP_ADDRESS,LOGIN_DATE,VERSION,PHP_SELF,DOCUMENT_ROOT,SCRIPT_NAME,MODNAME,USERNAME) values('$_SERVER[SERVER_NAME]','$ip','" . date('Y-m-d') . "','$openSISVersion','$_SERVER[PHP_SELF]','$_SERVER[DOCUMENT_ROOT]','$_SERVER[SCRIPT_NAME]','$_REQUEST[modname]','" . User('USERNAME') . "')");
Warehouse('footer');
if ($openSISNotifyAddress)
mail($openSISNotifyAddress, 'HACKING ATTEMPT', "INSERT INTO hacking_log (HOST_NAME,IP_ADDRESS,LOGIN_DATE,VERSION,PHP_SELF,DOCUMENT_ROOT,SCRIPT_NAME,MODNAME,USERNAME) values('$_SERVER[SERVER_NAME]','$ip','" . date('Y-m-d') . "','$openSISVersion','$_SERVER[PHP_SELF]','$_SERVER[DOCUMENT_ROOT]','$_SERVER[SCRIPT_NAME]','$_REQUEST[modname]','" . User('USERNAME') . "')");
}
exit;
}
if ($_SESSION['unset_student']) {
unset($_SESSION['unset_student']);
unset($_SESSION['staff_id']);
}
}
echo "<div id='cal' class='divcal'> </div>";
if (!isset($_REQUEST['_openSIS_PDF'])) {
for ($i = 1; $i <= $_openSIS['PrepareDate']; $i++) {
echo '<script type="text/javascript">
</script>';
}
echo '</BODY>';
echo '</HTML>';
}
function decode_unicode_url($str) {
$res = '';
$i = 0;
$max = strlen($str) - 6;
while ($i <= $max) {
$character = $str[$i];
if ($character == '%' && $str[$i + 1] == 'u') {
$value = hexdec(substr($str, $i + 2, 4));
$i += 6;
if ($value < 0x0080) // 1 byte: 0xxxxxxx
$character = chr($value);
else if ($value < 0x0800) // 2 bytes: 110xxxxx 10xxxxxx
$character = chr((($value & 0x07c0) >> 6) | 0xc0)
. chr(($value & 0x3f) | 0x80);
else // 3 bytes: 1110xxxx 10xxxxxx 10xxxxxx
$character = chr((($value & 0xf000) >> 12) | 0xe0)
. chr((($value & 0x0fc0) >> 6) | 0x80)
. chr(($value & 0x3f) | 0x80);
} else
$i++;
$res .= $character;
}
return $res . substr($str, $i);
}
function code2utf($num) {
if ($num < 128)
return chr($num);
if ($num < 1024)
return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
if ($num < 32768)
return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128)
. chr(($num & 63) + 128);
if ($num < 2097152)
return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128)
. chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
return '';
}
function unescape($strIn, $iconv_to = 'UTF-8') {
$strOut = '';
$iPos = 0;
$len = strlen($strIn);
while ($iPos < $len) {
$charAt = substr($strIn, $iPos, 1);
if ($charAt == '%') {
$iPos++;
$charAt = substr($strIn, $iPos, 1);
if ($charAt == 'u') {
// Unicode character
$iPos++;
$unicodeHexVal = substr($strIn, $iPos, 4);
$unicode = hexdec($unicodeHexVal);
$strOut .= code2utf($unicode);
$iPos += 4;
} else {
// Escaped ascii character
$hexVal = substr($strIn, $iPos, 2);
if (hexdec($hexVal) > 127) {
// Convert to Unicode
$strOut .= code2utf(hexdec($hexVal));
} else {
$strOut .= chr(hexdec($hexVal));
}
$iPos += 2;
}
} else {
$strOut .= $charAt;
$iPos++;
}
}
if ($iconv_to != "UTF-8") {
$strOut = iconv("UTF-8", $iconv_to, $strOut);
}
return $strOut;
}
?>