1 | <?php
|
---|
2 | $lvl = $player -> GetGmLvl();
|
---|
3 | if($lvl > 0){
|
---|
4 | echo "<center>";
|
---|
5 | $q = $_GET['q'];
|
---|
6 | if(empty($q)):
|
---|
7 | echo"<h2>Vyber kategorii</h2>";
|
---|
8 | echo"<p align=center>";
|
---|
9 | echo"<a href=\"?page=admin_novinky_modify&q=1&c=0\">Všechny</a> <br />";
|
---|
10 | echo"<a href=\"?page=admin_novinky_modify&q=1&c=1\">Server novinky</a> <br />";
|
---|
11 | echo"<a href=\"?page=admin_novinky_modify&q=1&c=2\">Gm novinky</a> <br />";
|
---|
12 | echo"<a href=\"?page=admin_novinky_modify&q=1&c=3\">In-Game novinky</a> <br />";
|
---|
13 | echo"<a href=\"?page=admin_novinky_modify&q=1&c=4\">Články</a> <br />";
|
---|
14 |
|
---|
15 | elseif($q == 1):
|
---|
16 | $kategorie = $_GET['c'];
|
---|
17 |
|
---|
18 | if($kategorie == 0):
|
---|
19 | $where = " ";
|
---|
20 | else:
|
---|
21 | $where = "WHERE category='$kategorie'";
|
---|
22 | endif;
|
---|
23 |
|
---|
24 | $DbResult = $db->query("SELECT id FROM articles $where")
|
---|
25 | $pocet = $DbResult->num_rows;
|
---|
26 |
|
---|
27 | if($pocet != 0):
|
---|
28 | echo"<table align=center border=1><tr><td><b>Autor</b><td><b>Datum</b><td><b>Nadpis</b><td></tr>";
|
---|
29 |
|
---|
30 | $query = $db->query("SELECT * from articles $where order by date DESC");
|
---|
31 | while($row = $query->fetch_array($query))
|
---|
32 | {
|
---|
33 | $id = $row['id'];
|
---|
34 | echo"<tr>
|
---|
35 | <td align=center valign=middle>$row[date]
|
---|
36 | <td align=center valign=middle>$row[autor]
|
---|
37 | <td align=center valign=middle>$row[title]
|
---|
38 | <form method=post action=\"?page=admin_novinky_modify&q=2\">
|
---|
39 | <td align=center valign=middle>
|
---|
40 | <input type=hidden name=id value='$id'><input type=submit value='Upravit'>
|
---|
41 | </form></tr>";
|
---|
42 |
|
---|
43 | }
|
---|
44 | echo"</table>";
|
---|
45 |
|
---|
46 | else:
|
---|
47 | echo"<b>V této kategorii nejsou žádné novinky!</b>";
|
---|
48 | endif;
|
---|
49 |
|
---|
50 | elseif($q == 2):
|
---|
51 | $id = $_POST['id'];
|
---|
52 |
|
---|
53 | $query = $db->query("SELECT * from articles where id='$id'");
|
---|
54 |
|
---|
55 | while($row = $query->fetch_array())
|
---|
56 | {
|
---|
57 | $autor = $row['autor'];
|
---|
58 | $title = $row['title'];
|
---|
59 | $text = $row['text'];
|
---|
60 | $kategorie = $row['category'];
|
---|
61 | }
|
---|
62 | if($kategorie==1):
|
---|
63 | $option1 = "<option value=1>Server novinky";
|
---|
64 | $option2 = "<option value=2>Gm novinky";
|
---|
65 | $option3 = "<option value=3>In-Game novinky";
|
---|
66 | $option4 = "<option value=4>Články";
|
---|
67 | elseif($kategorie==2):
|
---|
68 | $option1 = "<option value=2>Gm novinky";
|
---|
69 | $option2 = "<option value=1>Server novinky";
|
---|
70 | $option3 = "<option value=3>In-Game novinky";
|
---|
71 | $option4 = "<option value=4>Články";
|
---|
72 | elseif($kategorie==3):
|
---|
73 | $option1 = "<option value=3>In-Game novinky";
|
---|
74 | $option2 = "<option value=2>Gm novinky";
|
---|
75 | $option3 = "<option value=1>Server novinky";
|
---|
76 | $option4 = "<option value=4>Články";
|
---|
77 | elseif($kategorie==4):
|
---|
78 | $option1 = "<option value=4>Články";
|
---|
79 | $option2 = "<option value=2>Gm novinky";
|
---|
80 | $option3 = "<option value=3>In-Game novinky";
|
---|
81 | $option4 = "<option value=1>Server novinky";
|
---|
82 | endif;
|
---|
83 |
|
---|
84 | echo"<form method=post action=\"?page=admin_novinky_modify&q=3\"><table align=center><p align=center>";
|
---|
85 | echo"<input type=hidden name=id value='$id'><input type=hidden name=upravit value=1>";
|
---|
86 | echo"<tr><td align=right><b>Autor:</b> <td><input type=text value='$autor' name=autor><br />";
|
---|
87 | echo"<tr><td align=right><b>Nadpis:</b> <td><input type=text value='$title' name=title><br />";
|
---|
88 | echo"
|
---|
89 | <tr><td align=right>
|
---|
90 | <b>Kategorie:</b>
|
---|
91 | <td><select name=kategorie>
|
---|
92 | $option1
|
---|
93 | $option2
|
---|
94 | $option3
|
---|
95 | $option4
|
---|
96 | </select>
|
---|
97 | </table><br /><br />";
|
---|
98 | echo"<table align=center><tr><td valign=top><b>Text:</b> <td><textarea name=text cols=\"30\" rows=\"5\">$text</textarea></table><br />";
|
---|
99 | echo"<br><input type=submit value='Upravit'>";
|
---|
100 |
|
---|
101 | elseif($q == 3):
|
---|
102 | $autor = $_POST['autor'];
|
---|
103 | $title = $_POST['title'];
|
---|
104 | $text = $_POST['text'];
|
---|
105 | $kategorie = $_POST['kategorie'];
|
---|
106 | $id = $_POST['id'];
|
---|
107 | $upravit = $_POST['upravit'];
|
---|
108 |
|
---|
109 | if($upravit==1 and $lvl > 0):
|
---|
110 |
|
---|
111 |
|
---|
112 | $upravit_autor = $db->query("update articles set autor='$autor' where id='$id'");
|
---|
113 | $upravit_title = $db->query("update articles set title='$title' where id='$id'");
|
---|
114 | $upravit_text = $db->query("update articles set text='$text' where id='$id'");
|
---|
115 | $upravit_kategorie = $db->query("update articles set category='$kategorie' where id='$id'");
|
---|
116 |
|
---|
117 | if($upravit_autor and $upravit_title and $upravit_text and $upravit_kategorie):
|
---|
118 | echo"<p align=center><font color=green><b>Úprava novinky byla provedena úspěšně!</b></font><br>";
|
---|
119 | echo"<a href=\"?page=admin\"><-- Do administrace</a>";
|
---|
120 | else:
|
---|
121 | echo"<p align=center><font color=red><b>Při úpravě novinky došlo k chybě, zkuste to prosím později!</b></font><br>";
|
---|
122 | echo"<a href=\"?page=admin\"><-- Do administrace</a>";
|
---|
123 | endif;
|
---|
124 | else:
|
---|
125 | echo"<p align=center><font color=red><b>Nemáte dostatečná oprávnění pro tuto akci!</b></font>";
|
---|
126 | echo"<meta http-equiv=\"refresh\" content=\"3;url=?page=main\">";
|
---|
127 | endif;
|
---|
128 |
|
---|
129 | endif;
|
---|
130 | echo"</center>";
|
---|
131 |
|
---|
132 | } else {
|
---|
133 | echo"<p align=center><font color=red><b>Nemáte dostatečná oprávnění pro tuto akci!</b></font>";
|
---|
134 | echo"<meta http-equiv=\"refresh\" content=\"3;url=?page=main\">";
|
---|
135 | }
|
---|
136 |
|
---|
137 | ?>
|
---|