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