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