@@ 44-54 (lines=11) @@ | ||
41 | * @param int $ad_id Advertisement ID |
|
42 | * @return mixed Array with advertisement data, false if ad doesn't exist |
|
43 | */ |
|
44 | public function get_ad($ad_id) |
|
45 | { |
|
46 | $sql = 'SELECT * |
|
47 | FROM ' . $this->ads_table . ' |
|
48 | WHERE ad_id = ' . (int) $ad_id; |
|
49 | $result = $this->db->sql_query($sql); |
|
50 | $data = $this->db->sql_fetchrow($result); |
|
51 | $this->db->sql_freeresult($result); |
|
52 | ||
53 | return $data; |
|
54 | } |
|
55 | ||
56 | /** |
|
57 | * Get one ad per every location |
|
@@ 89-98 (lines=10) @@ | ||
86 | * |
|
87 | * @return array List of all ads |
|
88 | */ |
|
89 | public function get_all_ads() |
|
90 | { |
|
91 | $sql = 'SELECT ad_id, ad_name, ad_enabled, ad_end_date |
|
92 | FROM ' . $this->ads_table; |
|
93 | $result = $this->db->sql_query($sql); |
|
94 | $data = $this->db->sql_fetchrowset($result); |
|
95 | $this->db->sql_freeresult($result); |
|
96 | ||
97 | return $data; |
|
98 | } |
|
99 | ||
100 | /** |
|
101 | * Insert new advertisement to the database |
|
@@ 233-243 (lines=11) @@ | ||
230 | * |
|
231 | * @return array List of groups |
|
232 | */ |
|
233 | public function load_groups() |
|
234 | { |
|
235 | $sql = 'SELECT group_id, group_name, group_type |
|
236 | FROM ' . GROUPS_TABLE . " |
|
237 | ORDER BY group_name ASC"; |
|
238 | $result = $this->db->sql_query($sql); |
|
239 | $groups = $this->db->sql_fetchrowset($result); |
|
240 | $this->db->sql_freeresult($result); |
|
241 | ||
242 | return $groups; |
|
243 | } |
|
244 | ||
245 | /** |
|
246 | * Make sure only necessary data make their way to SQL query |
@@ 18-29 (lines=12) @@ | ||
15 | /** |
|
16 | * {@inheritDoc} |
|
17 | */ |
|
18 | public function effectively_installed() |
|
19 | { |
|
20 | $sql = 'SELECT module_id |
|
21 | FROM ' . $this->table_prefix . "modules |
|
22 | WHERE module_class = 'acp' |
|
23 | AND module_langname = 'ACP_ADMANAGEMENT_TITLE'"; |
|
24 | $result = $this->db->sql_query($sql); |
|
25 | $module_id = (int) $this->db->sql_fetchfield('module_id'); |
|
26 | $this->db->sql_freeresult($result); |
|
27 | ||
28 | return $module_id; |
|
29 | } |
|
30 | ||
31 | /** |
|
32 | * {@inheritDoc} |