From c46ee6da61815b2dab0088d2ef761af13f465321 Mon Sep 17 00:00:00 2001 From: Jamie P Holcomb Date: Tue, 21 Nov 2023 07:29:55 -0500 Subject: [PATCH] Leaf 4118 - new global constances --- LEAF_Nexus/admin/index.php | 21 +++-- LEAF_Nexus/ajaxEmployee.php | 7 +- LEAF_Nexus/ajaxGroup.php | 7 +- LEAF_Nexus/ajaxIframe.php | 5 +- LEAF_Nexus/ajaxIndex.php | 24 ++---- LEAF_Nexus/ajaxPosition.php | 2 +- LEAF_Nexus/api/index.php | 2 +- LEAF_Nexus/auth_cookie/index.php | 10 +-- LEAF_Nexus/auth_domain/index.php | 10 +-- LEAF_Nexus/auth_token/index.php | 10 +-- LEAF_Nexus/file.php | 6 +- LEAF_Nexus/image.php | 6 +- LEAF_Nexus/index.php | 42 +++++----- LEAF_Nexus/login/index.php | 8 +- LEAF_Nexus/report.php | 10 +-- LEAF_Nexus/scripts/convertFileNames.php | 6 +- LEAF_Nexus/scripts/firstRun.php | 10 +-- .../scripts/refreshOrgchartEmployees.php | 26 +++---- LEAF_Nexus/scripts/syncSVNrevision.php | 4 +- LEAF_Nexus/scripts/updateDatabase.php | 2 +- LEAF_Nexus/sources/Config.php | 2 - LEAF_Nexus/test.php | 2 +- LEAF_Nexus/utils/exportPDL.php | 6 +- LEAF_Nexus/utils/jsonExport_PDL.php | 12 +-- LEAF_Request_Portal/admin/ajaxIndex.php | 66 +++++++--------- LEAF_Request_Portal/admin/ajaxJSON.php | 2 +- LEAF_Request_Portal/admin/index.php | 37 ++++----- LEAF_Request_Portal/admin/modgroups.php | 4 +- LEAF_Request_Portal/ajaxIframe.php | 16 ++-- LEAF_Request_Portal/ajaxIndex.php | 43 +++------- LEAF_Request_Portal/ajaxJSON.php | 8 +- LEAF_Request_Portal/ajaxMicro.php | 4 +- LEAF_Request_Portal/ajaxScript.php | 2 +- .../api/controllers/SiteController.php | 2 +- LEAF_Request_Portal/api/index.php | 78 +++++++++---------- LEAF_Request_Portal/auth_cookie/index.php | 10 +-- .../auth_domain/LEAF_coach_key.php | 4 +- LEAF_Request_Portal/auth_domain/api/index.php | 2 + LEAF_Request_Portal/auth_domain/index.php | 10 +-- LEAF_Request_Portal/auth_token/index.php | 10 +-- LEAF_Request_Portal/file.php | 2 +- LEAF_Request_Portal/image.php | 2 +- LEAF_Request_Portal/index.php | 61 +++++++-------- LEAF_Request_Portal/login/index.php | 8 +- LEAF_Request_Portal/open.php | 2 +- LEAF_Request_Portal/report.php | 22 +++--- .../scripts/automated_email.php | 10 +-- LEAF_Request_Portal/scripts/firstRun.php | 4 +- .../scripts/syncSVNrevision.php | 2 +- LEAF_Request_Portal/scripts/sync_services.php | 14 ++-- .../scripts/updateDatabase.php | 2 +- LEAF_Request_Portal/sources/Site.php | 6 -- .../utils/LEAF_exportStandardConfig.php | 28 ++++--- .../utils/LEAF_importStandardConfig.php | 72 ++++++++--------- app/libs/loaders/Leaf_autoloader.php | 28 +++---- .../automatedDestruction.php | 4 +- .../refreshOrgchartEmployees.php | 4 +- 57 files changed, 359 insertions(+), 450 deletions(-) diff --git a/LEAF_Nexus/admin/index.php b/LEAF_Nexus/admin/index.php index 2ae360046..7147bc4f0 100644 --- a/LEAF_Nexus/admin/index.php +++ b/LEAF_Nexus/admin/index.php @@ -110,12 +110,11 @@ $t_form->assign('timeZones', DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, 'US')); - //$settings = $db->query_kv('SELECT * FROM settings', 'setting', 'data'); - $t_form->assign('timeZone', $settings['timeZone']); - $t_form->assign('heading', XSSHelpers::sanitizeHTMLRich($settings['heading'] == '' ? $config->title : $settings['heading'])); - $t_form->assign('subheading', XSSHelpers::sanitizeHTMLRich($settings['subheading'] == '' ? $config->city : $settings['subheading'])); + $t_form->assign('timeZone', LEAF_SETTINGS['timeZone']); + $t_form->assign('heading', XSSHelpers::sanitizeHTMLRich(LEAF_SETTINGS['heading'])); + $t_form->assign('subheading', XSSHelpers::sanitizeHTMLRich(LEAF_SETTINGS['subheading'])); - $tagObj = new Orgchart\Tag($db, $oc_login); + $tagObj = new Orgchart\Tag(DB, $oc_login); $t_form->assign('serviceParent', $tagObj->getParent('service')); $memberships = $oc_login->getMembership(); @@ -142,9 +141,8 @@ $t_form->assign('CSRFToken', $_SESSION['CSRFToken']); - //$settings = $db->query_kv('SELECT * FROM settings', 'setting', 'data'); - $t_form->assign('heading', XSSHelpers::sanitizeHTMLRich($settings['heading'] == '' ? $config->title : $settings['heading'])); - $t_form->assign('subheading', XSSHelpers::sanitizeHTMLRich($settings['subheading'] == '' ? $config->city : $settings['subheading'])); + $t_form->assign('heading', XSSHelpers::sanitizeHTMLRich(LEAF_SETTINGS['heading'])); + $t_form->assign('subheading', XSSHelpers::sanitizeHTMLRich(LEAF_SETTINGS['subheading'])); $memberships = $oc_login->getMembership(); if (isset($memberships['groupID'][1])) @@ -263,10 +261,9 @@ $tabText = $tabText == '' ? '' : $tabText . ' '; $main->assign('tabText', $tabText); -//$settings = $db->query_kv('SELECT * FROM settings', 'setting', 'data'); -$main->assign('title', XSSHelpers::sanitizeHTMLRich($settings['heading'] == '' ? $config->title : $settings['heading'])); -$main->assign('city', XSSHelpers::sanitizeHTMLRich($settings['subheading'] == '' ? $config->city : $settings['subheading'])); -$main->assign('revision', XSSHelpers::xscrub($settings['version'])); +$main->assign('title', XSSHelpers::sanitizeHTMLRich(LEAF_SETTINGS['heading'])); +$main->assign('city', XSSHelpers::sanitizeHTMLRich(LEAF_SETTINGS['subheading'])); +$main->assign('revision', XSSHelpers::xscrub(LEAF_SETTINGS['version'])); if (!isset($_GET['iframe'])) { diff --git a/LEAF_Nexus/ajaxEmployee.php b/LEAF_Nexus/ajaxEmployee.php index 457b33536..3e676e55d 100644 --- a/LEAF_Nexus/ajaxEmployee.php +++ b/LEAF_Nexus/ajaxEmployee.php @@ -19,18 +19,13 @@ $oc_login->loginUser(); -if ($oc_login) -{ -} - -$employee = new Orgchart\Employee($oc_db, $oc_login); +$employee = new Orgchart\Employee(OC_DB, $oc_login); $action = isset($_GET['a']) ? $_GET['a'] : ''; $uid = isset($_GET['empUID']) && is_numeric($_GET['empUID']) ? $_GET['empUID'] : 0; $indicatorID = isset($_GET['indicatorID']) && is_numeric($_GET['indicatorID']) ? $_GET['indicatorID'] : 0; - switch ($action) { case 'getForm': $t_form = new Smarty; diff --git a/LEAF_Nexus/ajaxGroup.php b/LEAF_Nexus/ajaxGroup.php index 5e50a001b..d5e67deb7 100644 --- a/LEAF_Nexus/ajaxGroup.php +++ b/LEAF_Nexus/ajaxGroup.php @@ -14,11 +14,8 @@ require_once getenv('APP_LIBS_PATH') . '/loaders/Leaf_autoloader.php'; $oc_login->loginUser(); -if ($oc_login) -{ -} -$group = new Orgchart\Group($oc_db, $oc_login); +$group = new Orgchart\Group(OC_DB, $oc_login); $action = isset($_GET['a']) ? $_GET['a'] : ''; @@ -81,7 +78,7 @@ break; case 'listPositionData': - $employee = new Orgchart\Employee($oc_db, $oc_login); + $employee = new Orgchart\Employee(OC_DB, $oc_login); $t_form = new Smarty; $t_form->left_delimiter = ''; - $rev = $oc_db->prepared_query("SELECT * FROM settings WHERE setting='dbversion'", array()); - $t_form->assign('dbversion', XSSHelpers::xscrub($rev[0]['data'])); + $t_form->assign('dbversion', XSSHelpers::xscrub(OC_SETTINGS['dbversion'])); $main->assign('hideFooter', true); $main->assign('body', $t_form->fetch('view_about.tpl')); @@ -504,8 +503,8 @@ function customTemplate($tpl) $t_form->left_delimiter = ''; - $employee = new Orgchart\Employee($oc_db, $oc_login); - $position = new Orgchart\Position($oc_db, $oc_login); + $employee = new Orgchart\Employee(OC_DB, $oc_login); + $position = new Orgchart\Position(OC_DB, $oc_login); $currentEmployee = $employee->lookupLogin($oc_login->getUserID()); $t_form->assign('employee', $currentEmployee); @@ -518,7 +517,7 @@ function customTemplate($tpl) $groupLeader = ''; if (count($resolvedService) > 0) { - $group = new Orgchart\Group($oc_db, $oc_login); + $group = new Orgchart\Group(OC_DB, $oc_login); $groupLeader = $group->getGroupLeader($resolvedService[0]['groupID']); } @@ -566,10 +565,9 @@ function customTemplate($tpl) $tabText = $tabText == '' ? '' : $tabText . ' '; $main->assign('tabText', $tabText); -//$settings = $oc_db->query_kv('SELECT * FROM settings', 'setting', 'data'); -$main->assign('title', XSSHelpers::sanitizeHTMLRich($settings['heading'] == '' ? $config->title : $settings['heading'])); -$main->assign('city', XSSHelpers::sanitizeHTMLRich($settings['subheading'] == '' ? $config->city : $settings['subheading'])); -$main->assign('revision', XSSHelpers::xscrub($settings['version'])); +$main->assign('title', XSSHelpers::sanitizeHTMLRich(LEAF_SETTINGS['heading'])); +$main->assign('city', XSSHelpers::sanitizeHTMLRich(LEAF_SETTINGS['subheading'])); +$main->assign('revision', XSSHelpers::xscrub(LEAF_SETTINGS['version'])); if (!isset($_GET['iframe'])) { diff --git a/LEAF_Nexus/login/index.php b/LEAF_Nexus/login/index.php index 45ceb7dfb..f1302a827 100644 --- a/LEAF_Nexus/login/index.php +++ b/LEAF_Nexus/login/index.php @@ -11,10 +11,6 @@ require_once getenv('APP_LIBS_PATH') . '/loaders/Leaf_autoloader.php'; -//$settings = $db->query_kv('SELECT * FROM settings', 'setting', 'data'); -$settings['heading'] = XSSHelpers::sanitizeHTMLRich($settings['heading'] == '' ? $config->title : $settings['heading']); -$settings['subHeading'] = XSSHelpers::sanitizeHTMLRich($settings['subHeading'] == '' ? $config->city : $settings['subHeading']); - function getBaseDir() { $dir = dirname($_SERVER['PHP_SELF']); @@ -43,8 +39,8 @@ function getBaseDir()