Файловый менеджер - Редактировать - /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); } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка