X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FSession.php;h=24f53be63f093c779df17d17550c100963b7a090;hb=39ba8bc062cc7f5ba3f9bff0e1478a320fdfa268;hp=20ba2ebf098c2895c3fcfca1a67982276a65ba8a;hpb=504e40d849d89dffb3d851e49cbb92c4d7b70795;p=civicrm-core.git diff --git a/CRM/Core/Session.php b/CRM/Core/Session.php index 20ba2ebf09..24f53be63f 100644 --- a/CRM/Core/Session.php +++ b/CRM/Core/Session.php @@ -1,9 +1,9 @@ _session = null; @@ -119,7 +123,11 @@ class CRM_Core_Session { } $config =& CRM_Core_Config::singleton(); if ($config->userSystem->is_drupal && function_exists('drupal_session_start')) { - drupal_session_start(); + // https://issues.civicrm.org/jira/browse/CRM-14356 + if (! (isset($GLOBALS['lazy_session']) && $GLOBALS['lazy_session'] == true)) { + drupal_session_start(); + } + $_SESSION = array(); } else { session_start(); @@ -145,6 +153,8 @@ class CRM_Core_Session { * * @access public * + * @param int $all + * * @return void */ function reset($all = 1) { @@ -514,6 +524,9 @@ class CRM_Core_Session { } } + /** + * @param $names + */ static function registerAndRetrieveSessionObjects($names) { if (!is_array($names)) { $names = array($names); @@ -529,6 +542,9 @@ class CRM_Core_Session { CRM_Core_BAO_Cache::restoreSessionFromCache($names); } + /** + * @param bool $reset + */ static function storeSessionObjects($reset = TRUE) { if (empty(self::$_managedNames)) { return; @@ -541,6 +557,21 @@ class CRM_Core_Session { self::$_managedNames = NULL; } + /** + * Retrieve contact id of the logged in user + * @return integer | NULL contact ID of logged in user + */ + static function getLoggedInContactID() { + $session = CRM_Core_Session::singleton(); + if (!is_numeric($session->get('userID'))) { + return NULL; + } + return $session->get('userID'); + } + + /** + * @return bool + */ function isEmpty() { // check if session is empty, if so we dont cache // stuff that we can get away with