Skip to content

Commit 86ddb87

Browse files
committed
Release 2.2
1 parent 6631b88 commit 86ddb87

File tree

6 files changed

+179
-9
lines changed

6 files changed

+179
-9
lines changed

assets/languages/lang_de.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
define("MY_TICKETS", "Meine Tickets");
5858
//team.php
5959
define("OPEN_TICKETS", "Offene Tickets");
60+
define("ALL_TICKETS", "Alle Tickets");
6061
define("NO_OPEN", "Derzeit gibt es keine offene Tickets.");
6162
//ticket.php
6263
define("CREATED_BY", "Erstellt von");
@@ -86,4 +87,8 @@
8687
define("EDIT_NO_PERMS", "Du kannst diesen Benutzer nicht verändern.");
8788
define("EDIT_NOT_YOU", "Du kannst dich nicht selbst bearbeiten.");
8889
define("NO_REQUEST", "Es wurde kein Benutzer angefordert.");
90+
//search.php
91+
define("SEARCH", "Suche");
92+
define("SEARCH_KEY", "Suchbegriff");
93+
define("NO_SEARCH_RESULT", "Es wurden keine Suchergebnisse gefunden.");
8994
?>

assets/languages/lang_en.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
define("MY_TICKETS", "My tickets");
5858
//team.php
5959
define("OPEN_TICKETS", "Open tickets");
60+
define("ALL_TICKETS", "All tickets");
6061
define("NO_OPEN", "Currently are no tickets open.");
6162
//ticket.php
6263
define("CREATED_BY", "Created by");
@@ -86,4 +87,8 @@
8687
define("EDIT_NO_PERMS", "You can't edit this user.");
8788
define("EDIT_NOT_YOU", "You can't edit yourself.");
8889
define("NO_REQUEST", "No user was requested.");
90+
//search.php
91+
define("SEARCH", "Search");
92+
define("SEARCH_KEY", "Keyword");
93+
define("NO_SEARCH_RESULT", "No search results were found.");
8994
?>

search.php

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
<?php
2+
if(!file_exists("mysql.php")){
3+
header("Location: setup/index.php");
4+
exit;
5+
}
6+
session_start();
7+
require("datamanager.php");
8+
require('assets/languages/lang_'.getSetting("lang").'.php');
9+
if(!isset($_SESSION["username"])){
10+
?>
11+
<meta http-equiv="refresh" content="0; URL=login.php">
12+
<?php
13+
exit;
14+
} else if(getAccountRank($_SESSION["username"]) < 1){
15+
?>
16+
<meta http-equiv="refresh" content="0; URL=mytickets.php">
17+
<?php
18+
exit;
19+
}
20+
?>
21+
<!DOCTYPE html>
22+
<html lang="en" dir="ltr">
23+
<head>
24+
<meta charset="utf-8">
25+
<title><?php echo SEARCH; ?></title>
26+
<link rel="stylesheet" href="assets/css/main.css">
27+
<link href="https://fonts.googleapis.com/css?family=Quicksand&display=swap" rel="stylesheet">
28+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
29+
</head>
30+
<body>
31+
<div class="flex">
32+
<div class="flex-item">
33+
<?php
34+
function shorter($text, $chars_limit){
35+
if (strlen($text) > $chars_limit){
36+
$new_text = substr($text, 0, $chars_limit);
37+
$new_text = trim($new_text);
38+
return $new_text . "...";
39+
} else {
40+
return $text;
41+
}
42+
}
43+
?>
44+
<h1><?php echo SEARCH; ?></h1>
45+
<div class="icon-card-big">
46+
<?php
47+
if(isset($_GET["archive"])){
48+
?>
49+
<a href="search.php"><i class="fas fa-search fa-2x"></i></a>
50+
<?php
51+
} else {
52+
?>
53+
<a href="team.php?archive"><i class="fas fa-archive fa-2x"></i></a>
54+
<?php
55+
}
56+
?>
57+
</div>
58+
<?php
59+
if(isset($_POST["submit"])){
60+
require("mysql.php");
61+
$stmt = $mysql->prepare("SELECT * FROM tickets WHERE TITLE LIKE :searchkey");
62+
$searchkey = "%".$_POST["key"]."%";
63+
$stmt->bindParam(":searchkey", $searchkey, PDO::PARAM_STR);
64+
$stmt->execute();
65+
$count = $stmt->rowCount();
66+
if($count != 0){
67+
?>
68+
<table>
69+
<tr>
70+
<th>ID</th>
71+
<th><?php echo TITLE; ?></th>
72+
<th><?php echo CATEGORY; ?></th>
73+
<th><?php echo CREATED_AT; ?></th>
74+
<th><?php echo LAST_ANSWER_AT; ?></th>
75+
<th>Status</th>
76+
<th><?php echo ACTION; ?></th>
77+
</tr>
78+
<?php
79+
while ($row = $stmt->fetch()) {
80+
?>
81+
<tr>
82+
<td><?php echo $row["ID"]; ?></td>
83+
<td><?php echo shorter($row["TITLE"], 25); ?></td>
84+
<td><?php echo getCategory($row["CATEGORY"]); ?></td>
85+
<td><?php echo displayTimestamp($row["CREATIONDATE"]); ?></td>
86+
<td><?php
87+
if($row["LASTANSWERDATE"] == null){
88+
echo NONE;
89+
} else {
90+
echo displayTimestamp($row["LASTANSWERDATE"]);
91+
}
92+
?></td>
93+
<td><?php
94+
if($row["STATUS"] == 0){
95+
echo OPEN;
96+
} if($row["STATUS"] == 1){
97+
echo CLOSED;
98+
}
99+
?></td>
100+
<td><a href="ticket.php?id=<?php echo $row["ID"]; ?>" class="btn"><i class="fas fa-eye"></i></a></td>
101+
</tr>
102+
<?php
103+
}
104+
?>
105+
</table>
106+
<?php
107+
} else {
108+
?>
109+
<p><?php echo NO_SEARCH_RESULT; ?></p><br>
110+
<form action="search.php" method="post">
111+
<input type="text" name="key" placeholder="<?php echo SEARCH_KEY ?>" required>
112+
<button type="submit" name="submit"><i class="fas fa-search fa-2x"></i></button>
113+
</form>
114+
<?php
115+
}
116+
} else {
117+
?>
118+
<form action="search.php" method="post">
119+
<input type="text" name="key" placeholder="<?php echo SEARCH_KEY ?>" required>
120+
<button type="submit" name="submit"><i class="fas fa-search fa-2x"></i></button>
121+
</form>
122+
<?php
123+
}
124+
?>
125+
</div>
126+
<div class="flex-item sidebar">
127+
<?php require('assets/inc/sidebar.inc.php'); ?>
128+
</div>
129+
</div>
130+
</body>
131+
</html>

