File manager - Edit - /home/capoccitel/www/wp-admin/com_users.tar
Back
helpers/route.php 0000604 00000007531 15242100514 0010051 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Users Route Helper * * @since 1.6 * @deprecated 4.0 */ class UsersHelperRoute { /** * Method to get the menu items for the component. * * @return array An array of menu items. * * @since 1.6 * @deprecated 4.0 */ public static function &getItems() { static $items; // Get the menu items for this component. if (!isset($items)) { $component = JComponentHelper::getComponent('com_users'); $items = JFactory::getApplication()->getMenu()->getItems('component_id', $component->id); // If no items found, set to empty array. if (!$items) { $items = array(); } } return $items; } /** * Method to get a route configuration for the login view. * * @return mixed Integer menu id on success, null on failure. * * @since 1.6 * @deprecated 4.0 */ public static function getLoginRoute() { // Get the items. $items = self::getItems(); // Search for a suitable menu id. foreach ($items as $item) { if (isset($item->query['view']) && $item->query['view'] === 'login' && (empty($item->query['layout']) || $item->query['layout'] === 'default')) { return $item->id; } } return null; } /** * Method to get a route configuration for the profile view. * * @return mixed Integer menu id on success, null on failure. * * @since 1.6 * @deprecated 4.0 */ public static function getProfileRoute() { // Get the items. $items = self::getItems(); // Search for a suitable menu id. // Menu link can only go to users own profile. foreach ($items as $item) { if (isset($item->query['view']) && $item->query['view'] === 'profile') { return $item->id; } } return null; } /** * Method to get a route configuration for the registration view. * * @return mixed Integer menu id on success, null on failure. * * @since 1.6 * @deprecated 4.0 */ public static function getRegistrationRoute() { // Get the items. $items = self::getItems(); // Search for a suitable menu id. foreach ($items as $item) { if (isset($item->query['view']) && $item->query['view'] === 'registration') { return $item->id; } } return null; } /** * Method to get a route configuration for the remind view. * * @return mixed Integer menu id on success, null on failure. * * @since 1.6 * @deprecated 4.0 */ public static function getRemindRoute() { // Get the items. $items = self::getItems(); // Search for a suitable menu id. foreach ($items as $item) { if (isset($item->query['view']) && $item->query['view'] === 'remind') { return $item->id; } } return null; } /** * Method to get a route configuration for the resend view. * * @return mixed Integer menu id on success, null on failure. * * @since 1.6 * @deprecated 4.0 */ public static function getResendRoute() { // Get the items. $items = self::getItems(); // Search for a suitable menu id. foreach ($items as $item) { if (isset($item->query['view']) && $item->query['view'] === 'resend') { return $item->id; } } return null; } /** * Method to get a route configuration for the reset view. * * @return mixed Integer menu id on success, null on failure. * * @since 1.6 * @deprecated 4.0 */ public static function getResetRoute() { // Get the items. $items = self::getItems(); // Search for a suitable menu id. foreach ($items as $item) { if (isset($item->query['view']) && $item->query['view'] === 'reset') { return $item->id; } } return null; } } helpers/legacyrouter.php 0000604 00000013673 15242100514 0011424 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Legacy routing rules class from com_users * * @since 3.6 * @deprecated 4.0 */ class UsersRouterRulesLegacy implements JComponentRouterRulesInterface { /** * Constructor for this legacy router * * @param JComponentRouterAdvanced $router The router this rule belongs to * * @since 3.6 * @deprecated 4.0 */ public function __construct($router) { $this->router = $router; } /** * Preprocess the route for the com_users component * * @param array &$query An array of URL arguments * * @return void * * @since 3.6 * @deprecated 4.0 */ public function preprocess(&$query) { } /** * Build the route for the com_users component * * @param array &$query An array of URL arguments * @param array &$segments The URL arguments to use to assemble the subsequent URL. * * @return void * * @since 3.6 * @deprecated 4.0 */ public function build(&$query, &$segments) { // Declare static variables. static $items; static $default; static $registration; static $profile; static $login; static $remind; static $resend; static $reset; // Get the relevant menu items if not loaded. if (empty($items)) { // Get all relevant menu items. $items = $this->router->menu->getItems('component', 'com_users'); // Build an array of serialized query strings to menu item id mappings. foreach ($items as $item) { if (empty($item->query['view'])) { continue; } // Check to see if we have found the resend menu item. if (empty($resend) && $item->query['view'] === 'resend') { $resend = $item->id; continue; } // Check to see if we have found the reset menu item. if (empty($reset) && $item->query['view'] === 'reset') { $reset = $item->id; continue; } // Check to see if we have found the remind menu item. if (empty($remind) && $item->query['view'] === 'remind') { $remind = $item->id; continue; } // Check to see if we have found the login menu item. if (empty($login) && $item->query['view'] === 'login' && (empty($item->query['layout']) || $item->query['layout'] === 'default')) { $login = $item->id; continue; } // Check to see if we have found the registration menu item. if (empty($registration) && $item->query['view'] === 'registration') { $registration = $item->id; continue; } // Check to see if we have found the profile menu item. if (empty($profile) && $item->query['view'] === 'profile') { $profile = $item->id; } } // Set the default menu item to use for com_users if possible. if ($profile) { $default = $profile; } elseif ($registration) { $default = $registration; } elseif ($login) { $default = $login; } } if (!empty($query['view'])) { switch ($query['view']) { case 'reset': if ($query['Itemid'] = $reset) { unset($query['view']); } else { $query['Itemid'] = $default; } break; case 'resend': if ($query['Itemid'] = $resend) { unset($query['view']); } else { $query['Itemid'] = $default; } break; case 'remind': if ($query['Itemid'] = $remind) { unset($query['view']); } else { $query['Itemid'] = $default; } break; case 'login': if ($query['Itemid'] = $login) { unset($query['view']); } else { $query['Itemid'] = $default; } break; case 'registration': if ($query['Itemid'] = $registration) { unset($query['view']); } else { $query['Itemid'] = $default; } break; default: case 'profile': if (!empty($query['view'])) { $segments[] = $query['view']; } unset($query['view']); if ($query['Itemid'] = $profile) { unset($query['view']); } else { $query['Itemid'] = $default; } // Only append the user id if not "me". $user = JFactory::getUser(); if (!empty($query['user_id']) && ($query['user_id'] != $user->id)) { $segments[] = $query['user_id']; } unset($query['user_id']); break; } } $total = count($segments); for ($i = 0; $i < $total; $i++) { $segments[$i] = str_replace(':', '-', $segments[$i]); } } /** * Parse the segments of a URL. * * @param array &$segments The segments of the URL to parse. * @param array &$vars The URL attributes to be used by the application. * * @return void * * @since 3.6 * @deprecated 4.0 */ public function parse(&$segments, &$vars) { $total = count($segments); for ($i = 0; $i < $total; $i++) { $segments[$i] = preg_replace('/-/', ':', $segments[$i], 1); } // Only run routine if there are segments to parse. if (count($segments) < 1) { return; } // Get the package from the route segments. $userId = array_pop($segments); if (!is_numeric($userId)) { $vars['view'] = 'profile'; return; } if (is_numeric($userId)) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__users')) ->where($db->quoteName('id') . ' = ' . (int) $userId); $db->setQuery($query); $userId = $db->loadResult(); } // Set the package id if present. if ($userId) { // Set the package id. $vars['user_id'] = (int) $userId; // Set the view to package if not already set. if (empty($vars['view'])) { $vars['view'] = 'profile'; } } else { JError::raiseError(404, JText::_('JGLOBAL_RESOURCE_NOT_FOUND')); } } } helpers/index.html 0000705 00000000037 15242100514 0010173 0 ustar 00 <!DOCTYPE html><title></title> helpers/html/users.php 0000604 00000010607 15242100514 0011016 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Users Html Helper * * @since 1.6 */ abstract class JHtmlUsers { /** * Get the sanitized value * * @param mixed $value Value of the field * * @return mixed String/void * * @since 1.6 */ public static function value($value) { if (is_string($value)) { $value = trim($value); } if (empty($value)) { return JText::_('COM_USERS_PROFILE_VALUE_NOT_FOUND'); } elseif (!is_array($value)) { return htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); } } /** * Get the space symbol * * @param mixed $value Value of the field * * @return string * * @since 1.6 */ public static function spacer($value) { return ''; } /** * Get the sanitized helpsite link * * @param mixed $value Value of the field * * @return mixed String/void * * @since 1.6 */ public static function helpsite($value) { if (empty($value)) { return static::value($value); } $text = $value; if ($xml = simplexml_load_file(JPATH_ADMINISTRATOR . '/help/helpsites.xml')) { foreach ($xml->sites->site as $site) { if ((string) $site->attributes()->url == $value) { $text = (string) $site; break; } } } $value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); if (strpos($value, 'http') === 0) { return '<a href="' . $value . '">' . $text . '</a>'; } return '<a href="http://' . $value . '">' . $text . '</a>'; } /** * Get the sanitized template style * * @param mixed $value Value of the field * * @return mixed String/void * * @since 1.6 */ public static function templatestyle($value) { if (empty($value)) { return static::value($value); } else { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('title') ->from('#__template_styles') ->where('id = ' . $db->quote($value)); $db->setQuery($query); $title = $db->loadResult(); if ($title) { return htmlspecialchars($title, ENT_COMPAT, 'UTF-8'); } else { return static::value(''); } } } /** * Get the sanitized language * * @param mixed $value Value of the field * * @return mixed String/void * * @since 1.6 */ public static function admin_language($value) { if (empty($value)) { return static::value($value); } else { $file = JLanguageHelper::getLanguagePath(JPATH_ADMINISTRATOR, $value) . '/' . $value . '.xml'; $result = null; if (is_file($file)) { $result = JLanguageHelper::parseXMLLanguageFile($file); } if ($result) { return htmlspecialchars($result['name'], ENT_COMPAT, 'UTF-8'); } else { return static::value(''); } } } /** * Get the sanitized language * * @param mixed $value Value of the field * * @return mixed String/void * * @since 1.6 */ public static function language($value) { if (empty($value)) { return static::value($value); } else { $file = JLanguageHelper::getLanguagePath(JPATH_SITE, $value) . '/' . $value . '.xml'; $result = null; if (is_file($file)) { $result = JLanguageHelper::parseXMLLanguageFile($file); } if ($result) { return htmlspecialchars($result['name'], ENT_COMPAT, 'UTF-8'); } else { return static::value(''); } } } /** * Get the sanitized editor name * * @param mixed $value Value of the field * * @return mixed String/void * * @since 1.6 */ public static function editor($value) { if (empty($value)) { return static::value($value); } else { $db = JFactory::getDbo(); $lang = JFactory::getLanguage(); $query = $db->getQuery(true) ->select('name') ->from('#__extensions') ->where('element = ' . $db->quote($value)) ->where('folder = ' . $db->quote('editors')); $db->setQuery($query); $title = $db->loadResult(); if ($title) { $lang->load("plg_editors_$value.sys", JPATH_ADMINISTRATOR, null, false, true) || $lang->load("plg_editors_$value.sys", JPATH_PLUGINS . '/editors/' . $value, null, false, true); $lang->load($title . '.sys'); return JText::_($title); } else { return static::value(''); } } } } helpers/html/index.html 0000705 00000000037 15242100514 0011137 0 ustar 00 <!DOCTYPE html><title></title> controller.php 0000604 00000007067 15242100514 0007440 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Base controller class for Users. * * @since 1.5 */ class UsersController extends JControllerLegacy { /** * 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 the document object. $document = JFactory::getDocument(); // Set the default view name and format from the Request. $vName = $this->input->getCmd('view', 'login'); $vFormat = $document->getType(); $lName = $this->input->getCmd('layout', 'default'); if ($view = $this->getView($vName, $vFormat)) { // Do any specific processing by view. switch ($vName) { case 'registration': // If the user is already logged in, redirect to the profile page. $user = JFactory::getUser(); if ($user->get('guest') != 1) { // Redirect to profile page. $this->setRedirect(JRoute::_('index.php?option=com_users&view=profile', false)); return; } // Check if user registration is enabled if (JComponentHelper::getParams('com_users')->get('allowUserRegistration') == 0) { // Registration is disabled - Redirect to login page. $this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false)); return; } // The user is a guest, load the registration model and show the registration page. $model = $this->getModel('Registration'); break; // Handle view specific models. case 'profile': // If the user is a guest, redirect to the login page. $user = JFactory::getUser(); if ($user->get('guest') == 1) { // Redirect to login page. $this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false)); return; } $model = $this->getModel($vName); break; // Handle the default views. case 'login': $model = $this->getModel($vName); break; case 'reset': // If the user is already logged in, redirect to the profile page. $user = JFactory::getUser(); if ($user->get('guest') != 1) { // Redirect to profile page. $this->setRedirect(JRoute::_('index.php?option=com_users&view=profile', false)); return; } $model = $this->getModel($vName); break; case 'remind': // If the user is already logged in, redirect to the profile page. $user = JFactory::getUser(); if ($user->get('guest') != 1) { // Redirect to profile page. $this->setRedirect(JRoute::_('index.php?option=com_users&view=profile', false)); return; } $model = $this->getModel($vName); break; default: $model = $this->getModel('Login'); break; } // Make sure we don't send a referer if (in_array($vName, array('remind', 'reset'))) { JFactory::getApplication()->setHeader('Referrer-Policy', 'no-referrer', true); } // Push the model into the view (as default). $view->setModel($model, true); $view->setLayout($lName); // Push document object into the view. $view->document = $document; $view->display(); } } } views/login/tmpl/index.html 0000705 00000000037 15242100514 0011752 0 ustar 00 <!DOCTYPE html><title></title> views/login/tmpl/logout.xml 0000604 00000001757 15242100514 0012020 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <metadata> <layout title="COM_USER_LOGOUT_VIEW_DEFAULT_TITLE" option="COM_USER_LOGOUT_VIEW_DEFAULT_OPTION"> <help key = "JHELP_MENUS_MENU_ITEM_USER_LOGOUT"/> <message> <![CDATA[COM_USER_LOGOUT_VIEW_DEFAULT_DESC]]> </message> </layout> <!-- Add fields to the request variables for the layout. --> <fields name="request"> <fieldset name="request"> <field name="task" type="hidden" default="user.menulogout" /> </fieldset> </fields> <!-- Add fields to the parameters object for the layout. --> <fields name="params"> <fieldset name="basic" label="COM_MENUS_BASIC_FIELDSET_LABEL"> <field name="logout" type="modal_menu" label="JFIELD_LOGOUT_REDIRECT_PAGE_LABEL" description="JFIELD_LOGOUT_REDIRECT_PAGE_DESC" disable="separator,alias,heading,url" select="true" new="true" edit="true" clear="true" > <option value="">JDEFAULT</option> </field> </fieldset> </fields> </metadata> views/login/tmpl/default.xml 0000604 00000010107 15242100514 0012120 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <metadata> <layout title="COM_USER_LOGIN_VIEW_DEFAULT_TITLE" option="COM_USER_LOGIN_VIEW_DEFAULT_OPTION"> <help key = "JHELP_MENUS_MENU_ITEM_USER_LOGIN" /> <message> <![CDATA[COM_USER_LOGIN_VIEW_DEFAULT_DESC]]> </message> </layout> <!-- Add fields to the parameters object for the layout. --> <fields name="params"> <!-- Basic options. --> <fieldset name="basic" addrulepath="components/com_users/models/rules" label="COM_MENUS_BASIC_FIELDSET_LABEL"> <field name="loginredirectchoice" type="radio" label="COM_USERS_FIELD_LOGIN_REDIRECT_CHOICE_LABEL" description="COM_USERS_FIELD_LOGIN_REDIRECT_CHOICE_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">COM_USERS_FIELD_LOGIN_MENUITEM</option> <option value="0">COM_USERS_FIELD_LOGIN_URL</option> </field> <field name="login_redirect_url" type="text" label="JFIELD_LOGIN_REDIRECT_URL_LABEL" description="JFIELD_LOGIN_REDIRECT_URL_DESC" class="inputbox" validate="loginuniquefield" field="login_redirect_menuitem" hint="COM_USERS_FIELD_LOGIN_REDIRECT_PLACEHOLDER" message="COM_USERS_FIELD_LOGIN_REDIRECT_ERROR" showon="loginredirectchoice:0" /> <field name="login_redirect_menuitem" type="modal_menu" label="COM_USERS_FIELD_LOGIN_REDIRECTMENU_LABEL" description="COM_USERS_FIELD_LOGIN_REDIRECTMENU_DESC" disable="separator,alias,heading,url" showon="loginredirectchoice:1" select="true" new="true" edit="true" clear="true" > <option value="">JDEFAULT</option> </field> <field name="logindescription_show" type="list" label="JFIELD_BASIS_LOGIN_DESCRIPTION_SHOW_LABEL" description="JFIELD_BASIS_LOGIN_DESCRIPTION_SHOW_DESC" default="1" class="chzn-color" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="login_description" type="textarea" label="JFIELD_BASIS_LOGIN_DESCRIPTION_LABEL" description="JFIELD_BASIS_LOGIN_DESCRIPTION_DESC" rows="3" cols="40" filter="safehtml" showon="logindescription_show:1" /> <field name="login_image" type="media" label="JFIELD_LOGIN_IMAGE_LABEL" description="JFIELD_LOGIN_IMAGE_DESC" /> <field name="spacer1" type="spacer" hr="true" /> <field name="logoutredirectchoice" type="radio" label="COM_USERS_FIELD_LOGOUT_REDIRECT_CHOICE_LABEL" description="COM_USERS_FIELD_LOGOUT_REDIRECT_CHOICE_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">COM_USERS_FIELD_LOGIN_MENUITEM</option> <option value="0">COM_USERS_FIELD_LOGIN_URL</option> </field> <field name="logout_redirect_url" type="text" label="JFIELD_LOGOUT_REDIRECT_URL_LABEL" description="JFIELD_LOGOUT_REDIRECT_URL_DESC" class="inputbox" field="logout_redirect_menuitem" validate="logoutuniquefield" hint="COM_USERS_FIELD_LOGIN_REDIRECT_PLACEHOLDER" message="COM_USERS_FIELD_LOGOUT_REDIRECT_ERROR" showon="logoutredirectchoice:0" /> <field name="logout_redirect_menuitem" type="modal_menu" label="COM_USERS_FIELD_LOGOUT_REDIRECTMENU_LABEL" description="COM_USERS_FIELD_LOGOUT_REDIRECTMENU_DESC" disable="separator,alias,heading,url" showon="logoutredirectchoice:1" select="true" new="true" edit="true" clear="true" > <option value="">JDEFAULT</option> </field> <field name="logoutdescription_show" type="list" label="JFIELD_BASIS_LOGOUT_DESCRIPTION_SHOW_LABEL" description="JFIELD_BASIS_LOGOUT_DESCRIPTION_SHOW_DESC" default="1" class="chzn-color" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="logout_description" type="textarea" label="JFIELD_BASIS_LOGOUT_DESCRIPTION_LABEL" description="JFIELD_BASIS_LOGOUT_DESCRIPTION_DESC" rows="3" cols="40" filter="safehtml" showon="logoutdescription_show:1" /> <field name="logout_image" type="media" label="JFIELD_LOGOUT_IMAGE_LABEL" description="JFIELD_LOGOUT_IMAGE_DESC" /> </fieldset> </fields> </metadata> views/login/tmpl/default.php 0000604 00000001035 15242100514 0012107 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; $cookieLogin = $this->user->get('cookieLogin'); if (!empty($cookieLogin) || $this->user->get('guest')) { // The user is not logged in or needs to provide a password. echo $this->loadTemplate('login'); } else { // The user is already logged in. echo $this->loadTemplate('logout'); } views/login/index.html 0000705 00000000037 15242100514 0010776 0 ustar 00 <!DOCTYPE html><title></title> views/login/view.html.php 0000604 00000005727 15242100514 0011440 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Login view class for Users. * * @since 1.5 */ class UsersViewLogin extends JViewLegacy { protected $form; protected $params; protected $state; protected $user; /** * Method to display the view. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise an Error object. * * @since 1.5 */ public function display($tpl = null) { // Get the view data. $this->user = JFactory::getUser(); $this->form = $this->get('Form'); $this->state = $this->get('State'); $this->params = $this->state->get('params'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } // Check for layout override $active = JFactory::getApplication()->getMenu()->getActive(); if (isset($active->query['layout'])) { $this->setLayout($active->query['layout']); } $tfa = JAuthenticationHelper::getTwoFactorMethods(); $this->tfa = is_array($tfa) && count($tfa) > 1; // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx', ''), ENT_COMPAT, 'UTF-8'); $this->prepareDocument(); parent::display($tpl); } /** * Prepares the document * * @return void * * @since 1.6 */ protected function prepareDocument() { $app = JFactory::getApplication(); $menus = $app->getMenu(); $user = JFactory::getUser(); $login = $user->get('guest') ? true : false; $title = null; // Because the application sets a default page title, // we need to get it from the menu item itself $menu = $menus->getActive(); if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } else { $this->params->def('page_heading', $login ? JText::_('JLOGIN') : JText::_('JLOGOUT')); } $title = $this->params->get('page_title', ''); if (empty($title)) { $title = $app->get('sitename'); } elseif ($app->get('sitename_pagetitles', 0) == 1) { $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title); } elseif ($app->get('sitename_pagetitles', 0) == 2) { $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename')); } $this->document->setTitle($title); if ($this->params->get('menu-meta_description')) { $this->document->setDescription($this->params->get('menu-meta_description')); } if ($this->params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); } if ($this->params->get('robots')) { $this->document->setMetadata('robots', $this->params->get('robots')); } } } views/remind/tmpl/index.html 0000705 00000000037 15242100514 0012120 0 ustar 00 <!DOCTYPE html><title></title> views/remind/tmpl/default.php 0000604 00000002415 15242100514 0012260 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::_('behavior.keepalive'); JHtml::_('behavior.formvalidator'); ?> <div class="remind<?php echo $this->pageclass_sfx; ?>"> <?php if ($this->params->get('show_page_heading')) : ?> <div class="page-header"> <h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1> </div> <?php endif; ?> <form id="user-registration" action="<?php echo JRoute::_('index.php?option=com_users&task=remind.remind'); ?>" method="post" class="form-validate form-horizontal well"> <?php foreach ($this->form->getFieldsets() as $fieldset) : ?> <fieldset> <?php if (isset($fieldset->label)) : ?> <p><?php echo JText::_($fieldset->label); ?></p> <?php endif; ?> <?php echo $this->form->renderFieldset($fieldset->name); ?> </fieldset> <?php endforeach; ?> <div class="control-group"> <div class="controls"> <button type="submit" class="btn btn-primary validate"> <?php echo JText::_('JSUBMIT'); ?> </button> </div> </div> <?php echo JHtml::_('form.token'); ?> </form> </div> views/remind/tmpl/default.xml 0000604 00000000461 15242100514 0012270 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <metadata> <layout title="COM_USER_REMIND_VIEW_DEFAULT_TITLE" option="COM_USER_REMIND_VIEW_DEFAULT_OPTION"> <help key = "JHELP_MENUS_MENU_ITEM_USER_REMINDER" /> <message> <![CDATA[COM_USER_REMIND_VIEW_DEFAULT_DESC]]> </message> </layout> </metadata> views/remind/index.html 0000705 00000000037 15242100514 0011144 0 ustar 00 <!DOCTYPE html><title></title> views/remind/view.html.php 0000604 00000005137 15242100514 0011601 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Registration view class for Users. * * @since 1.5 */ class UsersViewRemind extends JViewLegacy { protected $form; protected $params; protected $state; /** * Method to display the view. * * @param string $tpl The template file to include * * @return mixed * * @since 1.5 */ public function display($tpl = null) { // Get the view data. $this->form = $this->get('Form'); $this->state = $this->get('State'); $this->params = $this->state->params; // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } // Check for layout override $active = JFactory::getApplication()->getMenu()->getActive(); if (isset($active->query['layout'])) { $this->setLayout($active->query['layout']); } // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx', ''), ENT_COMPAT, 'UTF-8'); $this->prepareDocument(); parent::display($tpl); } /** * Prepares the document. * * @return void * * @since 1.6 */ protected function prepareDocument() { $app = JFactory::getApplication(); $menus = $app->getMenu(); $title = null; // Because the application sets a default page title, // we need to get it from the menu item itself $menu = $menus->getActive(); if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } else { $this->params->def('page_heading', JText::_('COM_USERS_REMIND')); } $title = $this->params->get('page_title', ''); if (empty($title)) { $title = $app->get('sitename'); } elseif ($app->get('sitename_pagetitles', 0) == 1) { $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title); } elseif ($app->get('sitename_pagetitles', 0) == 2) { $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename')); } $this->document->setTitle($title); if ($this->params->get('menu-meta_description')) { $this->document->setDescription($this->params->get('menu-meta_description')); } if ($this->params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); } if ($this->params->get('robots')) { $this->document->setMetadata('robots', $this->params->get('robots')); } } } views/profile/index.html 0000705 00000000037 15242100514 0011326 0 ustar 00 <!DOCTYPE html><title></title> views/profile/tmpl/edit.php 0000604 00000013024 15242100514 0011741 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::_('behavior.keepalive'); JHtml::_('behavior.formvalidator'); JHtml::_('formbehavior.chosen', 'select'); JHtml::_('bootstrap.tooltip'); // Load user_profile plugin language $lang = JFactory::getLanguage(); $lang->load('plg_user_profile', JPATH_ADMINISTRATOR); ?> <div class="profile-edit<?php echo $this->pageclass_sfx; ?>"> <?php if ($this->params->get('show_page_heading')) : ?> <div class="page-header"> <h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1> </div> <?php endif; ?> <script type="text/javascript"> Joomla.twoFactorMethodChange = function(e) { var selectedPane = 'com_users_twofactor_' + jQuery('#jform_twofactor_method').val(); jQuery.each(jQuery('#com_users_twofactor_forms_container>div'), function(i, el) { if (el.id != selectedPane) { jQuery('#' + el.id).hide(0); } else { jQuery('#' + el.id).show(0); } }); } </script> <form id="member-profile" action="<?php echo JRoute::_('index.php?option=com_users&task=profile.save'); ?>" method="post" class="form-validate form-horizontal well" enctype="multipart/form-data"> <?php // Iterate through the form fieldsets and display each one. ?> <?php foreach ($this->form->getFieldsets() as $group => $fieldset) : ?> <?php $fields = $this->form->getFieldset($group); ?> <?php if (count($fields)) : ?> <fieldset> <?php // If the fieldset has a label set, display it as the legend. ?> <?php if (isset($fieldset->label)) : ?> <legend> <?php echo JText::_($fieldset->label); ?> </legend> <?php endif; ?> <?php if (isset($fieldset->description) && trim($fieldset->description)) : ?> <p> <?php echo $this->escape(JText::_($fieldset->description)); ?> </p> <?php endif; ?> <?php // Iterate through the fields in the set and display them. ?> <?php foreach ($fields as $field) : ?> <?php // If the field is hidden, just display the input. ?> <?php if ($field->hidden) : ?> <?php echo $field->input; ?> <?php else : ?> <div class="control-group"> <div class="control-label"> <?php echo $field->label; ?> <?php if (!$field->required && $field->type !== 'Spacer') : ?> <span class="optional"> <?php echo JText::_('COM_USERS_OPTIONAL'); ?> </span> <?php endif; ?> </div> <div class="controls"> <?php if ($field->fieldname === 'password1') : ?> <?php // Disables autocomplete ?> <input type="password" style="display:none"> <?php endif; ?> <?php echo $field->input; ?> </div> </div> <?php endif; ?> <?php endforeach; ?> </fieldset> <?php endif; ?> <?php endforeach; ?> <?php if (count($this->twofactormethods) > 1 && !empty($this->twofactorform)) : ?> <fieldset> <legend><?php echo JText::_('COM_USERS_PROFILE_TWO_FACTOR_AUTH'); ?></legend> <div class="control-group"> <div class="control-label"> <label id="jform_twofactor_method-lbl" for="jform_twofactor_method" class="hasTooltip" title="<?php echo '<strong>' . JText::_('COM_USERS_PROFILE_TWOFACTOR_LABEL') . '</strong><br />' . JText::_('COM_USERS_PROFILE_TWOFACTOR_DESC'); ?>"> <?php echo JText::_('COM_USERS_PROFILE_TWOFACTOR_LABEL'); ?> </label> </div> <div class="controls"> <?php echo JHtml::_('select.genericlist', $this->twofactormethods, 'jform[twofactor][method]', array('onchange' => 'Joomla.twoFactorMethodChange()'), 'value', 'text', $this->otpConfig->method, 'jform_twofactor_method', false); ?> </div> </div> <div id="com_users_twofactor_forms_container"> <?php foreach ($this->twofactorform as $form) : ?> <?php $style = $form['method'] == $this->otpConfig->method ? 'display: block' : 'display: none'; ?> <div id="com_users_twofactor_<?php echo $form['method']; ?>" style="<?php echo $style; ?>"> <?php echo $form['form']; ?> </div> <?php endforeach; ?> </div> </fieldset> <fieldset> <legend> <?php echo JText::_('COM_USERS_PROFILE_OTEPS'); ?> </legend> <div class="alert alert-info"> <?php echo JText::_('COM_USERS_PROFILE_OTEPS_DESC'); ?> </div> <?php if (empty($this->otpConfig->otep)) : ?> <div class="alert alert-warning"> <?php echo JText::_('COM_USERS_PROFILE_OTEPS_WAIT_DESC'); ?> </div> <?php else : ?> <?php foreach ($this->otpConfig->otep as $otep) : ?> <span class="span3"> <?php echo substr($otep, 0, 4); ?>-<?php echo substr($otep, 4, 4); ?>-<?php echo substr($otep, 8, 4); ?>-<?php echo substr($otep, 12, 4); ?> </span> <?php endforeach; ?> <div class="clearfix"></div> <?php endif; ?> </fieldset> <?php endif; ?> <div class="control-group"> <div class="controls"> <button type="submit" class="btn btn-primary validate"> <?php echo JText::_('JSUBMIT'); ?> </button> <a class="btn" href="<?php echo JRoute::_('index.php?option=com_users&view=profile'); ?>" title="<?php echo JText::_('JCANCEL'); ?>"> <?php echo JText::_('JCANCEL'); ?> </a> <input type="hidden" name="option" value="com_users" /> <input type="hidden" name="task" value="profile.save" /> </div> </div> <?php echo JHtml::_('form.token'); ?> </form> </div> views/profile/tmpl/edit.xml 0000604 00000000470 15242100514 0011753 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <metadata> <layout title="COM_USER_PROFILE_EDIT_DEFAULT_TITLE" option="COM_USER_PROFILE_EDIT_DEFAULT_OPTION"> <help key = "JHELP_MENUS_MENU_ITEM_USER_PROFILE_EDIT" /> <message> <![CDATA[COM_USER_PROFILE_EDIT_DEFAULT_DESC]]> </message> </layout> </metadata> views/profile/tmpl/index.html 0000705 00000000037 15242100514 0012302 0 ustar 00 <!DOCTYPE html><title></title> views/profile/tmpl/default_params.php 0000604 00000002446 15242100514 0014011 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); ?> <?php $fields = $this->form->getFieldset('params'); ?> <?php if (count($fields)) : ?> <fieldset id="users-profile-custom"> <legend><?php echo JText::_('COM_USERS_SETTINGS_FIELDSET_LABEL'); ?></legend> <dl class="dl-horizontal"> <?php foreach ($fields as $field) : ?> <?php if (!$field->hidden) : ?> <dt> <?php echo $field->title; ?> </dt> <dd> <?php if (JHtml::isRegistered('users.' . $field->id)) : ?> <?php echo JHtml::_('users.' . $field->id, $field->value); ?> <?php elseif (JHtml::isRegistered('users.' . $field->fieldname)) : ?> <?php echo JHtml::_('users.' . $field->fieldname, $field->value); ?> <?php elseif (JHtml::isRegistered('users.' . $field->type)) : ?> <?php echo JHtml::_('users.' . $field->type, $field->value); ?> <?php else : ?> <?php echo JHtml::_('users.value', $field->value); ?> <?php endif; ?> </dd> <?php endif; ?> <?php endforeach; ?> </dl> </fieldset> <?php endif; ?> views/profile/tmpl/default.xml 0000604 00000000463 15242100514 0012454 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <metadata> <layout title="COM_USER_PROFILE_VIEW_DEFAULT_TITLE" option="COM_USER_PROFILE_VIEW_DEFAULT_OPTION"> <help key = "JHELP_MENUS_MENU_ITEM_USER_PROFILE" /> <message> <![CDATA[COM_USER_PROFILE_VIEW_DEFAULT_DESC]]> </message> </layout> </metadata> views/profile/tmpl/default.php 0000604 00000002026 15242100514 0012440 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; ?> <div class="profile<?php echo $this->pageclass_sfx; ?>"> <?php if ($this->params->get('show_page_heading')) : ?> <div class="page-header"> <h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1> </div> <?php endif; ?> <?php if (JFactory::getUser()->id == $this->data->id) : ?> <ul class="btn-toolbar pull-right"> <li class="btn-group"> <a class="btn" href="<?php echo JRoute::_('index.php?option=com_users&task=profile.edit&user_id=' . (int) $this->data->id); ?>"> <span class="icon-user"></span> <?php echo JText::_('COM_USERS_EDIT_PROFILE'); ?> </a> </li> </ul> <?php endif; ?> <?php echo $this->loadTemplate('core'); ?> <?php echo $this->loadTemplate('params'); ?> <?php echo $this->loadTemplate('custom'); ?> </div> views/profile/tmpl/default_custom.php 0000604 00000004607 15242100514 0014041 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); JHtml::register('users.spacer', array('JHtmlUsers', 'spacer')); $fieldsets = $this->form->getFieldsets(); if (isset($fieldsets['core'])) { unset($fieldsets['core']); } if (isset($fieldsets['params'])) { unset($fieldsets['params']); } $tmp = isset($this->data->jcfields) ? $this->data->jcfields : array(); $customFields = array(); foreach ($tmp as $customField) { $customFields[$customField->name] = $customField; } ?> <?php foreach ($fieldsets as $group => $fieldset) : ?> <?php $fields = $this->form->getFieldset($group); ?> <?php if (count($fields)) : ?> <fieldset id="users-profile-custom-<?php echo $group; ?>" class="users-profile-custom-<?php echo $group; ?>"> <?php if (isset($fieldset->label) && ($legend = trim(JText::_($fieldset->label))) !== '') : ?> <legend><?php echo $legend; ?></legend> <?php endif; ?> <?php if (isset($fieldset->description) && trim($fieldset->description)) : ?> <p><?php echo $this->escape(JText::_($fieldset->description)); ?></p> <?php endif; ?> <dl class="dl-horizontal"> <?php foreach ($fields as $field) : ?> <?php if (!$field->hidden && $field->type !== 'Spacer') : ?> <dt> <?php echo $field->title; ?> </dt> <dd> <?php if (key_exists($field->fieldname, $customFields)) : ?> <?php echo strlen($customFields[$field->fieldname]->value) ? $customFields[$field->fieldname]->value : JText::_('COM_USERS_PROFILE_VALUE_NOT_FOUND'); ?> <?php elseif (JHtml::isRegistered('users.' . $field->id)) : ?> <?php echo JHtml::_('users.' . $field->id, $field->value); ?> <?php elseif (JHtml::isRegistered('users.' . $field->fieldname)) : ?> <?php echo JHtml::_('users.' . $field->fieldname, $field->value); ?> <?php elseif (JHtml::isRegistered('users.' . $field->type)) : ?> <?php echo JHtml::_('users.' . $field->type, $field->value); ?> <?php else : ?> <?php echo JHtml::_('users.value', $field->value); ?> <?php endif; ?> </dd> <?php endif; ?> <?php endforeach; ?> </dl> </fieldset> <?php endif; ?> <?php endforeach; ?> views/profile/tmpl/default_core.php 0000604 00000002404 15242100514 0013450 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; ?> <fieldset id="users-profile-core"> <legend> <?php echo JText::_('COM_USERS_PROFILE_CORE_LEGEND'); ?> </legend> <dl class="dl-horizontal"> <dt> <?php echo JText::_('COM_USERS_PROFILE_NAME_LABEL'); ?> </dt> <dd> <?php echo $this->escape($this->data->name); ?> </dd> <dt> <?php echo JText::_('COM_USERS_PROFILE_USERNAME_LABEL'); ?> </dt> <dd> <?php echo $this->escape($this->data->username); ?> </dd> <dt> <?php echo JText::_('COM_USERS_PROFILE_REGISTERED_DATE_LABEL'); ?> </dt> <dd> <?php echo JHtml::_('date', $this->data->registerDate, JText::_('DATE_FORMAT_LC1')); ?> </dd> <dt> <?php echo JText::_('COM_USERS_PROFILE_LAST_VISITED_DATE_LABEL'); ?> </dt> <?php if ($this->data->lastvisitDate != $this->db->getNullDate()) : ?> <dd> <?php echo JHtml::_('date', $this->data->lastvisitDate, JText::_('DATE_FORMAT_LC1')); ?> </dd> <?php else : ?> <dd> <?php echo JText::_('COM_USERS_PROFILE_NEVER_VISITED'); ?> </dd> <?php endif; ?> </dl> </fieldset> views/profile/view.html.php 0000604 00000010175 15242100514 0011761 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Profile view class for Users. * * @since 1.6 */ class UsersViewProfile extends JViewLegacy { protected $data; protected $form; protected $params; protected $state; /** * An instance of JDatabaseDriver. * * @var JDatabaseDriver * @since 3.6.3 */ protected $db; /** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise an Error object. * * @since 1.6 */ public function display($tpl = null) { $user = JFactory::getUser(); // Get the view data. $this->data = $this->get('Data'); $this->form = $this->getModel()->getForm(new JObject(array('id' => $user->id))); $this->state = $this->get('State'); $this->params = $this->state->get('params'); $this->twofactorform = $this->get('Twofactorform'); $this->twofactormethods = UsersHelper::getTwoFactorMethods(); $this->otpConfig = $this->get('OtpConfig'); $this->db = JFactory::getDbo(); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } // View also takes responsibility for checking if the user logged in with remember me. $cookieLogin = $user->get('cookieLogin'); if (!empty($cookieLogin)) { // If so, the user must login to edit the password and other data. // What should happen here? Should we force a logout which destroys the cookies? $app = JFactory::getApplication(); $app->enqueueMessage(JText::_('JGLOBAL_REMEMBER_MUST_LOGIN'), 'message'); $app->redirect(JRoute::_('index.php?option=com_users&view=login', false)); return false; } // Check if a user was found. if (!$this->data->id) { JError::raiseError(404, JText::_('JERROR_USERS_PROFILE_NOT_FOUND')); return false; } JPluginHelper::importPlugin('content'); $this->data->text = ''; JEventDispatcher::getInstance()->trigger('onContentPrepare', array ('com_users.user', &$this->data, &$this->data->params, 0)); unset($this->data->text); // Check for layout override $active = JFactory::getApplication()->getMenu()->getActive(); if (isset($active->query['layout'])) { $this->setLayout($active->query['layout']); } // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx', '')); $this->prepareDocument(); return parent::display($tpl); } /** * Prepares the document * * @return void * * @since 1.6 */ protected function prepareDocument() { $app = JFactory::getApplication(); $menus = $app->getMenu(); $user = JFactory::getUser(); $title = null; // Because the application sets a default page title, // we need to get it from the menu item itself $menu = $menus->getActive(); if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $user->name)); } else { $this->params->def('page_heading', JText::_('COM_USERS_PROFILE')); } $title = $this->params->get('page_title', ''); if (empty($title)) { $title = $app->get('sitename'); } elseif ($app->get('sitename_pagetitles', 0) == 1) { $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title); } elseif ($app->get('sitename_pagetitles', 0) == 2) { $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename')); } $this->document->setTitle($title); if ($this->params->get('menu-meta_description')) { $this->document->setDescription($this->params->get('menu-meta_description')); } if ($this->params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); } if ($this->params->get('robots')) { $this->document->setMetadata('robots', $this->params->get('robots')); } } } views/registration/view.html.php 0000604 00000005306 15242100514 0013033 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Registration view class for Users. * * @since 1.6 */ class UsersViewRegistration extends JViewLegacy { protected $data; protected $form; protected $params; protected $state; public $document; /** * Method to display the view. * * @param string $tpl The template file to include * * @return mixed * * @since 1.6 */ public function display($tpl = null) { // Get the view data. $this->form = $this->get('Form'); $this->data = $this->get('Data'); $this->state = $this->get('State'); $this->params = $this->state->get('params'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } // Check for layout override $active = JFactory::getApplication()->getMenu()->getActive(); if (isset($active->query['layout'])) { $this->setLayout($active->query['layout']); } // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx', ''), ENT_COMPAT, 'UTF-8'); $this->prepareDocument(); return parent::display($tpl); } /** * Prepares the document. * * @return void * * @since 1.6 */ protected function prepareDocument() { $app = JFactory::getApplication(); $menus = $app->getMenu(); $title = null; // Because the application sets a default page title, // we need to get it from the menu item itself $menu = $menus->getActive(); if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } else { $this->params->def('page_heading', JText::_('COM_USERS_REGISTRATION')); } $title = $this->params->get('page_title', ''); if (empty($title)) { $title = $app->get('sitename'); } elseif ($app->get('sitename_pagetitles', 0) == 1) { $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title); } elseif ($app->get('sitename_pagetitles', 0) == 2) { $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename')); } $this->document->setTitle($title); if ($this->params->get('menu-meta_description')) { $this->document->setDescription($this->params->get('menu-meta_description')); } if ($this->params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); } if ($this->params->get('robots')) { $this->document->setMetadata('robots', $this->params->get('robots')); } } } views/registration/tmpl/complete.php 0000604 00000000754 15242100514 0013704 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; ?> <div class="registration-complete<?php echo $this->pageclass_sfx; ?>"> <?php if ($this->params->get('show_page_heading')) : ?> <h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1> <?php endif; ?> </div> views/registration/tmpl/index.html 0000705 00000000037 15242100514 0013354 0 ustar 00 <!DOCTYPE html><title></title> views/registration/tmpl/default.php 0000604 00000003543 15242100514 0013517 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::_('behavior.keepalive'); JHtml::_('behavior.formvalidator'); ?> <div class="registration<?php echo $this->pageclass_sfx; ?>"> <?php if ($this->params->get('show_page_heading')) : ?> <div class="page-header"> <h1><?php echo $this->escape($this->params->get('page_heading')); ?></h1> </div> <?php endif; ?> <form id="member-registration" action="<?php echo JRoute::_('index.php?option=com_users&task=registration.register'); ?>" method="post" class="form-validate form-horizontal well" enctype="multipart/form-data"> <?php // Iterate through the form fieldsets and display each one. ?> <?php foreach ($this->form->getFieldsets() as $fieldset) : ?> <?php $fields = $this->form->getFieldset($fieldset->name); ?> <?php if (count($fields)) : ?> <fieldset> <?php // If the fieldset has a label set, display it as the legend. ?> <?php if (isset($fieldset->label)) : ?> <legend><?php echo JText::_($fieldset->label); ?></legend> <?php endif; ?> <?php echo $this->form->renderFieldset($fieldset->name); ?> </fieldset> <?php endif; ?> <?php endforeach; ?> <div class="control-group"> <div class="controls"> <button type="submit" class="btn btn-primary validate"> <?php echo JText::_('JREGISTER'); ?> </button> <a class="btn" href="<?php echo JRoute::_(''); ?>" title="<?php echo JText::_('JCANCEL'); ?>"> <?php echo JText::_('JCANCEL'); ?> </a> <input type="hidden" name="option" value="com_users" /> <input type="hidden" name="task" value="registration.register" /> </div> </div> <?php echo JHtml::_('form.token'); ?> </form> </div> views/registration/tmpl/default.xml 0000604 00000000505 15242100514 0013523 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <metadata> <layout title="COM_USER_REGISTRATION_VIEW_DEFAULT_TITLE" option="COM_USER_REGISTRATION_VIEW_DEFAULT_OPTION"> <help key="JHELP_MENUS_MENU_ITEM_USER_REGISTRATION" /> <message> <![CDATA[COM_USER_REGISTRATION_VIEW_DEFAULT_DESC]]> </message> </layout> </metadata> views/registration/index.html 0000705 00000000037 15242100514 0012400 0 ustar 00 <!DOCTYPE html><title></title> views/reset/view.html.php 0000604 00000005402 15242100514 0011440 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Reset view class for Users. * * @since 1.5 */ class UsersViewReset extends JViewLegacy { protected $form; protected $params; protected $state; /** * Method to display the view. * * @param string $tpl The template file to include * * @return mixed * * @since 1.5 */ public function display($tpl = null) { // This name will be used to get the model $name = $this->getLayout(); // Check that the name is valid - has an associated model. if (!in_array($name, array('confirm', 'complete'))) { $name = 'default'; } if ('default' === $name) { $formname = 'Form'; } else { $formname = ucfirst($this->_name) . ucfirst($name) . 'Form'; } // Get the view data. $this->form = $this->get($formname); $this->state = $this->get('State'); $this->params = $this->state->params; // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx', ''), ENT_COMPAT, 'UTF-8'); $this->prepareDocument(); parent::display($tpl); } /** * Prepares the document. * * @return void * * @since 1.6 */ protected function prepareDocument() { $app = JFactory::getApplication(); $menus = $app->getMenu(); $title = null; // Because the application sets a default page title, // we need to get it from the menu item itself $menu = $menus->getActive(); if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } else { $this->params->def('page_heading', JText::_('COM_USERS_RESET')); } $title = $this->params->get('page_title', ''); if (empty($title)) { $title = $app->get('sitename'); } elseif ($app->get('sitename_pagetitles', 0) == 1) { $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title); } elseif ($app->get('sitename_pagetitles', 0) == 2) { $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename')); } $this->document->setTitle($title); if ($this->params->get('menu-meta_description')) { $this->document->setDescription($this->params->get('menu-meta_description')); } if ($this->params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); } if ($this->params->get('robots')) { $this->document->setMetadata('robots', $this->params->get('robots')); } } } views/reset/index.html 0000705 00000000037 15242100514 0011010 0 ustar 00 <!DOCTYPE html><title></title> views/reset/tmpl/confirm.php 0000604 00000002375 15242100514 0012142 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::_('behavior.keepalive'); JHtml::_('behavior.formvalidator'); ?> <div class="reset-confirm<?php echo $this->pageclass_sfx; ?>"> <?php if ($this->params->get('show_page_heading')) : ?> <div class="page-header"> <h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1> </div> <?php endif; ?> <form action="<?php echo JRoute::_('index.php?option=com_users&task=reset.confirm'); ?>" method="post" class="form-validate form-horizontal well"> <?php foreach ($this->form->getFieldsets() as $fieldset) : ?> <fieldset> <?php if (isset($fieldset->label)) : ?> <p><?php echo JText::_($fieldset->label); ?></p> <?php endif; ?> <?php echo $this->form->renderFieldset($fieldset->name); ?> </fieldset> <?php endforeach; ?> <div class="control-group"> <div class="controls"> <button type="submit" class="btn btn-primary validate"> <?php echo JText::_('JSUBMIT'); ?> </button> </div> </div> <?php echo JHtml::_('form.token'); ?> </form> </div> views/reset/tmpl/complete.php 0000604 00000002377 15242100514 0012317 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::_('behavior.keepalive'); JHtml::_('behavior.formvalidator'); ?> <div class="reset-complete<?php echo $this->pageclass_sfx; ?>"> <?php if ($this->params->get('show_page_heading')) : ?> <div class="page-header"> <h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1> </div> <?php endif; ?> <form action="<?php echo JRoute::_('index.php?option=com_users&task=reset.complete'); ?>" method="post" class="form-validate form-horizontal well"> <?php foreach ($this->form->getFieldsets() as $fieldset) : ?> <fieldset> <?php if (isset($fieldset->label)) : ?> <p><?php echo JText::_($fieldset->label); ?></p> <?php endif; ?> <?php echo $this->form->renderFieldset($fieldset->name); ?> </fieldset> <?php endforeach; ?> <div class="control-group"> <div class="controls"> <button type="submit" class="btn btn-primary validate"> <?php echo JText::_('JSUBMIT'); ?> </button> </div> </div> <?php echo JHtml::_('form.token'); ?> </form> </div> views/reset/tmpl/default.php 0000604 00000002414 15242100514 0012123 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::_('behavior.keepalive'); JHtml::_('behavior.formvalidator'); ?> <div class="reset<?php echo $this->pageclass_sfx; ?>"> <?php if ($this->params->get('show_page_heading')) : ?> <div class="page-header"> <h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1> </div> <?php endif; ?> <form id="user-registration" action="<?php echo JRoute::_('index.php?option=com_users&task=reset.request'); ?>" method="post" class="form-validate form-horizontal well"> <?php foreach ($this->form->getFieldsets() as $fieldset) : ?> <fieldset> <?php if (isset($fieldset->label)) : ?> <p><?php echo JText::_($fieldset->label); ?></p> <?php endif; ?> <?php echo $this->form->renderFieldset($fieldset->name); ?> </fieldset> <?php endforeach; ?> <div class="control-group"> <div class="controls"> <button type="submit" class="btn btn-primary validate"> <?php echo JText::_('JSUBMIT'); ?> </button> </div> </div> <?php echo JHtml::_('form.token'); ?> </form> </div> views/reset/tmpl/default.xml 0000604 00000000462 15242100514 0012135 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <metadata> <layout title="COM_USER_RESET_VIEW_DEFAULT_TITLE" option="COM_USER_RESET_VIEW_DEFAULT_OPTION"> <help key="JHELP_MENUS_MENU_ITEM_USER_PASSWORD_RESET" /> <message> <![CDATA[COM_USER_RESET_VIEW_DEFAULT_DESC]]> </message> </layout> </metadata> views/reset/tmpl/index.html 0000705 00000000037 15242100514 0011764 0 ustar 00 <!DOCTYPE html><title></title> views/index.html 0000705 00000000037 15242100514 0007666 0 ustar 00 <!DOCTYPE html><title></title> index.html 0000705 00000000037 15242100514 0006531 0 ustar 00 <!DOCTYPE html><title></title> models/login.php 0000604 00000005245 15242100514 0007644 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Rest model class for Users. * * @since 1.6 */ class UsersModelLogin extends JModelForm { /** * Method to get the login form. * * The base form is loaded from XML and then an event is fired * for users plugins to extend the form with extra fields. * * @param array $data An optional array of data for the form to interrogate. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return JForm A JForm object on success, false on failure * * @since 1.6 */ public function getForm($data = array(), $loadData = true) { // Get the form. $form = $this->loadForm('com_users.login', 'login', array('load_data' => $loadData)); if (empty($form)) { return false; } return $form; } /** * Method to get the data that should be injected in the form. * * @return array The default data is an empty array. * * @since 1.6 */ protected function loadFormData() { // Check the session for previously entered login form data. $app = JFactory::getApplication(); $data = $app->getUserState('users.login.form.data', array()); $input = $app->input->getInputForRequestMethod(); // Check for return URL from the request first if ($return = $input->get('return', '', 'BASE64')) { $data['return'] = base64_decode($return); if (!JUri::isInternal($data['return'])) { $data['return'] = ''; } } $app->setUserState('users.login.form.data', $data); $this->preprocessData('com_users.login', $data); return $data; } /** * Method to auto-populate the model state. * * Calling getState in this method will result in recursion. * * @return void * * @since 1.6 */ protected function populateState() { // Get the application object. $params = JFactory::getApplication()->getParams('com_users'); // Load the parameters. $this->setState('params', $params); } /** * Override JModelAdmin::preprocessForm to ensure the correct plugin group is loaded. * * @param JForm $form A JForm object. * @param mixed $data The data expected for the form. * @param string $group The name of the plugin group to import (defaults to "content"). * * @return void * * @since 1.6 * @throws Exception if there is an error in the form event. */ protected function preprocessForm(JForm $form, $data, $group = 'user') { parent::preprocessForm($form, $data, $group); } } models/reset.php 0000604 00000030677 15242100514 0007665 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\User\UserHelper; defined('_JEXEC') or die; /** * Rest model class for Users. * * @since 1.5 */ class UsersModelReset extends JModelForm { /** * Method to get the password reset request form. * * The base form is loaded from XML and then an event is fired * for users plugins to extend the form with extra fields. * * @param array $data An optional array of data for the form to interrogate. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return JForm A JForm object on success, false on failure * * @since 1.6 */ public function getForm($data = array(), $loadData = true) { // Get the form. $form = $this->loadForm('com_users.reset_request', 'reset_request', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) { return false; } return $form; } /** * Method to get the password reset complete form. * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return JForm A JForm object on success, false on failure * * @since 1.6 */ public function getResetCompleteForm($data = array(), $loadData = true) { // Get the form. $form = $this->loadForm('com_users.reset_complete', 'reset_complete', $options = array('control' => 'jform')); if (empty($form)) { return false; } return $form; } /** * Method to get the password reset confirm form. * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return JForm A JForm object on success, false on failure * * @since 1.6 */ public function getResetConfirmForm($data = array(), $loadData = true) { // Get the form. $form = $this->loadForm('com_users.reset_confirm', 'reset_confirm', $options = array('control' => 'jform')); if (empty($form)) { return false; } else { $form->setValue('token', '', JFactory::getApplication()->input->get('token')); } return $form; } /** * Override preprocessForm to load the user plugin group instead of content. * * @param JForm $form A JForm object. * @param mixed $data The data expected for the form. * @param string $group The name of the plugin group to import (defaults to "content"). * * @return void * * @throws Exception if there is an error in the form event. * * @since 1.6 */ protected function preprocessForm(JForm $form, $data, $group = 'user') { parent::preprocessForm($form, $data, $group); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * * @since 1.6 */ protected function populateState() { // Get the application object. $params = JFactory::getApplication()->getParams('com_users'); // Load the parameters. $this->setState('params', $params); } /** * Save the new password after reset is done * * @param array $data The data expected for the form. * * @return mixed Exception | JException | boolean * * @since 1.6 */ public function processResetComplete($data) { // Get the form. $form = $this->getResetCompleteForm(); // Check for an error. if ($form instanceof Exception) { return $form; } // Filter and validate the form data. $data = $form->filter($data); $return = $form->validate($data); // Check for an error. if ($return instanceof Exception) { return $return; } // Check the validation results. if ($return === false) { // Get the validation messages from the form. foreach ($form->getErrors() as $formError) { $this->setError($formError->getMessage()); } return false; } // Get the token and user id from the confirmation process. $app = JFactory::getApplication(); $token = $app->getUserState('com_users.reset.token', null); $userId = $app->getUserState('com_users.reset.user', null); // Check the token and user id. if (empty($token) || empty($userId)) { return new JException(JText::_('COM_USERS_RESET_COMPLETE_TOKENS_MISSING'), 403); } // Get the user object. $user = JUser::getInstance($userId); // Check for a user and that the tokens match. if (empty($user) || $user->activation !== $token) { $this->setError(JText::_('COM_USERS_USER_NOT_FOUND')); return false; } // Make sure the user isn't blocked. if ($user->block) { $this->setError(JText::_('COM_USERS_USER_BLOCKED')); return false; } // Check if the user is reusing the current password if required to reset their password if ($user->requireReset == 1 && JUserHelper::verifyPassword($data['password1'], $user->password)) { $this->setError(JText::_('JLIB_USER_ERROR_CANNOT_REUSE_PASSWORD')); return false; } // Prepare user data. $data['password'] = $data['password1']; $data['activation'] = ''; // Update the user object. if (!$user->bind($data)) { return new \Exception($user->getError(), 500); } // Save the user to the database. if (!$user->save(true)) { return new JException(JText::sprintf('COM_USERS_USER_SAVE_FAILED', $user->getError()), 500); } // Destroy all active sessions for the user UserHelper::destroyUserSessions($user->id); // Flush the user data from the session. $app->setUserState('com_users.reset.token', null); $app->setUserState('com_users.reset.user', null); return true; } /** * Receive the reset password request * * @param array $data The data expected for the form. * * @return mixed Exception | JException | boolean * * @since 1.6 */ public function processResetConfirm($data) { // Get the form. $form = $this->getResetConfirmForm(); // Check for an error. if ($form instanceof Exception) { return $form; } // Filter and validate the form data. $data = $form->filter($data); $return = $form->validate($data); // Check for an error. if ($return instanceof Exception) { return $return; } // Check the validation results. if ($return === false) { // Get the validation messages from the form. foreach ($form->getErrors() as $formError) { $this->setError($formError->getMessage()); } return false; } // Find the user id for the given token. $db = $this->getDbo(); $query = $db->getQuery(true) ->select('activation') ->select('id') ->select('block') ->from($db->quoteName('#__users')) ->where($db->quoteName('username') . ' = ' . $db->quote($data['username'])); // Get the user id. $db->setQuery($query); try { $user = $db->loadObject(); } catch (RuntimeException $e) { return new JException(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500); } // Check for a user. if (empty($user)) { $this->setError(JText::_('COM_USERS_USER_NOT_FOUND')); return false; } if (!$user->activation) { $this->setError(JText::_('COM_USERS_USER_NOT_FOUND')); return false; } // Verify the token if (!JUserHelper::verifyPassword($data['token'], $user->activation)) { $this->setError(JText::_('COM_USERS_USER_NOT_FOUND')); return false; } // Make sure the user isn't blocked. if ($user->block) { $this->setError(JText::_('COM_USERS_USER_BLOCKED')); return false; } // Push the user data into the session. $app = JFactory::getApplication(); $app->setUserState('com_users.reset.token', $user->activation); $app->setUserState('com_users.reset.user', $user->id); return true; } /** * Method to start the password reset process. * * @param array $data The data expected for the form. * * @return mixed Exception | JException | boolean * * @since 1.6 */ public function processResetRequest($data) { $config = JFactory::getConfig(); // Get the form. $form = $this->getForm(); $data['email'] = JStringPunycode::emailToPunycode($data['email']); // Check for an error. if ($form instanceof Exception) { return $form; } // Filter and validate the form data. $data = $form->filter($data); $return = $form->validate($data); // Check for an error. if ($return instanceof Exception) { return $return; } // Check the validation results. if ($return === false) { // Get the validation messages from the form. foreach ($form->getErrors() as $formError) { $this->setError($formError->getMessage()); } return false; } // Find the user id for the given email address. $db = $this->getDbo(); $query = $db->getQuery(true) ->select('id') ->from($db->quoteName('#__users')) ->where('LOWER(' . $db->quoteName('email') . ') = LOWER(' . $db->quote($data['email']) . ')'); // Get the user object. $db->setQuery($query); try { $userId = $db->loadResult(); } catch (RuntimeException $e) { $this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500); return false; } // Check for a user. if (empty($userId)) { $this->setError(JText::_('COM_USERS_INVALID_EMAIL')); return false; } // Get the user object. $user = JUser::getInstance($userId); // Make sure the user isn't blocked. if ($user->block) { $this->setError(JText::_('COM_USERS_USER_BLOCKED')); return false; } // Make sure the user isn't a Super Admin. if ($user->authorise('core.admin')) { $this->setError(JText::_('COM_USERS_REMIND_SUPERADMIN_ERROR')); return false; } // Make sure the user has not exceeded the reset limit if (!$this->checkResetLimit($user)) { $resetLimit = (int) JFactory::getApplication()->getParams()->get('reset_time'); $this->setError(JText::plural('COM_USERS_REMIND_LIMIT_ERROR_N_HOURS', $resetLimit)); return false; } // Set the confirmation token. $token = JApplicationHelper::getHash(JUserHelper::genRandomPassword()); $hashedToken = JUserHelper::hashPassword($token); $user->activation = $hashedToken; // Save the user to the database. if (!$user->save(true)) { return new JException(JText::sprintf('COM_USERS_USER_SAVE_FAILED', $user->getError()), 500); } // Assemble the password reset confirmation link. $mode = $config->get('force_ssl', 0) == 2 ? 1 : (-1); $link = 'index.php?option=com_users&view=reset&layout=confirm&token=' . $token; // Put together the email template data. $data = $user->getProperties(); $data['fromname'] = $config->get('fromname'); $data['mailfrom'] = $config->get('mailfrom'); $data['sitename'] = $config->get('sitename'); $data['link_text'] = JRoute::_($link, false, $mode); $data['link_html'] = JRoute::_($link, true, $mode); $data['token'] = $token; $subject = JText::sprintf( 'COM_USERS_EMAIL_PASSWORD_RESET_SUBJECT', $data['sitename'] ); $body = JText::sprintf( 'COM_USERS_EMAIL_PASSWORD_RESET_BODY', $data['sitename'], $data['token'], $data['link_text'] ); // Send the password reset request email. $return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $user->email, $subject, $body); // Check for an error. if ($return !== true) { return new JException(JText::_('COM_USERS_MAIL_FAILED'), 500); } return true; } /** * Method to check if user reset limit has been exceeded within the allowed time period. * * @param JUser $user User doing the password reset * * @return boolean true if user can do the reset, false if limit exceeded * * @since 2.5 */ public function checkResetLimit($user) { $params = JFactory::getApplication()->getParams(); $maxCount = (int) $params->get('reset_count'); $resetHours = (int) $params->get('reset_time'); $result = true; $lastResetTime = strtotime($user->lastResetTime) ?: 0; $hoursSinceLastReset = (strtotime(JFactory::getDate()->toSql()) - $lastResetTime) / 3600; if ($hoursSinceLastReset > $resetHours) { // If it's been long enough, start a new reset count $user->lastResetTime = JFactory::getDate()->toSql(); $user->resetCount = 1; } elseif ($user->resetCount < $maxCount) { // If we are under the max count, just increment the counter ++$user->resetCount; } else { // At this point, we know we have exceeded the maximum resets for the time period $result = false; } return $result; } } models/rules/logoutuniquefield.php 0000604 00000004116 15242100514 0013426 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('JPATH_PLATFORM') or die; use Joomla\Registry\Registry; /** * JFormRule for com_users to be sure only one redirect logout field has a value * * @since 3.6 */ class JFormRuleLogoutUniqueField extends JFormRule { /** * Method to test if two fields have a value in order to use only one field. * To use this rule, the form * XML needs a validate attribute of logoutuniquefield and a field attribute * that is equal to the field to test against. * * @param SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object. * @param mixed $value The form field value to validate. * @param string $group The field name group control value. This acts as an array container for the field. * For example if the field has name="foo" and the group value is set to "bar" then the * full field name would end up being "bar[foo]". * @param Registry $input An optional Registry object with the entire data set to validate against the entire form. * @param JForm $form The form object for which the field is being tested. * * @return boolean True if the value is valid, false otherwise. * * @since 3.6 */ public function test(SimpleXMLElement $element, $value, $group = null, Registry $input = null, JForm $form = null) { $logoutRedirectUrl = $input['params']->logout_redirect_url; $logoutRedirectMenuitem = $input['params']->logout_redirect_menuitem; if ($form === null) { throw new InvalidArgumentException(sprintf('The value for $form must not be null in %s', get_class($this))); } if ($input === null) { throw new InvalidArgumentException(sprintf('The value for $input must not be null in %s', get_class($this))); } return true; } } models/rules/loginuniquefield.php 0000604 00000004111 15242100514 0013220 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('JPATH_PLATFORM') or die; use Joomla\Registry\Registry; /** * JFormRule for com_users to be sure only one redirect login field has a value * * @since 3.6 */ class JFormRuleLoginUniqueField extends JFormRule { /** * Method to test if two fields have a value in order to use only one field. * To use this rule, the form * XML needs a validate attribute of loginuniquefield and a field attribute * that is equal to the field to test against. * * @param SimpleXMLElement $element The SimpleXMLElement object representing the `<field>` tag for the form field object. * @param mixed $value The form field value to validate. * @param string $group The field name group control value. This acts as an array container for the field. * For example if the field has name="foo" and the group value is set to "bar" then the * full field name would end up being "bar[foo]". * @param Registry $input An optional Registry object with the entire data set to validate against the entire form. * @param JForm $form The form object for which the field is being tested. * * @return boolean True if the value is valid, false otherwise. * * @since 3.6 */ public function test(SimpleXMLElement $element, $value, $group = null, Registry $input = null, JForm $form = null) { $loginRedirectUrl = $input['params']->login_redirect_url; $loginRedirectMenuitem = $input['params']->login_redirect_menuitem; if ($form === null) { throw new InvalidArgumentException(sprintf('The value for $form must not be null in %s', get_class($this))); } if ($input === null) { throw new InvalidArgumentException(sprintf('The value for $input must not be null in %s', get_class($this))); } return true; } } models/profile.php 0000604 00000026153 15242100514 0010175 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\User\UserHelper; use Joomla\Registry\Registry; /** * Profile model class for Users. * * @since 1.6 */ class UsersModelProfile extends JModelForm { /** * @var object The user profile data. * @since 1.6 */ protected $data; /** * Constructor * * @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request). * * @since 3.2 * * @throws Exception */ public function __construct($config = array()) { $config = array_merge( array( 'events_map' => array('validate' => 'user') ), $config ); parent::__construct($config); // Load the helper and model used for two factor authentication JLoader::register('UsersModelUser', JPATH_ADMINISTRATOR . '/components/com_users/models/user.php'); JLoader::register('UsersHelper', JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php'); } /** * Method to check in a user. * * @param integer $userId The id of the row to check out. * * @return boolean True on success, false on failure. * * @since 1.6 */ public function checkin($userId = null) { // Get the user id. $userId = (!empty($userId)) ? $userId : (int) $this->getState('user.id'); if ($userId) { // Initialise the table with JUser. $table = JTable::getInstance('User'); // Attempt to check the row in. if (!$table->checkin($userId)) { $this->setError($table->getError()); return false; } } return true; } /** * Method to check out a user for editing. * * @param integer $userId The id of the row to check out. * * @return boolean True on success, false on failure. * * @since 1.6 */ public function checkout($userId = null) { // Get the user id. $userId = (!empty($userId)) ? $userId : (int) $this->getState('user.id'); if ($userId) { // Initialise the table with JUser. $table = JTable::getInstance('User'); // Get the current user object. $user = JFactory::getUser(); // Attempt to check the row out. if (!$table->checkout($user->get('id'), $userId)) { $this->setError($table->getError()); return false; } } return true; } /** * Method to get the profile form data. * * The base form data is loaded and then an event is fired * for users plugins to extend the data. * * @return mixed Data object on success, false on failure. * * @since 1.6 */ public function getData() { if ($this->data === null) { $userId = $this->getState('user.id'); // Initialise the table with JUser. $this->data = new JUser($userId); // Set the base user data. $this->data->email1 = $this->data->get('email'); $this->data->email2 = $this->data->get('email'); // Override the base user data with any data in the session. $temp = (array) JFactory::getApplication()->getUserState('com_users.edit.profile.data', array()); foreach ($temp as $k => $v) { $this->data->$k = $v; } // Unset the passwords. unset($this->data->password1, $this->data->password2); $registry = new Registry($this->data->params); $this->data->params = $registry->toArray(); } return $this->data; } /** * Method to get the profile form. * * The base form is loaded from XML and then an event is fired * for users plugins to extend the form with extra fields. * * @param array $data An optional array of data for the form to interrogate. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return JForm A JForm object on success, false on failure * * @since 1.6 */ public function getForm($data = array(), $loadData = true) { // Get the form. $form = $this->loadForm('com_users.profile', 'profile', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) { return false; } // Check for username compliance and parameter set $isUsernameCompliant = true; $username = $loadData ? $form->getValue('username') : $this->loadFormData()->username; if ($username) { $isUsernameCompliant = !(preg_match('#[<>"\'%;()&\\\\]|\\.\\./#', $username) || strlen(utf8_decode($username)) < 2 || trim($username) !== $username); } $this->setState('user.username.compliant', $isUsernameCompliant); if ($isUsernameCompliant && !JComponentHelper::getParams('com_users')->get('change_login_name')) { $form->setFieldAttribute('username', 'class', ''); $form->setFieldAttribute('username', 'filter', ''); $form->setFieldAttribute('username', 'description', 'COM_USERS_PROFILE_NOCHANGE_USERNAME_DESC'); $form->setFieldAttribute('username', 'validate', ''); $form->setFieldAttribute('username', 'message', ''); $form->setFieldAttribute('username', 'readonly', 'true'); $form->setFieldAttribute('username', 'required', 'false'); } // When multilanguage is set, a user's default site language should also be a Content Language if (JLanguageMultilang::isEnabled()) { $form->setFieldAttribute('language', 'type', 'frontend_language', 'params'); } // If the user needs to change their password, mark the password fields as required if (JFactory::getUser()->requireReset) { $form->setFieldAttribute('password1', 'required', 'true'); $form->setFieldAttribute('password2', 'required', 'true'); } return $form; } /** * Method to get the data that should be injected in the form. * * @return mixed The data for the form. * * @since 1.6 */ protected function loadFormData() { $data = $this->getData(); $this->preprocessData('com_users.profile', $data, 'user'); return $data; } /** * Override preprocessForm to load the user plugin group instead of content. * * @param JForm $form A JForm object. * @param mixed $data The data expected for the form. * @param string $group The name of the plugin group to import (defaults to "content"). * * @return void * * @throws Exception if there is an error in the form event. * * @since 1.6 */ protected function preprocessForm(JForm $form, $data, $group = 'user') { if (JComponentHelper::getParams('com_users')->get('frontend_userparams')) { $form->loadFile('frontend', false); if (JFactory::getUser()->authorise('core.login.admin')) { $form->loadFile('frontend_admin', false); } } parent::preprocessForm($form, $data, $group); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * * @since 1.6 */ protected function populateState() { // Get the application object. $params = JFactory::getApplication()->getParams('com_users'); // Get the user id. $userId = JFactory::getApplication()->getUserState('com_users.edit.profile.id'); $userId = !empty($userId) ? $userId : (int) JFactory::getUser()->get('id'); // Set the user id. $this->setState('user.id', $userId); // Load the parameters. $this->setState('params', $params); } /** * Method to save the form data. * * @param array $data The form data. * * @return mixed The user id on success, false on failure. * * @since 1.6 */ public function save($data) { $userId = (!empty($data['id'])) ? $data['id'] : (int) $this->getState('user.id'); $user = new JUser($userId); // Prepare the data for the user object. $data['email'] = JStringPunycode::emailToPunycode($data['email1']); $data['password'] = $data['password1']; // Unset the username if it should not be overwritten $isUsernameCompliant = $this->getState('user.username.compliant'); if ($isUsernameCompliant && !JComponentHelper::getParams('com_users')->get('change_login_name')) { unset($data['username']); } // Unset block and sendEmail so they do not get overwritten unset($data['block'], $data['sendEmail']); // Handle the two factor authentication setup if (array_key_exists('twofactor', $data)) { $model = new UsersModelUser; $twoFactorMethod = $data['twofactor']['method']; // Get the current One Time Password (two factor auth) configuration $otpConfig = $model->getOtpConfig($userId); if ($twoFactorMethod !== 'none') { // Run the plugins FOFPlatform::getInstance()->importPlugin('twofactorauth'); $otpConfigReplies = FOFPlatform::getInstance()->runPlugins('onUserTwofactorApplyConfiguration', array($twoFactorMethod)); // Look for a valid reply foreach ($otpConfigReplies as $reply) { if (!is_object($reply) || empty($reply->method) || ($reply->method != $twoFactorMethod)) { continue; } $otpConfig->method = $reply->method; $otpConfig->config = $reply->config; break; } // Save OTP configuration. $model->setOtpConfig($userId, $otpConfig); // Generate one time emergency passwords if required (depleted or not set) if (empty($otpConfig->otep)) { $model->generateOteps($userId); } } else { $otpConfig->method = 'none'; $otpConfig->config = array(); $model->setOtpConfig($userId, $otpConfig); } // Unset the raw data unset($data['twofactor']); // Reload the user record with the updated OTP configuration $user->load($userId); } // Bind the data. if (!$user->bind($data)) { $this->setError(JText::sprintf('COM_USERS_PROFILE_BIND_FAILED', $user->getError())); return false; } // Load the users plugin group. JPluginHelper::importPlugin('user'); // Retrieve the user groups so they don't get overwritten unset($user->groups); $user->groups = JAccess::getGroupsByUser($user->id, false); // Store the data. if (!$user->save()) { $this->setError($user->getError()); return false; } // Destroy all active sessions for the user after changing the password if ($data['password']) { UserHelper::destroyUserSessions($user->id, true); } return $user->id; } /** * Gets the configuration forms for all two-factor authentication methods * in an array. * * @param integer $userId The user ID to load the forms for (optional) * * @return array * * @since 3.2 */ public function getTwofactorform($userId = null) { $userId = (!empty($userId)) ? $userId : (int) $this->getState('user.id'); $model = new UsersModelUser; $otpConfig = $model->getOtpConfig($userId); FOFPlatform::getInstance()->importPlugin('twofactorauth'); return FOFPlatform::getInstance()->runPlugins('onUserTwofactorShowConfiguration', array($otpConfig, $userId)); } /** * Returns the one time password (OTP) – a.k.a. two factor authentication – * configuration for a particular user. * * @param integer $userId The numeric ID of the user * * @return stdClass An object holding the OTP configuration for this user * * @since 3.2 */ public function getOtpConfig($userId = null) { $userId = (!empty($userId)) ? $userId : (int) $this->getState('user.id'); $model = new UsersModelUser; return $model->getOtpConfig($userId); } } models/remind.php 0000604 00000011063 15242100514 0010005 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * * @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Utilities\ArrayHelper; /** * Remind model class for Users. * * @since 1.5 */ class UsersModelRemind extends JModelForm { /** * Method to get the username remind request form. * * @param array $data An optional array of data for the form to interrogate. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return JFor A JForm object on success, false on failure * * @since 1.6 */ public function getForm($data = array(), $loadData = true) { // Get the form. $form = $this->loadForm('com_users.remind', 'remind', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) { return false; } return $form; } /** * Override preprocessForm to load the user plugin group instead of content. * * @param JForm $form A JForm object. * @param mixed $data The data expected for the form. * @param string $group The name of the plugin group to import (defaults to "content"). * * @return void * * @throws Exception if there is an error in the form event. * * @since 1.6 */ protected function preprocessForm(JForm $form, $data, $group = 'user') { parent::preprocessForm($form, $data, 'user'); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * * @since 1.6 */ protected function populateState() { // Get the application object. $app = JFactory::getApplication(); $params = $app->getParams('com_users'); // Load the parameters. $this->setState('params', $params); } /** * Send the remind username email * * @param array $data Array with the data received from the form * * @return boolean * * @since 1.6 */ public function processRemindRequest($data) { // Get the form. $form = $this->getForm(); $data['email'] = JStringPunycode::emailToPunycode($data['email']); // Check for an error. if (empty($form)) { return false; } // Validate the data. $data = $this->validate($form, $data); // Check for an error. if ($data instanceof Exception) { return false; } // Check the validation results. if ($data === false) { // Get the validation messages from the form. foreach ($form->getErrors() as $formError) { $this->setError($formError->getMessage()); } return false; } // Find the user id for the given email address. $db = $this->getDbo(); $query = $db->getQuery(true) ->select('*') ->from($db->quoteName('#__users')) ->where('LOWER(' . $db->quoteName('email') . ') = LOWER(' . $db->quote($data['email']) . ')'); // Get the user id. $db->setQuery($query); try { $user = $db->loadObject(); } catch (RuntimeException $e) { $this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500); return false; } // Check for a user. if (empty($user)) { $this->setError(JText::_('COM_USERS_USER_NOT_FOUND')); return false; } // Make sure the user isn't blocked. if ($user->block) { $this->setError(JText::_('COM_USERS_USER_BLOCKED')); return false; } $config = JFactory::getConfig(); // Assemble the login link. $link = 'index.php?option=com_users&view=login'; $mode = $config->get('force_ssl', 0) == 2 ? 1 : (-1); // Put together the email template data. $data = ArrayHelper::fromObject($user); $data['fromname'] = $config->get('fromname'); $data['mailfrom'] = $config->get('mailfrom'); $data['sitename'] = $config->get('sitename'); $data['link_text'] = JRoute::_($link, false, $mode); $data['link_html'] = JRoute::_($link, true, $mode); $subject = JText::sprintf( 'COM_USERS_EMAIL_USERNAME_REMINDER_SUBJECT', $data['sitename'] ); $body = JText::sprintf( 'COM_USERS_EMAIL_USERNAME_REMINDER_BODY', $data['sitename'], $data['username'], $data['link_text'] ); // Send the password reset request email. $return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $user->email, $subject, $body); // Check for an error. if ($return !== true) { $this->setError(JText::_('COM_USERS_MAIL_FAILED'), 500); return false; } $dispatcher = \JEventDispatcher::getInstance(); $dispatcher->trigger('onUserAfterRemind', array($user)); return true; } } models/forms/sitelang.xml 0000604 00000000622 15242100514 0011473 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <form> <fields name="params"> <fieldset name="params" label="COM_USERS_SETTINGS_FIELDSET_LABEL"> <field name="language" type="language" label="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_LABEL" description="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_DESC" client="site" filter="cmd" default="active" /> </fieldset> </fields> </form>