first commit

This commit is contained in:
alazhar
2020-01-02 22:20:31 +07:00
commit 10eb3340ad
5753 changed files with 631345 additions and 0 deletions

View File

@ -0,0 +1,127 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Base controller class for Users.
*
* @package Joomla.Site
* @subpackage com_users
* @since 1.5
*/
class UsersController extends JControllerLegacy
{
/**
* Method to display a view.
*
* @param boolean If true, the view output will be cached
* @param array 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;
}
// 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();
}
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,198 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
require_once JPATH_COMPONENT.'/controller.php';
/**
* Profile controller class for Users.
*
* @package Joomla.Site
* @subpackage com_users
* @since 1.6
*/
class UsersControllerProfile extends UsersController
{
/**
* Method to check out a user for editing and redirect to the edit form.
*
* @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', null, 'array');
// Check if the user is trying to edit another users profile.
if ($userId != $loginUserId)
{
JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
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));
}
/**
* Method to save a user's profile data.
*
* @return void
* @since 1.6
*/
public function save()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$app = JFactory::getApplication();
$model = $this->getModel('Profile', 'UsersModel');
$user = JFactory::getUser();
$userId = (int) $user->get('id');
// Get the user data.
$data = $app->input->post->get('jform', array(), 'array');
// Force the ID to this user.
$data['id'] = $userId;
// Validate the posted data.
$form = $model->getForm();
if (!$form)
{
JError::raiseError(500, $model->getError());
return false;
}
// Validate the posted data.
$data = $model->validate($form, $data);
// 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');
}
}
// 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->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'));
$this->setRedirect(JRoute::_(($redirect = $app->getUserState('com_users.edit.profile.redirect')) ? $redirect : 'index.php?option=com_users&view=profile&layout=edit&hidemainmenu=1', 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 to the list screen.
$this->setMessage(JText::_('COM_USERS_PROFILE_SAVE_SUCCESS'));
$this->setRedirect(JRoute::_(($redirect = $app->getUserState('com_users.edit.profile.redirect')) ? $redirect : 'index.php?option=com_users&view=profile&user_id='.$return, false));
break;
}
// Flush the data from the session.
$app->setUserState('com_users.edit.profile.data', null);
}
/**
* Function that allows child controller access to model data after the data has been saved.
*
* @param JModelLegacy $model The data model object.
* @param array $validData The validated data.
*
* @return void
* @since 3.1
*/
protected function postSaveHook(JModelLegacy $model, $validData = array())
{
$item = $model->getData();
$tags = $validData['tags'];
if ($tags)
{
$item->tags = new JHelperTags;
$item->tags->getTagIds($item->id, 'com_users.user');
$item->metadata['tags'] = $item->tags;
}
}
}

View File

@ -0,0 +1,190 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
require_once JPATH_COMPONENT.'/controller.php';
/**
* Registration controller class for Users.
*
* @package Joomla.Site
* @subpackage com_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');
// If the user is logged in, return them back to the homepage.
if ($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;
}
// Attempt to activate the user.
$return = $model->activate($token);
// Check for errors.
if ($return === false)
{
// Redirect back to the homepage.
$this->setMessage(JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $model->getError()), 'warning');
$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.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// 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(), 'warning');
} else {
$app->enqueueMessage($errors[$i], 'warning');
}
}
// 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(JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $model->getError()), 'warning');
$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;
}
}

View File

@ -0,0 +1,67 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
require_once JPATH_COMPONENT.'/controller.php';
/**
* Reset controller class for Users.
*
* @package Joomla.Site
* @subpackage com_users
* @since 1.6
*/
class UsersControllerRemind extends UsersController
{
/**
* Method to request a username reminder.
*
* @since 1.6
*/
public function remind()
{
// Check the request token.
JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));
$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)
{
// The request 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 request form.
$message = JText::sprintf('COM_USERS_REMIND_REQUEST_FAILED', $model->getError());
$this->setRedirect(JRoute::_($route, false), $message, 'notice');
return false;
}
else
{
// The request succeeded.
// Get the route to the next page.
$itemid = UsersHelperRoute::getRemindRoute();
$itemid = $itemid !== null ? '&Itemid='.$itemid : '';
$route = 'index.php?option=com_users&view=login'.$itemid;
// Proceed to step two.
$message = JText::_('COM_USERS_REMIND_REQUEST_SUCCESS');
$this->setRedirect(JRoute::_($route, false), $message);
return true;
}
}
}

View File

@ -0,0 +1,213 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
require_once JPATH_COMPONENT.'/controller.php';
/**
* Reset controller class for Users.
*
* @package Joomla.Site
* @subpackage com_users
* @since 1.6
*/
class UsersControllerReset extends UsersController
{
/**
* Method to request a password reset.
*
* @since 1.6
*/
public function request()
{
// Check the request token.
JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));
$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)
{
// Get the error message to display.
if ($app->getCfg('error_reporting'))
{
$message = $return->getMessage();
} else {
$message = JText::_('COM_USERS_RESET_REQUEST_ERROR');
}
// Get the route to the next page.
$itemid = UsersHelperRoute::getResetRoute();
$itemid = $itemid !== null ? '&Itemid='.$itemid : '';
$route = 'index.php?option=com_users&view=reset'.$itemid;
// Go back to the request form.
$this->setRedirect(JRoute::_($route, false), $message, 'error');
return false;
} elseif ($return === false)
{
// The request failed.
// Get the route to the next page.
$itemid = UsersHelperRoute::getResetRoute();
$itemid = $itemid !== null ? '&Itemid='.$itemid : '';
$route = 'index.php?option=com_users&view=reset'.$itemid;
// Go back to the request form.
$message = JText::sprintf('COM_USERS_RESET_REQUEST_FAILED', $model->getError());
$this->setRedirect(JRoute::_($route, false), $message, 'notice');
return false;
}
else
{
// The request succeeded.
// Get the route to the next page.
$itemid = UsersHelperRoute::getResetRoute();
$itemid = $itemid !== null ? '&Itemid='.$itemid : '';
$route = 'index.php?option=com_users&view=reset&layout=confirm'.$itemid;
// Proceed to step two.
$this->setRedirect(JRoute::_($route, false));
return true;
}
}
/**
* Method to confirm the password request.
*
* @access public
* @since 1.6
*/
public function confirm()
{
// Check the request token.
JSession::checkToken('request') or jexit(JText::_('JINVALID_TOKEN'));
$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->getCfg('error_reporting'))
{
$message = $return->getMessage();
} else {
$message = JText::_('COM_USERS_RESET_CONFIRM_ERROR');
}
// Get the route to the next page.
$itemid = UsersHelperRoute::getResetRoute();
$itemid = $itemid !== null ? '&Itemid='.$itemid : '';
$route = 'index.php?option=com_users&view=reset&layout=confirm'.$itemid;
// Go back to the confirm form.
$this->setRedirect(JRoute::_($route, false), $message, 'error');
return false;
} elseif ($return === false)
{
// Confirm failed.
// Get the route to the next page.
$itemid = UsersHelperRoute::getResetRoute();
$itemid = $itemid !== null ? '&Itemid='.$itemid : '';
$route = 'index.php?option=com_users&view=reset&layout=confirm'.$itemid;
// Go back to the confirm form.
$message = JText::sprintf('COM_USERS_RESET_CONFIRM_FAILED', $model->getError());
$this->setRedirect(JRoute::_($route, false), $message, 'notice');
return false;
}
else
{
// Confirm succeeded.
// Get the route to the next page.
$itemid = UsersHelperRoute::getResetRoute();
$itemid = $itemid !== null ? '&Itemid='.$itemid : '';
$route = 'index.php?option=com_users&view=reset&layout=complete'.$itemid;
// Proceed to step three.
$this->setRedirect(JRoute::_($route, false));
return true;
}
}
/**
* Method to complete the password reset process.
*
* @since 1.6
*/
public function complete()
{
// Check for request forgeries
JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));
$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->getCfg('error_reporting'))
{
$message = $return->getMessage();
} else {
$message = JText::_('COM_USERS_RESET_COMPLETE_ERROR');
}
// Get the route to the next page.
$itemid = UsersHelperRoute::getResetRoute();
$itemid = $itemid !== null ? '&Itemid='.$itemid : '';
$route = 'index.php?option=com_users&view=reset&layout=complete'.$itemid;
// Go back to the complete form.
$this->setRedirect(JRoute::_($route, false), $message, 'error');
return false;
} elseif ($return === false)
{
// Complete failed.
// Get the route to the next page.
$itemid = UsersHelperRoute::getResetRoute();
$itemid = $itemid !== null ? '&Itemid='.$itemid : '';
$route = 'index.php?option=com_users&view=reset&layout=complete'.$itemid;
// Go back to the complete form.
$message = JText::sprintf('COM_USERS_RESET_COMPLETE_FAILED', $model->getError());
$this->setRedirect(JRoute::_($route, false), $message, 'notice');
return false;
}
else
{
// 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_RESET_COMPLETE_SUCCESS');
$this->setRedirect(JRoute::_($route, false), $message);
return true;
}
}
}

View File

@ -0,0 +1,246 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
require_once JPATH_COMPONENT.'/controller.php';
/**
* Registration controller class for Users.
*
* @package Joomla.Site
* @subpackage com_users
* @since 1.6
*/
class UsersControllerUser extends UsersController
{
/**
* Method to log in a user.
*
* @since 1.6
*/
public function login()
{
JSession::checkToken('post') or jexit(JText::_('JInvalid_Token'));
$app = JFactory::getApplication();
// Populate the data array:
$data = array();
$data['return'] = base64_decode($app->input->post->get('return', '', 'BASE64'));
$data['username'] = JRequest::getVar('username', '', 'method', 'username');
$data['password'] = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW);
// 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'];
// Perform the log in.
if (true === $app->login($credentials, $options))
{
// Success
$app->setUserState('users.login.form.data', array());
$app->redirect(JRoute::_($app->getUserState('users.login.form.return'), false));
}
else
{
// Login failed !
$data['remember'] = (int) $options['remember'];
$app->setUserState('users.login.form.data', $data);
$app->redirect(JRoute::_('index.php?option=com_users&view=login', false));
}
}
/**
* Method to log out a user.
*
* @since 1.6
*/
public function logout()
{
JSession::checkToken('request') or jexit(JText::_('JInvalid_Token'));
$app = JFactory::getApplication();
// Perform the log in.
$error = $app->logout();
// Check if the log out succeeded.
if (!($error instanceof Exception))
{
// Get the return url from the request and validate that it is internal.
$return = JRequest::getVar('return', '', 'method', 'base64');
$return = base64_decode($return);
if (!JUri::isInternal($return))
{
$return = '';
}
// Redirect the user.
$app->redirect(JRoute::_($return, false));
}
else
{
$app->redirect(JRoute::_('index.php?option=com_users&view=login', false));
}
}
/**
* Method to register a user.
*
* @since 1.6
*/
public function register()
{
JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));
// Get the form data.
$data = $this->input->post->get('user', array(), 'array');
// Get the model and validate the data.
$model = $this->getModel('Registration', 'UsersModel');
$return = $model->validate($data);
// Check for errors.
if ($return === false)
{
// Get the validation messages.
$app = &JFactory::getApplication();
$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(), 'notice');
} else {
$app->enqueueMessage($errors[$i], 'notice');
}
}
// Save the data in the session.
$app->setUserState('users.registration.form.data', $data);
// Redirect back to the registration form.
$this->setRedirect('index.php?option=com_users&view=registration');
return false;
}
// Finish the registration.
$return = $model->register($data);
// Check for errors.
if ($return === false)
{
// Save the data in the session.
$app->setUserState('users.registration.form.data', $data);
// Redirect back to the registration form.
$message = JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $model->getError());
$this->setRedirect('index.php?option=com_users&view=registration', $message, 'error');
return false;
}
// Flush the data from the session.
$app->setUserState('users.registration.form.data', null);
exit;
}
/**
* Method to login a user.
*
* @since 1.6
*/
public function remind()
{
// Check the request token.
JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));
$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.
if ($app->getCfg('error_reporting'))
{
$message = $return->getMessage();
} else {
$message = 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;
} elseif ($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;
}
else
{
// 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 login a user.
*
* @since 1.6
*/
public function resend()
{
// Check for request forgeries
JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,192 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Users Html Helper
*
* @package Joomla.Site
* @subpackage com_users
* @since 1.6
*/
abstract class JHtmlUsers
{
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);
}
}
public static function spacer($value)
{
return '';
}
public static function helpsite($value)
{
if (empty($value))
{
return static::value($value);
}
else
{
$pathToXml = JPATH_ADMINISTRATOR . '/help/helpsites.xml';
$text = $value;
if (!empty($pathToXml) && $xml = simplexml_load_file($pathToXml))
{
foreach ($xml->sites->site as $site)
{
if ((string) $site->attributes()->url == $value)
{
$text = (string) $site;
break;
}
}
}
$value = htmlspecialchars($value);
if (substr($value, 0, 4) == "http")
{
return '<a href="' . $value . '">' . $text . '</a>';
}
else
{
return '<a href="http://' . $value . '">' . $text . '</a>';
}
}
}
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);
}
else
{
return static::value('');
}
}
}
public static function admin_language($value)
{
if (empty($value))
{
return static::value($value);
}
else
{
$path = JLanguage::getLanguagePath(JPATH_ADMINISTRATOR, $value);
$file = "$value.xml";
$result = null;
if (is_file("$path/$file"))
{
$result = JLanguage::parseXMLLanguageFile("$path/$file");
}
if ($result)
{
return htmlspecialchars($result['name']);
}
else
{
return static::value('');
}
}
}
public static function language($value)
{
if (empty($value))
{
return static::value($value);
}
else
{
$path = JLanguage::getLanguagePath(JPATH_SITE, $value);
$file = "$value.xml";
$result = null;
if (is_file("$path/$file"))
{
$result = JLanguage::parseXMLLanguageFile("$path/$file");
}
if ($result)
{
return htmlspecialchars($result['name']);
}
else
{
return static::value('');
}
}
}
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, false)
|| $lang->load("plg_editors_$value.sys", JPATH_PLUGINS . '/editors/' . $value, null, false, false)
|| $lang->load("plg_editors_$value.sys", JPATH_ADMINISTRATOR, $lang->getDefault(), false, false)
|| $lang->load("plg_editors_$value.sys", JPATH_PLUGINS . '/editors/' . $value, $lang->getDefault(), false, false);
$lang->load($title . '.sys');
return JText::_($title);
}
else
{
return static::value('');
}
}
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,204 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Users Route Helper
*
* @package Joomla.Site
* @subpackage com_users
* @since 1.6
*/
class UsersHelperRoute
{
/**
* Method to get the menu items for the component.
*
* @return array An array of menu items.
* @since 1.6
*/
public static function &getItems()
{
static $items;
// Get the menu items for this component.
if (!isset($items))
{
// Include the site app in case we are loading this from the admin.
require_once JPATH_SITE.'/includes/application.php';
$app = JFactory::getApplication();
$menu = $app->getMenu();
$com = JComponentHelper::getComponent('com_users');
$items = $menu->getItems('component_id', $com->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
* @static
*/
public static function getLoginRoute()
{
// Get the items.
$items = self::getItems();
$itemid = null;
// Search for a suitable menu id.
foreach ($items as $item)
{
if (isset($item->query['view']) && $item->query['view'] === 'login')
{
$itemid = $item->id;
break;
}
}
return $itemid;
}
/**
* Method to get a route configuration for the profile view.
*
* @return mixed Integer menu id on success, null on failure.
* @since 1.6
*/
public static function getProfileRoute()
{
// Get the items.
$items = self::getItems();
$itemid = null;
// 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')
{
$itemid = $item->id;
break;
}
}
return $itemid;
}
/**
* Method to get a route configuration for the registration view.
*
* @return mixed Integer menu id on success, null on failure.
* @since 1.6
*/
public static function getRegistrationRoute()
{
// Get the items.
$items = self::getItems();
$itemid = null;
// Search for a suitable menu id.
foreach ($items as $item)
{
if (isset($item->query['view']) && $item->query['view'] === 'registration')
{
$itemid = $item->id;
break;
}
}
return $itemid;
}
/**
* Method to get a route configuration for the remind view.
*
* @return mixed Integer menu id on success, null on failure.
* @since 1.6
*/
public static function getRemindRoute()
{
// Get the items.
$items = self::getItems();
$itemid = null;
// Search for a suitable menu id.
foreach ($items as $item)
{
if (isset($item->query['view']) && $item->query['view'] === 'remind')
{
$itemid = $item->id;
break;
}
}
return $itemid;
}
/**
* Method to get a route configuration for the resend view.
*
* @return mixed Integer menu id on success, null on failure.
* @since 1.6
*/
public static function getResendRoute()
{
// Get the items.
$items = self::getItems();
$itemid = null;
// Search for a suitable menu id.
foreach ($items as $item)
{
if (isset($item->query['view']) && $item->query['view'] === 'resend')
{
$itemid = $item->id;
break;
}
}
return $itemid;
}
/**
* Method to get a route configuration for the reset view.
*
* @return mixed Integer menu id on success, null on failure.
* @since 1.6
*/
public static function getResetRoute()
{
// Get the items.
$items = self::getItems();
$itemid = null;
// Search for a suitable menu id.
foreach ($items as $item)
{
if (isset($item->query['view']) && $item->query['view'] === 'reset')
{
$itemid = $item->id;
break;
}
}
return $itemid;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
</metadata>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="params">
<!-- Basic user account settings. -->
<fieldset name="params" label="COM_USERS_SETTINGS_FIELDSET_LABEL">
<field name="editor" type="plugins" folder="editors"
description="COM_USERS_USER_FIELD_EDITOR_DESC"
label="COM_USERS_USER_FIELD_EDITOR_LABEL"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
<field name="timezone" type="timezone"
label="COM_USERS_USER_FIELD_TIMEZONE_LABEL"
description="COM_USERS_USER_FIELD_TIMEZONE_DESC"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
<field name="language" type="language"
client="site"
description="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_DESC"
label="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_LABEL"
filter="cmd"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
</fieldset>
</fields>
</form>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="params">
<!-- Backend user account settings. -->
<fieldset name="params" label="COM_USERS_SETTINGS_FIELDSET_LABEL">
<field name="admin_style" type="templatestyle"
client="administrator"
description="COM_USERS_USER_FIELD_BACKEND_TEMPLATE_DESC"
label="COM_USERS_USER_FIELD_BACKEND_TEMPLATE_LABEL"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
<field name="admin_language" type="language"
client="administrator"
description="COM_USERS_USER_FIELD_BACKEND_LANGUAGE_DESC"
label="COM_USERS_USER_FIELD_BACKEND_LANGUAGE_LABEL"
filter="cmd"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
<field name="helpsite" type="helpsite"
label="COM_USERS_USER_FIELD_HELPSITE_LABEL"
description="COM_USERS_USER_FIELD_HELPSITE_DESC"
>
<option value="">JOPTION_USE_DEFAULT</option>
</field>
</fieldset>
</fields>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset name="credentials"
label="COM_USERS_LOGIN_DEFAULT_LABEL" >
<field name="username" type="text"
class="validate-username"
filter="username"
label="COM_USERS_LOGIN_USERNAME_LABEL"
size="25"
required="true"
validate="username"
/>
<field name="password" type="password"
class="validate-password"
required="true"
filter="raw"
label="JGLOBAL_PASSWORD"
size="25"
/>
</fieldset>
<fieldset>
<field name="return" type="hidden" />
</fieldset>
</form>

View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset name="core"
label="COM_USERS_PROFILE_DEFAULT_LABEL">
<field name="id" type="hidden"
filter="integer"
/>
<field name="name" type="text"
description="COM_USERS_PROFILE_NAME_DESC"
filter="string"
label="COM_USERS_PROFILE_NAME_LABEL"
required="true"
size="30"
/>
<field name="username" type="text"
class="validate-username"
description="COM_USERS_DESIRED_USERNAME"
filter="username"
label="COM_USERS_PROFILE_USERNAME_LABEL"
message="COM_USERS_PROFILE_USERNAME_MESSAGE"
required="true"
size="30"
validate="username"
/>
<field name="password2" type="password"
autocomplete="off"
class="validate-password"
description="COM_USERS_DESIRED_PASSWORD"
field="password1"
filter="raw"
label="COM_USERS_PROFILE_PASSWORD1_LABEL"
message="COM_USERS_PROFILE_PASSWORD1_MESSAGE"
size="30"
validate="equals"
/>
<field name="password1" type="password"
autocomplete="off"
class="validate-password"
description="COM_USERS_PROFILE_PASSWORD2_DESC"
filter="raw"
label="COM_USERS_PROFILE_PASSWORD2_LABEL"
size="30"
validate="password"
/>
<field name="email1" type="email"
description="COM_USERS_PROFILE_EMAIL1_DESC"
filter="string"
label="COM_USERS_PROFILE_EMAIL1_LABEL"
message="COM_USERS_PROFILE_EMAIL1_MESSAGE"
required="true"
size="30"
unique="true"
validate="email"
/>
<field name="email2" type="email"
description="COM_USERS_PROFILE_EMAIL2_DESC"
field="email1"
filter="string"
label="COM_USERS_PROFILE_EMAIL2_LABEL"
message="COM_USERS_PROFILE_EMAIL2_MESSAGE"
required="true"
size="30"
validate="equals"
/>
</fieldset>
</form>

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset name="default"
label="COM_USERS_REGISTRATION_DEFAULT_LABEL"
>
<field name="spacer" type="spacer" class="text"
label="COM_USERS_REGISTER_REQUIRED"
/>
<field name="name" type="text"
description="COM_USERS_REGISTER_NAME_DESC"
filter="string"
label="COM_USERS_REGISTER_NAME_LABEL"
required="true"
size="30"
/>
<field name="username" type="text"
class="validate-username"
description="COM_USERS_DESIRED_USERNAME"
filter="username"
label="COM_USERS_REGISTER_USERNAME_LABEL"
message="COM_USERS_REGISTER_USERNAME_MESSAGE"
required="true"
size="30"
validate="username"
/>
<field name="password2" type="password"
autocomplete="off"
class="validate-password"
description="COM_USERS_DESIRED_PASSWORD"
field="password1"
filter="raw"
label="COM_USERS_PROFILE_PASSWORD1_LABEL"
message="COM_USERS_PROFILE_PASSWORD1_MESSAGE"
size="30"
validate="equals"
required="true"
/>
<field name="password1" type="password"
autocomplete="off"
class="validate-password"
description="COM_USERS_PROFILE_PASSWORD2_DESC"
filter="raw"
label="COM_USERS_PROFILE_PASSWORD2_LABEL"
size="30"
validate="password"
required="true"
/>
<field name="email1" type="email"
description="COM_USERS_REGISTER_EMAIL1_DESC"
field="id"
filter="string"
label="COM_USERS_REGISTER_EMAIL1_LABEL"
message="COM_USERS_REGISTER_EMAIL1_MESSAGE"
required="true"
size="30"
unique="true"
validate="email"
/>
<field name="email2" type="email"
description="COM_USERS_REGISTER_EMAIL2_DESC"
field="email1"
filter="string"
label="COM_USERS_REGISTER_EMAIL2_LABEL"
message="COM_USERS_REGISTER_EMAIL2_MESSAGE"
required="true"
size="30"
validate="equals"
/>
<field
name="captcha"
type="captcha"
label="COM_USERS_CAPTCHA_LABEL"
description="COM_USERS_CAPTCHA_DESC"
validate="captcha"
/>
</fieldset>
</form>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset name="default" label="COM_USERS_REMIND_DEFAULT_LABEL">
<field name="email" type="email"
description="COM_USERS_FIELD_REMIND_EMAIL_DESC"
label="COM_USERS_FIELD_REMIND_EMAIL_LABEL"
required="true"
size="30"
validate="email"
/>
<field
name="captcha"
type="captcha"
label="COM_USERS_CAPTCHA_LABEL"
description="COM_USERS_CAPTCHA_DESC"
validate="captcha"
/>
</fieldset>
</form>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset name="default" label="COM_USERS_RESET_COMPLETE_LABEL">
<field name="password1" type="password"
autocomplete="off"
class="validate-password"
description="COM_USERS_FIELD_RESET_PASSWORD1_DESC"
field="password2"
filter="raw"
label="COM_USERS_FIELD_RESET_PASSWORD1_LABEL"
message="COM_USERS_FIELD_RESET_PASSWORD1_MESSAGE"
required="true"
size="30"
validate="equals"
/>
<field name="password2" type="password"
autocomplete="off"
class="validate-password"
description="COM_USERS_FIELD_RESET_PASSWORD2_DESC"
filter="raw"
label="COM_USERS_FIELD_RESET_PASSWORD2_LABEL"
required="true"
size="30"
/>
</fieldset>
</form>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset name="default" label="COM_USERS_RESET_CONFIRM_LABEL">
<field name="username" type="text"
description="COM_USERS_FIELD_RESET_CONFIRM_USERNAME_DESC"
filter="username"
label="COM_USERS_FIELD_RESET_CONFIRM_USERNAME_LABEL"
required="true"
size="30"/>
<field name="token" type="text"
description="COM_USERS_FIELD_RESET_CONFIRM_TOKEN_DESC"
filter="alnum"
label="COM_USERS_FIELD_RESET_CONFIRM_TOKEN_LABEL"
required="true"
size="32"/>
</fieldset>
</form>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset name="default" label="COM_USERS_RESET_REQUEST_LABEL">
<field name="email" type="text"
class="validate-username"
description="COM_USERS_FIELD_PASSWORD_RESET_DESC"
filter="email" label="COM_USERS_FIELD_PASSWORD_RESET_LABEL"
required="true"
size="30"
/>
<field
name="captcha"
type="captcha"
label="COM_USERS_CAPTCHA_LABEL"
description="COM_USERS_CAPTCHA_DESC"
validate="captcha"
/>
</fieldset>
</form>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="params">
<fieldset name="params" label="COM_USERS_SETTINGS_FIELDSET_LABEL">
<field name="language" type="language"
client="site"
description="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_DESC"
label="COM_USERS_USER_FIELD_FRONTEND_LANGUAGE_LABEL"
required="true"
filter="cmd"
/>
</fieldset>
</fields>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,110 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Rest model class for Users.
*
* @package Joomla.Site
* @subpackage com_users
* @since 1.6
*/
class UsersModelLogin extends JModelForm
{
/**
* Method to get the login form.
*
* The base form is loaded from XML and then an event is fired
* for users plugins to extend the form with extra fields.
*
* @param array $data An optional array of data for the form to interogate.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @return JForm A JForm object on success, false on failure
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_users.login', 'login', array('load_data' => $loadData));
if (empty($form))
{
return false;
}
return $form;
}
/**
* Method to get the data that should be injected in the form.
*
* @return array The default data is an empty array.
* @since 1.6
*/
protected function loadFormData()
{
// Check the session for previously entered login form data.
$app = JFactory::getApplication();
$data = $app->getUserState('users.login.form.data', array());
// check for return URL from the request first
if ($return = JRequest::getVar('return', '', 'method', 'base64'))
{
$data['return'] = base64_decode($return);
if (!JUri::isInternal($data['return']))
{
$data['return'] = '';
}
}
// Set the return URL if empty.
if (!isset($data['return']) || empty($data['return']))
{
$data['return'] = 'index.php?option=com_users&view=profile';
}
$app->setUserState('users.login.form.data', $data);
$this->preprocessData('com_users.login', $data);
return $data;
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState()
{
// Get the application object.
$params = JFactory::getApplication()->getParams('com_users');
// Load the parameters.
$this->setState('params', $params);
}
/**
* Override JModelAdmin::preprocessForm to ensure the correct plugin group is loaded.
*
* @param JForm $form A JForm object.
* @param mixed $data The data expected for the form.
* @param string $group The name of the plugin group to import (defaults to "content").
*
* @return void
*
* @since 1.6
* @throws Exception if there is an error in the form event.
*/
protected function preprocessForm(JForm $form, $data, $group = 'user')
{
parent::preprocessForm($form, $data, $group);
}
}

View File

@ -0,0 +1,286 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Profile model class for Users.
*
* @package Joomla.Site
* @subpackage com_users
* @since 1.6
*/
class UsersModelProfile extends JModelForm
{
/**
* @var object The user profile data.
* @since 1.6
*/
protected $data;
/**
* Method to check in a user.
*
* @param integer The id of the row to check out.
* @return boolean True on success, false on failure.
* @since 1.6
*/
public function checkin($userId = null)
{
// Get the user id.
$userId = (!empty($userId)) ? $userId : (int) $this->getState('user.id');
if ($userId)
{
// Initialise the table with JUser.
$table = JTable::getInstance('User');
// Attempt to check the row in.
if (!$table->checkin($userId))
{
$this->setError($table->getError());
return false;
}
}
return true;
}
/**
* Method to check out a user for editing.
*
* @param integer The id of the row to check out.
* @return boolean True on success, false on failure.
* @since 1.6
*/
public function checkout($userId = null)
{
// Get the user id.
$userId = (!empty($userId)) ? $userId : (int) $this->getState('user.id');
if ($userId)
{
// Initialise the table with JUser.
$table = JTable::getInstance('User');
// Get the current user object.
$user = JFactory::getUser();
// Attempt to check the row out.
if (!$table->checkout($user->get('id'), $userId))
{
$this->setError($table->getError());
return false;
}
}
return true;
}
/**
* Method to get the profile form data.
*
* The base form data is loaded and then an event is fired
* for users plugins to extend the data.
*
* @return mixed Data object on success, false on failure.
* @since 1.6
*/
public function getData()
{
if ($this->data === null) {
$userId = $this->getState('user.id');
// Initialise the table with JUser.
$this->data = new JUser($userId);
// Set the base user data.
$this->data->email1 = $this->data->get('email');
$this->data->email2 = $this->data->get('email');
// Override the base user data with any data in the session.
$temp = (array) JFactory::getApplication()->getUserState('com_users.edit.profile.data', array());
foreach ($temp as $k => $v)
{
$this->data->$k = $v;
}
// Unset the passwords.
unset($this->data->password1);
unset($this->data->password2);
$registry = new JRegistry($this->data->params);
$this->data->params = $registry->toArray();
// Get the dispatcher and load the users plugins.
$dispatcher = JEventDispatcher::getInstance();
JPluginHelper::importPlugin('user');
// Trigger the data preparation event.
$results = $dispatcher->trigger('onContentPrepareData', array('com_users.profile', $this->data));
// Check for errors encountered while preparing the data.
if (count($results) && in_array(false, $results, true))
{
$this->setError($dispatcher->getError());
$this->data = false;
}
}
return $this->data;
}
/**
* Method to get the profile form.
*
* The base form is loaded from XML and then an event is fired
* for users plugins to extend the form with extra fields.
*
* @param array $data An optional array of data for the form to interogate.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @return JForm A JForm object on success, false on failure
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_users.profile', 'profile', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
{
return false;
}
if (!JComponentHelper::getParams('com_users')->get('change_login_name'))
{
$form->setFieldAttribute('username', 'class', '');
$form->setFieldAttribute('username', 'filter', '');
$form->setFieldAttribute('username', 'description', 'COM_USERS_PROFILE_NOCHANGE_USERNAME_DESC');
$form->setFieldAttribute('username', 'validate', '');
$form->setFieldAttribute('username', 'message', '');
$form->setFieldAttribute('username', 'readonly', 'true');
$form->setFieldAttribute('username', 'required', 'false');
}
return $form;
}
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
* @since 1.6
*/
protected function loadFormData()
{
$data = $this->getData();
$this->preprocessData('com_users.profile', $data);
return $data;
}
/**
* Override preprocessForm to load the user plugin group instead of content.
*
* @param object A form object.
* @param mixed The data expected for the form.
* @throws Exception if there is an error in the form event.
* @since 1.6
*/
protected function preprocessForm(JForm $form, $data, $group = 'user')
{
if (JComponentHelper::getParams('com_users')->get('frontend_userparams'))
{
$form->loadFile('frontend', false);
if (JFactory::getUser()->authorise('core.login.admin'))
{
$form->loadFile('frontend_admin', false);
}
}
parent::preprocessForm($form, $data, $group);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState()
{
// Get the application object.
$params = JFactory::getApplication()->getParams('com_users');
// Get the user id.
$userId = JFactory::getApplication()->getUserState('com_users.edit.profile.id');
$userId = !empty($userId) ? $userId : (int) JFactory::getUser()->get('id');
// Set the user id.
$this->setState('user.id', $userId);
// Load the parameters.
$this->setState('params', $params);
}
/**
* Method to save the form data.
*
* @param array The form data.
* @return mixed The user id on success, false on failure.
* @since 1.6
*/
public function save($data)
{
$userId = (!empty($data['id'])) ? $data['id'] : (int) $this->getState('user.id');
$user = new JUser($userId);
// Prepare the data for the user object.
$data['email'] = JStringPunycode::emailToPunycode($data['email1']);
$data['password'] = $data['password1'];
// Unset the username if it should not be overwritten
if (!JComponentHelper::getParams('com_users')->get('change_login_name'))
{
unset($data['username']);
}
// Unset the block so it does not get overwritten
unset($data['block']);
// Unset the sendEmail so it does not get overwritten
unset($data['sendEmail']);
// Bind the data.
if (!$user->bind($data))
{
$this->setError(JText::sprintf('COM_USERS_PROFILE_BIND_FAILED', $user->getError()));
return false;
}
// Load the users plugin group.
JPluginHelper::importPlugin('user');
// Null the user groups so they don't get overwritten
$user->groups = null;
// Store the data.
if (!$user->save())
{
$this->setError($user->getError());
return false;
}
$user->tags = new JHelperTags;
$user->tags->getTagIds($user->id, 'com_users.user');
return $user->id;
}
}

View File

@ -0,0 +1,616 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Registration model class for Users.
*
* @package Joomla.Site
* @subpackage com_users
* @since 1.6
*/
class UsersModelRegistration extends JModelForm
{
/**
* @var object The user registration data.
* @since 1.6
*/
protected $data;
/**
* Method to activate a user account.
*
* @param string $token The activation token.
*
* @return mixed False on failure, user object on success.
*
* @since 1.6
*/
public function activate($token)
{
$config = JFactory::getConfig();
$userParams = JComponentHelper::getParams('com_users');
$db = $this->getDbo();
// Get the user id based on the token.
$query = $db->getQuery(true);
$query->select($db->quoteName('id'))
->from($db->quoteName('#__users'))
->where($db->quoteName('activation') . ' = ' . $db->quote($token))
->where($db->quoteName('block') . ' = ' . 1)
->where($db->quoteName('lastvisitDate') . ' = ' . $db->quote($db->getNullDate()));
$db->setQuery($query);
try
{
$userId = (int) $db->loadResult();
}
catch (RuntimeException $e)
{
$this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500);
return false;
}
// Check for a valid user id.
if (!$userId)
{
$this->setError(JText::_('COM_USERS_ACTIVATION_TOKEN_NOT_FOUND'));
return false;
}
// Load the users plugin group.
JPluginHelper::importPlugin('user');
// Activate the user.
$user = JFactory::getUser($userId);
// Admin activation is on and user is verifying their email
if (($userParams->get('useractivation') == 2) && !$user->getParam('activate', 0))
{
$uri = JUri::getInstance();
// Compile the admin notification mail values.
$data = $user->getProperties();
$data['activation'] = JApplication::getHash(JUserHelper::genRandomPassword());
$user->set('activation', $data['activation']);
$data['siteurl'] = JUri::base();
$base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
$data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);
$data['fromname'] = $config->get('fromname');
$data['mailfrom'] = $config->get('mailfrom');
$data['sitename'] = $config->get('sitename');
$user->setParam('activate', 1);
$emailSubject = JText::sprintf(
'COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_SUBJECT',
$data['name'],
$data['sitename']
);
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_BODY',
$data['sitename'],
$data['name'],
$data['email'],
$data['username'],
$data['activate']
);
// get all admin users
$query->clear()
->select($db->quoteName(array('name', 'email', 'sendEmail', 'id')))
->from($db->quoteName('#__users'))
->where($db->quoteName('sendEmail') . ' = ' . 1);
$db->setQuery($query);
try
{
$rows = $db->loadObjectList();
}
catch (RuntimeException $e)
{
$this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500);
return false;
}
// Send mail to all users with users creating permissions and receiving system emails
foreach ($rows as $row)
{
$usercreator = JFactory::getUser($row->id);
if ($usercreator->authorise('core.create', 'com_users'))
{
$return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $row->email, $emailSubject, $emailBody);
// Check for an error.
if ($return !== true)
{
$this->setError(JText::_('COM_USERS_REGISTRATION_ACTIVATION_NOTIFY_SEND_MAIL_FAILED'));
return false;
}
}
}
}
// Admin activation is on and admin is activating the account
elseif (($userParams->get('useractivation') == 2) && $user->getParam('activate', 0))
{
$user->set('activation', '');
$user->set('block', '0');
// Compile the user activated notification mail values.
$data = $user->getProperties();
$user->setParam('activate', 0);
$data['fromname'] = $config->get('fromname');
$data['mailfrom'] = $config->get('mailfrom');
$data['sitename'] = $config->get('sitename');
$data['siteurl'] = JUri::base();
$emailSubject = JText::sprintf(
'COM_USERS_EMAIL_ACTIVATED_BY_ADMIN_ACTIVATION_SUBJECT',
$data['name'],
$data['sitename']
);
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_ACTIVATED_BY_ADMIN_ACTIVATION_BODY',
$data['name'],
$data['siteurl'],
$data['username']
);
$return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody);
// Check for an error.
if ($return !== true)
{
$this->setError(JText::_('COM_USERS_REGISTRATION_ACTIVATION_NOTIFY_SEND_MAIL_FAILED'));
return false;
}
}
else
{
$user->set('activation', '');
$user->set('block', '0');
}
// Store the user object.
if (!$user->save())
{
$this->setError(JText::sprintf('COM_USERS_REGISTRATION_ACTIVATION_SAVE_FAILED', $user->getError()));
return false;
}
return $user;
}
/**
* Method to get the registration form data.
*
* The base form data is loaded and then an event is fired
* for users plugins to extend the data.
*
* @return mixed Data object on success, false on failure.
*
* @since 1.6
*/
public function getData()
{
if ($this->data === null)
{
$this->data = new stdClass;
$app = JFactory::getApplication();
$params = JComponentHelper::getParams('com_users');
// Override the base user data with any data in the session.
$temp = (array) $app->getUserState('com_users.registration.data', array());
foreach ($temp as $k => $v)
{
$this->data->$k = $v;
}
// Get the groups the user should be added to after registration.
$this->data->groups = array();
// Get the default new user group, Registered if not specified.
$system = $params->get('new_usertype', 2);
$this->data->groups[] = $system;
// Unset the passwords.
unset($this->data->password1);
unset($this->data->password2);
// Get the dispatcher and load the users plugins.
$dispatcher = JEventDispatcher::getInstance();
JPluginHelper::importPlugin('user');
// Trigger the data preparation event.
$results = $dispatcher->trigger('onContentPrepareData', array('com_users.registration', $this->data));
// Check for errors encountered while preparing the data.
if (count($results) && in_array(false, $results, true))
{
$this->setError($dispatcher->getError());
$this->data = false;
}
}
return $this->data;
}
/**
* Method to get the registration form.
*
* The base form is loaded from XML and then an event is fired
* for users plugins to extend the form with extra fields.
*
* @param array $data An optional array of data for the form to interogate.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
*
* @return JForm A JForm object on success, false on failure
*
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_users.registration', 'registration', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
{
return false;
}
return $form;
}
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
*
* @since 1.6
*/
protected function loadFormData()
{
$data = $this->getData();
$this->preprocessData('com_users.registration', $data);
return $data;
}
/**
* Override preprocessForm to load the user plugin group instead of content.
*
* @param JForm $form A JForm object.
* @param mixed $data The data expected for the form.
* @param string $group The name of the plugin group to import (defaults to "content").
*
* @return void
*
* @since 1.6
* @throws Exception if there is an error in the form event.
*/
protected function preprocessForm(JForm $form, $data, $group = 'user')
{
$userParams = JComponentHelper::getParams('com_users');
//Add the choice for site language at registration time
if ($userParams->get('site_language') == 1 && $userParams->get('frontend_userparams') == 1)
{
$form->loadFile('sitelang', false);
}
parent::preprocessForm($form, $data, $group);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState()
{
// Get the application object.
$app = JFactory::getApplication();
$params = $app->getParams('com_users');
// Load the parameters.
$this->setState('params', $params);
}
/**
* Method to save the form data.
*
* @param array $temp The form data.
*
* @return mixed The user id on success, false on failure.
*
* @since 1.6
*/
public function register($temp)
{
$params = JComponentHelper::getParams('com_users');
// Initialise the table with JUser.
$user = new JUser;
$data = (array) $this->getData();
// Merge in the registration data.
foreach ($temp as $k => $v)
{
$data[$k] = $v;
}
// Prepare the data for the user object.
$data['email'] = JStringPunycode::emailToPunycode($data['email1']);
$data['password'] = $data['password1'];
$useractivation = $params->get('useractivation');
$sendpassword = $params->get('sendpassword', 1);
// Check if the user needs to activate their account.
if (($useractivation == 1) || ($useractivation == 2))
{
$data['activation'] = JApplication::getHash(JUserHelper::genRandomPassword());
$data['block'] = 1;
}
// Bind the data.
if (!$user->bind($data))
{
$this->setError(JText::sprintf('COM_USERS_REGISTRATION_BIND_FAILED', $user->getError()));
return false;
}
// Load the users plugin group.
JPluginHelper::importPlugin('user');
// Store the data.
if (!$user->save())
{
$this->setError(JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $user->getError()));
return false;
}
$config = JFactory::getConfig();
$db = $this->getDbo();
$query = $db->getQuery(true);
// Compile the notification mail values.
$data = $user->getProperties();
$data['fromname'] = $config->get('fromname');
$data['mailfrom'] = $config->get('mailfrom');
$data['sitename'] = $config->get('sitename');
$data['siteurl'] = JUri::root();
// Handle account activation/confirmation emails.
if ($useractivation == 2)
{
// Set the link to confirm the user email.
$uri = JUri::getInstance();
$base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
$data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);
$emailSubject = JText::sprintf(
'COM_USERS_EMAIL_ACCOUNT_DETAILS',
$data['name'],
$data['sitename']
);
if ($sendpassword)
{
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY',
$data['name'],
$data['sitename'],
$data['activate'],
$data['siteurl'],
$data['username'],
$data['password_clear']
);
}
else
{
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY_NOPW',
$data['name'],
$data['sitename'],
$data['activate'],
$data['siteurl'],
$data['username']
);
}
}
elseif ($useractivation == 1)
{
// Set the link to activate the user account.
$uri = JUri::getInstance();
$base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
$data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);
$emailSubject = JText::sprintf(
'COM_USERS_EMAIL_ACCOUNT_DETAILS',
$data['name'],
$data['sitename']
);
if ($sendpassword)
{
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY',
$data['name'],
$data['sitename'],
$data['activate'],
$data['siteurl'],
$data['username'],
$data['password_clear']
);
}
else
{
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY_NOPW',
$data['name'],
$data['sitename'],
$data['activate'],
$data['siteurl'],
$data['username']
);
}
}
else
{
$emailSubject = JText::sprintf(
'COM_USERS_EMAIL_ACCOUNT_DETAILS',
$data['name'],
$data['sitename']
);
if ($sendpassword)
{
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_REGISTERED_BODY',
$data['name'],
$data['sitename'],
$data['siteurl'],
$data['username'],
$data['password_clear']
);
}
else
{
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_REGISTERED_BODY_NOPW',
$data['name'],
$data['sitename'],
$data['siteurl']
);
}
}
// Send the registration email.
$return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody);
// Send Notification mail to administrators
if (($params->get('useractivation') < 2) && ($params->get('mail_to_admin') == 1))
{
$emailSubject = JText::sprintf(
'COM_USERS_EMAIL_ACCOUNT_DETAILS',
$data['name'],
$data['sitename']
);
$emailBodyAdmin = JText::sprintf(
'COM_USERS_EMAIL_REGISTERED_NOTIFICATION_TO_ADMIN_BODY',
$data['name'],
$data['username'],
$data['siteurl']
);
// Get all admin users
$query->clear()
->select($db->quoteName(array('name', 'email', 'sendEmail')))
->from($db->quoteName('#__users'))
->where($db->quoteName('sendEmail') . ' = ' . 1);
$db->setQuery($query);
try
{
$rows = $db->loadObjectList();
}
catch (RuntimeException $e)
{
$this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500);
return false;
}
// Send mail to all superadministrators id
foreach ($rows as $row)
{
$return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $row->email, $emailSubject, $emailBodyAdmin);
// Check for an error.
if ($return !== true)
{
$this->setError(JText::_('COM_USERS_REGISTRATION_ACTIVATION_NOTIFY_SEND_MAIL_FAILED'));
return false;
}
}
}
// Check for an error.
if ($return !== true)
{
$this->setError(JText::_('COM_USERS_REGISTRATION_SEND_MAIL_FAILED'));
// Send a system message to administrators receiving system mails
$db = JFactory::getDbo();
$query->clear()
->select($db->quoteName(array('name', 'email', 'sendEmail', 'id')))
->from($db->quoteName('#__users'))
->where($db->quoteName('block') . ' = ' . (int) 0)
->where($db->quoteName('sendEmail') . ' = ' . (int) 1);
$db->setQuery($query);
try
{
$sendEmail = $db->loadColumn();
}
catch (RuntimeException $e)
{
$this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500);
return false;
}
if (count($sendEmail) > 0)
{
$jdate = new JDate;
// Build the query to add the messages
foreach ($sendEmail as $userid)
{
$values = array($db->quote($userid), $db->quote($userid), $db->quote($jdate->toSql()), $db->quote(JText::_('COM_USERS_MAIL_SEND_FAILURE_SUBJECT')), $db->quote(JText::sprintf('COM_USERS_MAIL_SEND_FAILURE_BODY', $return, $data['username'])));
$query->clear()
->insert($db->quoteName('#__messages'))
->columns($db->quoteName(array('user_id_from', 'user_id_to', 'date_time', 'subject', 'message')))
->values(implode(',', $values));
$db->setQuery($query);
try
{
$db->execute();
}
catch (RuntimeException $e)
{
$this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500);
return false;
}
}
}
return false;
}
if ($useractivation == 1)
{
return "useractivate";
}
elseif ($useractivation == 2)
{
return "adminactivate";
}
else
{
return $user->id;
}
}
}

