| @@ 187-199 (lines=13) @@ | ||
| 184 | { |
|
| 185 | $data = $this->get_form_data('phpbb/admanagement/add'); |
|
| 186 | ||
| 187 | if ($preview) |
|
| 188 | { |
|
| 189 | $this->ad_preview($data['ad_code']); |
|
| 190 | } |
|
| 191 | else if (empty($this->errors)) |
|
| 192 | { |
|
| 193 | $ad_id = $this->manager->insert_ad($data); |
|
| 194 | $this->manager->insert_ad_locations($ad_id, $data['ad_locations']); |
|
| 195 | ||
| 196 | $this->log('ADD', $data['ad_name']); |
|
| 197 | ||
| 198 | $this->success('ACP_AD_ADD_SUCCESS'); |
|
| 199 | } |
|
| 200 | ||
| 201 | $this->assign_locations($data); |
|
| 202 | $this->assign_form_data($data); |
|
| @@ 237-252 (lines=16) @@ | ||
| 234 | { |
|
| 235 | $this->ad_preview($data['ad_code']); |
|
| 236 | } |
|
| 237 | else if (empty($this->errors)) |
|
| 238 | { |
|
| 239 | $success = $this->manager->update_ad($ad_id, $data); |
|
| 240 | ||
| 241 | if ($success) |
|
| 242 | { |
|
| 243 | // Only insert new ad locations to DB when ad exists |
|
| 244 | $this->manager->delete_ad_locations($ad_id); |
|
| 245 | $this->manager->insert_ad_locations($ad_id, $data['ad_locations']); |
|
| 246 | ||
| 247 | $this->log('EDIT', $data['ad_name']); |
|
| 248 | ||
| 249 | $this->success('ACP_AD_EDIT_SUCCESS'); |
|
| 250 | } |
|
| 251 | $this->error('ACP_AD_DOES_NOT_EXIST'); |
|
| 252 | } |
|
| 253 | } |
|
| 254 | else |
|
| 255 | { |
|