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


PHP Addresses::fetch_subnet_addresses_recursive方法代码示例

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


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

示例1: DNS

    $sort['direction'] = $tmp[1];
    if ($sort['direction'] == "asc") {
        $sort['directionNext'] = "desc";
    } else {
        $sort['directionNext'] = "asc";
    }
    # subnet-related variables
    $subnet = (array) $Subnets->fetch_subnet(null, $_POST['subnetId']);
    //subnet details
    $subnet_detailed = $Subnets->get_network_boundaries($subnet['subnet'], $subnet['mask']);
    //set network boundaries
    $slaves = $Subnets->has_slaves($subnet['id']) ? true : false;
    //check if subnet has slaves and set slaves flag true/false
    # fetch all addresses - sorted
    if ($slaves) {
        $addresses = $Addresses->fetch_subnet_addresses_recursive($subnet['id'], false, $sort['field'], $sort['direction']);
        $slave_subnets = (array) $Subnets->fetch_subnet_slaves($subnet['id']);
    } else {
        $addresses = $Addresses->fetch_subnet_addresses($subnet['id'], $sort['field'], $sort['direction']);
    }
    # set permissions
    $subnet_permission = $Subnets->check_permission($User->user, $subnet['id']);
}
# We need DNS object
$DNS = new DNS($Database, $User->settings);
/* verifications */
# checks
if (sizeof($subnet) == 0) {
    $Result->show("danger", _('Subnet does not exist'), true);
}
//subnet doesnt exist
开发者ID:rtd,项目名称:phpipam,代码行数:31,代码来源:print-address-table.php

示例2: fetch_subnet_addresses_changelog_recursive

 /**
  * Fetches changelog for addresses in subnet for all slave subnets
  *
  * @access public
  * @param mixed $subnetId
  * @param int $limit (default: 50)
  * @return void
  */
 public function fetch_subnet_addresses_changelog_recursive($subnetId, $limit = 50)
 {
     # get all addresses ids
     $ips = array();
     $Addresses = new Addresses($this->Database);
     $ips = $Addresses->fetch_subnet_addresses_recursive($subnetId, false);
     # fetch changelog for IPs
     if (sizeof($ips) > 0) {
         # query
         $query = "select\n\t\t    \t\t\t`u`.`real_name`,`o`.`id`,`o`.`ip_addr`,`o`.`description`,`o`.`id`,`o`.`subnetId`,`c`.`caction`,`c`.`cresult`,`c`.`cdate`,`c`.`cdiff`\n\t\t\t\t\t\tfrom `changelog` as `c`, `users` as `u`, `ipaddresses` as `o`\n\t\t\t\t\t\twhere `c`.`cuser` = `u`.`id` and `c`.`coid`=`o`.`id`\n\t\t\t\t\t\tand (";
         $args = array();
         foreach ($ips as $ip) {
             $query .= "`c`.`coid` = ? or ";
             $args[] = $ip->id;
         }
         $query = substr($query, 0, -3);
         $query .= ") and `c`.`ctype` = 'ip_addr' order by `c`.`cid` desc limit {$limit};";
         # fetch
         try {
             $logs = $this->Database->getObjectsQuery($query, array_filter($args));
         } catch (Exception $e) {
             $this->Result->show("danger", $e->getMessage(), false);
             return false;
         }
         # return result
         return $logs;
     } else {
         return false;
     }
 }
开发者ID:routenull0,项目名称:phpipam,代码行数:38,代码来源:class.Log.php

示例3: elseif

    print "</blockquote>";
} elseif (!isset($out)) {
    print "<hr>";
    print "<blockquote style='margin-top:20px;margin-left:20px;'>";
    print "<p>" . _("No subnet selected for threshold check available") . "</p>";
    print "<small>" . _("No subnet with threshold check available") . "</small>";
    print "</blockquote>";
} else {
    print "<div class='hContent' style='padding:10px;'>";
    // count usage
    foreach ($out as $k => $s) {
        //check if subnet has slaves and set slaves flag true/false
        $slaves = $Subnets->has_slaves($s->id) ? true : false;
        # fetch all addresses and calculate usage
        if ($slaves) {
            $addresses = $Addresses->fetch_subnet_addresses_recursive($s->id, false);
            $slave_subnets = (array) $Subnets->fetch_subnet_slaves($s->id);
            // save count
            $addresses_cnt = gmp_strval(sizeof($addresses));
            # full ?
            if (sizeof($slave_subnets) > 0) {
                foreach ($slave_subnets as $ss) {
                    if ($ss->isFull == 1) {
                        # calculate max
                        $max_hosts = $Subnets->get_max_hosts($ss->mask, $Subnets->identify_address($ss->subnet), true);
                        # count
                        $count_hosts = $Addresses->count_subnet_addresses($ss->id);
                        # add
                        $addresses_cnt = gmp_strval(gmp_add($addresses_cnt, gmp_sub($max_hosts, $count_hosts)));
                    }
                }
开发者ID:korhaldragonir,项目名称:phpipam,代码行数:31,代码来源:threshold.php


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