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