| @@ 194-209 (lines=16) @@ | ||
| 191 | * @param int $ad_id Advertisement ID |
|
| 192 | * @return array List of template locations for specified ad |
|
| 193 | */ |
|
| 194 | public function get_ad_locations($ad_id) |
|
| 195 | { |
|
| 196 | $ad_locations = array(); |
|
| 197 | ||
| 198 | $sql = 'SELECT location_id |
|
| 199 | FROM ' . $this->ad_locations_table . ' |
|
| 200 | WHERE ad_id = ' . (int) $ad_id; |
|
| 201 | $result = $this->db->sql_query($sql); |
|
| 202 | while ($row = $this->db->sql_fetchrow($result)) |
|
| 203 | { |
|
| 204 | $ad_locations[] = $row['location_id']; |
|
| 205 | } |
|
| 206 | $this->db->sql_freeresult($result); |
|
| 207 | ||
| 208 | return $ad_locations; |
|
| 209 | } |
|
| 210 | ||
| 211 | /** |
|
| 212 | * Insert advertisement locations |
|
| @@ 250-264 (lines=15) @@ | ||
| 247 | * @param int $user_id User ID to load memberships |
|
| 248 | * @return array List of group IDs user is member of |
|
| 249 | */ |
|
| 250 | public function load_memberships($user_id) |
|
| 251 | { |
|
| 252 | $memberships = array(); |
|
| 253 | $sql = 'SELECT group_id |
|
| 254 | FROM ' . USER_GROUP_TABLE . ' |
|
| 255 | WHERE user_id = ' . (int) $user_id . ' |
|
| 256 | AND user_pending = 0'; |
|
| 257 | $result = $this->db->sql_query($sql, 3600); |
|
| 258 | while ($row = $this->db->sql_fetchrow($result)) |
|
| 259 | { |
|
| 260 | $memberships[] = $row['group_id']; |
|
| 261 | } |
|
| 262 | $this->db->sql_freeresult($result); |
|
| 263 | return $memberships; |
|
| 264 | } |
|
| 265 | ||
| 266 | /** |
|
| 267 | * Load all board groups |
|