Code Duplication    Length = 17-20 lines in 2 locations

controller/admin_controller.php 2 locations

@@ 203-219 (lines=17) @@
200
		{
201
			$data = $this->get_form_data('phpbb/ads/add');
202
203
			if ($preview)
204
			{
205
				$this->ad_preview($data['ad_code']);
206
			}
207
			else if ($upload_banner)
208
			{
209
				$data['ad_code'] = $this->process_banner_upload($data['ad_code']);
210
			}
211
			else if (empty($this->errors))
212
			{
213
				$ad_id = $this->manager->insert_ad($data);
214
				$this->manager->insert_ad_locations($ad_id, $data['ad_locations']);
215
216
				$this->log('ADD', $data['ad_name']);
217
218
				$this->success('ACP_AD_ADD_SUCCESS');
219
			}
220
221
			$this->assign_locations($data);
222
			$this->assign_form_data($data);
@@ 259-278 (lines=20) @@
256
			{
257
				$this->ad_preview($data['ad_code']);
258
			}
259
			else if ($upload_banner)
260
			{
261
				$data['ad_code'] = $this->process_banner_upload($data['ad_code']);
262
			}
263
			else if (empty($this->errors))
264
			{
265
				$success = $this->manager->update_ad($ad_id, $data);
266
267
				if ($success)
268
				{
269
					// Only insert new ad locations to DB when ad exists
270
					$this->manager->delete_ad_locations($ad_id);
271
					$this->manager->insert_ad_locations($ad_id, $data['ad_locations']);
272
273
					$this->log('EDIT', $data['ad_name']);
274
275
					$this->success('ACP_AD_EDIT_SUCCESS');
276
				}
277
				$this->error('ACP_AD_DOES_NOT_EXIST');
278
			}
279
		}
280
		else
281
		{