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