Code Duplication    Length = 9-11 lines in 2 locations

ad/manager.php 2 locations

@@ 175-183 (lines=9) @@
172
	* @param	array	$data	New ad data
173
	* @return	int		New advertisement ID
174
	*/
175
	public function insert_ad($data)
176
	{
177
		$data = $this->intersect_ad_data($data);
178
179
		$sql = 'INSERT INTO ' . $this->ads_table . ' ' . $this->db->sql_build_array('INSERT', $data);
180
		$this->db->sql_query($sql);
181
182
		return $this->db->sql_nextid();
183
	}
184
185
	/**
186
	* Update advertisement
@@ 192-202 (lines=11) @@
189
	* @param	array	$data	List of data to update in the database
190
	* @return	int		Number of affected rows. Can be used to determine if any ad has been updated.
191
	*/
192
	public function update_ad($ad_id, $data)
193
	{
194
		$data = $this->intersect_ad_data($data);
195
196
		$sql = 'UPDATE ' . $this->ads_table . '
197
			SET ' . $this->db->sql_build_array('UPDATE', $data) . '
198
			WHERE ad_id = ' . (int) $ad_id;
199
		$this->db->sql_query($sql);
200
201
		return $this->db->sql_affectedrows();
202
	}
203
204
	/**
205
	* Delete advertisement