| @@ 270-285 (lines=16) @@ | ||
| 267 | * @param int $ad_id Advertisement ID |
|
| 268 | * @return array List of template locations for specified ad |
|
| 269 | */ |
|
| 270 | public function get_ad_locations($ad_id) |
|
| 271 | { |
|
| 272 | $ad_locations = array(); |
|
| 273 | ||
| 274 | $sql = 'SELECT location_id |
|
| 275 | FROM ' . $this->ad_locations_table . ' |
|
| 276 | WHERE ad_id = ' . (int) $ad_id; |
|
| 277 | $result = $this->db->sql_query($sql); |
|
| 278 | while ($row = $this->db->sql_fetchrow($result)) |
|
| 279 | { |
|
| 280 | $ad_locations[] = $row['location_id']; |
|
| 281 | } |
|
| 282 | $this->db->sql_freeresult($result); |
|
| 283 | ||
| 284 | return $ad_locations; |
|
| 285 | } |
|
| 286 | ||
| 287 | /** |
|
| 288 | * Insert advertisement locations |
|
| @@ 326-340 (lines=15) @@ | ||
| 323 | * @param int $user_id User ID to load memberships |
|
| 324 | * @return array List of group IDs user is member of |
|
| 325 | */ |
|
| 326 | public function load_memberships($user_id) |
|
| 327 | { |
|
| 328 | $memberships = array(); |
|
| 329 | $sql = 'SELECT group_id |
|
| 330 | FROM ' . USER_GROUP_TABLE . ' |
|
| 331 | WHERE user_id = ' . (int) $user_id . ' |
|
| 332 | AND user_pending = 0'; |
|
| 333 | $result = $this->db->sql_query($sql, 3600); |
|
| 334 | while ($row = $this->db->sql_fetchrow($result)) |
|
| 335 | { |
|
| 336 | $memberships[] = $row['group_id']; |
|
| 337 | } |
|
| 338 | $this->db->sql_freeresult($result); |
|
| 339 | return $memberships; |
|
| 340 | } |
|
| 341 | ||
| 342 | /** |
|
| 343 | * Load all board groups |
|