error template added, fixed some small bugs

This commit is contained in:
Quitta 2013-07-03 18:49:23 +02:00
parent e0691ab9f5
commit c5d063a6eb
12 changed files with 193 additions and 63 deletions

View file

@ -20,6 +20,12 @@ name = "Name"
email = "Email" email = "Email"
action = "Action" action = "Action"
[error]
title404 = "Not<br/>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]
userlist_info = "welcome to the userlist" userlist_info = "welcome to the userlist"
@ -27,7 +33,7 @@ userlist_info = "welcome to the userlist"
[login] [login]
login_info = "Please login with your Username and Password." login_info = "Please login with your Username and Password."
login_error_message = "The filled in username/password were not correct!" login_error_message = "The filled in username/password were not correct!"
login_register_message ="<strong>Register</strong>If you dont have an account yet, create one" login_register_message ="<strong>Register</strong> If you dont have an account yet, create one"
login_register_message_here = "here" login_register_message_here = "here"
[logout] [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_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" email_default = "Email"
tac_tag = "YES, I agree to the <a href="toc.php">terms of service.</a>" tac_tag1= "YES, I agree to the "
tac_tag2="terms of service"
tac_message = "You must accept the Terms of Service." tac_message = "You must accept the Terms of Service."

View file

@ -20,6 +20,13 @@ name = "Nom"
email = "Email" email = "Email"
action = "Action" action = "Action"
[error]
title404 = "Pas<br/>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]
userlist_info = "bienvenue sur le userlist page!" 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_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" 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." tac_message = "Vous devez accepter les Conditions d'utilisation."

View file

@ -73,7 +73,7 @@
<div class="clear"></div> <div class="clear"></div>
<div class="content"> <div class="content">
The page your are looking for is not found. The page your are looking for is not found.
<br/><a href="index.php">Go Home</a> or<br/><form>Search<br/><input autofocus type="text" name="search" /></form> <br/><a href="index.php">Go Home</a>
</div> </div>
</body> </body>
</html> </html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View file

@ -0,0 +1,12 @@
<?php
function error(){
if(isset($_SESSION['error_code'])){
$result['error_code'] = $_SESSION['error_code'];
unset($_SESSION['error_code']);
}else{
$result['error_code'] = "404";
}
return $result;
}

View file

@ -2,61 +2,67 @@
function libuserlist(){ function libuserlist(){
if(WebUsers::isAdmin()){
//This checks to see if there is a page number. If not, it will set it to page 1 //This checks to see if there is a page number. If not, it will set it to page 1
if (!(isset($_GET['pagenum']))){ if (!(isset($_GET['pagenum']))){
$pagenum = 1;
}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; $pagenum = 1;
}else if ($pagenum > $last) { }else{
$pagenum = $last; $pagenum = $_GET['pagenum'];
} }
//This sets the range to display in our query //Here we count the number of results
$max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; global $cfg;
$dbl = new DBLayer($cfg['db']['lib']);
$rows = $dbl->executeWithoutParams("SELECT * FROM ams_querycache")->rowCount();
//This is your query again, the same one... the only difference is we add $max into it //the array hat will contain all users
$data = $dbl->executeWithoutParams("SELECT * FROM ams_querycache $max"); $pageResult['liblist'] = Array();
if($rows > 0){
//This is the number of results displayed per page
$page_rows = 2;
//This is where we put the results in a resultArray to be sent to smarty //This tells us the page number of our last page
$last = ceil($rows/$page_rows);
$i = 0; //this makes sure the page number isn't below one, or more than our maximum pages
while($row = $data->fetch(PDO::FETCH_ASSOC)){ if ($pagenum < 1)
$decode = json_decode($row['query']); {
$pageResult['liblist'][$i]['id'] = $row['SID']; $pagenum = 1;
$pageResult['liblist'][$i]['type'] = $row['type']; }else if ($pagenum > $last) {
//$pageResult['liblist'][$i]['name'] = $decode[0]; $pagenum = $last;
//$pageResult['liblist'][$i]['mail'] = $decode[2]; }
$i++;
//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 //check if shard is online
try{ try{
$dbs = new DBLayer($cfg['db']['shard']); $dbs = new DBLayer($cfg['db']['shard']);
$pageResult['shard'] = "online"; $pageResult['shard'] = "online";
}catch(PDOException $e) { }catch(PDOException $e) {
$pageResult['shard'] = "offline"; $pageResult['shard'] = "offline";
}
return $pageResult;
}else{
//ERROR: No access!
$_SESSION['error_code'] = "403";
header("Location: index.php?page=error");
exit;
} }
return $pageResult;
} }

View file

@ -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. //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(isset($_GET['id'])){
if(($_GET['id'] != $_SESSION['id']) && (!WebUsers::isAdmin()) ){ 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; exit;
}else{ }else{
$result = WebUsers::getInfo($_GET['id']); $result = WebUsers::getInfo($_GET['id']);
@ -24,7 +26,7 @@ function settings(){
return $result; return $result;
}else{ }else{
//ERROR: not logged in! //ERROR: not logged in!
print("not logged in!"); header("Location: index.php");
exit; exit;
} }
} }

View file

@ -14,7 +14,9 @@ function userlist(){
} }
return $pageResult; return $pageResult;
}else{ }else{
print('no permission'); //ERROR: No access!
$_SESSION['error_code'] = "403";
header("Location: index.php?page=error");
exit; exit;
} }
} }

