CRM-16478 Initial changes to remove custom error template path
[civicrm-core.git] / CRM / Core / Session.php
index 0c9133346f0eb6db3d26580141291e5c4b40252d..002d10cf36330104a96977dab34b6222ba89e3b0 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 
 require_once "PEAR.php";
@@ -34,7 +34,7 @@ require_once "PEAR.php";
 class CRM_Core_Session {
 
   /**
-   * Cache of all the session names that we manage
+   * Cache of all the session names that we manage.
    */
   static $_managedNames = NULL;
 
@@ -64,12 +64,11 @@ class CRM_Core_Session {
    * pattern and cache the instance in this variable
    *
    * @var object
-   * @static
    */
   static private $_singleton = NULL;
 
   /**
-   * Constructor
+   * Constructor.
    *
    * The CMS takes care of initiating the php session handler session_start().
    *
@@ -90,14 +89,13 @@ class CRM_Core_Session {
   }
 
   /**
-   * Singleton function used to manage this object
+   * Singleton function used to manage this object.
    *
    * @return CRM_Core_Session
-   * @static
    */
   public static function &singleton() {
     if (self::$_singleton === NULL) {
-      self::$_singleton = new CRM_Core_Session;
+      self::$_singleton = new CRM_Core_Session();
     }
     return self::$_singleton;
   }
@@ -125,7 +123,7 @@ class CRM_Core_Session {
         // FIXME: This belongs in CRM_Utils_System_*
         if ($config->userSystem->is_drupal && function_exists('drupal_session_start')) {
           // https://issues.civicrm.org/jira/browse/CRM-14356
-          if (! (isset($GLOBALS['lazy_session']) && $GLOBALS['lazy_session'] == TRUE)) {
+          if (!(isset($GLOBALS['lazy_session']) && $GLOBALS['lazy_session'] == TRUE)) {
             drupal_session_start();
           }
           $_SESSION = array();
@@ -146,11 +144,11 @@ class CRM_Core_Session {
     ) {
       $this->_session[$this->_key] = array();
     }
-    return;
+    return NULL;
   }
 
   /**
-   * Resets the session store
+   * Resets the session store.
    *
    *
    * @param int $all
@@ -169,11 +167,11 @@ class CRM_Core_Session {
       $this->_session = array();
     }
 
-    return;
+    return NULL;
   }
 
   /**
-   * Creates a session local scope
+   * Creates a session local scope.
    *
    * @param string $prefix
    *   Local scope name.
@@ -196,7 +194,7 @@ class CRM_Core_Session {
   }
 
   /**
-   * Resets the session local scope
+   * Resets the session local scope.
    *
    * @param string $prefix
    *   Local scope name.
@@ -216,7 +214,7 @@ class CRM_Core_Session {
   }
 
   /**
-   * Store the variable with the value in the session scope
+   * Store the variable with the value in the session scope.
    *
    * This function takes a name, value pair and stores this
    * in the session scope. Not sure what happens if we try
@@ -255,16 +253,16 @@ class CRM_Core_Session {
   }
 
   /**
-   * Gets the value of the named variable in the session scope
+   * Gets the value of the named variable in the session scope.
    *
    * This function takes a name and retrieves the value of this
    * variable from the session scope.
    *
    *
    * @param string $name
-   *   name of the variable.
+   *   name of the variable.
    * @param string $prefix
-   *   adds another level of scope to the session.
+   *   adds another level of scope to the session.
    *
    * @return mixed
    */
@@ -327,9 +325,9 @@ class CRM_Core_Session {
    *
    *
    * @param string $name
-   *   name of the timer.
+   *   name of the timer.
    * @param int $expire
-   *   expiry time (in seconds).
+   *   expiry time (in seconds).
    *
    * @return mixed
    */
@@ -343,7 +341,7 @@ class CRM_Core_Session {
   }
 
   /**
-   * Adds a userContext to the stack
+   * Adds a userContext to the stack.
    *
    * @param string $userContext
    *   The url to return to when done.
@@ -382,7 +380,7 @@ class CRM_Core_Session {
   }
 
   /**
-   * Replace the userContext of the stack with the passed one
+   * Replace the userContext of the stack with the passed one.
    *
    * @param string $userContext
    *   The url to return to when done.
@@ -401,7 +399,7 @@ class CRM_Core_Session {
   }
 
   /**
-   * Pops the top userContext stack
+   * Pops the top userContext stack.
    *
    * @return string
    *   the top of the userContext stack (also pops the top element)
@@ -413,7 +411,7 @@ class CRM_Core_Session {
   }
 
   /**
-   * Reads the top userContext stack
+   * Reads the top userContext stack.
    *
    * @return string
    *   the top of the userContext stack
@@ -427,7 +425,7 @@ class CRM_Core_Session {
   }
 
   /**
-   * Dumps the session to the log
+   * Dumps the session to the log.
    * @param int $all
    */
   public function debug($all = 1) {
@@ -441,7 +439,7 @@ class CRM_Core_Session {
   }
 
   /**
-   * Fetches status messages
+   * Fetches status messages.
    *
    * @param bool $reset
    *   Should we reset the status variable?.
@@ -489,7 +487,6 @@ class CRM_Core_Session {
    *                 defaults to 10 seconds for most messages, 5 if it has a title but no body,
    *                 or 0 for errors or messages containing links
    *
-   * @static
    *
    * @return void
    */
@@ -556,8 +553,9 @@ class CRM_Core_Session {
   }
 
   /**
-   * Retrieve contact id of the logged in user
-   * @return integer|NULL contact ID of logged in user
+   * Retrieve contact id of the logged in user.
+   * @return int|NULL
+   *   contact ID of logged in user
    */
   public static function getLoggedInContactID() {
     $session = CRM_Core_Session::singleton();
@@ -576,4 +574,5 @@ class CRM_Core_Session {
     // helps proxies like varnish
     return empty($_SESSION);
   }
+
 }