Code Duplication    Length = 9-11 lines in 2 locations

ad/manager.php 2 locations

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