| @@ 283-298 (lines=16) @@ | ||
| 280 | * @param int $ad_id Advertisement ID |
|
| 281 | * @return array List of template locations for specified ad |
|
| 282 | */ |
|
| 283 | public function get_ad_locations($ad_id) |
|
| 284 | { |
|
| 285 | $ad_locations = array(); |
|
| 286 | ||
| 287 | $sql = 'SELECT location_id |
|
| 288 | FROM ' . $this->ad_locations_table . ' |
|
| 289 | WHERE ad_id = ' . (int) $ad_id; |
|
| 290 | $result = $this->db->sql_query($sql); |
|
| 291 | while ($row = $this->db->sql_fetchrow($result)) |
|
| 292 | { |
|
| 293 | $ad_locations[] = $row['location_id']; |
|
| 294 | } |
|
| 295 | $this->db->sql_freeresult($result); |
|
| 296 | ||
| 297 | return $ad_locations; |
|
| 298 | } |
|
| 299 | ||
| 300 | /** |
|
| 301 | * Insert advertisement locations |
|
| @@ 339-353 (lines=15) @@ | ||
| 336 | * @param int $user_id User ID to load memberships |
|
| 337 | * @return array List of group IDs user is member of |
|
| 338 | */ |
|
| 339 | public function load_memberships($user_id) |
|
| 340 | { |
|
| 341 | $memberships = array(); |
|
| 342 | $sql = 'SELECT group_id |
|
| 343 | FROM ' . USER_GROUP_TABLE . ' |
|
| 344 | WHERE user_id = ' . (int) $user_id . ' |
|
| 345 | AND user_pending = 0'; |
|
| 346 | $result = $this->db->sql_query($sql, 3600); |
|
| 347 | while ($row = $this->db->sql_fetchrow($result)) |
|
| 348 | { |
|
| 349 | $memberships[] = $row['group_id']; |
|
| 350 | } |
|
| 351 | $this->db->sql_freeresult($result); |
|
| 352 | return $memberships; |
|
| 353 | } |
|
| 354 | ||
| 355 | /** |
|
| 356 | * Load all board groups |
|