Skip to content

Commit

Permalink
Leaf 4118 - new global constances
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie P Holcomb committed Nov 21, 2023
1 parent 28ea717 commit c46ee6d
Show file tree
Hide file tree
Showing 57 changed files with 359 additions and 450 deletions.
21 changes: 9 additions & 12 deletions LEAF_Nexus/admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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]))
Expand Down Expand Up @@ -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']))
{
Expand Down
7 changes: 1 addition & 6 deletions LEAF_Nexus/ajaxEmployee.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 2 additions & 5 deletions LEAF_Nexus/ajaxGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] : '';

Expand Down Expand Up @@ -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 = '<!--{';
Expand Down
5 changes: 2 additions & 3 deletions LEAF_Nexus/ajaxIframe.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@

break;
case 'view_position_permissions':
$position = new Orgchart\Position($oc_db, $oc_login);
$position = new Orgchart\Position(OC_DB, $oc_login);

$t_iframe = new Smarty;
$t_iframe->left_delimiter = '<!--{';
Expand Down Expand Up @@ -181,7 +181,6 @@
$main->assign('title', $config->title);
$main->assign('city', $config->city);

$rev = $oc_db->prepared_query("SELECT * FROM settings WHERE setting='version'", array());
$main->assign('revision', XSSHelpers::xscrub($rev[0]['data']));
$main->assign('revision', XSSHelpers::xscrub(OC_SETTINGS['version']));

$main->display('main_iframe.tpl');
24 changes: 8 additions & 16 deletions LEAF_Nexus/ajaxIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,25 @@

require_once getenv('APP_LIBS_PATH') . '/loaders/Leaf_autoloader.php';

