Code Duplication    Length = 13-16 lines in 2 locations

controller/admin_controller.php 2 locations

@@ 212-224 (lines=13) @@
209
		{
210
			$data = $this->get_form_data('phpbb/ads/add');
211
212
			if ($preview)
213
			{
214
				$this->ad_preview($data['ad_code']);
215
			}
216
			else if (empty($this->errors))
217
			{
218
				$ad_id = $this->manager->insert_ad($data);
219
				$this->manager->insert_ad_locations($ad_id, $data['ad_locations']);
220
221
				$this->log('ADD', $data['ad_name']);
222
223
				$this->success('ACP_AD_ADD_SUCCESS');
224
			}
225
226
			$this->assign_locations($data);
227
			$this->assign_form_data($data);
@@ 270-285 (lines=16) @@
267
			{
268
				$this->ad_preview($data['ad_code']);
269
			}
270
			else if (empty($this->errors))
271
			{
272
				$success = $this->manager->update_ad($ad_id, $data);
273
274
				if ($success)
275
				{
276
					// Only insert new ad locations to DB when ad exists
277
					$this->manager->delete_ad_locations($ad_id);
278
					$this->manager->insert_ad_locations($ad_id, $data['ad_locations']);
279
280
					$this->log('EDIT', $data['ad_name']);
281
282
					$this->success('ACP_AD_EDIT_SUCCESS');
283
				}
284
285
				$this->error('ACP_AD_DOES_NOT_EXIST');
286
			}
287
		}
288
		else