Files
HotLunches/ajax.ResetPageContent.php
2026-10-19 15:22:52 -07:00

136 lines
5.2 KiB
PHP

<?php
$ValidAccess = 2010;
require_once("include/globals.php");
if (session_status() != PHP_SESSION_ACTIVE) {
session_name($sessionName);
session_start();
}
$moduleName = "ajax.ResetStaffPasswords.php";
// startLog($moduleName);
// CSRF token validation
include "include/ajax.csrfToken.php";
logActivity("Staff.ResetPasswords");
$return_data = array();
$sequence_flag = 'N';
if (SessionActive() != 1 || ! UserLoggedIn()) {
header("Location: /?error_message=" . urlencode(getLanguageText('ERRORMSG-SESSION-EXPIRED')));
exit;
}
// Ensure that only valid user types have access to this module
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Communications Administrator');
if (checkPermission($AllowedUserTypes) != 1) {
exit();
}
// Get parameters
if (array_key_exists('record_num', $_GET)) $record_num = intval($_GET['record_num']);
if (!isset($record_num)) exit();
$content = '';
$content_id = db_getVal("SELECT content_id FROM formatted_content WHERE school_num = $school_num AND record_num = $record_num");
$url = $school_record['url'];
$pac_name = $school_record['pac_name'];
$siteType = "hotlunch";
if (strpos($url,'fundraiserorders.com') !== false) $siteType = 'fundraising';
if (strpos($url,'payschoolfees.net') !== false) $siteType = 'schoolfees';
if (strpos($url,'registrationnow.net') !== false) $siteType = 'registration';
if ($content_id == 'Welcome Page') {
switch ($siteType) {
case 'hotlunch':
$content = "<p>Welcome to the $pac_name and Lunch web site. On this site parents will be " .
"able to place lunch orders for their children.</p>\n" .
"<p>We believe that by involving and informing parents we will have a more supportive and effective school " .
"environment for our children. It is up to us to work together to ensure our children have the best " .
"possible school experience.</p>\n";
break;
case 'fundraising':
$content = "<p>Welcome to the $pac_name fund raising web site. On this site parents will be " .
"place fund raising orders for our $orgType.</p>\n";
break;
case 'schoolfees':
$content = "<p>Welcome to the $pac_name school fees web site. On this site parents will be able to pay school fees and " .
"register children for fieldtrips.</p>\n";
break;
case 'registration':
$content = "<p>Welcome to the $pac_name registration web site.</p>\n";
break;
}
}
if ($content_id == 'Login Page') {
switch ($siteType) {
case 'hotlunch':
$content = "<p><span style='font-size: medium;'><strong>Welcome</strong></span></p>\n" .
"<p>Welcome to the lunch on-line system. This application is meant to " .
"facilitate the ordering and management of school lunch orders for both " .
"parents and the $pac_name. Please feel free to contact us with any suggestions " .
"or problems you have with the system.</p>\n";
break;
case 'fundraising':
$content = "<p><span style='font-size: medium;'><strong>Welcome</strong></span></p>\n" .
"<p>Welcome to the $pac_name fund raising web site. On this site parents will be " .
"place fund raising orders for our $orgType.</p>\n";
break;
case 'schoolfees':
$content = "<p><span style='font-size: medium;'><strong>Welcome</strong></span></p>\n" .
"<p>Welcome to the $pac_name school fees web site. On this site parents will be able to pay school fees and " .
"register children for fieldtrips.</p>\n";
break;
case 'registration':
$content = "<p><span style='font-size: medium;'><strong>Welcome</strong></span></p>\n" .
"<p>Welcome to the $pac_name registration web site.</p>\n";
break;
}
}
if ($content_id == 'Contact Information') {
$content = "<p>This is the list of the members of the $pac_name. These are parent volunteers who work to raise funds and use " .
"those funds to purchase items for our school to enhance the learning experience for our children.</p>";
}
if ($content_id == 'Access to Class List Denied') {
$content = "<p>You have accessed the contact list for your child's class, but your child " .
"has not yet been verified in the system. In order to protect our children " .
"we only allow access to the class lists once your child has been verified. " .
"As parents we are sure you understand our caution.</p>\n" .
"<p>Please bear with us as we are processing the registrations and verifying " .
"the students as fast as possible.</p>\n" .
"<p>$pac_name</p>";
}
$return_data["ajax_return_code"] = -1;
if (strlen($content)) {
$date = date("Y-m-d",time());
$query = "UPDATE formatted_content SET content = '" . db_escape_string($content) . "', date_modified = '$date' WHERE school_num = $school_num AND record_num = $record_num";
db_query($query);
$return_data["ajax_return_code"] = 0;
}
echo(json_encode($return_data));
writeLog("completed\n");
?>