Code Duplication    Length = 9-11 lines in 2 locations

ad/manager.php 2 locations

@@ 162-170 (lines=9) @@
159
	* @param	array	$data	New ad data
160
	* @return	int		New advertisement ID
161
	*/
162
	public function insert_ad($data)
163
	{
164
		$data = $this->intersect_ad_data($data);
165
166
		$sql = 'INSERT INTO ' . $this->ads_table . ' ' . $this->db->sql_build_array('INSERT', $data);
167
		$this->db->sql_query($sql);
168
169
		return $this->db->sql_nextid();
170
	}
171
172
	/**
173
	* Update advertisement
@@ 179-189 (lines=11) @@
176
	* @param	array	$data	List of data to update in the database
177
	* @return	int		Number of affected rows. Can be used to determine if any ad has been updated.
178
	*/
179
	public function update_ad($ad_id, $data)
180
	{
181
		$data = $this->intersect_ad_data($data);
182
183
		$sql = 'UPDATE ' . $this->ads_table . '
184
			SET ' . $this->db->sql_build_array('UPDATE', $data) . '
185
			WHERE ad_id = ' . (int) $ad_id;
186
		$this->db->sql_query($sql);
187
188
		return $this->db->sql_affectedrows();
189
	}
190
191
	/**
192
	* Delete advertisement