Code Duplication    Length = 15-16 lines in 2 locations

ad/manager.php 2 locations

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