1 | <?php
|
---|
2 | function ShowValue ($cook)
|
---|
3 | {
|
---|
4 | if (isset($_COOKIE[$cook]) AND $_COOKIE[$cook] != 0 AND $_COOKIE[$cook] != "")
|
---|
5 | {
|
---|
6 | echo $_COOKIE[$cook];
|
---|
7 | }
|
---|
8 | }
|
---|
9 | function SelectValue ($frakce)
|
---|
10 | {
|
---|
11 | if (isset($_COOKIE["hof-frakce"]) AND $_COOKIE["hof-frakce"] != 0 AND $_COOKIE["hof-frakce"] != "" AND $_COOKIE["hof-frakce"] == $frakce)
|
---|
12 | {
|
---|
13 | echo "SELECTED";
|
---|
14 | }
|
---|
15 | }
|
---|
16 | $work = "";
|
---|
17 | if (isset($_POST["set"]))
|
---|
18 | {
|
---|
19 | $year = 365 * 24 * 60 * 60;
|
---|
20 | setcookie("hof-maxlvl",$_POST["maxlvl"],time()+$year);
|
---|
21 | setcookie("hof-minlvl",$_POST["minlvl"],time()+$year);
|
---|
22 | setcookie("hof-maxgold",$_POST["maxgold"],time()+$year);
|
---|
23 | setcookie("hof-frakce",$_POST["frakce"],time()+$year);
|
---|
24 | echo "<meta http-equiv=\"refresh\" content=\"2;url=?page=aukce\">";
|
---|
25 | $work = "Ukládám nastavení , chvíli strpení";
|
---|
26 | }
|
---|
27 | if (isset($_POST["reset"]))
|
---|
28 | {
|
---|
29 | $year = 365 * 24 * 60 * 60;
|
---|
30 | setcookie("hof-maxlvl","",time()+$year);
|
---|
31 | setcookie("hof-minlvl","",time()+$year);
|
---|
32 | setcookie("hof-maxgold","",time()+$year);
|
---|
33 | setcookie("hof-frakce","",time()+$year);
|
---|
34 | echo "<meta http-equiv=\"refresh\" content=\"2;url=?page=aukce\">";
|
---|
35 | $work = "Ukládám nastavení , chvíli strpení";
|
---|
36 | }
|
---|
37 | if (isset($_COOKIE["hof-widget"]) AND $_COOKIE["hof-widget"] == "thottbot")
|
---|
38 | {
|
---|
39 | echo "<script src=\"http://i.thottbot.com/power.js\"></script>";
|
---|
40 | $link = "http://thottbot.com/i";
|
---|
41 | }
|
---|
42 | else
|
---|
43 | {
|
---|
44 | echo "<script src=\"http://www.wowhead.com/widgets/power.js\"></script>";
|
---|
45 | $link = "http://www.wowhead.com/?item=";
|
---|
46 | }
|
---|
47 | ?>
|
---|
48 | <form method="post">
|
---|
49 | <table border="0">
|
---|
50 | <tr>
|
---|
51 | <td>Minimální / Maximální úroveň</td>
|
---|
52 | <td><input type="text" size="10" name="minlvl" value="<?php ShowValue("hof-minlvl");?>"> / <input type="text" size="10" name="maxlvl" value="<?php ShowValue("hof-maxlvl");?>"></td>
|
---|
53 | </tr>
|
---|
54 | <tr>
|
---|
55 | <td>Frakce</td>
|
---|
56 | <td>
|
---|
57 | <select name="frakce">
|
---|
58 | <option value="">Frakce</option>
|
---|
59 | <option value="2" <?php SelectValue("2");?> >Aliance</option>
|
---|
60 | <option value="6" <?php SelectValue("6");?> >Horda</option>
|
---|
61 | <option value="7" <?php SelectValue("7");?> >Neutralní</option>
|
---|
62 | </select>
|
---|
63 | </td>
|
---|
64 | </tr>
|
---|
65 | <tr>
|
---|
66 | <td>Maximálně goldů</td>
|
---|
67 | <td><input type="text" size="10" name="maxgold" value="<?php ShowValue("hof-maxgold");?>"></td>
|
---|
68 | </tr>
|
---|
69 | <tr>
|
---|
70 | <td colspan="2"><input type="submit" value="Potvrdit" name="set"></form><?php echo $work;?></td>
|
---|
71 | </tr>
|
---|
72 | </table>
|
---|
73 | <form method="post">
|
---|
74 | <input type="submit" value="Resetovat filtry" name="reset">
|
---|
75 | </form>
|
---|
76 |
|
---|
77 |
|
---|
78 |
|
---|
79 | <center>
|
---|
80 | <table border="1" width="540">
|
---|
81 | <tr>
|
---|
82 | <td width="300">Předmět</td>
|
---|
83 | <td align="center">Aktuální cena<br />Kup teď za cenu</td>
|
---|
84 | <td align="center">Konec aukce</td>
|
---|
85 | <td align="center">F</td>
|
---|
86 | </tr>
|
---|
87 | <?php
|
---|
88 | $db -> select_db($Config['Mangos']['DatabaseCharacters']);
|
---|
89 |
|
---|
90 | function AuctionEnd($end_time)
|
---|
91 | {
|
---|
92 | $now = time();
|
---|
93 | $end = $end_time;
|
---|
94 | $dif_minutes = round(($end_time - time()) / 60);
|
---|
95 | $dif_hours = round($dif_minutes / 60);
|
---|
96 | $dif_days = round($dif_hours / 24);
|
---|
97 | // dny
|
---|
98 | if ($dif_days <= 2)
|
---|
99 | {$end = "< 2 Dny";}
|
---|
100 | if ($dif_days < 1)
|
---|
101 | {$end = "< 1 Den";}
|
---|
102 | // hodiny
|
---|
103 | if ($dif_hours < 24)
|
---|
104 | {$end = "< 24 Hodin";}
|
---|
105 | if ($dif_hours < 12)
|
---|
106 | {$end = "< 12 Hodin";}
|
---|
107 | if ($dif_hours < 5)
|
---|
108 | {$end = "< 5 Hodin";}
|
---|
109 | // minuty
|
---|
110 | if ($dif_minutes < 60)
|
---|
111 | {$end = "< 1 Hodina";}
|
---|
112 | if ($dif_minutes < 10)
|
---|
113 | {$end = "< 10 Minut";}
|
---|
114 | if ($dif_minutes < 5)
|
---|
115 | {$end = "< 5 Minut";}
|
---|
116 | if ($dif_minutes < 2)
|
---|
117 | {$end = "< 2 Minuty";}
|
---|
118 | if ($dif_minutes <= 1)
|
---|
119 | {$end = "<font color =\"#990000\">Konec</font>";}
|
---|
120 | return $end;
|
---|
121 | }
|
---|
122 | function LoadCookie ($name,$def)
|
---|
123 | {
|
---|
124 | if (isset($_COOKIE[$name]) AND $_COOKIE[$name] != 0 AND $_COOKIE[$name] != "")
|
---|
125 | {
|
---|
126 | if ($name == "hof-maxgold")
|
---|
127 | {$value = $_COOKIE[$name]*10000;}
|
---|
128 | else
|
---|
129 | {$value = $_COOKIE[$name];}
|
---|
130 | return $value;
|
---|
131 | }
|
---|
132 | else
|
---|
133 | {
|
---|
134 | return $def;
|
---|
135 | }
|
---|
136 | }
|
---|
137 |
|
---|
138 |
|
---|
139 | $data = $db -> query("SELECT `item_template`,`itemowner`,`buyoutprice`,`time`,`buyguid`,`lastbid`,`startbid`,`location` FROM `auctionhouse` ORDER BY `time` ASC LIMIT 0,30");
|
---|
140 |
|
---|
141 |
|
---|
142 | while($row = $data -> fetch_array())
|
---|
143 | {
|
---|
144 |
|
---|
145 | $moneys = array_unique(array($row["buyoutprice"],$row["lastbid"],$row["startbid"]));
|
---|
146 | sort($moneys);
|
---|
147 | reset($moneys);
|
---|
148 | while ($moneys[0] == 0)
|
---|
149 | {
|
---|
150 | array_shift($moneys);
|
---|
151 | }
|
---|
152 |
|
---|
153 |
|
---|
154 |
|
---|
155 | $db -> select_db($Config['Mangos']['DatabaseMangos']);
|
---|
156 | $item = $db -> query("SELECT `name` , `RequiredLevel` FROM `item_template` WHERE `entry`='".$row["item_template"]."' LIMIT 1;") -> fetch_array();
|
---|
157 | if (LoadCookie("hof-frakce",$row["location"]) == $row["location"] AND LoadCookie("hof-maxgold",10000000000) >= $moneys[0] AND LoadCookie("hof-minlvl",0) <= $item["RequiredLevel"] AND LoadCookie("hof-maxlvl",70) >= $item["RequiredLevel"])
|
---|
158 | {
|
---|
159 | // switch
|
---|
160 | switch ($row["location"])
|
---|
161 | {
|
---|
162 | case 2:
|
---|
163 | $loc = "<img src=\"imgs/inc/a.gif\">";
|
---|
164 | break;
|
---|
165 | case 6:
|
---|
166 | $loc = "<img src=\"imgs/inc/h.gif\">";
|
---|
167 | break;
|
---|
168 | case 7:
|
---|
169 | $loc = "-";
|
---|
170 | break;
|
---|
171 | return $loc;
|
---|
172 | }
|
---|
173 | // imgs
|
---|
174 | if (is_readable("./imgs/INV/".$row["item_template"].".jpg"))
|
---|
175 | {$img = "<img src=\"imgs/INV/".$row["item_template"].".jpg\"><img src=\"imgs/INV/icon_border.png\" style=\"position: relative; left: -40px; top: 3px;\">";}
|
---|
176 | else
|
---|
177 | {$img = "<img src=\"imgs/INV/13250.jpg\"><img src=\"imgs/INV/icon_border.png\" style=\"position: relative; left: -40px; top: 3px;\">";}
|
---|
178 | // moneys
|
---|
179 | if ($row["buyoutprice"] != 0)
|
---|
180 | {$buyout = $server -> ParseCopper($row["buyoutprice"]);}
|
---|
181 | else
|
---|
182 | {$buyout = "-";}
|
---|
183 | if ($row["buyoutprice"] != 0)
|
---|
184 | {$buyout = $server -> ParseCopper($row["buyoutprice"]);}
|
---|
185 | else
|
---|
186 | {$buyout = "-";}
|
---|
187 | if ($row["lastbid"] != 0)
|
---|
188 | {$now = $server -> ParseCopper($row["lastbid"])."<br />(".$player -> GuidToCharName($row["buyguid"]).")";}
|
---|
189 | else
|
---|
190 | {$now = $server -> ParseCopper($row["startbid"]);}
|
---|
191 | // timer
|
---|
192 | echo "
|
---|
193 | <tr>
|
---|
194 | <td width=\"300\">".$img."<a href=\"".$link.$row["item_template"]."\" target=\"_blank\"><span style=\"position: relative; top: -13px; left: -38px\"><font size=\"2\">".$item["name"]."</font></span></a><br />Minimální level : ".$item["RequiredLevel"]."<br />Aukci vložil : ".$player -> GuidToCharName($row["itemowner"])."</td>
|
---|
195 | <td align=\"center\">".$now."<br />".$buyout."</td>
|
---|
196 | <td align=\"center\"><font size=\"2\">".AuctionEnd($row["time"])."</font></td>
|
---|
197 | <td align=\"center\">".$loc."</td>
|
---|
198 | </tr>
|
---|
199 | ";
|
---|
200 | }
|
---|
201 | }
|
---|
202 | ?>
|
---|
203 | </table></center>
|
---|
204 | <font size="2">Pro správnou filtraci je potřeba mít zaplé cookies.</font>
|
---|