View File

@ -0,0 +1,179 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Remind model class for Users.
*
* @package Joomla.Site
* @subpackage com_users
* @since 1.5
*/
class UsersModelRemind extends JModelForm
{
/**
* Method to get the username remind request form.
*
* @param array $data An optional array of data for the form to interogate.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @return JForm A JForm object on success, false on failure
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_users.remind', 'remind', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
{
return false;
}
return $form;
}
/**
* Override preprocessForm to load the user plugin group instead of content.
*
* @param object A form object.
* @param mixed The data expected for the form.
* @throws Exception if there is an error in the form event.
* @since 1.6
*/
protected function preprocessForm(JForm $form, $data, $group = 'user')
{
parent::preprocessForm($form, $data, 'user');
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState()
{
// Get the application object.
$app = JFactory::getApplication();
$params = $app->getParams('com_users');
// Load the parameters.
$this->setState('params', $params);
}
/**
* @since 1.6
*/
public function processRemindRequest($data)
{
// Get the form.
$form = $this->getForm();
$data['email'] = JStringPunycode::emailToPunycode($data['email']);
// Check for an error.
if (empty($form))
{
return false;
}
// Validate the data.
$data = $this->validate($form, $data);
// Check for an error.
if ($data instanceof Exception)
{
return false;
}
// Check the validation results.
if ($data === false)
{
// Get the validation messages from the form.
foreach ($form->getErrors() as $formError)
{
$this->setError($formError->getMessage());
}
return false;
}
// Find the user id for the given email address.
$db = $this->getDbo();
$query = $db->getQuery(true)
->select('*')
->from($db->quoteName('#__users'))
->where($db->quoteName('email') . ' = ' . $db->quote($data['email']));
// Get the user id.
$db->setQuery($query);
try
{
$user = $db->loadObject();
}
catch (RuntimeException $e)
{
$this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500);
return false;
}
// Check for a user.
if (empty($user))
{
$this->setError(JText::_('COM_USERS_USER_NOT_FOUND'));
return false;
}
// Make sure the user isn't blocked.
if ($user->block)
{
$this->setError(JText::_('COM_USERS_USER_BLOCKED'));
return false;
}
$config = JFactory::getConfig();
// Assemble the login link.
$itemid = UsersHelperRoute::getLoginRoute();
$itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
$link = 'index.php?option=com_users&view=login' . $itemid;
$mode = $config->get('force_ssl', 0) == 2 ? 1 : -1;
// Put together the email template data.
$data = JArrayHelper::fromObject($user);
$data['fromname'] = $config->get('fromname');
$data['mailfrom'] = $config->get('mailfrom');
$data['sitename'] = $config->get('sitename');
$data['link_text'] = JRoute::_($link, false, $mode);
$data['link_html'] = JRoute::_($link, true, $mode);
$subject = JText::sprintf(
'COM_USERS_EMAIL_USERNAME_REMINDER_SUBJECT',
$data['sitename']
);
$body = JText::sprintf(
'COM_USERS_EMAIL_USERNAME_REMINDER_BODY',
$data['sitename'],
$data['username'],
$data['link_text']
);
// Send the password reset request email.
$return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $user->email, $subject, $body);
// Check for an error.
if ($return !== true)
{
$this->setError(JText::_('COM_USERS_MAIL_FAILED'), 500);
return false;
}
return true;
}
}

