From 10159c25267e4ef1b88779450e5cde6678d047e8 Mon Sep 17 00:00:00 2001 From: Bill Dueber Date: Wed, 20 Jan 2016 11:38:06 -0500 Subject: [PATCH 01/10] Add ip display to header --- resources/templates/header.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/templates/header.php b/resources/templates/header.php index 631f8bd28..dd5498956 100644 --- a/resources/templates/header.php +++ b/resources/templates/header.php @@ -97,6 +97,8 @@ }else{ echo $user->loginID; } +
+On machine ^M ?> From 010814ec93de829c218f83f41d228cbb682e2c8c Mon Sep 17 00:00:00 2001 From: Bill Dueber Date: Wed, 20 Jan 2016 11:39:12 -0500 Subject: [PATCH 02/10] Added CoralSession.php --- .../admin/classes/common/CoralSession.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 resources/admin/classes/common/CoralSession.php diff --git a/resources/admin/classes/common/CoralSession.php b/resources/admin/classes/common/CoralSession.php new file mode 100644 index 000000000..973a7f522 --- /dev/null +++ b/resources/admin/classes/common/CoralSession.php @@ -0,0 +1,38 @@ + \ No newline at end of file From f734ace4df63adcf21ef01a6d0554061a18d88e1 Mon Sep 17 00:00:00 2001 From: Bill Dueber Date: Wed, 20 Jan 2016 11:43:19 -0500 Subject: [PATCH 03/10] Removed all instances of session_start outside of CoralSession --- resources/admin/classes/common/CoralSession.php | 10 +++------- resources/ajax_htmldata.php | 2 -- resources/export.php | 2 -- resources/import.php | 1 - resources/index.php | 1 - resources/install/CORALInstaller.php | 1 - resources/resource.php | 1 - resources/resources/cataloging.php | 2 -- resources/resources/cataloging_update.php | 1 - resources/sendAlerts.php | 1 - resources/summary.php | 1 - resources/user.php | 2 -- 12 files changed, 3 insertions(+), 22 deletions(-) diff --git a/resources/admin/classes/common/CoralSession.php b/resources/admin/classes/common/CoralSession.php index 973a7f522..cd04379ba 100644 --- a/resources/admin/classes/common/CoralSession.php +++ b/resources/admin/classes/common/CoralSession.php @@ -13,7 +13,7 @@ private static function open_for_read() { return self::$instance; } - public static get($key) { + public static function get($key) { self::open_for_read(); if (isset($_SESSION[$key])) { return $_SESSION[$key] @@ -22,7 +22,7 @@ private static function open_for_read() { } } - public static set($key, $value) { + public static function set($key, $value) { session_start(); $_SESSION[$key] = $value; session_write_close(); @@ -30,9 +30,5 @@ private static function open_for_read() { } } - - - - - + ?> \ No newline at end of file diff --git a/resources/ajax_htmldata.php b/resources/ajax_htmldata.php index 6b8c661a4..e95e7eebe 100644 --- a/resources/ajax_htmldata.php +++ b/resources/ajax_htmldata.php @@ -17,8 +17,6 @@ ************************************************************************************************************************** */ -session_start(); - include_once 'directory.php'; include_once 'user.php'; diff --git a/resources/export.php b/resources/export.php index 760fb30e6..98666799b 100644 --- a/resources/export.php +++ b/resources/export.php @@ -18,8 +18,6 @@ */ -session_start(); - include_once 'directory.php'; include_once 'util.php'; diff --git a/resources/import.php b/resources/import.php index 486ea7da9..0e6979937 100644 --- a/resources/import.php +++ b/resources/import.php @@ -16,7 +16,6 @@ ** ************************************************************************************************************************** */ -session_start(); include_once 'directory.php'; //print header $pageTitle=_('Resources import'); diff --git a/resources/index.php b/resources/index.php index c603282af..611ff3fe0 100644 --- a/resources/index.php +++ b/resources/index.php @@ -18,7 +18,6 @@ */ -session_start(); include_once 'directory.php'; diff --git a/resources/install/CORALInstaller.php b/resources/install/CORALInstaller.php index a8b7c0b3e..00b074370 100644 --- a/resources/install/CORALInstaller.php +++ b/resources/install/CORALInstaller.php @@ -1,5 +1,4 @@ hasOpenSession())){ - session_start(); $_SESSION['loginID'] = $loginID; //no open session @@ -78,7 +77,6 @@ - session_start(); $_SESSION['loginID'] = $loginID; From c3eef7819b5cfa047c6054e243cc4830de220525 Mon Sep 17 00:00:00 2001 From: Bill Dueber Date: Wed, 20 Jan 2016 11:58:46 -0500 Subject: [PATCH 04/10] Turn all stuff into get/set --- resources/admin.php | 2 +- .../admin/classes/common/CoralSession.php | 10 ++++----- resources/admin/classes/domain/Resource.php | 6 ++--- .../admin/classes/domain/ResourceStep.php | 2 +- resources/index.php | 22 +++++++++---------- resources/install/CORALInstaller.php | 1 + resources/queue.php | 2 +- resources/resource.php | 4 ++-- resources/user.php | 13 ++++------- 9 files changed, 29 insertions(+), 33 deletions(-) diff --git a/resources/admin.php b/resources/admin.php index fbf7b8ae2..cac960b86 100644 --- a/resources/admin.php +++ b/resources/admin.php @@ -23,7 +23,7 @@ include 'templates/header.php'; //set referring page -$_SESSION['ref_script']=$currentPage; +CoralSession::set('ref_script', $currentPage); $config = new Configuration; diff --git a/resources/admin/classes/common/CoralSession.php b/resources/admin/classes/common/CoralSession.php index cd04379ba..86af3fad0 100644 --- a/resources/admin/classes/common/CoralSession.php +++ b/resources/admin/classes/common/CoralSession.php @@ -2,15 +2,15 @@ class CoralSession { - private static $instance; + private static $opened; private static function open_for_read() { - if (!isset(self::$instance)) { + if (!isset(self::$opened)) { session_start(); session_write_close(); - self::$instance = $_SESSION; + self::$opened = true; } - return self::$instance; + return $_SESSION; } public static function get($key) { @@ -26,7 +26,7 @@ public static function set($key, $value) { session_start(); $_SESSION[$key] = $value; session_write_close(); - self::$instance = $_SESSION + self::$opened = true; } } diff --git a/resources/admin/classes/domain/Resource.php b/resources/admin/classes/domain/Resource.php index 083d380c9..694183ce7 100644 --- a/resources/admin/classes/domain/Resource.php +++ b/resources/admin/classes/domain/Resource.php @@ -885,7 +885,7 @@ public static function setSearch($search) { foreach ($search as $key => $value) { $search[$key] = trim($value); } - $_SESSION['resourceSearch'] = $search; + CoralSession::set('resourceSearch', $search); } public static function resetSearch() { @@ -893,10 +893,10 @@ public static function resetSearch() { } public static function getSearch() { - if (!isset($_SESSION['resourceSearch'])) { + if (!CoralSession::get('resourceSearch')) { Resource::resetSearch(); } - return $_SESSION['resourceSearch']; + return CoralSession::get('resourceSearch'); } public static function getSearchDetails() { diff --git a/resources/admin/classes/domain/ResourceStep.php b/resources/admin/classes/domain/ResourceStep.php index 5022f2cbf..922b8d175 100644 --- a/resources/admin/classes/domain/ResourceStep.php +++ b/resources/admin/classes/domain/ResourceStep.php @@ -32,7 +32,7 @@ public function completeStep(){ //mark this step complete $this->stepEndDate = date( 'Y-m-d' ); - $this->endLoginID = $_SESSION['loginID']; + $this->endLoginID = CoralSession::get('loginID'); $this->save; //if there are next steps, start them diff --git a/resources/index.php b/resources/index.php index 611ff3fe0..eecc93935 100644 --- a/resources/index.php +++ b/resources/index.php @@ -29,13 +29,13 @@ //except we don't want it to retain if they press the 'index' button //check what referring script is -if ($_SESSION['ref_script'] != "resource.php"){ +if (CoralSession:get('ref_script') != "resource.php"){ Resource::resetSearch(); } $search = Resource::getSearch(); -$_SESSION['ref_script']=$currentPage; +CoralSession:set('ref_script', $currentPage); @@ -597,21 +597,21 @@ "; diff --git a/resources/install/CORALInstaller.php b/resources/install/CORALInstaller.php index 00b074370..139a4a96f 100644 --- a/resources/install/CORALInstaller.php +++ b/resources/install/CORALInstaller.php @@ -8,6 +8,7 @@ function debug($value) { } class CORALInstaller { + session_start(); public $db; // because CORALInstaller::query does unwanted things with result public $error; diff --git a/resources/queue.php b/resources/queue.php index 029e7144c..78f8380ff 100644 --- a/resources/queue.php +++ b/resources/queue.php @@ -23,7 +23,7 @@ include 'templates/header.php'; //set referring page -$_SESSION['ref_script']=$currentPage; +CoralSession:set('ref_script', $currentPage); diff --git a/resources/resource.php b/resources/resource.php index a2cfad09d..ce1374ede 100644 --- a/resources/resource.php +++ b/resources/resource.php @@ -33,9 +33,9 @@ //set referring page if ((isset($_GET['ref'])) && ($_GET['ref'] == 'new')){ - $_SESSION['ref_script']="new"; + CoralSession:set('ref_script', 'new'); }else{ - $_SESSION['ref_script']=$currentPage; + CoralSession:set('ref_script', $currentPage); } diff --git a/resources/user.php b/resources/user.php index b0dc33362..67995b457 100644 --- a/resources/user.php +++ b/resources/user.php @@ -35,8 +35,7 @@ //if the user has an open session if (($loginID) && ($user->hasOpenSession())){ - - $_SESSION['loginID'] = $loginID; + CoralSession::set('loginID', $loginID); //no open session }else{ @@ -59,9 +58,7 @@ }else{ //get login id from server - if (!isset($_SESSION['loginID']) || ($_SESSION['loginID'] == '')){ - - + if (!CoralSession::get('loginID') || (CoralSession::get('loginID') == '')){ $varName = $config->settings->remoteAuthVariableName; //the following code takes the remote auth variable name from the config settings and evaluates it to get the actual value from web server @@ -75,14 +72,12 @@ //use the split in case the remote login is supplied as an email address list ($loginID,$restofAddr) = explode("@", $remoteAuth); - - - $_SESSION['loginID'] = $loginID; + CoralSession::set('loginID', $loginID); }else{ - $loginID = $_SESSION['loginID']; + $loginID = CoralSession::get('loginID'); } From 4d64f199aea501c5a3a73ae3f053696f4b5f3b64 Mon Sep 17 00:00:00 2001 From: Bill Dueber Date: Wed, 20 Jan 2016 12:03:30 -0500 Subject: [PATCH 05/10] Colons to double-colons in static calls --- resources/index.php | 4 ++-- resources/queue.php | 2 +- resources/resource.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/index.php b/resources/index.php index eecc93935..6dce22b6d 100644 --- a/resources/index.php +++ b/resources/index.php @@ -29,13 +29,13 @@ //except we don't want it to retain if they press the 'index' button //check what referring script is -if (CoralSession:get('ref_script') != "resource.php"){ +if (CoralSession::get('ref_script') != "resource.php"){ Resource::resetSearch(); } $search = Resource::getSearch(); -CoralSession:set('ref_script', $currentPage); +CoralSession::set('ref_script', $currentPage); diff --git a/resources/queue.php b/resources/queue.php index 78f8380ff..bf89f70ed 100644 --- a/resources/queue.php +++ b/resources/queue.php @@ -23,7 +23,7 @@ include 'templates/header.php'; //set referring page -CoralSession:set('ref_script', $currentPage); +CoralSession::set('ref_script', $currentPage); diff --git a/resources/resource.php b/resources/resource.php index ce1374ede..49735d295 100644 --- a/resources/resource.php +++ b/resources/resource.php @@ -33,9 +33,9 @@ //set referring page if ((isset($_GET['ref'])) && ($_GET['ref'] == 'new')){ - CoralSession:set('ref_script', 'new'); + CoralSession::set('ref_script', 'new'); }else{ - CoralSession:set('ref_script', $currentPage); + CoralSession::set('ref_script', $currentPage); } From 41fff02818c388d05df9a4efcbc740471c368cc2 Mon Sep 17 00:00:00 2001 From: Bill Dueber Date: Wed, 20 Jan 2016 12:05:55 -0500 Subject: [PATCH 06/10] can't use isset with a function result --- resources/index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/index.php b/resources/index.php index 6dce22b6d..b750ca120 100644 --- a/resources/index.php +++ b/resources/index.php @@ -597,20 +597,20 @@ Date: Wed, 20 Jan 2016 12:06:47 -0500 Subject: [PATCH 07/10] Fix header display of IP address --- resources/templates/header.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/templates/header.php b/resources/templates/header.php index dd5498956..d11b802a5 100644 --- a/resources/templates/header.php +++ b/resources/templates/header.php @@ -97,10 +97,10 @@ }else{ echo $user->loginID; } +?>
On machine ^M -?>
settings->authModule == 'Y'){ echo ""._("logout").""; } ?> From fc5505fa5e56394316e11f02fe641d260deeca9b Mon Sep 17 00:00:00 2001 From: Bill Dueber Date: Wed, 20 Jan 2016 12:07:42 -0500 Subject: [PATCH 08/10] Ugh. Missed semi-colon --- resources/admin/classes/common/CoralSession.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/admin/classes/common/CoralSession.php b/resources/admin/classes/common/CoralSession.php index 86af3fad0..e5937b347 100644 --- a/resources/admin/classes/common/CoralSession.php +++ b/resources/admin/classes/common/CoralSession.php @@ -16,7 +16,7 @@ private static function open_for_read() { public static function get($key) { self::open_for_read(); if (isset($_SESSION[$key])) { - return $_SESSION[$key] + return $_SESSION[$key]; } else { return null; } From c7c5224e4d481bd948e8b2e1b2325db605c47c34 Mon Sep 17 00:00:00 2001 From: Bill Dueber Date: Wed, 20 Jan 2016 12:29:31 -0500 Subject: [PATCH 09/10] Mess with session before spitting out header, so session can write --- resources/admin/classes/common/CoralSession.php | 1 - resources/index.php | 6 +++--- resources/queue.php | 4 ++-- resources/resource.php | 8 ++++---- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/resources/admin/classes/common/CoralSession.php b/resources/admin/classes/common/CoralSession.php index e5937b347..b22fa9e89 100644 --- a/resources/admin/classes/common/CoralSession.php +++ b/resources/admin/classes/common/CoralSession.php @@ -10,7 +10,6 @@ private static function open_for_read() { session_write_close(); self::$opened = true; } - return $_SESSION; } public static function get($key) { diff --git a/resources/index.php b/resources/index.php index b750ca120..f5456457f 100644 --- a/resources/index.php +++ b/resources/index.php @@ -21,9 +21,6 @@ include_once 'directory.php'; -//print header -$pageTitle=_('Home'); -include 'templates/header.php'; //used for creating a "sticky form" for back buttons //except we don't want it to retain if they press the 'index' button @@ -37,6 +34,9 @@ CoralSession::set('ref_script', $currentPage); +//print header +$pageTitle=_('Home'); +include 'templates/header.php'; ?> diff --git a/resources/queue.php b/resources/queue.php index bf89f70ed..43d965983 100644 --- a/resources/queue.php +++ b/resources/queue.php @@ -19,12 +19,12 @@ include_once 'directory.php'; -$pageTitle=_('My Queue'); -include 'templates/header.php'; //set referring page CoralSession::set('ref_script', $currentPage); +$pageTitle=_('My Queue'); +include 'templates/header.php'; diff --git a/resources/resource.php b/resources/resource.php index 49735d295..b8090fb9e 100644 --- a/resources/resource.php +++ b/resources/resource.php @@ -26,10 +26,6 @@ //used to get default email address for feedback link in the right side panel $config = new Configuration(); -//set this to turn off displaying the title header in header.php -$pageTitle=$resource->titleText;; -include 'templates/header.php'; - //set referring page if ((isset($_GET['ref'])) && ($_GET['ref'] == 'new')){ @@ -38,6 +34,10 @@ CoralSession::set('ref_script', $currentPage); } +//set this to turn off displaying the title header in header.php +$pageTitle=$resource->titleText;; +include 'templates/header.php'; + if ($resource->titleText){ ?> From fddace77cb405e73f047c7089e3ca0b21bc9939f Mon Sep 17 00:00:00 2001 From: Bill Dueber Date: Wed, 20 Jan 2016 12:35:50 -0500 Subject: [PATCH 10/10] Trying to figure out where the session is being set after output starts in header.php --- resources/index.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/resources/index.php b/resources/index.php index f5456457f..192340812 100644 --- a/resources/index.php +++ b/resources/index.php @@ -29,10 +29,8 @@ if (CoralSession::get('ref_script') != "resource.php"){ Resource::resetSearch(); } - -$search = Resource::getSearch(); - CoralSession::set('ref_script', $currentPage); +$search = Resource::getSearch(); //print header $pageTitle=_('Home');