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


PHP Subnets::fetch_subnet_slaves_recursive方法代码示例

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


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

示例1: foreach

/* If no errors are present execute request */
if (sizeof(@$errors) > 0) {
    print '<div class="alert alert-danger"><strong>' . _('Please fix following problems') . '</strong>:';
    foreach ($errors as $error) {
        print "<br>" . $error;
    }
    print '</div>';
    die;
} elseif ($_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'>";
    # print what will be deleted
    //fetch all slave subnets
    $Subnets->fetch_subnet_slaves_recursive($_POST['subnetId']);
    $subcnt = sizeof($Subnets->slaves);
    foreach ($Subnets->slaves as $s) {
        $slave_array[$s] = $s;
    }
    $ipcnt = $Addresses->count_addresses_in_multiple_subnets($slave_array);
    print "<strong>" . _("Warning") . "</strong>: " . _("I will delete") . ":<ul>";
    print "\t<li>{$subcnt} " . _("subnets") . "</li>";
    if ($ipcnt > 0) {
        print "\t<li>{$ipcnt} " . _("IP addresses") . "</li>";
    }
    print "</ul>";
    print "<hr><div style='text-align:right'>";
    print _("Are you sure you want to delete above items?") . " ";
    print "<div class='btn-group'>";
    print "\t<a class='btn btn-sm btn-danger editSubnetSubmitDelete' id='editSubnetSubmitDelete'>" . _("Confirm") . "</a>";
开发者ID:jselan,项目名称:phpipam,代码行数:31,代码来源:edit-result.php

示例2: fetch_subnet_slaves_changlog_entries_recursive

 /**
  * Fetches changelog entries for all slave subnets recursive
  *
  * @access public
  * @param mixed $subnetId
  * @param int $limit (default: 50)
  * @return void
  */
 public function fetch_subnet_slaves_changlog_entries_recursive($subnetId, $limit = 50)
 {
     # limit check
     if (!is_numeric($limit)) {
         $this->Result->show("danger", "Invalid limit", true);
         return false;
     }
     # $subnetId check
     if (!is_numeric($subnetId)) {
         $this->Result->show("danger", "Invalid subnet Id", true);
         return false;
     }
     # fetch all slave subnet ids
     $Subnets = new Subnets($this->Database);
     $Subnets->reset_subnet_slaves_recursive();
     $Subnets->fetch_subnet_slaves_recursive($subnetId);
     # remove master subnet ID
     $key = array_search($subnetId, $Subnets->slaves);
     unset($Subnets->slaves[$key]);
     $Subnets->slaves = array_unique($Subnets->slaves);
     # if some slaves are present get changelog
     if (sizeof($Subnets->slaves) > 0) {
         # set query
         $query = "select\n\t\t\t\t\t\t`u`.`real_name`,`o`.`sectionId`,`o`.`subnet`,`o`.`mask`,`o`.`isFolder`,`o`.`description`,`o`.`id`,`c`.`caction`,`c`.`cresult`,`c`.`cdate`,`c`.`cdiff`  from `changelog` as `c`, `users` as `u`, `subnets` 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 (";
         foreach ($Subnets->slaves as $slaveId) {
             if (!isset($args)) {
                 $args = array();
             }
             $query .= "`c`.`coid` = ? or ";
             $args[] = $slaveId;
             //set keys
         }
         $query = substr($query, 0, -3);
         $query .= ") and `c`.`ctype` = 'subnet' order by `c`.`cid` desc limit {$limit};";
         # fetch
         try {
             $logs = $this->Database->getObjectsQuery($query, $args);
         } catch (Exception $e) {
             $this->Result->show("danger", $e->getMessage(), false);
             return false;
         }
         # return result
         return $logs;
     } else {
         return false;
     }
 }
开发者ID:routenull0,项目名称:phpipam,代码行数:55,代码来源:class.Log.php

示例3: _

$Tools = new Tools($Database);
$Addresses = new Addresses($Database);
# verify that user is logged in
$User->check_user_session();
# create csrf token
$csrf = $User->csrf_cookie("create", "address");
# validate action
$Tools->validate_action($_POST['action']);
# validate post
is_numeric($_POST['subnetId']) ?: $Result->show("danger", _("Invalid ID"), true);
is_numeric($_POST['id']) || strlen($_POST['id']) == 0 ?: $Result->show("danger", _("Invalid ID"), true);
# fetch address and subnet
$address = (array) $Addresses->fetch_address(null, $_POST['id']);
$subnet = (array) $Subnets->fetch_subnet(null, $_POST['subnetId']);
# fetch all slave subnets
$Subnets->fetch_subnet_slaves_recursive($subnet['id']);
?>

<!-- header -->
<div class="pHeader"><?php 
print _('Move IP address to different subnet');
?>
</div>

<!-- content -->
<div class="pContent editIPAddress">

	<!-- IP address modify form -->
	<form class="editipaddress" name="editipaddress">
	<!-- edit IP address table -->
	<table id="editipaddress" class="table table-noborder table-condensed">
开发者ID:routenull0,项目名称:phpipam,代码行数:31,代码来源:move-address.php


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