<?php

/**
 *
 * @copyright  2010 frasq.org
 * @version    1
 * @link       http://www.frasq.org
 */

require_once 'tokenid.php';

function register($lang) {
	$name=$mail=$confirmed=$code=$token=false;

	$missing_code=false;
	$bad_code=false;

	$bad_token=false;

	$missing_name=false;
	$bad_name=false;
	$missing_mail=false;
	$bad_mail=false;
	$missing_confirmation=false;

	$duplicated_name=false;
	$duplicated_mail=false;

	$account_created=false;
	$user_page=false;

	$internal_error=false;
	$contact_page=false;

	$with_captcha=true;

	$_SESSION['register_token'] = $token = token_id();

	$errors = compact('missing_name', 'bad_name', 'missing_mail', 'bad_mail', 'missing_confirmation', 'missing_code', 'bad_code', 'duplicated_name', 'duplicated_mail', 'internal_error', 'contact_page');
	$infos = compact('user_page');

	$output = view('register', $lang, compact('token', 'with_captcha', 'name', 'mail', 'confirmed', 'account_created', 'errors', 'infos'));

	return $output;
}
