CRM-15678 hookable invalid page handling
[civicrm-core.git] / CRM / Utils / System / Base.php
index e52558d3b7432ad74d10d5a444da6b6207f200be..4ed43e16b9340a1545a21880414d61424ee574b4 100644 (file)
@@ -5,7 +5,7 @@
  */
 abstract class CRM_Utils_System_Base {
   /**
-   * deprecated property to check if this is a drupal install. The correct method is to have functions on the UF classes for all UF specific
+   * Deprecated property to check if this is a drupal install. The correct method is to have functions on the UF classes for all UF specific
    * functions and leave the codebase oblivious to the type of CMS
    * @deprecated
    * @var bool
@@ -13,7 +13,7 @@ abstract class CRM_Utils_System_Base {
   var $is_drupal = FALSE;
 
   /**
-   * deprecated property to check if this is a joomla install. The correct method is to have functions on the UF classes for all UF specific
+   * Deprecated property to check if this is a joomla install. The correct method is to have functions on the UF classes for all UF specific
    * functions and leave the codebase oblivious to the type of CMS
    * @deprecated
    * @var bool
@@ -41,7 +41,7 @@ abstract class CRM_Utils_System_Base {
   var $supports_form_extensions = FALSE;
 
   /**
-   * if we are using a theming system, invoke theme, else just print the
+   * If we are using a theming system, invoke theme, else just print the
    * content
    *
    * @param string  $content the content that will be themed
@@ -49,9 +49,8 @@ abstract class CRM_Utils_System_Base {
    * @param boolean $maintenance  for maintenance mode
    *
    * @return void           prints content on stdout
-   * @access public
    */
-  function theme(&$content, $print = FALSE, $maintenance = FALSE) {
+  public function theme(&$content, $print = FALSE, $maintenance = FALSE) {
     $ret = FALSE;
 
     // TODO: Split up; this was copied verbatim from CiviCRM 4.0's multi-UF theming function
@@ -99,14 +98,14 @@ abstract class CRM_Utils_System_Base {
   /**
    * @return string
    */
-  function getDefaultBlockLocation() {
+  public function getDefaultBlockLocation() {
     return 'left';
   }
 
   /**
    * @return string
    */
-  function getVersion() {
+  public function getVersion() {
     return 'Unknown';
   }
 
@@ -134,7 +133,7 @@ abstract class CRM_Utils_System_Base {
    *
    * @return string|NULL local file system path to CMS root, or NULL if it cannot be determined
    */
-  function cmsRootPath() {
+  public function cmsRootPath() {
     return NULL;
   }
 
@@ -151,12 +150,12 @@ abstract class CRM_Utils_System_Base {
   /**
    * Determine the native ID of the CMS user
    *
-   * @param $username
+   * @param string $username
    *
    * @throws CRM_Core_Exception
    * @return int|NULL
    */
-  function getUfId($username) {
+  public function getUfId($username) {
     $className = get_class($this);
     throw new CRM_Core_Exception("Not implemented: {$className}->getUfId");
   }
@@ -166,9 +165,8 @@ abstract class CRM_Utils_System_Base {
    *
    * @param array $data  array with user specific data
    *
-   * @access public
    */
-  function setUserSession($data) {
+  public function setUserSession($data) {
     list($userID, $ufID) = $data;
     $session = CRM_Core_Session::singleton();
     $session->set('ufID', $ufID);
@@ -179,14 +177,14 @@ abstract class CRM_Utils_System_Base {
    * Reset any system caches that may be required for proper CiviCRM
    * integration.
    */
-  function flush() {
+  public function flush() {
     // nullop by default
   }
 
   /**
    * Flush css/js caches
    */
-  function clearResourceCache() {
+  public function clearResourceCache() {
     // nullop by default
   }
 
@@ -200,7 +198,7 @@ abstract class CRM_Utils_System_Base {
    * - $siteName,
    * - $siteRoot
    */
-  function getDefaultSiteSettings($dir) {
+  public function getDefaultSiteSettings($dir) {
     $config = CRM_Core_Config::singleton();
     $url = $config->userFrameworkBaseURL;
     return array($url, NULL, NULL);
@@ -215,13 +213,13 @@ abstract class CRM_Utils_System_Base {
    *
    * FIXME: Document values accepted/required by $params
    */
-  function userLoginFinalize($params = array()){
+  public function userLoginFinalize($params = array()){
   }
 
   /**
    * Set timezone in mysql so that timestamp fields show the correct time
    */
-  function setMySQLTimeZone(){
+  public function setMySQLTimeZone(){
     $timeZoneOffset = $this->getTimeZoneOffset();
     if($timeZoneOffset){
       $sql = "SET time_zone = '$timeZoneOffset'";
@@ -238,7 +236,7 @@ abstract class CRM_Utils_System_Base {
    * Get timezone from Drupal
    * @return boolean|string
    */
-  function getTimeZoneOffset(){
+  public function getTimeZoneOffset(){
     $timezone = $this->getTimeZoneString();
     if($timezone){
       $tzObj = new DateTimeZone($timezone);
@@ -262,7 +260,7 @@ abstract class CRM_Utils_System_Base {
    * Over-ridable function to get timezone as a string eg.
    * @return string Timezone e.g. 'America/Los_Angeles'
    */
-  function getTimeZoneString() {
+  public function getTimeZoneString() {
     return date_default_timezone_get();
   }
 
@@ -272,7 +270,7 @@ abstract class CRM_Utils_System_Base {
    * @return mixed $uniqueIdentifer Unique identifier from the user Framework system
    *
    */
-  function getUniqueIdentifierFromUserObject($user) {}
+  public function getUniqueIdentifierFromUserObject($user) {}
 
   /**
    * Get User ID from UserFramework system (CMS)
@@ -280,24 +278,24 @@ abstract class CRM_Utils_System_Base {
    * @return mixed <NULL, number>
    *
    */
-  function getUserIDFromUserObject($user) {}
+  public function getUserIDFromUserObject($user) {}
 
   /**
    * Get currently logged in user uf id.
    *
    * @return int $userID logged in user uf id.
    */
-  function getLoggedInUfID() {}
+  public function getLoggedInUfID() {}
 
   /**
    * Get currently logged in user unique identifier - this tends to be the email address or user name.
    *
    * @return string $userID logged in user unique identifier
    */
-  function getLoggedInUniqueIdentifier() {}
+  public function getLoggedInUniqueIdentifier() {}
 
   /**
-   * return a UFID (user account ID from the UserFramework / CMS system being based on the user object
+   * Return a UFID (user account ID from the UserFramework / CMS system being based on the user object
    * passed, defaulting to the logged in user if not passed. Note that ambiguous situation occurs
    * in CRM_Core_BAO_UFMatch::synchronize - a cleaner approach would seem to be resolving the user id before calling
    * the function
@@ -307,7 +305,7 @@ abstract class CRM_Utils_System_Base {
    * @param object $user
    * @return int $ufid - user ID of UF System
    */
-  function getBestUFID($user = NULL) {
+  public function getBestUFID($user = NULL) {
     if($user) {
       return $this->getUserIDFromUserObject($user);
     }
@@ -315,7 +313,7 @@ abstract class CRM_Utils_System_Base {
   }
 
   /**
-   * return a unique identifier (usually an email address or username) from the UserFramework / CMS system being based on the user object
+   * Return a unique identifier (usually an email address or username) from the UserFramework / CMS system being based on the user object
    * passed, defaulting to the logged in user if not passed. Note that ambiguous situation occurs
    * in CRM_Core_BAO_UFMatch::synchronize - a cleaner approach would seem to be resolving the unique identifier before calling
    * the function
@@ -323,7 +321,7 @@ abstract class CRM_Utils_System_Base {
    * @param object $user
    * @return string $uniqueIdentifier - unique identifier from the UF System
    */
-  function getBestUFUniqueIdentifier($user = NULL) {
+  public function getBestUFUniqueIdentifier($user = NULL) {
     if($user) {
       return $this->getUniqueIdentifierFromUserObject($user);
     }
@@ -336,30 +334,34 @@ abstract class CRM_Utils_System_Base {
    *
    * @return string
    */
-  function getUserRecordUrl($contactID) {
+  public function getUserRecordUrl($contactID) {
     return NULL;
   }
   /**
    * Is the current user permitted to add a user
    * @return bool
    */
-  function checkPermissionAddUser() {
+  public function checkPermissionAddUser() {
     return FALSE;
   }
 
   /**
-   * output code from error function
+   * Output code from error function
    * @param string $content
    */
-  function outputError($content) {
+  public function outputError($content) {
     echo CRM_Utils_System::theme($content);
   }
 
   /**
    * Log error to CMS
    */
-  function logger($message) {
+  public function logger($message) {
 
   }
-}
 
+  /**
+   * Append to coreResourcesList
+   */
+  public function appendCoreResources(&$list) {}
+}