Merge with quitta-gsoc-2013

--HG--
branch : rc-botanic-webdev
This commit is contained in:
Botanic 2013-06-18 10:22:43 -07:00
commit 9b16fccc8d
8 changed files with 200 additions and 177 deletions

View file

@ -27,13 +27,13 @@ class Users{
'status' => 1, 'status' => 1,
'access' => REQUEST_TIME 'access' => REQUEST_TIME
); );
user_save( NULL, $edit ); //user_save( NULL, $edit );
header( 'Location: email_sent.php' ); header( 'Location: email_sent.php' );
exit; exit;
}else{ }else{
$pageElements = array( $pageElements = array(
'GAME_NAME' => variable_get( 'ryzommanage_game-name', '' ), //'GAME_NAME' => variable_get( 'ryzommanage_game-name', '' ),
'WELCOME_MESSAGE' => variable_get( 'ryzommanage_register-welcome', '' ), //'WELCOME_MESSAGE' => variable_get( 'ryzommanage_register-welcome', '' ),
'USERNAME' => $user, 'USERNAME' => $user,
'PASSWORD' => $pass, 'PASSWORD' => $pass,
'CPASSWORD' => $cpass, 'CPASSWORD' => $cpass,
@ -84,10 +84,10 @@ class Users{
return "Username must be 5 or more characters."; return "Username must be 5 or more characters.";
}elseif ( !preg_match( '/^[a-z0-9\.]*$/', $username ) ){ }elseif ( !preg_match( '/^[a-z0-9\.]*$/', $username ) ){
return "Username can only contain numbers and letters."; return "Username can only contain numbers and letters.";
}elseif ( sql :: db_query( "SELECT COUNT(*) FROM {users} WHERE name = :name", array( /*}elseif ( sql :: db_query( "SELECT COUNT(*) FROM {users} WHERE name = :name", array(
':name' => $username ':name' => $username
) ) -> fetchField() ){ ) ) -> fetchField() ){
return "Username " . $username . " is in use."; return "Username " . $username . " is in use.";*/
}else{ }else{
return "success"; return "success";
} }
@ -139,12 +139,12 @@ class Users{
public function checkEmail( $email ) public function checkEmail( $email )
{ {
if ( isset( $email ) ){ if ( isset( $email ) ){
if ( !validEmail( $email ) ){ if ( !Users::validEmail( $email ) ){
return "Email address is not valid."; return "Email address is not valid.";
}elseif ( db_query( "SELECT COUNT(*) FROM {users} WHERE mail = :mail", array( /*}elseif ( db_query( "SELECT COUNT(*) FROM {users} WHERE mail = :mail", array(
':mail' => $email ':mail' => $email
) ) -> fetchField() ){ ) ) -> fetchField() ){
return "Email is in use."; return "Email is in use.";*/
}else{ }else{
return "success"; return "success";
} }
@ -153,8 +153,8 @@ class Users{
} }
return "fail"; return "fail";
} }
public function validEmail( $email )
{ public function validEmail( $email ){
$isValid = true; $isValid = true;
$atIndex = strrpos( $email, "@" ); $atIndex = strrpos( $email, "@" );
if ( is_bool( $atIndex ) && !$atIndex ){ if ( is_bool( $atIndex ) && !$atIndex ){
@ -196,6 +196,7 @@ class Users{
} }
return $isValid; return $isValid;
} }
public function generateSALT( $length = 2 ) public function generateSALT( $length = 2 )
{ {
// start with a blank salt // start with a blank salt

View file

@ -7,20 +7,27 @@
[register] [register]
title = "RYZOM CORE INGAME REGISTRATION" title = "RYZOM CORE INGAME REGISTRATION"
welcome_message = "Welcome! Please fill in the following fields to get your new Ryzom Core account:" welcome_message = "Welcome! Please fill in the following fields to get your new Ryzom Core account"
username_tag = "Desired Username:" username_tag = "Desired Username"
username_tooltip = "5-12 lower-case characters and numbers. The login (username) you create here will be your login name. The name of your game characters will be chosen later on." username_tooltip = "5-12 lower-case characters and numbers. The login (username) you create here will be your login name. The name of your game characters will be chosen later on."
username_default = "Username"
password_tag = "Desired Password:" password_tag = "Desired Password"
password_tooltip = "Pick a hard to guess password (it must be 5-20 characters)."
password_message = "Password must be 5-20 characters." password_message = "Password must be 5-20 characters."
password_default = "Password"
cpassword_tag = "Confirm Password:" cpassword_tag = "Confirm Password"
cpassword_tooltip = "Retype your Password"
cpassword_message = "Retype your Password" cpassword_message = "Retype your Password"
cpassword_default = "Re-enter Password"
email_tag = "Email Address (to which a confirmation email will be sent):" email_tag = "Email Address"
email_tooltip = "Email Address to which a confirmation email will be sent."
email_message = "Please verify that the e-mail address you enter here is valid and will remain valid in the future. It will only be used to manage your Ryzom Core account." email_message = "Please verify that the e-mail address you enter here is valid and will remain valid in the future. It will only be used to manage your Ryzom Core account."
email_default = "Email"
tac_tag = "YES, I agree to the terms of service." tac_tag = "YES, I agree to the <a href="toc.php">terms of service.</a>"
tac_message = "You must accept the Terms of Service." tac_message = "You must accept the Terms of Service."

View file

@ -1,6 +1,7 @@
<?php <?php
function add_user(){
function add_user(){
// add user locally here // add user locally here
$return = users :: add_user(); $return = users :: add_user();
return $return; return $return;

View file

@ -2,22 +2,38 @@
require( '../config.php' ); require( '../config.php' );
require( '../../ams_lib/libinclude.php' ); require( '../../ams_lib/libinclude.php' );
//default page
$page = 'login';
if ( isset( $_POST["function"] ) ){ if ( isset( $_POST["function"] ) ){
require( "inc/" . $_POST["function"] . ".php" ); require( "inc/" . $_POST["function"] . ".php" );
$return = $_POST["function"](); $tempReturn = $_POST["function"]();
$functionReturn = array_merge($tempReturn,$_POST);
if ( isset($_POST["callBack"])){
$page = $_POST["callBack"];
} }
}
function loadpage ( $page ){ function loadpage ( $page ){
require_once( 'autoload/' . $page . '.php' ); require_once( 'autoload/' . $page . '.php' );
} }
$page = 'home';
if ( isset( $_GET["page"] ) ){ if ( isset( $_GET["page"] ) ){
$page = $_GET["page"]; $page = $_GET["page"];
} }
// temporary set permission to 1 which = admin mode //Page Handling
$return = array( 'permission' => 1, 'no_visible_elements' => 'FALSE' ); if($page == 'login' || $page == 'register'){
$no_visible_elements = 'TRUE';
}
if ( isset($functionReturn) ){
$return = array_merge(array( 'permission' => 1, 'no_visible_elements' => $no_visible_elements ),$functionReturn);
}else{
$return = array( 'permission' => 1, 'no_visible_elements' => $no_visible_elements );
}
//print_r($return);
helpers :: loadTemplate( $page , $return ); helpers :: loadTemplate( $page , $return );

View file

@ -1,13 +1,13 @@
function show_help(help_tip) function show_help(help_tip)
{ {
if(help_tip =='test') if(help_tip =='intro')
{ {
var tour = new Tour(); var tour = new Tour();
tour.addStep({ tour.addStep({
element: ".brand:first", /* html element next to which the step popover should be shown */ element: ".brand:first", /* html element next to which the step popover should be shown */
placement: "bottom", placement: "bottom",
title: "Custom Tour", /* title of the popover */ title: "Account Management System", /* title of the popover */
content: "You can create tour like this. Click Next." /* content of the popover */ content: "Welcome to the Ryzom Core Account Management System! Let's explore it together... Click next!" /* content of the popover */
}); });
tour.addStep({ tour.addStep({
element: ".theme-container", element: ".theme-container",

View file

@ -36,16 +36,14 @@
<div class="box-header well"> <div class="box-header well">
<h2><i class="icon-info-sign"></i> Introduction</h2> <h2><i class="icon-info-sign"></i> Introduction</h2>
<div class="box-icon"> <div class="box-icon">
<a href="#" class="btn btn-round" onclick="javascript:show_help('test');return false;"><i class="icon-info-sign"></i></a> <a href="#" class="btn btn-round" onclick="javascript:show_help('intro');return false;"><i class="icon-info-sign"></i></a>
<a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a> <a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a>
<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a> <a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a> <a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
</div> </div>
</div> </div>
<div class="box-content"> <div class="box-content">
<h1>Charisma <small>free, premium quality, responsive, multiple skin admin template.</small></h1> <p><strong>Welcome to the Ryzom Core - Account Management System</strong></p>
<p>Its a live demo of the template. I have created Charisma to ease the repeat work I have to do on my projects. Now I re-use Charisma as a base for my admin panel work and I am sharing it with you :)</p>
<p><b>All pages in the menu are functional, take a look at all, please share this with your followers.</b></p>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>

View file

@ -88,7 +88,6 @@
</ul> </ul>
</div> </div>
<!-- theme selector ends --> <!-- theme selector ends -->
<button onclick="show_help('test')">Help Test</button>
<!-- user dropdown starts --> <!-- user dropdown starts -->
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
@ -134,6 +133,8 @@
{/if} {/if}
{block name=content}{/block} {block name=content}{/block}
{if ! isset($no_visible_elements) or $no_visible_elements eq "FALSE"} {if ! isset($no_visible_elements) or $no_visible_elements eq "FALSE"}
</div><!--/#content.span10--> </div><!--/#content.span10-->
{/if} {/if}

View file

@ -12,119 +12,118 @@
<div class="alert alert-info"> <div class="alert alert-info">
{$welcome_message} {$welcome_message}
</div> </div>
<form id="signup" class="form-vertical" method="post" action="index.php">
<legend>{$title}</legend>
<div class="control-group {if isset($USERNAME_ERROR) and $USERNAME_ERROR eq "TRUE"}error{else if
<form name="Page1"method="post"> isset($USERNAME) and $USERNAME eq "success"}success{else}{/if}">
<table> <label class="control-label">{$username_tag}</label>
<tr> <div class="controls">
<td width="33%" {if isset($USERNAME_ERROR) && $USERNAME_ERROR eq "TRUE"}class="error"{/if} id="caption-Username">{$username_tag} </td> <div class="input-prepend">
<span class="add-on"><i class="icon-user"></i></span>
<td width="25%"> <input type="text" class="input-xlarge" id="Username" name="Username" placeholder="{$username_default}" {if isset($Username)}value="{$Username}"{/if} rel="popover" data-content="{$username_tooltip}" data-original-title="{$username_default}">
<input type="text"
name="Username"
value="{if isset($Username)}{$Username}{/if}"
maxlength="12"
onfocus=
"javascript:showTooltip('{$username_tooltip}', this);" />
</td>
<td id="comment-Username" {if isset($USERNAME_ERROR) && $USERNAME_ERROR eq "TRUE"}class="error"{/if} width="42%">{if isset($Username)}{$Username}{/if}</td>
</tr>
<tr>
<td width="33%" {if isset($PASSWORD_ERROR) && $PASSWORD_ERROR eq "TRUE"}class="error"{/if} id="caption-Password">{$password_tag}</td>
<td width="25%">
<input type="password"
name="Password"
value=""
maxlength="20"
onkeyup=
"testPassword(document.Page1.Password.value, 'comment-Password')"
onfocus="javascript:showTooltip('{$password_message}', this);" />
</td>
<td id="comment-Password" {if isset($PASSWORD_ERROR) && $PASSWORD_ERROR eq "TRUE"}class="error"{/if} width="42%">{if isset($PASSWORD_ERROR) && $PASSWORD_ERROR eq "TRUE"}{$Password}{/if}</td>
</tr>
<tr>
<td width="33%" {if isset($CPASSWORD_ERROR) && $CPASSWORD_ERROR eq "TRUE"}class="error"{/if} id="caption-ConfirmPass">{$cpassword_tag}</td>
<td width="25%"><input type="password"
name="ConfirmPass"
value=""
maxlength="20"
onfocus="javascript:showTooltip('{$cpassword_message}', this);" />
</td>
<td id="comment-ConfirmPass" {if isset($CPASSWORD_ERROR) && $CPASSWORD_ERROR eq "TRUE"}class="error"{/if} width="42%">{if isset($CPASSWORD_ERROR) && $CPASSWORD_ERROR eq "TRUE"}{$ConfirmPass}{/if}</td>
</tr>
<tr>
<td width="33%" {if isset($CPASSWORD_ERROR) && $CPASSWORD_ERROR eq "TRUE"}class="error"{/if} id="caption-Email">{$email_tag}</td>
<td width="25%">
<input type="text"
name="Email"
value=""
maxlength="255"
onfocus=
"javascript:showTooltip('{$email_message}', this);" />
</td>
<td id="comment-Email" {if isset($EMAIL_ERROR) && $EMAIL_ERROR eq "TRUE"}class="error"{/if} width="42%">{if isset($EMAIL_ERROR) && $EMAIL_ERROR eq "TRUE"}{$Email}{/if}</td>
</tr>
<tr>
<td width=
"33%" {if isset($TAC_ERROR) && $TAC_ERROR eq "TRUE"}class="error"{/if}
colspan="2"><input type="checkbox"
name="TaC"
value="1"
onfocus="javascript:showTooltip('', this);" /><span id=
"caption-TaC">{$tac_tag}</span></td>
<td id="comment-TaC" {if isset($TAC_ERROR) && $TAC_ERROR eq "TRUE"}class="error"{/if} width="42%"><div class="alert alert-danger">{$tac_message}</div></td>
</tr>
</table>
<div class="c1">
<input type="submit"
name="Submit"
value="Continue" />
</div> </div>
</div>
</div>
<div class="control-group {if isset($PASSWORD_ERROR) and $PASSWORD_ERROR eq "TRUE"}error{else if
isset($PASSWORD) and $PASSWORD eq "success"}success{else}{/if}">
<label class="control-label">{$password_tag}</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on"><i class="icon-lock"></i></span>
<input type="Password" id="Password" class="input-xlarge" name="Password" placeholder="{$password_default}" {if isset($Password)}value="{$Password}"{/if} rel="popover" data-content="{$password_tooltip}" data-original-title="{$password_default}">
</div>
</div>
</div>
<div class="control-group {if isset($CPASSWORD_ERROR) and $CPASSWORD_ERROR eq "TRUE"}error{else if
isset($CPASSWORD) and $CPASSWORD eq "success"}success{else}{/if}">
<label class="control-label">{$cpassword_tag}</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on"><i class="icon-lock"></i></span>
<input type="Password" id="ConfirmPass" class="input-xlarge" name="ConfirmPass" placeholder="{$cpassword_default}" {if isset($ConfirmPass)}value="{$ConfirmPass}"{/if} rel="popover" data-content="{$cpassword_tooltip}" data-original-title="{$cpassword_default}">
</div>
</div>
</div>
<div class="control-group {if isset($EMAIL_ERROR) and $EMAIL_ERROR eq "TRUE"}error{else if
isset($EMAIL) and $EMAIL eq "success"}success{else}{/if}">
<label class="control-label">{$email_tag}</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on"><i class="icon-envelope"></i></span>
<input type="text" class="input-xlarge" id="Email" name="Email" placeholder="{$email_default}" {if isset($Email)}value="{$Email}"{/if} rel="popover" data-content="{$email_tooltip}" data-original-title="{$email_default}">
</div>
</div>
</div>
<div class="control-group {if isset($TAC_ERROR) and $TAC_ERROR eq "TRUE"}error{else if
isset($TAC) and $TAC eq "success"}success{else}{/if}">
<div class="controls">
<div class="input-prepend">
<input type="checkbox" class="input-xlarge" id="TaC" name="TaC" placeholder="Email">{$tac_tag}
</div>
</div>
</div>
{if isset($USERNAME_ERROR) and $USERNAME_ERROR eq "TRUE"}
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Username Error</strong> {$USERNAME}
</div>
{/if}
{if isset($PASSWORD_ERROR) and $PASSWORD_ERROR eq "TRUE"}
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Password Error</strong> {$PASSWORD}
</div>
{/if}
{if isset($CPASSWORD_ERROR) and $CPASSWORD_ERROR eq "TRUE"}
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Confirmation Password Error</strong> {$CPASSWORD}
</div>
{/if}
{if isset($EMAIL_ERROR) and $EMAIL_ERROR eq "TRUE"}
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Email Error</strong> {$EMAIL}
</div>
{/if}
{if isset($TAC_ERROR) and $TAC_ERROR eq "TRUE"}
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Terms of Service Error</strong> {$tac_message}
</div>
{/if}
<input type="hidden" name="function" value="add_user"> <input type="hidden" name="function" value="add_user">
<input type="hidden" name="callBack" value="register">
<div class="control-group">
<label class="control-label"></label>
<div class="controls">
<button type="submit" class="btn btn-large btn-primary" >Create My Account</button>
</div>
</div>
</form> </form>
<div id="signupTooltip"
class="c2"
inset=""></div>
<div id="tooltip-Username">
<div class="alert alert-danger">
{$username_tooltip}
</div>
</div>
<div id="tooltip-Password">
<div class="alert alert-danger">
{$password_message}
</div>
</div>
<div id="tooltip-ConfirmPass">
<div class="alert alert-danger">
{$cpassword_message}
</div>
</div>
<div id="tooltip-Email">
<div class="alert alert-danger">
{$email_message}
</div>
</div>
</div><!--/span--> </div><!--/span-->
</div><!--/row--> </div><!--/row-->
{/block} {/block}