1
|
|
|
<?php
|
2
|
|
|
/* zKillboard
|
3
|
|
|
* Copyright (C) 2012-2015 EVE-KILL Team and EVSCO.
|
4
|
|
|
*
|
5
|
|
|
* This program is free software: you can redistribute it and/or modify
|
6
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
7
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
8
|
|
|
* (at your option) any later version.
|
9
|
|
|
*
|
10
|
|
|
* This program is distributed in the hope that it will be useful,
|
11
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
|
|
* GNU Affero General Public License for more details.
|
14
|
|
|
*
|
15
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
16
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
|
|
*/
|
18
|
|
|
|
19
|
|
|
$message = array();
|
20
|
|
|
$info = User::getUserInfo();
|
21
|
|
|
$ticket = Db::queryRow("SELECT * FROM zz_tickets WHERE id = :id", array(":id" => $id), 0);
|
22
|
|
|
if($ticket == NULL or sizeof($ticket) == 0)
|
23
|
|
|
$message = array("status" => "error", "message" => "Ticket does not exist.");
|
24
|
|
|
elseif($ticket["status"] == 0)
|
25
|
|
|
$message = array("status" => "error", "message" => "Ticket has been closed, you cannot post, only view it");
|
26
|
|
|
elseif($ticket["userid"] != $info["id"] && $info["moderator"] == 0 && $info["admin"] == 0)
|
27
|
|
|
$app->notFound();
|
28
|
|
|
|
29
|
|
|
if($_POST)
|
30
|
|
|
{
|
31
|
|
|
$reply = Util::getPost("reply");
|
32
|
|
|
|
33
|
|
|
if($reply && $ticket["status"] != 0)
|
|
|
|
|
34
|
|
|
{
|
35
|
|
|
$name = $info["username"];
|
36
|
|
|
$moderator = $info["moderator"];
|
37
|
|
|
$check = Db::query("SELECT * FROM zz_tickets_replies WHERE reply = :reply AND userid = :userid AND belongsTo = :id", array(":reply" => $reply, ":userid" => $info["id"], ":id" => $id), 0);
|
38
|
|
|
if(!$check)
|
39
|
|
|
{
|
40
|
|
|
Db::execute("INSERT INTO zz_tickets_replies (userid, belongsTo, name, reply, moderator) VALUES (:userid, :belongsTo, :name, :reply, :moderator)", array(":userid" => $info["id"], ":belongsTo" => $id, ":name" => $name, ":reply" => $reply, ":moderator" => $moderator));
|
41
|
|
|
global $baseAddr;
|
42
|
|
|
if (!$moderator) Log::ircAdmin("|g|Ticket response from $name:|n| https://$baseAddr/moderator/tickets/$id/");
|
43
|
|
|
$app->redirect("/tickets/view/$id/");
|
44
|
|
|
}
|
45
|
|
|
}
|
46
|
|
|
else
|
47
|
|
|
{
|
48
|
|
|
$message = array("status" => "error", "message" => "No...");
|
49
|
|
|
}
|
50
|
|
|
}
|
51
|
|
|
|
52
|
|
|
$replies = Db::query("SELECT * FROM zz_tickets_replies WHERE belongsTo = :id", array(":id" => $id), 0);
|
53
|
|
|
|
54
|
|
|
$app->render("tickets_view.html", array("page" => $id, "message" => $message, "ticket" => $ticket, "replies" => $replies));
|
55
|
|
|
|
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: