Code Duplication    Length = 17-21 lines in 2 locations

controller/admin_controller.php 2 locations

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