Spade
Mini Shell
access.xml000064400000000500151165062330006524 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<access component="com_loginasuser">
<section name="component">
<action name="core.admin" title="JACTION_ADMIN"
description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.manage" title="JACTION_MANAGE"
description="JACTION_MANAGE_COMPONENT_DESC" />
</section>
</access>assets/icons/index.html000064400000000034151165062330011155
0ustar00<html>
<body></body>
</html>assets/icons/loginasuser-loginasuser-favicon.png000064400000000637151165062330016206
0ustar00�PNG
IHDR�atEXtSoftwareAdobe
ImageReadyq�e<AIDATxڔӿ+Ea���Ǐ2Q�J)18F#��6L����V��c���$�E�nd��%�E��逸�����t~<��<�9ϓ���c�ZQ3���!�<&��*2ڠf]�Y��Ũ4����t�o�g�h8|���s<���4H��}K��s�r�6�9�E��{d}%ǽK��K�b�p���,�S8�g��=?XVvm�
�8®+
�a��G�ʸ�
�p�.i��1�+������BU�r��9�q��PGfk]��3���ق�x��&����%�#�U����;��(H���A���VV��,?X��c�IEND�B`�assets/icons/loginasuser.png000064400000002032151165062330012221
0ustar00�PNG
IHDR00W��tEXtSoftwareAdobe
ImageReadyq�e<�IDATx��WhQ�g�j�k$�h4Q,c|�ꋁ�(P���_Ā%F�����X#jD��AD��`�1�d��0gݝ��� x�cfg���ι�{���Z[����?t��3JKA���>�U\���Am���`�B���,2�_%�G:���l�8�����٠�c#��H4O�
��<��U���.
5{�}����s@Sy�_G�_�m>5�Z$nl*�&X|���]t�%2�xU���M��L� XvFyo8m�zq���fX��S�[��[�D���c]df�
��E�a
:��~�o
�.Cq��I�)��3�2u�j���a�~��I<�
��}
,����wm��I7�
���Be���L�:�b�f+��u��~�cR0n��|,g-��|�6� �3K�cmV�l7Nf���
.DH���M�)QUJ���\��ނ�`��/�t-��_q��5�<c��j�
���y,��r���!�.L0��\Ƿc,�k�3Z)X�rZ��L� 4r7!+bg�̝?��ƾ��lYo����2���"��ؒ7��t����c9�R��
�H��gk�t�"��<q�ܑhT%
��m"�~���eD�Gp�a��Fx���b��(�)T��0�k�CʊPr'Y��+�3��K���)5ͫ���L�}�'\����r8�72�54��B;c�l$�V1K����a�)d�P-@�k��Qg�Jǣ}��Zd�X�L�]��m�iZ�$Q!
S��%�����XR4������)�0��=w"
h�|�CU�nH+Jּk 纕�й,zyT�|Б��F���\G�?�y�m��NY�ku����\��
;<�J�\��
Ts�2ͣ�EM�q���*q��4¶�&�C1IEND�B`�assets/index.html000064400000000037151165062360010050
0ustar00<!DOCTYPE html><title></title>
controller.php000064400000011314151165062360007445 0ustar00<?php
/* ======================================================
# Login as User for Joomla! - v3.5.9 (pro version)
# -------------------------------------------------------
# For Joomla! CMS (v3.x)
# Author: Web357 (Yiannis Christodoulou)
# Copyright (©) 2014-2022 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https:/www.web357.com
# Demo: https://demo.web357.com/joomla/login-as-user
# Support: support@web357.com
# Last modified: Wednesday 07 December 2022, 11:05:26 AM
========================================================= */
/**
* @package Joomla.Administrator
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Users master display controller.
*
* @since 1.6
*/
class LoginasuserController extends JControllerLegacy
{
/**
* Checks whether a user can see this view.
*
* @param string $view The view name.
*
* @return boolean
*
* @since 1.6
*/
protected function canView($view)
{
// Get Joomla! version
$jversion = new JVersion;
$short_version = explode('.', $jversion->getShortVersion());
// 3.8.10
$mini_version = $short_version[0].'.'.$short_version[1]; // 3.8
if (!version_compare( $mini_version, "2.5", "<="))
:
// joomla 3.x
$canDo = JHelperContent::getActions('com_users');
else:
// joomla 2.5.x
$canDo = LoginasuserHelper::getActions();
endif;
switch ($view)
{
// Special permissions.
case 'groups':
case 'group':
case 'levels':
case 'level':
return $canDo->get('core.admin');
break;
// Default permissions.
default:
return true;
}
}
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe url parameters and their
variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
// Get Joomla! version
$jversion = new JVersion;
$short_version = explode('.', $jversion->getShortVersion());
// 3.8.10
$mini_version = $short_version[0].'.'.$short_version[1]; // 3.8
if (!version_compare( $mini_version, "2.5", "<="))
:
// joomla 3.x
$view = $this->input->get('view',
'loginasuser');
$layout = $this->input->get('layout',
'default');
$id = $this->input->getInt('id');
else:
// joomla 2.5.x
// Load the submenu.
LoginasuserHelper::addSubmenu(JFactory::getApplication()->input->get('view',
'loginasuser', 'CMD'));
$view = JFactory::getApplication()->input->get('view',
'loginasuser', 'CMD');
$layout =
JFactory::getApplication()->input->get('layout',
'', 'CMD');
$id = JFactory::getApplication()->input->get('id',
'', 'INT');
endif;
if (!$this->canView($view))
{
throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 404);
}
// Check for edit form.
if ($view == 'user' && $layout == 'edit'
&& !$this->checkEditId('com_users.edit.user', $id))
{
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID',
$id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=loginasuser',
false));
return false;
}
elseif ($view == 'group' && $layout == 'edit'
&& !$this->checkEditId('com_users.edit.group', $id))
{
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID',
$id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=groups',
false));
return false;
}
elseif ($view == 'level' && $layout == 'edit'
&& !$this->checkEditId('com_users.edit.level', $id))
{
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID',
$id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=levels',
false));
return false;
}
elseif ($view == 'note' && $layout == 'edit'
&& !$this->checkEditId('com_users.edit.note', $id))
{
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID',
$id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=notes',
false));
return false;
}
return parent::display();
}
}
controllers/loginasuser.php000064400000010026151165062360012162
0ustar00<?php
/* ======================================================
# Login as User for Joomla! - v3.5.9 (pro version)
# -------------------------------------------------------
# For Joomla! CMS (v3.x)
# Author: Web357 (Yiannis Christodoulou)
# Copyright (©) 2014-2022 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https:/www.web357.com
# Demo: https://demo.web357.com/joomla/login-as-user
# Support: support@web357.com
# Last modified: Wednesday 07 December 2022, 11:05:26 AM
========================================================= */
/**
* @package Joomla.Administrator
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Users list controller class.
*
* @since 1.6
*/
class LoginasuserControllerLoginasuser extends JControllerAdmin
{
/**
* @var string The prefix to use with controller messages.
* @since 1.6
*/
protected $text_prefix = 'COM_USERS_USERS';
/**
* Constructor.
*
* @param array $config An optional associative array of configuration
settings.
*
* @since 1.6
* @see JController
*/
public function __construct($config = array())
{
parent::__construct($config);
$this->registerTask('block', 'changeBlock');
$this->registerTask('unblock', 'changeBlock');
}
/**
* Proxy for getModel.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return object The model.
*
* @since 1.6
*/
public function getModel($name = 'Loginasuser', $prefix =
'LoginasuserModel', $config = array('ignore_request'
=> true))
{
return parent::getModel($name, $prefix, $config);
}
/**
* Method to change the block status on a record.
*
* @return void
*
* @since 1.6
*/
public function changeBlock()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$ids = $this->input->get('cid', array(),
'array');
$values = array('block' => 1, 'unblock' => 0);
$task = $this->getTask();
// Get Joomla! version
$jversion = new JVersion;
$short_version = explode('.', $jversion->getShortVersion());
// 3.8.10
$mini_version = $short_version[0].'.'.$short_version[1]; // 3.8
// Sanitize the input
if (version_compare($mini_version, "4.0", ">="))
{
// j4
$value = ArrayHelper::getValue($values, $task, 0, 'int');
}
else
{
$value = JArrayHelper::getValue($values, $task, 0, 'int');
}
if (empty($ids))
{
throw new
Exception(JText::_('COM_USERS_USERS_NO_ITEM_SELECTED'), 500);
}
else
{
// Get the model.
$model = $this->getModel();
// Change the state of the records.
if (!$model->block($ids, $value))
{
throw new Exception($model->getError(), 500);
}
else
{
if ($value == 1)
{
$this->setMessage(JText::plural('COM_USERS_N_USERS_BLOCKED',
count($ids)));
}
elseif ($value == 0)
{
$this->setMessage(JText::plural('COM_USERS_N_USERS_UNBLOCKED',
count($ids)));
}
}
}
$this->setRedirect('index.php?option=com_users&view=loginasuser');
}
/**
* Method to activate a record.
*
* @return void
*
* @since 1.6
*/
public function activate()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$ids = $this->input->get('cid', array(),
'array');
if (empty($ids))
{
throw new
Exception(JText::_('COM_USERS_USERS_NO_ITEM_SELECTED'), 500);
}
else
{
// Get the model.
$model = $this->getModel();
// Change the state of the records.
if (!$model->activate($ids))
{
throw new Exception($model->getError(), 500);
}
else
{
$this->setMessage(JText::plural('COM_USERS_N_USERS_ACTIVATED',
count($ids)));
}
}
$this->setRedirect('index.php?option=com_users&view=loginasuser');
}
}
helpers/helper.php000064400000016507151165062360010214 0ustar00<?php
/* ======================================================
# Login as User for Joomla! - v3.5.9 (pro version)
# -------------------------------------------------------
# For Joomla! CMS (v3.x)
# Author: Web357 (Yiannis Christodoulou)
# Copyright (©) 2014-2022 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https:/www.web357.com
# Demo: https://demo.web357.com/joomla/login-as-user
# Support: support@web357.com
# Last modified: Wednesday 07 December 2022, 11:05:26 AM
========================================================= */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
abstract class LoginasuserHelper
{
/**
* @var JObject A cache for the available actions.
* @since 1.6
*/
protected static $actions;
public static function addSubmenu($submenu)
{
// get the ID of plugin
$db = JFactory::getDBO();
$query = "SELECT extension_id "
."FROM #__extensions "
."WHERE type='plugin' AND element='loginasuser'
AND folder='system' "
;
$db->setQuery($query);
$db->execute();
$extension_id = (int)$db->loadResult();
// Get Joomla! version
$jversion = new JVersion;
$short_version = explode('.', $jversion->getShortVersion());
// 3.8.10
$mini_version = $short_version[0].'.'.$short_version[1]; // 3.8
if (version_compare( $mini_version, "2.5", "<="))
:
// J25X
$vName = JFactory::getApplication()->input->get('view',
'loginasuser', 'CMD');
echo JSubMenuHelper::addEntry( JText::_('Users List (Login as
User)'),
'index.php?option=com_loginasuser&view=loginasuser', $vName
== 'loginasuser' );
$vName = JFactory::getApplication()->input->get('view',
'plugin_settings', 'CMD');
echo JSubMenuHelper::addEntry( JText::_('Settings'),
'index.php?option=com_plugins&task=plugin.edit&extension_id='.$extension_id,
$vName == 'plugin_settings' );
$vName = JFactory::getApplication()->input->get('view',
'overv', 'CMD');
echo JSubMenuHelper::addEntry( JText::_('About Login as
User'), 'index.php?option=com_loginasuser&view=overv',
$vName == 'overv' );
$vName = JFactory::getApplication()->input->get('view',
'about', 'CMD');
echo JSubMenuHelper::addEntry( JText::_('About Web357'),
'index.php?option=com_loginasuser&view=about', $vName ==
'about' );
else:
// J3X
JHtmlSidebar::addEntry(JText::_('Users List (Login as User)'),
'index.php?option=com_loginasuser&view=loginasuser', $submenu
== 'loginasuser');
JHtmlSidebar::addEntry(JText::_('Settings'),
'index.php?option=com_plugins&task=plugin.edit&extension_id='.$extension_id,
$submenu == 'plugin_settings');
JHtmlSidebar::addEntry(JText::_('About Login as User'),
'index.php?option=com_loginasuser&view=overv', $submenu ==
'overv');
JHtmlSidebar::addEntry(JText::_('About Web357'),
'index.php?option=com_loginasuser&view=about', $submenu ==
'about');
endif;
}
/**
* Gets a list of the actions that can be performed.
*
* @return JObject
*
* @deprecated 3.2 Use JHelperContent::getActions() instead
*/
public static function getActions()
{
// Get Joomla! version
$jversion = new JVersion;
$short_version = explode('.', $jversion->getShortVersion());
// 3.8.10
$mini_version = $short_version[0].'.'.$short_version[1]; // 3.8
if (!version_compare( $mini_version, "2.5", "<="))
:
// joomla 3.x
// Log usage of deprecated function
JLog::add(__METHOD__ . '() is deprecated, use
JHelperContent::getActions() with new arguments order instead.',
JLog::WARNING, 'deprecated');
// Get list of actions
$result = JHelperContent::getActions('com_users');
return $result;
else:
// joomla 2.5.x
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;
endif;
}
/**
* 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()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('a.id AS value')
->select('a.title AS text')
->select('COUNT(DISTINCT b.id) AS level')
->from('#__usergroups as a')
->join('LEFT', '#__usergroups AS b ON a.lft >
b.lft AND a.rgt < b.rgt')
->group('a.id, a.title, a.lft, a.rgt')
->order('a.lft ASC');
$db->setQuery($query);
try
{
$options = $db->loadObjectList();
}
catch (RuntimeException $e)
{
Factory::getApplication()->enqueueMessage($e->getMessage(),
'error');
return;
}
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;
}
/**
* 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()
{
// Load the Joomla! RAD layer
if (!defined('FOF_INCLUDED'))
{
include_once JPATH_LIBRARIES . '/fof/include.php';
}
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;
}
}helpers/html/users.php000064400000014031151165062360011030
0ustar00<?php
/* ======================================================
# Login as User for Joomla! - v3.5.9 (pro version)
# -------------------------------------------------------
# For Joomla! CMS (v3.x)
# Author: Web357 (Yiannis Christodoulou)
# Copyright (©) 2014-2022 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https:/www.web357.com
# Demo: https://demo.web357.com/joomla/login-as-user
# Support: support@web357.com
# Last modified: Wednesday 07 December 2022, 11:05:26 AM
========================================================= */
/**
* @package Joomla.Administrator
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Extended Utility class for the Users component.
*
* @since 2.5
*/
class JHtmlUsers
{
/**
* Display an image.
*
* @param string $src The source of the image
*
* @return string A <img> element if the specified file exists,
otherwise, a null string
*
* @since 2.5
*/
public static function image($src)
{
$src = preg_replace('#[^A-Z0-9\-_\./]#i', '', $src);
$file = JPATH_SITE . '/' . $src;
jimport('joomla.filesystem.path');
JPath::check($file);
if (!file_exists($file))
{
return '';
}
return '<img src="' . JUri::root() . $src .
'" alt="" />';
}
/**
* Displays an icon to add a note for this user.
*
* @param integer $userId The user ID
*
* @return string A link to add a note
*
* @since 2.5
*/
public static function addNote($userId)
{
$title = JText::_('COM_USERS_ADD_NOTE');
return '<a href="' .
JRoute::_('index.php?option=com_users&task=note.add&u_id='
. (int) $userId) . '" class="hasTooltip btn btn-mini"
title="' . $title . '">'
. '<i class="icon-vcard"></i><span
class="hidden-phone">' . $title .
'</span></a>';
}
/**
* Displays an icon to filter the notes list on this user.
*
* @param integer $count The number of notes for the user
* @param integer $userId The user ID
*
* @return string A link to apply a filter
*
* @since 2.5
*/
public static function filterNotes($count, $userId)
{
if (empty($count))
{
return '';
}
$title = JText::_('COM_USERS_FILTER_NOTES');
return '<a href="' .
JRoute::_('index.php?option=com_users&view=notes&filter_search=uid:'
. (int) $userId) . '" class="hasTooltip btn btn-mini"
title="' . $title . '">'
. '<i
class="icon-filter"></i></a>';
}
/**
* Displays a note icon.
*
* @param integer $count The number of notes for the user
* @param integer $userId The user ID
*
* @return string A link to a modal window with the user notes
*
* @since 2.5
*/
public static function notes($count, $userId)
{
if (empty($count))
{
return '';
}
$title = JText::plural('COM_USERS_N_USER_NOTES', $count);
return '<a href="#userModal_' . (int) $userId .
'" id="modal-' . (int) $userId . '"
data-toggle="modal" class="hasTooltip btn btn-mini"
title="' . $title . '">'
. '<i class="icon-drawer-2"></i><span
class="hidden-phone">' . $title .
'</span></a>';
}
/**
* Renders the modal html.
*
* @param integer $count The number of notes for the user
* @param integer $userId The user ID
*
* @return string The html for the rendered modal
*
* @since 3.4.1
*/
public static function notesModal($count, $userId)
{
if (empty($count))
{
return '';
}
$title = JText::plural('COM_USERS_N_USER_NOTES', $count);
return JHtmlBootstrap::renderModal(
'userModal_' . (int) $userId, array(
'url' =>
JRoute::_('index.php?option=com_users&view=notes&tmpl=component&layout=modal&u_id='
. (int) $userId),
'title' => $title,
'width' => '800px',
'height' => '500px')
);
}
/**
* Build an array of block/unblock user states to be used by jgrid.state,
* State options will be different for any user
* and for currently logged in user
*
* @param boolean $self True if state array is for currently logged in
user
*
* @return array a list of possible states to display
*
* @since 3.0
*/
public static function blockStates( $self = false)
{
if ($self)
{
$states = array(
1 => array(
'task' => 'unblock',
'text' => '',
'active_title' =>
'COM_USERS_USER_FIELD_BLOCK_DESC',
'inactive_title' => '',
'tip' => true,
'active_class' => 'unpublish',
'inactive_class' => 'unpublish'
),
0 => array(
'task' => 'block',
'text' => '',
'active_title' => '',
'inactive_title' =>
'COM_USERS_USERS_ERROR_CANNOT_BLOCK_SELF',
'tip' => true,
'active_class' => 'publish',
'inactive_class' => 'publish'
)
);
}
else
{
$states = array(
1 => array(
'task' => 'unblock',
'text' => '',
'active_title' => 'COM_USERS_TOOLBAR_UNBLOCK',
'inactive_title' => '',
'tip' => true,
'active_class' => 'unpublish',
'inactive_class' => 'unpublish'
),
0 => array(
'task' => 'block',
'text' => '',
'active_title' =>
'COM_USERS_USER_FIELD_BLOCK_DESC',
'inactive_title' => '',
'tip' => true,
'active_class' => 'publish',
'inactive_class' => 'publish'
)
);
}
return $states;
}
/**
* Build an array of activate states to be used by jgrid.state,
*
* @return array a list of possible states to display
*
* @since 3.0
*/
public static function activateStates()
{
$states = array(
1 => array(
'task' => 'activate',
'text' => '',
'active_title' => 'COM_USERS_TOOLBAR_ACTIVATE',
'inactive_title' => '',
'tip' => true,
'active_class' => 'unpublish',
'inactive_class' => 'unpublish'
),
0 => array(
'task' => '',
'text' => '',
'active_title' => '',
'inactive_title' => 'COM_USERS_ACTIVATED',
'tip' => true,
'active_class' => 'publish',
'inactive_class' => 'publish'
)
);
return $states;
}
}
index.html000064400000000037151165062360006546 0ustar00<!DOCTYPE
html><title></title>
language/en-GB/en-GB.com_loginasuser.ini000064400000001445151165062360014011
0ustar00; Defaults
COM_LOGINASUSER="Login as User"
LOGINASUSER="Login as User"
WEB357LOGINASUSER="Login as User"
COM_LOGINASUSER_XML_DESCRIPTION="<p style='padding: 30px 0
!important;'>This plugin helps admin users to login to the
front-end as a specific user. It is useful for websites where the admin
user needs to check if a user can see their order(s) correctly, if a form
was filled out correctly, or any issues with a user's personal
details, etc. The Admin user will be accessing all this information as the
external User in order to replicate any issues and assist the user. To see
plugin in action, visit the <a
href='index.php?option=com_loginasuser'>Component's
page</a>.</p>"
COM_LOGINASUSER_CONFIGURATION="Login as User - Parameters"
COM_LOGINASUSER_XML_PARAMS_DESC="Login as User -
Parameters"language/en-GB/en-GB.com_loginasuser.sys.ini000064400000001447151165062360014630
0ustar00; Defaults
COM_LOGINASUSER="Login as User"
LOGINASUSER="Login as User"
WEB357LOGINASUSER="Login as User"
COM_LOGINASUSER_XML_DESCRIPTION="<p style='padding: 30px 0
!important;'>This plugin helps admin users to login to the
front-end as a specific user. It is useful for websites where the admin
user needs to check if a user can see their order(s) correctly, if a form
was filled out correctly, or any issues with a user's personal
details, etc. The Admin user will be accessing all this information as the
external User in order to replicate any issues and assist the user. To see
plugin in action, visit the <a
href='index.php?option=com_loginasuser'>Component's
page</a>.</p>"
COM_LOGINASUSER_CONFIGURATION="Login as User - Parameters"
COM_LOGINASUSER_XML_PARAMS_DESC="Login as User - Parameters"
language/en-GB/index.html000064400000000057151165062360011223
0ustar00<html>
<body bgcolor="#FFFFFF">
</body>
</html>language/index.html000064400000000057151165062360010333
0ustar00<html>
<body bgcolor="#FFFFFF">
</body>
</html>loginasuser.php000064400000006724151165062360007626
0ustar00<?php
/* ======================================================
# Login as User for Joomla! - v3.5.9 (pro version)
# -------------------------------------------------------
# For Joomla! CMS (v3.x)
# Author: Web357 (Yiannis Christodoulou)
# Copyright (©) 2014-2022 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https:/www.web357.com
# Demo: https://demo.web357.com/joomla/login-as-user
# Support: support@web357.com
# Last modified: Wednesday 07 December 2022, 11:05:26 AM
========================================================= */
/**
* @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;
// BEGIN: Check if Web357 Framework plugin exists and is enabled
jimport('joomla.plugin.helper');
if(!JPluginHelper::isEnabled('system',
'web357framework')):
$web357framework_required_msg = JText::_('<p>The
<strong>"Web357 Framework"</strong> is required for
this extension and must be active. Please, download and install it from
<a
href="http://downloads.web357.com/?item=web357framework&type=free">here</a>.
It\'s FREE!</p>');
JFactory::getApplication()->enqueueMessage($web357framework_required_msg,
'error');
return false;
endif;
// END: Check if Web357 Framework plugin exists and is enabled
// BEGIN: Check if the plugin exists
if(!JPluginHelper::isEnabled('system', 'loginasuser')):
$plugin_required_msg = JText::_('<p>The
<strong>"Login as User"</strong> plugin is required
for this extension and must be active. Check if is unpublished. If does not
exists in the Plugins list, download and install it from <a
href="https://www.web357.com/downloads/"
target="_blank">web357.com/downloads</a>.</p>');
JFactory::getApplication()->enqueueMessage($plugin_required_msg,
'error');
return false;
endif;
// END: Check if the plugin exists
// Call the Web357 Framework Helper Class
require_once(JPATH_PLUGINS.DIRECTORY_SEPARATOR.'system'.DIRECTORY_SEPARATOR.'web357framework'.DIRECTORY_SEPARATOR.'web357framework.class.php');
$w357frmwrk = new Web357FrameworkHelperClass;
// API Key Checker
$w357frmwrk->apikeyChecker();
// ACL
if (!JFactory::getUser()->authorise('core.manage',
'com_loginasuser')):
throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 404);
endif;
// BEGIN: Loading com_users language
$lang = JFactory::getLanguage();
$current_lang_tag = $lang->getTag();
$lang = JFactory::getLanguage();
$extension = 'com_users';
$base_dir = JPATH_ADMINISTRATOR;
$language_tag = (!empty($current_lang_tag)) ? $current_lang_tag :
'en-GB';
$reload = true;
$lang->load($extension, $base_dir, $language_tag, $reload);
// END: Loading com_users language
if (version_compare(JVERSION, '4.0', 'lt'))
{
// Load cms libraries
JLoader::registerPrefix('J', JPATH_PLATFORM . '/cms');
// Load joomla libraries without overwrite
JLoader::registerPrefix('J', JPATH_PLATFORM .
'/joomla',false);
}
// Register helper class
JLoader::register('LoginasuserHelper', dirname(__FILE__) .
'/helpers/helper.php');
// import joomla controller library
jimport('joomla.application.component.controller');
// Get an instance of the controller prefixed by Estore
$controller = JControllerLegacy::getInstance('Loginasuser');
// Perform the Request task
$controller->execute(JFactory::getApplication()->input->get('task'));
// Redirect if set by the controller
$controller->redirect();loginasuser.xml000064400000003501151165062360007625
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="2.5"
method="upgrade">
<name>COM_LOGINASUSER</name>
<author>Web357 (Yiannis Christodoulou)</author>
<creationDate>07-Dec-2022</creationDate>
<copyright>Copyright (©) 2014-2022 Web357. All rights
reserved.</copyright>
<license>GNU/GPLv3,
http://www.gnu.org/licenses/gpl-3.0.html</license>
<authorEmail>support@web357.com</authorEmail>
<authorUrl>https:/www.web357.com</authorUrl>
<version>3.5.9</version>
<variant>pro</variant>
<description>This plugin helps admin users to login to the front-end
as a specific user. It is useful for websites where the admin user needs to
check if a user can see their order(s) correctly, if a form was filled out
correctly, or any issues with a user personal details, etc. The Admin user
will be accessing all this information as the external User in order to
replicate any issues and assist the user.</description>
<scriptfile>script.install.php</scriptfile>
<administration>
<menu link="option=com_loginasuser&view=loginasuser"
admin_menu_link="option=com_loginasuser&view=loginasuser"
view="loginasuser"
img="components/com_loginasuser/assets/icons/loginasuser-loginasuser-favicon.png">COM_LOGINASUSER</menu>
<files>
<folder>assets</folder>
<folder>controllers</folder>
<folder>helpers</folder>
<folder>language</folder>
<folder>models</folder>
<folder>views</folder>
<filename>controller.php</filename>
<filename>index.html</filename>
<filename>loginasuser.php</filename>
<filename>access.xml</filename>
<filename>script.install.helper.php</filename>
</files>
</administration>
<updateservers><server type="extension"
priority="1" name="Login as User (pro
version)"><![CDATA[https://updates.web357.com/loginasuser/loginasuser_pro.xml]]></server></updateservers>
</extension>models/about.php000064400000002012151165062360007652
0ustar00<?php
/* ======================================================
# Login as User for Joomla! - v3.5.9 (pro version)
# -------------------------------------------------------
# For Joomla! CMS (v3.x)
# Author: Web357 (Yiannis Christodoulou)
# Copyright (©) 2014-2022 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https:/www.web357.com
# Demo: https://demo.web357.com/joomla/login-as-user
# Support: support@web357.com
# Last modified: Wednesday 07 December 2022, 11:05:26 AM
========================================================= */
defined('_JEXEC') or die;
jimport('joomla.application.component.modelform');
/**
* Component Settings Model
*
*/
class LoginasuserModelAbout extends JModelForm
{
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_loginasuser.about',
'about', array('control' => 'jform',
'load_data' => $loadData));
if (empty($form)) {
return false;
}
return $form;
}
}
models/fields/index.html000064400000000057151165062360011301
0ustar00<html>
<body bgcolor="#FFFFFF">
</body>
</html>models/forms/about.xml000064400000000700151165062360011013
0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset name="about" label="About Web357"
addfieldpath="/plugins/system/web357framework/elements">
<!-- BEGIN: About Web357 -->
<field type="header"
name="W357FRM_HEADER_ABOUT_WEB357"
label="W357FRM_HEADER_ABOUT_WEB357" />
<field name="about" id="about"
type="about" label=""
addfieldpath="/plugins/system/web357framework/elements" />
<!-- END: About Web357 -->
</fieldset>
</form>models/forms/filter_loginasuser.xml000064400000005456151165062360013616
0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="filter">
<field
name="search"
type="text"
label="COM_USERS_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
class="js-stools-search-string"
/>
<field
name="state"
type="userstate"
label="COM_USERS_FILTER_STATE"
description="COM_USERS_FILTER_STATE_DESC"
onchange="this.form.submit();"
>
<option value="">COM_USERS_FILTER_STATE</option>
</field>
<field
name="active"
type="useractive"
label="COM_USERS_FILTER_ACTIVE"
description="COM_USERS_FILTER_ACTIVE_DESC"
onchange="this.form.submit();"
>
<option value="">COM_USERS_FILTER_ACTIVE</option>
</field>
<field
name="group_id"
type="usergrouplist"
label="COM_USERS_FILTER_GROUP"
description="COM_USERS_FILTER_GROUP_DESC"
onchange="this.form.submit();"
>
<option
value="">COM_USERS_FILTER_USERGROUP</option>
</field>
<field
name="range"
type="registrationdaterange"
label="COM_USERS_OPTION_FILTER_DATE"
description="COM_USERS_OPTION_FILTER_DATE"
onchange="this.form.submit();"
>
<option
value="">COM_USERS_OPTION_FILTER_DATE</option>
</field>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="COM_CONTENT_LIST_FULL_ORDERING"
description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
onchange="this.form.submit();"
default="a.title ASC"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.name
ASC">COM_USERS_HEADING_NAME_ASC</option>
<option value="a.name
DESC">COM_USERS_HEADING_NAME_DESC</option>
<option value="a.username
ASC">COM_USERS_HEADING_USERNAME_ASC</option>
<option value="a.username
DESC">COM_USERS_HEADING_USERNAME_DESC</option>
<option value="a.block
ASC">COM_USERS_HEADING_ENABLED_ASC</option>
<option value="a.block
DESC">COM_USERS_HEADING_ENABLED_DESC</option>
<option value="a.activation
ASC">COM_USERS_HEADING_ACTIVATED_ASC</option>
<option value="a.activation
DESC">COM_USERS_HEADING_ACTIVATED_DESC</option>
<option value="a.email
ASC">COM_USERS_HEADING_EMAIL_ASC</option>
<option value="a.email
DESC">COM_USERS_HEADING_EMAIL_DESC</option>
<option value="a.lastvisitDate
ASC">COM_USERS_HEADING_LAST_VISIT_DATE_ASC</option>
<option value="a.lastvisitDate
DESC">COM_USERS_HEADING_LAST_VISIT_DATE_DESC</option>
<option value="a.registerDate
ASC">COM_USERS_HEADING_REGISTRATION_DATE_ASC</option>
<option value="a.registerDate
DESC">COM_USERS_HEADING_REGISTRATION_DATE_DESC</option>
<option value="a.id
ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id
DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
class="input-mini"
default="25"
label="COM_CONTENT_LIST_LIMIT"
description="COM_CONTENT_LIST_LIMIT_DESC"
onchange="this.form.submit();"
/>
</fields>
</form>models/forms/index.html000064400000000057151165062360011161
0ustar00<html>
<body bgcolor="#FFFFFF">
</body>
</html>models/forms/loginasuser.xml000064400000011262151165062360012241
0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset name="user_details">
<field name="name" type="text"
description="COM_USERS_USER_FIELD_NAME_DESC"
label="COM_USERS_USER_FIELD_NAME_LABEL"
required="true"
size="30"
/>
<field name="username" type="text"
description="COM_USERS_USER_FIELD_USERNAME_DESC"
label="COM_USERS_USER_FIELD_USERNAME_LABEL"
required="true"
size="30"
/>
<field name="password" type="password"
autocomplete="off"
class="validate-password"
description="COM_USERS_USER_FIELD_PASSWORD_DESC"
filter="raw"
validate="password"
label="JGLOBAL_PASSWORD"
size="30"
/>
<field name="password2" type="password"
autocomplete="off"
class="validate-password"
description="COM_USERS_USER_FIELD_PASSWORD2_DESC"
filter="raw"
label="COM_USERS_USER_FIELD_PASSWORD2_LABEL"
size="30"
validate="equals"
field="password"
/>
<field name="email" type="email"
description="COM_USERS_USER_FIELD_EMAIL_DESC"
label="JGLOBAL_EMAIL"
required="true"
size="30"
validate="email"
/>
<field
name="registerDate"
type="calendar"
class="readonly"
label="COM_USERS_USER_FIELD_REGISTERDATE_LABEL"
description="COM_USERS_USER_FIELD_REGISTERDATE_DESC"
readonly="true"
format="%Y-%m-%d %H:%M:%S"
size="22"
filter="user_utc"
/>
<field
name="lastvisitDate"
type="calendar"
class="readonly"
label="COM_USERS_USER_FIELD_LASTVISIT_LABEL"
description="COM_USERS_USER_FIELD_LASTVISIT_DESC"
readonly="true"
format="%Y-%m-%d %H:%M:%S"
size="22"
filter="user_utc"
/>
<field
name="lastResetTime"
type="calendar"
class="readonly"
label="COM_USERS_USER_FIELD_LASTRESET_LABEL"
description="COM_USERS_USER_FIELD_LASTRESET_DESC"
readonly="true"
format="%Y-%m-%d %H:%M:%S"
size="22"
filter="user_utc"
/>
<field
name="resetCount"
type="text"
class="readonly"
label="COM_USERS_USER_FIELD_RESETCOUNT_LABEL"
description ="COM_USERS_USER_FIELD_RESETCOUNT_DESC"
default="0"
readonly="true"
/>
<field
name="sendEmail"
type="radio"
default="0"
class="btn-group btn-group-yesno"
label="COM_USERS_USER_FIELD_SENDEMAIL_LABEL"
description="COM_USERS_USER_FIELD_SENDEMAIL_DESC">
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="block"
type="radio"
class="btn-group btn-group-yesno"
default="0"
label="COM_USERS_USER_FIELD_BLOCK_LABEL"
description="COM_USERS_USER_FIELD_BLOCK_DESC">
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="requireReset"
type="radio"
default="0"
class="btn-group btn-group-yesno"
label="COM_USERS_USER_FIELD_REQUIRERESET_LABEL"
description="COM_USERS_USER_FIELD_REQUIRERESET_DESC">
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="id"
type="text"
class="readonly"
label="JGLOBAL_FIELD_ID_LABEL"
description ="JGLOBAL_FIELD_ID_DESC"
default="0"
readonly="true"
/>
</fieldset>
<field name="groups" type="hidden" />
<field name="twofactor" type="hidden" />
<fields name="params">
<!-- Basic user account settings. -->
<fieldset name="settings"
label="COM_USERS_SETTINGS_FIELDSET_LABEL">
<field name="admin_style" type="templatestyle"
client="administrator"
description="COM_USERS_USER_FIELD_BACKEND_TEMPLATE_DESC"
label="COM_USERS_USER_FIELD_BACKEND_TEMPLATE_LABEL"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
<field name="admin_language" type="language"
client="administrator"
description="COM_USERS_USER_FIELD_BACKEND_LANGUAGE_DESC"
label="COM_USERS_USER_FIELD_BACKEND_LANGUAGE_LABEL"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
<field name="language" type="language"
client="site"
description="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_DESC"
label="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_LABEL"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
<field name="editor" type="plugins"
folder="editors"
description="COM_USERS_USER_FIELD_EDITOR_DESC"
label="COM_USERS_USER_FIELD_EDITOR_LABEL"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
<field name="helpsite" type="helpsite"
label="COM_USERS_USER_FIELD_HELPSITE_LABEL"
description="COM_USERS_USER_FIELD_HELPSITE_DESC"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
<field name="timezone" type="timezone"
label="COM_USERS_USER_FIELD_TIMEZONE_LABEL"
description="COM_USERS_USER_FIELD_TIMEZONE_DESC"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
</fieldset>
</fields>
</form>
models/forms/overv.xml000064400000002322151165062360011044 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<form>
<fieldset name="description" label="About Login as
User"
addfieldpath="/plugins/system/web357framework/elements">
<!-- BEGIN: Description -->
<field type="header"
name="W357FRM_HEADER_DESCRIPTION"
label="W357FRM_HEADER_DESCRIPTION" />
<field name="description" id="description"
type="description" extension_type="plugin"
extension_name="loginasuser" real_name="Login as User"
plugin_type="system" label=""
addfieldpath="/plugins/system/web357framework/elements" />
<!-- END: Description -->
<!-- BEGIN: Version Check -->
<field type="header"
name="W357FRM_HEADER_VERSION_CHECK"
label="W357FRM_HEADER_VERSION_CHECK" />
<field name="info" id="info" type="info"
extension_type="plugin" extension_name="loginasuser"
real_name="Login as User" plugin_type="system"
label=""
addfieldpath="/plugins/system/web357framework/elements" />
<!-- END: Version Check -->
<!-- BEGIN: JED Review -->
<field name="jedreview" id="jedreview"
type="jedreview" extension_type="component"
extension_name="loginasuser" real_name="Login as User"
plugin_type="system" label=""
addfieldpath="/plugins/system/web357framework/elements" />
<!-- END: JED Review -->
</fieldset>
</form>models/index.html000064400000000057151165062400010026
0ustar00<html>
<body bgcolor="#FFFFFF">
</body>
</html>models/loginasuser.php000064400000030657151165062400011106
0ustar00<?php
/* ======================================================
# Login as User for Joomla! - v3.5.9 (pro version)
# -------------------------------------------------------
# For Joomla! CMS (v3.x)
# Author: Web357 (Yiannis Christodoulou)
# Copyright (©) 2014-2022 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https:/www.web357.com
# Demo: https://demo.web357.com/joomla/login-as-user
# Support: support@web357.com
# Last modified: Wednesday 07 December 2022, 11:05:26 AM
========================================================= */
/**
* @package Joomla.Administrator
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// Get Joomla! version
$jversion = new JVersion;
$short_version = explode('.', $jversion->getShortVersion());
// 3.8.10
$mini_version = $short_version[0].'.'.$short_version[1]; // 3.8
if (!version_compare( $mini_version, "2.5", "<=")) :
// joomla 3.x
else:
// joomla 2.5.x
jimport('joomla.application.component.modellist');
endif;
/**
* Methods supporting a list of user records.
*
* @since 1.6
*/
class LoginasuserModelLoginasuser 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',
'active',
'group_id',
'range',
'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 = null, $direction = null)
{
$app = JFactory::getApplication('administrator');
// Adjust the context to support modal layouts.
if ($layout = $app->input->get('layout', '',
'cmd'))
{
$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($app->input->get('groups',
'', 'BASE64')));
// Get Joomla! version
$jversion = new JVersion;
$short_version = explode('.', $jversion->getShortVersion());
// 3.8.10
$mini_version = $short_version[0].'.'.$short_version[1]; // 3.8
if (version_compare($mini_version, "4.0", ">="))
{
// j4
if (isset($groups))
{
ArrayHelper::toInteger($groups);
}
}
else
{
if (isset($groups))
{
JArrayHelper::toInteger($groups);
}
}
$this->setState('filter.groups', $groups);
$excluded =
json_decode(base64_decode($app->input->get('excluded',
'', 'BASE64')));
if (version_compare($mini_version, "4.0", ">="))
{
// j4
if (isset($excluded))
{
ArrayHelper::toInteger($excluded);
}
}
else
{
if (isset($excluded))
{
JArrayHelper::toInteger($excluded);
}
}
$this->setState('filter.groups', $groups);
$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.
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.
if ($this->getState('filter.search') !== ''
&& $this->getState('filter.search') !== null)
{
// Escape the search token.
$search = $db->quote('%' . str_replace(' ',
'%',
$db->escape(trim($this->getState('filter.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)
{
// 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->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;
}
if ($range == 'post_year')
{
$query->where(
$db->qn('a.registerDate') . ' < ' .
$db->quote($dStart->format('Y-m-d H:i:s'))
);
}
else
{
$query->where(
$db->qn('a.registerDate') . ' >= ' .
$db->quote($dStart->format('Y-m-d H:i:s')) .
' AND ' . $db->qn('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->qn($db->escape($this->getState('list.ordering',
'a.name'))) . ' ' .
$db->escape($this->getState('list.direction',
'ASC')));
return $query;
}
/**
* SQL server change
*
* @param integer $user_id User identifier
*
* @return string Groups titles imploded :$
*/
function _getUserDisplayedGroups($user_id)
{
$db = JFactory::getDbo();
$query = "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=" . (int) $user_id;
$db->setQuery($query);
$result = $db->loadColumn();
return implode("\n", $result);
}
}
models/overv.php000064400000002012151165062400007674 0ustar00<?php
/* ======================================================
# Login as User for Joomla! - v3.5.9 (pro version)
# -------------------------------------------------------
# For Joomla! CMS (v3.x)
# Author: Web357 (Yiannis Christodoulou)
# Copyright (©) 2014-2022 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https:/www.web357.com
# Demo: https://demo.web357.com/joomla/login-as-user
# Support: support@web357.com
# Last modified: Wednesday 07 December 2022, 11:05:26 AM
========================================================= */
defined('_JEXEC') or die;
jimport('joomla.application.component.modelform');
/**
* Component Settings Model
*
*/
class LoginasuserModelOverv extends JModelForm
{
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_loginasuser.overv',
'overv', array('control' => 'jform',
'load_data' => $loadData));
if (empty($form)) {
return false;
}
return $form;
}
}
script.install.helper.php000064400000036450151165062400011514
0ustar00<?php
/* ======================================================
# Login as User for Joomla! - v3.5.9 (pro version)
# -------------------------------------------------------
# For Joomla! CMS (v3.x)
# Author: Web357 (Yiannis Christodoulou)
# Copyright (©) 2014-2022 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https:/www.web357.com
# Demo: https://demo.web357.com/joomla/login-as-user
# Support: support@web357.com
# Last modified: Wednesday 07 December 2022, 11:05:26 AM
========================================================= */
defined('_JEXEC') or die;
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
class Com_LoginasuserInstallerScriptHelper
{
public $name = '';
public $alias = '';
public $extname = '';
public $extension_type = '';
public $plugin_folder = 'system';
public $module_position = 'web357';
public $client_id = 0;
public $install_type = 'install';
public $show_message = true;
public $db = null;
public $softbreak = null;
public $mini_version = null;
public function __construct(&$params)
{
$this->extname = $this->extname ?: $this->alias;
$this->db = JFactory::getDbo();
// Get Joomla's version
$jversion = new JVersion;
$short_version = explode('.', $jversion->getShortVersion());
// 3.8.10
$this->mini_version =
$short_version[0].'.'.$short_version[1]; // 3.8
}
public function preflight($route, $adapter)
{
if (!in_array($route, array('install', 'update')))
{
return true;
}
JFactory::getLanguage()->load('plg_system_web357installer',
JPATH_PLUGINS . '/system/web357installer');
if ($this->show_message && $this->isInstalled())
{
$this->install_type = 'update';
}
if ($this->onBeforeInstall($route) === false)
{
return false;
}
return true;
}
public function postflight($route, $adapter)
{
$this->removeGlobalLanguageFiles();
if (version_compare($this->mini_version, "4.0",
"<"))
{
$this->removeUnusedLanguageFiles();
}
JFactory::getLanguage()->load($this->getPrefix() . '_' .
$this->extname, $this->getMainFolder());
if (!in_array($route, array('install', 'update')))
{
return true;
}
$this->updateHttptoHttpsInUpdateSites();
if ($this->onAfterInstall($route) === false)
{
return false;
}
if ($route == 'install')
{
$this->publishExtension();
}
if ($this->show_message)
{
$this->addInstalledMessage();
}
JFactory::getCache()->clean('com_plugins');
JFactory::getCache()->clean('_system');
return true;
}
public function isInstalled()
{
if ( ! is_file($this->getInstalledXMLFile()))
{
return false;
}
$query = $this->db->getQuery(true)
->select($this->db->quoteName('extension_id'))
->from('#__extensions')
->where($this->db->quoteName('type') . ' =
' . $this->db->quote($this->extension_type))
->where($this->db->quoteName('element') . ' =
' . $this->db->quote($this->getElementName()));
$this->db->setQuery($query, 0, 1);
$result = $this->db->loadResult();
return empty($result) ? false : true;
}
public function getMainFolder()
{
switch ($this->extension_type)
{
case 'plugin' :
return JPATH_PLUGINS . '/' . $this->plugin_folder .
'/' . $this->extname;
case 'component' :
return JPATH_ADMINISTRATOR . '/components/com_' .
$this->extname;
case 'module' :
return JPATH_SITE . '/modules/mod_' . $this->extname;
case 'library' :
return JPATH_SITE . '/libraries/' . $this->extname;
}
}
public function getInstalledXMLFile()
{
return $this->getXMLFile($this->getMainFolder());
}
public function getCurrentXMLFile()
{
return $this->getXMLFile(__DIR__);
}
public function getXMLFile($folder)
{
switch ($this->extension_type)
{
case 'module' :
return $folder . '/mod_' . $this->extname .
'.xml';
default :
return $folder . '/' . $this->extname . '.xml';
}
}
public function uninstallExtension($extname, $type = 'plugin',
$folder = 'system', $show_message = true)
{
if (empty($extname))
{
return;
}
$folders = array();
switch ($type)
{
case 'plugin';
$folders[] = JPATH_PLUGINS . '/' . $folder . '/' .
$extname;
break;
case 'component':
$folders[] = JPATH_ADMINISTRATOR . '/components/com_' .
$extname;
$folders[] = JPATH_SITE . '/components/com_' . $extname;
break;
case 'module':
$folders[] = JPATH_ADMINISTRATOR . '/modules/mod_' .
$extname;
$folders[] = JPATH_SITE . '/modules/mod_' . $extname;
break;
}
if ( ! $this->foldersExist($folders))
{
return;
}
$query = $this->db->getQuery(true)
->select($this->db->quoteName('extension_id'))
->from('#__extensions')
->where($this->db->quoteName('element') . ' =
' . $this->db->quote($this->getElementName($type,
$extname)))
->where($this->db->quoteName('type') . ' =
' . $this->db->quote($type));
if ($type == 'plugin')
{
$query->where($this->db->quoteName('folder') . '
= ' . $this->db->quote($folder));
}
$this->db->setQuery($query);
$ids = $this->db->loadColumn();
if (empty($ids))
{
foreach ($folders as $folder)
{
JFolder::delete($folder);
}
return;
}
$ignore_ids =
JFactory::getApplication()->getUserState('rl_ignore_uninstall_ids',
array());
if (JFactory::getApplication()->input->get('option') ==
'com_installer' &&
JFactory::getApplication()->input->get('task') ==
'remove')
{
// Don't attempt to uninstall extensions that are already selected
to get uninstalled by them selves
$ignore_ids = array_merge($ignore_ids,
JFactory::getApplication()->input->get('cid', array(),
'array'));
JFactory::getApplication()->input->set('cid',
array_merge($ignore_ids, $ids));
}
$ids = array_diff($ids, $ignore_ids);
if (empty($ids))
{
return;
}
$ignore_ids = array_merge($ignore_ids, $ids);
JFactory::getApplication()->setUserState('rl_ignore_uninstall_ids',
$ignore_ids);
foreach ($ids as $id)
{
$tmpInstaller = new JInstaller;
$tmpInstaller->uninstall($type, $id);
}
if ($show_message)
{
JFactory::getApplication()->enqueueMessage(
JText::sprintf(
'COM_INSTALLER_UNINSTALL_SUCCESS',
JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($type))
)
);
}
}
public function foldersExist($folders = array())
{
foreach ($folders as $folder)
{
if (is_dir($folder))
{
return true;
}
}
return false;
}
public function uninstallPlugin($extname, $folder = 'system',
$show_message = true)
{
$this->uninstallExtension($extname, 'plugin', $folder,
$show_message);
}
public function uninstallComponent($extname, $show_message = true)
{
$this->uninstallExtension($extname, 'component', null,
$show_message);
}
public function uninstallModule($extname, $show_message = true)
{
$this->uninstallExtension($extname, 'module', null,
$show_message);
}
public function publishExtension()
{
switch ($this->extension_type)
{
case 'plugin' :
$this->publishPlugin();
case 'module' :
$this->publishModule();
}
}
public function publishPlugin()
{
$query = $this->db->getQuery(true)
->update('#__extensions')
->set($this->db->quoteName('enabled') . ' =
1')
->where($this->db->quoteName('type') . ' =
' . $this->db->quote('plugin'))
->where($this->db->quoteName('element') . ' =
' . $this->db->quote($this->extname))
->where($this->db->quoteName('folder') . ' =
' . $this->db->quote($this->plugin_folder));
$this->db->setQuery($query);
$this->db->execute();
}
public function publishModule()
{
// Get module id
$query = $this->db->getQuery(true)
->select($this->db->quoteName('id'))
->from('#__modules')
->where($this->db->quoteName('module') . ' =
' . $this->db->quote('mod_' . $this->extname))
->where($this->db->quoteName('client_id') . ' =
' . (int) $this->client_id);
$this->db->setQuery($query, 0, 1);
$id = $this->db->loadResult();
if ( ! $id)
{
return;
}
// check if module is already in the modules_menu table (meaning is is
already saved)
$query->clear()
->select($this->db->quoteName('moduleid'))
->from('#__modules_menu')
->where($this->db->quoteName('moduleid') . ' =
' . (int) $id);
$this->db->setQuery($query, 0, 1);
$exists = $this->db->loadResult();
if ($exists)
{
return;
}
// Get highest ordering number in position
$query->clear()
->select($this->db->quoteName('ordering'))
->from('#__modules')
->where($this->db->quoteName('position') . ' =
' . $this->db->quote($this->module_position))
->where($this->db->quoteName('client_id') . ' =
' . (int) $this->client_id)
->order('ordering DESC');
$this->db->setQuery($query, 0, 1);
$ordering = $this->db->loadResult();
$ordering++;
// publish module and set ordering number
$query->clear()
->update('#__modules')
->set($this->db->quoteName('published') . ' =
1')
->set($this->db->quoteName('ordering') . ' =
' . (int) $ordering)
->set($this->db->quoteName('position') . ' =
' . $this->db->quote($this->module_position))
->where($this->db->quoteName('id') . ' = '
. (int) $id);
$this->db->setQuery($query);
$this->db->execute();
// add module to the modules_menu table
$query->clear()
->insert('#__modules_menu')
->columns(array($this->db->quoteName('moduleid'),
$this->db->quoteName('menuid')))
->values((int) $id . ', 0');
$this->db->setQuery($query);
$this->db->execute();
}
public function addInstalledMessage()
{
JFactory::getApplication()->enqueueMessage(
JText::sprintf(
JText::_($this->install_type == 'update' ?
'W357_THE_EXTENSION_HAS_BEEN_UPDATED_SUCCESSFULLY' :
'W357_THE_EXTENSION_HAS_BEEN_INSTALLED_SUCCESSFULLY'),
'<strong>' . JText::_($this->name) .
'</strong>',
'<strong>' . $this->getVersion() .
'</strong>',
$this->getFullType()
)
);
}
public function getPrefix()
{
switch ($this->extension_type)
{
case 'plugin';
return JText::_('plg_' .
strtolower($this->plugin_folder));
case 'component':
return JText::_('com');
case 'module':
return JText::_('mod');
case 'library':
return JText::_('lib');
default:
return $this->extension_type;
}
}
public function getElementName($type = null, $extname = null)
{
$type = is_null($type) ? $this->extension_type : $type;
$extname = is_null($extname) ? $this->extname : $extname;
switch ($type)
{
case 'component' :
return 'com_' . $extname;
case 'module' :
return 'mod_' . $extname;
case 'plugin' :
default:
return $extname;
}
}
public function getFullType()
{
return JText::_('W357_' . strtoupper($this->getPrefix()));
}
public function getVersion($file = '')
{
$file = $file ?: $this->getCurrentXMLFile();
if ( ! is_file($file))
{
return '';
}
$xml = JInstaller::parseXMLInstallFile($file);
if ( ! $xml || ! isset($xml['version']))
{
return '';
}
return $xml['version'];
}
public function isNewer()
{
if ( ! $installed_version =
$this->getVersion($this->getInstalledXMLFile()))
{
return true;
}
$package_version = $this->getVersion();
return version_compare($installed_version, $package_version,
'<=');
}
public function canInstall()
{
// The extension is not installed yet
if ( ! $installed_version =
$this->getVersion($this->getInstalledXMLFile()))
{
return true;
}
// The free version is installed. So any version is ok to install
if (strpos($installed_version, 'PRO') === false)
{
return true;
}
// Current package is a pro version, so all good
if (strpos($this->getVersion(), 'PRO') !== false)
{
return true;
}
JFactory::getLanguage()->load($this->getPrefix() . '_' .
$this->extname, __DIR__);
JFactory::getApplication()->enqueueMessage(JText::_('W357_ERROR_PRO_TO_FREE'),
'error');
JFactory::getApplication()->enqueueMessage(
html_entity_decode(
JText::sprintf(
'W357_ERROR_UNINSTALL_FIRST',
'<a href="//www.web357.com/product/' .
$this->url_alias . '" target="_blank">',
'</a>',
JText::_($this->name)
)
), 'error'
);
return false;
}
public function onBeforeInstall($route)
{
if ( ! $this->canInstall())
{
return false;
}
return true;
}
public function onAfterInstall($route)
{
}
public function delete($files = array())
{
foreach ($files as $file)
{
if (is_dir($file) && JFolder::exists($file))
{
JFolder::delete($file);
}
if (is_file($file) && JFile::exists($file))
{
JFile::delete($file);
}
}
}
public function fixAssetsRules($rules =
'{"core.admin":[],"core.manage":[]}')
{
// replace default rules value {} with the correct initial value
$query = $this->db->getQuery(true)
->update($this->db->quoteName('#__assets'))
->set($this->db->quoteName('rules') . ' = '
. $this->db->quote($rules))
->where($this->db->quoteName('title') . ' =
' . $this->db->quote('com_' . $this->extname))
->where($this->db->quoteName('rules') . ' =
' . $this->db->quote('{}'));
$this->db->setQuery($query);
$this->db->execute();
}
private function updateHttptoHttpsInUpdateSites()
{
$query = $this->db->getQuery(true)
->update('#__update_sites')
->set($this->db->quoteName('location') . ' =
REPLACE('
. $this->db->quoteName('location') . ', '
. $this->db->quote('http://') . ', '
. $this->db->quote('https://')
. ')')
->where($this->db->quoteName('location') . '
LIKE ' . $this->db->quote('http://updates.web357%'));
$this->db->setQuery($query);
$this->db->execute();
}
private function removeGlobalLanguageFiles()
{
if ($this->extension_type == 'library' || $this->alias
=== 'web357framework')
{
return;
}
$language_files = JFolder::files(JPATH_ADMINISTRATOR .
'/language', '\.' . $this->getPrefix() .
'_' . $this->extname . '\.', true, true);
// Remove override files
foreach ($language_files as $i => $language_file)
{
if (strpos($language_file, '/overrides/') === false)
{
continue;
}
unset($language_files[$i]);
}
if (empty($language_files))
{
return;
}
JFile::delete($language_files);
}
private function removeUnusedLanguageFiles()
{
if ($this->extension_type == 'library')
{
return;
}
$main_language_dir_path = JFolder::folders(__DIR__ .
'/language');
$installed_languages = array_merge(
JFolder::folders(JPATH_SITE . '/language'),
JFolder::folders(JPATH_ADMINISTRATOR . '/language')
);
$languages = array();
if (is_array($main_language_dir_path) &&
is_array($installed_languages))
{
$languages = array_diff(
$main_language_dir_path,
$installed_languages
);
}
$delete_languages = array();
if (!empty($languages))
{
foreach ($languages as $language)
{
$delete_languages[] = $this->getMainFolder() .
'/language/' . $language;
}
}
if (empty($delete_languages))
{
return;
}
// Remove folders
$this->delete($delete_languages);
}
}script.install.php000064400000001577151165062400010240 0ustar00<?php
/* ======================================================
# Login as User for Joomla! - v3.5.9 (pro version)
# -------------------------------------------------------
# For Joomla! CMS (v3.x)
# Author: Web357 (Yiannis Christodoulou)
# Copyright (©) 2014-2022 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https:/www.web357.com
# Demo: https://demo.web357.com/joomla/login-as-user
# Support: support@web357.com
# Last modified: Wednesday 07 December 2022, 11:05:26 AM
========================================================= */
defined('_JEXEC') or die;
require_once __DIR__ . '/script.install.helper.php';
class Com_LoginasuserInstallerScript extends
Com_LoginasuserInstallerScriptHelper
{
public $name = 'Login as User';
public $alias = 'loginasuser';
public $extension_type = 'component';
}views/about/tmpl/default.php000064400000002764151165062400012135
0ustar00<?php
/* ======================================================
# Login as User for Joomla! - v3.5.9 (pro version)
# -------------------------------------------------------
# For Joomla! CMS (v3.x)
# Author: Web357 (Yiannis Christodoulou)
# Copyright (©) 2014-2022 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https:/www.web357.com
# Demo: https://demo.web357.com/joomla/login-as-user
# Support: support@web357.com
# Last modified: Wednesday 07 December 2022, 11:05:26 AM
========================================================= */
defined('_JEXEC') or die;
// Get Joomla! version
$jversion = new JVersion;
$short_version = explode('.', $jversion->getShortVersion());
// 3.8.10
$mini_version = $short_version[0].'.'.$short_version[1]; // 3.8
if (version_compare($mini_version, "4.0", ">="))
{
// joomla 4.x
$row_fluid = '';
}
else
{
// joomla 3.x
$row_fluid = '-fluid';
}
?>
<div class="container-fluid">
<div class="row<?php echo $row_fluid; ?>">
<div id="j-sidebar-container" class="span2 col
col-md-2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="col col-md-10
span10 j-main-container p-4">
<div class="row<?php echo $row_fluid;
?>">
<div class="col-12 span12">
<?php
echo $this->form->getLabel('about');
?>
</div>
</div>
</div>
</div>
</div>views/about/tmpl/index.html000064400000000054151165062400011763
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/about/view.html.php000064400000003524151165062400011445
0ustar00<?php
/* ======================================================
# Login as User for Joomla! - v3.5.9 (pro version)
# -------------------------------------------------------
# For Joomla! CMS (v3.x)
# Author: Web357 (Yiannis Christodoulou)
# Copyright (©) 2014-2022 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https:/www.web357.com
# Demo: https://demo.web357.com/joomla/login-as-user
# Support: support@web357.com
# Last modified: Wednesday 07 December 2022, 11:05:26 AM
========================================================= */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
class LoginasuserViewAbout extends JViewLegacy
{
function display($tpl = null)
{
$form = $this->get('Form');
// Check for model errors.
if ($errors = $this->get('Errors')) {
throw new Exception(implode('<br />', $errors), 500);
}
// Get Joomla! version
$jversion = new JVersion;
$short_version = explode('.', $jversion->getShortVersion());
// 3.8.10
$mini_version = $short_version[0].'.'.$short_version[1]; // 3.8
if (version_compare($mini_version, "2.5", "<=")):
// j25x
// Show sidebar
$this->sidebar = "";
else:
// j3X
// Include helper submenu
LoginasuserHelper::addSubmenu('about');
// Show sidebar
$this->sidebar = JHtmlSidebar::render();
endif;
// mapping variables
$this->form = $form;
// Set the toolbar
$this->addToolBar();
// Display the template
parent::display($tpl);
}
protected function addToolBar()
{
// Build title
$title = JText::_('About Web357');
// Set document title
JFactory::getDocument()->setTitle($title);
// Set ToolBar title
JToolbarHelper::title($title, 'loginasuser icon-user');
}
}views/index.html000064400000000054151165062400007675
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/loginasuser/tmpl/default.php000064400000054536151165062400013362
0ustar00<?php
/* ======================================================
# Login as User for Joomla! - v3.5.9 (pro version)
# -------------------------------------------------------
# For Joomla! CMS (v3.x)
# Author: Web357 (Yiannis Christodoulou)
# Copyright (©) 2014-2022 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https:/www.web357.com
# Demo: https://demo.web357.com/joomla/login-as-user
# Support: support@web357.com
# Last modified: Wednesday 07 December 2022, 11:05:26 AM
========================================================= */
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
// Get Joomla! version
$jversion = new JVersion;
$short_version = explode('.', $jversion->getShortVersion());
// 3.8.10
$mini_version = $short_version[0].'.'.$short_version[1]; // 3.8
if (version_compare($mini_version, "4.0", ">="))
{
// joomla 4.x
$row_fluid = '';
}
else
{
// joomla 3.x
$row_fluid = '-fluid';
}
// BEGIN: Web357 (Login as User - system joomla! plugin)
$db = JFactory::getDbo();
$db->setQuery("SELECT enabled FROM #__extensions WHERE type =
'plugin' AND element = 'loginasuser'");
$loginasclient_is_enabled = $db->loadResult();
if ($loginasclient_is_enabled)
{
// get custom css
$plugin = JPluginHelper::getPlugin('system',
'loginasuser');
$params = new JRegistry($plugin->params);
$custom_css = $params->get('custom_css');
$displayed_text = $params->get('displayed_text', 'Login
as %s »');
$login_as_type = $params->get('login_as_type',
'username');
$login_as_type_characters_limit =
$params->get('login_as_type_characters_limit', 0);
echo (!empty($custom_css)) ? '<style
type="text/css">'.$custom_css.'</style>'
: '';
// Check if the logged in Admin user can use the LoginAsUser functionality
function canLoginAsUser($user_id)
{
// me
$user = JFactory::getUser();
$me = $user->id;
// get params
$plugin = JPluginHelper::getPlugin('system',
'loginasuser');
$params = new JRegistry($plugin->params);
$custom_css = $params->get('custom_css');
// get user groups
$usergroups = JAccess::getGroupsByUser($user_id); //
implode(',', $usergroups)
if ($usergroups[0] == 1)
{
unset($usergroups[0]);
$usergroups = array_values($usergroups);
}
// define arrays
$get_access = array();
$get_access_for_all = array();
$allowed_admins_prm_arr = array();
$is_enabled_arr = array();
foreach ($usergroups as $usergroup_id)
{
$is_enabled = $params->get('enable_'.$usergroup_id,
'1');
$allowed_admins_prm = $params->get('users_'.$usergroup_id);
if ($is_enabled)
{
// The usergroup is enabled from the plugin parameters
$is_enabled_arr[] = 1;
if (!empty($allowed_admins_prm))
{
if (in_array($me, $allowed_admins_prm))
{
// Has access because the logged in admin user is in the allowed list
$get_access[] = 1;
}
else
{
// No access because the logged in admin user is not in the allowed
list
$get_access[] = 0;
}
}
else
{
// Has access because this usergroup is open for all (blank input
field)
$get_access_for_all[] = 1;
}
if (isset($allowed_admins_prm[0]))
{
$allowed_admins_prm_arr[] = $allowed_admins_prm[0];
}
}
else
{
// The usergroup is disabled from the plugin parameters
$is_enabled_arr[] = 0;
}
}
if (array_sum($is_enabled_arr) > 0 && array_sum($get_access)
> 0) // usergroup is active and access for specific users
{
// Can login as user
return true;
}
elseif (array_sum($is_enabled_arr) > 0 &&
array_sum($allowed_admins_prm_arr) == 0) // usergroup is active and access
for all
{
// Can login as user
return true;
}
else
{
// Cannot login as user
return false;
}
}
}
// END: Web357 (Login as User - system joomla! plugin)
// BEGIN: JOOMLA! 2.5.x
if (version_compare($mini_version, "2.5", "<=")):
// Load the tooltip behavior.
JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('behavior.modal');
$canDo = LoginasuserHelper::getActions();
$user = JFactory::getUser();
$listOrder =
$this->escape($this->state->get('list.ordering'));
$listDirn =
$this->escape($this->state->get('list.direction'));
$loggeduser = JFactory::getUser();
?>
<form action="<?php echo
JRoute::_('index.php?option=com_loginasuser&view=loginasuser');?>"
method="post" name="adminForm"
id="adminForm">
<fieldset id="filter-bar">
<div class="filter-search fltlft">
<label class="filter-search-lbl"
for="filter_search"><?php echo
JText::_('COM_USERS_SEARCH_USERS'); ?></label>
<input type="text" name="filter_search"
id="filter_search" value="<?php echo
$this->escape($this->state->get('filter.search'));
?>" title="<?php echo
JText::_('COM_USERS_SEARCH_USERS'); ?>" />
<button type="submit"><?php echo
JText::_('JSEARCH_FILTER_SUBMIT'); ?></button>
<button type="button"
onclick="document.id('filter_search').value='';this.form.submit();"><?php
echo JText::_('JSEARCH_RESET'); ?></button>
</div>
<div class="filter-select fltrt">
<label for="filter_state">
<?php echo JText::_('COM_USERS_FILTER_LABEL'); ?>
</label>
<select name="filter_state" class="inputbox"
onchange="this.form.submit()">
<option value="*"><?php echo
JText::_('COM_USERS_FILTER_STATE');?></option>
<?php echo JHtml::_('select.options',
LoginasuserHelper::getStateOptions(), 'value', 'text',
$this->state->get('filter.state'));?>
</select>
<select name="filter_active" class="inputbox"
onchange="this.form.submit()">
<option value="*"><?php echo
JText::_('COM_USERS_FILTER_ACTIVE');?></option>
<?php echo JHtml::_('select.options',
LoginasuserHelper::getActiveOptions(), 'value', 'text',
$this->state->get('filter.active'));?>
</select>
<select name="filter_group_id" class="inputbox"
onchange="this.form.submit()">
<option value=""><?php echo
JText::_('COM_USERS_FILTER_USERGROUP');?></option>
<?php echo JHtml::_('select.options',
LoginasuserHelper::getGroups(), 'value', 'text',
$this->state->get('filter.group_id'));?>
</select>
<select name="filter_range" id="filter_range"
class="inputbox" onchange="this.form.submit()">
<option value=""><?php echo
JText::_('COM_USERS_OPTION_FILTER_DATE');?></option>
<?php echo JHtml::_('select.options',
LoginasuserHelper::getRangeOptions(), 'value', 'text',
$this->state->get('filter.range'));?>
</select>
</div>
</fieldset>
<div class="clr"> </div>
<table class="adminlist">
<thead>
<tr>
<th width="1%">
<input type="checkbox" name="checkall-toggle"
value="" title="<?php echo
JText::_('JGLOBAL_CHECK_ALL'); ?>"
onclick="Joomla.checkAll(this)" />
</th>
<th class="left">
<?php echo JHtml::_('grid.sort',
'COM_USERS_HEADING_NAME', 'a.name', $listDirn,
$listOrder); ?>
</th>
<th class="nowrap" width="10%">
<?php echo JHtml::_('grid.sort',
'JGLOBAL_USERNAME', 'a.username', $listDirn,
$listOrder); ?>
</th>
<?php
// BEGIN: Web357 (Login as User - system joomla! plugin)
if ($loginasclient_is_enabled):
?>
<th width="15%" class="nowrap left
login_as_user">
<?php echo JHtml::_('grid.sort',
JText::_('COM_LOGINASUSER'), 'a.name', $listDirn,
$listOrder); ?>
</th>
<?php
endif;
// END: Web357 (Login as User - system joomla! plugin)
?>
<th class="nowrap" width="5%">
<?php echo JHtml::_('grid.sort',
'COM_USERS_HEADING_ENABLED', 'a.block', $listDirn,
$listOrder); ?>
</th>
<th class="nowrap" width="5%">
<?php echo JHtml::_('grid.sort',
'COM_USERS_HEADING_ACTIVATED', 'a.activation',
$listDirn, $listOrder); ?>
</th>
<th class="nowrap" width="10%">
<?php echo JText::_('COM_USERS_HEADING_GROUPS'); ?>
</th>
<th class="nowrap" width="15%">
<?php echo JHtml::_('grid.sort',
'JGLOBAL_EMAIL', 'a.email', $listDirn, $listOrder);
?>
</th>
<th class="nowrap" width="10%">
<?php echo JHtml::_('grid.sort',
'COM_USERS_HEADING_LAST_VISIT_DATE', 'a.lastvisitDate',
$listDirn, $listOrder); ?>
</th>
<th class="nowrap" width="10%">
<?php echo JHtml::_('grid.sort',
'COM_USERS_HEADING_REGISTRATION_DATE',
'a.registerDate', $listDirn, $listOrder); ?>
</th>
<th class="nowrap" width="3%">
<?php echo JHtml::_('grid.sort',
'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder);
?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="15">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) :
$canEdit = $canDo->get('core.edit');
$canChange =
$loggeduser->authorise('core.edit.state', 'com_users');
// If this group is super admin and this user is not super admin,
$canEdit is false
if ((!$loggeduser->authorise('core.admin')) &&
JAccess::check($item->id, 'core.admin')) {
$canEdit = false;
$canChange = false;
}
?>
<tr class="row<?php echo $i % 2; ?>">
<td class="center">
<?php if ($canEdit) : ?>
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
<?php endif; ?>
</td>
<td>
<?php if ($canEdit) : ?>
<a href="<?php echo
JRoute::_('index.php?option=com_users&task=user.edit&id='.(int)
$item->id); ?>" title="<?php echo
JText::sprintf('COM_USERS_EDIT_USER',
$this->escape($item->name)); ?>">
<?php echo $this->escape($item->name); ?></a>
<?php else : ?>
<?php echo $this->escape($item->name); ?>
<?php endif; ?>
<?php if (JDEBUG) : ?>
<div class="fltrt"><div class="button2-left
smallsub"><div class="blank"><a
href="<?php echo
JRoute::_('index.php?option=com_users&view=debuguser&user_id='.(int)
$item->id);?>">
<?php echo
JText::_('COM_USERS_DEBUG_USER');?></a></div></div></div>
<?php endif; ?>
</td>
<td class="center">
<?php echo $this->escape($item->username); ?>
</td>
<?php
// BEGIN: Web357 (Login as User - system joomla! plugin)
if ($loginasclient_is_enabled):
// Get current user session
$session = Factory::getSession();
$current_session_id = $session->getId();
// Get the return URL
$jtoken = $current_session_id;
$login_as_user_url = new Uri(Uri::root() . 'index.php');
$params = [
'loginasclient' => 1,
'lacusr' => $item->username ?
$this->escape(rawurlencode($item->username)) : '',
'lacpas' => $this->escape($item->password),
'token' => $jtoken,
];
array_walk($params, function ($value, $key) use
(&$login_as_user_url) {
$login_as_user_url->setVar($key, $value);
});
if ($canChange):
?>
<td class="left login_as_user">
<a href="<?php echo $login_as_user_url; ?>"
target="_blank" class="login_as_user_link"><span
class="icon-user"></span>
<?php
if ($login_as_type === 'name')
{
$login_as_txt = $this->escape($item->name);
}
else
{
$login_as_txt = $this->escape($item->username);
}
if (is_numeric($login_as_type_characters_limit) &&
$login_as_type_characters_limit > 0)
{
if(strlen($login_as_txt) > $login_as_type_characters_limit)
{
$login_as_txt = trim(substr($login_as_txt, 0,
$login_as_type_characters_limit)) . '…';
}
}
echo sprintf($displayed_text,
"<strong>".$login_as_txt."</strong>");
?>
</a>
</th>
<?php
else:
?>
<td class="left login_as_user"><small>You are
not authorised to login as Super User.</small></th>
<?php
endif;
endif;
// END: Web357 (Login as User - system joomla! plugin)
?>
<td class="center">
<?php if ($canChange) : ?>
<?php if ($loggeduser->id != $item->id) : ?>
<?php echo JHtml::_('grid.boolean', $i,
!$item->block, 'users.unblock', 'users.block');
?>
<?php else : ?>
<?php echo JHtml::_('grid.boolean', $i,
!$item->block, 'users.block', null); ?>
<?php endif; ?>
<?php else : ?>
<?php echo JText::_($item->block ? 'JNO' :
'JYES'); ?>
<?php endif; ?>
</td>
<td class="center">
<?php echo JHtml::_('grid.boolean', $i,
!$item->activation, 'users.activate', null); ?>
</td>
<td class="center">
<?php if (substr_count($item->group_names, "\n") >
1) : ?>
<span class="hasTip" title="<?php echo
JText::_('COM_USERS_HEADING_GROUPS').'::'.nl2br($item->group_names);
?>"><?php echo
JText::_('COM_USERS_USERS_MULTIPLE_GROUPS'); ?></span>
<?php else : ?>
<?php echo nl2br($item->group_names); ?>
<?php endif; ?>
</td>
<td class="center">
<?php echo $this->escape($item->email); ?>
</td>
<td class="center">
<?php if ($item->lastvisitDate!='0000-00-00
00:00:00'):?>
<?php echo JHtml::_('date', $item->lastvisitDate,
'Y-m-d H:i:s'); ?>
<?php else:?>
<?php echo JText::_('JNEVER'); ?>
<?php endif;?>
</td>
<td class="center">
<?php echo JHtml::_('date', $item->registerDate,
'Y-m-d H:i:s'); ?>
</td>
<td class="center">
<?php echo (int) $item->id; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div>
<input type="hidden" name="task"
value="" />
<input type="hidden" name="boxchecked"
value="0" />
<input type="hidden" name="filter_order"
value="<?php echo $listOrder; ?>" />
<input type="hidden" name="filter_order_Dir"
value="<?php echo $listDirn; ?>" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
<?php
// END: JOOMLA! 2.5.x
else:
// BEGIN: JOOMLA! 3.x, 4.x
JHtml::_('behavior.multiselect');
if (version_compare(JVERSION, '3.3', 'ge') &&
version_compare(JVERSION, '4.0', 'lt')) {
JHtml::_('behavior.tabstate');
}
$listOrder =
$this->escape($this->state->get('list.ordering'));
$listDirn =
$this->escape($this->state->get('list.direction'));
$loggeduser = JFactory::getUser();
$debugUsers =
$this->state->get('params')->get('debugUsers',
1);
?>
<div class="<?php echo (version_compare(JVERSION,
'4.0', 'lt') ? 'container-fluid' :
''); ?>">
<div class="row<?php echo $row_fluid; ?>">
<?php if(!empty($this->sidebar) &&
version_compare(JVERSION, '4.0', 'lt')): ?>
<div id="j-sidebar-container" class="span2 col
col-md-1">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="col col-md-11
span10 j-main-container p-4">
<?php else: ?>
<div id="j-main-container" class="col col-md-12
span10 j-main-container p-4">
<?php endif; ?>
<div class="row<?php echo $row_fluid; ?>">
<div class="col-12 span12">
<form action="<?php echo
JRoute::_('index.php?option=com_loginasuser&view=loginasuser');
?>" method="post" name="adminForm"
id="adminForm">
<?php
// Search tools bar
echo JLayoutHelper::render('joomla.searchtools.default',
array('view' => $this));
?>
<?php if (empty($this->items)) : ?>
<joomla-alert type="warning"><?php echo
JText::_('JGLOBAL_NO_MATCHING_RESULTS');
?></joomla-alert>
<?php else : ?>
<table class="table table-striped"
id="userList">
<thead>
<tr>
<th class="nowrap">
<?php echo JHtml::_('searchtools.sort',
'COM_USERS_HEADING_NAME', 'a.name', $listDirn,
$listOrder); ?>
</th>
<th style="width:10%" class="nowrap
text-center">
<?php echo JHtml::_('searchtools.sort',
'JGLOBAL_USERNAME', 'a.username', $listDirn,
$listOrder); ?>
</th>
<?php
// BEGIN: Web357 (Login as User - system joomla! plugin)
if ($loginasclient_is_enabled):
?>
<th width="15%" class="nowrap text-center
left login_as_user">
<div class="arrow-down-bg-icon"></div>
<?php echo JHtml::_('grid.sort',
JText::_('COM_LOGINASUSER'), 'a.name', $listDirn,
$listOrder); ?>
</th>
<?php
endif;
// END: Web357 (Login as User - system joomla! plugin)
?>
<th style="width:5%" class="nowrap
text-center">
<?php echo JHtml::_('searchtools.sort',
'COM_USERS_HEADING_ENABLED', 'a.block', $listDirn,
$listOrder); ?>
</th>
<th style="width:5%" class="nowrap text-center
d-none d-md-table-cell">
<?php echo JHtml::_('searchtools.sort',
'COM_USERS_HEADING_ACTIVATED', 'a.activation',
$listDirn, $listOrder); ?>
</th>
<th style="width:12%" class="nowrap
text-center">
<?php echo JText::_('COM_USERS_HEADING_GROUPS');
?>
</th>
<th style="width:12%" class="nowrap d-none
d-lg-table-cell text-center">
<?php echo JHtml::_('searchtools.sort',
'JGLOBAL_EMAIL', 'a.email', $listDirn, $listOrder);
?>
</th>
<th style="width:12%" class="nowrap d-none
d-lg-table-cell text-center">
<?php echo JHtml::_('searchtools.sort',
'COM_USERS_HEADING_LAST_VISIT_DATE', 'a.lastvisitDate',
$listDirn, $listOrder); ?>
</th>
<th style="width:12%" class="nowrap d-none
d-lg-table-cell text-center">
<?php echo JHtml::_('searchtools.sort',
'COM_USERS_HEADING_REGISTRATION_DATE',
'a.registerDate', $listDirn, $listOrder); ?>
</th>
<th style="width:5%" class="nowrap d-none
d-md-table-cell text-center">
<?php echo JHtml::_('searchtools.sort',
'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder);
?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="10">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) : ?>
<tr class="row<?php echo $i % 2; ?>">
<td>
<div class="name break-word">
<?php echo $this->escape($item->name); ?>
</div>
</td>
<td class="break-word text-center">
<?php echo $this->escape($item->username); ?>
</td>
<?php
// BEGIN: Web357 (Login as User - system joomla! plugin)
if ($loginasclient_is_enabled):
// Get current user session
$session = Factory::getSession();
$current_session_id = $session->getId();
// Get the return URL
$jtoken = $current_session_id;
$login_as_user_url = new Uri(Uri::root() .
'index.php');
$params = [
'loginasclient' => 1,
'lacusr' => $item->username ?
$this->escape(rawurlencode($item->username)) : '',
'lacpas' => $this->escape($item->password),
'token' => $jtoken,
];
array_walk($params, function ($value, $key) use
(&$login_as_user_url) {
$login_as_user_url->setVar($key, $value);
});
if (canLoginAsUser($item->id)):
?>
<td class="left login_as_user">
<a href="<?php echo $login_as_user_url;
?>" target="_blank"
class="login_as_user_link"><span
class="icon-user"></span>
<?php
if ($login_as_type === 'name')
{
$login_as_txt = $this->escape($item->name);
}
else
{
$login_as_txt = $this->escape($item->username);
}
if (is_numeric($login_as_type_characters_limit) &&
$login_as_type_characters_limit > 0)
{
if(strlen($login_as_txt) >
$login_as_type_characters_limit)
{
$login_as_txt = trim(substr($login_as_txt, 0,
$login_as_type_characters_limit)) . '…';
}
}
echo sprintf($displayed_text,
"<strong>".$login_as_txt."</strong>");
?>
</a>
</th>
<?php
else:
?>
<td class="left
login_as_user"><small>You are not authorised to use the Login
as User functionality for this User Group.</small></th>
<?php
endif;
endif;
// END: Web357 (Login as User - system joomla! plugin)
?>
<td class="text-center">
<?php echo JText::_($item->block ? 'JNO' :
'JYES'); ?>
</td>
<td class="text-center d-none d-md-table-cell">
<?php
$activated = empty( $item->activation) ? 0 : 1;
echo JHtml::_('jgrid.state',
JHtml::_('users.activateStates'), $activated, $i,
'users.', (boolean) $activated);
?>
</td>
<td class="text-center">
<?php if (substr_count($item->group_names,
"\n") > 1) : ?>
<span class="hasTooltip" title="<?php
echo JHtml::_('tooltipText',
JText::_('COM_USERS_HEADING_GROUPS'),
nl2br($item->group_names), 0); ?>"><?php echo
JText::_('COM_USERS_USERS_MULTIPLE_GROUPS'); ?></span>
<?php else : ?>
<?php echo nl2br($item->group_names); ?>
<?php endif; ?>
</td>
<td class="d-none d-lg-table-cell break-word
text-center">
<?php echo
JStringPunycode::emailToUTF8($this->escape($item->email)); ?>
</td>
<td class="d-none d-lg-table-cell text-center">
<?php if ($item->lastvisitDate !=
JFactory::getDBO()->getNullDate() &&
!empty($item->lastvisitDate)) : ?>
<?php echo JHtml::_('date',
$item->lastvisitDate, 'Y-m-d H:i:s'); ?>
<?php else : ?>
<?php echo JText::_('JNEVER'); ?>
<?php endif; ?>
</td>
<td class="d-none d-lg-table-cell text-center">
<?php echo JHtml::_('date',
$item->registerDate, 'Y-m-d H:i:s'); ?>
</td>
<td class="d-none d-md-table-cell text-center">
<?php echo (int) $item->id; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php // Load the batch processing form if user is allowed
?>
<?php endif; ?>
<input type="hidden" name="task"
value="">
<input type="hidden" name="boxchecked"
value="0">
<?php echo JHtml::_('form.token'); ?>
</form>
</div>
</div>
</div>
</div>
</div>
<?php echo
Web357Framework\Functions::showFooter("com_loginasuser",
JText::_('COM_LOGINASUSER')); ?>
<?php
// END: JOOMLA! 3.x, 4.x
endif;
?>views/loginasuser/view.html.php000064400000007531151165062400012670
0ustar00<?php
/* ======================================================
# Login as User for Joomla! - v3.5.9 (pro version)
# -------------------------------------------------------
# For Joomla! CMS (v3.x)
# Author: Web357 (Yiannis Christodoulou)
# Copyright (©) 2014-2022 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https:/www.web357.com
# Demo: https://demo.web357.com/joomla/login-as-user
# Support: support@web357.com
# Last modified: Wednesday 07 December 2022, 11:05:26 AM
========================================================= */
/**
* @package Joomla.Administrator
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* View class for a list of users.
*
* @since 1.6
*/
class LoginasuserViewLoginasuser extends JViewLegacy
{
/**
* The item data.
*
* @var object
* @since 1.6
*/
protected $items;
/**
* The pagination object.
*
* @var JPagination
* @since 1.6
*/
protected $pagination;
/**
* The model state.
*
* @var JObject
* @since 1.6
*/
protected $state;
/**
* Display the view
*
* @param string $tpl The name of the template file to parse;
automatically searches through the template paths.
*
* @return void
*/
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
// Get Joomla! version
$jversion = new JVersion;
$short_version = explode('.', $jversion->getShortVersion());
// 3.8.10
$mini_version = $short_version[0].'.'.$short_version[1]; // 3.8
if (!version_compare( $mini_version, "2.5", "<="))
:
// joomla 3.x
LoginasuserHelper::addSubmenu('loginasuser');
// Show sidebar
$this->sidebar = JHtmlSidebar::render();
else:
// joomla 2.5.x
$this->sidebar = '';
endif;
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode('<br />', $errors), 500);
}
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
$this->addToolbar();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
// Build title
$title = JText::_('Users List (Login as User)');
// Set document title
JFactory::getDocument()->setTitle($title);
// Set ToolBar title
JToolbarHelper::title($title, 'users user');
// get the ID of plugin
$db = JFactory::getDBO();
$query = "SELECT extension_id "
."FROM #__extensions "
."WHERE type='plugin' AND element='loginasuser'
AND folder='system' "
;
$db->setQuery($query);
$db->execute();
$extension_id = (int)$db->loadResult();
JToolbarHelper::link(JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id='.$extension_id),
'JOPTIONS', 'options');
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array Array containing the field name to sort by as the key
and display text as value
*
* @since 3.0
*/
protected function getSortFields()
{
return array(
'a.name' => JText::_('COM_USERS_HEADING_NAME'),
'a.username' => JText::_('JGLOBAL_USERNAME'),
'a.block' =>
JText::_('COM_USERS_HEADING_ENABLED'),
'a.activation' =>
JText::_('COM_USERS_HEADING_ACTIVATED'),
'a.email' => JText::_('JGLOBAL_EMAIL'),
'a.lastvisitDate' =>
JText::_('COM_USERS_HEADING_LAST_VISIT_DATE'),
'a.registerDate' =>
JText::_('COM_USERS_HEADING_REGISTRATION_DATE'),
'a.id' => JText::_('JGRID_HEADING_ID')
);
}
}
views/overv/tmpl/default.php000064400000003555151165062400012163
0ustar00<?php
/* ======================================================
# Login as User for Joomla! - v3.5.9 (pro version)
# -------------------------------------------------------
# For Joomla! CMS (v3.x)
# Author: Web357 (Yiannis Christodoulou)
# Copyright (©) 2014-2022 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https:/www.web357.com
# Demo: https://demo.web357.com/joomla/login-as-user
# Support: support@web357.com
# Last modified: Wednesday 07 December 2022, 11:05:26 AM
========================================================= */
defined('_JEXEC') or die;
// Get Joomla! version
$jversion = new JVersion;
$short_version = explode('.', $jversion->getShortVersion());
// 3.8.10
$mini_version = $short_version[0].'.'.$short_version[1]; // 3.8
if (version_compare($mini_version, "4.0", ">="))
{
// joomla 4.x
$row_fluid = '';
}
else
{
// joomla 3.x
$row_fluid = '-fluid';
}
?>
<div class="container-fluid">
<div class="row<?php echo $row_fluid; ?>">
<div id="j-sidebar-container" class="span2 col
col-md-2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="col col-md-10
span10 j-main-container p-4">
<div class="row<?php echo $row_fluid;
?>">
<div class="col-8 span7">
<?php
echo
$this->form->getLabel('description');
?>
</div>
<div class="col-4 span5">
<?php
echo
$this->form->getLabel('W357FRM_HEADER_VERSION_CHECK');
echo $this->form->getLabel('info');
?>
<?php
echo
$this->form->getLabel('jedreview');
?>
</div>
</div>
</div>
</div>
</div>views/overv/tmpl/index.html000064400000000054151165062400012012
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/overv/view.html.php000064400000003557151165062400011502
0ustar00<?php
/* ======================================================
# Login as User for Joomla! - v3.5.9 (pro version)
# -------------------------------------------------------
# For Joomla! CMS (v3.x)
# Author: Web357 (Yiannis Christodoulou)
# Copyright (©) 2014-2022 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https:/www.web357.com
# Demo: https://demo.web357.com/joomla/login-as-user
# Support: support@web357.com
# Last modified: Wednesday 07 December 2022, 11:05:26 AM
========================================================= */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
class LoginasuserViewOverv extends JViewLegacy
{
function display($tpl = null)
{
$form = $this->get('Form');
// Check for model errors.
if ($errors = $this->get('Errors')) {
throw new Exception(implode('<br />', $errors), 500);
}
// Get Joomla! version
$jversion = new JVersion;
$short_version = explode('.', $jversion->getShortVersion());
// 3.8.10
$mini_version = $short_version[0].'.'.$short_version[1]; // 3.8
if (version_compare($mini_version, "2.5", "<=")):
// j25x
// Show sidebar
$this->sidebar = "";
else:
// j3X
// Include helper submenu
LoginasuserHelper::addSubmenu('overv');
// Show sidebar
$this->sidebar = JHtmlSidebar::render();
endif;
// mapping variables
$this->form = $form;
// Set the toolbar
$this->addToolBar();
// Display the template
parent::display($tpl);
}
protected function addToolBar()
{
// Build title
$title = JText::_('Login as User').':
'.JText::_('Overview');
// Set document title
JFactory::getDocument()->setTitle($title);
// Set ToolBar title
JToolbarHelper::title($title, 'loginasuser icon-user');
}
}