View File

@ -0,0 +1,475 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Rest model class for Users.
*
* @package Joomla.Site
* @subpackage com_users
* @since 1.5
*/
class UsersModelReset extends JModelForm
{
/**
* Method to get the password reset request form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @return JForm A JForm object on success, false on failure
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_users.reset_request', 'reset_request', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
{
return false;
}
return $form;
}
/**
* Method to get the password reset complete form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @return JForm A JForm object on success, false on failure
* @since 1.6
*/
public function getResetCompleteForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_users.reset_complete', 'reset_complete', $options = array('control' => 'jform'));
if (empty($form))
{
return false;
}
return $form;
}
/**
* Method to get the password reset confirm form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @return JForm A JForm object on success, false on failure
* @since 1.6
*/
public function getResetConfirmForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_users.reset_confirm', 'reset_confirm', $options = array('control' => 'jform'));
if (empty($form))
{
return false;
}
return $form;
}
/**
* Override preprocessForm to load the user plugin group instead of content.
*
* @param object A form object.
* @param mixed The data expected for the form.
* @throws Exception if there is an error in the form event.
* @since 1.6
*/
protected function preprocessForm(JForm $form, $data, $group = 'user')
{
parent::preprocessForm($form, $data, $group);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState()
{
// Get the application object.
$params = JFactory::getApplication()->getParams('com_users');
// Load the parameters.
$this->setState('params', $params);
}
/**
* @since 1.6
*/
function processResetComplete($data)
{
// Get the form.
$form = $this->getResetCompleteForm();
$data['email'] = JStringPunycode::emailToPunycode($data['email']);
// Check for an error.
if ($form instanceof Exception)
{
return $form;
}
// Filter and validate the form data.
$data = $form->filter($data);
$return = $form->validate($data);
// Check for an error.
if ($return instanceof Exception)
{
return $return;
}
// Check the validation results.
if ($return === false)
{
// Get the validation messages from the form.
foreach ($form->getErrors() as $formError)
{
$this->setError($formError->getMessage());
}
return false;
}
// Get the token and user id from the confirmation process.
$app = JFactory::getApplication();
$token = $app->getUserState('com_users.reset.token', null);
$userId = $app->getUserState('com_users.reset.user', null);
// Check the token and user id.
if (empty($token) || empty($userId))
{
return new JException(JText::_('COM_USERS_RESET_COMPLETE_TOKENS_MISSING'), 403);
}
// Get the user object.
$user = JUser::getInstance($userId);
// Check for a user and that the tokens match.
if (empty($user) || $user->activation !== $token)
{
$this->setError(JText::_('COM_USERS_USER_NOT_FOUND'));
return false;
}
// Make sure the user isn't blocked.
if ($user->block)
{
$this->setError(JText::_('COM_USERS_USER_BLOCKED'));
return false;
}
// Generate the new password hash.
$salt = JUserHelper::genRandomPassword(32);
$crypted = JUserHelper::getCryptedPassword($data['password1'], $salt);
$password = $crypted . ':' . $salt;
// Update the user object.
$user->password = $password;
$user->activation = '';
$user->password_clear = $data['password1'];
// Save the user to the database.
if (!$user->save(true))
{
return new JException(JText::sprintf('COM_USERS_USER_SAVE_FAILED', $user->getError()), 500);
}
// Flush the user data from the session.
$app->setUserState('com_users.reset.token', null);
$app->setUserState('com_users.reset.user', null);
return true;
}
/**
* @since 1.6
*/
function processResetConfirm($data)
{
// Get the form.
$form = $this->getResetConfirmForm();
$data['email'] = JStringPunycode::emailToPunycode($data['email']);
// Check for an error.
if ($form instanceof Exception)
{
return $form;
}
// Filter and validate the form data.
$data = $form->filter($data);
$return = $form->validate($data);
// Check for an error.
if ($return instanceof Exception)
{
return $return;
}
// Check the validation results.
if ($return === false)
{
// Get the validation messages from the form.
foreach ($form->getErrors() as $formError)
{
$this->setError($formError->getMessage());
}
return false;
}
// Find the user id for the given token.
$db = $this->getDbo();
$query = $db->getQuery(true)
->select('activation')
->select('id')
->select('block')
->from($db->quoteName('#__users'))
->where($db->quoteName('username') . ' = ' . $db->quote($data['username']));
// Get the user id.
$db->setQuery($query);
try
{
$user = $db->loadObject();
}
catch (RuntimeException $e)
{
return new JException(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500);
}
// Check for a user.
if (empty($user))
{
$this->setError(JText::_('COM_USERS_USER_NOT_FOUND'));
return false;
}
$parts = explode(':', $user->activation);
$crypt = $parts[0];
if (!isset($parts[1]))
{
$this->setError(JText::_('COM_USERS_USER_NOT_FOUND'));
return false;
}
$salt = $parts[1];
$testcrypt = JUserHelper::getCryptedPassword($data['token'], $salt);
// Verify the token
if (!($crypt == $testcrypt))
{
$this->setError(JText::_('COM_USERS_USER_NOT_FOUND'));
return false;
}
// Make sure the user isn't blocked.
if ($user->block)
{
$this->setError(JText::_('COM_USERS_USER_BLOCKED'));
return false;
}
// Push the user data into the session.
$app = JFactory::getApplication();
$app->setUserState('com_users.reset.token', $crypt . ':' . $salt);
$app->setUserState('com_users.reset.user', $user->id);
return true;
}
/**
* Method to start the password reset process.
*
* @since 1.6
*/
public function processResetRequest($data)
{
$config = JFactory::getConfig();
// Get the form.
$form = $this->getForm();
$data['email'] = JStringPunycode::emailToPunycode($data['email']);
// Check for an error.
if ($form instanceof Exception)
{
return $form;
}
// Filter and validate the form data.
$data = $form->filter($data);
$return = $form->validate($data);
// Check for an error.
if ($return instanceof Exception)
{
return $return;
}
// Check the validation results.
if ($return === false)
{
// Get the validation messages from the form.
foreach ($form->getErrors() as $formError)
{
$this->setError($formError->getMessage());
}
return false;
}
// Find the user id for the given email address.
$db = $this->getDbo();
$query = $db->getQuery(true)
->select('id')
->from($db->quoteName('#__users'))
->where($db->quoteName('email') . ' = ' . $db->quote($data['email']));
// Get the user object.
$db->setQuery($query);
try
{
$userId = $db->loadResult();
}
catch (RuntimeException $e)
{
$this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500);
return false;
}
// Check for a user.
if (empty($userId))
{
$this->setError(JText::_('COM_USERS_INVALID_EMAIL'));
return false;
}
// Get the user object.
$user = JUser::getInstance($userId);
// Make sure the user isn't blocked.
if ($user->block)
{
$this->setError(JText::_('COM_USERS_USER_BLOCKED'));
return false;
}
// Make sure the user isn't a Super Admin.
if ($user->authorise('core.admin'))
{
$this->setError(JText::_('COM_USERS_REMIND_SUPERADMIN_ERROR'));
return false;
}
// Make sure the user has not exceeded the reset limit
if (!$this->checkResetLimit($user))
{
$resetLimit = (int) JFactory::getApplication()->getParams()->get('reset_time');
$this->setError(JText::plural('COM_USERS_REMIND_LIMIT_ERROR_N_HOURS', $resetLimit));
return false;
}
// Set the confirmation token.
$token = JApplication::getHash(JUserHelper::genRandomPassword());
$salt = JUserHelper::getSalt('crypt-md5');
$hashedToken = md5($token . $salt) . ':' . $salt;
$user->activation = $hashedToken;
// Save the user to the database.
if (!$user->save(true))
{
return new JException(JText::sprintf('COM_USERS_USER_SAVE_FAILED', $user->getError()), 500);
}
// Assemble the password reset confirmation link.
$mode = $config->get('force_ssl', 0) == 2 ? 1 : -1;
$itemid = UsersHelperRoute::getLoginRoute();
$itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
$link = 'index.php?option=com_users&view=reset&layout=confirm' . $itemid;
// Put together the email template data.
$data = $user->getProperties();
$data['fromname'] = $config->get('fromname');
$data['mailfrom'] = $config->get('mailfrom');
$data['sitename'] = $config->get('sitename');
$data['link_text'] = JRoute::_($link, false, $mode);
$data['link_html'] = JRoute::_($link, true, $mode);
$data['token'] = $token;
$subject = JText::sprintf(
'COM_USERS_EMAIL_PASSWORD_RESET_SUBJECT',
$data['sitename']
);
$body = JText::sprintf(
'COM_USERS_EMAIL_PASSWORD_RESET_BODY',
$data['sitename'],
$data['token'],
$data['link_text']
);
// Send the password reset request email.
$return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $user->email, $subject, $body);
// Check for an error.
if ($return !== true)
{
return new JException(JText::_('COM_USERS_MAIL_FAILED'), 500);
}
return true;
}
/**
* Method to check if user reset limit has been exceeded within the allowed time period.
*
* @param JUser the user doing the password reset
*
* @return boolean true if user can do the reset, false if limit exceeded
*
* @since 2.5
*/
public function checkResetLimit($user)
{
$params = JFactory::getApplication()->getParams();
$maxCount = (int) $params->get('reset_count');
$resetHours = (int) $params->get('reset_time');
$result = true;
$lastResetTime = strtotime($user->lastResetTime) ? strtotime($user->lastResetTime) : 0;
$hoursSinceLastReset = (strtotime(JFactory::getDate()->toSql()) - $lastResetTime) / 3600;
// If it's been long enough, start a new reset count
if ($hoursSinceLastReset > $resetHours)
{
$user->lastResetTime = JFactory::getDate()->toSql();
$user->resetCount = 1;
}
// If we are under the max count, just increment the counter
elseif ($user->resetCount < $maxCount)
{
$user->resetCount;
}
// At this point, we know we have exceeded the maximum resets for the time period
else
{
$result = false;
}
return $result;
}
}

