Code Duplication    Length = 9-11 lines in 2 locations

ad/manager.php 2 locations

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