Merge with quitta-gsoc-2013

This commit is contained in:
Botanic 2013-07-09 05:08:32 -07:00
commit 262bc8b847
39 changed files with 2277 additions and 402 deletions

View file

@ -41,4 +41,17 @@ class DBLayer{
}
}
public function executeReturnId($query,$params){
try{
$statement = $this->PDO->prepare($query);
$this->PDO->beginTransaction();
$statement->execute($params);
$lastId =$this->PDO->lastInsertId();
$this->PDO->commit();
return $lastId;
}catch (PDOException $e) {
throw $e;
}
}
}

View file

@ -25,13 +25,27 @@ class Sync{
switch($record['type']) {
case 'createPermissions':
case 'user_edit':
case 'change_pass':
$decode = json_decode($record['query']);
$values = array('user' => $decode[0], 'pass' => $decode[1]);
//make connection with and put into shard db & delete from the lib
$dbs->execute("SET Password = :pass WHERE Login = :user",$values);
$dbl->execute("DELETE FROM ams_querycache WHERE SID=:SID",array('SID' => $record['SID']));
break;
case 'change_mail':
$decode = json_decode($record['query']);
$values = array('user' => $decode[0], 'mail' => $decode[1]);
//make connection with and put into shard db & delete from the lib
$dbs->execute("SET Email = :mail WHERE Login = :user",$values);
$dbl->execute("DELETE FROM ams_querycache WHERE SID=:SID",array('SID' => $record['SID']));
break;
case 'createUser':
$decode = json_decode($record['query']);
$query = array('login' => $decode[0], 'pass' => $decode[1], 'mail' => $decode[2] );
$values = array('login' => $decode[0], 'pass' => $decode[1], 'mail' => $decode[2] );
//make connection with and put into shard db & delete from the lib
$dbs->execute("INSERT INTO user (Login, Password, Email) VALUES (:login, :pass, :mail)",$query);
$dbs->execute("INSERT INTO user (Login, Password, Email) VALUES (:login, :pass, :mail)",$values);
$dbl->execute("DELETE FROM ams_querycache WHERE SID=:SID",array('SID' => $record['SID']));
break;
}
}
print('Syncing completed');

View file

@ -0,0 +1,169 @@
<?php
class Ticket{
private $tId;
private $timestamp;
private $title;
private $status;
private $queue;
private $ticket_category;
private $author;
private $db;
////////////////////////////////////////////Functions////////////////////////////////////////////////////
/*FUNCTION: getTicketTitlesOf()
* return all ticket of the given author's id.
*
*/
public static function getTicketsOf($author, $db_data) {
$dbl = new DBLayer($db_data);
$statement = $dbl->execute("SELECT * FROM ticket INNER JOIN ticket_user ON ticket.Author = ticket_user.TUserId and ticket_user.ExternId=:id", array('id' => $author));
$row = $statement->fetchAll();
$result = Array();
foreach($row as $ticket){
$instance = new self($db_data);
$instance->setTimestamp($ticket['Timestamp']);
$instance->setTitle($ticket['Title']);
$instance->setStatus($ticket['Status']);
$instance->setQueue($ticket['Queue']);
$instance->setTicket_Category($ticket['Ticket_Category']);
$instance->setAuthor($ticket['Author']);
$result[] = $instance;
}
return $result;
}
/*FUNCTION: create_Ticket()
* creates a ticket + first initial reply and fills in the content of it!
*
*/
public static function create_Ticket( $title, $content, $category, $author, $db_data) {
$ticket = new Ticket($db_data);
$ticket->set($title,0,0,$category,$author);
$ticket->create();
$ticket_id = $ticket->getTId();
$ticket_content = new Ticket_Content($db_data);
$ticket_content->setContent($content);
$ticket_content->create();
$content_id = $ticket_content->getTContentId();
$ticket_reply = new Ticket_Reply($db_data);
$ticket_reply->set($ticket_id, $content_id, $author);
$ticket_reply->create();
}
////////////////////////////////////////////Methods////////////////////////////////////////////////////
public function __construct($db_data) {
$this->db = $db_data;
}
//Set ticket object
public function set($t,$s,$q,$t_c,$a){
$this->title = $t;
$this->status = $s;
$this->queue = $q;
$this->ticket_category = $t_c;
$this->author = $a;
}
//create ticket by writing private data to DB.
public function create(){
$dbl = new DBLayer($this->db);
$query = "INSERT INTO ticket (Timestamp, Title, Status, Queue, Ticket_Category, Author) VALUES (now(), :title, :status, :queue, :tcat, :author)";
$values = Array('title' => $this->title, 'status' => $this->status, 'queue' => $this->queue, 'tcat' => $this->ticket_category, 'author' => $this->author);
$this->tId = $dbl->executeReturnId($query, $values); ;
}
//return constructed element based on TId
public function load_With_TId( $id) {
$dbl = new DBLayer($this->db);
$statement = $dbl->execute("SELECT * FROM ticket WHERE TId=:id", array('id' => $id));
$row = $statement->fetch();
$this->tId = $row['TId'];
$this->timestamp = $row['Timestamp'];
$this->title = $row['Title'];
$this->status = $row['Status'];
$this->queue = $row['Queue'];
$this->ticket_category = $row['Ticket_Category'];
$this->author = $row['Author'];
}
//update private data to DB.
public function update(){
$dbl = new DBLayer($this->db);
$query = "UPDATE ticket SET Timestamp = :timestamp, Title = :title, Status = :status, Queue = :queue, Ticket_Category = :tcat, Author = :author WHERE TId=:id";
$values = Array('id' => $this->tId, 'timestamp' => $this->timestamp, 'title' => $this->title, 'status' => $this->status, 'queue' => $this->queue, 'tcat' => $this->ticket_category, 'author' => $this->author);
$statement = $dbl->execute($query, $values);
}
////////////////////////////////////////////Getters////////////////////////////////////////////////////
public function getTId(){
return $this->tId;
}
public function getTimestamp(){
return $this->timestamp;
}
public function getTitle(){
return $this->title;
}
public function getStatus(){
return $this->status;
}
public function getQueue(){
return $this->queue;
}
public function getTicket_Category(){
return $this->ticket_category;
}
public function getAuthor(){
return $this->author;
}
////////////////////////////////////////////Setters////////////////////////////////////////////////////
public function setTId($id){
$this->tId = $id;
}
public function setTimestamp($ts){
$this->timestamp = $ts;
}
public function setTitle($t){
$this->title = $t;
}
public function setStatus($s){
$this->status = $s;
}
public function setQueue($q){
$this->queue = $q;
}
public function setTicket_Category($tc){
$this->ticket_category = $tc;
}
public function setAuthor($a){
$this->author = $a;
}
}

View file

@ -0,0 +1,94 @@
<?php
class Ticket_Category{
private $tCategoryId;
private $name;
////////////////////////////////////////////Functions////////////////////////////////////////////////////
//Creates a ticket_Catergory in the DB
public static function createTicketCategory( $name ,$db ) {
$dbl = new DBLayer($db);
$query = "INSERT INTO ticket_category (Name) VALUES (:name)";
$values = Array('name' => $name);
$dbl->execute($query, $values);
}
//return constructed element based on TCategoryId
public static function constr_TCategoryId( $id, $db_data) {
$instance = new self($db_data);
$instance->setTCategoryId($id);
return $instance;
}
//returns list of all category objects
public static function getAllCategories($db_data) {
$dbl = new DBLayer($db_data);
$statement = $dbl->executeWithoutParams("SELECT * FROM ticket_category");
$row = $statement->fetchAll();
$result = Array();
foreach($row as $category){
$instance = new self($db_data);
$instance->tCategoryId = $category['TCategoryId'];
$instance->name = $category['Name'];
$result[] = $instance;
}
return $result;
}
////////////////////////////////////////////Methods////////////////////////////////////////////////////
public function __construct($db_data) {
$this->db = $db_data;
}
//return constructed element based on TCategoryId
public function load_With_TCategoryId( $id) {
$dbl = new DBLayer($this->db);
$statement = $dbl->execute("SELECT * FROM ticket_category WHERE TCategoryId=:id", array('id' => $id));
$row = $statement->fetch();
$this->tCategoryId = $row['TCategoryId'];
$this->name = $row['Name'];
}
//update private data to DB.
public function update(){
$dbl = new DBLayer($this->db);
$query = "UPDATE ticket_category SET Name = :name WHERE TCategoryId=:id";
$values = Array('id' => $this->tCategoryId, 'name' => $this->name);
$statement = $dbl->execute($query, $values);
}
////////////////////////////////////////////Getters////////////////////////////////////////////////////
public function getName(){
if ($this->name == ""){
$this->load_With_TCategoryId($this->tCategoryId);
}
return $this->name;
}
public function getTCategoryId(){
return $this->tCategoryId;
}
////////////////////////////////////////////Setters////////////////////////////////////////////////////
public function setName($n){
$this->name = $n;
}
public function setTCategoryId($id){
$this->tCategoryId = $id;
}
}

View file

@ -0,0 +1,75 @@
<?php
class Ticket_Content{
private $tContentId;
private $content;
////////////////////////////////////////////Functions////////////////////////////////////////////////////
//return constructed element based on TCategoryId
public static function constr_TContentId( $id, $db_data) {
$instance = new self($db_data);
$instance->setTContentId($id);
return $instance;
}
////////////////////////////////////////////Methods////////////////////////////////////////////////////
public function __construct($db_data) {
$this->db = $db_data;
}
//Creates a ticket_content entry in the DB
public function create() {
$dbl = new DBLayer($this->db);
$query = "INSERT INTO ticket_content (Content) VALUES (:content)";
$values = Array('content' => $this->content);
$this->tContentId = $dbl->executeReturnId($query, $values); ;
}
//return constructed element based on TContentId
public function load_With_TContentId( $id) {
$dbl = new DBLayer($this->db);
$statement = $dbl->execute("SELECT * FROM ticket_content WHERE TContentId=:id", array('id' => $id));
$row = $statement->fetch();
$this->tContentId = $row['TContentId'];
$this->content = $row['Content'];
}
//update private data to DB.
public function update(){
$dbl = new DBLayer($this->db);
$query = "UPDATE ticket_content SET Content = :content WHERE TContentId=:id";
$values = Array('id' => $this->tContentId, 'content' => $this->content);
$statement = $dbl->execute($query, $values);
}
////////////////////////////////////////////Getters////////////////////////////////////////////////////
public function getContent(){
if ($this->content == ""){
$this->load_With_TContentId($this->tContentId);
}
return $this->content;
}
public function getTContentId(){
return $this->tContentId;
}
////////////////////////////////////////////Setters////////////////////////////////////////////////////
public function setContent($c){
$this->content = $c;
}
public function setTContentId($c){
$this->tContentId = $c;
}
}

View file

