Code Duplication    Length = 9-11 lines in 2 locations

ad/manager.php 2 locations

@@ 144-152 (lines=9) @@
141
	* @param	array	$data	New ad data
142
	* @return	int		New advertisement ID
143
	*/
144
	public function insert_ad($data)
145
	{
146
		$data = $this->intersect_ad_data($data);
147
148
		$sql = 'INSERT INTO ' . $this->ads_table . ' ' . $this->db->sql_build_array('INSERT', $data);
149
		$this->db->sql_query($sql);
150
151
		return $this->db->sql_nextid();
152
	}
153
154
	/**
155
	* Update advertisement
@@ 161-171 (lines=11) @@
158
	* @param	array	$data	List of data to update in the database
159
	* @return	int		Number of affected rows. Can be used to determine if any ad has been updated.
160
	*/
161
	public function update_ad($ad_id, $data)
162
	{
163
		$data = $this->intersect_ad_data($data);
164
165
		$sql = 'UPDATE ' . $this->ads_table . '
166
			SET ' . $this->db->sql_build_array('UPDATE', $data) . '
167
			WHERE ad_id = ' . (int) $ad_id;
168
		$this->db->sql_query($sql);
169
170
		return $this->db->sql_affectedrows();
171
	}
172
173
	/**
174
	* Delete advertisement