Code Duplication    Length = 15-16 lines in 2 locations

ad/manager.php 2 locations

@@ 263-278 (lines=16) @@
260
	 * @param	int		$ad_id	Advertisement ID
261
	 * @return	array	List of template locations for specified ad
262
	 */
263
	public function get_ad_locations($ad_id)
264
	{
265
		$ad_locations = array();
266
267
		$sql = 'SELECT location_id
268
			FROM ' . $this->ad_locations_table . '
269
			WHERE ad_id = ' . (int) $ad_id;
270
		$result = $this->db->sql_query($sql);
271
		while ($row = $this->db->sql_fetchrow($result))
272
		{
273
			$ad_locations[] = $row['location_id'];
274
		}
275
		$this->db->sql_freeresult($result);
276
277
		return $ad_locations;
278
	}
279
280
	/**
281
	 * Insert advertisement locations
@@ 319-333 (lines=15) @@
316
	 * @param	int		$user_id	User ID to load memberships
317
	 * @return	array	List of group IDs user is member of
318
	 */
319
	public function load_memberships($user_id)
320
	{
321
		$memberships = array();
322
		$sql = 'SELECT group_id
323
			FROM ' . USER_GROUP_TABLE . '
324
			WHERE user_id = ' . (int) $user_id . '
325
			AND user_pending = 0';
326
		$result = $this->db->sql_query($sql, 3600);
327
		while ($row = $this->db->sql_fetchrow($result))
328
		{
329
			$memberships[] = $row['group_id'];
330
		}
331
		$this->db->sql_freeresult($result);
332
		return $memberships;
333
	}
334
335
	/**
336
	 * Load all board groups