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


PHP Addresses::transform_to_dotted方法代码示例

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


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

示例1:

     if ($action !== "delete") {
         if (strlen(@$address['mac']) > 0) {
             if ($User->validate_mac($address['mac']) === false) {
                 $errors[] = _('Invalid MAC address') . "!";
             } else {
                 $address['mac'] = $User->reformat_mac_address($address['mac'], 1);
             }
         }
     }
     # modify action - if delete ok, dynamically reset add / edit -> if IP already exists set edit
     if ($action != "delete") {
         $address['action'] = $Addresses->address_exists($m, $address['subnetId']) === true ? "edit" : "add";
     }
     # if it fails set error log
     if (!$Addresses->modify_address($address, false)) {
         $errors[] = _('Cannot') . ' ' . $address['action'] . ' ' . _('IP address') . ' ' . $Addresses->transform_to_dotted($m);
     }
     # next IP
     $m = gmp_strval(gmp_add($m, 1));
 }
 # print errors if they exist
 if (isset($errors)) {
     $log = $Result->array_to_log($errors);
     $Result->show("danger", $log, false);
     $Log->write("IP address modification", "'Error {$action} range {$address['start']} - {$address['stop']}<br> {$log}", 2);
 } else {
     # reset IP for mailing
     $address['ip_addr'] = $address['start'] . ' - ' . $address['stop'];
     # log and changelog
     $Result->show("success", _("Range") . " {$address['start']} - {$address['stop']} " . _($action) . " " . _("successfull") . "!", false);
     $Log->write("IP address modification", "Range {$address['start']} - {$address['stop']} {$action} successfull!", 0);
开发者ID:routenull0,项目名称:phpipam,代码行数:31,代码来源:address-modify-submit.php

示例2: provided

    $request = (array) $request;
}
# verify permissions
if ($Subnets->check_permission($User->user, $request['subnetId']) != 3) {
    $Result->show("danger", _('You do not have permissions to process this request') . "!", true, true);
}
# set IP address
# if provided (requested from logged in user) check if already in use, if it is warn and set next free
# else get next free
if (strlen($request['ip_addr']) > 0) {
    // check if it exists
    if ($Addresses->address_exists($request['ip_addr'], $request['subnetId'])) {
        $errmsg = "Requested IP address ({$request['ip_addr']}) already used. First available address automatically provided.";
        $errmsg_class = "warning";
        //fetch first free
        $ip_address = $Addresses->transform_to_dotted($Addresses->get_first_available_address($request['subnetId'], $Subnets));
    } else {
        $ip_address = $request['ip_addr'];
    }
} else {
    // fetch first free
    $ip_address = $Addresses->transform_to_dotted($Addresses->get_first_available_address($request['subnetId'], $Subnets));
}
// false
if ($ip_address === false) {
    $ip_address = "";
    $errmsg = "No IP addresses available in requested subnet";
    $errmsg_class = "danger";
}
# set selected address fields array
$selected_ip_fields = explode(";", $User->settings->IPfilter);
开发者ID:martinsv,项目名称:phpipam,代码行数:31,代码来源:edit.php

示例3: 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);
    }
    # 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);
开发者ID:routenull0,项目名称:phpipam,代码行数:31,代码来源:edit-result.php

示例4: 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);
开发者ID:netbuild,项目名称:phpipam,代码行数:31,代码来源:edit-result.php


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