@ -0,0 +1,110 @@
<?php
class Ticket_Reply{
private $tReplyId;
private $ticket;
private $content;
private $author;
private $timestamp;
private $db;
////////////////////////////////////////////Functions////////////////////////////////////////////////////
//return constructed element based on TCategoryId
public static function constr_TReplyId( $id, $db_data) {
$instance = new self($db_data);
$instance->setTReplyId($id);
return $instance;
}
////////////////////////////////////////////Methods////////////////////////////////////////////////////
public function __construct($db_data) {
$this->db = $db_data;
}
//Set ticket_reply object
public function set($t,$c,$a){
$this->ticket = $t;
$this->content = $c;
$this->author = $a;
}
//create ticket by writing private data to DB.
public function create(){
$dbl = new DBLayer($this->db);
$query = "INSERT INTO ticket_reply (Ticket, Content, Author, Timestamp) VALUES (:ticket, :content, :author, now())";
$values = Array('ticket' => $this->ticket, 'content' => $this->content, 'author' => $this->author);
$dbl->execute($query, $values);
}
//return constructed element based on TId
public function load_With_TReplyId( $id) {
$dbl = new DBLayer($this->db);
$statement = $dbl->execute("SELECT * FROM ticket_reply WHERE TReplyId=:id", array('id' => $id));
$row = $statement->fetch();
$this->tReplyId = $row['TReplyId'];
$this->ticket = $row['Ticket'];
$this->content = $row['Content'];
$this->author = $row['Author'];
$this->timestamp = $row['Timestamp'];
}
//update private data to DB.
public function update(){
$dbl = new DBLayer($this->db);
$query = "UPDATE ticket SET Ticket = :ticket, Content = :content, Author = :author, Timestamp = :timestamp WHERE TReplyId=:id";
$values = Array('id' => $this->tReplyId, 'timestamp' => $this->timestamp, 'ticket' => $this->ticket, 'content' => $this->content, 'author' => $this->author);
$statement = $dbl->execute($query, $values);
}
////////////////////////////////////////////Getters////////////////////////////////////////////////////
public function getTicket(){
return $this->ticket;
}
public function getContent(){
return $this->content;
}
public function getAuthor(){
return $this->author;
}
public function getTimestamp(){
return $this->timestamp;
}
public function getTReplyId(){
return $this->tReplyId;
}
////////////////////////////////////////////Setters////////////////////////////////////////////////////
public function setTicket($t){
$this->ticket = $t;
}
public function setContent($c){
$this->content = $c;
}
public function setAuthor($a){
$this->author = $a;
}
public function setTimestamp($t){
$this->timestamp = $t;
}
public function setTReplyId($i){
$this->tReplyId = $i;
}
}

View file

@ -0,0 +1,101 @@
<?php
class Ticket_User{
private $tUserId;
private $permission;
private $externId;
private $db;
////////////////////////////////////////////Functions////////////////////////////////////////////////////
//Creates a ticket_user in the DB
public static function createTicketUser( $extern_id, $permission,$db ) {
$dbl = new DBLayer($db);
$query = "INSERT INTO ticket_user (Permission, ExternId) VALUES (:perm, :ext_id)";
$values = Array('perm' => $permission, 'ext_id' => $extern_id);
$dbl->execute($query, $values);
}
//return constructed element based on TUserId
public static function constr_TUserId( $id, $db_data) {
$instance = new self($db_data);
$instance->setTUserId($id);
return $instance;
}
//return constructed element based on ExternId
public static function constr_ExternId( $id, $db_data ) {
$instance = new self($db_data);
$dbl = new DBLayer($instance->db);
$statement = $dbl->execute("SELECT * FROM ticket_user WHERE ExternId=:id", array('id' => $id));
$row = $statement->fetch();
$instance->tUserId = $row['TUserId'];
$instance->permission = $row['Permission'];
$instance->externId = $row['ExternId'];
return $instance;
}
////////////////////////////////////////////Methods////////////////////////////////////////////////////
public function __construct($db_data) {
$this->db = $db_data;
}
//return constructed element based on TUserId
public function load_With_TUserId( $id) {
$dbl = new DBLayer($this->db);
$statement = $dbl->execute("SELECT * FROM ticket_user WHERE TUserId=:id", array('id' => $id));
$row = $statement->fetch();
$instance->tUserId = $row['TUserId'];
$instance->permission = $row['Permission'];
$instance->externId = $row['ExternId'];
return $instance;
}
//update private data to DB.
public function update(){
$dbl = new DBLayer($this->db);
$query = "UPDATE ticket_user SET Permission = :perm, ExternId = :ext_id WHERE TUserId=:id";
$values = Array('id' => $this->tUserId, 'perm' => $this->permission, 'ext_id' => $this->externId);
$statement = $dbl->execute($query, $values);
}
////////////////////////////////////////////Getters////////////////////////////////////////////////////
public function getPermission(){
if ($this->permission == ""){
$this->load_With_TUserId($this->tUserId);
}
return $this->permission;
}
public function getExternId(){
if ($this->ExternId == ""){
$this->load_With_TUserId($this->tUserId);
}
return $this->externId;
}
public function getTUserId(){
return $this->tUserId;
}
////////////////////////////////////////////Setters////////////////////////////////////////////////////
public function setPermission($perm){
$this->permission = $perm;
}
public function setExternId($id){
$this->externId = $id;
}
}

View file

