| @@ 192-204 (lines=13) @@ | ||
| 189 | 		{ | 
                                |
| 190 | 			$data = $this->get_form_data('phpbb/ads/add'); | 
                                |
| 191 | ||
| 192 | if ($preview)  | 
                                |
| 193 | 			{ | 
                                |
| 194 | $this->ad_preview($data['ad_code']);  | 
                                |
| 195 | }  | 
                                |
| 196 | else if (empty($this->errors))  | 
                                |
| 197 | 			{ | 
                                |
| 198 | $ad_id = $this->manager->insert_ad($data);  | 
                                |
| 199 | $this->manager->insert_ad_locations($ad_id, $data['ad_locations']);  | 
                                |
| 200 | ||
| 201 | 				$this->log('ADD', $data['ad_name']); | 
                                |
| 202 | ||
| 203 | 				$this->success('ACP_AD_ADD_SUCCESS'); | 
                                |
| 204 | }  | 
                                |
| 205 | ||
| 206 | $this->assign_locations($data);  | 
                                |
| 207 | $this->assign_form_data($data);  | 
                                |
| @@ 243-258 (lines=16) @@ | ||
| 240 | 			{ | 
                                |
| 241 | $this->ad_preview($data['ad_code']);  | 
                                |
| 242 | }  | 
                                |
| 243 | else if (empty($this->errors))  | 
                                |
| 244 | 			{ | 
                                |
| 245 | $success = $this->manager->update_ad($ad_id, $data);  | 
                                |
| 246 | ||
| 247 | if ($success)  | 
                                |
| 248 | 				{ | 
                                |
| 249 | // Only insert new ad locations to DB when ad exists  | 
                                |
| 250 | $this->manager->delete_ad_locations($ad_id);  | 
                                |
| 251 | $this->manager->insert_ad_locations($ad_id, $data['ad_locations']);  | 
                                |
| 252 | ||
| 253 | 					$this->log('EDIT', $data['ad_name']); | 
                                |
| 254 | ||
| 255 | 					$this->success('ACP_AD_EDIT_SUCCESS'); | 
                                |
| 256 | }  | 
                                |
| 257 | 				$this->error('ACP_AD_DOES_NOT_EXIST'); | 
                                |
| 258 | }  | 
                                |
| 259 | }  | 
                                |
| 260 | else  | 
                                |
| 261 | 		{ | 
                                |