<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
/**
* singleton function used to manage this object
*
- * @return object
+ * @return CRM_Core_Session
* @static
*/
static function &singleton() {
}
$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();
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) {
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