function updateIPCommentAJAX() { global $sic; assertStringArg('text', TRUE); $ip_bin = assertIPArg('id'); $addr = getIPAddress($ip_bin); $net = spotNetworkByIP($ip_bin); if (isset($net)) { fixContext($net); } assertPermission('ipaddress', 'properties', 'editAddress'); updateAddress($ip_bin, $addr['name'], $addr['reserved'], $sic['text']); echo 'OK'; }
$addr['notes'] = $notes; $keep_photo = true; if (isset($delete_photo)) { $keep_photo = !$delete_photo; } if (isset($_FILES["photo"]) && $_FILES["photo"]["error"] <= 0) { $file_tmp_name = $_FILES["photo"]["tmp_name"]; $file_name = $_FILES["photo"]["name"]; $photo = new Photo($file_tmp_name); $photo->scaleToMaxSide(150); $addr['photo'] = $photo->getBase64(); $keep_photo = false; } else { $addr['photo'] = ''; } if (updateAddress($addr, $keep_photo)) { echo "<br /><div class='msgbox'>" . ucfmsg('ADDRESS_BOOK') . " " . msg('UPDATED') . "<br /><i>return to <a href='index{$page_ext}'>home page</a></i></div>"; } else { echo "<br /><div class='msgbox'>" . ucfmsg('INVALID') . " ID.<br /><i>return to <a href='index{$page_ext}'>home page</a></i></div>"; echo ""; } } else { echo "<br /><div class='msgbox'>Editing is disabled.</div>\n"; } } else { if ($id) { if (!$read_only) { $result = mysql_query("SELECT * FROM {$base_from_where} AND {$table}.id={$id}", $db); $myrow = mysql_fetch_array($result); ?>
function importPTRData() { $net = spotEntity('ipv4net', getBypassValue()); assertUIntArg('addrcount'); $nbad = $ngood = 0; for ($i = 1; $i <= $_REQUEST['addrcount']; $i++) { $inputname = "import_{$i}"; if (!isCheckSet($inputname)) { continue; } $ip_bin = assertIPv4Arg("addr_{$i}"); assertStringArg("descr_{$i}", TRUE); assertStringArg("rsvd_{$i}"); // Non-existent addresses will not have this argument set in request. $rsvd = 'no'; if ($_REQUEST["rsvd_{$i}"] == 'yes') { $rsvd = 'yes'; } try { if (!ip_in_range($ip_bin, $net)) { throw new InvalidArgException('ip_bin', $ip_bin); } updateAddress($ip_bin, $_REQUEST["descr_{$i}"], $rsvd); $ngood++; } catch (RackTablesError $e) { $nbad++; } } if (!$nbad) { showFuncMessage(__FUNCTION__, 'OK', array($ngood)); } else { showFuncMessage(__FUNCTION__, 'ERR', array($nbad, $ngood)); } }
$delimiter = ""; } $value = $pal[$pal_keys[$j]]["value"]; $complex = $pal[$pal_keys[$j]]["complex"]; if ($pal_keys[$j] == "LPFiscalNumber") { $comp_query .= " VAT_number='" . $value . "'" . $delimiter; } else { if ($pal_keys[$j] == "legalName") { $comp_query .= " company_name='" . $value . "'" . $delimiter; } else { if ($pal_keys[$j] == "alternativeName") { $comp_query .= " brand_name='" . $value . "'" . $delimiter; } else { if ($pal_keys[$j] == "registeredCanonicalAddress") { //$comp_query .= " street_name='". $value ."'". $delimiter; //SOS to be fixed because this is a complex attribute!!!!! $comp_query .= updateAddress($value, $delimiter); } else { if ($pal_keys[$j] == "eLPIdentifier") { $comp_query .= " eLPIdentifier='" . $value . "'" . $delimiter; } } } } } } //end company's for $comp_query .= " WHERE token='" . $sql2_result . "'"; error_log("{$comp_query}", 0); //lines 326-362, 365: Update the representative's entry in my system by knowing the representative's token used in the SS connection require_once 'wp-config.php'; $rep_query = "UPDATE wp_users SET";
function updateV6Address($ip_bin, $name = '', $reserved = 'no') { if (strlen($ip_bin) != 16) { throw new InvalidArgException('ip_bin', $ip_bin, "Invalid binary IP"); } return updateAddress($ip_bin, $name, $reserved); }
/** * Called when a message has been changed on the mobile. * This functionality is not available for emails. * * @param string $folderid id of the folder * @param string $id id of the message * @param SyncXXX $message the SyncObject containing a message * * @access public * @return array same return value as StatMessage() * @throws StatusException could throw specific SYNC_STATUS_* exceptions */ public function ChangeMessage($folderid, $id, $message) { ZLog::Write(LOGLEVEL_DEBUG, 'PhpAddr::ChangeMessage(' . $folderid . ', ' . $id . ', ..)'); debugLog('PhpAddr::ChangeMessage(FolderID: ' . $folderid . ', ID: ' . $id . ', ..)' . json_encode($message)); global $keep_history, $domain_id; $addr['firstname'] = $message->title != "" ? $message->title . " " : ""; $addr['firstname'] .= $message->firstname . ($message->middlename != "" ? " " . $message->middlename : ""); $addr['firstname'] .= $message->suffix != "" ? " " . $message->suffix : ""; $addr['lastname'] = $message->lastname; $addr['nickname'] = $message->nickname; $addr['company'] = $message->companyname; $addr['title'] = $message->jobtitle; // 'jobtitle' => 'ROLE', // ';;homestreet;homecity;homestate;homepostalcode;homecountry' => 'ADR;HOME', $addr['home'] = $message->homephonenumber; $addr['mobile'] = $message->mobilephonenumber; $addr['work'] = $message->businessphonenumber; $addr['fax'] = $message->businessfaxnumber != "" ? $message->businessfaxnumber : $message->homefaxnumber; $addr['phone2'] = $message->home2phonenumber; // 'business2phonenumber' => 'TEL;WORK', // 'businessfaxnumber' => 'TEL;WORK;FAX', // 'home2phonenumber' => 'TEL;HOME', // 'homefaxnumber' => 'TEL;HOME;FAX', // 'carphonenumber' => 'TEL;CAR', // 'pagernumber' => 'TEL;PAGER', if (!empty($message->picture)) { $addr['photo'] .= 'PHOTO;ENCODING=BASE64;TYPE=JPEG:' . "\n\t" . substr(chunk_split($message->picture, 50, "\n\t"), 0, -1); } $addr['email'] = $message->email1address; $addr['email2'] = $message->email2address; $addr['email3'] = $message->email3address; $addr['homepage'] = $message->webpage; // if($message->birthday !== FALSE) { if ($message->birthday != 0) { $addr['bday'] = date('j', $message->birthday); $addr['bmonth'] = date('F', $message->birthday); $addr['byear'] = date('Y', $message->birthday); } // if($message->anniversary !== FALSE) { if ($message->anniversary != 0) { $addr['aday'] = date('j', $message->anniversary); $addr['amonth'] = date('F', $message->anniversary); $addr['ayear'] = date('Y', $message->anniversary); } // ->anniversary /* // if($message->birthday > 0) { debugLog('PhpAddr::Birthday(Birthday: '.$message->birthday.', Day: '.$addr['bday']); } debugLog('PhpAddr::Birthday(Birthday: '.$message->birthday); */ // ';;businessstreet;businesscity;businessstate;businesspostalcode;businesscountry' => 'ADR;WORK', // ';;otherstreet;othercity;otherstate;otherpostalcode;othercountry' => 'ADR', $addr['notes'] = $message->body; // assistantname, assistnamephonenumber, children, department, officelocation, radiophonenumber, spouse, rtf $addr['address'] = $message->homestreet . "\n" . $message->homepostalcode . " " . $message->homecity . "\n" . $message->homecountry; // $message->homestate = $addr_parts['city']; $addr['address2'] = $message->businessstreet . "\n" . $message->businesspostalcode . " " . $message->businesscity . "\n" . $message->businesscountry; // $message->businessstate = $addr_parts['city']; //2 $this->_phpaddr->connect(); if ($id == "") { $id = saveAddress($addr); debugLog('PhpAddr::ChangedMessage(FolderID: ' . $folderid . ', ID: ' . $id . ', ..)'); } else { $addr['id'] = intval($id); updateAddress($addr); } //2 $this->_phpaddr->disconnect(); /* $mapping = array( ); $data = "BEGIN:VCARD\nVERSION:2.1\nPRODID:Z-Push\n"; foreach($mapping as $k => $v){ $val = ''; $ks = explode(';', $k); foreach($ks as $i){ if(!empty($message->$i)) $val .= $this->escape($message->$i); $val.=';'; } if(empty($val)) continue; $val = substr($val,0,-1); if(strlen($val)>50){ $data .= $v.":\n\t".substr(chunk_split($val, 50, "\n\t"), 0, -1); }else{ $data .= $v.':'.$val."\n"; } } if(!empty($message->categories)) $data .= 'CATEGORIES:'.implode(',', $this->escape($message->categories))."\n"; if(!empty($message->picture)) $data .= 'PHOTO;ENCODING=BASE64;TYPE=JPEG:'."\n\t".substr(chunk_split($message->picture, 50, "\n\t"), 0, -1); if(isset($message->birthday)) $data .= 'BDAY:'.date('Y-m-d', $message->birthday)."\n"; $data .= "END:VCARD"; // not supported: anniversary, assistantname, assistnamephonenumber, children, department, officelocation, radiophonenumber, spouse, rtf if(!$id){ if(!empty($message->fileas)){ $name = u2wi($message->fileas); }elseif(!empty($message->lastname)){ $name = $name = u2wi($message->lastname); }elseif(!empty($message->firstname)){ $name = $name = u2wi($message->firstname); }elseif(!empty($message->companyname)){ $name = $name = u2wi($message->companyname); }else{ $name = 'unknown'; } $name = preg_replace('/[^a-z0-9 _-]/i', '', $name); $id = $name.'.vcf'; $i = 0; while(file_exists($this->getPath().'/'.$id)){ $i++; $id = $name.$i.'.vcf'; } } // file_put_contents($this->getPath().'/'.$id, $data); */ return $this->StatMessage($folderid, $id); }
http_response_code(400); HandleResponse::badRequest("Parameters are blank"); } else { if (!Validation::isValidAddress($address)) { HandleResponse::badRequest("Invalid user address"); } else { $conn = null; try { $db = new DBConnection(); $conn = $db->getConnection(); mysqli_query($conn, "set autocommit = 0"); mysqli_query($conn, "begin"); $user_id = getUserIdFromToken($conn, $access_token); if ($user_id == null) { $ret = HandleResponse::badRequestReturn("Invalid Accesstoken"); } else { // Update address $ret = updateAddress($conn, $user_id, $address); } mysqli_query($conn, "commit"); } catch (Exception $e) { mysqli_query($conn, "rollback"); $ret = HandleResponse::badRequestReturn($e->getMessage()); } print json_encode($ret); } } } else { // NOT POST request http_response_code(404); }
$newAddressData[0] = $_SESSION['currentUserID']; $newAddressData[1] = filter_input(INPUT_POST, 'selected_address_group'); $newAddressData[2] = filter_input(INPUT_POST, 'fullname'); $newAddressData[3] = filter_input(INPUT_POST, 'email'); $newAddressData[4] = filter_input(INPUT_POST, 'address'); $newAddressData[5] = formatPhone(stripDownPhone(filter_input(INPUT_POST, 'phone'))); $newAddressData[6] = filter_input(INPUT_POST, 'website'); $newAddressData[7] = filter_input(INPUT_POST, 'birthday'); if (empty($newAddressData[7])) { $newAddressData[7] = filter_input(INPUT_POST, 'old_birthday'); } $errors = validateNewItem($newAddressData); if (count($errors) == 0) { $newAddressData[8] = uploadImage(); if (empty($newAddressData[8])) { $newAddressData[8] = filter_input(INPUT_POST, 'old_image'); $errors[] = 'Existing image retained'; } if (updateAddress($_SESSION['currentAddress'], $newAddressData[1], $newAddressData[2], $newAddressData[4], $newAddressData[3], $newAddressData[5], $newAddressData[6], $newAddressData[7], $newAddressData[8])) { $results = 'Updated'; } else { $results = 'Update could not be completed'; } } else { $results = '**Errors found**'; } } include './includes/updateform.html.php'; ?>
getPersonalInfo(); } if ($function == "update_personal_info") { updatePersonalInfo(); } if ($function == "change_password") { changePassword(); } if ($function == "get_all_addresses") { getAllAddresses(); } if ($function == "get_address") { getAddress(); } if ($function == "update_address") { updateAddress(); } if ($function == "add_address") { addAddress(); } if ($function == "get_all_cards") { getAllCards(); } if ($function == "get_card") { getCard(); } if ($function == "add_credit_card") { addCreditCard(); } if ($function == "add_credit_card_checkout") { addCreditCardCheckout();
function editAddress() { assertStringArg('name', TRUE); assertStringArg('comment', TRUE); $ip_bin = assertIPArg('ip'); updateAddress($ip_bin, $_REQUEST['name'], isCheckSet('reserved', 'yesno'), $_REQUEST['comment']); return showFuncMessage(__FUNCTION__, 'OK'); }
if ($view === 'update') { $groups = getGroups(); if (isPostRequest()) { $userID = $_SESSION['userID']; $group = filter_input(INPUT_POST, 'group'); $name = filter_input(INPUT_POST, 'fullname'); $email = filter_input(INPUT_POST, 'email'); $address = filter_input(INPUT_POST, 'address'); $phone = filter_input(INPUT_POST, 'phone'); $website = filter_input(INPUT_POST, 'website'); $birthday = filter_input(INPUT_POST, 'birthday'); $updateShit = filter_input(INPUT_POST, 'updateForm'); if (empty($name)) { echo "Cannot have a blank name."; } else { $results = updateAddress($group, $name, $email, $address, $phone, $website, $birthday, $updateShit); } if ($results === true) { echo "Address Updated"; } else { echo "Address Not Updated"; } } $address_id = filter_input(INPUT_GET, 'id'); $results = getAddressById($address_id); include '../templates/update-address.html.php'; } else { /* Default view */ include '../templates/loggedin-default.html.php'; } }
function Update() { // Read uploaded file $lines = file($_FILES['userfile']['tmp_name']); // add file contents to facter array foreach ($lines as $line_num => $line) { $tmpfacter = explode("=>", $line, 2); $facter[trim($tmpfacter[0])] = str_replace('"', '', trim($tmpfacter[1])); } // Fix fqdn since all fields have \n inn them $facter['fqdn'] = str_replace("\n", "", $facter['fqdn']); // Check if it's an existing machine // 2011-08-31 <*****@*****.**> // * expanded query to try to match via facter Serialnumber to be able to // match unnamed HW assets. Serial is more precise and less likely to be changed. if (array_key_exists('serialnumber', $facter) && strlen($facter['serialnumber']) > 0 && $facter['serialnumber'] != 'Not Specified') { $query = "select id from RackObject where name = \"{$facter['fqdn']}\" OR asset_no = \"{$facter['serialnumber']}\" LIMIT 1"; } else { $query = "select id from RackObject where name = \"{$facter['fqdn']}\" LIMIT 1"; } unset($result); $result = usePreparedSelectBlade($query); $resultarray = $result->fetchAll(PDO::FETCH_ASSOC); if ($resultarray) { $id = $resultarray[0]['id']; } // If it's a new machine if (!isset($id)) { // Check to see if it's a physical machine and get the correct id for Server if ($facter['is_virtual'] == "false") { // Find server id $query = "select dict_key from Dictionary where dict_value='Server' LIMIT 1"; unset($result); $result = usePreparedSelectBlade($query); $resultarray = $result->fetchAll(); if ($resultarray) { $virtual = $resultarray[0]['dict_key']; } } else { // Find virtual id $query = "select dict_key from Dictionary where dict_value='VM' LIMIT 1"; unset($result); $result = usePreparedSelectBlade($query); $resultarray = $result->fetchAll(PDO::FETCH_ASSOC); if ($resultarray) { $virtual = $resultarray[0]['dict_key']; } } // Add the new machine $newmachine = commitAddObject($facter['fqdn'], "", $virtual, $value = ""); $type_id = getObjectTypeID($newmachine); } else { // Just set some fields I use later down for updating $newmachine = $id; $machineupdate = 1; $type_id = getObjectTypeID($newmachine); } // 2011-08-31 <*****@*****.**> // * Update (unique) name of object. if (array_key_exists('serialnumber', $facter) && strlen($facter['serialnumber']) > 0 && $facter['serialnumber'] != 'Not Specified') { unset($result); $query = "select * from RackObject where asset_no = \"{$facter['serialnumber']}\" LIMIT 1"; $result = usePreparedSelectBlade($query); $resultarray = $result->fetchAll(PDO::FETCH_ASSOC); if ($resultarray) { $id = $resultarray[0]['id']; $label = $resultarray[0]['label']; // Update FQDN commitUpdateObject($id, $facter['fqdn'], $label, 'no', $facter['serialnumber'], 'Facter Import::Update Common Name'); } } // Find HW type id // 2011-08-31 <*****@*****.**> // * adjust format to match default Dictionary Sets if ($facter['is_virtual'] == "false") { $iHWTemp = preg_match('([a-zA-Z]{1,})', $facter['manufacturer'], $matches); $sManufacturer = $matches[0]; $sHW = preg_replace('(\\ )', '\\1%GPASS%', $facter['productname']); $sHWType = $sManufacturer . ' ' . $sHW; $query = "select id from Attribute where name='HW type' LIMIT 1"; unset($result); $result = usePreparedSelectBlade($query); $resultarray = $result->fetchAll(PDO::FETCH_ASSOC); if ($resultarray) { $id = $resultarray[0]['id']; // Update HW type $hw_dict_key = getdict($sHWType, $chapter = 11); commitUpdateAttrValue($object_id = $newmachine, $attr_id = $id, $value = $hw_dict_key); } //Also Check if HYPERVISOR if (isset($facter['is_hypervisor'])) { $query = "select id from Attribute where name REGEXP '^ *Hypervisor Type\$' LIMIT 1"; unset($result); $result = usePreparedSelectBlade($query); $resultarray = $result->fetchAll(PDO::FETCH_ASSOC); if ($resultarray) { $id = $resultarray[0]['id']; // Update Hypervisor type $hypervisor_type = $facter['is_hypervisor']; $hypervisor_type_dict_key = getdict($hw = $hypervisor_type, $chapter = 10005); commitUpdateAttrValue($object_id = $newmachine, $attr_id = $id, $value = $hypervisor_type_dict_key); } //Set Value to Yes $query = "select id from Attribute where name REGEXP '^ *Hypervisor' LIMIT 1"; unset($result); $result = usePreparedSelectBlade($query); $resultarray = $result->fetchAll(PDO::FETCH_ASSOC); if ($resultarray) { $id = $resultarray[0]['id']; // Update Hypervisor type $hypervisor = "Yes"; $hypervisor_dict_key = getdict($hypervisor, $chapter = 29); commitUpdateAttrValue($object_id = $newmachine, $attr_id = $id, $value = $hypervisor_dict_key); } //Find Running VMs $vms = explode(',', $facter['vms']); $vm_count = count($vms); for ($i = 0; $i < $vm_count; $i++) { //addToParent addVmToParent($vms[$i], $newmachine); } } else { $query = "select id from Attribute where name REGEXP '^ *Hypervisor' LIMIT 1"; unset($result); $result = usePreparedSelectBlade($query); $resultarray = $result->fetchAll(PDO::FETCH_ASSOC); if ($resultarray) { $id = $resultarray[0]['id']; // Update Hypervisor type $hypervisor = "No"; $hypervisor_dict_key = getdict($hypervisor, $chapter = 29); commitUpdateAttrValue($object_id = $newmachine, $attr_id = $id, $value = ""); } } } // Find SW type id (OS) $query = "select id from Attribute where name REGEXP '^ *SW type\$' LIMIT 1"; unset($result); $result = usePreparedSelectBlade($query); $resultarray = $result->fetchAll(PDO::FETCH_ASSOC); if ($resultarray) { $id = $resultarray[0]['id']; // Update SW type (OS) $osrelease = $facter['operatingsystem'] . '%GSKIP%' . $facter['operatingsystem'] . ' V' . $facter['operatingsystemrelease']; $os_dict_key = getdict($hw = $osrelease, $chapter = 13); commitUpdateAttrValue($object_id = $newmachine, $attr_id = $id, $value = $os_dict_key); } //Generic to read in from file $manifest_file = fopen("../plugins/manifest", "r") or die("Could not open manifest, make sure it is in the websrv root and called manifest \n"); while (!feof($manifest_file)) { $tmp_line = fgets($manifest_file); if (!empty($tmp_line) && !preg_match("/\\/\\//", $tmp_line)) { @(list($Fact, $Attr, $Chapter) = array_map('trim', explode(',', $tmp_line, 3))); //check for multi-facter names if (strstr($Fact, '.')) { @(list($Fact1, $Fact2) = array_map('trim', explode('.', $Fact))); $value = $facter[$Fact1] . ' ' . $facter[$Fact2]; if (!isset($facter[$Fact1]) || !isset($facter[$Fact2])) { echo "WARNING: {$Fact1} or {$Fact2} does not exist in Facter for this object \n"; continue; } } else { if (!isset($facter[$Fact])) { echo "WARNING: {$Fact} does not exist in Facter for this object \n"; continue; } else { $value = $facter[$Fact]; } } $query = "select id from Attribute where name REGEXP '^ *{$Attr}' LIMIT 1"; unset($result); $result = usePreparedSelectBlade($query); $resultarray = $result->fetchAll(PDO::FETCH_ASSOC); $id = $resultarray[0]['id']; if (!valid($type_id, $id)) { echo "WARNING: Not a valid Mapping for {$Fact} to {$Attr} for objectType {$type_id} \n"; } else { if ($resultarray) { if (!empty($Chapter)) { $name = $value; $name_dict_key = getdict($hw = $name, $chapter = $Chapter); commitUpdateAttrValue($object_id = $newmachine, $attr_id = $id, $value = $name_dict_key); } else { if (preg_match("/[0-9]{1,2}\\/[0-9]{1,2}\\/[0-9]{4}/", $value) || preg_match("/[0-9]{1,2}\\-[0-9]{1,2}\\-[0-9]{4}/", $value) || preg_match("/[0-9]{4}\\-[0-9]{1,2}\\-[0-9]{1,2}/", $value)) { //handle dates commitUpdateAttrValue($newmachine, $id, strtotime($value)); } else { commitUpdateAttrValue($newmachine, $id, $value); } } } } } } fclose($manifest_file); // Add network interfaces // Create an array with interfaces $nics = explode(',', $facter['interfaces']); // Go through all interfaces and add IP and MAC $count = count($nics); for ($i = 0; $i < $count; $i++) { // Remove newline from the field $nics[$i] = str_replace("\n", "", $nics[$i]); // We generally don't monitor sit interfaces. // We don't do this for lo interfaces, too // 2011-08-31 <*****@*****.**> // * Only Document real interfaces, dont do bridges, bonds, vlan-interfaces // when they have no IP defined. if (preg_match('(_|^(bond|lo|sit|vnet|virbr|veth|peth))', $nics[$i]) != 0) { // do nothing } else { // Get IP if (isset($facter['ipaddress_' . $nics[$i]])) { $ip = $facter['ipaddress_' . $nics[$i]]; } // Get MAC if (isset($facter['macaddress_' . $nics[$i]])) { $mac = $facter['macaddress_' . $nics[$i]]; } //check if VM or not if ($facter['is_virtual'] == "false") { // Find 1000Base-T id $query = "select id from PortOuterInterface where oif_name REGEXP '^ *1000Base-T\$' LIMIT 1"; } else { // Find virtual port id $query = "select id from PortOuterInterface where oif_name REGEXP '^ *virtual port\$' LIMIT 1"; } unset($result); $result = usePreparedSelectBlade($query); $resultarray = $result->fetchAll(PDO::FETCH_ASSOC); if ($resultarray) { $nictypeid = $resultarray[0]['id']; } // Remove newline from ip $ip = str_replace("\n", "", $ip); // Check to se if the interface has an ip assigned $query = "SELECT object_id FROM IPv4Allocation where object_id={$newmachine} and name=\"{$nics[$i]}\""; unset($result); $result = usePreparedSelectBlade($query); $resultarray = $result->fetchAll(PDO::FETCH_ASSOC); if ($resultarray) { unset($id); $ipcheck = $resultarray; } // Check if it's been configured a port already $query = "SELECT id,iif_id FROM Port where object_id={$newmachine} and name=\"{$nics[$i]}\""; unset($result); $result = usePreparedSelectBlade($query); $resultarray = $result->fetchAll(PDO::FETCH_ASSOC); if ($resultarray) { $portid = $resultarray[0]['id']; unset($id); $portcheck = $resultarray; } // Add/update port // 2011-08-31 <*****@*****.**> // * Don't touch already existing complex ports if ($resultarray[0]['type'] != 9) { if (count($portcheck) == 1) { commitUpdatePort($newmachine, $portid, $nics[$i], $nictypeid, "Ethernet port", "{$mac}", NULL); } else { commitAddPort($object_id = $newmachine, $nics[$i], $nictypeid, 'Ethernet port', "{$mac}"); } } else { //We've got a complex port, don't touch it, it raises an error with 'Database error: foreign key violation' } if (count($ipcheck) == 1) { if ($ip) { updateAddress(ip_parse($ip), $newmachine, $nics[$i], 'regular'); } } else { if ($ip) { bindIpToObject(ip_parse($ip), $newmachine, $nics[$i], 'regular'); } } unset($portcheck); unset($ipcheck); unset($ip); unset($mac); } } //uncomment to start using auto tags //addTagToObject($facter, $newmachine); return buildRedirectURL(); }