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