diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini index 56c07761f..bfb187520 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini @@ -20,6 +20,12 @@ name = "Name" email = "Email" action = "Action" +[error] +title404 = "Not
Found!" +title403 = "Forbidden!" +error_message404 = "This is not the page you are looking for.." +error_message403 = "You cannot access this page!" +go_home = "Go Home" [userlist] userlist_info = "welcome to the userlist" @@ -27,7 +33,7 @@ userlist_info = "welcome to the userlist" [login] login_info = "Please login with your Username and Password." login_error_message = "The filled in username/password were not correct!" -login_register_message ="RegisterIf you dont have an account yet, create one" +login_register_message ="Register If you dont have an account yet, create one" login_register_message_here = "here" [logout] @@ -67,6 +73,7 @@ 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_default = "Email" -tac_tag = "YES, I agree to the terms of service." +tac_tag1= "YES, I agree to the " +tac_tag2="terms of service" tac_message = "You must accept the Terms of Service." diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini index 56c07b555..ebf862450 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini @@ -20,6 +20,13 @@ name = "Nom" email = "Email" action = "Action" +[error] +title404 = "Pas
trouvez!" +title403 = "Interdit!" +error_message404 = "Ce page que vous cherchez n'existe pas." +error_message403 = "Vous n'avez pas permission d'access ce page!" +go_home = "Allez au main page" + [userlist] userlist_info = "bienvenue sur le userlist page!" @@ -66,5 +73,6 @@ email_tooltip = "Adresse de courriel (pour qui un email de confirmation vous ser email_message = "Veuillez vérifier que l'adresse e-mail que vous entrez ici est valable et restera valable à l'avenir. Elle ne sera utilisée que pour gérer votre compte de base de Ryzom." email_default = "email" -tac_tag = "OUI, j'accepte les termes de service." +tac_tag1 = "OUI, j'accepte les " +tac_tag2 = "termes de service" tac_message = "Vous devez accepter les Conditions d'utilisation." \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/error.php b/code/ryzom/tools/server/ryzom_ams/www/html/error.php index 4d701a543..b84bd7de7 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/error.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/error.php @@ -73,7 +73,7 @@
The page your are looking for is not found. -
Go Home or
Search
+
Go Home
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/img/notpage.jpg b/code/ryzom/tools/server/ryzom_ams/www/html/img/notpage.jpg new file mode 100644 index 000000000..76c434b6e Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams/www/html/img/notpage.jpg differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/error.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/error.php new file mode 100644 index 000000000..eca129ff6 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/error.php @@ -0,0 +1,12 @@ +executeWithoutParams("SELECT * FROM ams_querycache")->rowCount(); - - //the array hat will contain all users - $pageResult['liblist'] = Array(); - if($rows > 0){ - //This is the number of results displayed per page - $page_rows = 2; - - //This tells us the page number of our last page - $last = ceil($rows/$page_rows); - - //this makes sure the page number isn't below one, or more than our maximum pages - if ($pagenum < 1) - { + if(WebUsers::isAdmin()){ + //This checks to see if there is a page number. If not, it will set it to page 1 + if (!(isset($_GET['pagenum']))){ $pagenum = 1; - }else if ($pagenum > $last) { - $pagenum = $last; - } - - //This sets the range to display in our query - $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; - - //This is your query again, the same one... the only difference is we add $max into it - $data = $dbl->executeWithoutParams("SELECT * FROM ams_querycache $max"); - - //This is where we put the results in a resultArray to be sent to smarty - - $i = 0; - while($row = $data->fetch(PDO::FETCH_ASSOC)){ - $decode = json_decode($row['query']); - $pageResult['liblist'][$i]['id'] = $row['SID']; - $pageResult['liblist'][$i]['type'] = $row['type']; - //$pageResult['liblist'][$i]['name'] = $decode[0]; - //$pageResult['liblist'][$i]['mail'] = $decode[2]; - $i++; + }else{ + $pagenum = $_GET['pagenum']; } + + //Here we count the number of results + global $cfg; + $dbl = new DBLayer($cfg['db']['lib']); + $rows = $dbl->executeWithoutParams("SELECT * FROM ams_querycache")->rowCount(); + + //the array hat will contain all users + $pageResult['liblist'] = Array(); + if($rows > 0){ + //This is the number of results displayed per page + $page_rows = 2; + + //This tells us the page number of our last page + $last = ceil($rows/$page_rows); + + //this makes sure the page number isn't below one, or more than our maximum pages + if ($pagenum < 1) + { + $pagenum = 1; + }else if ($pagenum > $last) { + $pagenum = $last; + } + + //This sets the range to display in our query + $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; + + //This is your query again, the same one... the only difference is we add $max into it + $data = $dbl->executeWithoutParams("SELECT * FROM ams_querycache $max"); + + //This is where we put the results in a resultArray to be sent to smarty + + $i = 0; + while($row = $data->fetch(PDO::FETCH_ASSOC)){ + $decode = json_decode($row['query']); + $pageResult['liblist'][$i]['id'] = $row['SID']; + $pageResult['liblist'][$i]['type'] = $row['type']; + //$pageResult['liblist'][$i]['name'] = $decode[0]; + //$pageResult['liblist'][$i]['mail'] = $decode[2]; + $i++; + } + } + + //check if shard is online + try{ + $dbs = new DBLayer($cfg['db']['shard']); + $pageResult['shard'] = "online"; + }catch(PDOException $e) { + $pageResult['shard'] = "offline"; + } + return $pageResult; + }else{ + //ERROR: No access! + $_SESSION['error_code'] = "403"; + header("Location: index.php?page=error"); + exit; } - - //check if shard is online - try{ - $dbs = new DBLayer($cfg['db']['shard']); - $pageResult['shard'] = "online"; - }catch(PDOException $e) { - $pageResult['shard'] = "offline"; - } - return $pageResult; } \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/settings.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/settings.php index 9a4cc1ad6..aebfeb186 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/settings.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/settings.php @@ -5,7 +5,9 @@ function settings(){ //in case id-GET param set it's value as target_id, if no id-param is given, ue the session id. if(isset($_GET['id'])){ if(($_GET['id'] != $_SESSION['id']) && (!WebUsers::isAdmin()) ){ - print('No permission to see this page!'); + //ERROR: No access! + $_SESSION['error_code'] = "403"; + header("Location: index.php?page=error"); exit; }else{ $result = WebUsers::getInfo($_GET['id']); @@ -24,7 +26,7 @@ function settings(){ return $result; }else{ //ERROR: not logged in! - print("not logged in!"); + header("Location: index.php"); exit; } } \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/userlist.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/userlist.php index c065c6985..e2c2cbfcb 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/userlist.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/userlist.php @@ -14,7 +14,9 @@ function userlist(){ } return $pageResult; }else{ - print('no permission'); + //ERROR: No access! + $_SESSION['error_code'] = "403"; + header("Location: index.php?page=error"); exit; } } \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/index.php b/code/ryzom/tools/server/ryzom_ams/www/html/index.php index d7f234d0d..040989bbb 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/index.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/index.php @@ -50,5 +50,11 @@ if($page == 'login' || $page == 'register' || $page == 'logout'){ }else{ $return['no_visible_elements'] = 'FALSE'; } + +//handle error page +if($page == 'error'){ + $return['permission'] = 0; + $return['no_visible_elements'] = 'FALSE'; +} //print_r($return); helpers :: loadTemplate( $page , $return ); diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/error.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/error.tpl new file mode 100644 index 000000000..a8e3ddd83 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/error.tpl @@ -0,0 +1,87 @@ + + + + + + + Error + + + +

+ {$error_code} +

+ {if $error_code eq "404"} +

{$title404}

+
+
+
+ {$error_message404} + {else if $error_code eq "403"} +

{$title403}

+
+
+ {$error_message403} + {/if} +
{$go_home} +
+ + + \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/register.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/register.tpl index 5a154bb92..c97323520 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/register.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/register.tpl @@ -64,7 +64,7 @@ isset($TAC) and $TAC eq "success"}success{else}{/if}">
- {$tac_tag} + {$tac_tag1}{$tac_tag2}
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/settings.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/settings.tpl index ceec3aa76..3ef4e0b50 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/settings.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/settings.tpl @@ -163,7 +163,7 @@