Code Duplication    Length = 10-12 lines in 4 locations

migrations/v10x/m2_acp_module.php 1 location

@@ 18-29 (lines=12) @@
15
	/**
16
	* {@inheritDoc}
17
	*/
18
	public function effectively_installed()
19
	{
20
		$sql = 'SELECT module_id
21
			FROM ' . $this->table_prefix . "modules
22
			WHERE module_class = 'acp'
23
				AND module_langname = 'ACP_PHPBB_ADS_TITLE'";
24
		$result = $this->db->sql_query($sql);
25
		$module_id = (int) $this->db->sql_fetchfield('module_id');
26
		$this->db->sql_freeresult($result);
27
28
		return $module_id;
29
	}
30
31
	/**
32
	* {@inheritDoc}

ad/manager.php 3 locations

@@ 49-59 (lines=11) @@
46
	* @param	int		$ad_id	Advertisement ID
47
	* @return	mixed	Array with advertisement data, false if ad doesn't exist
48
	*/
49
	public function get_ad($ad_id)
50
	{
51
		$sql = 'SELECT *
52
			FROM ' . $this->ads_table . '
53
			WHERE ad_id = ' . (int) $ad_id;
54
		$result = $this->db->sql_query($sql);
55
		$data = $this->db->sql_fetchrow($result);
56
		$this->db->sql_freeresult($result);
57
58
		return $data;
59
	}
60
61
	/**
62
	* Get one ad per every location
@@ 106-115 (lines=10) @@
103
	*
104
	* @return	array	List of all ads
105
	*/
106
	public function get_all_ads()
107
	{
108
		$sql = 'SELECT ad_id, ad_name, ad_enabled, ad_end_date, ad_views, ad_clicks, ad_views_limit, ad_clicks_limit
109
			FROM ' . $this->ads_table;
110
		$result = $this->db->sql_query($sql);
111
		$data = $this->db->sql_fetchrowset($result);
112
		$this->db->sql_freeresult($result);
113
114
		return $data;
115
	}
116
117
	/**
118
	* Increment views for specified ads
@@ 284-294 (lines=11) @@
281
	*
282
	* @return	array	List of groups
283
	*/
284
	public function load_groups()
285
	{
286
		$sql = 'SELECT group_id, group_name, group_type
287
			FROM ' . GROUPS_TABLE . '
288
			ORDER BY group_name ASC';
289
		$result = $this->db->sql_query($sql);
290
		$groups = $this->db->sql_fetchrowset($result);
291
		$this->db->sql_freeresult($result);
292
293
		return $groups;
294
	}
295
296
	/**
297
	* Make sure only necessary data make their way to SQL query