| @@ 225-240 (lines=16) @@ | ||
| 222 | * @param int $ad_id Advertisement ID |
|
| 223 | * @return array List of template locations for specified ad |
|
| 224 | */ |
|
| 225 | public function get_ad_locations($ad_id) |
|
| 226 | { |
|
| 227 | $ad_locations = array(); |
|
| 228 | ||
| 229 | $sql = 'SELECT location_id |
|
| 230 | FROM ' . $this->ad_locations_table . ' |
|
| 231 | WHERE ad_id = ' . (int) $ad_id; |
|
| 232 | $result = $this->db->sql_query($sql); |
|
| 233 | while ($row = $this->db->sql_fetchrow($result)) |
|
| 234 | { |
|
| 235 | $ad_locations[] = $row['location_id']; |
|
| 236 | } |
|
| 237 | $this->db->sql_freeresult($result); |
|
| 238 | ||
| 239 | return $ad_locations; |
|
| 240 | } |
|
| 241 | ||
| 242 | /** |
|
| 243 | * Insert advertisement locations |
|
| @@ 281-295 (lines=15) @@ | ||
| 278 | * @param int $user_id User ID to load memberships |
|
| 279 | * @return array List of group IDs user is member of |
|
| 280 | */ |
|
| 281 | public function load_memberships($user_id) |
|
| 282 | { |
|
| 283 | $memberships = array(); |
|
| 284 | $sql = 'SELECT group_id |
|
| 285 | FROM ' . USER_GROUP_TABLE . ' |
|
| 286 | WHERE user_id = ' . (int) $user_id . ' |
|
| 287 | AND user_pending = 0'; |
|
| 288 | $result = $this->db->sql_query($sql, 3600); |
|
| 289 | while ($row = $this->db->sql_fetchrow($result)) |
|
| 290 | { |
|
| 291 | $memberships[] = $row['group_id']; |
|
| 292 | } |
|
| 293 | $this->db->sql_freeresult($result); |
|
| 294 | return $memberships; |
|
| 295 | } |
|
| 296 | ||
| 297 | /** |
|
| 298 | * Load all board groups |
|