//$settings = $oc_db->query_kv('SELECT * FROM settings', 'setting', 'data');
if (isset($settings['timeZone']))
{
date_default_timezone_set(XSSHelpers::xscrub($settings['timeZone']));
if (isset(LEAF_SETTINGS['timeZone'])) {
date_default_timezone_set(XSSHelpers::xscrub(LEAF_SETTINGS['timeZone']));
}


$oc_login->loginUser();
if ($oc_login)
{
}

$type = null;
switch ($_GET['categoryID']) {
case 1: // employee
$type = new Orgchart\Employee($oc_db, $oc_login);
$type = new Orgchart\Employee(OC_DB, $oc_login);

break;
case 2: // position
$type = new Orgchart\Position($oc_db, $oc_login);
$type = new Orgchart\Position(OC_DB, $oc_login);

break;
case 3: // group
$type = new Orgchart\Group($oc_db, $oc_login);
$type = new Orgchart\Group(OC_DB, $oc_login);

break;
default:
Expand Down Expand Up @@ -133,12 +128,9 @@
$tz = isset($_GET['tz']) ? $_GET['tz'] : null;

if($tz == null){
//$settings = $oc_db->query_kv('SELECT * FROM settings', 'setting', 'data');
if(isset($settings['timeZone']))
{
$tz = $settings['timeZone'];
}
else{
if (isset(LEAF_SETTINGS['timeZone'])) {
$tz = LEAF_SETTINGS['timeZone'];
} else {
$tz = 'America/New_York';
}
}
Expand Down
2 changes: 1 addition & 1 deletion LEAF_Nexus/ajaxPosition.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{
}

$position = new Orgchart\Position($oc_db, $oc_login);
$position = new Orgchart\Position(OC_DB, $oc_login);

$action = isset($_GET['a']) ? $_GET['a'] : '';

Expand Down
2 changes: 1 addition & 1 deletion LEAF_Nexus/api/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

require_once getenv('APP_LIBS_PATH') . '/loaders/Leaf_autoloader.php';

$oc_db = $oc_db;
$oc_db = OC_DB;
$oc_login->setBaseDir('../');

if (strtolower($oc_config->dbName) == strtolower(DIRECTORY_DB)) {
Expand Down
10 changes: 5 additions & 5 deletions LEAF_Nexus/auth_cookie/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

// see if user is valid
$vars = array(':userName' => $user);
$res = $oc_db->prepared_query('SELECT * FROM employee
$res = OC_DB->prepared_query('SELECT * FROM employee
WHERE userName=:userName
AND deleted=0', $vars);

Expand Down Expand Up @@ -65,16 +65,16 @@
':domain' => $res[0]['domain'],
':lastUpdated' => time(),
':new_empUUID' => $res[0]['new_empUUID'] );
$oc_db->prepared_query('INSERT INTO employee (firstName, lastName, middleName, userName, phoneticFirstName, phoneticLastName, domain, lastUpdated, new_empUUID)
OC_DB->prepared_query('INSERT INTO employee (firstName, lastName, middleName, userName, phoneticFirstName, phoneticLastName, domain, lastUpdated, new_empUUID)
VALUES (:firstName, :lastName, :middleName, :userName, :phoFirstName, :phoLastName, :domain, :lastUpdated, :new_empUUID)
ON DUPLICATE KEY UPDATE deleted=0', $vars);

$empUID = $oc_db->getLastInsertID();
$empUID = OC_DB->getLastInsertID();

if ($empUID == 0)
{
$vars = array(':userName' => $res[0]['userName']);
$empUID = $oc_db->prepared_query('SELECT empUID FROM employee
$empUID = OC_DB->prepared_query('SELECT empUID FROM employee
WHERE userName=:userName', $vars)[0]['empUID'];
}

Expand All @@ -84,7 +84,7 @@
':author' => 'viaLogin',
':timestamp' => time(),
);
$oc_db->prepared_query('INSERT INTO employee_data (empUID, indicatorID, data, author, timestamp)
OC_DB->prepared_query('INSERT INTO employee_data (empUID, indicatorID, data, author, timestamp)
VALUES (:empUID, :indicatorID, :data, :author, :timestamp)
ON DUPLICATE KEY UPDATE data=:data', $vars);

Expand Down
10 changes: 5 additions & 5 deletions LEAF_Nexus/auth_domain/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

// see if user is valid
$vars = array(':userName' => $user);
$res = $oc_db->prepared_query('SELECT * FROM employee
$res = OC_DB->prepared_query('SELECT * FROM employee
WHERE userName=:userName
AND deleted=0', $vars);

Expand Down Expand Up @@ -68,15 +68,15 @@
':domain' => $res[0]['domain'],
':lastUpdated' => time(),
':new_empUUID' => $res[0]['new_empUUID'] );
$oc_db->prepared_query('INSERT INTO employee (firstName, lastName, middleName, userName, phoneticFirstName, phoneticLastName, domain, lastUpdated, new_empUUID)
OC_DB->prepared_query('INSERT INTO employee (firstName, lastName, middleName, userName, phoneticFirstName, phoneticLastName, domain, lastUpdated, new_empUUID)
VALUES (:firstName, :lastName, :middleName, :userName, :phoFirstName, :phoLastName, :domain, :lastUpdated, :new_empUUID)
ON DUPLICATE KEY UPDATE deleted=0', $vars);
$empUID = $oc_db->getLastInsertID();
$empUID = OC_DB->getLastInsertID();

if ($empUID == 0)
{
$vars = array(':userName' => $res[0]['userName']);
$empUID = $oc_db->prepared_query('SELECT empUID FROM employee
$empUID = OC_DB->prepared_query('SELECT empUID FROM employee
WHERE userName=:userName', $vars)[0]['empUID'];
}

Expand All @@ -86,7 +86,7 @@
':author' => 'viaLogin',
':timestamp' => time(),
);
$oc_db->prepared_query('INSERT INTO employee_data (empUID, indicatorID, data, author, timestamp)
OC_DB->prepared_query('INSERT INTO employee_data (empUID, indicatorID, data, author, timestamp)
VALUES (:empUID, :indicatorID, :data, :author, :timestamp)
ON DUPLICATE KEY UPDATE data=:data', $vars);

Expand Down
10 changes: 5 additions & 5 deletions LEAF_Nexus/auth_token/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
}

$vars = array(':email' => $_SERVER['SSL_CLIENT_S_DN_UID']);
$res = $oc_db->prepared_query('SELECT * FROM employee_data
$res = OC_DB->prepared_query('SELECT * FROM employee_data
LEFT JOIN employee USING (empUID)
WHERE indicatorID = 6
AND data = :email
Expand Down Expand Up @@ -67,15 +67,15 @@
':domain' => $res[0]['domain'],
':lastUpdated' => time(),
':new_empUUID' => $res[0]['new_empUUID'] );
$oc_db->prepared_query('INSERT INTO employee (firstName, lastName, middleName, userName, phoneticFirstName, phoneticLastName, domain, lastUpdated, new_empUUID)
OC_DB->prepared_query('INSERT INTO employee (firstName, lastName, middleName, userName, phoneticFirstName, phoneticLastName, domain, lastUpdated, new_empUUID)
VALUES (:firstName, :lastName, :middleName, :userName, :phoFirstName, :phoLastName, :domain, :lastUpdated, :new_empUUID)
ON DUPLICATE KEY UPDATE deleted=0', $vars);
$empUID = $oc_db->getLastInsertID();
$empUID = OC_DB->getLastInsertID();

if ($empUID == 0)
{
$vars = array(':userName' => $res[0]['userName']);
$empUID = $oc_db->prepared_query('SELECT empUID FROM employee
$empUID = OC_DB->prepared_query('SELECT empUID FROM employee
WHERE userName=:userName', $vars)[0]['empUID'];
}

Expand All @@ -85,7 +85,7 @@
':author' => 'viaLogin',
':timestamp' => time(),
);
$oc_db->prepared_query('INSERT INTO employee_data (empUID, indicatorID, data, author, timestamp)
OC_DB->prepared_query('INSERT INTO employee_data (empUID, indicatorID, data, author, timestamp)
VALUES (:empUID, :indicatorID, :data, :author, :timestamp)
ON DUPLICATE KEY UPDATE data=:data', $vars);

Expand Down
6 changes: 3 additions & 3 deletions LEAF_Nexus/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
$type = null;
switch ($_GET['categoryID']) {
case 1: // employee
$type = new Orgchart\Employee($oc_db, $oc_login);
$type = new Orgchart\Employee(OC_DB, $oc_login);

break;
case 2: // position
$type = new Orgchart\Position($oc_db, $oc_login);
$type = new Orgchart\Position(OC_DB, $oc_login);

break;
case 3: // group
$type = new Orgchart\Group($oc_db, $oc_login);
$type = new Orgchart\Group(OC_DB, $oc_login);

break;
default:
Expand Down
6 changes: 3 additions & 3 deletions LEAF_Nexus/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
$type = null;
switch ($_GET['categoryID']) {
case 1: // employee
$type = new Orgchart\Employee($oc_db, $oc_login);
$type = new Orgchart\Employee(OC_DB, $oc_login);

break;
case 2: // position
$type = new Orgchart\Position($oc_db, $oc_login);
$type = new Orgchart\Position(OC_DB, $oc_login);

break;
case 3: // group
$type = new Orgchart\Group($oc_db, $oc_login);
$type = new Orgchart\Group(OC_DB, $oc_login);

break;
default:
Expand Down
Loading

0 comments on commit c46ee6d

Please sign in to comment.