当前位置: 首页>>代码示例>>PHP>>正文


PHP Addresses::transform_address方法代码示例

本文整理汇总了PHP中Addresses::transform_address方法的典型用法代码示例。如果您正苦于以下问题:PHP Addresses::transform_address方法的具体用法?PHP Addresses::transform_address怎么用?PHP Addresses::transform_address使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Addresses的用法示例。


在下文中一共展示了Addresses::transform_address方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: resolve_address

 /**
  * Resolves hostname
  *
  * @access public
  * @param mixed $address		address object
  * @param boolena $override		override DNS resolving flag
  * @return void
  */
 public function resolve_address($address, $override = false)
 {
     # settings
     $this->get_settings();
     # addresses object
     $Address = new Addresses($this->Database);
     # make sure it is dotted format
     $address->ip = $Address->transform_address($address->ip_addr, "dotted");
     # if dns_nameis set try to check
     if (empty($address->dns_name) || is_null($address->dns_name)) {
         # if permitted in settings
         if ($this->settings->enableDNSresolving == 1 || $override) {
             # resolve
             $resolved = gethostbyaddr($address->ip);
             if ($resolved == $address->ip) {
                 $resolved = "";
             }
             //resolve fails
             return array("class" => "resolved", "name" => $resolved);
         } else {
             return array("class" => "", "name" => "");
         }
     } else {
         return array("class" => "", "name" => $address->dns_name);
     }
 }
开发者ID:Benchwork,项目名称:phpipam,代码行数:34,代码来源:class.DNS.php