View File

@ -0,0 +1,242 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Function to build a Users URL route.
*
* @return array The array of query string values for which to build a route.
* @return array The URL route with segments represented as an array.
* @since 1.5
*/
function UsersBuildRoute(&$query)
{
// Declare static variables.
static $items;
static $default;
static $registration;
static $profile;
static $login;
static $remind;
static $resend;
static $reset;
$segments = array();
// Get the relevant menu items if not loaded.
if (empty($items))
{
// Get all relevant menu items.
$app = JFactory::getApplication();
$menu = $app->getMenu();
$items = $menu->getItems('component', 'com_users');
// Build an array of serialized query strings to menu item id mappings.
for ($i = 0, $n = count($items); $i < $n; $i++)
{
// Check to see if we have found the resend menu item.
if (empty($resend) && !empty($items[$i]->query['view']) && ($items[$i]->query['view'] == 'resend'))
{
$resend = $items[$i]->id;
}
// Check to see if we have found the reset menu item.
if (empty($reset) && !empty($items[$i]->query['view']) && ($items[$i]->query['view'] == 'reset'))
{
$reset = $items[$i]->id;
}
// Check to see if we have found the remind menu item.
if (empty($remind) && !empty($items[$i]->query['view']) && ($items[$i]->query['view'] == 'remind'))
{
$remind = $items[$i]->id;
}
// Check to see if we have found the login menu item.
if (empty($login) && !empty($items[$i]->query['view']) && ($items[$i]->query['view'] == 'login'))
{
$login = $items[$i]->id;
}
// Check to see if we have found the registration menu item.
if (empty($registration) && !empty($items[$i]->query['view']) && ($items[$i]->query['view'] == 'registration'))
{
$registration = $items[$i]->id;
}
// Check to see if we have found the profile menu item.
if (empty($profile) && !empty($items[$i]->query['view']) && ($items[$i]->query['view'] == 'profile'))
{
$profile = $items[$i]->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;
}
}
return $segments;
}
/**
* Function to parse a Users URL route.
*
* @return array The URL route with segments represented as an array.
* @return array The array of variables to set in the request.
* @since 1.5
*/
function UsersParseRoute($segments)
{
$vars = array();
// 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 $vars;
}
if (is_numeric($userId))
{
// Get the package id from the packages table by alias.
$db = JFactory::getDbo();
$db->setQuery(
'SELECT ' . $db->quoteName('id') .
' FROM ' . $db->quoteName('#__users') .
' WHERE ' . $db->quoteName('id') . ' = ' . (int) $userId
);
$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'));
}
return $vars;
}

