Code Duplication    Length = 10-12 lines in 4 locations

ad/manager.php 3 locations

@@ 105-114 (lines=10) @@
102
	 *
103
	 * @return    array    List of all ads
104
	 */
105
	public function get_all_ads()
106
	{
107
		$sql = 'SELECT ad_id, ad_priority, ad_name, ad_enabled, ad_end_date, ad_views, ad_clicks, ad_views_limit, ad_clicks_limit
108
			FROM ' . $this->ads_table;
109
		$result = $this->db->sql_query($sql);
110
		$data = $this->db->sql_fetchrowset($result);
111
		$this->db->sql_freeresult($result);
112
113
		return $data;
114
	}
115
116
	/**
117
	 * Get all owner's ads
@@ 122-132 (lines=11) @@
119
	 * @param    int $user_id Ad owner
120
	 * @return    array    List of owner's ads
121
	 */
122
	public function get_ads_by_owner($user_id)
123
	{
124
		$sql = 'SELECT ad_id, ad_name, ad_enabled, ad_end_date, ad_views, ad_views_limit, ad_clicks, ad_clicks_limit
125
			FROM ' . $this->ads_table . '
126
			WHERE ad_owner = ' . (int) $user_id;
127
		$result = $this->db->sql_query($sql);
128
		$data = $this->db->sql_fetchrowset($result);
129
		$this->db->sql_freeresult($result);
130
131
		return $data;
132
	}
133
134
	/**
135
	 * Increment views for specified ads
@@ 320-331 (lines=12) @@
317
	 *
318
	 * @return	array	List of groups
319
	 */
320
	public function load_groups()
321
	{
322
		$sql = 'SELECT group_id, group_name, group_type
323
			FROM ' . GROUPS_TABLE . "
324
			WHERE group_name <> 'BOTS'
325
			ORDER BY group_name ASC";
326
		$result = $this->db->sql_query($sql);
327
		$groups = $this->db->sql_fetchrowset($result);
328
		$this->db->sql_freeresult($result);
329
330
		return $groups;
331
	}
332
333
	/**
334
	 * Make sure only necessary data make their way to SQL query

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}