217 lines
11 KiB
PHP
217 lines
11 KiB
PHP
<?php
|
|
|
|
$accessCode = 2010;
|
|
|
|
// Ensure that the page is being accessed correctly
|
|
if (!isset($ValidAccess) || $ValidAccess != $accessCode) {
|
|
echo("Invalid Page Access");
|
|
exit();
|
|
}
|
|
|
|
|
|
// Set default timezone
|
|
date_default_timezone_set("America/Vancouver");
|
|
$prevCode = 78910;
|
|
$authCode = 13425;
|
|
|
|
|
|
setlocale(LC_ALL, 'en_US.UTF-8');
|
|
ini_set('default_charset', 'UTF-8');
|
|
|
|
|
|
$grace_period = -5;
|
|
|
|
|
|
//
|
|
// Include all required files
|
|
//
|
|
$cdir = "/m/data1/app.hotlunches.net";
|
|
$AppDir = $cdir;
|
|
|
|
//
|
|
// Handle current language selection
|
|
//
|
|
// $currLanguage = $school_record['default_language'];
|
|
// if (isset($_COOKIE['language_cookie']) && strlen($_COOKIE['language_cookie']) > 0) $currLanguage = $_COOKIE['language_cookie'];
|
|
// if (isset($_SESSION['UserInfo']['language'])) $currLanguage = $_SESSION['UserInfo']['language'];
|
|
// if (isset($_GET['selected_language']) && strlen($_GET['selected_language']) > 0) $currLanguage = $_GET['selected_language'];
|
|
// $_SESSION['UserInfo']['language'] = $currLanguage;
|
|
// setcookie('language_cookie', $currLanguage, time()+60*60*24*120, $cookiePath);
|
|
|
|
|
|
require_once("$cdir/include/logging-functions.php");
|
|
// startLog("globals.php");
|
|
require_once("$cdir/include/config.php");
|
|
require_once("$cdir/include/database.php");
|
|
require_once("$cdir/include/school-functions.php");
|
|
require_once("$cdir/include/date-time.php");
|
|
require_once("$cdir/include/session.php");
|
|
require_once("$cdir/include/current-language.php");
|
|
require_once("$cdir/include/globaltext.php");
|
|
require_once("$cdir/include/template.php");
|
|
require_once("$cdir/include/functions.php");
|
|
require_once("global.functions.php");
|
|
require_once("optionlist.php");
|
|
require_once("table.php");
|
|
|
|
require_once("$cdir/include/initForm.php");
|
|
// if (isset($_SESSION) && array_key_exists('type', $_SESSION['UserInfo']) && $_SESSION['UserInfo']['type'] == 'SuperUser') startLog("globals.php");
|
|
// writeLog("includes complete");
|
|
// writeLog("_SESSION[db_dbname]: ".$_SESSION['db_dbname']);
|
|
if (isset($_SESSION) && array_key_exists('db_dbname', $_SESSION) && strlen($_SESSION['db_dbname'])) db_query("USE ".$_SESSION['db_dbname']);
|
|
|
|
|
|
if (!isset($school_num)) exit();
|
|
|
|
if (isset($_SESSION) && array_key_exists('UserInfo',$_SESSION) && array_key_exists('record_num', $_SESSION['UserInfo'])) $loggedInId = $_SESSION['UserInfo']['record_num'];
|
|
else $loggedInId = '';
|
|
|
|
if (intval($supplier_school_num) == 0) $supplier_school_num = $school_num;
|
|
|
|
|
|
//
|
|
// Set supplier costs format string
|
|
//
|
|
$costFmt = "%.".$school_record['supplier_costs_decimals']."f";
|
|
|
|
|
|
//
|
|
// Set school template if required
|
|
//
|
|
$school_template = $school_record['template'];
|
|
if (strlen($school_template) > 0 && is_file("templates/$school_template")) $currentTemplate = $school_template;
|
|
|
|
$languagesFile = "languages.txt";
|
|
if (is_file("languages.$schoolID.txt")) $languagesFile = "languages.$schoolID.txt";
|
|
|
|
|
|
|
|
|
|
//
|
|
// Site Type
|
|
//
|
|
$siteType = "hotlunch";
|
|
if (preg_match("/payschoolfees.net/",$currentURL)) $siteType = "schoolfees";
|
|
if (preg_match("/fundraiserorders.com/",$currentURL)) $siteType = "fundraising";
|
|
if (preg_match("/schoolclothingorder.com/",$currentURL)) $siteType = "fundraising";
|
|
if (preg_match("/schooltripfundraising.com/",$currentURL)) $siteType = "fundraising";
|
|
if (preg_match("/registrationnow.net/",$currentURL)) $siteType = "registration";
|
|
if (preg_match("/yearbookorders.net/",$currentURL)) $siteType = "yearbook";
|
|
if (preg_match("/yearbookorders.net/",$currentURL)) $siteType = "yearbook";
|
|
if (preg_match("/buyticketsnow.net/",$currentURL)) $siteType = "tickets";
|
|
if (preg_match("/schooltickets.net/",$currentURL)) $siteType = "tickets";
|
|
|
|
$ApplicationURLS = array(array('url' => "hotlunches.net", 'secure' => TRUE, 'domain' => "standard"),
|
|
array('url' => "payschoolfees.net", 'secure' => TRUE, 'domain' => "standard"),
|
|
array('url' => "hotlunches.dev", 'secure' => TRUE, 'domain' => "standard"),
|
|
|
|
array('url' => "hotlunches.ca", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "fundraiserorders.com", 'secure' => TRUE, 'domain' => "standard"),
|
|
array('url' => "registrationnow.net", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "yearbookorders.net", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "buyticketsnow.net", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "schooltickets.net", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "schoolclothingorder.com", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "schooltripfundraising.com", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "schoolparentcouncil.com", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "parentcouncil.net", 'secure' => TRUE, 'domain' => "standard"),
|
|
array('url' => "schoolcouncil.net", 'secure' => TRUE, 'domain' => "standard"),
|
|
array('url' => "schoolclothesorder.com", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "schoollunchorders.net", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "buyticketsnow.net", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "schoolsuppliesorder.com", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "gradfundraising.com", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "gradfundraising.net", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "milkprogram.com", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "schoolhotdogs.com", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "hotdogday.net", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "pizzalunchorder.com", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "ouronlineorders.com", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "ouronlineorders.net", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "hotlunchesonline.net", 'secure' => FALSE, 'domain' => "standard"),
|
|
|
|
array('url' => "calendars4schools.com", 'secure' => FALSE, 'domain' => "standard"),
|
|
array('url' => "calendars4schools.net", 'secure' => FALSE, 'domain' => "standard"),
|
|
|
|
array('url' => "esns.ca", 'secure' => TRUE, 'domain' => "custom"),
|
|
array('url' => "backpacfundraising.com", 'secure' => TRUE, 'domain' => "custom"),
|
|
array('url' => "pitapitottawa.ca", 'secure' => FALSE, 'domain' => "custom"),
|
|
array('url' => "pitapitmilton.ca", 'secure' => TRUE, 'domain' => "custom"),
|
|
array('url' => "pitapitmississauga.ca", 'secure' => TRUE, 'domain' => "custom"),
|
|
array('url' => "dukecatering.com", 'secure' => FALSE, 'domain' => "custom"),
|
|
array('url' => "servings.ca", 'secure' => FALSE, 'domain' => "custom"),
|
|
array('url' => "fuelcatering.ca", 'secure' => FALSE, 'domain' => "custom"),
|
|
array('url' => "coldlunchcounts.com", 'secure' => FALSE, 'domain' => "custom"),
|
|
array('url' => "lunchinhand.net", 'secure' => FALSE, 'domain' => "custom"),
|
|
array('url' => "lunchinhand.com", 'secure' => FALSE, 'domain' => "custom"),
|
|
|
|
array('url' => "springvalleypta.org", 'secure' => FALSE, 'domain' => "custom"),
|
|
|
|
array('url' => "wrepac.ca", 'secure' => TRUE, 'domain' => "custom"),
|
|
array('url' => "aeslunchbox.com", 'secure' => TRUE, 'domain' => "custom"),
|
|
array('url' => "clesharks.ca", 'secure' => TRUE, 'domain' => "custom"),
|
|
array('url' => "dwepac.org", 'secure' => TRUE, 'domain' => "custom"),
|
|
array('url' => "ggpac.org", 'secure' => TRUE, 'domain' => "custom"),
|
|
array('url' => "glenmoreschool.ca", 'secure' => TRUE, 'domain' => "custom"),
|
|
array('url' => "larondepac.ca", 'secure' => TRUE, 'domain' => "custom"),
|
|
array('url' => "stonecrestcouncil.ca", 'secure' => TRUE, 'domain' => "custom"),
|
|
array('url' => "sullivanpac.com", 'secure' => TRUE, 'domain' => "custom"),
|
|
);
|
|
|
|
$OrderDetailsText = getLanguageText('TEXT-ORDER-DETAILS');
|
|
if ($siteType == 'registration') $OrderDetailsText = getLanguageText('TEXT-REGISTRATION-DETAILS');
|
|
|
|
$deleteConfirmationMsg = getLanguageText('TEXT-CONFIRM-DELETE');
|
|
|
|
|
|
//
|
|
// Determine the number of entries for students, classes, staff and suppliers
|
|
//
|
|
$NumStudents = db_getVal("SELECT count(*) FROM people WHERE school_num = $base_school_num AND people_type IN ('Student','Customer')");
|
|
$NumStaff = db_getVal("SELECT count(*) FROM people WHERE school_num = $base_school_num AND people_type IN ('Staff')");
|
|
$NumUsers = db_getVal("SELECT count(*) FROM users WHERE school_num = $base_school_num AND type IN ('Parent','Administration Team','Guest')");
|
|
$NumClasses = db_getVal("SELECT count(*) FROM classes WHERE school_num = $base_school_num");
|
|
$NumSuppliers = db_getVal("SELECT count(*) FROM suppliers WHERE school_num = $base_school_num");
|
|
$NumAllergens = db_getVal("SELECT count(*) FROM allergens WHERE school_num = $base_school_num");
|
|
|
|
|
|
//
|
|
// Define schedule sort order
|
|
//
|
|
$scheduleSortOrder = "schedule_start_date desc";
|
|
switch ($school_record['schedule_sort']) {
|
|
case 'desc':
|
|
$scheduleSortOrder = "start_order_datetime desc, schedule_name";
|
|
$menuSortOrder = "sequence desc";
|
|
break;
|
|
|
|
case 'asc':
|
|
$scheduleSortOrder = "start_order_datetime asc, schedule_name";
|
|
$menuSortOrder = "sequence asc";
|
|
break;
|
|
|
|
case 'alpha':
|
|
$scheduleSortOrder = "schedule_name asc";
|
|
$menuSortOrder = "sequence asc";
|
|
break;
|
|
|
|
case 'sequence':
|
|
default:
|
|
$scheduleSortOrder = "sequence,start_order_datetime,schedule_name asc";
|
|
$menuSortOrder = "sequence asc";
|
|
break;
|
|
}
|
|
|
|
|
|
// Letters array for date upload from CSV
|
|
$Letters = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
|
|
'AA','AB','AC','AD','AE','AF','AG','AH','AI','AJ','AK','AL','AM','AN','AO','AP','AQ','AR','AS','AT','AU','AV','AW','AX','AY','AZ');
|
|
|
|
$bamboraTransactionFee = 0.25;
|
|
$bamboraTransactionPercentage = 2.7;
|
|
|
|
if (!isset($base_school_num) || intval($base_school_num) == 0) $base_school_num = $school_num;
|
|
|
|
writeLog("globals.php - complete");
|
|
?>
|