1 | <?php
|
---|
2 |
|
---|
3 | $smarty->config_load($conf_file, 'objects');
|
---|
4 |
|
---|
5 | $type = $podrazdel;
|
---|
6 |
|
---|
7 | if(!$data = load_cache(4, intval($type)))
|
---|
8 | {
|
---|
9 | unset($data);
|
---|
10 |
|
---|
11 | // Подключаемся к ДБ:
|
---|
12 | global $DB;
|
---|
13 | global $AoWoWconf;
|
---|
14 |
|
---|
15 | // Получаем данные по этому типу объектов
|
---|
16 | $rows = $DB->select('
|
---|
17 | SELECT g.* {, a.requiredskill1 as ?#} {, a.requiredskill2 as ?#}
|
---|
18 | {, l.name_loc?d AS `name_loc`}
|
---|
19 | FROM {gameobject_questrelation ?#, } {?_lock ?#, } gameobject_template g
|
---|
20 | {LEFT JOIN (locales_gameobject l) ON l.entry=g.entry AND ?d}
|
---|
21 | WHERE
|
---|
22 | name != ""
|
---|
23 | { AND g.type = ? }
|
---|
24 | { AND g.data0=a.lockID AND g.type=3 AND a.type1=2 AND 1=?}
|
---|
25 | { AND g.data0=a.lockID AND g.type=3 AND a.type2=2 AND 1=?}
|
---|
26 | { AND a.lockproperties1=2 AND 1=?}
|
---|
27 | { AND a.lockproperties1=3 AND 1=?}
|
---|
28 | { AND a.lockproperties2=1 AND 1=?}
|
---|
29 | { AND g.entry = q.?#}
|
---|
30 | ORDER by name
|
---|
31 | {LIMIT ?d}
|
---|
32 | ',
|
---|
33 | (($type==-3) or ($type==-4))? 'skill': DBSIMPLE_SKIP,
|
---|
34 | ($type==-5)? 'skill': DBSIMPLE_SKIP,
|
---|
35 | ($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
|
---|
36 | ($type==-2)? 'q': DBSIMPLE_SKIP,
|
---|
37 | (($type==-3) or ($type==-4) or ($type==-5))? 'a': DBSIMPLE_SKIP,
|
---|
38 | ($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP,
|
---|
39 | ($type>0)? $type : DBSIMPLE_SKIP,
|
---|
40 | (($type==-3) or ($type==-4))? 1: DBSIMPLE_SKIP,
|
---|
41 | ($type==-5)? 1: DBSIMPLE_SKIP,
|
---|
42 | ($type==-3)? 1: DBSIMPLE_SKIP,
|
---|
43 | ($type==-4)? 1: DBSIMPLE_SKIP,
|
---|
44 | ($type==-5)? 1: DBSIMPLE_SKIP,
|
---|
45 | ($type==-2)? 'id': DBSIMPLE_SKIP,
|
---|
46 | ($AoWoWconf['limit']!=0)? $AoWoWconf['limit']: DBSIMPLE_SKIP
|
---|
47 | );
|
---|
48 |
|
---|
49 |
|
---|
50 | $i = 0;
|
---|
51 | $data = array();
|
---|
52 | foreach ($rows as $numRow=>$row)
|
---|
53 | {
|
---|
54 | $data[$i] = array();
|
---|
55 | $data[$i]['entry'] = $row['entry'];
|
---|
56 | if (IsSet($row['skill']))
|
---|
57 | $data[$i]['skill'] = $row['skill'];
|
---|
58 | $data[$i]['name'] = $row['name_loc']?$row['name_loc']:$row['name'];
|
---|
59 | // TODO: Расположение
|
---|
60 | $data[$i]['location'] = "[-1]";
|
---|
61 | // Тип объекта
|
---|
62 | $data[$i]['type'] = (isset($type))? $type : $row['type'];
|
---|
63 | $i++;
|
---|
64 | }
|
---|
65 | save_cache(4, intval($type), $data);
|
---|
66 | }
|
---|
67 | global $page;
|
---|
68 | $page = array(
|
---|
69 | 'Mapper' => false,
|
---|
70 | 'Book' => false,
|
---|
71 | 'Title' => $smarty->get_config_vars('Objects'),
|
---|
72 | 'tab' => 0,
|
---|
73 | 'type' => 0,
|
---|
74 | 'typeid' => 0,
|
---|
75 | 'path' => '[0, 5,'.$podrazdel.']'
|
---|
76 | );
|
---|
77 | $smarty->assign('page', $page);
|
---|
78 |
|
---|
79 | // Передаем массив данных шаблонизатору
|
---|
80 | $smarty->assign('data', $data);
|
---|
81 | // Статистика выполнения mysql запросов
|
---|
82 | $smarty->assign('mysql', $DB->getStatistics());
|
---|
83 |
|
---|
84 | $smarty->display('objects.tpl');
|
---|
85 |
|
---|
86 | ?>
|
---|