Source for file logon.php
Documentation is available at logon.php
<?php //if (empty($_SESSION['RG']['Retreat'])) { display_error_page('session_expired'); }
* <b>Class Description</b>: controller class for login screen.
* Created On: 30 March 2009
* @author Jan van der Breggen
* @subpackage RetreatRegistrationControllers
* @see controllersPackage.php
* @todo gather requirements and implement functionality
/*-----------------------------------------------------------------------------*/
/* Logon - Display the form */
/*-----------------------------------------------------------------------------*/
function index($ErrorMsg = '')
$this->_init('','',false);
$this->View['text_to_display'] = $GLOBALS['lang']['title_logon'];
// If exists, display the error message
$this->View['error_message_logon'] = $ErrorMsg;
// Display in the email field the last email saved in the session
// Its for the usability only.
if (empty($_POST['email']) and !empty($_SESSION['RG']['USER']['Email']))
$_POST['email'] = $_SESSION['RG']['USER']['Email'];
} elseif (!empty($_POST['email']) and empty($ErrorMsg))
$_SESSION['RG']['USER']['Email'] = $_POST['email'];
// Display the email after the post
if (!empty($_POST['email'])) {
$this->View['logon_email'] = $_POST['email'];
$this->View['page_to_display'] = 'logon';
display_view('view_template_mainscreen', $this->View);
/*-----------------------------------------------------------------------------*/
/* Logon - Form verification */
/*-----------------------------------------------------------------------------*/
* * Set the rules to validate the data
$Rules['email'] = 'trim|required|valid_email';
$Rules['password'] = 'required';
$Names['email'] = $GLOBALS['lang']['label_your_email'];
$Names['password'] = $GLOBALS['lang']['label_rigpa_password'];
$valid = new Validation_Old();
$ErrorMsg = $valid->valid($Rules, $Names);
//$authentication = new model_students();
* load the local user file
$Data = $this->_checkAcl($_POST['email'], $_POST['password']);
* Check for logon in the database
if (empty($Data['local_key']))
$Data = $authentication->selectLogon($_POST['email'], $_POST['password']);
* If logon wrong, display an error message.
if (empty($Data['local_key']))
$ErrorMsg = $GLOBALS['lang']['error_unknow_logon'];
$_SESSION['RG']['USER']['id'] = $Data['local_key'];
$_SESSION['RG']['USER']['Email'] = $_POST['email'];
$_SESSION['RG']['USER']['FirstName'] = $Data['first_name'];
$_SESSION['RG']['USER']['LastName'] = $Data['last_name'];
$_SESSION['RG']['USER']['Roles'] = 'roles here';//$authentication->getRoles($Data['local_key']);
$_SESSION['Object']= serialize(new User($Data['local_key'],$Data['first_name'],
$Data['last_name'],$_POST['email'],$_SESSION['RG']['USER']['Roles']));
$x = new externalDataServerConnection();
redirect('applicationSetupOne');
* If errors occurred, display it
$ErrorMsg = '<ul class="error_message">' . $ErrorMsg . '</ul>';
return array('local_key' => - 1,
$config[$cf[0]] = $cf[1];
|