@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | - * Get specific ad |
|
| 45 | - * |
|
| 46 | - * @param int $ad_id Advertisement ID |
|
| 47 | - * @return mixed Array with advertisement data, false if ad doesn't exist |
|
| 48 | - */ |
|
| 44 | + * Get specific ad |
|
| 45 | + * |
|
| 46 | + * @param int $ad_id Advertisement ID |
|
| 47 | + * @return mixed Array with advertisement data, false if ad doesn't exist |
|
| 48 | + */ |
|
| 49 | 49 | public function get_ad($ad_id) |
| 50 | 50 | { |
| 51 | 51 | $sql = 'SELECT * |
@@ -59,11 +59,11 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | - * Get one ad per every location |
|
| 63 | - * |
|
| 64 | - * @param array $ad_locations List of ad locations to fetch ads for |
|
| 65 | - * @return array List of ad codes for each location |
|
| 66 | - */ |
|
| 62 | + * Get one ad per every location |
|
| 63 | + * |
|
| 64 | + * @param array $ad_locations List of ad locations to fetch ads for |
|
| 65 | + * @return array List of ad codes for each location |
|
| 66 | + */ |
|
| 67 | 67 | public function get_ads($ad_locations) |
| 68 | 68 | { |
| 69 | 69 | $sql_where_views = $this->config['phpbb_ads_enable_views'] ? 'AND (a.ad_views_limit = 0 OR a.ad_views_limit > a.ad_views)' : ''; |
@@ -120,14 +120,14 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | - * Increment views for specified ads |
|
| 124 | - * |
|
| 125 | - * Note, that views are incremented only by one even when |
|
| 126 | - * an ad is displayed multiple times on the same page. |
|
| 127 | - * |
|
| 128 | - * @param array $ad_ids IDs of ads to increment views |
|
| 129 | - * @return void |
|
| 130 | - */ |
|
| 123 | + * Increment views for specified ads |
|
| 124 | + * |
|
| 125 | + * Note, that views are incremented only by one even when |
|
| 126 | + * an ad is displayed multiple times on the same page. |
|
| 127 | + * |
|
| 128 | + * @param array $ad_ids IDs of ads to increment views |
|
| 129 | + * @return void |
|
| 130 | + */ |
|
| 131 | 131 | public function increment_ads_views($ad_ids) |
| 132 | 132 | { |
| 133 | 133 | if (!empty($ad_ids)) |
@@ -140,11 +140,11 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
| 143 | - * Increment clicks for specified ad |
|
| 144 | - * |
|
| 145 | - * @param int $ad_id ID of an ad to increment clicks |
|
| 146 | - * @return void |
|
| 147 | - */ |
|
| 143 | + * Increment clicks for specified ad |
|
| 144 | + * |
|
| 145 | + * @param int $ad_id ID of an ad to increment clicks |
|
| 146 | + * @return void |
|
| 147 | + */ |
|
| 148 | 148 | public function increment_ad_clicks($ad_id) |
| 149 | 149 | { |
| 150 | 150 | $sql = 'UPDATE ' . $this->ads_table . ' |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
| 157 | - * Insert new advertisement to the database |
|
| 158 | - * |
|
| 159 | - * @param array $data New ad data |
|
| 160 | - * @return int New advertisement ID |
|
| 161 | - */ |
|
| 157 | + * Insert new advertisement to the database |
|
| 158 | + * |
|
| 159 | + * @param array $data New ad data |
|
| 160 | + * @return int New advertisement ID |
|
| 161 | + */ |
|
| 162 | 162 | public function insert_ad($data) |
| 163 | 163 | { |
| 164 | 164 | $data = $this->intersect_ad_data($data); |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
| 173 | - * Update advertisement |
|
| 174 | - * |
|
| 175 | - * @param int $ad_id Advertisement ID |
|
| 176 | - * @param array $data List of data to update in the database |
|
| 177 | - * @return int Number of affected rows. Can be used to determine if any ad has been updated. |
|
| 178 | - */ |
|
| 173 | + * Update advertisement |
|
| 174 | + * |
|
| 175 | + * @param int $ad_id Advertisement ID |
|
| 176 | + * @param array $data List of data to update in the database |
|
| 177 | + * @return int Number of affected rows. Can be used to determine if any ad has been updated. |
|
| 178 | + */ |
|
| 179 | 179 | public function update_ad($ad_id, $data) |
| 180 | 180 | { |
| 181 | 181 | $data = $this->intersect_ad_data($data); |
@@ -189,11 +189,11 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | - * Delete advertisement |
|
| 193 | - * |
|
| 194 | - * @param int $ad_id Advertisement ID |
|
| 195 | - * @return int Number of affected rows. Can be used to determine if any ad has been deleted. |
|
| 196 | - */ |
|
| 192 | + * Delete advertisement |
|
| 193 | + * |
|
| 194 | + * @param int $ad_id Advertisement ID |
|
| 195 | + * @return int Number of affected rows. Can be used to determine if any ad has been deleted. |
|
| 196 | + */ |
|
| 197 | 197 | public function delete_ad($ad_id) |
| 198 | 198 | { |
| 199 | 199 | $sql = 'DELETE FROM ' . $this->ads_table . ' |
@@ -204,11 +204,11 @@ discard block |
||
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
| 207 | - * Get all locations for specified advertisement |
|
| 208 | - * |
|
| 209 | - * @param int $ad_id Advertisement ID |
|
| 210 | - * @return array List of template locations for specified ad |
|
| 211 | - */ |
|
| 207 | + * Get all locations for specified advertisement |
|
| 208 | + * |
|
| 209 | + * @param int $ad_id Advertisement ID |
|
| 210 | + * @return array List of template locations for specified ad |
|
| 211 | + */ |
|
| 212 | 212 | public function get_ad_locations($ad_id) |
| 213 | 213 | { |
| 214 | 214 | $ad_locations = array(); |
@@ -227,12 +227,12 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
| 230 | - * Insert advertisement locations |
|
| 231 | - * |
|
| 232 | - * @param int $ad_id Advertisement ID |
|
| 233 | - * @param array $ad_locations List of template locations for this ad |
|
| 234 | - * @return void |
|
| 235 | - */ |
|
| 230 | + * Insert advertisement locations |
|
| 231 | + * |
|
| 232 | + * @param int $ad_id Advertisement ID |
|
| 233 | + * @param array $ad_locations List of template locations for this ad |
|
| 234 | + * @return void |
|
| 235 | + */ |
|
| 236 | 236 | public function insert_ad_locations($ad_id, $ad_locations) |
| 237 | 237 | { |
| 238 | 238 | $sql_ary = array(); |
@@ -247,11 +247,11 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
| 250 | - * Delete advertisement locations |
|
| 251 | - * |
|
| 252 | - * @param int $ad_id Advertisement ID |
|
| 253 | - * @return void |
|
| 254 | - */ |
|
| 250 | + * Delete advertisement locations |
|
| 251 | + * |
|
| 252 | + * @param int $ad_id Advertisement ID |
|
| 253 | + * @return void |
|
| 254 | + */ |
|
| 255 | 255 | public function delete_ad_locations($ad_id) |
| 256 | 256 | { |
| 257 | 257 | $sql = 'DELETE FROM ' . $this->ad_locations_table . ' |
@@ -260,11 +260,11 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
| 263 | - * Load memberships of the user |
|
| 264 | - * |
|
| 265 | - * @param int $user_id User ID to load memberships |
|
| 266 | - * @return array List of group IDs user is member of |
|
| 267 | - */ |
|
| 263 | + * Load memberships of the user |
|
| 264 | + * |
|
| 265 | + * @param int $user_id User ID to load memberships |
|
| 266 | + * @return array List of group IDs user is member of |
|
| 267 | + */ |
|
| 268 | 268 | public function load_memberships($user_id) |
| 269 | 269 | { |
| 270 | 270 | $memberships = array(); |
@@ -282,10 +282,10 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /** |
| 285 | - * Load all board groups |
|
| 286 | - * |
|
| 287 | - * @return array List of groups |
|
| 288 | - */ |
|
| 285 | + * Load all board groups |
|
| 286 | + * |
|
| 287 | + * @return array List of groups |
|
| 288 | + */ |
|
| 289 | 289 | public function load_groups() |
| 290 | 290 | { |
| 291 | 291 | $sql = 'SELECT group_id, group_name, group_type |
@@ -335,11 +335,11 @@ discard block |
||
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | /** |
| 338 | - * Make sure only necessary data make their way to SQL query |
|
| 339 | - * |
|
| 340 | - * @param array $data List of data to query the database |
|
| 341 | - * @return array Cleaned data that contain only valid keys |
|
| 342 | - */ |
|
| 338 | + * Make sure only necessary data make their way to SQL query |
|
| 339 | + * |
|
| 340 | + * @param array $data List of data to query the database |
|
| 341 | + * @return array Cleaned data that contain only valid keys |
|
| 342 | + */ |
|
| 343 | 343 | protected function intersect_ad_data($data) |
| 344 | 344 | { |
| 345 | 345 | return array_intersect_key($data, array( |
@@ -356,11 +356,11 @@ discard block |
||
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /** |
| 359 | - * Get the random statement for this database layer |
|
| 360 | - * Random function should generate a float value between 0 and 1 |
|
| 361 | - * |
|
| 362 | - * @return string Random statement for current database layer |
|
| 363 | - */ |
|
| 359 | + * Get the random statement for this database layer |
|
| 360 | + * Random function should generate a float value between 0 and 1 |
|
| 361 | + * |
|
| 362 | + * @return string Random statement for current database layer |
|
| 363 | + */ |
|
| 364 | 364 | protected function sql_random() |
| 365 | 365 | { |
| 366 | 366 | switch ($this->db->get_sql_layer()) |