Source for file users_lib.php
Documentation is available at users_lib.php
* @param array $pParamHash
* @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
global $gBitSmarty, $gBitSystem;
$siteName = $gBitSystem->getConfig('site_title', $_SERVER['HTTP_HOST'] );
$gBitSmarty->assign( 'siteName', $_SERVER["SERVER_NAME"] );
$gBitSmarty->assign( 'mail_site', $_SERVER["SERVER_NAME"] );
$gBitSmarty->assign( 'mail_user', $pParamHash['login'] );
if( !empty( $_REQUEST['admin_verify_user'] ) && !empty( $pParamHash['user_store']['provpass'] )) {
$apass = $pParamHash['user_store']['provpass'];
$machine = httpPrefix(). USERS_PKG_URL. 'confirm.php';
$gBitSmarty->assign( 'mail_machine', $machine );
$gBitSmarty->assign( 'mailUserId', $pParamHash['user_store']['user_id'] );
$gBitSmarty->assign( 'mailProvPass', $apass );
$mail_data = $gBitSmarty->fetch( 'bitpackage:users/admin_validation_mail.tpl' );
mail( $pParamHash['email'], $siteName. ' - '. tra( 'Your registration information' ),$mail_data,"From: ". $gBitSystem->getConfig( 'site_sender_email' ). "\r\nContent-type: text/plain;charset=utf-8\r\n" );
$gBitSmarty->assign( 'showmsg', 'n' );
'confirm' => 'Validation email sent to '. $pParamHash['email']. '.'
} elseif( !empty( $pParamHash['password'] )) {
$gBitSmarty->assign( 'mailPassword',$pParamHash['password'] );
$gBitSmarty->assign( 'mailEmail',$pParamHash['email'] );
$mail_data = $gBitSmarty->fetch( 'bitpackage:users/admin_welcome_mail.tpl' );
mail( $pParamHash["email"], tra( 'Welcome to' ). ' '. $siteName,$mail_data,"From: ". $gBitSystem->getConfig('site_sender_email'). "\r\nContent-type: text/plain;charset=utf-8\r\n" );
'welcome' => 'Welcome email sent to '. $pParamHash['email']. '.'
* @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
$trans = array( "@" => tra(" AT "),
$ret = strtr($email, $trans);
for ($i = strpos($email, "@") + 1; $i < strlen($email); $i++ ) {
if ($encoded[$i] != ".") $encoded[$i] = 'x';
for( $i = 0; $i < strlen( $email ); $i++ ) {
$encoded .= '&#' . ord( $email[$i] ). ';';
global $gBitSystem, $gBitUser;
$https_mode = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off';
$url = $gBitSystem->getConfig( 'site_https_domain' );
$site_https_port = $gBitSystem->getConfig('site_https_port', 443);
if ($site_https_port != 443)
$url .= ':' . $site_https_port;
$url .= $gBitSystem->getConfig( 'site_https_prefix' ) . $_SERVER['REQUEST_URI'];
$url .= (!empty( $_SERVER['QUERY_STRING'] )? '&': '?') . SID;
header("Location: https://$url");
$user = isset ($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : false;
$pass = isset ($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : false;
// verify the user is valid first
if( $gBitUser->validate( $user, $pass, $challenge, $response ) ){
// log in user - returns a url so can't use it for validation check
$gBitUser->login( $user, $pass, $challenge, $response );
header('WWW-Authenticate: Basic realm="Test"');
header('HTTP/1.0 401 Unauthorized');
$gBitSystem->fatalError( tra('HTTP Authentication Canceled') );
|