Code Duplication    Length = 16-17 lines in 2 locations

web_interface/astpp/application/modules/accounts/controllers/accounts.php 1 location

@@ 412-428 (lines=17) @@
409
				$getdata = $this->db_model->countQuery("*", "ip_map", $where);
410
				if ($getdata > 0) {
411
					$this->session->set_flashdata('astpp_notification', 'IP already exist in system.');
412
				} else {
413
					if ($accounttype == "provider") {
414
						$add_array['pricelist_id'] = 0;
415
					}
416
					unset($add_array['action']);
417
					$add_array['context'] = 'default';
418
					$add_array['accountid'] = $accountid;
419
					$ip_flag = $this->db->insert("ip_map", $add_array);
420
					if ($ip_flag) {
421
						$this->load->library('freeswitch_lib');
422
						$this->load->module('freeswitch/freeswitch');
423
						$command = "api reloadacl";
424
						$response = $this->freeswitch_model->reload_freeswitch($command);
425
						$this->session->set_userdata('astpp_notification', $response);
426
					}
427
					$this->session->set_flashdata('astpp_errormsg', 'IP added sucessfully.');
428
				}
429
			}
430
		}
431
		if ($action == "delete") {

web_interface/astpp/application/modules/user/controllers/user.php 1 location

@@ 1225-1240 (lines=16) @@
1222
			  }
1223
			  $where = array("ip" => trim($add_array['ip']), "prefix" => trim($add_array['prefix']));
1224
			  $getdata = $this->db_model->countQuery("*", "ip_map", $where);
1225
			  if ($getdata > 0) {
1226
				$this->session->set_flashdata('astpp_notification', 'IP already exist in system.');
1227
			  } else {
1228
				unset($add_array['action']);
1229
				$add_array['context'] = 'default';
1230
				$add_array['accountid'] = $accountinfo['id'];
1231
				$ip_flag = $this->db->insert("ip_map", $add_array);
1232
				if ($ip_flag) {
1233
					$this->load->library('freeswitch_lib');
1234
					$this->load->module('freeswitch/freeswitch');
1235
					$command = "api reloadacl";
1236
					$response = $this->freeswitch_model->reload_freeswitch($command);
1237
					$this->session->set_userdata('astpp_notification', $response);
1238
				}
1239
				$this->session->set_flashdata('astpp_errormsg', 'IP Added Sucessfully.');
1240
			}
1241
			}
1242
		if($action =='delete'){
1243
			$this->db->delete('ip_map',array('id'=>$id));