Code Duplication    Length = 17-21 lines in 2 locations

controller/admin_controller.php 2 locations

@@ 185-201 (lines=17) @@
182
		{
183
			$data = $this->input->get_form_data('phpbb/ads/add');
184
185
			if ($preview)
186
			{
187
				$this->ad_preview($data['ad_code']);
188
			}
189
			else if ($upload_banner)
190
			{
191
				$data['ad_code'] = $this->input->banner_upload($data['ad_code']);
192
			}
193
			else if (!$this->input->has_errors())
194
			{
195
				$ad_id = $this->manager->insert_ad($data);
196
				$this->manager->insert_ad_locations($ad_id, $data['ad_locations']);
197
198
				$this->helper->log('ADD', $data['ad_name']);
199
200
				$this->success('ACP_AD_ADD_SUCCESS');
201
			}
202
203
			$this->helper->assign_locations($data['ad_locations']);
204
			$this->helper->assign_form_data($data);
@@ 243-263 (lines=21) @@
240
			{
241
				$this->ad_preview($data['ad_code']);
242
			}
243
			else if ($upload_banner)
244
			{
245
				$data['ad_code'] = $this->input->banner_upload($data['ad_code']);
246
			}
247
			else if (!$this->input->has_errors())
248
			{
249
				$success = $this->manager->update_ad($ad_id, $data);
250
251
				if ($success)
252
				{
253
					// Only insert new ad locations to DB when ad exists
254
					$this->manager->delete_ad_locations($ad_id);
255
					$this->manager->insert_ad_locations($ad_id, $data['ad_locations']);
256
257
					$this->helper->log('EDIT', $data['ad_name']);
258
259
					$this->success('ACP_AD_EDIT_SUCCESS');
260
				}
261
262
				$this->error('ACP_AD_DOES_NOT_EXIST');
263
			}
264
		}
265
		else
266
		{