X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FSession.php;h=b31782dfad49bfaf0957880ce7d1978018a1dfe0;hb=79c045777605663809d516ddbd02be6c0f75ead5;hp=f3d1c169f52223a2da3d65da8e7a7d3c847e585b;hpb=232624b1bfe3beee7476775b278b9509e1607487;p=civicrm-core.git diff --git a/CRM/Core/Session.php b/CRM/Core/Session.php index f3d1c169f5..b31782dfad 100644 --- a/CRM/Core/Session.php +++ b/CRM/Core/Session.php @@ -88,7 +88,7 @@ class CRM_Core_Session { /** * singleton function used to manage this object * - * @return CRM_CoreSession + * @return CRM_Core_Session * @static */ static function &singleton() { @@ -119,7 +119,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(); @@ -496,7 +500,7 @@ class CRM_Core_Session { if (!isset(self::$_singleton->_session[self::$_singleton->_key]['status'])) { self::$_singleton->_session[self::$_singleton->_key]['status'] = array(); } - if ($text) { + if ($text || $title) { if ($options['unique']) { foreach (self::$_singleton->_session[self::$_singleton->_key]['status'] as $msg) { if ($msg['text'] == $text && $msg['title'] == $title) { @@ -541,6 +545,18 @@ 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'); + } + function isEmpty() { // check if session is empty, if so we dont cache // stuff that we can get away with