Кондиции для воровства.
[cswow.git] / module / set / itemset.php
blobb8e8232d34b8542558ffd6913454ab3af5745e92
1 <?php
2 include_once("include/functions.php");
4 $page = intval(@$_REQUEST['page']);
6 // Создаём SQL запрос исходя из заданых пользователем параметров
7 $filter = "";
8 // Создаём ссылку на страницу, игнорируем дефолтные значения
9 $FindRefrence = "?set";
11 // Name filter
12 if ($name = mysql_real_escape_string(@$_REQUEST['name']))
14 $filter.= " AND `name` like '%$name%'";
15 $FindRefrence.="&name=$name";
18 $filter.=" AND 1=1";
20 // Убираем ненужный AND в начале строки
21 $filter = substr($filter, 5);
23 // Sort method
24 $sort = @$_REQUEST['sort'];
25 $sort_str = " order by `name`";
26 if ($sort == "name") $sort_str = " order by `name`";
27 else if($sort == "id") $sort_str = " order by `id`";
28 else $sort_str = " order by `name`";
30 $rows = 0;
31 if ($filter!="")
32 $rows = $wDB->selectPage($number, "SELECT * FROM `wowd_itemset` WHERE
33 $filter
34 $sort_str LIMIT ?d, ?d", getPageOffset($page), $config['fade_limit']);
36 if (!$rows || $number == 0)
38 echo $lang['not_found'];
40 else
42 echo "<table class=report width=500>\n";
43 echo "<tbody>\n";
44 echo "<tr><td colspan=4 class=head>$lang[item_set]</td></tr>\n";
46 // Делаем ссылку для сортировки
47 $SortRefrence = $FindRefrence;
48 if ($page>1) $SortRefrence.="&page=$page";
50 echo "<tr>";
51 echo "<th><a href=\"$SortRefrence\">$lang[set_name]</a></th>";
52 echo "<th width=260px>Items</th>";
53 echo "<th>Info</th>";
54 echo "</tr>\n";
55 foreach ($rows as $set)
57 $items = array();
58 $item = 0;
59 if ($set['item_1'])
60 $item = getItem($set['item_1']);
61 else
63 $items = $dDB->select("SELECT `entry`, `AllowableClass`, `displayid` FROM `item_template` WHERE `itemset` = ?d", $set['id']);
64 if ($items)
65 $item = $items[0];
67 echo "<tr>";
68 echo "<td>$set[name]</td>";
69 echo "<td>";
70 if ($set['item_1'])
72 for ($i=1;$i<18;$i++)
73 if ($itemid = $set['item_'.$i])
74 show_item($itemid, 0, 'set');
76 else
78 foreach($items as $item)
79 show_item($item['entry'], $item['displayid'], 'set');
81 if ($item)
82 $classreq = getAllowableClass($item['AllowableClass']);
83 else
84 $classreq = 0;
85 if (!$classreq) $classreq = "";
86 echo "</td>";
87 echo "<td align=center>".$classreq."</td>";
88 echo "</tr>\n";
90 $pageRefrence = $FindRefrence;
91 if ($sort) $pageRefrence.="&sort=$sort";
92 generatePage($number, $page, "<a href=\"$pageRefrence&page=%d\">%d </a>", 4);
93 echo "</tbody></table>";