settings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@
6565
<p><?php echo RANK; ?>: <strong><?php
6666
if(getAccountRank($_SESSION["username"]) == 3 || getAccountRank($_SESSION["username"]) == 2){
6767
echo "Admin";
68-
} else if(getAccountRank($_SESSION["username"]) == 2){
69-
echo "Team";
7068
} else if(getAccountRank($_SESSION["username"]) == 1){
69+
echo "Team";
70+
} else if(getAccountRank($_SESSION["username"]) == 0){
7171
echo MEMBER;
7272
}
7373
?></strong> </p>

team.php

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,37 @@ function shorter($text, $chars_limit){
4141
}
4242
}
4343
?>
44-
<h1><?php echo OPEN_TICKETS; ?></h1>
44+
<?php
45+
if(isset($_GET["archive"])){
46+
?>
47+
<h1><?php echo ALL_TICKETS; ?></h1>
48+
<?php
49+
} else {
50+
?>
51+
<h1><?php echo OPEN_TICKETS; ?></h1>
52+
<?php
53+
}
54+
?>
55+
<div class="icon-card-big">
56+
<?php
57+
if(isset($_GET["archive"])){
58+
?>
59+
<a href="search.php"><i class="fas fa-search fa-2x"></i></a>
60+
<?php
61+
} else {
62+
?>
63+
<a href="team.php?archive"><i class="fas fa-archive fa-2x"></i></a>
64+
<?php
65+
}
66+
?>
67+
</div>
4568
<?php
4669
require("mysql.php");
47-
$stmt = $mysql->prepare("SELECT * FROM tickets WHERE STATUS = 0 ORDER BY CREATIONDATE DESC");
70+
if(isset($_GET["archive"])){
71+
$stmt = $mysql->prepare("SELECT * FROM tickets ORDER BY CREATIONDATE DESC");
72+
} else {
73+
$stmt = $mysql->prepare("SELECT * FROM tickets WHERE STATUS = 0 ORDER BY CREATIONDATE DESC");
74+
}
4875
$stmt->execute();
4976
$count = $stmt->rowCount();
5077
if($count != 0){

ticket.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
<meta http-equiv="refresh" content="0; URL=login.php">
1212
<?php
1313
exit;
14-
} else if(getAccountRank($_SESSION["username"]) == 0 || $_SESSION["username"] != getAccountName(getTicketCreatorID($_GET["id"]))){
15-
?>
16-
<meta http-equiv="refresh" content="0; URL=mytickets.php">
17-
<?php
18-
exit;
14+
} else if($_SESSION["username"] != getAccountName(getTicketCreatorID($_GET["id"]))){
15+
if(getAccountRank($_SESSION["username"]) < 1){
16+
?>
17+
<meta http-equiv="refresh" content="0; URL=mytickets.php">
18+
<?php
19+
exit;
20+
}
1921
}
2022
?>
2123
<!DOCTYPE html>

0 commit comments

Comments
 (0)