0byt3m1n1-V2
Path:
/
home
/
a
/
c
/
a
/
academiac
/
www
/
[
Home
]
File: users.php.tar
home/academiac/www/components/com_users/users.php 0000644 00000000747 15137376753 0016276 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @since 1.5 */ defined('_JEXEC') or die; require_once JPATH_COMPONENT.'/helpers/route.php'; // Launch the controller. $controller = JControllerLegacy::getInstance('Users'); $controller->execute(JRequest::getCmd('task', 'display')); $controller->redirect(); home/academiac/www/components/com_users/helpers/html/users.php 0000644 00000006705 15137556211 0020671 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Users Html Helper * * @package Joomla.Site * @subpackage com_users * @since 1.6 */ abstract class JHtmlUsers { public static function value($value) { if (is_string($value)) { $value = trim($value); } if (empty($value)) { return JText::_('COM_USERS_PROFILE_VALUE_NOT_FOUND'); } else { return htmlspecialchars($value); } } public static function spacer($value) { return ''; } public static function helpsite($value) { if (empty($value)) { return self::value($value); } else { $version = new JVersion(); $jver = explode( '.', $version->getShortVersion() ); $pathToXml = JPATH_ADMINISTRATOR.'/help/helpsites.xml'; $text = $value; if (!empty($pathToXml) && $xml = JFactory::getXML($pathToXml)) { foreach ($xml->sites->site as $site) { if ((string)$site->attributes()->url == $value) { $text = (string)$site; break; } } } $value = htmlspecialchars($value); if (substr ($value, 0, 4) == "http") { return '<a href="'.$value.'">'.$text.'</a>'; } else { return '<a href="http://'.$value.'">'.$text.'</a>'; } } } public static function templatestyle($value) { if (empty($value)) { return self::value($value); } else { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('title'); $query->from('#__template_styles'); $query->where('id = '.$db->quote($value)); $db->setQuery($query); $title = $db->loadResult(); if ($title) { return htmlspecialchars($title); } else { return self::value(''); } } } public static function admin_language($value) { if (empty($value)) { return self::value($value); } else { $path = JLanguage::getLanguagePath(JPATH_ADMINISTRATOR, $value); $file = "$value.xml"; $result = null; if (is_file("$path/$file")) { $result = JLanguage::parseXMLLanguageFile("$path/$file"); } if ($result) { return htmlspecialchars($result['name']); } else { return self::value(''); } } } public static function language($value) { if (empty($value)) { return self::value($value); } else { $path = JLanguage::getLanguagePath(JPATH_SITE, $value); $file = "$value.xml"; $result = null; if (is_file("$path/$file")) { $result = JLanguage::parseXMLLanguageFile("$path/$file"); } if ($result) { return htmlspecialchars($result['name']); } else { return self::value(''); } } } public static function editor($value) { if (empty($value)) { return self::value($value); } else { $db = JFactory::getDbo(); $lang = JFactory::getLanguage(); $query = $db->getQuery(true); $query->select('name'); $query->from('#__extensions'); $query->where('element = '.$db->quote($value)); $query->where('folder = '.$db->quote('editors')); $db->setQuery($query); $title = $db->loadResult(); if ($title) { $lang->load("plg_editors_$value.sys", JPATH_ADMINISTRATOR, null, false, true) || $lang->load("plg_editors_$value.sys", JPATH_PLUGINS . '/editors/' . $value, null, false, true); $lang->load($title.'.sys'); return JText::_($title); } else { return self::value(''); } } } } home/academiac/www/administrator/components/com_users/helpers/users.php 0000644 00000011142 15140204010 0022551 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_users * * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // No direct access. defined('_JEXEC') or die; /** * Users component helper. * * @package Joomla.Administrator * @subpackage com_users * @since 1.6 */ class UsersHelper { /** * @var JObject A cache for the available actions. * @since 1.6 */ protected static $actions; /** * Configure the Linkbar. * * @param string $vName The name of the active view. * * @return void * * @since 1.6 */ public static function addSubmenu($vName) { JSubMenuHelper::addEntry( JText::_('COM_USERS_SUBMENU_USERS'), 'index.php?option=com_users&view=users', $vName == 'users' ); // Groups and Levels are restricted to core.admin $canDo = self::getActions(); if ($canDo->get('core.admin')) { JSubMenuHelper::addEntry( JText::_('COM_USERS_SUBMENU_GROUPS'), 'index.php?option=com_users&view=groups', $vName == 'groups' ); JSubMenuHelper::addEntry( JText::_('COM_USERS_SUBMENU_LEVELS'), 'index.php?option=com_users&view=levels', $vName == 'levels' ); JSubMenuHelper::addEntry( JText::_('COM_USERS_SUBMENU_NOTES'), 'index.php?option=com_users&view=notes', $vName == 'notes' ); $extension = JRequest::getString('extension'); JSubMenuHelper::addEntry( JText::_('COM_USERS_SUBMENU_NOTE_CATEGORIES'), 'index.php?option=com_categories&extension=com_users', $vName == 'categories' || $extension == 'com_users' ); } } /** * Gets a list of the actions that can be performed. * * @return JObject * * @since 1.6 * @todo Refactor to work with notes */ public static function getActions() { if (empty(self::$actions)) { $user = JFactory::getUser(); self::$actions = new JObject; $actions = JAccess::getActions('com_users'); foreach ($actions as $action) { self::$actions->set($action->name, $user->authorise($action->name, 'com_users')); } } return self::$actions; } /** * Get a list of filter options for the blocked state of a user. * * @return array An array of JHtmlOption elements. * * @since 1.6 */ static function getStateOptions() { // Build the filter options. $options = array(); $options[] = JHtml::_('select.option', '0', JText::_('JENABLED')); $options[] = JHtml::_('select.option', '1', JText::_('JDISABLED')); return $options; } /** * Get a list of filter options for the activated state of a user. * * @return array An array of JHtmlOption elements. * * @since 1.6 */ static function getActiveOptions() { // Build the filter options. $options = array(); $options[] = JHtml::_('select.option', '0', JText::_('COM_USERS_ACTIVATED')); $options[] = JHtml::_('select.option', '1', JText::_('COM_USERS_UNACTIVATED')); return $options; } /** * Get a list of the user groups for filtering. * * @return array An array of JHtmlOption elements. * * @since 1.6 */ static function getGroups() { $db = JFactory::getDbo(); $db->setQuery( 'SELECT a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level' . ' FROM #__usergroups AS a' . ' LEFT JOIN '.$db->quoteName('#__usergroups').' AS b ON a.lft > b.lft AND a.rgt < b.rgt' . ' GROUP BY a.id, a.title, a.lft, a.rgt' . ' ORDER BY a.lft ASC' ); $options = $db->loadObjectList(); // Check for a database error. if ($db->getErrorNum()) { JError::raiseNotice(500, $db->getErrorMsg()); return null; } foreach ($options as &$option) { $option->text = str_repeat('- ', $option->level).$option->text; } return $options; } /** * Creates a list of range options used in filter select list * used in com_users on users view * * @return array * * @since 2.5 */ public static function getRangeOptions() { $options = array( JHtml::_('select.option', 'today', JText::_('COM_USERS_OPTION_RANGE_TODAY')), JHtml::_('select.option', 'past_week', JText::_('COM_USERS_OPTION_RANGE_PAST_WEEK')), JHtml::_('select.option', 'past_1month', JText::_('COM_USERS_OPTION_RANGE_PAST_1MONTH')), JHtml::_('select.option', 'past_3month', JText::_('COM_USERS_OPTION_RANGE_PAST_3MONTH')), JHtml::_('select.option', 'past_6month', JText::_('COM_USERS_OPTION_RANGE_PAST_6MONTH')), JHtml::_('select.option', 'past_year', JText::_('COM_USERS_OPTION_RANGE_PAST_YEAR')), JHtml::_('select.option', 'post_year', JText::_('COM_USERS_OPTION_RANGE_POST_YEAR')), ); return $options; } } home/academiac/www/administrator/components/com_users/users.php 0000644 00000001237 15140225033 0021123 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_users * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; // Access check. if (!JFactory::getUser()->authorise('core.manage', 'com_users')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } // Register helper class JLoader::register('UsersHelper', dirname(__FILE__) . '/helpers/users.php'); // Execute the task. $controller = JControllerLegacy::getInstance('Users'); $controller->execute(JRequest::getCmd('task')); $controller->redirect(); home/academiac/www/administrator/components/com_users/models/users.php 0000644 00000025042 15140225311 0022405 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_users * * @copyright Copyright (C) 2005 - 2014 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.application.component.modellist'); /** * Methods supporting a list of user records. * * @package Joomla.Administrator * @subpackage com_users * @since 1.6 */ class UsersModelUsers extends JModelList { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JController * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'id', 'a.id', 'name', 'a.name', 'username', 'a.username', 'email', 'a.email', 'block', 'a.block', 'sendEmail', 'a.sendEmail', 'registerDate', 'a.registerDate', 'lastvisitDate', 'a.lastvisitDate', 'activation', 'a.activation', ); } parent::__construct($config); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { // Initialise variables. $app = JFactory::getApplication('administrator'); // Adjust the context to support modal layouts. if ($layout = JRequest::getVar('layout', 'default')) { $this->context .= '.'.$layout; } // Load the filter state. $search = $this->getUserStateFromRequest($this->context.'.filter.search', 'filter_search'); $this->setState('filter.search', $search); $active = $this->getUserStateFromRequest($this->context.'.filter.active', 'filter_active', '*'); $this->setState('filter.active', $active); $state = $this->getUserStateFromRequest($this->context.'.filter.state', 'filter_state', '*'); $this->setState('filter.state', $state); $groupId = $this->getUserStateFromRequest($this->context.'.filter.group', 'filter_group_id', null, 'int'); $this->setState('filter.group_id', $groupId); $range = $this->getUserStateFromRequest($this->context.'.filter.range', 'filter_range'); $this->setState('filter.range', $range); $groups = json_decode(base64_decode(JRequest::getVar('groups', '', 'default', 'BASE64'))); if (isset($groups)) { JArrayHelper::toInteger($groups); } $this->setState('filter.groups', $groups); $excluded = json_decode(base64_decode(JRequest::getVar('excluded', '', 'default', 'BASE64'))); if (isset($excluded)) { JArrayHelper::toInteger($excluded); } $this->setState('filter.excluded', $excluded); // Load the parameters. $params = JComponentHelper::getParams('com_users'); $this->setState('params', $params); // List state information. parent::populateState('a.name', 'asc'); } /** * Method to get a store id based on model configuration state. * * This is necessary because the model is used by the component and * different modules that might need different sets of data or different * ordering requirements. * * @param string $id A prefix for the store id. * * @return string A store id. * * @since 1.6 */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':'.$this->getState('filter.search'); $id .= ':'.$this->getState('filter.active'); $id .= ':'.$this->getState('filter.state'); $id .= ':'.$this->getState('filter.group_id'); $id .= ':'.$this->getState('filter.range'); return parent::getStoreId($id); } /** * Gets the list of users and adds expensive joins to the result set. * * @return mixed An array of data items on success, false on failure. * * @since 1.6 */ public function getItems() { // Get a storage key. $store = $this->getStoreId(); // Try to load the data from internal storage. if (empty($this->cache[$store])) { $groups = $this->getState('filter.groups'); $groupId = $this->getState('filter.group_id'); if (isset($groups) && (empty($groups) || $groupId && !in_array($groupId, $groups))) { $items = array(); } else { $items = parent::getItems(); } // Bail out on an error or empty list. if (empty($items)) { $this->cache[$store] = $items; return $items; } // Joining the groups with the main query is a performance hog. // Find the information only on the result set. // First pass: get list of the user id's and reset the counts. $userIds = array(); foreach ($items as $item) { $userIds[] = (int) $item->id; $item->group_count = 0; $item->group_names = ''; $item->note_count = 0; } // Get the counts from the database only for the users in the list. $db = $this->getDbo(); $query = $db->getQuery(true); // Join over the group mapping table. $query->select('map.user_id, COUNT(map.group_id) AS group_count') ->from('#__user_usergroup_map AS map') ->where('map.user_id IN ('.implode(',', $userIds).')') ->group('map.user_id') // Join over the user groups table. ->join('LEFT', '#__usergroups AS g2 ON g2.id = map.group_id'); $db->setQuery($query); // Load the counts into an array indexed on the user id field. $userGroups = $db->loadObjectList('user_id'); $error = $db->getErrorMsg(); if ($error) { $this->setError($error); return false; } $query->clear() ->select('n.user_id, COUNT(n.id) As note_count') ->from('#__user_notes AS n') ->where('n.user_id IN ('.implode(',', $userIds).')') ->where('n.state >= 0') ->group('n.user_id'); $db->setQuery((string) $query); // Load the counts into an array indexed on the aro.value field (the user id). $userNotes = $db->loadObjectList('user_id'); $error = $db->getErrorMsg(); if ($error) { $this->setError($error); return false; } // Second pass: collect the group counts into the master items array. foreach ($items as &$item) { if (isset($userGroups[$item->id])) { $item->group_count = $userGroups[$item->id]->group_count; //Group_concat in other databases is not supported $item->group_names = $this->_getUserDisplayedGroups($item->id); } if (isset($userNotes[$item->id])) { $item->note_count = $userNotes[$item->id]->note_count; } } // Add the items to the internal cache. $this->cache[$store] = $items; } return $this->cache[$store]; } /** * Build an SQL query to load the list data. * * @return JDatabaseQuery * * @since 1.6 */ protected function getListQuery() { // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); // Select the required fields from the table. $query->select( $this->getState( 'list.select', 'a.*' ) ); $query->from($db->quoteName('#__users').' AS a'); // If the model is set to check item state, add to the query. $state = $this->getState('filter.state'); if (is_numeric($state)) { $query->where('a.block = '.(int) $state); } // If the model is set to check the activated state, add to the query. $active = $this->getState('filter.active'); if (is_numeric($active)) { if ($active == '0') { $query->where('a.activation = '.$db->quote('')); } elseif ($active == '1') { $query->where($query->length('a.activation').' = 32'); } } // Filter the items over the group id if set. $groupId = $this->getState('filter.group_id'); $groups = $this->getState('filter.groups'); if ($groupId || isset($groups)) { $query->join('LEFT', '#__user_usergroup_map AS map2 ON map2.user_id = a.id'); $query->group('a.id,a.name,a.username,a.password,a.usertype,a.block,a.sendEmail,a.registerDate,a.lastvisitDate,a.activation,a.params,a.email'); if ($groupId) { $query->where('map2.group_id = '.(int) $groupId); } if (isset($groups)) { $query->where('map2.group_id IN ('.implode(',', $groups).')'); } } // Filter the items over the search string if set. if ($this->getState('filter.search') !== '') { // Escape the search token. $token = $db->Quote('%'.$db->escape($this->getState('filter.search')).'%'); // Compile the different search clauses. $searches = array(); $searches[] = 'a.name LIKE '.$token; $searches[] = 'a.username LIKE '.$token; $searches[] = 'a.email LIKE '.$token; // Add the clauses to the query. $query->where('('.implode(' OR ', $searches).')'); } // Add filter for registration ranges select list $range = $this->getState('filter.range'); // Apply the range filter. if ($range) { jimport('joomla.utilities.date'); // Get UTC for now. $dNow = new JDate; $dStart = clone $dNow; switch ($range) { case 'past_week': $dStart->modify('-7 day'); break; case 'past_1month': $dStart->modify('-1 month'); break; case 'past_3month': $dStart->modify('-3 month'); break; case 'past_6month': $dStart->modify('-6 month'); break; case 'post_year': case 'past_year': $dStart->modify('-1 year'); break; case 'today': // Ranges that need to align with local 'days' need special treatment. $app = JFactory::getApplication(); $offset = $app->getCfg('offset'); // Reset the start time to be the beginning of today, local time. $dStart = new JDate('now', $offset); $dStart->setTime(0, 0, 0); // Now change the timezone back to UTC. $tz = new DateTimeZone('GMT'); $dStart->setTimezone($tz); break; } if ($range == 'post_year') { $query->where( 'a.registerDate < '.$db->quote($dStart->format('Y-m-d H:i:s')) ); } else { $query->where( 'a.registerDate >= '.$db->quote($dStart->format('Y-m-d H:i:s')). ' AND a.registerDate <='.$db->quote($dNow->format('Y-m-d H:i:s')) ); } } // Filter by excluded users $excluded = $this->getState('filter.excluded'); if (!empty($excluded)) { $query->where('id NOT IN ('.implode(',', $excluded).')'); } // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering', 'a.name')).' '.$db->escape($this->getState('list.direction', 'ASC'))); return $query; } //sqlsrv change function _getUserDisplayedGroups($user_id) { $db = JFactory::getDbo(); $sql = "SELECT title FROM ".$db->quoteName('#__usergroups')." ug left join ". $db->quoteName('#__user_usergroup_map')." map on (ug.id = map.group_id)". " WHERE map.user_id=".$user_id; $db->setQuery($sql); $result = $db->loadColumn(); return implode("\n", $result); } }
©
2018.