From 556f246b81882551f27757a56e8bebeb6b8f61b3 Mon Sep 17 00:00:00 2001 From: botanic Date: Tue, 2 Sep 2014 23:24:41 -0700 Subject: [PATCH] Fix add user in settings --- code/web/private_php/ams/autoload/users.php | 10 +++++- code/web/public_php/ams/func/add_user.php | 31 ++++++++++++------- code/web/public_php/ams/func/change_mail.php | 3 +- .../web/public_php/ams/templates/settings.tpl | 28 ++++++++++------- 4 files changed, 47 insertions(+), 25 deletions(-) diff --git a/code/web/private_php/ams/autoload/users.php b/code/web/private_php/ams/autoload/users.php index 32eb4b4f1..aabdbe98e 100644 --- a/code/web/private_php/ams/autoload/users.php +++ b/code/web/private_php/ams/autoload/users.php @@ -25,8 +25,16 @@ class Users{ $cpass = ""; $email = ""; } + + if ( helpers :: check_if_game_client() or isset($FORCE_INGAME) ) { + if ( isset( $_POST["TaC"] )) { + $tac="success"; + } + } else { + $tac="success"; + } - if ( ( $user == "success" ) and ( $pass == "success" ) and ( $cpass == "success" ) and ( $email == "success" ) and ( isset( $_POST["TaC"] ) ) ){ + if ( ( $user == "success" ) and ( $pass == "success" ) and ( $cpass == "success" ) and ( $email == "success" ) and ($tac=="success") ){ return "success"; }else{ global $TOS_URL; diff --git a/code/web/public_php/ams/func/add_user.php b/code/web/public_php/ams/func/add_user.php index a40e22450..dffa0ab86 100644 --- a/code/web/public_php/ams/func/add_user.php +++ b/code/web/public_php/ams/func/add_user.php @@ -15,6 +15,8 @@ function add_user(){ //check if the POST variables are valid, before actual registering $result = $webUser->check_Register($params); + global $SITEBASE; + require_once($SITEBASE . '/inc/settings.php'); // if all are good then create user if ( $result == "success"){ $edit = array( @@ -32,19 +34,26 @@ function add_user(){ header('Location: email_sent.php'); exit; } - $pageElements['status'] = $status; - $pageElements['no_visible_elements'] = 'TRUE'; - $pageElements['ingame_webpath'] = $INGAME_WEBPATH; - helpers :: loadtemplate( 'register_feedback', $pageElements); + $pageElements = settings(); + $pageElements['ingame_webpath'] = $INGAME_WEBPATH; + $pageElements['permission'] = unserialize($_SESSION['ticket_user'])->getPermission(); + $pageElements['SUCCESS_ADD'] = $status; + if (isset($_GET['page']) && $_GET['page']=="settings"){ + helpers :: loadtemplate( 'settings', $pageElements); + }else{ + $pageElements['no_visible_elements'] = 'TRUE'; + helpers :: loadtemplate( 'register_feedback', $pageElements); + } exit; - }elseif ($_POST['page']=="settings"){ + }elseif (isset($_GET['page']) && $_GET['page']=="settings"){ + $pageElements = array_merge(settings(), $result); // pass error and reload template accordingly - $result['prevUsername'] = $_POST["Username"]; - $result['prevPassword'] = $_POST["Password"]; - $result['prevConfirmPass'] = $_POST["ConfirmPass"]; - $result['prevEmail'] = $_POST["Email"]; - $result['no_visible_elements'] = 'TRUE'; - helpers :: loadtemplate( 'settings', $result); + $pageElements['prevUsername'] = $_POST["Username"]; + $pageElements['prevPassword'] = $_POST["Password"]; + $pageElements['prevConfirmPass'] = $_POST["ConfirmPass"]; + $pageElements['prevEmail'] = $_POST["Email"]; + $pageElements['permission'] = unserialize($_SESSION['ticket_user'])->getPermission(); + helpers :: loadtemplate( 'settings', $pageElements); exit; }else{ // pass error and reload template accordingly diff --git a/code/web/public_php/ams/func/change_mail.php b/code/web/public_php/ams/func/change_mail.php index 095e545ac..3eee0251d 100644 --- a/code/web/public_php/ams/func/change_mail.php +++ b/code/web/public_php/ams/func/change_mail.php @@ -71,6 +71,7 @@ function change_mail(){ $result['isMod'] = "TRUE"; } } + $result['CEMAIL_ERROR'] = true; helpers :: loadtemplate( 'settings', $result); exit; } @@ -83,7 +84,7 @@ function change_mail(){ } }else{ - //ERROR: The form was not filled in correclty + //ERROR: The form was not filled in correctly header("Location: index.php?page=settings"); exit; } diff --git a/code/web/public_php/ams/templates/settings.tpl b/code/web/public_php/ams/templates/settings.tpl index 9efb05eba..ea0f32e34 100644 --- a/code/web/public_php/ams/templates/settings.tpl +++ b/code/web/public_php/ams/templates/settings.tpl @@ -83,56 +83,60 @@
Add User -
+
- + + {if isset($USERNAME_ERROR) and $USERNAME_ERROR eq "TRUE"}{$USERNAME}{/if}
-
+
+ {if isset($PASSWORD_ERROR) and $PASSWORD_ERROR eq "TRUE"}{$PASSWORD}{/if}
-
+
+ {if isset($CPASSWORD_ERROR) and $CPASSWORD_ERROR eq "TRUE"}{$CPASSWORD}{/if}
-
+
- + + {if isset($EMAIL_ERROR) and $EMAIL_ERROR eq "TRUE"}{$EMAIL}{/if}
- {if isset($SUCCESS_PASS) and $SUCCESS_PASS eq "OK"} + {if isset($SUCCESS_ADD) and $SUCCESS_ADD eq "ok"}
- The user is created! + The user has been created!
{/if} - {if isset($SUCCESS_PASS) and $SUCCESS_PASS eq "SHARDOFF"} + {if isset($SUCCESS_ADD) and $SUCCESS_ADD eq "shardoffline"}
- The user can't be created. + The user is created, though the shard seems offline, it may take some time to see the change on the shard.
{/if} @@ -158,13 +162,13 @@
Change Email -
+
- {if isset($EMAIL_ERROR) and $EMAIL_ERROR eq "TRUE"}{$EMAIL}{/if} + {if isset($CEMAIL_ERROR) and $CEMAIL_ERROR eq "TRUE"}{$EMAIL}{/if}