Code Duplication    Length = 10-12 lines in 3 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 2 locations

@@ 115-124 (lines=10) @@
112
	 *
113
	 * @return    array    List of all ads
114
	 */
115
	public function get_all_ads()
116
	{
117
		$sql = 'SELECT ad_id, ad_priority, ad_name, ad_enabled, ad_start_date, ad_end_date, ad_views, ad_clicks, ad_views_limit, ad_clicks_limit
118
			FROM ' . $this->ads_table;
119
		$result = $this->db->sql_query($sql);
120
		$data = $this->db->sql_fetchrowset($result);
121
		$this->db->sql_freeresult($result);
122
123
		return $data;
124
	}
125
126
	/**
127
	 * Get all owner's ads
@@ 132-142 (lines=11) @@
129
	 * @param    int $user_id Ad owner
130
	 * @return    array    List of owner's ads
131
	 */
132
	public function get_ads_by_owner($user_id)
133
	{
134
		$sql = 'SELECT ad_id, ad_name, ad_enabled, ad_start_date, ad_end_date, ad_views, ad_views_limit, ad_clicks, ad_clicks_limit
135
			FROM ' . $this->ads_table . '
136
			WHERE ad_owner = ' . (int) $user_id;
137
		$result = $this->db->sql_query($sql);
138
		$data = $this->db->sql_fetchrowset($result);
139
		$this->db->sql_freeresult($result);
140
141
		return $data;
142
	}
143
144
	/**
145
	 * Increment views for specified ads