示例2:

 # if errors are present print them, else execute query!
 if ($verify) {
     $Result->show("danger", _('Error') . ": {$verify} ({$address['ip_addr']})", true);
 } else {
     # set update type for update to single
     $address['type'] = "single";
     # check for duplicate entryon adding new address
     if ($action == "add") {
         if ($Addresses->address_exists($address['ip_addr'], $address['subnetId'])) {
             $Result->show("danger", _('IP address') . " {$address['ip_addr']} " . _('already existing in selected network') . '!', true);
         }
     }
     # check for duplicate entry on edit!
     if ($action == "edit") {
         # if IP is the same than it can already exist!
         if ($Addresses->transform_address($address['ip_addr'], "decimal") != $address['ip_addr_old']) {
             if ($Addresses->address_exists($address['ip_addr'], $address['subnetId'])) {
                 $Result->show("danger", _('IP address') . " {$address['ip_addr']} " . _('already existing in selected network') . '!', true);
             }
         }
     }
     # move checks
     if ($action == "move") {
         # check if not already used in new subnet
         if ($Addresses->address_exists($address['ip_addr'], $address['newSubnet'])) {
             $Result->show("danger", _('IP address') . " {$address['ip_addr']} " . _('already existing in selected network') . '!', true);
         }
     }
     # multicast check
     if ($User->settings->enableMulticast == 1 && $subnet_is_multicast) {
         if (!$User->is_admin(false)) {
开发者ID:routenull0,项目名称:phpipam,代码行数:31,代码来源:address-modify-submit.php

示例3: array

/* if action is reject set processed and accepted to 1 and 0 */
if ($_POST['action'] == "reject") {
    //set reject values
    $values = array("id" => $_POST['requestId'], "processed" => 1, "accepted" => 0, "adminComment" => @$_POST['adminComment']);
    if (!$Admin->object_modify("requests", "edit", "id", $values)) {
        $Result->show("danger", _("Failed to reject IP request"), true);
    } else {
        $Result->show("success", _("Request has beed rejected"), false);
    }
    # send mail
    $Tools->ip_request_send_mail("reject", $_POST);
} else {
    // fetch subnet
    $subnet_temp = $Addresses->transform_to_dotted($subnet['subnet']) . "/" . $subnet['mask'];
    //verify IP and subnet
    $Addresses->verify_address($Addresses->transform_address($_POST['ip_addr'], "dotted"), $subnet_temp, false, true);
    //check if already existing and die
    if ($Addresses->address_exists($Addresses->transform_address($_POST['ip_addr'], "decimal"), $subnet['id'])) {
        $Result->show("danger", _('IP address already exists'), true);
    }
    //insert to ipaddresses table
    $values = array("action" => "add", "ip_addr" => $Addresses->transform_address($_POST['ip_addr'], "decimal"), "subnetId" => $_POST['subnetId'], "description" => @$_POST['description'], "dns_name" => @$_POST['dns_name'], "mac" => @$_POST['mac'], "owner" => @$_POST['owner'], "state" => @$_POST['state'], "switch" => @$_POST['switch'], "port" => @$_POST['port'], "note" => @$_POST['note']);
    if (!$Addresses->modify_address($values)) {
        $Result->show("danger", _("Failed to create IP address"), true);
    }
    //accept message
    $values2 = array("id" => $_POST['requestId'], "processed" => 1, "accepted" => 1, "adminComment" => $comment);
    if (!$Admin->object_modify("requests", "edit", "id", $values2)) {
        $Result->show("danger", _("Cannot confirm IP address"), true);
    } else {
        $Result->show("success", _("IP request accepted/rejected"), false);
开发者ID:routenull0,项目名称:phpipam,代码行数:31,代码来源:edit-result.php

示例4: sizeof

         }
         $dns_records[] = "</ul>";
         // if none ignore
         $dns_records = sizeof($dns_records) == 3 ? "" : implode(" ", $dns_records);
     } else {
         $dns_records = "";
     }
 } else {
     $dns_records = "";
     $button = "";
 }
 // add button
 if ($User->settings->enablePowerDNS == 1) {
     // add new button
     if ($Subnets->validate_hostname($addresses[$n]->dns_name) && ($User->isadmin || @$User->user->pdns == "Yes")) {
         $button = "<i class='fa fa-plus-circle fa-gray fa-href editRecord' data-action='add' data-id='" . $Addresses->transform_address($addresses[$n]->ip_addr, "dotted") . "' data-domain_id='" . $addresses[$n]->dns_name . "'></i>";
     } else {
         $button = "";
     }
 }
 # resolve dns name
 $resolve = $DNS->resolve_address($addresses[$n]->ip_addr, $addresses[$n]->dns_name, false, $subnet['nameserverId']);
 print "<td class='{$resolve['class']} hostname'>{$resolve['name']} {$button} {$dns_records}</td>";
 # print firewall address object - mandatory if enabled
 if (in_array('firewallAddressObject', $selected_ip_fields) && $zone) {
     print "<td class='fwzone'>" . $addresses[$n]->firewallAddressObject . "</td>";
 }
 # print description - mandatory
 print "<td class='description'>" . $addresses[$n]->description . "</td>";
 # Print mac address icon!
 if (in_array('mac', $selected_ip_fields)) {
开发者ID:dajo,项目名称:phpipam,代码行数:31,代码来源:print-address-table.php

示例5: array

# fetch subnet
$subnet = (array) $Admin->fetch_object("subnets", "id", $_POST['subnetId']);
/* if action is reject set processed and accepted to 1 and 0 */
if ($_POST['action'] == "reject") {
    //set reject values
    $values = array("id" => $_POST['requestId'], "processed" => 1, "accepted" => 0, "adminComment" => @$_POST['adminComment']);
    if (!$Admin->object_modify("requests", "edit", "id", $values)) {
        $Result->show("danger", _("Failed to reject IP request"), true);
    } else {
        $Result->show("success", _("Request has beed rejected"), false);
    }
} else {
    // fetch subnet
    $subnet_temp = $Addresses->transform_to_dotted($subnet['subnet']) . "/" . $subnet['mask'];
    //verify IP and subnet
    $Addresses->verify_address($Addresses->transform_address($_POST['ip_addr'], "dotted"), $subnet_temp, false, true);
    //check if already existing and die
    if ($Addresses->address_exists($Addresses->transform_address($_POST['ip_addr'], "decimal"), $subnet['id'])) {
        $Result->show("danger", _('IP address already exists'), true);
    }
    //insert to ipaddresses table
    $values = array("action" => "add", "ip_addr" => $Addresses->transform_address($_POST['ip_addr'], "decimal"), "subnetId" => $_POST['subnetId'], "description" => @$_POST['description'], "dns_name" => @$_POST['dns_name'], "mac" => @$_POST['mac'], "owner" => @$_POST['owner'], "state" => @$_POST['state'], "switch" => @$_POST['switch'], "port" => @$_POST['port'], "note" => @$_POST['note']);
    if (!$Addresses->modify_address($values)) {
        $Result->show("danger", _("Failed to create IP address"), true);
    }
    //accept message
    $values = array("id" => $_POST['requestId'], "processed" => 1, "accepted" => 1, "adminComment" => $comment);
    if (!$Admin->object_modify("requests", "edit", "id", $values)) {
        $Result->show("danger", _("Cannot confirm IP address"), true);
    } else {
        $Result->show("success", _("IP request accepted/rejected"), false);
开发者ID:netbuild,项目名称:phpipam,代码行数:31,代码来源:edit-result.php


注:本文中的Addresses::transform_address方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。