| @@ 194-214 (lines=21) @@ | ||
| 191 | { |
|
| 192 | $data = $this->input->get_form_data('phpbb/ads/add'); |
|
| 193 | ||
| 194 | if ($preview) |
|
| 195 | { |
|
| 196 | $this->ad_preview($data['ad_code']); |
|
| 197 | } |
|
| 198 | else if ($upload_banner) |
|
| 199 | { |
|
| 200 | $data['ad_code'] = $this->input->banner_upload($data['ad_code']); |
|
| 201 | } |
|
| 202 | else if ($analyse_ad_code) |
|
| 203 | { |
|
| 204 | $this->analyser->run($data['ad_code']); |
|
| 205 | } |
|
| 206 | else if (!$this->input->has_errors()) |
|
| 207 | { |
|
| 208 | $ad_id = $this->manager->insert_ad($data); |
|
| 209 | $this->manager->insert_ad_locations($ad_id, $data['ad_locations']); |
|
| 210 | ||
| 211 | $this->helper->log('ADD', $data['ad_name']); |
|
| 212 | ||
| 213 | $this->success('ACP_AD_ADD_SUCCESS'); |
|
| 214 | } |
|
| 215 | ||
| 216 | $this->helper->assign_locations($data['ad_locations']); |
|
| 217 | $this->helper->assign_form_data($data); |
|
| @@ 257-281 (lines=25) @@ | ||
| 254 | { |
|
| 255 | $this->ad_preview($data['ad_code']); |
|
| 256 | } |
|
| 257 | else if ($upload_banner) |
|
| 258 | { |
|
| 259 | $data['ad_code'] = $this->input->banner_upload($data['ad_code']); |
|
| 260 | } |
|
| 261 | else if ($analyse_ad_code) |
|
| 262 | { |
|
| 263 | $this->analyser->run($data['ad_code']); |
|
| 264 | } |
|
| 265 | else if (!$this->input->has_errors()) |
|
| 266 | { |
|
| 267 | $success = $this->manager->update_ad($ad_id, $data); |
|
| 268 | ||
| 269 | if ($success) |
|
| 270 | { |
|
| 271 | // Only insert new ad locations to DB when ad exists |
|
| 272 | $this->manager->delete_ad_locations($ad_id); |
|
| 273 | $this->manager->insert_ad_locations($ad_id, $data['ad_locations']); |
|
| 274 | ||
| 275 | $this->helper->log('EDIT', $data['ad_name']); |
|
| 276 | ||
| 277 | $this->success('ACP_AD_EDIT_SUCCESS'); |
|
| 278 | } |
|
| 279 | ||
| 280 | $this->error('ACP_AD_DOES_NOT_EXIST'); |
|
| 281 | } |
|
| 282 | } |
|
| 283 | else |
|
| 284 | { |
|