View File

@ -0,0 +1,16 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
require_once JPATH_COMPONENT.'/helpers/route.php';
$controller = JControllerLegacy::getInstance('Users');
$controller->execute(JFactory::getApplication()->input->get('task', 'display'));
$controller->redirect();

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view title="Login">
<message><![CDATA[TYPESEARCHDESC]]></message>
</view>
</metadata>

View File

@ -0,0 +1,18 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
if ($this->user->get('guest')):
// The user is not logged in.
echo $this->loadTemplate('login');
else:
// The user is already logged in.
echo $this->loadTemplate('logout');
endif;

View File

@ -0,0 +1,87 @@
<?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" label="COM_MENUS_BASIC_FIELDSET_LABEL">
<field
name="login_redirect_url"
type="text"
label="JFIELD_LOGIN_REDIRECT_URL_LABEL"
description="JFIELD_LOGIN_REDIRECT_URL_DESC"
class="inputbox"/>
<field
name="logindescription_show"
type="list"
label="JFIELD_BASIS_LOGIN_DESCRIPTION_SHOW_LABEL"
description="JFIELD_BASIS_LOGIN_DESCRIPTION_SHOW_DESC"
default="1">
<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"/>
<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="logout_redirect_url"
type="text"
label="JFIELD_LOGOUT_REDIRECT_URL_LABEL"
description="JFIELD_LOGOUT_REDIRECT_URL_DESC"
class="inputbox"/>
<field
name="logoutdescription_show"
type="list"
label="JFIELD_BASIS_LOGOUT_DESCRIPTION_SHOW_LABEL"
description="JFIELD_BASIS_LOGOUT_DESCRIPTION_SHOW_DESC"
default="1">
<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"/>
<field
name="logout_image"
type="media"
label="JFIELD_LOGOUT_IMAGE_LABEL"
description="JFIELD_LOGOUT_IMAGE_DESC"/>
</fieldset>
</fields>
</metadata>

