| @@ 127-137 (lines=11) @@ | ||
| 124 | ||
| 125 | $this->validate($data, 'phpbb/admanagement/add'); |
|
| 126 | ||
| 127 | if ($preview) |
|
| 128 | { |
|
| 129 | $this->ad_preview($data['ad_code']); |
|
| 130 | } |
|
| 131 | else if (empty($this->errors)) |
|
| 132 | { |
|
| 133 | $ad_id = $this->manager->insert_ad($data); |
|
| 134 | $this->manager->insert_ad_locations($ad_id, $data['ad_locations']); |
|
| 135 | ||
| 136 | $this->success('ACP_AD_ADD_SUCCESS'); |
|
| 137 | } |
|
| 138 | ||
| 139 | $this->assign_locations($data); |
|
| 140 | $this->assign_form_data($data); |
|
| @@ 173-186 (lines=14) @@ | ||
| 170 | { |
|
| 171 | $this->ad_preview($data['ad_code']); |
|
| 172 | } |
|
| 173 | else if (empty($this->errors)) |
|
| 174 | { |
|
| 175 | $success = $this->manager->update_ad($ad_id, $data); |
|
| 176 | ||
| 177 | if ($success) |
|
| 178 | { |
|
| 179 | // Only insert new ad locations to DB when ad exists |
|
| 180 | $this->manager->delete_ad_locations($ad_id); |
|
| 181 | $this->manager->insert_ad_locations($ad_id, $data['ad_locations']); |
|
| 182 | ||
| 183 | $this->success('ACP_AD_EDIT_SUCCESS'); |
|
| 184 | } |
|
| 185 | $this->error('ACP_AD_DOES_NOT_EXIST'); |
|
| 186 | } |
|
| 187 | } |
|
| 188 | else |
|
| 189 | { |
|