Code Duplication    Length = 11-14 lines in 2 locations

controller/admin_controller.php 2 locations

@@ 126-136 (lines=11) @@
123
124
			$this->validate($data, 'phpbb/admanagement/add');
125
126
			if ($preview)
127
			{
128
				$this->ad_preview($data['ad_code']);
129
			}
130
			else if (empty($this->errors))
131
			{
132
				$ad_id = $this->manager->insert_ad($data);
133
				$this->manager->insert_ad_locations($ad_id, $data['ad_locations']);
134
135
				$this->success('ACP_AD_ADD_SUCCESS');
136
			}
137
138
			$this->assign_locations($data);
139
			$this->assign_form_data($data);
@@ 171-184 (lines=14) @@
168
			{
169
				$this->ad_preview($data['ad_code']);
170
			}
171
			else if (empty($this->errors))
172
			{
173
				$success = $this->manager->update_ad($ad_id, $data);
174
175
				if ($success)
176
				{
177
					// Only insert new ad locations to DB when ad exists
178
					$this->manager->delete_ad_locations($ad_id);
179
					$this->manager->insert_ad_locations($ad_id, $data['ad_locations']);
180
181
					$this->success('ACP_AD_EDIT_SUCCESS');
182
				}
183
				$this->error('ACP_AD_DOES_NOT_EXIST');
184
			}
185
		}
186
		else
187
		{