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