/** * @param string $userFramework * One of 'Drupal', 'Joomla', etc. */ private function _setUserFrameworkConfig($userFramework) { $this->userFrameworkClass = 'CRM_Utils_System_' . $userFramework; $this->userHookClass = 'CRM_Utils_Hook_' . $userFramework; $userPermissionClass = 'CRM_Core_Permission_' . $userFramework; $this->userPermissionClass = new $userPermissionClass(); $class = $this->userFrameworkClass; // redundant with _initVariables $this->userSystem = new $class(); if ($userFramework == 'Joomla') { $this->userFrameworkURLVar = 'task'; } if (defined('CIVICRM_UF_BASEURL')) { $this->userFrameworkBaseURL = CRM_Utils_File::addTrailingSlash(CIVICRM_UF_BASEURL, '/'); //format url for language negotiation, CRM-7803 $this->userFrameworkBaseURL = CRM_Utils_System::languageNegotiationURL($this->userFrameworkBaseURL); if (CRM_Utils_System::isSSL()) { $this->userFrameworkBaseURL = str_replace('http://', 'https://', $this->userFrameworkBaseURL); } } if (defined('CIVICRM_UF_DSN')) { $this->userFrameworkDSN = CIVICRM_UF_DSN; } // this is dynamically figured out in the civicrm.settings.php file if (defined('CIVICRM_CLEANURL')) { $this->cleanURL = CIVICRM_CLEANURL; } else { $this->cleanURL = 0; } $this->userFrameworkVersion = $this->userSystem->getVersion(); if ($userFramework == 'Joomla') { /** @var object|null $mainframe */ global $mainframe; $dbprefix = $mainframe ? $mainframe->getCfg('dbprefix') : 'jos_'; $this->userFrameworkUsersTableName = $dbprefix . 'users'; } elseif ($userFramework == 'WordPress') { global $wpdb; $dbprefix = $wpdb ? $wpdb->prefix : ''; $this->userFrameworkUsersTableName = $dbprefix . 'users'; } }
/** * Output code from error function. * @param string $content */ public function outputError($content) { if (class_exists('JErrorPage')) { $error = new Exception($content); JErrorPage::render($error); } elseif (class_exists('JError')) { JError::raiseError('CiviCRM-001', $content); } else { parent::outputError($content); } }
/** * Get an array of user details for a contact, containing at minimum the user ID & name. * * @param int $contactID * * @return array * CMS user details including * - id * - name (ie the system user name. */ public function getUser($contactID) { $userDetails = parent::getUser($contactID); $user = $this->getUserObject($userDetails['id']); $userDetails['name'] = $user->name; $userDetails['email'] = $user->mail; return $userDetails; }
/** * Set a init session with user object * * @param array $data array with user specific data * * @access public */ function setUserSession($data) { list($userID, $ufID) = $data; $user = new JUser($ufID); $session = JFactory::getSession(); $session->set('user', $user); parent::setUserSession($data); }