CoreFiles by mySites.guru
usermessages.php75 lines, 1,674 bytes, from Joomla_2.5.6-Stable-Full_Package.zip
Raw History Compare with 2.5.5
md5
625ea62dfb6aa3c2a5993f251be531b4
sha1
efa3ed385a60a8c3a9037e9fa3fced3e6a92d219
sha256
352935942b4aa442142c2fc6052f9cbeb4f102833a9178f1105169472be36ace
<?php
/**
 * @package		Joomla.Administrator
 * @subpackage	com_messages
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

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->loadColumn();

		// 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 9 releases, Joomla 2.5.0 to 2.5.8. See them all, or every version of this file.