@@ 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_PHPBB_ADS_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} |
@@ 49-59 (lines=11) @@ | ||
46 | * @param int $ad_id Advertisement ID |
|
47 | * @return array Array with advertisement data |
|
48 | */ |
|
49 | public function get_ad($ad_id) |
|
50 | { |
|
51 | $sql = 'SELECT * |
|
52 | FROM ' . $this->ads_table . ' |
|
53 | WHERE ad_id = ' . (int) $ad_id; |
|
54 | $result = $this->db->sql_query($sql); |
|
55 | $data = $this->db->sql_fetchrow($result); |
|
56 | $this->db->sql_freeresult($result); |
|
57 | ||
58 | return $data !== false ? $data : array(); |
|
59 | } |
|
60 | ||
61 | /** |
|
62 | * Get one ad per every location |
|
@@ 102-111 (lines=10) @@ | ||
99 | * |
|
100 | * @return array List of all ads |
|
101 | */ |
|
102 | public function get_all_ads() |
|
103 | { |
|
104 | $sql = 'SELECT ad_id, ad_priority, ad_name, ad_enabled, ad_end_date, ad_views, ad_clicks, ad_views_limit, ad_clicks_limit |
|
105 | FROM ' . $this->ads_table; |
|
106 | $result = $this->db->sql_query($sql); |
|
107 | $data = $this->db->sql_fetchrowset($result); |
|
108 | $this->db->sql_freeresult($result); |
|
109 | ||
110 | return $data; |
|
111 | } |
|
112 | ||
113 | /** |
|
114 | * Get all owner's ads |
|
@@ 119-129 (lines=11) @@ | ||
116 | * @param int $user_id Ad owner |
|
117 | * @return array List of owner's ads |
|
118 | */ |
|
119 | public function get_ads_by_owner($user_id) |
|
120 | { |
|
121 | $sql = 'SELECT ad_id, ad_name, ad_enabled, ad_end_date, ad_views, ad_views_limit, ad_clicks, ad_clicks_limit |
|
122 | FROM ' . $this->ads_table . ' |
|
123 | WHERE ad_owner = ' . (int) $user_id; |
|
124 | $result = $this->db->sql_query($sql); |
|
125 | $data = $this->db->sql_fetchrowset($result); |
|
126 | $this->db->sql_freeresult($result); |
|
127 | ||
128 | return $data; |
|
129 | } |
|
130 | ||
131 | /** |
|
132 | * Increment views for specified ads |
|
@@ 317-327 (lines=11) @@ | ||
314 | * |
|
315 | * @return array List of groups |
|
316 | */ |
|
317 | public function load_groups() |
|
318 | { |
|
319 | $sql = 'SELECT group_id, group_name, group_type |
|
320 | FROM ' . GROUPS_TABLE . " |
|
321 | WHERE group_name <> 'BOTS' |
|
322 | ORDER BY group_name ASC"; |
|
323 | $result = $this->db->sql_query($sql); |
|
324 | $groups = $this->db->sql_fetchrowset($result); |
|
325 | $this->db->sql_freeresult($result); |
|
326 | ||
327 | return $groups; |
|
328 | } |
|
329 | ||
330 | /** |