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