Файловый менеджер - Редактировать - /home/wuectly/www/03cbe/com_users.tar
Назад
router.php 0000604 00000004411 15245530514 0006575 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; /** * Routing class from com_users * * @since 3.2 */ class UsersRouter extends JComponentRouterView { /** * Users Component router constructor * * @param JApplicationCms $app The application object * @param JMenu $menu The menu object to work with */ public function __construct($app = null, $menu = null) { $this->registerView(new JComponentRouterViewconfiguration('login')); $profile = new JComponentRouterViewconfiguration('profile'); $profile->addLayout('edit'); $this->registerView($profile); $this->registerView(new JComponentRouterViewconfiguration('registration')); $this->registerView(new JComponentRouterViewconfiguration('remind')); $this->registerView(new JComponentRouterViewconfiguration('reset')); parent::__construct($app, $menu); $this->attachRule(new JComponentRouterRulesMenu($this)); $params = JComponentHelper::getParams('com_users'); if ($params->get('sef_advanced', 0)) { $this->attachRule(new JComponentRouterRulesStandard($this)); $this->attachRule(new JComponentRouterRulesNomenu($this)); } else { JLoader::register('UsersRouterRulesLegacy', __DIR__ . '/helpers/legacyrouter.php'); $this->attachRule(new UsersRouterRulesLegacy($this)); } } } /** * Users router functions * * These functions are proxys for the new router interface * for old SEF extensions. * * @param array &$query REQUEST query * * @return array Segments of the SEF url * * @deprecated 4.0 Use Class based routers instead */ function usersBuildRoute(&$query) { $app = JFactory::getApplication(); $router = new UsersRouter($app, $app->getMenu()); return $router->build($query); } /** * Convert SEF URL segments into query variables * * @param array $segments Segments in the current URL * * @return array Query variables * * @deprecated 4.0 Use Class based routers instead */ function usersParseRoute($segments) { $app = JFactory::getApplication(); $router = new UsersRouter($app, $app->getMenu()); return $router->parse($segments); } views/login/view.html.php 0000604 00000005727 15245530514 0011452 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/login/tmpl/logout.xml 0000604 00000001757 15245530514 0012032 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_login.php 0000604 00000006356 15245530514 0013324 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="login<?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 (($this->params->get('logindescription_show') == 1 && str_replace(' ', '', $this->params->get('login_description')) != '') || $this->params->get('login_image') != '') : ?> <div class="login-description"> <?php endif; ?> <?php if ($this->params->get('logindescription_show') == 1) : ?> <?php echo $this->params->get('login_description'); ?> <?php endif; ?> <?php if ($this->params->get('login_image') != '') : ?> <img src="<?php echo $this->escape($this->params->get('login_image')); ?>" class="login-image" alt="<?php echo JText::_('COM_USERS_LOGIN_IMAGE_ALT'); ?>" /> <?php endif; ?> <?php if (($this->params->get('logindescription_show') == 1 && str_replace(' ', '', $this->params->get('login_description')) != '') || $this->params->get('login_image') != '') : ?> </div> <?php endif; ?> <form action="<?php echo JRoute::_('index.php?option=com_users&task=user.login'); ?>" method="post" class="form-validate form-horizontal well"> <fieldset> <?php echo $this->form->renderFieldset('credentials'); ?> <?php if ($this->tfa) : ?> <?php echo $this->form->renderField('secretkey'); ?> <?php endif; ?> <?php if (JPluginHelper::isEnabled('system', 'remember')) : ?> <div class="control-group"> <div class="control-label"> <label for="remember"> <?php echo JText::_('COM_USERS_LOGIN_REMEMBER_ME'); ?> </label> </div> <div class="controls"> <input id="remember" type="checkbox" name="remember" class="inputbox" value="yes" /> </div> </div> <?php endif; ?> <div class="control-group"> <div class="controls"> <button type="submit" class="btn btn-primary"> <?php echo JText::_('JLOGIN'); ?> </button> </div> </div> <?php $return = $this->form->getValue('return', '', $this->params->get('login_redirect_url', $this->params->get('login_redirect_menuitem'))); ?> <input type="hidden" name="return" value="<?php echo base64_encode($return); ?>" /> <?php echo JHtml::_('form.token'); ?> </fieldset> </form> </div> <div> <ul class="nav nav-tabs nav-stacked"> <li> <a href="<?php echo JRoute::_('index.php?option=com_users&view=reset'); ?>"> <?php echo JText::_('COM_USERS_LOGIN_RESET'); ?> </a> </li> <li> <a href="<?php echo JRoute::_('index.php?option=com_users&view=remind'); ?>"> <?php echo JText::_('COM_USERS_LOGIN_REMIND'); ?> </a> </li> <?php $usersConfig = JComponentHelper::getParams('com_users'); ?> <?php if ($usersConfig->get('allowUserRegistration')) : ?> <li> <a href="<?php echo JRoute::_('index.php?option=com_users&view=registration'); ?>"> <?php echo JText::_('COM_USERS_LOGIN_REGISTER'); ?> </a> </li> <?php endif; ?> </ul> </div> views/login/tmpl/default.php 0000604 00000001035 15245530514 0012121 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/tmpl/default.xml 0000604 00000010107 15245530514 0012132 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_logout.php 0000604 00000004212 15245530514 0013512 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="logout<?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 (($this->params->get('logoutdescription_show') == 1 && str_replace(' ', '', $this->params->get('logout_description')) != '')|| $this->params->get('logout_image') != '') : ?> <div class="logout-description"> <?php endif; ?> <?php if ($this->params->get('logoutdescription_show') == 1) : ?> <?php echo $this->params->get('logout_description'); ?> <?php endif; ?> <?php if ($this->params->get('logout_image') != '') : ?> <img src="<?php echo $this->escape($this->params->get('logout_image')); ?>" class="thumbnail pull-right logout-image" alt="<?php echo JText::_('COM_USER_LOGOUT_IMAGE_ALT'); ?>" /> <?php endif; ?> <?php if (($this->params->get('logoutdescription_show') == 1 && str_replace(' ', '', $this->params->get('logout_description')) != '')|| $this->params->get('logout_image') != '') : ?> </div> <?php endif; ?> <form action="<?php echo JRoute::_('index.php?option=com_users&task=user.logout'); ?>" method="post" class="form-horizontal well"> <div class="control-group"> <div class="controls"> <button type="submit" class="btn btn-primary"> <span class="icon-arrow-left icon-white"></span> <?php echo JText::_('JLOGOUT'); ?> </button> </div> </div> <?php if ($this->params->get('logout_redirect_url')) : ?> <input type="hidden" name="return" value="<?php echo base64_encode($this->params->get('logout_redirect_url', $this->form->getValue('return'))); ?>" /> <?php else : ?> <input type="hidden" name="return" value="<?php echo base64_encode($this->params->get('logout_redirect_menuitem', $this->form->getValue('return'))); ?>" /> <?php endif; ?> <?php echo JHtml::_('form.token'); ?> </form> </div> views/remind/view.html.php 0000604 00000005137 15245530514 0011613 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/remind/tmpl/default.php 0000604 00000002415 15245530514 0012272 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 15245530514 0012302 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/registration/tmpl/complete.php 0000604 00000000754 15245530514 0013716 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/default.xml 0000604 00000000505 15245530514 0013535 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/tmpl/default.php 0000604 00000003543 15245530514 0013531 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/view.html.php 0000604 00000005306 15245530514 0013045 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/reset/tmpl/default.php 0000604 00000002414 15245530514 0012135 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 15245530514 0012147 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/confirm.php 0000604 00000002375 15245530514 0012154 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 15245530514 0012331 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/view.html.php 0000604 00000005402 15245530514 0011452 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/profile/view.html.php 0000604 00000010175 15245530514 0011773 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/profile/tmpl/default_params.php 0000604 00000002446 15245530514 0014023 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/edit.xml 0000604 00000000470 15245530514 0011765 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/edit.php 0000604 00000013024 15245530514 0011753 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/default_custom.php 0000604 00000004607 15245530514 0014053 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.php 0000604 00000002026 15245530514 0012452 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.xml 0000604 00000000463 15245530514 0012466 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_core.php 0000604 00000002404 15245530514 0013462 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> layouts/joomla/form/renderfield.php 0000604 00000003530 15245530514 0013465 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage Layout * * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; extract($displayData); /** * Layout variables * --------------------- * $options : (array) Optional parameters * $label : (string) The html code for the label (not required if $options['hiddenLabel'] is true) * $input : (string) The input field html code */ if (!empty($options['showonEnabled'])) { JHtml::_('jquery.framework'); JHtml::_('script', 'jui/cms.js', array('version' => 'auto', 'relative' => true)); } $class = empty($options['class']) ? '' : ' ' . $options['class']; $rel = empty($options['rel']) ? '' : ' ' . $options['rel']; /** * @TODO: * * As mentioned in #8473 (https://github.com/joomla/joomla-cms/pull/8473), ... * as long as we cannot access the field properties properly, this seems to * be the way to go for now. * * On a side note: Parsing html is seldom a good idea. * https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 */ preg_match('/class=\"([^\"]+)\"/i', $input, $match); $required = (strpos($input, 'aria-required="true"') !== false || (!empty($match[1]) && strpos($match[1], 'required') !== false)); $typeOfSpacer = (strpos($label, 'spacer-lbl') !== false); ?> <div class="control-group<?php echo $class; ?>"<?php echo $rel; ?>> <?php if (empty($options['hiddenLabel'])): ?> <div class="control-label"> <?php echo $label; ?> <?php if (!$required && !$typeOfSpacer) : ?> <span class="optional"><?php echo JText::_('COM_USERS_OPTIONAL'); ?></span> <?php endif; ?> </div> <?php endif; ?> <div class="controls"> <?php echo $input; ?> </div> </div> users.php 0000604 00000000757 15245530514 0006427 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; JLoader::register('UsersHelperRoute', JPATH_COMPONENT . '/helpers/route.php'); $controller = JControllerLegacy::getInstance('Users'); $controller->execute(JFactory::getApplication()->input->get('task', 'display')); $controller->redirect(); controller.php 0000604 00000007067 15245530514 0007452 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(); } } } helpers/route.php 0000604 00000007531 15245530514 0010063 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 15245530514 0011436 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/html/users.php 0000604 00000010607 15245530514 0011030 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(''); } } } } controllers/remind.php 0000604 00000002621 15245530514 0011102 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; JLoader::register('UsersController', JPATH_COMPONENT . '/controller.php'); /** * Reset controller class for Users. * * @since 1.6 */ class UsersControllerRemind extends UsersController { /** * Method to request a username reminder. * * @return boolean * * @since 1.6 */ public function remind() { // Check the request token. $this->checkToken('post'); $model = $this->getModel('Remind', 'UsersModel'); $data = $this->input->post->get('jform', array(), 'array'); // Submit the password reset request. $return = $model->processRemindRequest($data); // Check for a hard error. if ($return == false && JDEBUG) { // The request failed. // Go back to the request form. $message = JText::sprintf('COM_USERS_REMIND_REQUEST_FAILED', $model->getError()); $this->setRedirect(JRoute::_('index.php?option=com_users&view=remind', false), $message, 'notice'); return false; } // To not expose if the user exists or not we send a generic message. $message = JText::_('COM_USERS_REMIND_REQUEST'); $this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false), $message, 'notice'); return true; } } controllers/reset.php 0000604 00000011203 15245530514 0010742 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; JLoader::register('UsersController', JPATH_COMPONENT . '/controller.php'); /** * Reset controller class for Users. * * @since 1.6 */ class UsersControllerReset extends UsersController { /** * Method to request a password reset. * * @return boolean * * @since 1.6 */ public function request() { // Check the request token. $this->checkToken('post'); $app = JFactory::getApplication(); $model = $this->getModel('Reset', 'UsersModel'); $data = $this->input->post->get('jform', array(), 'array'); // Submit the password reset request. $return = $model->processResetRequest($data); // Check for a hard error. if ($return instanceof Exception && JDEBUG) { // Get the error message to display. if ($app->get('error_reporting')) { $message = $return->getMessage(); } else { $message = JText::_('COM_USERS_RESET_REQUEST_ERROR'); } // Go back to the request form. $this->setRedirect(JRoute::_('index.php?option=com_users&view=reset', false), $message, 'error'); return false; } elseif ($return === false && JDEBUG) { // The request failed. // Go back to the request form. $message = JText::sprintf('COM_USERS_RESET_REQUEST_FAILED', $model->getError()); $this->setRedirect(JRoute::_('index.php?option=com_users&view=reset', false), $message, 'notice'); return false; } // To not expose if the user exists or not we send a generic message. $message = JText::_('COM_USERS_RESET_REQUEST'); $this->setRedirect(JRoute::_('index.php?option=com_users&view=reset&layout=confirm', false), $message, 'notice'); return true; } /** * Method to confirm the password request. * * @return boolean * * @access public * @since 1.6 */ public function confirm() { // Check the request token. $this->checkToken('request'); $app = JFactory::getApplication(); $model = $this->getModel('Reset', 'UsersModel'); $data = $this->input->get('jform', array(), 'array'); // Confirm the password reset request. $return = $model->processResetConfirm($data); // Check for a hard error. if ($return instanceof Exception) { // Get the error message to display. if ($app->get('error_reporting')) { $message = $return->getMessage(); } else { $message = JText::_('COM_USERS_RESET_CONFIRM_ERROR'); } // Go back to the confirm form. $this->setRedirect(JRoute::_('index.php?option=com_users&view=reset&layout=confirm', false), $message, 'error'); return false; } elseif ($return === false) { // Confirm failed. // Go back to the confirm form. $message = JText::sprintf('COM_USERS_RESET_CONFIRM_FAILED', $model->getError()); $this->setRedirect(JRoute::_('index.php?option=com_users&view=reset&layout=confirm', false), $message, 'notice'); return false; } else { // Confirm succeeded. // Proceed to step three. $this->setRedirect(JRoute::_('index.php?option=com_users&view=reset&layout=complete', false)); return true; } } /** * Method to complete the password reset process. * * @return boolean * * @since 1.6 */ public function complete() { // Check for request forgeries $this->checkToken('post'); $app = JFactory::getApplication(); $model = $this->getModel('Reset', 'UsersModel'); $data = $this->input->post->get('jform', array(), 'array'); // Complete the password reset request. $return = $model->processResetComplete($data); // Check for a hard error. if ($return instanceof Exception) { // Get the error message to display. if ($app->get('error_reporting')) { $message = $return->getMessage(); } else { $message = JText::_('COM_USERS_RESET_COMPLETE_ERROR'); } // Go back to the complete form. $this->setRedirect(JRoute::_('index.php?option=com_users&view=reset&layout=complete', false), $message, 'error'); return false; } elseif ($return === false) { // Complete failed. // Go back to the complete form. $message = JText::sprintf('COM_USERS_RESET_COMPLETE_FAILED', $model->getError()); $this->setRedirect(JRoute::_('index.php?option=com_users&view=reset&layout=complete', false), $message, 'notice'); return false; } else { // Complete succeeded. // Proceed to the login form. $message = JText::_('COM_USERS_RESET_COMPLETE_SUCCESS'); $this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false), $message); return true; } } } controllers/profile.php 0000604 00000013641 15245530514 0011270 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; JLoader::register('UsersController', JPATH_COMPONENT . '/controller.php'); /** * Profile controller class for Users. * * @since 1.6 */ class UsersControllerProfile extends UsersController { /** * Method to check out a user for editing and redirect to the edit form. * * @return boolean * * @since 1.6 */ public function edit() { $app = JFactory::getApplication(); $user = JFactory::getUser(); $loginUserId = (int) $user->get('id'); // Get the previous user id (if any) and the current user id. $previousId = (int) $app->getUserState('com_users.edit.profile.id'); $userId = $this->input->getInt('user_id'); // Check if the user is trying to edit another users profile. if ($userId != $loginUserId) { $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); $app->setHeader('status', 403, true); return false; } $cookieLogin = $user->get('cookieLogin'); // Check if the user logged in with a cookie if (!empty($cookieLogin)) { // If so, the user must login to edit the password and other data. $app->enqueueMessage(JText::_('JGLOBAL_REMEMBER_MUST_LOGIN'), 'message'); $this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false)); return false; } // Set the user id for the user to edit in the session. $app->setUserState('com_users.edit.profile.id', $userId); // Get the model. $model = $this->getModel('Profile', 'UsersModel'); // Check out the user. if ($userId) { $model->checkout($userId); } // Check in the previous user. if ($previousId) { $model->checkin($previousId); } // Redirect to the edit screen. $this->setRedirect(JRoute::_('index.php?option=com_users&view=profile&layout=edit', false)); return true; } /** * Method to save a user's profile data. * * @return void * * @since 1.6 */ public function save() { // Check for request forgeries. $this->checkToken(); $app = JFactory::getApplication(); $model = $this->getModel('Profile', 'UsersModel'); $user = JFactory::getUser(); $userId = (int) $user->get('id'); // Get the user data. $requestData = $app->input->post->get('jform', array(), 'array'); // Force the ID to this user. $requestData['id'] = $userId; // Validate the posted data. $form = $model->getForm(); if (!$form) { JError::raiseError(500, $model->getError()); return false; } // Send an object which can be modified through the plugin event $objData = (object) $requestData; $app->triggerEvent( 'onContentNormaliseRequestData', array('com_users.user', $objData, $form) ); $requestData = (array) $objData; // Validate the posted data. $data = $model->validate($form, $requestData); // Check for errors. if ($data === false) { // Get the validation messages. $errors = $model->getErrors(); // Push up to three validation messages out to the user. for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) { if ($errors[$i] instanceof Exception) { $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); } else { $app->enqueueMessage($errors[$i], 'warning'); } } // Unset the passwords. unset($requestData['password1'], $requestData['password2']); // Save the data in the session. $app->setUserState('com_users.edit.profile.data', $requestData); // Redirect back to the edit screen. $userId = (int) $app->getUserState('com_users.edit.profile.id'); $this->setRedirect(JRoute::_('index.php?option=com_users&view=profile&layout=edit&user_id=' . $userId, false)); return false; } // Attempt to save the data. $return = $model->save($data); // Check for errors. if ($return === false) { // Save the data in the session. $app->setUserState('com_users.edit.profile.data', $data); // Redirect back to the edit screen. $userId = (int) $app->getUserState('com_users.edit.profile.id'); $this->setMessage(JText::sprintf('COM_USERS_PROFILE_SAVE_FAILED', $model->getError()), 'warning'); $this->setRedirect(JRoute::_('index.php?option=com_users&view=profile&layout=edit&user_id=' . $userId, false)); return false; } // Redirect the user and adjust session state based on the chosen task. switch ($this->getTask()) { case 'apply': // Check out the profile. $app->setUserState('com_users.edit.profile.id', $return); $model->checkout($return); // Redirect back to the edit screen. $this->setMessage(JText::_('COM_USERS_PROFILE_SAVE_SUCCESS')); $redirect = $app->getUserState('com_users.edit.profile.redirect'); // Don't redirect to an external URL. if (!JUri::isInternal($redirect)) { $redirect = null; } if (!$redirect) { $redirect = 'index.php?option=com_users&view=profile&layout=edit&hidemainmenu=1'; } $this->setRedirect(JRoute::_($redirect, false)); break; default: // Check in the profile. $userId = (int) $app->getUserState('com_users.edit.profile.id'); if ($userId) { $model->checkin($userId); } // Clear the profile id from the session. $app->setUserState('com_users.edit.profile.id', null); $redirect = $app->getUserState('com_users.edit.profile.redirect'); // Don't redirect to an external URL. if (!JUri::isInternal($redirect)) { $redirect = null; } if (!$redirect) { $redirect = 'index.php?option=com_users&view=profile&user_id=' . $return; } // Redirect to the list screen. $this->setMessage(JText::_('COM_USERS_PROFILE_SAVE_SUCCESS')); $this->setRedirect(JRoute::_($redirect, false)); break; } // Flush the data from the session. $app->setUserState('com_users.edit.profile.data', null); } } controllers/registration.php 0000604 00000015420 15245530514 0012337 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; JLoader::register('UsersController', JPATH_COMPONENT . '/controller.php'); /** * Registration controller class for Users. * * @since 1.6 */ class UsersControllerRegistration extends UsersController { /** * Method to activate a user. * * @return boolean True on success, false on failure. * * @since 1.6 */ public function activate() { $user = JFactory::getUser(); $input = JFactory::getApplication()->input; $uParams = JComponentHelper::getParams('com_users'); // Check for admin activation. Don't allow non-super-admin to delete a super admin if ($uParams->get('useractivation') != 2 && $user->get('id')) { $this->setRedirect('index.php'); return true; } // If user registration or account activation is disabled, throw a 403. if ($uParams->get('useractivation') == 0 || $uParams->get('allowUserRegistration') == 0) { JError::raiseError(403, JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN')); return false; } $model = $this->getModel('Registration', 'UsersModel'); $token = $input->getAlnum('token'); // Check that the token is in a valid format. if ($token === null || strlen($token) !== 32) { JError::raiseError(403, JText::_('JINVALID_TOKEN')); return false; } // Get the User ID $userIdToActivate = $model->getUserIdFromToken($token); if (!$userIdToActivate) { $this->setMessage(JText::_('COM_USERS_ACTIVATION_TOKEN_NOT_FOUND')); $this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false)); return false; } // Get the user we want to activate $userToActivate = JFactory::getUser($userIdToActivate); // Admin activation is on and admin is activating the account if (($uParams->get('useractivation') == 2) && $userToActivate->getParam('activate', 0)) { // If a user admin is not logged in, redirect them to the login page with an error message if (!$user->authorise('core.create', 'com_users') || !$user->authorise('core.manage', 'com_users')) { $activationUrl = 'index.php?option=com_users&task=registration.activate&token=' . $token; $loginUrl = 'index.php?option=com_users&view=login&return=' . base64_encode($activationUrl); // In case we still run into this in the second step the user does not have the right permissions $message = JText::_('COM_USERS_REGISTRATION_ACL_ADMIN_ACTIVATION_PERMISSIONS'); // When we are not logged in we should login if ($user->guest) { $message = JText::_('COM_USERS_REGISTRATION_ACL_ADMIN_ACTIVATION'); } $this->setMessage($message); $this->setRedirect(JRoute::_($loginUrl, false)); return false; } } // Attempt to activate the user. $return = $model->activate($token); // Check for errors. if ($return === false) { // Redirect back to the home page. $this->setMessage(JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $model->getError()), 'error'); $this->setRedirect('index.php'); return false; } $useractivation = $uParams->get('useractivation'); // Redirect to the login screen. if ($useractivation == 0) { $this->setMessage(JText::_('COM_USERS_REGISTRATION_SAVE_SUCCESS')); $this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false)); } elseif ($useractivation == 1) { $this->setMessage(JText::_('COM_USERS_REGISTRATION_ACTIVATE_SUCCESS')); $this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false)); } elseif ($return->getParam('activate')) { $this->setMessage(JText::_('COM_USERS_REGISTRATION_VERIFY_SUCCESS')); $this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false)); } else { $this->setMessage(JText::_('COM_USERS_REGISTRATION_ADMINACTIVATE_SUCCESS')); $this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false)); } return true; } /** * Method to register a user. * * @return boolean True on success, false on failure. * * @since 1.6 */ public function register() { // Check for request forgeries. $this->checkToken(); // If registration is disabled - Redirect to login page. if (JComponentHelper::getParams('com_users')->get('allowUserRegistration') == 0) { $this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false)); return false; } $app = JFactory::getApplication(); $model = $this->getModel('Registration', 'UsersModel'); // Get the user data. $requestData = $this->input->post->get('jform', array(), 'array'); // Validate the posted data. $form = $model->getForm(); if (!$form) { JError::raiseError(500, $model->getError()); return false; } $data = $model->validate($form, $requestData); // Check for validation errors. if ($data === false) { // Get the validation messages. $errors = $model->getErrors(); // Push up to three validation messages out to the user. for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) { if ($errors[$i] instanceof Exception) { $app->enqueueMessage($errors[$i]->getMessage(), 'error'); } else { $app->enqueueMessage($errors[$i], 'error'); } } // Save the data in the session. $app->setUserState('com_users.registration.data', $requestData); // Redirect back to the registration screen. $this->setRedirect(JRoute::_('index.php?option=com_users&view=registration', false)); return false; } // Attempt to save the data. $return = $model->register($data); // Check for errors. if ($return === false) { // Save the data in the session. $app->setUserState('com_users.registration.data', $data); // Redirect back to the edit screen. $this->setMessage($model->getError(), 'error'); $this->setRedirect(JRoute::_('index.php?option=com_users&view=registration', false)); return false; } // Flush the data from the session. $app->setUserState('com_users.registration.data', null); // Redirect to the profile screen. if ($return === 'adminactivate') { $this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_VERIFY')); $this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false)); } elseif ($return === 'useractivate') { $this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_ACTIVATE')); $this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false)); } else { $this->setMessage(JText::_('COM_USERS_REGISTRATION_SAVE_SUCCESS')); $this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false)); } return true; } } controllers/user.php 0000604 00000020634 15245530514 0010606 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; JLoader::register('UsersController', JPATH_COMPONENT . '/controller.php'); /** * Registration controller class for Users. * * @since 1.6 */ class UsersControllerUser extends UsersController { /** * Method to log in a user. * * @return void * * @since 1.6 */ public function login() { $this->checkToken('post'); $app = JFactory::getApplication(); $input = $app->input->getInputForRequestMethod(); // Populate the data array: $data = array(); $data['return'] = base64_decode($input->get('return', '', 'BASE64')); $data['username'] = $input->get('username', '', 'USERNAME'); $data['password'] = $input->get('password', '', 'RAW'); $data['secretkey'] = $input->get('secretkey', '', 'RAW'); // Check for a simple menu item id if (is_numeric($data['return'])) { if (JLanguageMultilang::isEnabled()) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('language') ->from($db->quoteName('#__menu')) ->where('client_id = 0') ->where('id =' . $data['return']); $db->setQuery($query); try { $language = $db->loadResult(); } catch (RuntimeException $e) { return; } if ($language !== '*') { $lang = '&lang=' . $language; } else { $lang = ''; } } else { $lang = ''; } $data['return'] = 'index.php?Itemid=' . $data['return'] . $lang; } else { // Don't redirect to an external URL. if (!JUri::isInternal($data['return'])) { $data['return'] = ''; } } // Set the return URL if empty. if (empty($data['return'])) { $data['return'] = 'index.php?option=com_users&view=profile'; } // Set the return URL in the user state to allow modification by plugins $app->setUserState('users.login.form.return', $data['return']); // Get the log in options. $options = array(); $options['remember'] = $this->input->getBool('remember', false); $options['return'] = $data['return']; // Get the log in credentials. $credentials = array(); $credentials['username'] = $data['username']; $credentials['password'] = $data['password']; $credentials['secretkey'] = $data['secretkey']; // Perform the log in. if (true !== $app->login($credentials, $options)) { // Login failed ! // Clear user name, password and secret key before sending the login form back to the user. $data['remember'] = (int) $options['remember']; $data['username'] = ''; $data['password'] = ''; $data['secretkey'] = ''; $app->setUserState('users.login.form.data', $data); $app->redirect(JRoute::_('index.php?option=com_users&view=login', false)); } // Success if ($options['remember'] == true) { $app->setUserState('rememberLogin', true); } $app->setUserState('users.login.form.data', array()); $app->redirect(JRoute::_($app->getUserState('users.login.form.return'), false)); } /** * Method to log out a user. * * @return void * * @since 1.6 */ public function logout() { $this->checkToken('request'); $app = JFactory::getApplication(); // Prepare the logout options. $options = array( 'clientid' => $app->get('shared_session', '0') ? null : 0, ); // Perform the log out. $error = $app->logout(null, $options); $input = $app->input->getInputForRequestMethod(); // Check if the log out succeeded. if ($error instanceof Exception) { $app->redirect(JRoute::_('index.php?option=com_users&view=login', false)); } // Get the return URL from the request and validate that it is internal. $return = $input->get('return', '', 'BASE64'); $return = base64_decode($return); // Check for a simple menu item id if (is_numeric($return)) { if (JLanguageMultilang::isEnabled()) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('language') ->from($db->quoteName('#__menu')) ->where('client_id = 0') ->where('id =' . $return); $db->setQuery($query); try { $language = $db->loadResult(); } catch (RuntimeException $e) { return; } if ($language !== '*') { $lang = '&lang=' . $language; } else { $lang = ''; } } else { $lang = ''; } $return = 'index.php?Itemid=' . $return . $lang; } else { // Don't redirect to an external URL. if (!JUri::isInternal($return)) { $return = ''; } } // In case redirect url is not set, redirect user to homepage if (empty($return)) { $return = JUri::root(); } // Redirect the user. $app->redirect(JRoute::_($return, false)); } /** * Method to logout directly and redirect to page. * * @return void * * @since 3.5 */ public function menulogout() { // Get the ItemID of the page to redirect after logout $app = JFactory::getApplication(); $active = $app->getMenu()->getActive(); $itemid = $active ? $active->getParams()->get('logout') : 0; // Get the language of the page when multilang is on if (JLanguageMultilang::isEnabled()) { if ($itemid) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('language') ->from($db->quoteName('#__menu')) ->where('client_id = 0') ->where('id =' . $itemid); $db->setQuery($query); try { $language = $db->loadResult(); } catch (RuntimeException $e) { return; } if ($language !== '*') { $lang = '&lang=' . $language; } else { $lang = ''; } // URL to redirect after logout $url = 'index.php?Itemid=' . $itemid . $lang; } else { // Logout is set to default. Get the home page ItemID $lang_code = $app->input->cookie->getString(JApplicationHelper::getHash('language')); $item = $app->getMenu()->getDefault($lang_code); $itemid = $item->id; // Redirect to Home page after logout $url = 'index.php?Itemid=' . $itemid; } } else { // URL to redirect after logout, default page if no ItemID is set $url = $itemid ? 'index.php?Itemid=' . $itemid : JUri::root(); } // Logout and redirect $this->setRedirect('index.php?option=com_users&task=user.logout&' . JSession::getFormToken() . '=1&return=' . base64_encode($url)); } /** * Method to request a username reminder. * * @return boolean * * @since 1.6 */ public function remind() { // Check the request token. $this->checkToken('post'); $app = JFactory::getApplication(); $model = $this->getModel('User', 'UsersModel'); $data = $this->input->post->get('jform', array(), 'array'); // Submit the username remind request. $return = $model->processRemindRequest($data); // Check for a hard error. if ($return instanceof Exception) { // Get the error message to display. $message = $app->get('error_reporting') ? $return->getMessage() : JText::_('COM_USERS_REMIND_REQUEST_ERROR'); // Get the route to the next page. $itemid = UsersHelperRoute::getRemindRoute(); $itemid = $itemid !== null ? '&Itemid=' . $itemid : ''; $route = 'index.php?option=com_users&view=remind' . $itemid; // Go back to the complete form. $this->setRedirect(JRoute::_($route, false), $message, 'error'); return false; } if ($return === false) { // Complete failed. // Get the route to the next page. $itemid = UsersHelperRoute::getRemindRoute(); $itemid = $itemid !== null ? '&Itemid=' . $itemid : ''; $route = 'index.php?option=com_users&view=remind' . $itemid; // Go back to the complete form. $message = JText::sprintf('COM_USERS_REMIND_REQUEST_FAILED', $model->getError()); $this->setRedirect(JRoute::_($route, false), $message, 'notice'); return false; } // Complete succeeded. // Get the route to the next page. $itemid = UsersHelperRoute::getLoginRoute(); $itemid = $itemid !== null ? '&Itemid=' . $itemid : ''; $route = 'index.php?option=com_users&view=login' . $itemid; // Proceed to the login form. $message = JText::_('COM_USERS_REMIND_REQUEST_SUCCESS'); $this->setRedirect(JRoute::_($route, false), $message); return true; } /** * Method to resend a user. * * @return void * * @since 1.6 */ public function resend() { // Check for request forgeries // $this->checkToken('post'); } } models/forms/reset_request.xml 0000604 00000000771 15245530514 0012576 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <form> <fieldset name="default" label="COM_USERS_RESET_REQUEST_LABEL"> <field name="email" type="text" label="COM_USERS_FIELD_PASSWORD_RESET_LABEL" description="COM_USERS_FIELD_PASSWORD_RESET_DESC" class="validate-username" filter="email" required="true" size="30" /> <field name="captcha" type="captcha" label="COM_USERS_CAPTCHA_LABEL" description="COM_USERS_CAPTCHA_DESC" validate="captcha" /> </fieldset> </form>