| @@ 156-171 (lines=16) @@ | ||
| 153 | * @param int $ad_id Advertisement ID |
|
| 154 | * @return array List of template locations for specified ad |
|
| 155 | */ |
|
| 156 | public function get_ad_locations($ad_id) |
|
| 157 | { |
|
| 158 | $ad_locations = array(); |
|
| 159 | ||
| 160 | $sql = 'SELECT location_id |
|
| 161 | FROM ' . $this->ad_locations_table . ' |
|
| 162 | WHERE ad_id = ' . (int) $ad_id; |
|
| 163 | $result = $this->db->sql_query($sql); |
|
| 164 | while ($row = $this->db->sql_fetchrow($result)) |
|
| 165 | { |
|
| 166 | $ad_locations[] = $row['location_id']; |
|
| 167 | } |
|
| 168 | $this->db->sql_freeresult($result); |
|
| 169 | ||
| 170 | return $ad_locations; |
|
| 171 | } |
|
| 172 | ||
| 173 | /** |
|
| 174 | * Insert advertisement locations |
|
| @@ 212-226 (lines=15) @@ | ||
| 209 | * @param int $user_id User ID to load memberships |
|
| 210 | * @return array List of group IDs user is member of |
|
| 211 | */ |
|
| 212 | public function load_memberships($user_id) |
|
| 213 | { |
|
| 214 | $memberships = array(); |
|
| 215 | $sql = 'SELECT group_id |
|
| 216 | FROM ' . USER_GROUP_TABLE . ' |
|
| 217 | WHERE user_id = ' . (int) $user_id . ' |
|
| 218 | AND user_pending = 0'; |
|
| 219 | $result = $this->db->sql_query($sql, 3600); |
|
| 220 | while ($row = $this->db->sql_fetchrow($result)) |
|
| 221 | { |
|
| 222 | $memberships[] = $row['group_id']; |
|
| 223 | } |
|
| 224 | $this->db->sql_freeresult($result); |
|
| 225 | return $memberships; |
|
| 226 | } |
|
| 227 | ||
| 228 | /** |
|
| 229 | * Load all board groups |
|