| @@ 210-222 (lines=13) @@ | ||
| 207 | { |
|
| 208 | $data = $this->get_form_data('phpbb/ads/add'); |
|
| 209 | ||
| 210 | if ($preview) |
|
| 211 | { |
|
| 212 | $this->ad_preview($data['ad_code']); |
|
| 213 | } |
|
| 214 | else if (empty($this->errors)) |
|
| 215 | { |
|
| 216 | $ad_id = $this->manager->insert_ad($data); |
|
| 217 | $this->manager->insert_ad_locations($ad_id, $data['ad_locations']); |
|
| 218 | ||
| 219 | $this->log('ADD', $data['ad_name']); |
|
| 220 | ||
| 221 | $this->success('ACP_AD_ADD_SUCCESS'); |
|
| 222 | } |
|
| 223 | ||
| 224 | $this->assign_locations($data); |
|
| 225 | $this->assign_form_data($data); |
|
| @@ 262-277 (lines=16) @@ | ||
| 259 | { |
|
| 260 | $this->ad_preview($data['ad_code']); |
|
| 261 | } |
|
| 262 | else if (empty($this->errors)) |
|
| 263 | { |
|
| 264 | $success = $this->manager->update_ad($ad_id, $data); |
|
| 265 | ||
| 266 | if ($success) |
|
| 267 | { |
|
| 268 | // Only insert new ad locations to DB when ad exists |
|
| 269 | $this->manager->delete_ad_locations($ad_id); |
|
| 270 | $this->manager->insert_ad_locations($ad_id, $data['ad_locations']); |
|
| 271 | ||
| 272 | $this->log('EDIT', $data['ad_name']); |
|
| 273 | ||
| 274 | $this->success('ACP_AD_EDIT_SUCCESS'); |
|
| 275 | } |
|
| 276 | ||
| 277 | $this->error('ACP_AD_DOES_NOT_EXIST'); |
|
| 278 | } |
|
| 279 | } |
|
| 280 | else |
|