- md5
- cac06870367db5b017af95220fdb1daa
- sha1
- 854abb2d5a1af9b8e3eca11ecca214ea73bb93c2
- sha256
- ac837843b79b8be57bbeb868de1597696c0a1c70a3c968ead4c382912dc6392f
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
<?php
/**
* @version $Id: usermessages.php 20196 2011-01-09 02:40:25Z ian $
* @package Joomla.Administrator
* @subpackage com_messages
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
jimport('joomla.form.formfield');
jimport('joomla.form.helper');
jimport('joomla.access.access');
JFormHelper::loadFieldClass('user');
/**
* Supports an modal select of user that have access to com_messages
*/
class JFormFieldUserMessages extends JFormFieldUser
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
public $type = 'UserMessages';
/**
* Method to get the filtering groups (null means no filtering)
*
* @return array|null array of filtering groups or null.
* @since 1.6
*/
protected function getGroups()
{
// Compute usergroups
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id');
$query->from('#__usergroups');
$db->setQuery($query);
$groups = $db->loadResultArray();
// Check for a database error.
if ($db->getErrorNum()) {
JError::raiseNotice(500, $db->getErrorMsg());
return null;
}
foreach ($groups as $i=>$group)
{
if (JAccess::checkGroup($group, 'core.admin')) {
continue;
}
if (!JAccess::checkGroup($group, 'core.manage', 'com_messages')) {
unset($groups[$i]);
continue;
}
if (!JAccess::checkGroup($group, 'core.login.admin')) {
unset($groups[$i]);
continue;
}
}
return array_values($groups);
}
/**
* Method to get the users to exclude from the list of users
*
* @return array|null array of users to exclude or null to to not exclude them
* @since 1.6
*/
protected function getExcluded()
{
return array(JFactory::getUser()->id);
}
}
The same content is in 13 releases, Joomla 1.6.0 to 1.7.5. See them all, or every version of this file.