View File

@ -0,0 +1,83 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('behavior.keepalive');
?>
<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_USER_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-horizontal">
<fieldset class="well">
<?php foreach ($this->form->getFieldset('credentials') as $field) : ?>
<?php if (!$field->hidden) : ?>
<div class="control-group">
<div class="control-label">
<?php echo $field->label; ?>
</div>
<div class="controls">
<?php echo $field->input; ?>
</div>
</div>
<?php endif; ?>
<?php endforeach; ?>
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-primary"><?php echo JText::_('JLOGIN'); ?></button>
</div>
</div>
<input type="hidden" name="return" value="<?php echo base64_encode($this->params->get('login_redirect_url', $this->form->getValue('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');
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>

View File

@ -0,0 +1,46 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @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">
<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>
<input type="hidden" name="return" value="<?php echo base64_encode($this->params->get('logout_redirect_url', $this->form->getValue('return'))); ?>" />
<?php echo JHtml::_('form.token'); ?>
</form>
</div>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,119 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Login view class for Users.
*
* @package Joomla.Site
* @subpackage com_users
* @since 1.5
*/
class UsersViewLogin extends JViewLegacy
{
protected $form;
protected $params;
protected $state;
protected $user;
/**
* Method to display the view.
*
* @param string The template file to include
* @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']);
}
//Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
$this->prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document
* @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->getCfg('sitename');
}
elseif ($app->getCfg('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
}
elseif ($app->getCfg('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('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'));
}
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view title="Profile">
<message><![CDATA[TYPESEARCHDESC]]></message>
</view>
</metadata>

View File

@ -0,0 +1,34 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @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>

View File

@ -0,0 +1,11 @@
<?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>

View File

@ -0,0 +1,54 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @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->data->name; ?>
</dd>
<dt>
<?php echo JText::_('COM_USERS_PROFILE_USERNAME_LABEL'); ?>
</dt>
<dd>
<?php echo htmlspecialchars($this->data->username); ?>
</dd>
<dt>
<?php echo JText::_('COM_USERS_PROFILE_REGISTERED_DATE_LABEL'); ?>
</dt>
<dd>
<?php echo JHtml::_('date', $this->data->registerDate); ?>
</dd>
<dt>
<?php echo JText::_('COM_USERS_PROFILE_LAST_VISITED_DATE_LABEL'); ?>
</dt>
<?php if ($this->data->lastvisitDate != '0000-00-00 00:00:00'){?>
<dd>
<?php echo JHtml::_('date', $this->data->lastvisitDate); ?>
</dd>
<?php }
else
{?>
<dd>
<?php echo JText::_('COM_USERS_PROFILE_NEVER_VISITED'); ?>
</dd>
<?php } ?>
</dl>
</fieldset>

View File

@ -0,0 +1,53 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('JHtmlUsers', JPATH_COMPONENT . '/helpers/html/users.php');
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']);
foreach ($fieldsets as $group => $fieldset): // Iterate through the form fieldsets
$fields = $this->form->getFieldset($group);
if (count($fields)):
?>
<?php //if ($this->params->get('show_tags')) : ?>
<?php //$this->tagLayout = new JLayoutFile('joomla.content.tags'); ?>
<?php //echo $this->tagLayout->render($this->tags); ?>
<?php // endif; ?>
<fieldset id="users-profile-custom" class="users-profile-custom-<?php echo $group;?>">
<?php if (isset($fieldset->label)):// If the fieldset has a label set, display it as the legend.?>
<legend><?php echo JText::_($fieldset->label); ?></legend>
<?php endif;?>
<dl class="dl-horizontal">
<?php foreach ($fields as $field):
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;?>
<?php endforeach;?>

View File

@ -0,0 +1,44 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('JHtmlUsers', JPATH_COMPONENT . '/helpers/html/users.php');
JHtml::register('users.spacer', array('JHtmlUsers', 'spacer'));
JHtml::register('users.helpsite', array('JHtmlUsers', 'helpsite'));
JHtml::register('users.templatestyle', array('JHtmlUsers', 'templatestyle'));
JHtml::register('users.admin_language', array('JHtmlUsers', 'admin_language'));
JHtml::register('users.language', array('JHtmlUsers', 'language'));
JHtml::register('users.editor', array('JHtmlUsers', 'editor'));
?>
<?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):
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;?>

View File

@ -0,0 +1,68 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidation');
//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; ?>
<form id="member-profile" action="<?php echo JRoute::_('index.php?option=com_users&task=profile.save'); ?>" method="post" class="form-validate form-horizontal" enctype="multipart/form-data">
<?php foreach ($this->form->getFieldsets() as $group => $fieldset):// Iterate through the form fieldsets and display each one.?>
<?php $fields = $this->form->getFieldset($group);?>
<?php if (count($fields)):?>
<fieldset>
<?php if (isset($fieldset->label)):// If the fieldset has a label set, display it as the legend.?>
<legend><?php echo JText::_($fieldset->label); ?></legend>
<?php endif;?>
<?php foreach ($fields as $field):// Iterate through the fields in the set and display them.?>
<?php if ($field->hidden):// If the field is hidden, just display the input.?>
<div class="control-group">
<div class="controls">
<?php echo $field->input;?>
</div>
</div>
<?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 echo $field->input; ?>
</div>
</div>
<?php endif;?>
<?php endforeach;?>
</fieldset>
<?php endif;?>
<?php endforeach;?>
<div class="form-actions">
<button type="submit" class="btn btn-primary validate"><span><?php echo JText::_('JSUBMIT'); ?></span></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="profile.save" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
</div>

View File

@ -0,0 +1,11 @@
<?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>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,129 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Profile view class for Users.
*
* @package Joomla.Site
* @subpackage com_users
* @since 1.6
*/
class UsersViewProfile extends JViewLegacy
{
protected $data;
protected $form;
protected $params;
protected $state;
/**
* Method to display the view.
*
* @param string $tpl The template file to include
* @since 1.6
*/
public function display($tpl = null)
{
// Get the view data.
$this->data = $this->get('Data');
$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 if a user was found.
if (!$this->data->id)
{
JError::raiseError(404, JText::_('JERROR_USERS_PROFILE_NOT_FOUND'));
return false;
}
$this->data->tags = new JHelperTags;
$this->data->tags->getItemTags('com_users.user.', $this->data->id);
// 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();
parent::display($tpl);
}
/**
* Prepares the document
*
* @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->getCfg('sitename');
}
elseif ($app->getCfg('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
}
elseif ($app->getCfg('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('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'));
}
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view title="Registration">
<message><![CDATA[TYPESEARCHDESC]]></message>
</view>
</metadata>

View File

@ -0,0 +1,18 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @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>

View File

@ -0,0 +1,59 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidation');
?>
<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" enctype="multipart/form-data">
<?php foreach ($this->form->getFieldsets() as $fieldset): // Iterate through the form fieldsets and display each one.?>
<?php $fields = $this->form->getFieldset($fieldset->name);?>
<?php if (count($fields)):?>
<fieldset>
<?php if (isset($fieldset->label)):// If the fieldset has a label set, display it as the legend.
?>
<legend><?php echo JText::_($fieldset->label);?></legend>
<?php endif;?>
<?php foreach ($fields as $field) :// Iterate through the fields in the set and display them.?>
<?php if ($field->hidden):// If the field is hidden, just display the input.?>
<?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 echo $field->input;?>
</div>
</div>
<?php endif;?>
<?php endforeach;?>
</fieldset>
<?php endif;?>
<?php endforeach;?>
<div class="form-actions">
<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" />
<?php echo JHtml::_('form.token');?>
</div>
</form>
</div>

View File

@ -0,0 +1,11 @@
<?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>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,118 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Registration view class for Users.
*
* @package Joomla.Site
* @subpackage com_users
* @since 1.6
*/
class UsersViewRegistration extends JViewLegacy
{
protected $data;
protected $form;
protected $params;
protected $state;
/**
* Method to display the view.
*
* @param string The template file to include
* @since 1.6
*/
public function display($tpl = null)
{
// Get the view data.
$this->data = $this->get('Data');
$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']);
}
//Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
$this->prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document.
*
* @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->getCfg('sitename');
}
elseif ($app->getCfg('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
}
elseif ($app->getCfg('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('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'));
}
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view title="Remind">
<message><![CDATA[TYPESEARCHDESC]]></message>
</view>
</metadata>

View File

@ -0,0 +1,47 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidation');
?>
<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">
<?php foreach ($this->form->getFieldsets() as $fieldset) : ?>
<p><?php echo JText::_($fieldset->label); ?></p>
<fieldset>
<?php foreach ($this->form->getFieldset($fieldset->name) as $name => $field) : ?>
<div class="control-group">
<div class="control-label">
<?php echo $field->label; ?>
</div>
<div class="controls">
<?php echo $field->input; ?>
</div>
</div>
<?php endforeach; ?>
</fieldset>
<?php endforeach; ?>
<div class="form-actions">
<button type="submit" class="btn btn-primary validate"><?php echo JText::_('JSUBMIT'); ?></button>
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
</div>

View File

@ -0,0 +1,11 @@
<?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>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,115 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Registration view class for Users.
*
* @package Joomla.Site
* @subpackage com_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
* @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'));
$this->prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document.
*
* @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->getCfg('sitename');
}
elseif ($app->getCfg('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
}
elseif ($app->getCfg('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('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'));
}
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view title="Reset">
<message><![CDATA[TYPESEARCHDESC]]></message>
</view>
</metadata>

View File

@ -0,0 +1,40 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidation');
?>
<div class="reset-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; ?>
<form action="<?php echo JRoute::_('index.php?option=com_users&task=reset.complete'); ?>" method="post" class="form-validate">
<?php foreach ($this->form->getFieldsets() as $fieldset) : ?>
<p><?php echo JText::_($fieldset->label); ?></p> <fieldset>
<dl>
<?php foreach ($this->form->getFieldset($fieldset->name) as $name => $field) : ?>
<dt><?php echo $field->label; ?></dt>
<dd><?php echo $field->input; ?></dd>
<?php endforeach; ?>
</dl>
</fieldset>
<?php endforeach; ?>
<div>
<button type="submit" class="validate"><?php echo JText::_('JSUBMIT'); ?></button>
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
</div>

View File

@ -0,0 +1,40 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidation');
?>
<div class="reset-confirm<?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; ?>
<form action="<?php echo JRoute::_('index.php?option=com_users&task=reset.confirm'); ?>" method="post" class="form-validate">
<?php foreach ($this->form->getFieldsets() as $fieldset) : ?>
<p><?php echo JText::_($fieldset->label); ?></p> <fieldset>
<dl>
<?php foreach ($this->form->getFieldset($fieldset->name) as $name => $field) : ?>
<dt><?php echo $field->label; ?></dt>
<dd><?php echo $field->input; ?></dd>
<?php endforeach; ?>
</dl>
</fieldset>
<?php endforeach; ?>
<div>
<button type="submit" class="validate"><?php echo JText::_('JSUBMIT'); ?></button>
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
</div>

View File

@ -0,0 +1,48 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('behavior.keepalive');
JHtml::_('behavior.formvalidation');
?>
<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">
<?php foreach ($this->form->getFieldsets() as $fieldset) : ?>
<p><?php echo JText::_($fieldset->label); ?></p>
<fieldset>
<?php foreach ($this->form->getFieldset($fieldset->name) as $name => $field) : ?>
<div class="control-group">
<div class="control-label">
<?php echo $field->label; ?>
</div>
<div class="controls">
<?php echo $field->input; ?>
</div>
</div>
<?php endforeach; ?>
</fieldset>
<?php endforeach; ?>
<div class="form-actions">
<button type="submit" class="btn btn-primary validate"><?php echo JText::_('JSUBMIT'); ?></button>
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
</div>

View File

@ -0,0 +1,11 @@
<?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>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,126 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Reset view class for Users.
*
* @package Joomla.Site
* @subpackage com_users
* @since 1.5
*/
class UsersViewReset extends JViewLegacy
{
protected $form;
protected $params;
protected $state;
/**
* Method to display the view.
*
* @param string The template file to include
* @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'));
$this->prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document.
*
* @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->getCfg('sitename');
}
elseif ($app->getCfg('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
}
elseif ($app->getCfg('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('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'));
}
}
}