CoreFiles by mySites.guru
usermessages.php75 lines, 1,674 bytes, from Joomla_2.5.13-Stable-Full_Package.zip
Raw History Compare with 2.5.11
md5
8a173d8d666bf83a9b059a9ca0237389
sha1
692f52c5656cd8ccc9e6c6c4ccaf9cd9214af44e
sha256
bcdb64e683a7b8d95bf1953975117ca226f3a8e70838e0fd266a3d86c27a18ec
<?php
/**
 * @package		Joomla.Administrator
 * @subpackage	com_messages
 * @copyright	Copyright (C) 2005 - 2013 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 8 releases, Joomla 2.5.9 to 2.5.17. See them all, or every version of this file.