public function JFusionHelper_xenforo() { // Get params and any cookies that are available $this->params =& JFusionFactory::getParams($this->getJname()); $database_type = $this->params->get('database_type', ''); if ($database_type === '') { $file = JFUSION_PLUGIN_PATH . DIRECTORY_SEPARATOR . $this->getJname() . DIRECTORY_SEPARATOR . 'jfusion.xml'; $this->params = new JRegistry('', $file); return; } $this->cookie_prefix = $this->params->get('cookie_prefix', 'xf_'); $this->db = JFusionFactory::getDatabase($this->getJname()); $this->cookie_domain = $this->params->get('cookie_domain', ''); $this->cookie_path = $this->params->get('cookie_path', '/'); $this->httponly = is_array($_COOKIE) ? false : true; $this->global_salt = $this->params->get('global_salt', ''); // Do we need to verify ?? $this->ipaddress = $_SERVER['REMOTE_ADDR']; $this->currenttime = time(); $this->cookie_persist = $this->db->getEscaped(JRequest::getVar($this->cookie_prefix . 'user', '', 'cookie')); $this->session_id = $this->db->getEscaped(JRequest::getVar($this->cookie_prefix . 'session', '', 'cookie')); }
/** * Update user's email address * * @param object $userinfo User info * @param object &$existinguser Existing user * @param array &$status Status * * @return void */ function updateEmail($userinfo, &$existinguser, &$status) { // We need to update the email $db = JFusionFactory::getDatabase($this->getJname()); $query = "UPDATE xf_user SET email ='{$userinfo->email}' WHERE user_id = {$existinguser->userid}"; $db->setQuery($query); if (!$db->query()) { $status['error'][] = JText::_('EMAIL_UPDATE_ERROR') . $db->stderr(); } else { $status['debug'][] = JText::_('PASSWORD_UPDATE') . ': ' . $existinguser->email . ' -> ' . $userinfo->email; } }
/** * Is registration allowed? * * @return boolean */ function allowRegistration() { $db = JFusionFactory::getDatabase($this->getJname()); $query = "SELECT option_value FROM xf_option WHERE option_id ='registrationSetup'"; $db->setQuery($query); $registrationSetup = unserialize($db->loadResult()); if (intval($registrationSetup['enabled']) === 1) { $result = true; return $result; } else { $result = false; return $result; } }
/** * Get the number of on-line members * * @return int */ function getNumberOnlineMembers() { // Get a unix time from 5 mintues ago date_default_timezone_set('UTC'); $active = strtotime("-5 minutes", time()); $db =& JFusionFactory::getDatabase($this->getJname()); $query = "SELECT COUNT(DISTINCT(session_user_id)) FROM #__sessions WHERE session_viewonline = 1 AND session_user_id != 1 AND session_time > {$active}"; $db->setQuery($query); $result = $db->loadResult(); return $result; }