Code Duplication    Length = 15-16 lines in 2 locations

ad/manager.php 2 locations

@@ 255-270 (lines=16) @@
252
	 * @param	int		$ad_id	Advertisement ID
253
	 * @return	array	List of template locations for specified ad
254
	 */
255
	public function get_ad_locations($ad_id)
256
	{
257
		$ad_locations = array();
258
259
		$sql = 'SELECT location_id
260
			FROM ' . $this->ad_locations_table . '
261
			WHERE ad_id = ' . (int) $ad_id;
262
		$result = $this->db->sql_query($sql);
263
		while ($row = $this->db->sql_fetchrow($result))
264
		{
265
			$ad_locations[] = $row['location_id'];
266
		}
267
		$this->db->sql_freeresult($result);
268
269
		return $ad_locations;
270
	}
271
272
	/**
273
	 * Insert advertisement locations
@@ 311-325 (lines=15) @@
308
	 * @param	int		$user_id	User ID to load memberships
309
	 * @return	array	List of group IDs user is member of
310
	 */
311
	public function load_memberships($user_id)
312
	{
313
		$memberships = array();
314
		$sql = 'SELECT group_id
315
			FROM ' . USER_GROUP_TABLE . '
316
			WHERE user_id = ' . (int) $user_id . '
317
			AND user_pending = 0';
318
		$result = $this->db->sql_query($sql, 3600);
319
		while ($row = $this->db->sql_fetchrow($result))
320
		{
321
			$memberships[] = $row['group_id'];
322
		}
323
		$this->db->sql_freeresult($result);
324
		return $memberships;
325
	}
326
327
	/**
328
	 * Load all board groups