Code Duplication    Length = 13-16 lines in 2 locations

controller/admin_controller.php 2 locations

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