| @@ 243-258 (lines=16) @@ | ||
| 240 | * @param int $ad_id Advertisement ID |
|
| 241 | * @return array List of template locations for specified ad |
|
| 242 | */ |
|
| 243 | public function get_ad_locations($ad_id) |
|
| 244 | { |
|
| 245 | $ad_locations = array(); |
|
| 246 | ||
| 247 | $sql = 'SELECT location_id |
|
| 248 | FROM ' . $this->ad_locations_table . ' |
|
| 249 | WHERE ad_id = ' . (int) $ad_id; |
|
| 250 | $result = $this->db->sql_query($sql); |
|
| 251 | while ($row = $this->db->sql_fetchrow($result)) |
|
| 252 | { |
|
| 253 | $ad_locations[] = $row['location_id']; |
|
| 254 | } |
|
| 255 | $this->db->sql_freeresult($result); |
|
| 256 | ||
| 257 | return $ad_locations; |
|
| 258 | } |
|
| 259 | ||
| 260 | /** |
|
| 261 | * Insert advertisement locations |
|
| @@ 299-313 (lines=15) @@ | ||
| 296 | * @param int $user_id User ID to load memberships |
|
| 297 | * @return array List of group IDs user is member of |
|
| 298 | */ |
|
| 299 | public function load_memberships($user_id) |
|
| 300 | { |
|
| 301 | $memberships = array(); |
|
| 302 | $sql = 'SELECT group_id |
|
| 303 | FROM ' . USER_GROUP_TABLE . ' |
|
| 304 | WHERE user_id = ' . (int) $user_id . ' |
|
| 305 | AND user_pending = 0'; |
|
| 306 | $result = $this->db->sql_query($sql, 3600); |
|
| 307 | while ($row = $this->db->sql_fetchrow($result)) |
|
| 308 | { |
|
| 309 | $memberships[] = $row['group_id']; |
|
| 310 | } |
|
| 311 | $this->db->sql_freeresult($result); |
|
| 312 | return $memberships; |
|
| 313 | } |
|
| 314 | ||
| 315 | /** |
|
| 316 | * Load all board groups |
|