Code Duplication    Length = 9-11 lines in 2 locations

ad/manager.php 2 locations

@@ 104-112 (lines=9) @@
101
	* @param	array	$data	New ad data
102
	* @return	int		New advertisement ID
103
	*/
104
	public function insert_ad($data)
105
	{
106
		$data = $this->intersect_ad_data($data);
107
108
		$sql = 'INSERT INTO ' . $this->ads_table . ' ' . $this->db->sql_build_array('INSERT', $data);
109
		$this->db->sql_query($sql);
110
111
		return $this->db->sql_nextid();
112
	}
113
114
	/**
115
	* Update advertisement
@@ 121-131 (lines=11) @@
118
	* @param	array	$data	List of data to update in the database
119
	* @return	int		Number of affected rows. Can be used to determine if any ad has been updated.
120
	*/
121
	public function update_ad($ad_id, $data)
122
	{
123
		$data = $this->intersect_ad_data($data);
124
125
		$sql = 'UPDATE ' . $this->ads_table . '
126
			SET ' . $this->db->sql_build_array('UPDATE', $data) . '
127
			WHERE ad_id = ' . (int) $ad_id;
128
		$this->db->sql_query($sql);
129
130
		return $this->db->sql_affectedrows();
131
	}
132
133
	/**
134
	* Delete advertisement