@@ 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 mixed Array with advertisement data, false if ad doesn't exist |
|
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; |
|
59 | } |
|
60 | ||
61 | /** |
|
62 | * Get one ad per every location |
|
@@ 106-115 (lines=10) @@ | ||
103 | * |
|
104 | * @return array List of all ads |
|
105 | */ |
|
106 | public function get_all_ads() |
|
107 | { |
|
108 | $sql = 'SELECT ad_id, ad_priority, ad_name, ad_enabled, ad_end_date, ad_views, ad_clicks, ad_views_limit, ad_clicks_limit |
|
109 | FROM ' . $this->ads_table; |
|
110 | $result = $this->db->sql_query($sql); |
|
111 | $data = $this->db->sql_fetchrowset($result); |
|
112 | $this->db->sql_freeresult($result); |
|
113 | ||
114 | return $data; |
|
115 | } |
|
116 | ||
117 | /** |
|
118 | * Get all owner's ads |
|
@@ 123-133 (lines=11) @@ | ||
120 | * @param int $user_id Ad owner |
|
121 | * @return array List of owner's ads |
|
122 | */ |
|
123 | public function get_ads_by_owner($user_id) |
|
124 | { |
|
125 | $sql = 'SELECT ad_name, ad_views, ad_clicks |
|
126 | FROM ' . $this->ads_table . ' |
|
127 | WHERE ad_owner = ' . (int) $user_id; |
|
128 | $result = $this->db->sql_query($sql); |
|
129 | $data = $this->db->sql_fetchrowset($result); |
|
130 | $this->db->sql_freeresult($result); |
|
131 | ||
132 | return $data; |
|
133 | } |
|
134 | ||
135 | /** |
|
136 | * Increment views for specified ads |
|
@@ 238-247 (lines=10) @@ | ||
235 | $this->db->sql_query($sql); |
|
236 | } |
|
237 | ||
238 | public function get_all_locations() |
|
239 | { |
|
240 | $sql = 'SELECT * |
|
241 | FROM ' . $this->ad_locations_table; |
|
242 | $result = $this->db->sql_query($sql); |
|
243 | $data = $this->db->sql_fetchrowset($result); |
|
244 | $this->db->sql_freeresult($result); |
|
245 | ||
246 | return $data; |
|
247 | } |
|
248 | ||
249 | /** |
|
250 | * Get all locations for specified advertisement |
|
@@ 332-342 (lines=11) @@ | ||
329 | * |
|
330 | * @return array List of groups |
|
331 | */ |
|
332 | public function load_groups() |
|
333 | { |
|
334 | $sql = 'SELECT group_id, group_name, group_type |
|
335 | FROM ' . GROUPS_TABLE . " |
|
336 | WHERE group_name <> 'BOTS' |
|
337 | ORDER BY group_name ASC"; |
|
338 | $result = $this->db->sql_query($sql); |
|
339 | $groups = $this->db->sql_fetchrowset($result); |
|
340 | $this->db->sql_freeresult($result); |
|
341 | ||
342 | return $groups; |
|
343 | } |
|
344 | ||
345 | /** |