@ -156,7 +156,7 @@ class Users{
* @takes $email
* @return
*/
private function checkEmail( $email )
public function checkEmail( $email )
{
if ( isset( $email ) ){
if ( !Users::validEmail( $email ) ){
@ -284,12 +284,13 @@ class Users{
* @takes $array with name,pass and mail
* @return ok if it's get correctly added to the shard, else return lib offline and put in libDB, if libDB is also offline return liboffline.
*/
public function createUser($values){
public function createUser($values, $user_id){
try {
//make connection with and put into shard db
global $cfg;
$dbs = new DBLayer($cfg['db']['shard']);
$dbs->execute("INSERT INTO user (Login, Password, Email) VALUES (:name, :pass, :mail)",$values);
ticket_user::createTicketUser( $user_id , 1, $cfg['db']['lib'] );
return "ok";
}
catch (PDOException $e) {
@ -298,6 +299,7 @@ class Users{
$dbl = new DBLayer($cfg['db']['lib']);
$dbl->execute("INSERT INTO ams_querycache (type, query) VALUES (:type, :query)",array("type" => "createUser",
"query" => json_encode(array($values["name"],$values["pass"],$values["mail"]))));
ticket_user::createTicketUser( $user_id , 1, $cfg['db']['lib'] );
return "shardoffline";
}catch (PDOException $e) {
print_r($e);
@ -365,25 +367,51 @@ class Users{
}
}
protected function setPassword($user, $pass){
protected function setAmsPassword($user, $pass){
global $cfg;
$values = Array('user' => $user, 'pass' => $pass);
try {
//make connection with and put into shard db
global $cfg;
$dbs = new DBLayer($cfg['db']['shard']);
$dbs->execute("UPDATE user SET Password = :pass WHERE Login = :user ",$values);
return "ok";
}
catch (PDOException $e) {
//oh noooz, the shard is offline! Put in query queue at ams_lib db!
/*try {
$dbl = new DBLayer($cfg['db']['lib']);
$dbl->execute("INSERT INTO ams_querycache (type, query) VALUES (:type, :query)",array("type" => "createUser",
"query" => json_encode(array($values["name"],$values["pass"],$values["mail"]))));
try {
$dbl = new DBLayer($cfg['db']['lib']);
$dbl->execute("INSERT INTO ams_querycache (type, query) VALUES (:type, :query)",array("type" => "change_pass",
"query" => json_encode(array($values["user"],$values["pass"]))));
return "shardoffline";
}catch (PDOException $e) {
print_r($e);
return "liboffline";
}*/
}
}
}
protected function setAmsEmail($user, $mail){
global $cfg;
$values = Array('user' => $user, 'mail' => $mail);
try {
//make connection with and put into shard db
$dbs = new DBLayer($cfg['db']['shard']);
$dbs->execute("UPDATE user SET Email = :mail WHERE Login = :user ",$values);
return "ok";
}
catch (PDOException $e) {
//oh noooz, the shard is offline! Put in query queue at ams_lib db!
try {
$dbl = new DBLayer($cfg['db']['lib']);
$dbl->execute("INSERT INTO ams_querycache (type, query) VALUES (:type, :query)",array("type" => "change_mail",
"query" => json_encode(array($values["user"],$values["mail"]))));
return "shardoffline";
}catch (PDOException $e) {
return "liboffline";
}
}
}
}

View file

@ -20,14 +20,24 @@ name = "Name"
email = "Email"
action = "Action"
[show_user]
[createticket]
[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_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 ="<strong>Register</strong>If you dont have an account yet, create one"
login_error_message = "The username/password were not correct!"
login_register_message ="<strong>Register</strong> If you don't have an account yet, create one"
login_register_message_here = "here"
[logout]
@ -67,6 +77,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 <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."

View file

@ -20,6 +20,17 @@ name = "Nom"
email = "Email"
action = "Action"
[createticket]
[show_user]
[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_info = "bienvenue sur le userlist page!"
@ -66,5 +77,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."

View file

@ -50,7 +50,15 @@ class WebUsers extends Users{
}
}
public function getId($username){
global $cfg;
$dbw = new DBLayer($cfg['db']['web']);
$statement = $dbw->execute("SELECT * FROM ams_user WHERE Login=:username", array('username' => $username));
$row = $statement->fetch();
return $row['UId'];
}
public function getUsername($id){
global $cfg;
@ -60,6 +68,25 @@ class WebUsers extends Users{
return $row['Login'];
}
public function getEmail($id){
global $cfg;
$dbw = new DBLayer($cfg['db']['web']);
$statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $id));
$row = $statement->fetch();
return $row['Email'];
}
public function getInfo($id){
global $cfg;
$dbw = new DBLayer($cfg['db']['web']);
$statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $id));
$row = $statement->fetch();
$result = Array('FirstName' => $row['FirstName'], 'LastName' => $row['LastName'], 'Gender' => $row['Gender'], 'Country' => $row['Country']);
return $result;
}
public function isLoggedIn(){
if(isset($_SESSION['user'])){
return true;
@ -74,4 +101,40 @@ class WebUsers extends Users{
return false;
}
public function setPassword($user, $pass){
global $cfg;
$reply = WebUsers::setAmsPassword($user, $pass);
$values = Array('user' => $user, 'pass' => $pass);
try {
//make connection with and put into shard db
$dbw = new DBLayer($cfg['db']['web']);
$dbw->execute("UPDATE ams_user SET Password = :pass WHERE Login = :user ",$values);
}
catch (PDOException $e) {
//ERROR: the web DB is offline
}
return $reply;
}
public function setEmail($user, $mail){
global $cfg;
$reply = WebUsers::setAmsEmail($user, $mail);
$values = Array('user' => $user, 'mail' => $mail);
try {
//make connection with and put into shard db
$dbw = new DBLayer($cfg['db']['web']);
$dbw->execute("UPDATE ams_user SET Email = :mail WHERE Login = :user ",$values);
}
catch (PDOException $e) {
//ERROR: the web DB is offline
}
return $reply;
}
public function getUsers(){
global $cfg;
$dbl = new DBLayer($cfg['db']['web']);
$data = $dbl->executeWithoutParams("SELECT * FROM ams_user");
return $data;
}
}

View file

@ -73,7 +73,7 @@
<div class="clear"></div>
<div class="content">
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>
</body>
</html>

View file

@ -36,7 +36,7 @@ function add_user(){
function write_user($newUser){
//create salt here, because we want it to be the same on the web/server
$hashpass = crypt($newUser["pass"], WebUsers::generateSALT());
@ -45,16 +45,17 @@ function write_user($newUser){
'pass' => $hashpass,
'mail' => $newUser["mail"]
);
//Create the user on the shard + in case shard is offline put copy of query in query db
//returns: ok, shardoffline or liboffline
$result = WebUsers::createUser($params);
try{
//make connection with web db and put it in there
global $cfg;
//make connection with web db and put it in there
$dbw = new DBLayer($cfg['db']['web']);
$dbw->execute("INSERT INTO ams_user (Login, Password, Email) VALUES (:name, :pass, :mail)",$params);
$user_id = $dbw->executeReturnId("INSERT INTO ams_user (Login, Password, Email) VALUES (:name, :pass, :mail)",$params);
//Create the user on the shard + in case shard is offline put copy of query in query db
//returns: ok, shardoffline or liboffline
$result = WebUsers::createUser($params, $user_id);
}catch (PDOException $e) {
//go to error page or something, because can't access website db

View file

@ -0,0 +1,115 @@
<?php
function change_info(){
try{
//if logged in
if(WebUsers::isLoggedIn()){
if(isset($_POST['target_id'])){
if( ($_POST['target_id'] == $_SESSION['id']) || WebUsers::isAdmin() ){
if($_POST['target_id'] == $_SESSION['id']){
$target_username = $_SESSION['user'];
}else{
$target_username = WebUsers::getUsername($_POST['target_id']);
}
$webUser = new WebUsers();
//use current info to check for changes
$current_info = $webUser->getInfo($_POST['target_id']);
$current_info['FirstName'] = filter_var($current_info['FirstName'], FILTER_SANITIZE_STRING);
$current_info['LastName'] = filter_var($current_info['LastName'], FILTER_SANITIZE_STRING);
$current_info['Country'] = filter_var($current_info['Country'], FILTER_SANITIZE_STRING);
$current_info['Gender'] = filter_var($current_info['Gender'], FILTER_SANITIZE_NUMBER_INT);
$updated = false;
$values = Array();
$values['user'] = $target_username;
//make the query that will update the data.
$query = "UPDATE ams_user SET ";
if(($_POST['FirstName'] != "") && ($_POST['FirstName'] != $current_info['FirstName'])){
$query = $query . "FirstName = :fName ";
$updated = true;
$values['fName'] = filter_var($_POST['FirstName'], FILTER_SANITIZE_STRING);
}
if(($_POST['LastName'] != "") && ($_POST['LastName'] != $current_info['LastName'])){
if($updated){
$query = $query . ", LastName = :lName ";
}else{
$query = $query . "LastName = :lName ";
}
$updated = true;
$values['lName'] = filter_var($_POST['LastName'], FILTER_SANITIZE_STRING);
}
if(($_POST['Country'] != "AA") && ($_POST['Country'] != $current_info['Country'])){
if($updated){
$query = $query . ", Country = :country ";
}else{
$query = $query . "Country = :country ";
}
$updated = true;
$values['country'] = filter_var($_POST['Country'], FILTER_SANITIZE_STRING);
}
if($_POST['Gender'] != $current_info['Gender']){
if($updated){
$query = $query . ", Gender = :gender ";
}else{
$query = $query . "Gender = :gender ";
}
$updated = true;
$values['gender'] = filter_var($_POST['Gender'], FILTER_SANITIZE_NUMBER_INT);
}
//finish the query!
$query = $query . "WHERE Login = :user";
//if some field is update then:
if($updated){
global $cfg;
//execute the query in the web DB.
$dbw = new DBLayer($cfg['db']['web']);
$dbw->execute($query,$values);
}
global $SITEBASE;
require_once($SITEBASE . 'inc/settings.php');
$result = settings();
if($updated){
$result['info_updated'] = "OK";
}
$result['permission'] = $_SESSION['permission'];
$result['username'] = $_SESSION['user'];
$result['no_visible_elements'] = 'FALSE';
$result['target_id'] = $_POST['target_id'];
helpers :: loadtemplate( 'settings', $result);
exit;
}else{
//ERROR: permission denied!
$_SESSION['error_code'] = "403";
header("Location: index.php?page=error");
exit;
}
}else{
//ERROR: The form was not filled in correclty
header("Location: index.php?page=settings");
exit;
}
}else{
//ERROR: user is not logged in
header("Location: index.php");
exit;
}
}catch (PDOException $e) {
//go to error page or something, because can't access website db
print_r($e);
exit;
}
}

View file

@ -0,0 +1,92 @@
<?php
function change_mail(){
try{
//if logged in
if(WebUsers::isLoggedIn()){
if(isset($_POST['target_id'])){
if( ($_POST['target_id'] == $_SESSION['id']) || WebUsers::isAdmin() ){
if($_POST['target_id'] == $_SESSION['id']){
$target_username = $_SESSION['user'];
}else{
$target_username = WebUsers::getUsername($_POST['target_id']);
}
$webUser = new WebUsers();
$reply = $webUser->checkEmail($_POST['NewEmail']);
global $SITEBASE;
require_once($SITEBASE . 'inc/settings.php');
$result = settings();
if ( $reply != "success" ){
$result['EMAIL_ERROR'] = 'TRUE';
}else{
$result['EMAIL_ERROR'] = 'FALSE';
}
$result['prevNewEmail'] = filter_var($_POST["NewEmail"], FILTER_SANITIZE_EMAIL);
if ($reply== "success"){
$status = WebUsers::setEmail($target_username, filter_var($_POST["NewEmail"], FILTER_SANITIZE_EMAIL) );
if($status == 'ok'){
$result['SUCCESS_MAIL'] = "OK";
}else if($status == 'shardoffline'){
$result['SUCCESS_MAIL'] = "SHARDOFF";
}
$result['permission'] = $_SESSION['permission'];
$result['no_visible_elements'] = 'FALSE';
$result['username'] = $_SESSION['user'];
$result['target_id'] = $_POST['target_id'];
if(isset($_GET['id'])){
if(WebUsers::isAdmin() && ($_POST['target_id'] != $_SESSION['id'])){
$result['isAdmin'] = "TRUE";
}
}
helpers :: loadtemplate( 'settings', $result);
exit;
}else{
$result['EMAIL'] = $reply;
$result['permission'] = $_SESSION['permission'];
$result['no_visible_elements'] = 'FALSE';
$result['username'] = $_SESSION['user'];
$result['target_id'] = $_POST['target_id'];
if(isset($_GET['id'])){
if(WebUsers::isAdmin() && ($_POST['target_id'] != $_SESSION['id'])){
$result['isAdmin'] = "TRUE";
}
}
helpers :: loadtemplate( 'settings', $result);
exit;
}
}else{
//ERROR: permission denied!
$_SESSION['error_code'] = "403";
header("Location: index.php?page=error");
exit;
}
}else{
//ERROR: The form was not filled in correclty
header("Location: index.php?page=settings");
exit;
}
}else{
//ERROR: user is not logged in
header("Location: index.php");
exit;
}
}catch (PDOException $e) {
//go to error page or something, because can't access website db
print_r($e);
exit;
}
}

View file

@ -18,44 +18,64 @@ function change_password(){
$adminChangesOther = true;
$_POST["CurrentPass"] = "dummypass";
}
$id = $_POST['target_id'];
$webUser = new WebUsers();
$params = Array( 'user' => $target_username, 'CurrentPass' => $_POST["CurrentPass"], 'NewPass' => $_POST["NewPass"], 'ConfirmNewPass' => $_POST["ConfirmNewPass"], 'adminChangesOther' => $adminChangesOther);
$result = $webUser->check_change_password($params);
if ($result == "success"){
//edit stuff into db
global $SITEBASE;
require_once($SITEBASE . 'inc/settings.php');
$succresult = settings();
$hashpass = crypt($_POST["NewPass"], WebUsers::generateSALT());
print('success!');
$status = WebUsers::setPassword($target_username, $hashpass);
if($status == 'ok'){
$succresult['SUCCESS_PASS'] = "OK";
}else if($status == 'shardoffline'){
$succresult['SUCCESS_PASS'] = "SHARDOFF";
}
$succresult['permission'] = $_SESSION['permission'];
$succresult['no_visible_elements'] = 'FALSE';
$succresult['username'] = $_SESSION['user'];
$succresult['target_id'] = $_POST['target_id'];
helpers :: loadtemplate( 'settings', $succresult);
exit;
}else{
$result['prevCurrentPass'] = $_POST["CurrentPass"];
$result['prevNewPass'] = $_POST["NewPass"];
$result['prevConfirmNewPass'] = $_POST["ConfirmNewPass"];
$result['prevCurrentPass'] = filter_var($_POST["CurrentPass"], FILTER_SANITIZE_STRING);
$result['prevNewPass'] = filter_var($_POST["NewPass"], FILTER_SANITIZE_STRING);
$result['prevConfirmNewPass'] = filter_var($_POST["ConfirmNewPass"], FILTER_SANITIZE_STRING);
$result['permission'] = $_SESSION['permission'];
$result['no_visible_elements'] = 'FALSE';
$result['username'] = $_SESSION['user'];
$result['target_id'] = $_POST['target_id'];
if(isset($_GET['id'])){
if(WebUsers::isAdmin() && ($_POST['target_id'] != $_SESSION['id'])){
$result['isAdmin'] = "TRUE";
}
}
global $SITEBASE;
require_once($SITEBASE . 'inc/settings.php');
$settings = settings();
$result = array_merge($result,$settings);
helpers :: loadtemplate( 'settings', $result);
exit;
}
}else{
//ERROR: permission denied!
$_SESSION['error_code'] = "403";
header("Location: index.php?page=error");
exit;
}
}else{
//ERROR: The form was not filled in correclty
header("Location: index.php?page=settings");
exit;
}
}else{
//ERROR: user is not logged in
exit;
header("Location: index.php");
exit;
}
}catch (PDOException $e) {

View file

@ -0,0 +1,48 @@
<?php
function create_ticket(){
//if logged in
if(WebUsers::isLoggedIn() && isset($_SESSION['ticket_user'])){
if(isset($_POST['target_id'])){
//if target_id is the same as session id or is admin
if( ($_POST['target_id'] == $_SESSION['id']) || WebUsers::isAdmin() ){
global $cfg;
$category = filter_var($_POST['Category'], FILTER_SANITIZE_NUMBER_INT);
$title = filter_var($_POST['Title'], FILTER_SANITIZE_STRING);
$content = filter_var($_POST['Content'], FILTER_SANITIZE_STRING);
try{
if($_POST['target_id'] == $_SESSION['id']){
$author = $_SESSION['ticket_user']->getTUserId();
}else{
$author= Ticket_User::constr_ExternId($_POST['target_id'], $cfg['db']['lib'])->getTUserId();
}
Ticket::create_Ticket($title, $content, $category, $author, $cfg['db']['lib'] );
}catch (PDOException $e) {
//ERROR: LIB DB is not online!
header("Location: index.php");
exit;
}
}else{
//ERROR: permission denied!
$_SESSION['error_code'] = "403";
header("Location: index.php?page=error");
exit;
}
}else{
//ERROR: The form was not filled in correclty
header("Location: index.php?page=settings");
exit;
}
}else{
//ERROR: user is not logged in
header("Location: index.php");
exit;
}
}

View file

@ -11,13 +11,14 @@ function login(){
$_SESSION['user'] = $_POST["Username"];
$_SESSION['permission'] = $result['Permission'];
$_SESSION['id'] = $result['UId'];
print('id=');
print($_SESSION['id']);
$_SESSION['ticket_user'] = Ticket_User::constr_ExternId($result['UId'],$cfg['db']['lib']);
//go back to the index page.
header( 'Location: index.php' );
exit;
}else{
//handle login failure
$result = Array();
$result['login_error'] = 'TRUE';
$result['no_visible_elements'] = 'TRUE';
helpers :: loadtemplate( 'login', $result);

View file

@ -0,0 +1,45 @@
<?php
function createticket(){
//if logged in
if(WebUsers::isLoggedIn()){
//in case user_id-GET param set it's value as target_id, if no user_id-param is given, use the session id.
if(isset($_GET['user_id'])){
if(($_GET['user_id'] != $_SESSION['id']) && (!WebUsers::isAdmin()) ){
//ERROR: No access!
$_SESSION['error_code'] = "403";
header("Location: index.php?page=error");
exit;
}else{
//if user_id is given, then set it as the target_id
$result['target_id'] = filter_var($_GET['user_id'], FILTER_SANITIZE_NUMBER_INT);
}
}else{
//set session_id as target_id
$result['target_id'] = $_SESSION['id'];
}
//create array of category id & names
global $cfg;
$catArray = Ticket_Category::getAllCategories($cfg['db']['lib']);
$result['category'] = Array();
foreach($catArray as $catObj){
$result['category'][$catObj->getTCategoryId()] = $catObj->getName();
}
return $result;
}else{
//ERROR: not logged in!
header("Location: index.php");
exit;
}
}

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(){
//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{
$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)
{
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;
}

View file

@ -4,18 +4,288 @@ function settings(){
if(WebUsers::isLoggedIn()){
//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(WebUsers::isAdmin() && ($_GET['id']!= $_SESSION['id'])){
$result['isAdmin'] = "TRUE";
if(($_GET['id'] != $_SESSION['id']) && (!WebUsers::isAdmin()) ){
//ERROR: No access!
$_SESSION['error_code'] = "403";
header("Location: index.php?page=error");
exit;
}else{
$result = WebUsers::getInfo($_GET['id']);
if(WebUsers::isAdmin() && ($_GET['id']!= $_SESSION['id'])){
$result['isAdmin'] = "TRUE";
}
$result['target_id'] = $_GET['id'];
$result['current_mail'] = WebUsers::getEmail($_GET['id']);
}
$result['target_id'] = $_GET['id'];
}else{
$result = WebUsers::getInfo($_SESSION['id']);
$result['target_id'] = $_SESSION['id'];
$result['current_mail'] = WebUsers::getEmail($_SESSION['id']);
//Sanitize Data
$result['current_mail'] = filter_var($result['current_mail'], FILTER_SANITIZE_EMAIL);
//$result['Login'] = filter_var($result['Login'], FILTER_SANITIZE_STRING);
$result['FirstName'] = filter_var($result['FirstName'], FILTER_SANITIZE_STRING);
$result['LastName'] = filter_var($result['LastName'], FILTER_SANITIZE_STRING);
$result['Country'] = filter_var($result['Country'], FILTER_SANITIZE_STRING);
$result['Gender'] = filter_var($result['Gender'], FILTER_SANITIZE_NUMBER_INT);
}
$result['country_array'] = getCountryArray();
return $result;
}else{
//ERROR: not logged in!
print("not logged in!");
header("Location: index.php");
exit;
}
}
}
function getCountryArray(){
$countries = array(
'AA'=>'None Selected',
'AF'=>'Afghanistan',
'AL'=>'Albania',
'DZ'=>'Algeria',
'AS'=>'American Samoa',
'AD'=>'Andorra',
'AO'=>'Angola',
'AI'=>'Anguilla',
'AQ'=>'Antarctica',
'AG'=>'Antigua And Barbuda',
'AR'=>'Argentina',
'AM'=>'Armenia',
'AW'=>'Aruba',
'AU'=>'Australia',
'AT'=>'Austria',
'AZ'=>'Azerbaijan',
'BS'=>'Bahamas',
'BH'=>'Bahrain',
'BD'=>'Bangladesh',
'BB'=>'Barbados',
'BY'=>'Belarus',
'BE'=>'Belgium',
'BZ'=>'Belize',
'BJ'=>'Benin',
'BM'=>'Bermuda',
'BT'=>'Bhutan',
'BO'=>'Bolivia',
'BA'=>'Bosnia And Herzegovina',
'BW'=>'Botswana',
'BV'=>'Bouvet Island',
'BR'=>'Brazil',
'IO'=>'British Indian Ocean Territory',
'BN'=>'Brunei',
'BG'=>'Bulgaria',
'BF'=>'Burkina Faso',
'BI'=>'Burundi',
'KH'=>'Cambodia',
'CM'=>'Cameroon',
'CA'=>'Canada',
'CV'=>'Cape Verde',
'KY'=>'Cayman Islands',
'CF'=>'Central African Republic',
'TD'=>'Chad',
'CL'=>'Chile',
'CN'=>'China',
'CX'=>'Christmas Island',
'CC'=>'Cocos (Keeling) Islands',
'CO'=>'Columbia',
'KM'=>'Comoros',
'CG'=>'Congo',
'CK'=>'Cook Islands',
'CR'=>'Costa Rica',
'CI'=>'Cote D\'Ivorie (Ivory Coast)',
'HR'=>'Croatia (Hrvatska)',
'CU'=>'Cuba',
'CY'=>'Cyprus',
'CZ'=>'Czech Republic',
'CD'=>'Democratic Republic Of Congo (Zaire)',
'DK'=>'Denmark',
'DJ'=>'Djibouti',
'DM'=>'Dominica',
'DO'=>'Dominican Republic',
'TP'=>'East Timor',
'EC'=>'Ecuador',
'EG'=>'Egypt',
'SV'=>'El Salvador',
'GQ'=>'Equatorial Guinea',
'ER'=>'Eritrea',
'EE'=>'Estonia',
'ET'=>'Ethiopia',
'FK'=>'Falkland Islands (Malvinas)',
'FO'=>'Faroe Islands',
'FJ'=>'Fiji',
'FI'=>'Finland',
'FR'=>'France',
'FX'=>'France, Metropolitan',
'GF'=>'French Guinea',
'PF'=>'French Polynesia',
'TF'=>'French Southern Territories',
'GA'=>'Gabon',
'GM'=>'Gambia',
'GE'=>'Georgia',
'DE'=>'Germany',
'GH'=>'Ghana',
'GI'=>'Gibraltar',
'GR'=>'Greece',
'GL'=>'Greenland',
'GD'=>'Grenada',
'GP'=>'Guadeloupe',
'GU'=>'Guam',
'GT'=>'Guatemala',
'GN'=>'Guinea',
'GW'=>'Guinea-Bissau',
'GY'=>'Guyana',
'HT'=>'Haiti',
'HM'=>'Heard And McDonald Islands',
'HN'=>'Honduras',
'HK'=>'Hong Kong',
'HU'=>'Hungary',
'IS'=>'Iceland',
'IN'=>'India',
'ID'=>'Indonesia',
'IR'=>'Iran',
'IQ'=>'Iraq',
'IE'=>'Ireland',
'IL'=>'Israel',
'IT'=>'Italy',
'JM'=>'Jamaica',
'JP'=>'Japan',
'JO'=>'Jordan',
'KZ'=>'Kazakhstan',
'KE'=>'Kenya',
'KI'=>'Kiribati',
'KW'=>'Kuwait',
'KG'=>'Kyrgyzstan',
'LA'=>'Laos',
'LV'=>'Latvia',
'LB'=>'Lebanon',
'LS'=>'Lesotho',
'LR'=>'Liberia',
'LY'=>'Libya',
'LI'=>'Liechtenstein',
'LT'=>'Lithuania',
'LU'=>'Luxembourg',
'MO'=>'Macau',
'MK'=>'Macedonia',
'MG'=>'Madagascar',
'MW'=>'Malawi',
'MY'=>'Malaysia',
'MV'=>'Maldives',
'ML'=>'Mali',
'MT'=>'Malta',
'MH'=>'Marshall Islands',
'MQ'=>'Martinique',
'MR'=>'Mauritania',
'MU'=>'Mauritius',
'YT'=>'Mayotte',
'MX'=>'Mexico',
'FM'=>'Micronesia',
'MD'=>'Moldova',
'MC'=>'Monaco',
'MN'=>'Mongolia',
'MS'=>'Montserrat',
'MA'=>'Morocco',
'MZ'=>'Mozambique',
'MM'=>'Myanmar (Burma)',
'NA'=>'Namibia',
'NR'=>'Nauru',
'NP'=>'Nepal',
'NL'=>'Netherlands',
'AN'=>'Netherlands Antilles',
'NC'=>'New Caledonia',
'NZ'=>'New Zealand',
'NI'=>'Nicaragua',
'NE'=>'Niger',
'NG'=>'Nigeria',
'NU'=>'Niue',
'NF'=>'Norfolk Island',
'KP'=>'North Korea',
'MP'=>'Northern Mariana Islands',
'NO'=>'Norway',
'OM'=>'Oman',
'PK'=>'Pakistan',
'PW'=>'Palau',
'PA'=>'Panama',
'PG'=>'Papua New Guinea',
'PY'=>'Paraguay',
'PE'=>'Peru',
'PH'=>'Philippines',
'PN'=>'Pitcairn',
'PL'=>'Poland',
'PT'=>'Portugal',
'PR'=>'Puerto Rico',
'QA'=>'Qatar',
'RE'=>'Reunion',
'RO'=>'Romania',
'RU'=>'Russia',
'RW'=>'Rwanda',
'SH'=>'Saint Helena',
'KN'=>'Saint Kitts And Nevis',
'LC'=>'Saint Lucia',
'PM'=>'Saint Pierre And Miquelon',
'VC'=>'Saint Vincent And The Grenadines',
'SM'=>'San Marino',
'ST'=>'Sao Tome And Principe',
'SA'=>'Saudi Arabia',
'SN'=>'Senegal',
'SC'=>'Seychelles',
'SL'=>'Sierra Leone',
'SG'=>'Singapore',
'SK'=>'Slovak Republic',
'SI'=>'Slovenia',
'SB'=>'Solomon Islands',
'SO'=>'Somalia',
'ZA'=>'South Africa',
'GS'=>'South Georgia And South Sandwich Islands',
'KR'=>'South Korea',
'ES'=>'Spain',
'LK'=>'Sri Lanka',
'SD'=>'Sudan',
'SR'=>'Suriname',
'SJ'=>'Svalbard And Jan Mayen',
'SZ'=>'Swaziland',
'SE'=>'Sweden',
'CH'=>'Switzerland',
'SY'=>'Syria',
'TW'=>'Taiwan',
'TJ'=>'Tajikistan',
'TZ'=>'Tanzania',
'TH'=>'Thailand',
'TG'=>'Togo',
'TK'=>'Tokelau',
'TO'=>'Tonga',
'TT'=>'Trinidad And Tobago',
'TN'=>'Tunisia',
'TR'=>'Turkey',
'TM'=>'Turkmenistan',
'TC'=>'Turks And Caicos Islands',
'TV'=>'Tuvalu',
'UG'=>'Uganda',
'UA'=>'Ukraine',
'AE'=>'United Arab Emirates',
'UK'=>'United Kingdom',
'US'=>'United States',
'UM'=>'United States Minor Outlying Islands',
'UY'=>'Uruguay',
'UZ'=>'Uzbekistan',
'VU'=>'Vanuatu',
'VA'=>'Vatican City (Holy See)',
'VE'=>'Venezuela',
'VN'=>'Vietnam',
'VG'=>'Virgin Islands (British)',
'VI'=>'Virgin Islands (US)',
'WF'=>'Wallis And Futuna Islands',
'EH'=>'Western Sahara',
'WS'=>'Western Samoa',
'YE'=>'Yemen',
'YU'=>'Yugoslavia',
'ZM'=>'Zambia',
'ZW'=>'Zimbabwe'
);
return $countries;
}

View file

@ -0,0 +1,63 @@
<?php
function show_user(){
//if logged in
if(WebUsers::isLoggedIn()){
if( !isset($_GET['id']) || WebUsers::isAdmin() || $_GET['id'] == $_SESSION['id'] ){
if(isset($_GET['id'])){
$result['target_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
}else{
$result['target_id'] = $_SESSION['id'];
}
$result['target_name'] = WebUsers::getUsername( $result['target_id']);
$result['mail'] = WebUsers::getEmail( $result['target_id']);
$info = WebUsers::getInfo($result['target_id']);
$result['firstName'] = $info['FirstName'];
$result['lastName'] = $info['LastName'];
$result['country'] = $info['Country'];
$result['gender'] = $info['Gender'];
global $cfg;
$ticket_user = Ticket_User::constr_ExternId($result['target_id'],$cfg['db']['lib']);
$ticketlist = Ticket::getTicketsOf($ticket_user->getTUserId(),$cfg['db']['lib']);
$i = 0;
$result['ticketlist'] = Array();
foreach($ticketlist as $ticket){
$result['ticketlist'][$i]['tId'] = $ticket->getTId();
$result['ticketlist'][$i]['timestamp'] = $ticket->getTimestamp();
$result['ticketlist'][$i]['title'] = $ticket->getTitle();
//get the status
$statusId = $ticket->getStatus();
if ($statusId == 0){
$status = "Waiting on support..";
}else if($statusId == 1){
$status = "Being handled..";
}else if($statusId == 2){
$status = "Closed";
}
$result['ticketlist'][$i]['statusText'] = $status;
$result['ticketlist'][$i]['status'] = $statusId;
//get the category
$category = Ticket_Category::constr_TCategoryId($ticket->getTicket_Category(), $cfg['db']['lib']);
$result['ticketlist'][$i]['category'] = $category->getName();
$i++;
}
return $result;
}else{
//ERROR: No access!
$_SESSION['error_code'] = "403";
header("Location: index.php?page=error");
exit;
}
}else{
//ERROR: not logged in!
header("Location: index.php");
exit;
}
}

View file

@ -0,0 +1,22 @@
<?php
function userlist(){
if(WebUsers::isAdmin()){
$users = WebUsers::getUsers();
$i = 0;
$pageResult['userlist'] = Array();
while($row = $users->fetch(PDO::FETCH_ASSOC)){
$pageResult['userlist'][$i]['id'] = $row['UId'];
$pageResult['userlist'][$i]['username'] = $row['Login'];
$pageResult['userlist'][$i]['permission'] = $row['Permission'];
$pageResult['userlist'][$i]['email'] = $row['Email'];
$i++;
}
return $pageResult;
}else{
//ERROR: No access!
$_SESSION['error_code'] = "403";
header("Location: index.php?page=error");
exit;
}
}

View file

@ -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 );

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

View file

@ -11,8 +11,8 @@
//SETUP THE WWW DB
$dbw = new DBLayer($cfg['db']['web']);
$sql = "
CREATE DATABASE IF NOT EXISTS `ryzom_ams`;
USE `ryzom_ams`;
CREATE DATABASE IF NOT EXISTS `" . $cfg['db']['web']['name'] ."`;
USE `". $cfg['db']['web']['name'] . "`;
DROP TABLE IF EXISTS ams_user;
CREATE TABLE IF NOT EXISTS `ams_user` (
@ -21,6 +21,10 @@
`Password` varchar(13) DEFAULT NULL,
`Email` varchar(255) NOT NULL DEFAULT '',
`Permission` int(3) NOT NULL DEFAULT 1,
`FirstName` varchar(255) NOT NULL DEFAULT '',
`LastName` varchar(255) NOT NULL DEFAULT '',
`Gender` tinyint(1) unsigned NOT NULL DEFAULT '0',
`Country` char(2) NOT NULL DEFAULT '',
PRIMARY KEY (`UId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='contains all users information for ryzom_ams';
@ -31,15 +35,216 @@
//SETUP THE AMS_LIB DB
$dbl = new DBLayer($cfg['db']['lib']);
$sql = "
CREATE DATABASE IF NOT EXISTS `ryzom_ams_lib`;
USE `ryzom_ams_lib`;
CREATE DATABASE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`;
USE `" . $cfg['db']['lib']['name'] ."`;
DROP TABLE IF EXISTS ams_querycache;
CREATE TABLE ams_querycache (
`SID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`type` VARCHAR( 64 ) NOT NULL ,
`query` VARCHAR( 512 ) NOT NULL
);
);
-- -----------------------------------------------------
-- Table `" . $cfg['db']['lib']['name'] ."`.`ticket_category`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_category` ;
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_category` (
`TCategoryId` INT NOT NULL AUTO_INCREMENT ,
`Name` VARCHAR(45) NOT NULL ,
PRIMARY KEY (`TCategoryId`) ,
UNIQUE INDEX `Name_UNIQUE` (`Name` ASC) )
ENGINE = InnoDB;
INSERT IGNORE INTO `" . $cfg['db']['lib']['name'] ."`.`ticket_category` (`Name`) VALUES ('Hacking'),('Ingame-Bug'),('Website-Bug'),('Installation');
-- -----------------------------------------------------
-- Table `" . $cfg['db']['lib']['name'] ."`.`ticket_user`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_user` ;
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_user` (
`TUserId` INT(10) NOT NULL AUTO_INCREMENT ,
`Permission` INT(3) NOT NULL DEFAULT 1 ,
`ExternId` INT(10) NOT NULL ,
PRIMARY KEY (`TUserId`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `" . $cfg['db']['lib']['name'] ."`.`ticket`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket` ;
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket` (
`TId` INT NOT NULL AUTO_INCREMENT ,
`Timestamp` TIMESTAMP NOT NULL ,
`Title` VARCHAR(120) NOT NULL ,
`Status` INT NULL DEFAULT 0 ,
`Queue` INT NULL DEFAULT 0 ,
`Ticket_Category` INT NOT NULL ,
`Author` INT NOT NULL ,
PRIMARY KEY (`TId`) ,
INDEX `fk_ticket_ticket_category_idx` (`Ticket_Category` ASC) ,
INDEX `fk_ticket_ams_user_idx` (`Author` ASC) ,
CONSTRAINT `fk_ticket_ticket_category`
FOREIGN KEY (`Ticket_Category` )
REFERENCES `" . $cfg['db']['lib']['name'] ."`.`ticket_category` (`TCategoryId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_ticket_ams_user`
FOREIGN KEY (`Author` )
REFERENCES `" . $cfg['db']['lib']['name'] ."`.`ticket_user` (`TUserId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `" . $cfg['db']['lib']['name'] ."`.`assigned`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`assigned` ;
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`assigned` (
`Ticket` INT NOT NULL ,
`User` INT NOT NULL ,
INDEX `fk_assigned_ticket_idx` (`Ticket` ASC) ,
PRIMARY KEY (`Ticket`, `User`) ,
INDEX `fk_assigned_ams_user_idx` (`User` ASC) ,
CONSTRAINT `fk_assigned_ticket`
FOREIGN KEY (`Ticket` )
REFERENCES `" . $cfg['db']['lib']['name'] ."`.`ticket` (`TId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_assigned_ams_user`
FOREIGN KEY (`User` )
REFERENCES `" . $cfg['db']['lib']['name'] ."`.`ticket_user` (`TUserId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `" . $cfg['db']['lib']['name'] ."`.`tag`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`tag` ;
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`tag` (
`TagId` INT NOT NULL AUTO_INCREMENT ,
`Value` VARCHAR(60) NOT NULL ,
PRIMARY KEY (`TagId`) ,
UNIQUE INDEX `Value_UNIQUE` (`Value` ASC) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `" . $cfg['db']['lib']['name'] ."`.`tagged`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`tagged` ;
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`tagged` (
`Ticket` INT NOT NULL ,
`Tag` INT NOT NULL ,
PRIMARY KEY (`Ticket`, `Tag`) ,
INDEX `fk_tagged_tag_idx` (`Tag` ASC) ,
CONSTRAINT `fk_tagged_ticket`
FOREIGN KEY (`Ticket` )
REFERENCES `" . $cfg['db']['lib']['name'] ."`.`ticket` (`TId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_tagged_tag`
FOREIGN KEY (`Tag` )
REFERENCES `" . $cfg['db']['lib']['name'] ."`.`tag` (`TagId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `" . $cfg['db']['lib']['name'] ."`.`ticket_content`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_content` ;
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_content` (
`TContentId` INT NOT NULL AUTO_INCREMENT ,
`Content` TEXT NULL ,
PRIMARY KEY (`TContentId`) )
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `" . $cfg['db']['lib']['name'] ."`.`ticket_reply`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_reply` ;
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_reply` (
`TReplyId` INT NOT NULL AUTO_INCREMENT ,
`Ticket` INT NOT NULL ,
`Author` INT NOT NULL ,
`Content` INT NOT NULL ,
`Timestamp` TIMESTAMP NULL ,
PRIMARY KEY (`TReplyId`) ,
INDEX `fk_ticket_reply_ticket_idx` (`Ticket` ASC) ,
INDEX `fk_ticket_reply_ams_user_idx` (`Author` ASC) ,
INDEX `fk_ticket_reply_content_idx` (`Content` ASC) ,
CONSTRAINT `fk_ticket_reply_ticket`
FOREIGN KEY (`Ticket` )
REFERENCES `" . $cfg['db']['lib']['name'] ."`.`ticket` (`TId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_ticket_reply_ams_user`
FOREIGN KEY (`Author` )
REFERENCES `" . $cfg['db']['lib']['name'] ."`.`ticket_user` (`TUserId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_ticket_reply_ticket_content`
FOREIGN KEY (`Content` )
REFERENCES `" . $cfg['db']['lib']['name'] ."`.`ticket_content` (`TContentId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `" . $cfg['db']['lib']['name'] ."`.`ticket_group`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_group` ;
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`ticket_group` (
`TGroupId` INT NOT NULL AUTO_INCREMENT ,
`Title` VARCHAR(80) NOT NULL ,
PRIMARY KEY (`TGroupId`) ,
UNIQUE INDEX `Title_UNIQUE` (`Title` ASC) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `" . $cfg['db']['lib']['name'] ."`.`in_group`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`in_group` ;
CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`in_group` (
`Ticket_Group` INT NOT NULL ,
`Ticket` INT NOT NULL ,
PRIMARY KEY (`Ticket_Group`, `Ticket`) ,
INDEX `fk_in_group_ticket_group_idx` (`Ticket_Group` ASC) ,
INDEX `fk_in_group_ticket_idx` (`Ticket` ASC) ,
CONSTRAINT `fk_in_group_ticket_group`
FOREIGN KEY (`Ticket_Group` )
REFERENCES `" . $cfg['db']['lib']['name'] ."`.`ticket_group` (`TGroupId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_in_group_ticket`
FOREIGN KEY (`Ticket` )
REFERENCES `" . $cfg['db']['lib']['name'] ."`.`ticket` (`TId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
";
$dbl->executeWithoutParams($sql);
print "The Lib & Web database were correctly installed! <br />";
@ -51,7 +256,7 @@
'pass' => $hashpass,
'mail' => "admin@admin.com",
);
Users::createUser($params);
Users::createUser($params, 1);
try{
$params['permission'] = 2;
$dbw = new DBLayer($cfg['db']['web']);

View file

@ -0,0 +1,209 @@
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
USE `mydb` ;
-- -----------------------------------------------------
-- Table `mydb`.`ticket_category`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`ticket_category` ;
CREATE TABLE IF NOT EXISTS `mydb`.`ticket_category` (
`TCategoryId` INT NOT NULL AUTO_INCREMENT ,
`Name` VARCHAR(45) NOT NULL ,
PRIMARY KEY (`TCategoryId`) ,
UNIQUE INDEX `Name_UNIQUE` (`Name` ASC) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`ticket_user`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`ticket_user` ;
CREATE TABLE IF NOT EXISTS `mydb`.`ticket_user` (
`TUserId` INT(10) NOT NULL AUTO_INCREMENT ,
`Permission` INT(3) NOT NULL DEFAULT 1 ,
`ExternId` INT(10) NOT NULL ,
PRIMARY KEY (`TUserId`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`ticket`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`ticket` ;
CREATE TABLE IF NOT EXISTS `mydb`.`ticket` (
`TId` INT NOT NULL AUTO_INCREMENT ,
`Timestamp` TIMESTAMP NOT NULL ,
`Title` VARCHAR(120) NOT NULL ,
`Status` INT NULL DEFAULT 0 ,
`Queue` INT NULL DEFAULT 0 ,
`Ticket_Category` INT NOT NULL ,
`Author` INT NOT NULL ,
PRIMARY KEY (`TId`) ,
INDEX `fk_ticket_ticket_category_idx` (`Ticket_Category` ASC) ,
INDEX `fk_ticket_ams_user_idx` (`Author` ASC) ,
CONSTRAINT `fk_ticket_ticket_category`
FOREIGN KEY (`Ticket_Category` )
REFERENCES `mydb`.`ticket_category` (`TCategoryId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_ticket_ams_user`
FOREIGN KEY (`Author` )
REFERENCES `mydb`.`ticket_user` (`TUserId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`assigned`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`assigned` ;
CREATE TABLE IF NOT EXISTS `mydb`.`assigned` (
`Ticket` INT NOT NULL ,
`User` INT NOT NULL ,
INDEX `fk_assigned_ticket_idx` (`Ticket` ASC) ,
PRIMARY KEY (`Ticket`, `User`) ,
INDEX `fk_assigned_ams_user_idx` (`User` ASC) ,
CONSTRAINT `fk_assigned_ticket`
FOREIGN KEY (`Ticket` )
REFERENCES `mydb`.`ticket` (`TId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_assigned_ams_user`
FOREIGN KEY (`User` )
REFERENCES `mydb`.`ticket_user` (`TUserId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`tag`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`tag` ;
CREATE TABLE IF NOT EXISTS `mydb`.`tag` (
`TagId` INT NOT NULL AUTO_INCREMENT ,
`Value` VARCHAR(60) NOT NULL ,
PRIMARY KEY (`TagId`) ,
UNIQUE INDEX `Value_UNIQUE` (`Value` ASC) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`tagged`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`tagged` ;
CREATE TABLE IF NOT EXISTS `mydb`.`tagged` (
`Ticket` INT NOT NULL ,
`Tag` INT NOT NULL ,
PRIMARY KEY (`Ticket`, `Tag`) ,
INDEX `fk_tagged_tag_idx` (`Tag` ASC) ,
CONSTRAINT `fk_tagged_ticket`
FOREIGN KEY (`Ticket` )
REFERENCES `mydb`.`ticket` (`TId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_tagged_tag`
FOREIGN KEY (`Tag` )
REFERENCES `mydb`.`tag` (`TagId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`ticket_content`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`ticket_content` ;
CREATE TABLE IF NOT EXISTS `mydb`.`ticket_content` (
`TContentId` INT NOT NULL AUTO_INCREMENT ,
`Content` TEXT NULL ,
PRIMARY KEY (`TContentId`) )
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `mydb`.`ticket_reply`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`ticket_reply` ;
CREATE TABLE IF NOT EXISTS `mydb`.`ticket_reply` (
`TReplyId` INT NOT NULL AUTO_INCREMENT ,
`Ticket` INT NOT NULL ,
`Author` INT NOT NULL ,
`Content` INT NOT NULL ,
`Timestamp` TIMESTAMP NULL ,
PRIMARY KEY (`TReplyId`) ,
INDEX `fk_ticket_reply_ticket_idx` (`Ticket` ASC) ,
INDEX `fk_ticket_reply_ams_user_idx` (`Author` ASC) ,
INDEX `fk_ticket_reply_content_idx` (`Content` ASC) ,
CONSTRAINT `fk_ticket_reply_ticket`
FOREIGN KEY (`Ticket` )
REFERENCES `mydb`.`ticket` (`TId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_ticket_reply_ams_user`
FOREIGN KEY (`Author` )
REFERENCES `mydb`.`ticket_user` (`TUserId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_ticket_reply_ticket_content`
FOREIGN KEY (`Content` )
REFERENCES `mydb`.`ticket_content` (`TContentId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`ticket_group`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`ticket_group` ;
CREATE TABLE IF NOT EXISTS `mydb`.`ticket_group` (
`TGroupId` INT NOT NULL AUTO_INCREMENT ,
`Title` VARCHAR(80) NOT NULL ,
PRIMARY KEY (`TGroupId`) ,
UNIQUE INDEX `Title_UNIQUE` (`Title` ASC) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`in_group`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `mydb`.`in_group` ;
CREATE TABLE IF NOT EXISTS `mydb`.`in_group` (
`Ticket_Group` INT NOT NULL ,
`Ticket` INT NOT NULL ,
PRIMARY KEY (`Ticket_Group`, `Ticket`) ,
INDEX `fk_in_group_ticket_group_idx` (`Ticket_Group` ASC) ,
INDEX `fk_in_group_ticket_idx` (`Ticket` ASC) ,
CONSTRAINT `fk_in_group_ticket_group`
FOREIGN KEY (`Ticket_Group` )
REFERENCES `mydb`.`ticket_group` (`TGroupId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_in_group_ticket`
FOREIGN KEY (`Ticket` )
REFERENCES `mydb`.`ticket` (`TId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

View file

@ -0,0 +1,59 @@
{block name=content}
<div class="row-fluid sortable ui-sortable">
<div class="box span8">
<div class="box-header well" data-original-title="">
<h2><i class="icon-th"></i> Create a new Ticket</h2>
<div class="box-icon">
<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>
</div>
</div>
<div class="box-content">
<div class="row-fluid">
<form id="changePassword" class="form-vertical" method="post" action="index.php?page=createticket&id={$target_id}">
<legend>New ticket</legend>
<div class="control-group">
<label class="control-label">Title</label>
<div class="controls">
<div class="input-prepend">
<input type="text" class="span8" id="Title" name="Title">
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">Category</label>
<div class="controls">
<select name="Category">
{foreach from=$category key=k item=v}
<option value="{$k}">{$v}</option>
{/foreach}
</select>
</div>
</div>
<div class="control-group">
<label class="control-label">Description</label>
<div class="controls">
<div class="input-prepend">
<textarea rows="12" class="span12" id="Content" name="Content"></textarea>
</div>
</div>
</div>
<input type="hidden" name="function" value="create_ticket">
<input type="hidden" name="target_id" value="{$target_id}">
<div class="control-group">
<label class="control-label"></label>
<div class="controls">
<button type="submit" class="btn btn-primary" style="margin-left:5px; margin-top:10px;">Send Ticket</button>
</div>
</div>
</form>
</div>
</div>
</div><!--/span-->
</div><!--/row-->
{/block}

View file

@ -0,0 +1,86 @@
<!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">
{$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

@ -96,8 +96,7 @@
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href="#">Profile</a></li>
<li class="divider"></li>
<li><a href="index.php?page=show_user">Profile</a></li>
<li><a href="index.php?page=logout">Logout</a></li>
</ul>
</div>

View file

@ -2,9 +2,11 @@
{block name=menu}
<li class="nav-header hidden-tablet">Main</li>
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php"><i class="icon-home"></i><span class="hidden-tablet"> Dashboard</span></a></li>
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=show_user"><i class="icon-user"></i><span class="hidden-tablet"> Profile</span></a></li>
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=settings"><i class="icon-cog"></i><span class="hidden-tablet"> Settings</span></a></li>
<li class="nav-header hidden-tablet">Admin</li>
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=libuserlist"><i class="icon-th-list"></i><span class="hidden-tablet"> Liblist</span></a></li>
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=userlist"><i class="icon-th-list"></i><span class="hidden-tablet"> UserList</span></a></li>
<li class="nav-header hidden-tablet">Actions</li>
<li style="margin-left: -2px;"><a href="?page=logout"><i class="icon-off"></i><span class="hidden-tablet"> Logout </span></a></li>

View file

@ -2,9 +2,10 @@
{block name=menu}
<li class="nav-header hidden-tablet">Main</li>
<li style="margin-left: -2px;" class="active"><a class="ajax-link" href="index.php"><i class="icon-home"></i><span class="hidden-tablet"> Dashboard</span></a></li>
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=show_user"><i class="icon-user"></i><span class="hidden-tablet"> Profile</span></a></li>
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=settings"><i class="icon-cog"></i><span class="hidden-tablet"> Settings</span></a></li>
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=userlist"><i class="icon-home"></i><span class="hidden-tablet"> Demo Userlist</span></a></li>
<li class="nav-header hidden-tablet">Actions</li>
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=createticket"><i class="icon-pencil"></i><span class="hidden-tablet">Create New Ticket</span></a></li>
<li style="margin-left: -2px;"><a href="?page=logout"><i class="icon-off"></i><span class="hidden-tablet"> Logout </span></a></li>
{/block}

View file

@ -51,9 +51,6 @@
<tr>
<th>{$id}</th>
<th>{$type}</th>
<th>{$name}</th>
<th>{$email}</th>
<th>{$action}</th>
</tr>
</thead>
<tbody>
@ -61,11 +58,7 @@
<tr>
<td>{$element.id}</td>
<td class="center">{$element.type}</td>
<td class="center">{$element.name}</td>
<td class="center">{$element.mail}</td>
<td class="center">
<a class="btn btn-danger" href="index.php?page=libuserlist&action=remove&id={$element.id}"><i class="icon-trash icon-white"></i>Delete</a>
</td>
</tr>
{/foreach}

View file

@ -64,7 +64,7 @@
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}
<input type="checkbox" class="input-xlarge" id="TaC" name="TaC" placeholder="Email">{$tac_tag1}<a href='toc.php'>{$tac_tag2}</a>
</div>
</div>

View file

@ -50,6 +50,20 @@
</div>
</div>
{if isset($SUCCESS_PASS) and $SUCCESS_PASS eq "OK"}
<div class="alert alert-success">
The password has been changed!
</div>
{/if}
{if isset($SUCCESS_PASS) and $SUCCESS_PASS eq "SHARDOFF"}
<div class="alert alert-warning">
The password has been changed, though the shard seems offline, it may take some time to see the change on the shard.
</div>
{/if}
<input type="hidden" name="function" value="change_password">
<input type="hidden" name="target_id" value="{$target_id}">
<div class="control-group">
@ -73,18 +87,34 @@
</div>
<div class="box-content">
<div class="row-fluid">
<form id="changeEmail" class="form-vertical" method="post" action="index.php">
<form id="changeEmail" class="form-vertical" method="post" action="index.php?page=settings&id={$target_id}">
<legend>Change Email</legend>
<div class="control-group">
<div class="control-group {if isset($EMAIL_ERROR) and $EMAIL_ERROR eq "TRUE"}error{/if}">
<label class="control-label">New Email</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on" style="margin-left:5px;"><i class="icon-envelope"></i></span>
<input type="text" class="input-xlarge" id="NewEmail" name="NewEmail" placeholder="Your new email">
</div>
<input type="text" class="input-xlarge" id="NewEmail" name="NewEmail" placeholder="Your new email" {if isset($prevNewEmail)}value="{$prevNewEmail}"{else if isset($current_mail)}value="{$current_mail}"{/if}>
{if isset($EMAIL_ERROR) and $EMAIL_ERROR eq "TRUE"}<span class="help-inline">{$EMAIL}</span>{/if}
</div>
</div>
</div>
<input type="hidden" name="function" value="change_email">
</div>
{if isset($SUCCESS_MAIL) and $SUCCESS_MAIL eq "OK"}
<div class="alert alert-success">
The email has been changed!
</div>
{/if}
{if isset($SUCCESS_MAIL) and $SUCCESS_MAIL eq "SHARDOFF"}
<div class="alert alert-warning">
The email has been changed, though the shard seems offline, it may take some time to see the change on the shard.
</div>
{/if}
<input type="hidden" name="function" value="change_mail">
<input type="hidden" name="target_id" value="{$target_id}">
<div class="control-group">
<label class="control-label"></label>
<div class="controls">
@ -106,7 +136,7 @@
</div>
<div class="box-content">
<div class="row-fluid">
<form id="changeEmail" class="form-vertical" method="post" action="index.php">
<form id="changeEmail" class="form-vertical" method="post" action="index.php?page=settings&id={$target_id}">
<legend>Change Info</legend>
<div class="control-group">
@ -114,7 +144,7 @@
<div class="controls">
<div class="input-prepend">
<span class="add-on" style="margin-left:5px;"><i class="icon-user"></i></span>
<input type="text" class="input-xlarge" id="Firstname" name="Firstname" placeholder="Your firstname">
<input type="text" class="input-xlarge" id="FirstName" name="FirstName" placeholder="Your firstname" {if isset($FirstName) and $FirstName neq ""}value="{$FirstName}"{/if}>
</div>
</div>
</div>
@ -124,7 +154,7 @@
<div class="controls">
<div class="input-prepend">
<span class="add-on" style="margin-left:5px;"><i class="icon-user"></i></span>
<input type="text" class="input-xlarge" id="Lastname" name="Lastname" placeholder="Your lastname">
<input type="text" class="input-xlarge" id="LastName" name="LastName" placeholder="Your lastname" {if isset($LastName) and $LastName neq ""}value="{$LastName}"{/if}>
</div>
</div>
</div>
@ -132,257 +162,10 @@
<div class="control-group">
<label class="control-label">Country</label>
<div class="controls">
<select>
<option value="AA" selected="selected">Select one</option>
<option value="AF">Afghanistan</option>
<option value="AX">Åland Islands</option>
<option value="AL">Albania</option>
<option value="DZ">Algeria</option>
<option value="AS">American Samoa</option>
<option value="AD">Andorra</option>
<option value="AO">Angola</option>
<option value="AI">Anguilla</option>
<option value="AQ">Antarctica</option>
<option value="AG">Antigua and Barbuda</option>
<option value="AR">Argentina</option>
<option value="AM">Armenia</option>
<option value="AW">Aruba</option>
<option value="AU">Australia</option>
<option value="AT">Austria</option>
<option value="AZ">Azerbaijan</option>
<option value="BS">Bahamas</option>
<option value="BH">Bahrain</option>
<option value="BD">Bangladesh</option>
<option value="BB">Barbados</option>
<option value="BY">Belarus</option>
<option value="BE">Belgium</option>
<option value="BZ">Belize</option>
<option value="BJ">Benin</option>
<option value="BM">Bermuda</option>
<option value="BT">Bhutan</option>
<option value="BO">Bolivia, Plurinational State of</option>
<option value="BQ">Bonaire, Sint Eustatius and Saba</option>
<option value="BA">Bosnia and Herzegovina</option>
<option value="BW">Botswana</option>
<option value="BV">Bouvet Island</option>
<option value="BR">Brazil</option>
<option value="IO">British Indian Ocean Territory</option>
<option value="BN">Brunei Darussalam</option>
<option value="BG">Bulgaria</option>
<option value="BF">Burkina Faso</option>
<option value="BI">Burundi</option>
<option value="KH">Cambodia</option>
<option value="CM">Cameroon</option>
<option value="CA">Canada</option>
<option value="CV">Cape Verde</option>
<option value="KY">Cayman Islands</option>
<option value="CF">Central African Republic</option>
<option value="TD">Chad</option>
<option value="CL">Chile</option>
<option value="CN">China</option>
<option value="CX">Christmas Island</option>
<option value="CC">Cocos (Keeling) Islands</option>
<option value="CO">Colombia</option>
<option value="KM">Comoros</option>
<option value="CG">Congo</option>
<option value="CD">Congo, the Democratic Republic of the</option>
<option value="CK">Cook Islands</option>
<option value="CR">Costa Rica</option>
<option value="CI">Côte d'Ivoire</option>
<option value="HR">Croatia</option>
<option value="CU">Cuba</option>
<option value="CW">Curaçao</option>
<option value="CY">Cyprus</option>
<option value="CZ">Czech Republic</option>
<option value="DK">Denmark</option>
<option value="DJ">Djibouti</option>
<option value="DM">Dominica</option>
<option value="DO">Dominican Republic</option>
<option value="EC">Ecuador</option>
<option value="EG">Egypt</option>
<option value="SV">El Salvador</option>
<option value="GQ">Equatorial Guinea</option>
<option value="ER">Eritrea</option>
<option value="EE">Estonia</option>
<option value="ET">Ethiopia</option>
<option value="FK">Falkland Islands (Malvinas)</option>
<option value="FO">Faroe Islands</option>
<option value="FJ">Fiji</option>
<option value="FI">Finland</option>
<option value="FR">France</option>
<option value="GF">French Guiana</option>
<option value="PF">French Polynesia</option>
<option value="TF">French Southern Territories</option>
<option value="GA">Gabon</option>
<option value="GM">Gambia</option>
<option value="GE">Georgia</option>
<option value="DE">Germany</option>
<option value="GH">Ghana</option>
<option value="GI">Gibraltar</option>
<option value="GR">Greece</option>
<option value="GL">Greenland</option>
<option value="GD">Grenada</option>
<option value="GP">Guadeloupe</option>
<option value="GU">Guam</option>
<option value="GT">Guatemala</option>
<option value="GG">Guernsey</option>
<option value="GN">Guinea</option>
<option value="GW">Guinea-Bissau</option>
<option value="GY">Guyana</option>
<option value="HT">Haiti</option>
<option value="HM">Heard Island and McDonald Islands</option>
<option value="VA">Holy See (Vatican City State)</option>
<option value="HN">Honduras</option>
<option value="HK">Hong Kong</option>
<option value="HU">Hungary</option>
<option value="IS">Iceland</option>
<option value="IN">India</option>
<option value="ID">Indonesia</option>
<option value="IR">Iran, Islamic Republic of</option>
<option value="IQ">Iraq</option>
<option value="IE">Ireland</option>
<option value="IM">Isle of Man</option>
<option value="IL">Israel</option>
<option value="IT">Italy</option>
<option value="JM">Jamaica</option>
<option value="JP">Japan</option>
<option value="JE">Jersey</option>
<option value="JO">Jordan</option>
<option value="KZ">Kazakhstan</option>
<option value="KE">Kenya</option>
<option value="KI">Kiribati</option>
<option value="KP">Korea, Democratic People's Republic of</option>
<option value="KR">Korea, Republic of</option>
<option value="KW">Kuwait</option>
<option value="KG">Kyrgyzstan</option>
<option value="LA">Lao People's Democratic Republic</option>
<option value="LV">Latvia</option>
<option value="LB">Lebanon</option>
<option value="LS">Lesotho</option>
<option value="LR">Liberia</option>
<option value="LY">Libya</option>
<option value="LI">Liechtenstein</option>
<option value="LT">Lithuania</option>
<option value="LU">Luxembourg</option>
<option value="MO">Macao</option>
<option value="MK">Macedonia, the former Yugoslav Republic of</option>
<option value="MG">Madagascar</option>
<option value="MW">Malawi</option>
<option value="MY">Malaysia</option>
<option value="MV">Maldives</option>
<option value="ML">Mali</option>
<option value="MT">Malta</option>
<option value="MH">Marshall Islands</option>
<option value="MQ">Martinique</option>
<option value="MR">Mauritania</option>
<option value="MU">Mauritius</option>
<option value="YT">Mayotte</option>
<option value="MX">Mexico</option>
<option value="FM">Micronesia, Federated States of</option>
<option value="MD">Moldova, Republic of</option>
<option value="MC">Monaco</option>
<option value="MN">Mongolia</option>
<option value="ME">Montenegro</option>
<option value="MS">Montserrat</option>
<option value="MA">Morocco</option>
<option value="MZ">Mozambique</option>
<option value="MM">Myanmar</option>
<option value="NA">Namibia</option>
<option value="NR">Nauru</option>
<option value="NP">Nepal</option>
<option value="NL">Netherlands</option>
<option value="NC">New Caledonia</option>
<option value="NZ">New Zealand</option>
<option value="NI">Nicaragua</option>
<option value="NE">Niger</option>
<option value="NG">Nigeria</option>
<option value="NU">Niue</option>
<option value="NF">Norfolk Island</option>
<option value="MP">Northern Mariana Islands</option>
<option value="NO">Norway</option>
<option value="OM">Oman</option>
<option value="PK">Pakistan</option>
<option value="PW">Palau</option>
<option value="PS">Palestinian Territory, Occupied</option>
<option value="PA">Panama</option>
<option value="PG">Papua New Guinea</option>
<option value="PY">Paraguay</option>
<option value="PE">Peru</option>
<option value="PH">Philippines</option>
<option value="PN">Pitcairn</option>
<option value="PL">Poland</option>
<option value="PT">Portugal</option>
<option value="PR">Puerto Rico</option>
<option value="QA">Qatar</option>
<option value="RE">Réunion</option>
<option value="RO">Romania</option>
<option value="RU">Russian Federation</option>
<option value="RW">Rwanda</option>
<option value="BL">Saint Barthélemy</option>
<option value="SH">Saint Helena, Ascension and Tristan da Cunha</option>
<option value="KN">Saint Kitts and Nevis</option>
<option value="LC">Saint Lucia</option>
<option value="MF">Saint Martin (French part)</option>
<option value="PM">Saint Pierre and Miquelon</option>
<option value="VC">Saint Vincent and the Grenadines</option>
<option value="WS">Samoa</option>
<option value="SM">San Marino</option>
<option value="ST">Sao Tome and Principe</option>
<option value="SA">Saudi Arabia</option>
<option value="SN">Senegal</option>
<option value="RS">Serbia</option>
<option value="SC">Seychelles</option>
<option value="SL">Sierra Leone</option>
<option value="SG">Singapore</option>
<option value="SX">Sint Maarten (Dutch part)</option>
<option value="SK">Slovakia</option>
<option value="SI">Slovenia</option>
<option value="SB">Solomon Islands</option>
<option value="SO">Somalia</option>
<option value="ZA">South Africa</option>
<option value="GS">South Georgia and the South Sandwich Islands</option>
<option value="SS">South Sudan</option>
<option value="ES">Spain</option>
<option value="LK">Sri Lanka</option>
<option value="SD">Sudan</option>
<option value="SR">Suriname</option>
<option value="SJ">Svalbard and Jan Mayen</option>
<option value="SZ">Swaziland</option>
<option value="SE">Sweden</option>
<option value="CH">Switzerland</option>
<option value="SY">Syrian Arab Republic</option>
<option value="TW">Taiwan, Province of China</option>
<option value="TJ">Tajikistan</option>
<option value="TZ">Tanzania, United Republic of</option>
<option value="TH">Thailand</option>
<option value="TL">Timor-Leste</option>
<option value="TG">Togo</option>
<option value="TK">Tokelau</option>
<option value="TO">Tonga</option>
<option value="TT">Trinidad and Tobago</option>
<option value="TN">Tunisia</option>
<option value="TR">Turkey</option>
<option value="TM">Turkmenistan</option>
<option value="TC">Turks and Caicos Islands</option>
<option value="TV">Tuvalu</option>
<option value="UG">Uganda</option>
<option value="UA">Ukraine</option>
<option value="AE">United Arab Emirates</option>
<option value="GB">United Kingdom</option>
<option value="US">United States</option>
<option value="UM">United States Minor Outlying Islands</option>
<option value="UY">Uruguay</option>
<option value="UZ">Uzbekistan</option>
<option value="VU">Vanuatu</option>
<option value="VE">Venezuela, Bolivarian Republic of</option>
<option value="VN">Viet Nam</option>
<option value="VG">Virgin Islands, British</option>
<option value="VI">Virgin Islands, U.S.</option>
<option value="WF">Wallis and Futuna</option>
<option value="EH">Western Sahara</option>
<option value="YE">Yemen</option>
<option value="ZM">Zambia</option>
<option value="ZW">Zimbabwe</option>
<select name="Country">
{foreach from=$country_array key=k item=v}
<option value="{$k}" {if isset($Country) and $Country eq $k}selected="selected"{/if}>{$v}</option>
{/foreach}
</select>
</div>
</div>
@ -391,24 +174,30 @@
<label class="control-label">Gender</label>
<div class="controls">
<label class="radio">
<div id="uniform-optionsRadios2" class="radio"><span class=""><input style="opacity: 0;" name="optionsRadios" id="optionsRadios2" value="option2" checked="" type="radio"></span></div>
<div id="uniform-optionsRadios2" class="radio"><span class="{if isset($Gender) and $Gender eq 0}checked{/if}"><input style="opacity: 0;" name="Gender" id="optionsRadios0" value="0" {if isset($Gender) and $Gender eq 0}checked=""{/if} type="radio"></span></div>
Secret
</label>
<div style="clear:both"></div>
<label class="radio">
<div id="uniform-optionsRadios1" class="radio"><span class="checked"><input style="opacity: 0;" name="optionsRadios" id="optionsRadios1" value="option1" type="radio"></span></div>
<div id="uniform-optionsRadios1" class="radio"><span class="{if isset($Gender) and $Gender eq 1}checked{/if}"><input style="opacity: 0;" name="Gender" id="optionsRadios1" value="1" {if isset($Gender) and $Gender eq 1}checked=""{/if} type="radio"></span></div>
Male
</label>
<div style="clear:both"></div>
<label class="radio">
<div id="uniform-optionsRadios2" class="radio"><span class=""><input style="opacity: 0;" name="optionsRadios" id="optionsRadios2" value="option2" type="radio"></span></div>
<div id="uniform-optionsRadios2" class="radio"><span class="{if isset($Gender) and $Gender eq 2}checked{/if}"><input style="opacity: 0;" name="Gender" id="optionsRadios2" value="2" {if isset($Gender) and $Gender eq 2}checked=""{/if} type="radio"></span></div>
Female
</label>
</div>
</div>
<input type="hidden" name="function" value="change_info">
{if isset($info_updated) and $info_updated eq "OK"}
<div class="alert alert-success">
The Info has been updated!
</div>
{/if}
<input type="hidden" name="function" value="change_info">
<input type="hidden" name="target_id" value="{$target_id}">
<div class="control-group">
<label class="control-label"></label>
<div class="controls">

View file

@ -0,0 +1,117 @@
{block name=content}
<div class="row-fluid sortable ui-sortable">
<div class="box span9">
<div class="box-header well" data-original-title="">
<h2><i class="icon-user"></i> Profile of {$target_name}</h2>
<div class="box-icon">
<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>
</div>
</div>
<div class="box-content">
<div class="row-fluid">
<legend>Info</legend>
<table class="table table-striped" >
<tbody>
<tr >
<td><strong>Email:</strong></td>
<td>{$mail}</td>
</tr>
{if $firstName neq ""}
<tr>
<td><strong>Firstname:</strong></td>
<td>{$firstName}</td>
</tr>
{/if}
{if $lastName neq ""}
<tr>
<td><strong>LastName:</strong></td>
<td>{$lastName}</td>
</tr>
{/if}
{if $country neq ""}
<tr>
<td><strong>Country:</strong></td>
<td>{$country}</td>
</tr>
{/if}
{if $gender neq 0}
<tr>
<td><strong>Gender:</strong></td>
{if $gender eq 1}
<td><strong>♂</strong></td>
{else if $gender eq 2}
<td><strong>♀</strong></td>
{/if}
</tr>
{/if}
</tbody>
</table>
</div>
</div>
</div><!--/span-->
<div class="box span3">
<div class="box-header well" data-original-title="">
<h2><i class="icon-th"></i>Actions</h2>
<div class="box-icon">
<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>
</div>
</div>
<div class="box-content">
<div class="row-fluid">
<div class="btn-group">
<button class="btn btn-primary btn-large dropdown-toggle" data-toggle="dropdown">Actions<span class="caret"></span></button>
<ul class="dropdown-menu">
<li class="divider"></li>
<li><a href="index.php?page=settings&id={$target_id}">Edit User</a></li>
<li><a href="index.php?page=createticket&user_id={$target_id}">Send Ticket</a></li>
<li class="divider"></li>
</ul>
</div>
</div>
</div>
</div><!--/span-->
</div><!--/row-->
<div class="row-fluid sortable ui-sortable">
<div class="box span9">
<div class="box-header well" data-original-title="">
<h2><i class="icon-tag"></i> Tickets of {$target_name}</h2>
<div class="box-icon">
<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>
</div>
</div>
<div class="box-content">
<div class="row-fluid">
<legend>Tickets</legend>
<table class="table table-striped table-bordered bootstrap-datatable datatable">
<thead>
<tr>
<th>Title</th>
<th>Timestamp</th>
<th>Category</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{foreach from=$ticketlist item=ticket}
<tr>
<td>{$ticket.title}</td>
<td class="center"><i>{$ticket.timestamp}</i></td>
<td class="center">{$ticket.category}</td>
<td class="center"><span class="label {if $ticket.status eq 0}label-success{else if $ticket.status eq 1}label-warning{else if $ticket.status eq 2}label-important{/if}">{$ticket.statusText}</span></td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
</div><!--/span-->
</div><!--/row-->
{/block}

View file

@ -1,22 +1,46 @@
{block name=content}
<div class="row-fluid">
<div class="box span12">
<div class="box-header well">
<h2><i class="icon-info-sign"></i> {$userlist_info}</h2>
<div class="box-icon">
<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-minimize btn-round"><i class="icon-chevron-up"></i></a>
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
</div>
</div>
<div class="box-content">
<p><strong>The shard/lib/web db user list</strong> You are about to see it here!</p>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="box span12">
<div class="box-header well" data-original-title>
<h2><i class="icon-user"></i> Members</h2>
<div class="box-icon">
<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-close btn-round"><i class="icon-remove"></i></a>
</div>
</div>
<div class="box-content">
<table class="table table-striped table-bordered bootstrap-datatable datatable">
<thead>
<tr>
<th>Id</th>
<th>Username</th>
<th>Email</th>
<th>Permission</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{foreach from=$userlist item=element}
<tr>
<td>{$element.id}</td>
<td class="center"><a href="index.php?page=show_user&id={$element.id}">{$element.username}</a></td>
<td class="center">{$element.email}</td>
{if $element.permission eq 1}<td class="center"><span class="label label-success">User</span></td>{/if}
{if $element.permission eq 2}<td class="center"><span class="label label-warning">Admin</span></td>{/if}
<td class="center">
<a class="btn btn-primary" href="index.php?page=show_user&id={$element.id}"><i class=" icon-pencil icon-white"></i>Show User</a>
<a class="btn btn-info" href="index.php?page=settings&id={$element.id}"><i class=" icon-pencil icon-white"></i>Edit User</a>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div><!--/span-->
</div><!--/row-->
{/block}