Файловый менеджер - Редактировать - /home/wuectly/www/03cbe/users.php.tar
Назад
home/wuectly/www/libraries/joomla/mediawiki/users.php 0000604 00000026563 15245570523 0017106 0 ustar 00 <?php /** * @package Joomla.Platform * @subpackage MediaWiki * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; /** * MediaWiki API Users class for the Joomla Platform. * * @since 3.1.4 */ class JMediawikiUsers extends JMediawikiObject { /** * Method to login and get authentication tokens. * * @param string $lgname User Name. * @param string $lgpassword Password. * @param string $lgdomain Domain (optional). * * @return object * * @since 3.1.4 */ public function login($lgname, $lgpassword, $lgdomain = null) { // Build the request path. $path = '?action=login&lgname=' . $lgname . '&lgpassword=' . $lgpassword; if (isset($lgdomain)) { $path .= '&lgdomain=' . $lgdomain; } // Send the request. $response = $this->client->post($this->fetchUrl($path), null); // Request path with login token. $path = '?action=login&lgname=' . $lgname . '&lgpassword=' . $lgpassword . '&lgtoken=' . $this->validateResponse($response)->login['token']; if (isset($lgdomain)) { $path .= '&lgdomain=' . $lgdomain; } // Set the session cookies returned. $headers = (array) $this->options->get('headers'); $headers['Cookie'] = !empty($headers['Cookie']) ? empty($headers['Cookie']) : ''; $headers['Cookie'] = $headers['Cookie'] . $response->headers['Set-Cookie']; $this->options->set('headers', $headers); // Send the request again with the token. $response = $this->client->post($this->fetchUrl($path), null); $response_body = $this->validateResponse($response); $headers = (array) $this->options->get('headers'); $cookie_prefix = $response_body->login['cookieprefix']; $cookie = $cookie_prefix . 'UserID=' . $response_body->login['lguserid'] . '; ' . $cookie_prefix . 'UserName=' . $response_body->login['lgusername']; $headers['Cookie'] = $headers['Cookie'] . '; ' . $response->headers['Set-Cookie'] . '; ' . $cookie; $this->options->set('headers', $headers); return $this->validateResponse($response); } /** * Method to logout and clear session data. * * @return object * * @since 3.1.4 */ public function logout() { // Build the request path. $path = '?action=login'; // @TODO clear internal data as well // Send the request. $response = $this->client->get($this->fetchUrl($path)); return $this->validateResponse($response); } /** * Method to get user information. * * @param array $ususers A list of users to obtain the same information for. * @param array $usprop What pieces of information to include. * * @return object * * @since 3.1.4 */ public function getUserInfo(array $ususers, array $usprop = null) { // Build the request path. $path = '?action=query&list=users'; // Append users to the request. $path .= '&ususers=' . $this->buildParameter($ususers); if (isset($usprop)) { $path .= '&usprop' . $this->buildParameter($usprop); } // Send the request. $response = $this->client->get($this->fetchUrl($path)); return $this->validateResponse($response); } /** * Method to get current user information. * * @param array $uiprop What pieces of information to include. * * @return object * * @since 3.1.4 */ public function getCurrentUserInfo(array $uiprop = null) { // Build the request path. $path = '?action=query&meta=userinfo'; if (isset($uiprop)) { $path .= '&uiprop' . $this->buildParameter($uiprop); } // Send the request. $response = $this->client->get($this->fetchUrl($path)); return $this->validateResponse($response); } /** * Method to get user contributions. * * @param string $ucuser The users to retrieve contributions for. * @param string $ucuserprefix Retrieve contibutions for all users whose names begin with this value. * @param integer $uclimit The users to retrieve contributions for. * @param string $ucstart The start timestamp to return from. * @param string $ucend The end timestamp to return to. * @param boolean $uccontinue When more results are available, use this to continue. * @param string $ucdir In which direction to enumerate. * @param array $ucnamespace Only list contributions in these namespaces. * @param array $ucprop Include additional pieces of information. * @param array $ucshow Show only items that meet this criteria. * @param string $uctag Only list revisions tagged with this tag. * @param string $uctoponly Only list changes which are the latest revision * * @return object * * @since 3.1.4 */ public function getUserContribs($ucuser = null, $ucuserprefix = null, $uclimit = null, $ucstart = null, $ucend = null, $uccontinue = null, $ucdir = null, array $ucnamespace = null, array $ucprop = null, array $ucshow = null, $uctag = null, $uctoponly = null) { // Build the request path. $path = '?action=query&list=usercontribs'; if (isset($ucuser)) { $path .= '&ucuser=' . $ucuser; } if (isset($ucuserprefix)) { $path .= '&ucuserprefix=' . $ucuserprefix; } if (isset($uclimit)) { $path .= '&uclimit=' . $uclimit; } if (isset($ucstart)) { $path .= '&ucstart=' . $ucstart; } if (isset($ucend)) { $path .= '&ucend=' . $ucend; } if ($uccontinue) { $path .= '&uccontinue='; } if (isset($ucdir)) { $path .= '&ucdir=' . $ucdir; } if (isset($ucnamespace)) { $path .= '&ucnamespace=' . $this->buildParameter($ucnamespace); } if (isset($ucprop)) { $path .= '&ucprop=' . $this->buildParameter($ucprop); } if (isset($ucshow)) { $path .= '&ucshow=' . $this->buildParameter($ucshow); } if (isset($uctag)) { $path .= '&uctag=' . $uctag; } if (isset($uctoponly)) { $path .= '&uctoponly=' . $uctoponly; } // Send the request. $response = $this->client->get($this->fetchUrl($path)); return $this->validateResponse($response); } /** * Method to block a user. * * @param string $user Username, IP address or IP range you want to block. * @param string $expiry Relative expiry time, Default: never. * @param string $reason Reason for block (optional). * @param boolean $anononly Block anonymous users only. * @param boolean $nocreate Prevent account creation. * @param boolean $autoblock Automatically block the last used IP address, and any subsequent IP addresses they try to login from. * @param boolean $noemail Prevent user from sending email through the wiki. * @param boolean $hidename Hide the username from the block log. * @param boolean $allowusertalk Allow the user to edit their own talk page. * @param boolean $reblock If the user is already blocked, overwrite the existing block. * @param boolean $watchuser Watch the user/IP's user and talk pages. * * @return object * * @since 3.1.4 */ public function blockUser($user, $expiry = null, $reason = null, $anononly = null, $nocreate = null, $autoblock = null, $noemail = null, $hidename = null, $allowusertalk = null, $reblock = null, $watchuser = null) { // Get the token. $token = $this->getToken($user, 'block'); // Build the request path. $path = '?action=unblock'; // Build the request data. $data = array( 'user' => $user, 'token' => $token, 'expiry' => $expiry, 'reason' => $reason, 'anononly' => $anononly, 'nocreate' => $nocreate, 'autoblock' => $autoblock, 'noemail' => $noemail, 'hidename' => $hidename, 'allowusetalk' => $allowusertalk, 'reblock' => $reblock, 'watchuser' => $watchuser, ); // Send the request. $response = $this->client->post($this->fetchUrl($path), $data); return $this->validateResponse($response); } /** * Method to unblock a user. * * @param string $user Username, IP address or IP range you want to unblock. * @param string $reason Reason for unblock (optional). * * @return object * * @since 3.1.4 */ public function unBlockUserByName($user, $reason = null) { // Get the token. $token = $this->getToken($user, 'unblock'); // Build the request path. $path = '?action=unblock'; // Build the request data. $data = array( 'user' => $user, 'token' => $token, 'reason' => $reason, ); // Send the request. $response = $this->client->post($this->fetchUrl($path), $data); return $this->validateResponse($response); } /** * Method to unblock a user. * * @param int $id Username, IP address or IP range you want to unblock. * @param string $reason Reason for unblock (optional). * * @return object * * @since 3.1.4 */ public function unBlockUserById($id, $reason = null) { // Get the token. $token = $this->getToken($id, 'unblock'); // Build the request path. $path = '?action=unblock'; // Build the request data. // TODO: $data doesn't seem to be used! $data = array( 'id' => $id, 'token' => $token, 'reason' => $reason, ); // Send the request. $response = $this->client->get($this->fetchUrl($path)); return $this->validateResponse($response); } /** * Method to assign a user to a group. * * @param string $username User name. * @param array $add Add the user to these groups. * @param array $remove Remove the user from these groups. * @param string $reason Reason for the change. * * @return object * * @since 3.1.4 */ public function assignGroup($username, $add = null, $remove = null, $reason = null) { // Get the token. $token = $this->getToken($username, 'unblock'); // Build the request path. $path = '?action=userrights'; // Build the request data. $data = array( 'username' => $username, 'token' => $token, 'add' => $add, 'remove' => $remove, 'reason' => $reason, ); // Send the request. $response = $this->client->post($this->fetchUrl($path), $data); return $this->validateResponse($response); } /** * Method to email a user. * * @param string $target User to send email to. * @param string $subject Subject header. * @param string $text Mail body. * @param boolean $ccme Send a copy of this mail to me. * * @return object * * @since 3.1.4 */ public function emailUser($target, $subject = null, $text = null, $ccme = null) { // Get the token. $token = $this->getToken($target, 'emailuser'); // Build the request path. $path = '?action=emailuser'; // Build the request data. $data = array( 'target' => $target, 'token' => $token, 'subject' => $subject, 'text' => $text, 'ccme' => $ccme, ); // Send the request. $response = $this->client->post($this->fetchUrl($path), $data); return $this->validateResponse($response); } /** * Method to get access token. * * @param string $user The User to get token. * @param string $intoken The type of token. * * @return object * * @since 3.1.4 */ public function getToken($user, $intoken) { // Build the request path. $path = '?action=query&prop=info&intoken=' . $intoken . '&titles=User:' . $user; // Send the request. $response = $this->client->post($this->fetchUrl($path), null); return (string) $this->validateResponse($response)->query->pages->page[$intoken . 'token']; } } home/wuectly/www/libraries/regularlabs/fields/users.php 0000604 00000004525 15245607142 0017423 0 ustar 00 <?php /** * @package Regular Labs Library * @version 21.4.10972 * * @author Peter van Westen <info@regularlabs.com> * @link http://www.regularlabs.com * @copyright Copyright © 2021 Regular Labs All Rights Reserved * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ defined('_JEXEC') or die; use Joomla\CMS\HTML\HTMLHelper as JHtml; use Joomla\CMS\Language\Text as JText; use Joomla\Registry\Registry; if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php')) { return; } require_once JPATH_LIBRARIES . '/regularlabs/autoload.php'; class JFormFieldRL_Users extends \RegularLabs\Library\Field { public $type = 'Users'; protected function getInput() { if ( ! is_array($this->value)) { $this->value = explode(',', $this->value); } $size = (int) $this->get('size'); $multiple = $this->get('multiple'); $show_current = $this->get('show_current'); return $this->selectListSimpleAjax( $this->type, $this->name, $this->value, $this->id, compact('size', 'multiple', 'show_current') ); } function getAjaxRaw(Registry $attributes) { $name = $attributes->get('name', $this->type); $id = $attributes->get('id', strtolower($name)); $value = $attributes->get('value', []); $size = $attributes->get('size'); $multiple = $attributes->get('multiple'); $show_current = $attributes->get('show_current'); $options = $this->getUsers(); if (is_array($options) && $show_current) { array_unshift($options, JHtml::_('select.option', 'current', '- ' . JText::_('RL_CURRENT_USER') . ' -')); } return $this->selectListSimple($options, $name, $value, $id, $size, $multiple); } function getUsers() { $query = $this->db->getQuery(true) ->select('COUNT(*)') ->from('#__users AS u'); $this->db->setQuery($query); $total = $this->db->loadResult(); if ($total > $this->max_list_count) { return -1; } $query->clear('select') ->select('u.name, u.username, u.id, u.block as disabled') ->order('name'); $this->db->setQuery($query); $list = $this->db->loadObjectList(); $list = array_map(function ($item) { if ($item->disabled) { $item->name .= ' (' . JText::_('JDISABLED') . ')'; } return $item; }, $list); return $this->getOptionsByList($list, ['username', 'id']); } } home/wuectly/www/administrator/components/com_users/models/users.php 0000604 00000031767 15245617334 0022241 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_users * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Utilities\ArrayHelper; /** * Methods supporting a list of user records. * * @since 1.6 */ class UsersModelUsers extends JModelList { /** * A blacklist of filter variables to not merge into the model's state * * @var array */ protected $filterBlacklist = array('groups', 'excluded'); /** * 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', 'active', 'group_id', 'range', 'lastvisitrange', 'state', ); } parent::__construct($config); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 1.6 */ protected function populateState($ordering = 'a.name', $direction = 'asc') { $app = JFactory::getApplication('administrator'); // Adjust the context to support modal layouts. if ($layout = $app->input->get('layout', 'default', 'cmd')) { $this->context .= '.' . $layout; } // Load the filter state. $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); $this->setState('filter.active', $this->getUserStateFromRequest($this->context . '.filter.active', 'filter_active', '', 'cmd')); $this->setState('filter.state', $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'cmd')); $this->setState('filter.group_id', $this->getUserStateFromRequest($this->context . '.filter.group_id', 'filter_group_id', null, 'int')); $this->setState('filter.range', $this->getUserStateFromRequest($this->context . '.filter.range', 'filter_range', '', 'cmd')); $this->setState( 'filter.lastvisitrange', $this->getUserStateFromRequest($this->context . '.filter.lastvisitrange', 'filter_lastvisitrange', '', 'cmd') ); $groups = json_decode(base64_decode($app->input->get('groups', '', 'BASE64'))); if (isset($groups)) { $groups = ArrayHelper::toInteger($groups); } $this->setState('filter.groups', $groups); $excluded = json_decode(base64_decode($app->input->get('excluded', '', 'BASE64'))); if (isset($excluded)) { $excluded = ArrayHelper::toInteger($excluded); } $this->setState('filter.excluded', $excluded); // Load the parameters. $params = JComponentHelper::getParams('com_users'); $this->setState('params', $params); // List state information. parent::populateState($ordering, $direction); } /** * 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. try { $userGroups = $db->loadObjectList('user_id'); } catch (RuntimeException $e) { $this->setError($e->getMessage()); 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($query); // Load the counts into an array indexed on the aro.value field (the user id). try { $userNotes = $db->loadObjectList('user_id'); } catch (RuntimeException $e) { $this->setError($e->getMessage()); 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 IN (' . $db->quote('') . ', ' . $db->quote('0') . ')'); } elseif ($active == '1') { $query->where($query->length('a.activation') . ' > 1'); } } // 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') ->group( $db->quoteName( array( 'a.id', 'a.name', 'a.username', 'a.password', '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. $search = $this->getState('filter.search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $query->where('a.id = ' . (int) substr($search, 3)); } elseif (stripos($search, 'username:') === 0) { $search = $db->quote('%' . $db->escape(substr($search, 9), true) . '%'); $query->where('a.username LIKE ' . $search); } else { // Escape the search token. $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); // Compile the different search clauses. $searches = array(); $searches[] = 'a.name LIKE ' . $search; $searches[] = 'a.username LIKE ' . $search; $searches[] = 'a.email LIKE ' . $search; // 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) { $dates = $this->buildDateRange($range); if ($dates['dNow'] === false) { $query->where( $db->qn('a.registerDate') . ' < ' . $db->quote($dates['dStart']->format('Y-m-d H:i:s')) ); } else { $query->where( $db->qn('a.registerDate') . ' >= ' . $db->quote($dates['dStart']->format('Y-m-d H:i:s')) . ' AND ' . $db->qn('a.registerDate') . ' <= ' . $db->quote($dates['dNow']->format('Y-m-d H:i:s')) ); } } // Add filter for registration ranges select list $lastvisitrange = $this->getState('filter.lastvisitrange'); // Apply the range filter. if ($lastvisitrange) { $dates = $this->buildDateRange($lastvisitrange); if (is_string($dates['dStart'])) { $query->where( $db->qn('a.lastvisitDate') . ' = ' . $db->quote($dates['dStart']) ); } elseif ($dates['dNow'] === false) { $query->where( $db->qn('a.lastvisitDate') . ' < ' . $db->quote($dates['dStart']->format('Y-m-d H:i:s')) ); } else { $query->where( $db->qn('a.lastvisitDate') . ' >= ' . $db->quote($dates['dStart']->format('Y-m-d H:i:s')) . ' AND ' . $db->qn('a.lastvisitDate') . ' <= ' . $db->quote($dates['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->qn($db->escape($this->getState('list.ordering', 'a.name'))) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); return $query; } /** * Construct the date range to filter on. * * @param string $range The textual range to construct the filter for. * * @return string The date range to filter on. * * @since 3.6.0 */ private function buildDateRange($range) { // 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': $dNow = false; 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->get('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; case 'never': $dNow = false; $dStart = $this->_db->getNullDate(); break; } return array('dNow' => $dNow, 'dStart' => $dStart); } /** * SQL server change * * @param integer $userId User identifier * * @return string Groups titles imploded :$ */ protected function _getUserDisplayedGroups($userId) { $db = $this->getDbo(); $query = $db->getQuery(true) ->select($db->qn('title')) ->from($db->qn('#__usergroups', 'ug')) ->join('LEFT', $db->qn('#__user_usergroup_map', 'map') . ' ON (ug.id = map.group_id)') ->where($db->qn('map.user_id') . ' = ' . (int) $userId); try { $result = $db->setQuery($query)->loadColumn(); } catch (RunTimeException $e) { $result = array(); } return implode("\n", $result); } } home/wuectly/www/libraries/joomla/github/package/users.php 0000604 00000010001 15245626620 0017774 0 ustar 00 <?php /** * @package Joomla.Platform * @subpackage GitHub * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; /** * GitHub API References class for the Joomla Platform. * * @documentation https://developer.github.com/v3/users * * @since 3.1.4 * @deprecated 4.0 Use the `joomla/github` package via Composer instead */ class JGithubPackageUsers extends JGithubPackage { protected $name = 'Users'; protected $packages = array('emails', 'followers', 'keys'); /** * Get a single user. * * @param string $user The users login name. * * @throws DomainException * * @return object */ public function get($user) { // Build the request path. $path = '/users/' . $user; // Send the request. return $this->processResponse( $this->client->get($this->fetchUrl($path)) ); } /** * Get the current authenticated user. * * @throws DomainException * * @return mixed */ public function getAuthenticatedUser() { // Build the request path. $path = '/user'; // Send the request. return $this->processResponse( $this->client->get($this->fetchUrl($path)) ); } /** * Update a user. * * @param string $name The full name * @param string $email The email * @param string $blog The blog * @param string $company The company * @param string $location The location * @param string $hireable If he is unemployed :P * @param string $bio The biometrical DNA fingerprint (or something...) * * @throws DomainException * * @return mixed */ public function edit($name = '', $email = '', $blog = '', $company = '', $location = '', $hireable = '', $bio = '') { $data = array( 'name' => $name, 'email' => $email, 'blog' => $blog, 'company' => $company, 'location' => $location, 'hireable' => $hireable, 'bio' => $bio, ); // Build the request path. $path = '/user'; // Send the request. return $this->processResponse( $this->client->patch($this->fetchUrl($path), json_encode($data)) ); } /** * Get all users. * * This provides a dump of every user, in the order that they signed up for GitHub. * * @param integer $since The integer ID of the last User that you’ve seen. * * @throws DomainException * @return mixed */ public function getList($since = 0) { // Build the request path. $path = '/users'; $path .= ($since) ? '?since=' . $since : ''; // Send the request. return $this->processResponse( $this->client->get($this->fetchUrl($path)) ); } /* * Legacy methods */ /** * Get a single user. * * @param string $user The users login name. * * @deprecated use users->get() * * @throws DomainException * * @return mixed */ public function getUser($user) { return $this->get($user); } /** * Update a user. * * @param string $name The full name * @param string $email The email * @param string $blog The blog * @param string $company The company * @param string $location The location * @param string $hireable If he is unemployed :P * @param string $bio The biometrical DNA fingerprint (or something...) * * @deprecated use users->edit() * * @throws DomainException * * @return mixed */ public function updateUser($name = '', $email = '', $blog = '', $company = '', $location = '', $hireable = '', $bio = '') { return $this->edit($name = '', $email = '', $blog = '', $company = '', $location = '', $hireable = '', $bio = ''); } /** * Get all users. * * This provides a dump of every user, in the order that they signed up for GitHub. * * @param integer $since The integer ID of the last User that you’ve seen. * * @deprecated use users->getList() * * @throws DomainException * @return mixed */ public function getUsers($since = 0) { return $this->getList($since); } } home/wuectly/www/administrator/components/com_users/helpers/users.php 0000604 00000015411 15245630335 0022400 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Users component helper. * * @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) { JHtmlSidebar::addEntry( JText::_('COM_USERS_SUBMENU_USERS'), 'index.php?option=com_users&view=users', $vName == 'users' ); // Groups and Levels are restricted to core.admin $canDo = JHelperContent::getActions('com_users'); if ($canDo->get('core.admin')) { JHtmlSidebar::addEntry( JText::_('COM_USERS_SUBMENU_GROUPS'), 'index.php?option=com_users&view=groups', $vName == 'groups' ); JHtmlSidebar::addEntry( JText::_('COM_USERS_SUBMENU_LEVELS'), 'index.php?option=com_users&view=levels', $vName == 'levels' ); } if (JComponentHelper::isEnabled('com_fields') && JComponentHelper::getParams('com_users')->get('custom_fields_enable', '1')) { JHtmlSidebar::addEntry( JText::_('JGLOBAL_FIELDS'), 'index.php?option=com_fields&context=com_users.user', $vName == 'fields.fields' ); JHtmlSidebar::addEntry( JText::_('JGLOBAL_FIELD_GROUPS'), 'index.php?option=com_fields&view=groups&context=com_users.user', $vName == 'fields.groups' ); } JHtmlSidebar::addEntry( JText::_('COM_USERS_SUBMENU_NOTES'), 'index.php?option=com_users&view=notes', $vName == 'notes' ); JHtmlSidebar::addEntry( JText::_('COM_USERS_SUBMENU_NOTE_CATEGORIES'), 'index.php?option=com_categories&extension=com_users', $vName == 'categories' ); } /** * Gets a list of the actions that can be performed. * * @return JObject * * @deprecated 3.2 Use JHelperContent::getActions() instead */ public static function getActions() { // Log usage of deprecated function try { JLog::add( sprintf('%s() is deprecated. Use JHelperContent::getActions() with new arguments order instead.', __METHOD__), JLog::WARNING, 'deprecated' ); } catch (RuntimeException $exception) { // Informational log only } // Get list of actions return JHelperContent::getActions('com_users'); } /** * Get a list of filter options for the blocked state of a user. * * @return array An array of JHtmlOption elements. * * @since 1.6 */ public 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 */ public 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 */ public static function getGroups() { $options = JHelperUsergroups::getInstance()->getAll(); foreach ($options as &$option) { $option->value = $option->id; $option->text = str_repeat('- ', $option->level) . $option->title; } 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; } /** * Creates a list of two factor authentication methods used in com_users * on user view * * @return array * * @since 3.2.0 */ public static function getTwoFactorMethods() { FOFPlatform::getInstance()->importPlugin('twofactorauth'); $identities = FOFPlatform::getInstance()->runPlugins('onUserTwofactorIdentify', array()); $options = array( JHtml::_('select.option', 'none', JText::_('JGLOBAL_OTPMETHOD_NONE'), 'value', 'text'), ); if (!empty($identities)) { foreach ($identities as $identity) { if (!is_object($identity)) { continue; } $options[] = JHtml::_('select.option', $identity->method, $identity->title, 'value', 'text'); } } return $options; } /** * Get a list of the User Groups for Viewing Access Levels * * @param string $rules User Groups in JSON format * * @return string $groups Comma separated list of User Groups * * @since 3.6 */ public static function getVisibleByGroups($rules) { $rules = json_decode($rules); if (!$rules) { return false; } $rules = implode(',', $rules); $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('a.title AS text') ->from('#__usergroups as a') ->where('a.id IN (' . $rules . ')'); $db->setQuery($query); $groups = $db->loadColumn(); $groups = implode(', ', $groups); return $groups; } /** * Returns a valid section for users. If it is not valid then null * is returned. * * @param string $section The section to get the mapping for * * @return string|null The new section * * @since 3.7.0 */ public static function validateSection($section) { if (JFactory::getApplication()->isClient('site')) { switch ($section) { case 'registration': case 'profile': $section = 'user'; } } if ($section != 'user') { // We don't know other sections return null; } return $section; } /** * Returns valid contexts * * @return array * * @since 3.7.0 */ public static function getContexts() { JFactory::getLanguage()->load('com_users', JPATH_ADMINISTRATOR); $contexts = array( 'com_users.user' => JText::_('COM_USERS'), ); return $contexts; } } home/wuectly/www/libraries/regularlabs/helpers/assignments/users.php 0000604 00000007123 15245670137 0022153 0 ustar 00 <?php /** * @package Regular Labs Library * @version 21.4.10972 * * @author Peter van Westen <info@regularlabs.com> * @link http://www.regularlabs.com * @copyright Copyright © 2021 Regular Labs All Rights Reserved * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ /* @DEPRECATED */ defined('_JEXEC') or die; use Joomla\CMS\Factory as JFactory; if (is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php')) { require_once JPATH_LIBRARIES . '/regularlabs/autoload.php'; } require_once dirname(__DIR__) . '/assignment.php'; class RLAssignmentsUsers extends RLAssignment { public function passAccessLevels() { $user = JFactory::getUser(); $levels = $user->getAuthorisedViewLevels(); $this->selection = $this->convertAccessLevelNamesToIds($this->selection); return $this->passSimple($levels); } public function passUserGroupLevels() { $user = JFactory::getUser(); if ( ! empty($user->groups)) { $groups = array_values($user->groups); } else { $groups = $user->getAuthorisedGroups(); } if ($this->params->inc_children) { $this->setUserGroupChildrenIds(); } $this->selection = $this->convertUsergroupNamesToIds($this->selection); return $this->passSimple($groups); } public function passUsers() { return $this->passSimple(JFactory::getUser()->get('id')); } private function convertAccessLevelNamesToIds($selection) { $names = []; foreach ($selection as $i => $level) { if (is_numeric($level)) { continue; } unset($selection[$i]); $names[] = strtolower(str_replace(' ', '', $level)); } $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from('#__viewlevels') ->where('LOWER(REPLACE(' . $db->quoteName('title') . ', " ", "")) IN (\'' . implode('\',\'', $names) . '\')'); $db->setQuery($query); $level_ids = $db->loadColumn(); return array_unique(array_merge($selection, $level_ids)); } private function convertUsergroupNamesToIds($selection) { $names = []; foreach ($selection as $i => $group) { if (is_numeric($group)) { continue; } unset($selection[$i]); $names[] = strtolower(str_replace(' ', '', $group)); } $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from('#__usergroups') ->where('LOWER(REPLACE(' . $db->quoteName('title') . ', " ", "")) IN (\'' . implode('\',\'', $names) . '\')'); $db->setQuery($query); $group_ids = $db->loadColumn(); return array_unique(array_merge($selection, $group_ids)); } private function setUserGroupChildrenIds() { $children = $this->getUserGroupChildrenIds($this->selection); if ($this->params->inc_children == 2) { $this->selection = $children; return; } $this->selection = array_merge($this->selection, $children); } private function getUserGroupChildrenIds($groups) { $children = []; $db = JFactory::getDbo(); foreach ($groups as $group) { $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__usergroups')) ->where($db->quoteName('parent_id') . ' = ' . (int) $group); $db->setQuery($query); $group_children = $db->loadColumn(); if (empty($group_children)) { continue; } $children = array_merge($children, $group_children); $group_grand_children = $this->getUserGroupChildrenIds($group_children); if (empty($group_grand_children)) { continue; } $children = array_merge($children, $group_grand_children); } $children = array_unique($children); return $children; } } home/wuectly/www/administrator/components/com_users/users.php 0000604 00000001223 15245721232 0020727 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_users * * @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::_('behavior.tabstate'); if (!JFactory::getUser()->authorise('core.manage', 'com_users')) { throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); } JLoader::register('UsersHelper', __DIR__ . '/helpers/users.php'); $controller = JControllerLegacy::getInstance('Users'); $controller->execute(JFactory::getApplication()->input->get('task')); $controller->redirect();
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка