本文整理汇总了PHP中Result::show方法的典型用法代码示例。如果您正苦于以下问题:PHP Result::show方法的具体用法?PHP Result::show怎么用?PHP Result::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Result
的用法示例。
在下文中一共展示了Result::show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
<?php
/*
* Print resize subnet
*********************/
/* functions */
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database, false);
$Subnets = new Subnets($Database);
$Addresses = new Addresses($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# id must be numeric
if (!is_numeric($_POST['subnetId'])) {
$Result->show("danger", _("Invalid ID"), true);
}
# get subnet details
$subnet_old = $Subnets->fetch_subnet(null, $_POST['subnetId']);
# verify that user has write permissions for subnet
$subnetPerm = $Subnets->check_permission($User->user, $subnet_old->id);
if ($subnetPerm < 3) {
$Result->show("danger", _('You do not have permissions to resize subnet') . '!', true);
}
# verify
$Subnets->subnet_split($subnet_old, $_POST['number'], $_POST['prefix'], $_POST['group'], $_POST['strict']);
# all good
$Result->show("success", _("Subnet splitted ok") . "!", true);
示例2: dirname
* Print edit subnet
*********************/
/* functions */
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database);
$Sections = new Sections($Database);
$Subnets = new Subnets($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# ID must be numeric
if (!is_numeric($_POST['subnetId'])) {
$Result->show("danger", _("Invalid ID"), true, true);
}
# get all groups
$groups = $Admin->fetch_all_objects("userGroups", "g_id");
# get subnet details
$subnet = $Subnets->fetch_subnet(null, $_POST['subnetId']);
?>
<script type="text/javascript">
$(document).ready(function() {
/* bootstrap switch */
var switch_options = {
onText: "Yes",
offText: "No",
onColor: 'default',
示例3: dirname
/* functions */
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database, false);
$Subnets = new Subnets($Database);
$Addresses = new Addresses($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# create csrf token
$csrf = $User->create_csrf_cookie();
# id must be numeric
if (!is_numeric($_POST['subnetId'])) {
$Result->show("danger", _("Invalid ID"), true, true);
}
# get subnet details
$subnet = $Subnets->fetch_subnet(null, $_POST['subnetId']);
# verify that user has write permissions for subnet
$subnetPerm = $Subnets->check_permission($User->user, $subnet->id);
if ($subnetPerm < 3) {
$Result->show("danger", _('You do not have permissions to resize subnet') . '!', true, true);
}
?>
<!-- header -->
<div class="pHeader"><?php
print _('Truncate subnet');
?>
</div>
示例4: ucwords
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database);
$Tools = new Tools($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# create csrf token
$csrf = $User->csrf_cookie("create", "location");
# validate action
$Admin->validate_action($_POST['action'], true);
# get Location object
if ($_POST['action'] != "add") {
$location = $Admin->fetch_object("locations", "id", $_POST['id']);
$location !== false ?: $Result->show("danger", _("Invalid ID"), true, true);
}
# disable edit on delete
$readonly = $_POST['action'] == "delete" ? "readonly" : "";
$link = $readonly ? false : true;
# fetch custom fields
$custom = $Tools->fetch_custom_fields('locations');
?>
<!-- header -->
<div class="pHeader"><?php
print ucwords(_("{$_POST['action']}"));
?>
<?php
print _('Location');
示例5: dirname
/* functions */
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database);
$Sections = new Sections($Database);
$Subnets = new Subnets($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# create csrf token
$csrf = $User->csrf_cookie("create", "permissions");
# ID must be numeric
if (!is_numeric($_POST['subnetId'])) {
$Result->show("danger", _("Invalid ID"), true, true);
}
# get all groups
$groups = $Admin->fetch_all_objects("userGroups", "g_name");
# get subnet details
$subnet = $Subnets->fetch_subnet(null, $_POST['subnetId']);
?>
<script type="text/javascript">
$(document).ready(function() {
/* bootstrap switch */
var switch_options = {
onText: "Yes",
offText: "No",
onColor: 'default',
示例6: dirname
* add, edit and delete firewall zones mappings
**************************************************/
# functions
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize classes
$Database = new Database_PDO();
$User = new User($Database);
$Subnets = new Subnets($Database);
$Tools = new Tools($Database);
$Result = new Result();
$Zones = new FirewallZones($Database);
# validate session parameters
$User->check_user_session();
# validate $_POST['id'] values
if (!preg_match('/^[0-9]+$/i', $_POST['id'])) {
$Result->show("danger", _("Invalid ID. Do not manipulate the POST values!"), true);
}
# validate $_POST['action'] values
if ($_POST['action'] != 'add' && $_POST['action'] != 'edit' && $_POST['action'] != 'delete') {
$Result->show("danger", _("Invalid action. Do not manipulate the POST values!"), true);
}
# disable edit on delete
$readonly = $_POST['action'] == "delete" ? "disabled" : "";
# fetch all firewall zones
$firewallZones = $Zones->get_zones();
# fetch settings
$firewallZoneSettings = json_decode($User->settings->firewallZoneSettings, true);
# fetch all devices
$devices = $Tools->fetch_multiple_objects("devices", "type", $firewallZoneSettings['deviceType']);
# fetch old mapping
if ($_POST['action'] != 'add') {
示例7: dirname
* add, edit and delete firewall zones
******************************************/
# functions
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize classes
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database);
$Subnets = new Subnets($Database);
$Result = new Result();
$Zones = new FirewallZones($Database);
# validate session parameters
$User->check_user_session();
# validate $_POST['id'] values
if (!preg_match('/^[0-9]+$/i', $_POST['id'])) {
$Result->show("danger", _("Invalid ID. Do not manipulate the POST values!"), true);
}
# validate $_POST['action'] values
if ($_POST['action'] != 'add' && $_POST['action'] != 'edit' && $_POST['action'] != 'delete') {
$Result->show("danger", _("Invalid action. Do not manipulate the POST values!"), true);
}
# fetch module settings
$firewallZoneSettings = json_decode($User->settings->firewallZoneSettings, true);
# fetch old zone
if ($_POST['action'] != 'add') {
$firewallZone = $Zones->get_zone($_POST['id']);
}
# disable edit on delete
$readonly = $_POST['action'] == "delete" ? "readonly" : "";
?>
示例8: dirname
/* functions */
require dirname(__FILE__) . '/../../functions/functions.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Install = new Install($Database);
$Tools = new Tools($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# admin user is required
$User->is_admin(true);
# try to upgrade database
if ($Install->upgrade_database() === true) {
# print success
$Result->show("success", _("Database upgraded successfully! <a class='btn btn-sm btn-default' href='" . create_link('dashboard') . "'>Dashboard</a>"), false);
# migrate settings
$User->migrate_domain_settings();
$User->migrate_ldap_settings();
# check for possible errors
if (sizeof($errors = $Tools->verify_database()) > 0) {
$esize = sizeof($errors['tableError']) + sizeof($errors['fieldError']);
print '<div class="alert alert-danger">' . "\n";
# print table errors
if (isset($errors['tableError'])) {
print '<strong>' . _('Missing table') . 's:</strong>' . "\n";
print '<ul class="fix-table">' . "\n";
foreach ($errors['tableError'] as $table) {
print '<li>' . $table . '</li>' . "\n";
}
print '</ul>' . "\n";
示例9: substr
# verify that user is logged in
$User->check_user_session();
//strip AS if provided, to get just the number
if (substr($_POST['as'], 0, 2) == "AS" || substr($_POST['as'], 0, 2) == "as") {
$_POST['as'] = substr($_POST['as'], 2);
}
# fetch subnets form ripe
$subnet = $Admin->ripe_fetch_subnets($_POST['as']);
# fetch all sections
$sections = $Admin->fetch_all_objects("sections", "id");
$vlans = $Admin->fetch_all_objects("vlans", "vlanId");
$vrfs = $Admin->fetch_all_objects("vrf", "vrfId");
//none found
if (sizeof(@$subnet) == 0) {
print "<hr>";
$Result->show("danger alert-absolute", _('No subnets found') . '!', true);
} else {
//form
print '<form name="asImport" id="asImport">';
//table
print '<table class="asImport table table-striped table-condensed table-top table-auto">';
//headers
print '<tr>';
print ' <th colspan="5">' . _('I found the following routes belonging to AS') . ' ' . $_POST['as'] . ':</th>';
print '</tr> ';
print "<tr>";
print "\t<th></th>";
print "\t<th>" . _('Subnet') . "</th>";
print "\t<th>" . _('select section') . "</th>";
print "\t<th>" . _('Description') . "</th>";
print "\t<th>" . _('VLAN') . "</th>";
示例10: dirname
/**
* remove item from nat
************************************************/
/* functions */
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database);
$Tools = new Tools($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# get NAT object
$nat = $Admin->fetch_object("nat", "id", $_POST['id']);
$nat !== false ?: $Result->show("danger", _("Invalid ID"), true);
# static NAT checks
if ($nat->type == "static") {
// static NAT can only have IP address
if ($_POST['object_type'] != "ipaddresses") {
$Result->show("danger", _("Static NAT can only contain IP address"), true);
}
// decode
$nat_src = json_decode($nat->src, true);
$nat_dst = json_decode($nat->dst, true);
// validate all objects
if (sizeof(@$nat_src['ipaddresses']) > 0) {
foreach ($nat_src['ipaddresses'] as $ik => $iv) {
if ($Tools->fetch_object("ipaddresses", "id", $iv) === false) {
unset($nat_src['ipaddresses'][$ik]);
}
示例11: User
$Database = new Database_PDO();
$User = new User($Database);
$Tools = new Tools($Database);
$Subnets = new Subnets($Database);
$Result = new Result();
}
# user must be authenticated
$User->check_user_session();
# set size parameters
$height = 200;
$slimit = 10;
# if direct request include plot JS
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") {
# get widget details
if (!($widget = $Tools->fetch_object("widgets", "wfile", $_REQUEST['section']))) {
$Result->show("danger", _("Invalid widget"), true);
}
# reset size and limit
$height = 350;
$slimit = 20;
# include flot JS
print '<script language="javascript" type="text/javascript" src="js/1.2/flot/jquery.flot.js"></script>';
print '<script language="javascript" type="text/javascript" src="js/1.2/flot/jquery.flot.categories.js"></script>';
print '<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="js/1.2/flot/excanvas.min.js"></script><![endif]-->';
# and print title
print "<div class='container'>";
print "<h4 style='margin-top:40px;'>{$widget->wtitle}</h4><hr>";
print "</div>";
}
$type = "IPv4";
# get subnets statistic
示例12: Result
$Result = new Result();
}
# user must be authenticated
$User->check_user_session();
# if direct request that redirect to tools page
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") {
header("Location: " . create_link("tools", "changelog"));
}
# changelog to syslog
if ($User->settings->log != "syslog") {
/* get logs */
$clogs = $Log->fetch_all_changelogs(false, "", 50);
}
# syslog
if ($User->settings->log == "syslog") {
$Result->show("warning", _("Changelog files are sent to syslog"), false);
} elseif (sizeof($clogs) == 0) {
print "<blockquote style='margin-top:20px;margin-left:20px;'>";
print "<p>" . _("No changelogs available") . "</p>";
print "<small>" . _("No changelog entries are available") . "</small>";
print "</blockquote>";
} else {
# printout
print "<table class='table changelog table-hover table-top table-condensed'>";
# headers
print "<tr>";
print "\t<th>" . _('User') . "</th>";
print "\t<th>" . _('Type') . "</th>";
print "\t<th>" . _('Object') . "</th>";
print "\t<th>" . _('Date') . "</th>";
print "\t<th class='hidden-xs'>" . _('Change') . "</th>";
示例13: dirname
/**
* Script to display usermod result
*************************************/
/* functions */
require dirname(__FILE__) . '/../../../functions/functions.php';
require dirname(__FILE__) . "/../../../functions/adLDAP/src/adLDAP.php";
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# fetch server
$server = $Admin->fetch_object("usersAuthMethod", "id", $_POST['server']);
$server !== false ?: $Result->show("danger", _("Invalid server ID"), true);
//parse parameters
$params = json_decode($server->params);
//no login parameters
if (strlen(@$params->adminUsername) == 0 || strlen(@$params->adminPassword) == 0) {
$Result->show("danger", _("Missing credentials"), true);
}
//at least 2 chars
if (strlen($_POST['dfilter']) < 2) {
$Result->show("danger", _('Please enter at least 2 characters'), true);
}
//open connection
try {
if ($server->type == "NetIQ") {
$params->account_suffix = "";
}
示例14: unset
# for edit check old details
if ($_POST['action'] == "edit" || $_POST['action'] == "delete") {
# old
$agent_old = $Admin->fetch_object("scanAgents", "id", $_POST['id']);
// invalid id
if ($agent_old === false) {
$error[] = "Invalid agent Id";
}
// remove type and code if direct
if (@$agent_old->type == "direct") {
unset($_POST['type'], $_POST['code']);
}
}
# die if direct and delete
if (@$agent_old->type == "direct" && $_POST['action'] == "delete") {
$Result->show("danger", _("Cannot remove localhost scan agent"), true);
}
# checks for edit / add
if ($_POST['action'] != "delete") {
# code must be exactly 32 chars long and alfanumeric if app_security = crypt
if (@$agent_old->type != "direct") {
if (strlen($_POST['code']) != 32 || !ctype_alnum($_POST['code'])) {
$error[] = "Invalid agent code";
}
}
# name must be more than 2 and alphanumberic
if (strlen($_POST['name']) == 0) {
$error[] = "Invalid agent name";
}
}
# die if errors
示例15: dirname
/**
* Script to replace fields in IP address list
***********************************************/
/* functions */
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
//verify post
if (empty($_POST['search'])) {
$Result->show("danger", _('Please enter something in search field') . '!', true);
}
//if device verify that it exists
if ($_POST['field'] == "switch") {
if (!($device1 = $Admin->fetch_object("devices", "hostname", $_POST['search']))) {
$Result->show("danger alert-absolute", _('Switch') . ' "<i>' . $_POST['search'] . '</i>" ' . _('does not exist, first create switch under admin menu') . '!', true);
}
if (!($device2 = $Admin->fetch_object("devices", "hostname", $_POST['replace']))) {
$Result->show("danger alert-absolute", _('Switch') . ' "<i>' . $_POST['search'] . '</i>" ' . _('does not exist, first create switch under admin menu') . '!', true);
}
//replace posts
$_POST['search'] = $device1->id;
$_POST['replace'] = $device2->id;
}
# update
$Admin->replace_fields($_POST['field'], $_POST['search'], $_POST['replace']);