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


PHP Subnets::fetch_section_subnets方法代码示例

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


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

示例1: array

foreach ($all_vrfs as $vrf) {
    //cast
    $vrf = (array) $vrf;
    $vrf_data[$vrf['name']] = $vrf;
    $vrf_data[$vrf['rd']] = $vrf;
    # add also RD as VRF name, will allow matches against both name and RD
}
# fetch all sections and load all subnets
$all_sections = $Sections->fetch_all_sections();
# get all subnets in all sections
$edata = array();
$section_names = array();
foreach ($all_sections as $section) {
    $section = (array) $section;
    $section_names[$section['name']] = $section;
    $section_subnets = $Subnets->fetch_section_subnets($section['id']);
    # skip empty sections
    if (sizeof($section_subnets) == 0) {
        continue;
    }
    foreach ($section_subnets as $subnet) {
        $subnet = (array) $subnet;
        # load whole record in array
        $edata[$section['id']][$subnet['vrfId']][$subnet['ip']][$subnet['mask']] = $subnet;
        $edata[$section['id']][$subnet['vrfId']][$subnet['ip']][$subnet['mask']]['type'] = $Subnets->identify_address($subnet['ip']);
    }
}
#print_r($vlan_data);
$rows = "";
$counters = array();
$ndata = array();
开发者ID:martinsv,项目名称:phpipam,代码行数:31,代码来源:import-subnets-check.php

示例2: section_delete

 /**
  * Delete section, subsections, subnets and ip addresses
  *
  * @access private
  * @param mixed $values
  * @return void
  */
 private function section_delete($values)
 {
     # subnets class
     $Subnets = new Subnets($this->Database);
     # save old values
     $old_section = $this->fetch_section("id", $values['id']);
     # check for subsections and store all ids
     $all_ids = $this->get_all_section_and_subsection_ids($values['id']);
     //array of section + all subsections
     # truncate and delete all subnets in all sections, than delete sections
     foreach ($all_ids as $id) {
         $section_subnets = $Subnets->fetch_section_subnets($id);
         if (sizeof($section_subnets) > 0) {
             foreach ($section_subnets as $ss) {
                 //delete subnet
                 $Subnets->modify_subnet("delete", array("id" => $ss->id));
             }
         }
         # delete all sections
         try {
             $this->Database->deleteRow("sections", "id", $id);
         } catch (Exception $e) {
             $this->Log->write("Section {$old_section->name} delete", "Failed to delete section {$old_section->name}<hr>" . $e->getMessage() . "<hr>" . $this->array_to_log($this->reformat_empty_array_fields($values, "NULL")), 2);
             $this->Result->show("danger", _("Error: ") . $e->getMessage(), false);
             return false;
         }
     }
     # write changelog
     $this->Log->write_changelog('section', "delete", 'success', $old_section, array());
     # log
     $this->Log->write("Section {$old_section->name} delete", "Section {$old_section->name} deleted<hr>" . $this->array_to_log($this->reformat_empty_array_fields((array) $old_section)), 0);
     return true;
 }
开发者ID:martinsv,项目名称:phpipam,代码行数:40,代码来源:class.Sections.php

示例3: Subnets

$Subnets = new Subnets($Database);
$Addresses = new Addresses($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# If confirm is not set print delete warning
if ($_POST['action'] == "delete" && !isset($_POST['deleteconfirm'])) {
    //for ajax to prevent reload
    print "<div style='display:none'>alert alert-danger</div>";
    //result
    print "<div class='alert alert-warning'>";
    //fetch all subsections
    $subsections = $Sections->fetch_subsections($_POST['id']);
    //print what will be deleted
    if (sizeof($subsections) > 0) {
        $subnets = $Subnets->fetch_section_subnets($_POST['id']);
        //fetch all subnets in section
        $num_subnets = sizeof($subnets);
        //number of subnets to be deleted
        if (sizeof($subnets) > 0) {
            foreach ($subnets as $s) {
                $out[] = $s;
            }
        }
        //fetch subsection subnets
        foreach ($subsections as $ss) {
            $subsection_subnets = $Subnets->fetch_section_subnets($ss->id);
            //fetch all subnets in subsection
            if (sizeof($subsection_subnets) > 0) {
                foreach ($subsection_subnets as $sss) {
                    $out[] = $sss;
开发者ID:martinsv,项目名称:phpipam,代码行数:31,代码来源:edit-result.php

示例4: array

    $vrf = (array) $vrf;
    $vrf_name[$vrf['vrfId']] = $vrf['name'];
}
# Precompute masks values, to avoid too much CPU load
$masks = array();
for ($i = 0; $i <= 32; $i++) {
    $masks["IPv4"][$i] = 0xffffffff >> 32 - $i << 32 - $i;
}
# IPv4 masks, long
for ($i = 0; $i <= 128; $i++) {
    $masks["IPv6"][$i] = str_repeat('1', $i) . str_repeat('0', 128 - $i);
}
# IPv6 masks, bin str
# Read IPs for the sections we need to order
foreach ($rlist as $sect_id => $sect_check) {
    $section_subnets = $Subnets->fetch_section_subnets($sect_id);
    # skip empty sections
    if (sizeof($section_subnets) == 0) {
        continue;
    }
    $isFolder[$sect_id] = array();
    foreach ($section_subnets as &$subnet) {
        $subnet = (array) $subnet;
        $subnet['ip'] = $Subnets->transform_to_dotted($subnet['subnet']);
        $subnet['type'] = $Subnets->identify_address($subnet['ip']);
        # Precompute subnet in AND format (long for IPv4 and bin str for IPv6)
        $subnet['andip'] = $subnet['type'] == "IPv4" ? $subnet['subnet'] : my_ip2Bin($pi6, $subnet['ip']);
        # Add to array
        $edata[$sect_id][] = $subnet;
        $isFolder[$sect_id][$subnet['id']] = $subnet['isFolder'];
    }
开发者ID:MrWoodward,项目名称:phpipam,代码行数:31,代码来源:import-recompute-logic.php


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