INFRA-132 - Docblock formatting fixes
[civicrm-core.git] / CRM / Utils / System / Drupal6.php
index fb46eae9b33ac5a6153fc14b10d691391b6ae8c7..1d2cf0fdd79047972183b912cecaedf459b3dd5f 100644 (file)
@@ -42,14 +42,17 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
    * If we are using a theming system, invoke theme, else just print the
    * content
    *
-   * @param string  $content the content that will be themed
-   * @param boolean $print   are we displaying to the screen or bypassing theming?
-   * @param boolean $maintenance  for maintenance mode
+   * @param string $content
+   *   The content that will be themed.
+   * @param bool $print
+   *   Are we displaying to the screen or bypassing theming?.
+   * @param bool $maintenance
+   *   For maintenance mode.
    *
-   * @return void           prints content on stdout
-   * @access public
+   * @return void
+   *   prints content on stdout
    */
-  function theme(&$content, $print = FALSE, $maintenance = FALSE) {
+  public function theme(&$content, $print = FALSE, $maintenance = FALSE) {
     // TODO: Simplify; this was copied verbatim from CiviCRM 3.4's multi-UF theming function, but that's more complex than necessary
     if (function_exists('theme') && !$print) {
       if ($maintenance) {
@@ -75,14 +78,14 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   /**
    * Create a user in Drupal.
    *
-   * @param array  $params associated array
-   * @param string $mail email id for cms user
-   *
-   * @return uid if user exists, false otherwise
+   * @param array $params
+   * @param string $mail
+   *   Email id for cms user.
    *
-   * @access public
+   * @return int|bool
+   *   uid if user exists, false otherwise
    */
-  function createUser(&$params, $mail) {
+  public function createUser(&$params, $mail) {
     $form_state = array();
     $form_state['values'] = array(
       'name' => $params['cms_name'],
@@ -118,17 +121,13 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
     return $form_state['user']->uid;
   }
 
-  /*
-   *  Change user name in host CMS
-   *
-   *  @param integer $ufID User ID in CMS
-   *  @param string $ufName User name
-   */
   /**
-   * @param int $ufID
-   * @param string $ufName
+   * Change user name in host CMS
+   *
+   * @param int $ufID User ID in CMS
+   * @param string $ufName User name
    */
-  function updateCMSName($ufID, $ufName) {
+  public function updateCMSName($ufID, $ufName) {
     // CRM-5555
     if (function_exists('user_load')) {
       $user = user_load(array('uid' => $ufID));
@@ -142,17 +141,20 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   /**
    * Check if username and email exists in the drupal db
    *
-   * @param array $params array of name and mail values
-   * @param array $errors array of errors
-   * @param string $emailName  field label for the 'email'
+   * @param array $params
+   *   Array of name and mail values.
+   * @param array $errors
+   *   Array of errors.
+   * @param string $emailName
+   *   Field label for the 'email'.
    *
    * @return void
    */
-  function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
+  public function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
     $config = CRM_Core_Config::singleton();
 
-    $dao   = new CRM_Core_DAO();
-    $name  = $dao->escape(CRM_Utils_Array::value('name', $params));
+    $dao = new CRM_Core_DAO();
+    $name = $dao->escape(CRM_Utils_Array::value('name', $params));
     $email = $dao->escape(CRM_Utils_Array::value('mail', $params));
     _user_edit_validate(NULL, $params);
     $errors = form_get_errors();
@@ -196,12 +198,12 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
         );
       }
       if (strtolower($dbEmail) == strtolower($email)) {
-        if(empty($email)) {
+        if (empty($email)) {
           $errors[$emailName] = ts('You cannot create an email account for a contact with no email',
             array(1 => $email)
           );
         }
-        else{
+        else {
           $errors[$emailName] = ts('This email %1 is already registered. Please select another email.',
             array(1 => $email)
           );
@@ -214,11 +216,12 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
    * Get the drupal destination string. When this is passed in the
    * URL the user will be directed to it after filling in the drupal form
    *
-   * @param CRM_Core_Form $form Form object representing the 'current' form - to which the user will be returned
-   * @return string $destination destination value for URL
-   *
+   * @param CRM_Core_Form $form
+   *   Form object representing the 'current' form - to which the user will be returned.
+   * @return string
+   *   destination value for URL
    */
-  function getLoginDestination(&$form) {
+  public function getLoginDestination(&$form) {
     $args = NULL;
 
     $id = $form->get('id');
@@ -257,9 +260,8 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
    * @paqram string $pageTitle
    *
    * @return void
-   * @access public
    */
-  function setTitle($title, $pageTitle = NULL) {
+  public function setTitle($title, $pageTitle = NULL) {
     if (!$pageTitle) {
       $pageTitle = $title;
     }
@@ -278,9 +280,8 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
    * @internal param string $url
    *
    * @return void
-   * @access public
    */
-  function appendBreadCrumb($breadCrumbs) {
+  public function appendBreadCrumb($breadCrumbs) {
     $breadCrumb = drupal_get_breadcrumb();
 
     if (is_array($breadCrumbs)) {
@@ -306,9 +307,8 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
    * Reset an additional breadcrumb tag to the existing breadcrumb
    *
    * @return void
-   * @access public
    */
-  function resetBreadCrumb() {
+  public function resetBreadCrumb() {
     $bc = array();
     drupal_set_breadcrumb($bc);
   }
@@ -316,26 +316,27 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   /**
    * Append a string to the head of the html file
    *
-   * @param string $head the new string to be appended
+   * @param string $head
+   *   The new string to be appended.
    *
    * @return void
-   * @access public
    */
-  function addHTMLHead($head) {
+  public function addHTMLHead($head) {
     drupal_set_html_head($head);
   }
 
   /**
    * Add a script file
    *
-   * @param $url: string, absolute path to file
-   * @param $region string, location within the document: 'html-header', 'page-header', 'page-footer'
+   * @param $url : string, absolute path to file
+   * @param string $region
+   *   location within the document: 'html-header', 'page-header', 'page-footer'.
    *
    * Note: This function is not to be called directly
    * @see CRM_Core_Region::render()
    *
-   * @return bool TRUE if we support this operation in this CMS, FALSE otherwise
-   * @access public
+   * @return bool
+   *   TRUE if we support this operation in this CMS, FALSE otherwise
    */
   public function addScriptUrl($url, $region) {
     // CRM-15450 - D6 doesn't order internal/external links correctly so we can't use drupal_add_js
@@ -345,14 +346,15 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   /**
    * Add an inline script
    *
-   * @param $code: string, javascript code
-   * @param $region string, location within the document: 'html-header', 'page-header', 'page-footer'
+   * @param $code : string, javascript code
+   * @param string $region
+   *   location within the document: 'html-header', 'page-header', 'page-footer'.
    *
    * Note: This function is not to be called directly
    * @see CRM_Core_Region::render()
    *
-   * @return bool TRUE if we support this operation in this CMS, FALSE otherwise
-   * @access public
+   * @return bool
+   *   TRUE if we support this operation in this CMS, FALSE otherwise
    */
   public function addScript($code, $region) {
     // CRM-15450 - ensure scripts are in correct order
@@ -362,14 +364,15 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   /**
    * Add a css file
    *
-   * @param $url: string, absolute path to file
-   * @param $region string, location within the document: 'html-header', 'page-header', 'page-footer'
+   * @param $url : string, absolute path to file
+   * @param string $region
+   *   location within the document: 'html-header', 'page-header', 'page-footer'.
    *
    * Note: This function is not to be called directly
    * @see CRM_Core_Region::render()
    *
-   * @return bool TRUE if we support this operation in this CMS, FALSE otherwise
-   * @access public
+   * @return bool
+   *   TRUE if we support this operation in this CMS, FALSE otherwise
    */
   public function addStyleUrl($url, $region) {
     if ($region != 'html-header' || !$this->formatResourceUrl($url)) {
@@ -382,14 +385,15 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   /**
    * Add an inline style
    *
-   * @param $code: string, css code
-   * @param $region string, location within the document: 'html-header', 'page-header', 'page-footer'
+   * @param $code : string, css code
+   * @param string $region
+   *   location within the document: 'html-header', 'page-header', 'page-footer'.
    *
    * Note: This function is not to be called directly
    * @see CRM_Core_Region::render()
    *
-   * @return bool TRUE if we support this operation in this CMS, FALSE otherwise
-   * @access public
+   * @return bool
+   *   TRUE if we support this operation in this CMS, FALSE otherwise
    */
   public function addStyle($code, $region) {
     return FALSE;
@@ -401,9 +405,8 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
    * @param null
    *
    * @return void
-   * @access public
    */
-  function mapConfigToSSL() {
+  public function mapConfigToSSL() {
     global $base_url;
     $base_url = str_replace('http://', 'https://', $base_url);
   }
@@ -411,12 +414,13 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   /**
    * Figure out the post url for the form
    *
-   * @param mix $action the default action if one is pre-specified
+   * @param mix $action
+   *   The default action if one is pre-specified.
    *
-   * @return string the url to post the form
-   * @access public
+   * @return string
+   *   the url to post the form
    */
-  function postURL($action) {
+  public function postURL($action) {
     if (!empty($action)) {
       return $action;
     }
@@ -427,24 +431,25 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   /**
    * Authenticate the user against the drupal db
    *
-   * @param string $name     the user name
-   * @param string $password the password for the above user name
-   * @param boolean $loadCMSBootstrap load cms bootstrap?
+   * @param string $name
+   *   The user name.
+   * @param string $password
+   *   The password for the above user name.
+   * @param bool $loadCMSBootstrap
+   *   Load cms bootstrap?.
    * @param NULL|string $realPath filename of script
    *
-   * @return mixed false if no auth
-   *               array(
-   *  contactID, ufID, unique string ) if success
-   * @access public
-   */
-  function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
-   //@todo this 'PEAR-y' stuff is only required when bookstrap is not being loaded which is rare
-   // if ever now.
-   // probably if bootstrap is loaded this call
-   // CRM_Utils_System::loadBootStrap($bootStrapParams, TRUE, TRUE, $realPath); would be
-   // sufficient to do what this fn does. It does exist as opposed to return which might need some hanky-panky to make
-   // safe in the unknown situation where authenticate might be called & it is important that
-   // false is returned
+   * @return array|bool
+   *   [contactID, ufID, uniqueString] if success else false if no auth
+   */
+  public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
+    //@todo this 'PEAR-y' stuff is only required when bookstrap is not being loaded which is rare
+    // if ever now.
+    // probably if bootstrap is loaded this call
+    // CRM_Utils_System::loadBootStrap($bootStrapParams, TRUE, TRUE, $realPath); would be
+    // sufficient to do what this fn does. It does exist as opposed to return which might need some hanky-panky to make
+    // safe in the unknown situation where authenticate might be called & it is important that
+    // false is returned
     require_once 'DB.php';
 
     $config = CRM_Core_Config::singleton();
@@ -455,10 +460,10 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
     }
 
     $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
-    $dbpassword   = md5($password);
-    $name       = $dbDrupal->escapeSimple($strtolower($name));
-    $sql        = 'SELECT u.* FROM ' . $config->userFrameworkUsersTableName . " u WHERE LOWER(u.name) = '$name' AND u.pass = '$dbpassword' AND u.status = 1";
-    $query      = $dbDrupal->query($sql);
+    $dbpassword = md5($password);
+    $name = $dbDrupal->escapeSimple($strtolower($name));
+    $sql = 'SELECT u.* FROM ' . $config->userFrameworkUsersTableName . " u WHERE LOWER(u.name) = '$name' AND u.pass = '$dbpassword' AND u.status = 1";
+    $query = $dbDrupal->query($sql);
 
     $user = NULL;
     // need to change this to make sure we matched only one row
@@ -468,13 +473,13 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
       if (!$contactID) {
         return FALSE;
       }
-      else{//success
+      else { //success
         if ($loadCMSBootstrap) {
           $bootStrapParams = array();
           if ($name && $password) {
             $bootStrapParams = array(
-                'name' => $name,
-                'pass' => $password,
+              'name' => $name,
+              'pass' => $password,
             );
           }
           CRM_Utils_System::loadBootStrap($bootStrapParams, TRUE, TRUE, $realPath);
@@ -488,7 +493,7 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   /**
    * Load user into session
    */
-  function loadUser($username) {
+  public function loadUser($username) {
     global $user;
     $user = user_load(array('name' => $username));
     if (empty($user->uid)) {
@@ -514,7 +519,7 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
    *
    * FIXME: Document values accepted/required by $params
    */
-  function userLoginFinalize($params = array()) {
+  public function userLoginFinalize($params = array()) {
     user_authenticate_finalize($params);
   }
 
@@ -524,7 +529,7 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
    * @param string $username
    * @return int|NULL
    */
-  function getUfId($username) {
+  public function getUfId($username) {
     $user = user_load(array('name' => $username));
     if (empty($user->uid)) {
       return NULL;
@@ -535,23 +540,22 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   /**
    * Set a message in the UF to display to a user
    *
-   * @param string $message the message to set
-   *
-   * @access public
+   * @param string $message
+   *   The message to set.
    */
-  function setMessage($message) {
+  public function setMessage($message) {
     drupal_set_message($message);
   }
 
   /**
    * @return mixed
    */
-  function logout() {
+  public function logout() {
     module_load_include('inc', 'user', 'user.pages');
     return user_logout();
   }
 
-  function updateCategories() {
+  public function updateCategories() {
     // copied this from profile.module. Seems a bit inefficient, but i dont know a better way
     // CRM-3600
     cache_clear_all();
@@ -561,9 +565,10 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   /**
    * Get the locale set in the hosting CMS
    *
-   * @return string  with the locale or null for none
+   * @return string
+   *   with the locale or null for none
    */
-  function getUFLocale() {
+  public function getUFLocale() {
     // return CiviCRM’s xx_YY locale that either matches Drupal’s Chinese locale
     // (for CRM-6281), Drupal’s xx_YY or is retrieved based on Drupal’s xx
     // sometimes for CLI based on order called, this might not be set and/or empty
@@ -591,21 +596,24 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   /**
    * @return string
    */
-  function getVersion() {
+  public function getVersion() {
     return defined('VERSION') ? VERSION : 'Unknown';
   }
 
   /**
    * Load drupal bootstrap
    *
-   * @param array $params Either uid, or name & pass.
-   * @param boolean $loadUser boolean Require CMS user load.
-   * @param boolean $throwError If true, print error on failure and exit.
-   * @param boolean|string $realPath path to script
+   * @param array $params
+   *   Either uid, or name & pass.
+   * @param bool $loadUser
+   *   Boolean Require CMS user load.
+   * @param bool $throwError
+   *   If true, print error on failure and exit.
+   * @param bool|string $realPath path to script
    *
    * @return bool
    */
-  function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) {
+  public function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) {
     //take the cms root path.
     $cmsPath = $this->cmsRootPath($realPath);
 
@@ -697,7 +705,7 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
     // which means that define(CIVICRM_CLEANURL) was correctly set.
     // So we correct it
     $config = CRM_Core_Config::singleton();
-    $config->cleanURL = (int)variable_get('clean_url', '0');
+    $config->cleanURL = (int) variable_get('clean_url', '0');
 
     // CRM-8655: Drupal wasn't available during bootstrap, so hook_civicrm_config never executes
     CRM_Utils_Hook::config($config);
@@ -706,9 +714,8 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   }
 
   /**
-   *
    */
-  function cmsRootPath($scriptFilename = NULL) {
+  public function cmsRootPath($scriptFilename = NULL) {
     $cmsRoot = $valid = NULL;
 
     if (!is_null($scriptFilename)) {
@@ -741,10 +748,8 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
     do {
       $cmsRoot = $firstVar . '/' . implode('/', $pathVars);
       $cmsIncludePath = "$cmsRoot/includes";
-      //stop as we found bootstrap.
-      if (@opendir($cmsIncludePath) &&
-        file_exists("$cmsIncludePath/bootstrap.inc")
-      ) {
+      // Stop if we found bootstrap.
+      if (file_exists("$cmsIncludePath/bootstrap.inc")) {
         $valid = TRUE;
         break;
       }
@@ -758,7 +763,7 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   /**
    * Check is user logged in.
    *
-   * @return boolean true/false.
+   * @return boolean
    */
   public function isUserLoggedIn() {
     $isloggedIn = FALSE;
@@ -772,7 +777,8 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   /**
    * Get currently logged in user uf id.
    *
-   * @return int $userID logged in user uf id.
+   * @return int
+   *   $userID logged in user uf id.
    */
   public function getLoggedInUfID() {
     $ufID = NULL;
@@ -794,10 +800,11 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
    * @param bool $addLanguagePart
    * @param bool $removeLanguagePart
    *
-   * @return string $url, formatted url.
+   * @return string
+   *   , formatted url.
    * @static
    */
-  function languageNegotiationURL($url, $addLanguagePart = TRUE, $removeLanguagePart = FALSE) {
+  public function languageNegotiationURL($url, $addLanguagePart = TRUE, $removeLanguagePart = FALSE) {
     if (empty($url)) {
       return $url;
     }
@@ -817,8 +824,8 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
         $language->prefix &&
         in_array($mode, array(
           LANGUAGE_NEGOTIATION_PATH,
-            LANGUAGE_NEGOTIATION_PATH_DEFAULT,
-          ))
+          LANGUAGE_NEGOTIATION_PATH_DEFAULT,
+        ))
       ) {
 
         if ($addLanguagePart) {
@@ -843,11 +850,11 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
           //kinda hackish but not sure how to do it right
           //hope http_build_url() will help at some point.
           if (is_array($parseUrl) && !empty($parseUrl)) {
-            $urlParts           = explode('/', $url);
-            $hostKey            = array_search($parseUrl['host'], $urlParts);
-            $ufUrlParts         = parse_url(CIVICRM_UF_BASEURL);
+            $urlParts = explode('/', $url);
+            $hostKey = array_search($parseUrl['host'], $urlParts);
+            $ufUrlParts = parse_url(CIVICRM_UF_BASEURL);
             $urlParts[$hostKey] = $ufUrlParts['host'];
-            $url                = implode('/', $urlParts);
+            $url = implode('/', $urlParts);
           }
         }
       }
@@ -860,12 +867,13 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
    * Find any users/roles/security-principals with the given permission
    * and replace it with one or more permissions.
    *
-   * @param $oldPerm string
-   * @param $newPerms array, strings
+   * @param string $oldPerm
+   * @param array $newPerms
+   *   Array, strings.
    *
    * @return void
    */
-  function replacePermission($oldPerm, $newPerms) {
+  public function replacePermission($oldPerm, $newPerms) {
     $roles = user_roles(FALSE, $oldPerm);
     foreach ($roles as $rid => $roleName) {
       $permList = db_result(db_query('SELECT perm FROM {permission} WHERE rid = %d', $rid));
@@ -886,9 +894,10 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   /**
    * Get a list of all installed modules, including enabled and disabled ones
    *
-   * @return array CRM_Core_Module
+   * @return array
+   *   CRM_Core_Module
    */
-  function getModules() {
+  public function getModules() {
     $result = array();
     $q = db_query('SELECT name, status FROM {system} WHERE type = \'module\' AND schema_version <> -1');
     while ($row = db_fetch_object($q)) {
@@ -900,9 +909,11 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   /**
    * Get user login URL for hosting CMS (method declared in each CMS system class)
    *
-   * @param string $destination - if present, add destination to querystring (works for Drupal only)
+   * @param string $destination
+   *   If present, add destination to querystring (works for Drupal only).
    *
-   * @return string - loginURL for the current CMS
+   * @return string
+   *   loginURL for the current CMS
    * @static
    */
   public function getLoginURL($destination = '') {
@@ -919,33 +930,39 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
   /**
    * Wrapper for og_membership creation
    *
-   * @param integer $ogID Organic Group ID
-   * @param integer $drupalID drupal User ID
+   * @param int $ogID
+   *   Organic Group ID.
+   * @param int $drupalID
+   *   Drupal User ID.
    */
-  function og_membership_create($ogID, $drupalID){
-    og_save_subscription( $ogID, $drupalID, array( 'is_active' => 1 ) );
+  public function og_membership_create($ogID, $drupalID) {
+    og_save_subscription($ogID, $drupalID, array('is_active' => 1));
   }
 
   /**
    * Wrapper for og_membership deletion
    *
-   * @param integer $ogID Organic Group ID
-   * @param integer $drupalID drupal User ID
+   * @param int $ogID
+   *   Organic Group ID.
+   * @param int $drupalID
+   *   Drupal User ID.
    */
-  function og_membership_delete($ogID, $drupalID) {
-      og_delete_subscription( $ogID, $drupalID );
+  public function og_membership_delete($ogID, $drupalID) {
+    og_delete_subscription($ogID, $drupalID);
   }
 
   /**
    * Over-ridable function to get timezone as a string eg.
-   * @return string Timezone e.g. 'America/Los_Angeles'
+   * @return string
+   *   Timezone e.g. 'America/Los_Angeles'
    */
-  function getTimeZoneString() {
+  public function getTimeZoneString() {
     global $user;
     if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) {
       $timezone = $user->timezone;
-    } else {
-      $timezone = variable_get('date_default_timezone', null);
+    }
+    else {
+      $timezone = variable_get('date_default_timezone', NULL);
     }
     if (!$timezone) {
       $timezone = parent::getTimeZoneString();
@@ -958,7 +975,7 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
    * Reset any system caches that may be required for proper CiviCRM
    * integration.
    */
-  function flush() {
+  public function flush() {
     drupal_flush_all_caches();
   }
 }