View file

@ -50,5 +50,11 @@ if($page == 'login' || $page == 'register' || $page == 'logout'){
}else{ }else{
$return['no_visible_elements'] = 'FALSE'; $return['no_visible_elements'] = 'FALSE';
} }
//handle error page
if($page == 'error'){
$return['permission'] = 0;
$return['no_visible_elements'] = 'FALSE';
}
//print_r($return); //print_r($return);
helpers :: loadTemplate( $page , $return ); helpers :: loadTemplate( $page , $return );

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
*{
margin:0;
padding:0;
}
body{
font-family: 'Audiowide', cursive, arial, helvetica, sans-serif;
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAUElEQVQYV2NkYGAwBuKzQAwDID4IoIgxIikAMZE1oRiArBDdZBSNMIXoJiFbDZYDKcSmCOYimDuNSVKIzRNYrUYOFuQgweoZbIoxgoeoAAcAEckW11HVTfcAAAAASUVORK5CYII=) repeat;
background-color:#212121;
color:white;
font-size: 18px;
padding-bottom:20px;
}
.error-code{
font-family: 'Creepster', cursive, arial, helvetica, sans-serif;
font-size: 200px;
color: white;
color: rgba(255, 255, 255, 0.98);
width: 50%;
text-align: right;
margin-top: 5%;
text-shadow: 5px 5px hsl(0, 0%, 25%);
float: left;
}
.not-found{
width: 47%;
float: right;
margin-top: 5%;
font-size: 50px;
color: white;
text-shadow: 2px 2px 5px hsl(0, 0%, 61%);
padding-top: 70px;
}
.clear{
float:none;
clear:both;
}
.content{
text-align:center;
line-height: 30px;
}
input[type=text]{
border: hsl(247, 89%, 72%) solid 1px;
outline: none;
padding: 5px 3px;
font-size: 16px;
border-radius: 8px;
}
a{
text-decoration: none;
color: #9ECDFF;
text-shadow: 0px 0px 2px white;
}
a:hover{
color:white;
}
</style>
<title>Error</title>
</head>
<body>
<p class="error-code">
{$error_code}
</p>
{if $error_code eq "404"}
<p class="not-found">{$title404}</p>
<div class="clear"></div>
<div class="content">
<img src="../html/img/notpage.jpg"/><br/>
{$error_message404}
{else if $error_code eq "403"}
<p class="not-found">{$title403}</p>
<div class="clear"></div>
<div class="content">
{$error_message403}
{/if}
<br/><a href="index.php">{$go_home}</a>
</div>
</body>
</html>

View file

@ -64,7 +64,7 @@
isset($TAC) and $TAC eq "success"}success{else}{/if}"> isset($TAC) and $TAC eq "success"}success{else}{/if}">
<div class="controls"> <div class="controls">
<div class="input-prepend"> <div class="input-prepend">
<input type="checkbox" class="input-xlarge" id="TaC" name="TaC" placeholder="Email">{$tac_tag} <input type="checkbox" class="input-xlarge" id="TaC" name="TaC" placeholder="Email">{$tac_tag1}<a href='toc.php'>{$tac_tag2}</a>
</div> </div>
</div> </div>

View file

@ -163,7 +163,7 @@
<label class="control-label">Country</label> <label class="control-label">Country</label>
<div class="controls"> <div class="controls">
<select> <select>
<option value="AA" selected="selected">Select one</option> <option value="AA">None Selected</option>
<option value="AF">Afghanistan</option> <option value="AF">Afghanistan</option>
<option value="AX">Åland Islands</option> <option value="AX">Åland Islands</option>
<option value="AL">Albania</option> <option value="AL">Albania</option>