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