| @@ 212-227 (lines=16) @@ | ||
| 209 | * @param int $ad_id Advertisement ID |
|
| 210 | * @return array List of template locations for specified ad |
|
| 211 | */ |
|
| 212 | public function get_ad_locations($ad_id) |
|
| 213 | { |
|
| 214 | $ad_locations = array(); |
|
| 215 | ||
| 216 | $sql = 'SELECT location_id |
|
| 217 | FROM ' . $this->ad_locations_table . ' |
|
| 218 | WHERE ad_id = ' . (int) $ad_id; |
|
| 219 | $result = $this->db->sql_query($sql); |
|
| 220 | while ($row = $this->db->sql_fetchrow($result)) |
|
| 221 | { |
|
| 222 | $ad_locations[] = $row['location_id']; |
|
| 223 | } |
|
| 224 | $this->db->sql_freeresult($result); |
|
| 225 | ||
| 226 | return $ad_locations; |
|
| 227 | } |
|
| 228 | ||
| 229 | /** |
|
| 230 | * Insert advertisement locations |
|
| @@ 268-282 (lines=15) @@ | ||
| 265 | * @param int $user_id User ID to load memberships |
|
| 266 | * @return array List of group IDs user is member of |
|
| 267 | */ |
|
| 268 | public function load_memberships($user_id) |
|
| 269 | { |
|
| 270 | $memberships = array(); |
|
| 271 | $sql = 'SELECT group_id |
|
| 272 | FROM ' . USER_GROUP_TABLE . ' |
|
| 273 | WHERE user_id = ' . (int) $user_id . ' |
|
| 274 | AND user_pending = 0'; |
|
| 275 | $result = $this->db->sql_query($sql, 3600); |
|
| 276 | while ($row = $this->db->sql_fetchrow($result)) |
|
| 277 | { |
|
| 278 | $memberships[] = $row['group_id']; |
|
| 279 | } |
|
| 280 | $this->db->sql_freeresult($result); |
|
| 281 | return $memberships; |
|
| 282 | } |
|
| 283 | ||
| 284 | /** |
|
| 285 | * Load all board groups |
|