Code Duplication    Length = 13-16 lines in 2 locations

controller/admin_controller.php 2 locations

@@ 133-145 (lines=13) @@
130
131
			$this->validate($data, 'phpbb/admanagement/add');
132
133
			if ($preview)
134
			{
135
				$this->ad_preview($data['ad_code']);
136
			}
137
			else if (empty($this->errors))
138
			{
139
				$ad_id = $this->manager->insert_ad($data);
140
				$this->manager->insert_ad_locations($ad_id, $data['ad_locations']);
141
142
				$this->log('ADD', $data['ad_name']);
143
144
				$this->success('ACP_AD_ADD_SUCCESS');
145
			}
146
147
			$this->assign_locations($data);
148
			$this->assign_form_data($data);
@@ 185-200 (lines=16) @@
182
			{
183
				$this->ad_preview($data['ad_code']);
184
			}
185
			else if (empty($this->errors))
186
			{
187
				$success = $this->manager->update_ad($ad_id, $data);
188
189
				if ($success)
190
				{
191
					// Only insert new ad locations to DB when ad exists
192
					$this->manager->delete_ad_locations($ad_id);
193
					$this->manager->insert_ad_locations($ad_id, $data['ad_locations']);
194
195
					$this->log('EDIT', $data['ad_name']);
196
197
					$this->success('ACP_AD_EDIT_SUCCESS');
198
				}
199
				$this->error('ACP_AD_DOES_NOT_EXIST');
200
			}
201
		}
202
		else
203
		{