Code Duplication    Length = 15-16 lines in 2 locations

ad/manager.php 2 locations

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