Code Duplication    Length = 17-21 lines in 2 locations

controller/admin_controller.php 2 locations

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