Code Duplication    Length = 15-16 lines in 2 locations

ad/manager.php 2 locations

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