CoreFiles by mySites.guru
author.php68 lines, 1,930 bytes, from Joomla_1.7.2-Stable-Full_Package.zip
Raw History Compare with 1.7.1
md5
654355bad096590eb02fb9a2d3a03ab0
sha1
48e94b7ec5f174b1153dacc86fc023a0be4f0487
sha256
c20cee9d8524256665bcc5625d4dae232e95de415afa0700a5ad615aab6ef075
<?php
/**
 * @version		$Id: author.php 21097 2011-04-07 15:38:03Z dextercowley $
 * @package		Joomla.Administrator
 * @subpackage	com_content
 * @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;

/**
 * Renders an author element
 *
 * @package		Joomla.Administrator
 * @subpackage	com_content
 * @deprecated	JParameter is deprecated and will be removed in a future version. Use JForm instead.
 * @since		1.5
 */
class JElementAuthor extends JElement
{
	/**
	 * The name of the element.
	 *
	 * @var		string
	 */
	var	$_name = 'Author';

	function fetchElement($name, $value, &$node, $control_name)
	{
		$access	= JFactory::getACL();

		// Include user in groups that have access to edit their articles, other articles, or manage content.
		$action = array('com_content.article.edit_own', 'com_content.article.edit_article', 'com_content.manage');
		$groups	= $access->getAuthorisedUsergroups($action, true);

		// Check the results of the access check.
		if (!$groups) {
			return false;
		}

		// Clean up and serialize.
		JArrayHelper::toInteger($groups);
		$groups = implode(',', $groups);

		// Build the query to get the users.
		$db = JFactory::getDbo();
		$query = $db->getQuery(true);
		$query->select('u.id AS value');
		$query->select('u.name AS text');
		$query->from('#__users AS u');
		$query->join('INNER', '#__user_usergroup_map AS m ON m.user_id = u.id');
		$query->where('u.block = 0');
		$query->where('m.group_id IN ('.$groups.')');

		// Get the users.
		$db->setQuery((string) $query);
		$users = $db->loadObjectList();

		// Check for a database error.
		if ($db->getErrorNum()) {
			JError::raiseNotice(500, $db->getErrorMsg());
			return false;
		}

		return JHtml::_('select.genericlist', $users, $name, 'class="inputbox" size="1"', 'value', 'text', $value);
	}
}

The same content is in 11 releases, Joomla 1.6.2 to 1.7.5. See them all, or every version of this file.