Code Duplication    Length = 15-16 lines in 2 locations

ad/manager.php 2 locations

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