| @@ 213-229 (lines=17) @@ | ||
| 210 | { |
|
| 211 | $data = $this->get_form_data('phpbb/ads/add'); |
|
| 212 | ||
| 213 | if ($preview) |
|
| 214 | { |
|
| 215 | $this->ad_preview($data['ad_code']); |
|
| 216 | } |
|
| 217 | else if ($upload_banner) |
|
| 218 | { |
|
| 219 | $data['ad_code'] = $this->process_banner_upload($data['ad_code']); |
|
| 220 | } |
|
| 221 | else if (empty($this->errors)) |
|
| 222 | { |
|
| 223 | $ad_id = $this->manager->insert_ad($data); |
|
| 224 | $this->manager->insert_ad_locations($ad_id, $data['ad_locations']); |
|
| 225 | ||
| 226 | $this->log('ADD', $data['ad_name']); |
|
| 227 | ||
| 228 | $this->success('ACP_AD_ADD_SUCCESS'); |
|
| 229 | } |
|
| 230 | ||
| 231 | $this->assign_locations($data); |
|
| 232 | $this->assign_form_data($data); |
|
| @@ 270-289 (lines=20) @@ | ||
| 267 | { |
|
| 268 | $this->ad_preview($data['ad_code']); |
|
| 269 | } |
|
| 270 | else if ($upload_banner) |
|
| 271 | { |
|
| 272 | $data['ad_code'] = $this->process_banner_upload($data['ad_code']); |
|
| 273 | } |
|
| 274 | else if (empty($this->errors)) |
|
| 275 | { |
|
| 276 | $success = $this->manager->update_ad($ad_id, $data); |
|
| 277 | ||
| 278 | if ($success) |
|
| 279 | { |
|
| 280 | // Only insert new ad locations to DB when ad exists |
|
| 281 | $this->manager->delete_ad_locations($ad_id); |
|
| 282 | $this->manager->insert_ad_locations($ad_id, $data['ad_locations']); |
|
| 283 | ||
| 284 | $this->log('EDIT', $data['ad_name']); |
|
| 285 | ||
| 286 | $this->success('ACP_AD_EDIT_SUCCESS'); |
|
| 287 | } |
|
| 288 | ||
| 289 | $this->error('ACP_AD_DOES_NOT_EXIST'); |
|
| 290 | } |
|
| 291 | } |
|
| 292 | else |
|