Code Duplication    Length = 17-21 lines in 2 locations

controller/admin_controller.php 2 locations

@@ 176-192 (lines=17) @@
173
		{
174
			$data = $this->input->get_form_data('phpbb/ads/add');
175
176
			if ($preview)
177
			{
178
				$this->ad_preview($data['ad_code']);
179
			}
180
			else if ($upload_banner)
181
			{
182
				$data['ad_code'] = $this->input->process_banner_upload($data['ad_code']);
183
			}
184
			else if (empty($this->input->get_errors()))
185
			{
186
				$ad_id = $this->manager->insert_ad($data);
187
				$this->manager->insert_ad_locations($ad_id, $data['ad_locations']);
188
189
				$this->helper->log('ADD', $data['ad_name']);
190
191
				$this->success('ACP_AD_ADD_SUCCESS');
192
			}
193
194
			$this->helper->assign_locations($data['ad_locations']);
195
			$this->helper->assign_form_data($data);
@@ 234-254 (lines=21) @@
231
			{
232
				$this->ad_preview($data['ad_code']);
233
			}
234
			else if ($upload_banner)
235
			{
236
				$data['ad_code'] = $this->input->process_banner_upload($data['ad_code']);
237
			}
238
			else if (empty($this->input->get_errors()))
239
			{
240
				$success = $this->manager->update_ad($ad_id, $data);
241
242
				if ($success)
243
				{
244
					// Only insert new ad locations to DB when ad exists
245
					$this->manager->delete_ad_locations($ad_id);
246
					$this->manager->insert_ad_locations($ad_id, $data['ad_locations']);
247
248
					$this->helper->log('EDIT', $data['ad_name']);
249
250
					$this->success('ACP_AD_EDIT_SUCCESS');
251
				}
252
253
				$this->error('ACP_AD_DOES_NOT_EXIST');
254
			}
255
		}
256
		else
257
		{