@@ 132-144 (lines=13) @@ | ||
129 | ||
130 | $this->validate($data, 'phpbb/admanagement/add'); |
|
131 | ||
132 | if ($preview) |
|
133 | { |
|
134 | $this->ad_preview($data['ad_code']); |
|
135 | } |
|
136 | else if (empty($this->errors)) |
|
137 | { |
|
138 | $ad_id = $this->manager->insert_ad($data); |
|
139 | $this->manager->insert_ad_locations($ad_id, $data['ad_locations']); |
|
140 | ||
141 | $this->log('ADD', $data['ad_name']); |
|
142 | ||
143 | $this->success('ACP_AD_ADD_SUCCESS'); |
|
144 | } |
|
145 | ||
146 | $this->assign_locations($data); |
|
147 | $this->assign_form_data($data); |
|
@@ 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 | { |