Code Duplication    Length = 17-20 lines in 2 locations

controller/admin_controller.php 2 locations

@@ 218-234 (lines=17) @@
215
		{
216
			$data = $this->get_form_data('phpbb/ads/add');
217
218
			if ($preview)
219
			{
220
				$this->ad_preview($data['ad_code']);
221
			}
222
			else if ($upload_banner)
223
			{
224
				$data['ad_code'] = $this->process_banner_upload($data['ad_code']);
225
			}
226
			else if (empty($this->errors))
227
			{
228
				$ad_id = $this->manager->insert_ad($data);
229
				$this->manager->insert_ad_locations($ad_id, $data['ad_locations']);
230
231
				$this->log('ADD', $data['ad_name']);
232
233
				$this->success('ACP_AD_ADD_SUCCESS');
234
			}
235
236
			$this->assign_locations($data);
237
			$this->assign_form_data($data);
@@ 275-294 (lines=20) @@
272
			{
273
				$this->ad_preview($data['ad_code']);
274
			}
275
			else if ($upload_banner)
276
			{
277
				$data['ad_code'] = $this->process_banner_upload($data['ad_code']);
278
			}
279
			else if (empty($this->errors))
280
			{
281
				$success = $this->manager->update_ad($ad_id, $data);
282
283
				if ($success)
284
				{
285
					// Only insert new ad locations to DB when ad exists
286
					$this->manager->delete_ad_locations($ad_id);
287
					$this->manager->insert_ad_locations($ad_id, $data['ad_locations']);
288
289
					$this->log('EDIT', $data['ad_name']);
290
291
					$this->success('ACP_AD_EDIT_SUCCESS');
292
				}
293
294
				$this->error('ACP_AD_DOES_NOT_EXIST');
295
			}
296
		}
297
		else