/** * Return if a user can see the ads contact * * @return boolean */ static public function checkRightContact(){ //If the static variable is already set, we directly return it if (self::$showContact == null) { $user = JFactory::getUser(); $conf = TConf::getConfig(); $userGroups = array(); if(version_compare(JVERSION, '1.6', 'ge')) { //If the user is a guest, we authorise the public group //else we return the authorised group of the user if($user->guest) $userGroups[] = 1; else $userGroups = JHTMLAdsmanagerUserGroups::getUserGroup($user->id); $authorisedContact = false; $allowedContacts = explode(',', $conf->show_contact); foreach ($userGroups as $userGroup) { if(array_search($userGroup, $allowedContacts) !== false){ $authorisedContact = true; } } self::$showContact = $authorisedContact; } else { self::$showContact = true; } } return self::$showContact; }