Fix #189
This commit is contained in:
parent
f20415a3b6
commit
afa6787100
4 changed files with 45 additions and 15 deletions
|
@ -201,7 +201,6 @@ class DBLayer {
|
||||||
$field_option_values = ltrim($field_option_values, ',');
|
$field_option_values = ltrim($field_option_values, ',');
|
||||||
try {
|
try {
|
||||||
$sth = $this->PDO->prepare("UPDATE $tb_name SET $field_option_values WHERE $where ");
|
$sth = $this->PDO->prepare("UPDATE $tb_name SET $field_option_values WHERE $where ");
|
||||||
error_log("UPDATE $tb_name SET $field_option_values WHERE $where ");
|
|
||||||
|
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
$sth->bindValue(":$key", $value);
|
$sth->bindValue(":$key", $value);
|
||||||
|
|
|
@ -9,8 +9,36 @@ function create_ticket(){
|
||||||
//if logged in
|
//if logged in
|
||||||
global $INGAME_WEBPATH;
|
global $INGAME_WEBPATH;
|
||||||
global $WEBPATH;
|
global $WEBPATH;
|
||||||
|
$return = array();
|
||||||
|
$error = false;
|
||||||
if(WebUsers::isLoggedIn() && isset($_SESSION['ticket_user'])){
|
if(WebUsers::isLoggedIn() && isset($_SESSION['ticket_user'])){
|
||||||
|
|
||||||
|
if(strlen (preg_replace('/\s\s+/', ' ', $_POST['Title']) )<2){
|
||||||
|
$return = array_merge ( $_POST, $return);
|
||||||
|
$return['no_visible_elements'] = 'FALSE';
|
||||||
|
$catArray = Ticket_Category::getAllCategories();
|
||||||
|
$return['permission'] = unserialize( $_SESSION['ticket_user'] ) -> getPermission();
|
||||||
|
$return['category'] = Gui_Elements::make_table_with_key_is_id($catArray, Array("getName"), "getTCategoryId" );
|
||||||
|
$return['TITLE_ERROR_MESSAGE'] = "Title must not be blank!";
|
||||||
|
$return['TITLE_ERROR'] = true;
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
if(strlen (preg_replace('/\s\s+/', ' ', $_POST['Content']) )<2){
|
||||||
|
$return = array_merge ( $_POST, $return);
|
||||||
|
$return['no_visible_elements'] = 'FALSE';
|
||||||
|
$catArray = Ticket_Category::getAllCategories();
|
||||||
|
$return['permission'] = unserialize( $_SESSION['ticket_user'] ) -> getPermission();
|
||||||
|
$return['category'] = Gui_Elements::make_table_with_key_is_id($catArray, Array("getName"), "getTCategoryId" );
|
||||||
|
$return['CONTENT_ERROR_MESSAGE'] = "Content must not be blank!";
|
||||||
|
$return['CONTENT_ERROR'] = true;
|
||||||
|
$error = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($error) {
|
||||||
|
helpers :: loadTemplate( 'createticket' , $return );
|
||||||
|
throw new SystemExit();
|
||||||
|
}
|
||||||
if(isset($_POST['target_id'])){
|
if(isset($_POST['target_id'])){
|
||||||
|
|
||||||
//if target_id is the same as session id or is admin
|
//if target_id is the same as session id or is admin
|
||||||
|
@ -36,8 +64,8 @@ function create_ticket(){
|
||||||
}else{
|
}else{
|
||||||
header("Cache-Control: max-age=1");
|
header("Cache-Control: max-age=1");
|
||||||
header("Location: ".$WEBPATH."?page=show_ticket&id=".$ticket_id);
|
header("Location: ".$WEBPATH."?page=show_ticket&id=".$ticket_id);
|
||||||
}
|
|
||||||
throw new SystemExit();
|
throw new SystemExit();
|
||||||
|
}
|
||||||
|
|
||||||
}catch (PDOException $e) {
|
}catch (PDOException $e) {
|
||||||
//ERROR: LIB DB is not online!
|
//ERROR: LIB DB is not online!
|
||||||
|
@ -59,7 +87,7 @@ function create_ticket(){
|
||||||
}else{
|
}else{
|
||||||
//ERROR: The form was not filled in correclty
|
//ERROR: The form was not filled in correclty
|
||||||
header("Cache-Control: max-age=1");
|
header("Cache-Control: max-age=1");
|
||||||
header("Location: index.php?page=create_ticket");
|
header("Location: index.php?page=createticket");
|
||||||
throw new SystemExit();
|
throw new SystemExit();
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -44,6 +44,7 @@ function createticket(){
|
||||||
$result['category'] = Gui_Elements::make_table_with_key_is_id($catArray, Array("getName"), "getTCategoryId" );
|
$result['category'] = Gui_Elements::make_table_with_key_is_id($catArray, Array("getName"), "getTCategoryId" );
|
||||||
global $INGAME_WEBPATH;
|
global $INGAME_WEBPATH;
|
||||||
$result['ingame_webpath'] = $INGAME_WEBPATH;
|
$result['ingame_webpath'] = $INGAME_WEBPATH;
|
||||||
|
$result['TITLE_ERROR'] = $INGAME_WEBPATH;
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -10,11 +10,12 @@
|
||||||
<form id="changePassword" class="form-vertical" method="post" action="index.php?page=createticket&id={$target_id}">
|
<form id="changePassword" class="form-vertical" method="post" action="index.php?page=createticket&id={$target_id}">
|
||||||
<legend>New ticket</legend>
|
<legend>New ticket</legend>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group {if isset($TITLE_ERROR) and $TITLE_ERROR eq "TRUE"}error{/if}">
|
||||||
<label class="control-label">Title</label>
|
<label class="control-label">Title</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="input-prepend">
|
<div class="input-prepend">
|
||||||
<input type="text" class="span8" id="Title" name="Title">
|
<input type="text" class="span8" id="Title" name="Title" {if isset($Title)}value='{$Title}'{/if}>
|
||||||
|
{if isset($TITLE_ERROR) and $TITLE_ERROR eq "TRUE"}<span class="help-inline">{$TITLE_ERROR_MESSAGE}</span>{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -30,11 +31,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group {if isset($CONTENT_ERROR) and $CONTENT_ERROR eq "TRUE"}error{/if}">
|
||||||
<label class="control-label">Description</label>
|
<label class="control-label">Description</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="input-prepend">
|
<div class="input-prepend">
|
||||||
<textarea rows="12" class="span12" id="Content" name="Content"></textarea>
|
<textarea rows="12" class="span12" id="Content" name="Content">{if isset($Content)}{$Content}{/if}</textarea>
|
||||||
|
{if isset($CONTENT_ERROR) and $CONTENT_ERROR eq "TRUE"}<span class="help-inline">{$CONTENT_ERROR_MESSAGE}</span>{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue