| @@ 183-198 (lines=16) @@ | ||
| 180 | { |
|
| 181 | $this->ad_preview($data['ad_code']); |
|
| 182 | } |
|
| 183 | else if (empty($this->errors)) |
|
| 184 | { |
|
| 185 | $success = $this->manager->update_ad($ad_id, $data); |
|
| 186 | ||
| 187 | if ($success) |
|
| 188 | { |
|
| 189 | // Only insert new ad locations to DB when ad exists |
|
| 190 | $this->manager->delete_ad_locations($ad_id); |
|
| 191 | $this->manager->insert_ad_locations($ad_id, $data['ad_locations']); |
|
| 192 | ||
| 193 | $this->log('EDIT', $data['ad_name']); |
|
| 194 | ||
| 195 | $this->success('ACP_AD_EDIT_SUCCESS'); |
|
| 196 | } |
|
| 197 | $this->error('ACP_AD_DOES_NOT_EXIST'); |
|
| 198 | } |
|
| 199 | } |
|
| 200 | else |
|
| 201 | { |
|
| @@ 133-145 (lines=13) @@ | ||
| 130 | { |
|
| 131 | $data = $this->get_form_data('phpbb/admanagement/add'); |
|
| 132 | ||
| 133 | if ($preview) |
|
| 134 | { |
|
| 135 | $this->ad_preview($data['ad_code']); |
|
| 136 | } |
|
| 137 | else if (empty($this->errors)) |
|
| 138 | { |
|
| 139 | $ad_id = $this->manager->insert_ad($data); |
|
| 140 | $this->manager->insert_ad_locations($ad_id, $data['ad_locations']); |
|
| 141 | ||
| 142 | $this->log('ADD', $data['ad_name']); |
|
| 143 | ||
| 144 | $this->success('ACP_AD_ADD_SUCCESS'); |
|
| 145 | } |
|
| 146 | ||
| 147 | $this->assign_locations($data); |
|
| 148 | $this->assign_form_data($data); |
|