本文整理汇总了PHP中OptionalPageArguments函数的典型用法代码示例。如果您正苦于以下问题:PHP OptionalPageArguments函数的具体用法?PHP OptionalPageArguments怎么用?PHP OptionalPageArguments使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OptionalPageArguments函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckLoginOrDie
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
include "defs.php3";
#
# Only known and logged in users can do this.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
#
# Verify page arguments
#
$optargs = OptionalPageArguments("sortby", PAGEARG_STRING);
#
# Standard Testbed Header
#
PAGEHEADER("Emulab Site List");
if (!($isadmin || OPSGUY() || STUDLY())) {
USERERROR("Cannot view site list.", 1);
}
if (!isset($sortby)) {
$sortby = "created";
}
$sortclause = "";
if ($sortby == "created") {
$sortclause = "order by created";
} elseif ($sortby == "urn") {
$sortclause = "order by urn";
示例2: sajax_init
include "defs.php3";
include_once "template_defs.php";
require "Sajax.php";
sajax_init();
sajax_export("Show", "GraphChange");
#
# Only known and logged in users ...
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
#
# Verify page arguments
#
$reqargs = RequiredPageArguments("template", PAGEARG_TEMPLATE);
$optargs = OptionalPageArguments("action", PAGEARG_STRING, "show", PAGEARG_STRING, "confirmed", PAGEARG_STRING);
if (!($experiment = $template->GetExperiment())) {
TBERROR("Could not find experiment object for template!", 1);
}
# Need these below
$guid = $template->guid();
$vers = $template->vers();
$pid = $template->pid();
$eid = $template->eid();
$tid = $template->tid();
$exptidx = $experiment->idx();
$unix_gid = $experiment->UnixGID();
$this_url = CreateURL("template_show", $template);
$project = $template->GetProject();
$unix_pid = $project->unix_gid();
#
示例3: or
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
require "defs.php3";
#
# Verify page arguments.
#
$optargs = OptionalPageArguments("submit", PAGEARG_STRING, "query", PAGEARG_STRING);
if (!isset($query) || $query == "Search Documentation") {
$query = "";
} else {
$query = urldecode($query);
$query = preg_replace("/[\\ ]+/", "+", $query);
}
header("Location: http://wiki.emulab.net/@@search?SearchableText={$query}");
?>
示例4: Copyright
#
# Copyright (c) 2009 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
include "../defs.php3";
include "usermap.php";
$optargs = OptionalPageArguments("fullscreen", PAGEARG_BOOLEAN);
if (isset($fullscreen)) {
draw_usermap($USERMAP_TYPE_FULLSCREEN);
} else {
draw_usermap($USERMAP_TYPE_NORMAL);
}
示例5: CheckLoginOrDie
#
include "defs.php3";
include_once "geni_defs.php";
include "table_defs.php";
#
#
# Only known and logged in users allowed.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
$defaultsearchstring = 'Search CM for URN or IP or MAC';
#
# Verify Page Arguments.
#
$optargs = OptionalPageArguments("showtype", PAGEARG_STRING, "query", PAGEARG_STRING);
$showtypes = array();
if (isset($query) && $query != $defaultsearchstring) {
$showtypes[] = "cm";
} elseif (!isset($showtype)) {
$showtypes[] = "cm";
$showtypes[] = "sa";
$showtypes[] = "ch";
} else {
if (!($showtype == "sa" || $showtype == "cm" || $showtype == "ch")) {
USERERROR("Improper argument: showtype={$showtype}", 1);
}
$showtypes[] = $showtype;
}
#
# Standard Testbed Header
示例6: handle_error
$session_errorhandler = 'handle_error';
function handle_error($message, $death)
{
SPITERROR(400, $message);
}
#
# Must be SSL, even though we do not require an account login.
#
if (!isset($SSL_PROTOCOL)) {
SPITERROR(400, "Must use https:// to access this page!");
}
#
# Verify page arguments.
#
$reqargs = RequiredPageArguments("image", PAGEARG_IMAGE, "access_key", PAGEARG_STRING);
$optargs = OptionalPageArguments("stamp", PAGEARG_INTEGER);
#
# A cleanup function to keep the child from becoming a zombie, since
# the script is terminated, but the children are left to roam.
#
$fp = 0;
function SPEWCLEANUP()
{
global $fp;
if (!$fp || !connection_aborted()) {
exit;
}
pclose($fp);
exit;
}
set_time_limit(0);
示例7: OptionalPageArguments
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
require "defs.php3";
#
# Verify page arguments.
#
$optargs = OptionalPageArguments("printable", PAGEARG_BOOLEAN);
if (!isset($printable)) {
$printable = 0;
}
#
# Standard Testbed Header
#
if (!$printable) {
PAGEHEADER("Emulab Copyright Notice");
}
if ($printable) {
#
# Need to spit out some header stuff.
#
echo "<html>\n <head>\n <title>Copyright Notice</title>\n \t <link rel='stylesheet' href='tbstyle-plain.css' type='text/css'>\n </head>\n <body>\n";
} else {
示例8: define
define("WASTATUS_IPADDRINUSE", 105);
define("WASTATUS_MUSTUSESSL", 106);
define("WASTATUS_OTHER", 199);
#
# Spit back a text message we can display to the user on the console
# of the node running the checkin. We could return an http error, but
# that would be of no help to the user on the other side.
#
function SPITSTATUS($status)
{
header("Content-Type: text/plain");
echo "emulab_status={$status}\n";
}
# Required arguments
$reqargs = RequiredPageArguments("IP", PAGEARG_STRING, "privkey", PAGEARG_STRING);
$optargs = OptionalPageArguments("hostname", PAGEARG_STRING);
# Must use https,
if (!isset($_SERVER["SSL_PROTOCOL"])) {
SPITSTATUS(WASTATUS_MUSTUSESSL);
return;
}
if (!preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/', $IP) || !preg_match('/^[\\w]+$/', $privkey) || isset($hostname) && !preg_match('/^[-\\w\\.]+$/', $hostname)) {
SPITSTATUS(WASTATUS_INVALIDARGS);
return;
}
#
# Make sure this is a valid privkey before we invoke the backend.
#
$query_result = DBQueryFatal("select IP from widearea_nodeinfo where privkey='{$privkey}'");
if (!mysql_num_rows($query_result)) {
SPITSTATUS(WASTATUS_BADPRIVKEY);
示例9: SPITFORM
SPITFORM($formfields, $errors);
PAGEFOOTER();
die("");
}
#
# Only known and logged in users can begin experiments.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
# Does not return if this a request.
include "showlogfile_sup.php3";
#
# Verify page arguments.
#
$optargs = OptionalPageArguments("view_style", PAGEARG_STRING, "beginexp", PAGEARG_STRING, "formfields", PAGEARG_ARRAY, "nsref", PAGEARG_INTEGER, "guid", PAGEARG_INTEGER, "copyid", PAGEARG_INTEGER);
#
# Handle pre-defined view styles
#
unset($view);
if (isset($view_style) && $view_style == "plab") {
$view['hide_proj'] = $view['hide_group'] = $view['hide_swap'] = $view['hide_preload'] = $view['hide_batch'] = $view['hide_linktest'] = $view['quiet'] = $view['plab_ns_message'] = $view['plab_descr'] = 1;
}
include "beginexp_form.php3";
# Need this below;
$idleswaptimeout = TBGetSiteVar("idle/threshold");
$autoswap_max = TBGetSiteVar("general/autoswap_max");
#
# See what projects the uid can create experiments in. Must be at least one.
#
$projlist = $this_user->ProjectAccessList($TB_PROJECT_CREATEEXPT);
示例10: CheckLoginOrDie
#
# }}}
#
include "defs.php3";
include_once "template_defs.php";
#
# Only known and logged in users.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
#
# Verify page arguments.
#
$reqargs = RequiredPageArguments("instance", PAGEARG_INSTANCE);
$optargs = OptionalPageArguments("canceled", PAGEARG_BOOLEAN, "referrer", PAGEARG_STRING, "confirmed", PAGEARG_BOOLEAN);
$template = $instance->GetTemplate();
if (isset($canceled) && $canceled) {
header("Location: " . CreateURL("template_show", $template));
return;
}
# Need these below.
$guid = $template->guid();
$vers = $template->vers();
$pid = $template->pid();
$eid = $instance->eid();
$iid = $instance->id();
$unix_gid = $template->UnixGID();
$exptidx = $instance->exptidx();
$project = $template->GetProject();
$unix_pid = $project->unix_gid();
示例11: CheckLoginOrDie
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
require "defs.php3";
#
#
# Only known and logged in users allowed.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
#
# Verify Page Arguments.
#
$optargs = OptionalPageArguments("resource", PAGEARG_STRING, "getdata", PAGEARG_BOOLEAN);
# if you change any of the resource queries, you must change these arrays!
$resources = array("project", "experiment", "user", "nodetype");
$fields = array();
$fields["project"] = array("pcs" => array("type" => "size", "data" => "count"), "exps" => array("type" => "color", "data" => "count"));
$fields["experiment"] = array("pcs" => array("type" => "size", "data" => "count"), "idle" => array("type" => "color", "data" => "time"), "duration" => array("type" => "color", "data" => "time"));
$fields["user"] = array("pcs" => array("type" => "size", "data" => "count"), "exps" => array("type" => "color", "data" => "count"));
$fields["nodetype"] = array("experiment" => array("type" => "multi", "data" => "text"), "pcs" => array("type" => "size", "data" => "count"), "idle" => array("type" => "color", "data" => "time"), "duration" => array("type" => "color", "data" => "time"));
$defResource = "experiment";
$defColorField = "idle";
# resource queries
$queries = array();
$queries["project"] = "select r.pid as project,count(r.node_id) as pcs," . " count(distinct r.eid) as exps" . " from reserved as r" . " left join nodes as n on r.node_id=n.node_id" . " left join node_types as nt on n.type=nt.type" . " left join experiments as e on (r.pid=e.pid and r.eid=e.eid)" . " where nt.class='pc'" . " and !(r.pid='emulab-ops' and e.noswap_reason='System Experiment')" . " group by r.pid order by pcs desc";
$queries["experiment"] = "select concat_ws(' / ',r.pid,r.eid) as experiment," . " count(r.node_id) as pcs," . " min(unix_timestamp(now()) - unix_timestamp(greatest(na.last_tty_act,na.last_net_act,na.last_cpu_act,na.last_ext_act))) as idle," . " max(unix_timestamp(now()) - unix_timestamp(e.expt_swapped)) as duration" . " from reserved as r" . " left join nodes as n on r.node_id=n.node_id" . " left join node_types as nt on n.type=nt.type" . " left join node_activity as na on r.node_id=na.node_id" . " left join experiments as e on (r.pid=e.pid and r.eid=e.eid)" . " where nt.class='pc'" . " and !(r.pid='emulab-ops' and e.noswap_reason='System Experiment')" . " group by r.pid,r.eid order by pcs desc";
$queries["user"] = "select u.uid as user,count(r.node_id) as pcs," . " count(distinct e.eid) as exps" . " from reserved as r" . " left join nodes as n on r.node_id=n.node_id" . " left join node_types as nt on n.type=nt.type" . " left join experiments as e on (r.pid=e.pid and r.eid=e.eid)" . " left join users as u on e.swapper_idx=u.uid_idx" . " where nt.class='pc'" . " and !(r.pid='emulab-ops' and e.noswap_reason='System Experiment')" . " group by (u.uid) order by pcs desc";
$queries["nodetype"] = "select n.type as nodetype," . " concat_ws(' / ',r.pid,r.eid) as experiment," . " count(distinct r.node_id) as pcs," . " min(unix_timestamp(now()) - unix_timestamp(greatest(na.last_tty_act,na.last_net_act,na.last_cpu_act,na.last_ext_act))) as idle," . " (unix_timestamp(now()) - unix_timestamp(e.expt_swapped)) as duration" . " from reserved as r" . " left join experiments as e on (r.pid=e.pid and r.eid=e.eid)" . " left join nodes as n on r.node_id=n.node_id" . " left join node_types as nt on n.type=nt.type" . " left join node_activity as na on r.node_id=na.node_id" . " where nt.class='pc'" . " group by n.type,r.pid,r.eid order by n.type,pcs desc";
示例12: CheckLoginOrDie
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
include "defs.php3";
include_once "template_defs.php";
#
# Only known and logged in users.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
#
# Verify page arguments.
#
$optargs = OptionalPageArguments("instance", PAGEARG_INSTANCE, "template", PAGEARG_TEMPLATE, "canceled", PAGEARG_BOOLEAN, "confirmed", PAGEARG_BOOLEAN, "referrer", PAGEARG_STRING, "runidx", PAGEARG_INTEGER, "tag", PAGEARG_STRING, "overwrite", PAGEARG_BOOLEAN, "spew", PAGEARG_BOOLEAN);
#
# An instance might be a current or historical. If its a template, use
# the underlying experiment of the template.
#
if (isset($instance)) {
$template = $instance->GetTemplate();
} elseif (!isset($template)) {
PAGEARGERROR("Must provide a template or an instance to export");
}
if (isset($canceled) && $canceled) {
if (isset($instance)) {
header("Location: " . CreateURL("template_show", $template));
} else {
header("Location: " . CreateURL("template_show", $instance));
}
示例13: CheckLoginOrDie
#
include "defs.php3";
include_once "node_defs.php";
#
# Only known and logged in users can do this.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
if (!$isadmin && !STUDLY()) {
USERERROR("You are not allowed to view this page!", 1);
}
#
# Verify page arguments.
#
$optargs = OptionalPageArguments("type", PAGEARG_STRING);
#
# Standard Testbed Header
#
PAGEHEADER("Node Control Center");
$query_result = DBQueryFatal("select n.inception,util.*, " . " UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(n.inception) as age " . " from node_utilization as util " . "left join nodes as n on n.node_id=util.node_id " . "left join node_types as t on t.type=n.type " . "where n.inception is not null and t.class='pc' and " . " role='testnode'" . "order BY priority");
if (mysql_num_rows($query_result) == 0) {
echo "<center>Oops, no nodes to show you!</center>";
PAGEFOOTER();
exit;
}
echo "<center>\n <table id='nodetable' align=center cellpadding=2 border=1>\n <thead class='sort'>\n <tr>\n <th>Node ID</th>\n <th>Inception Date</th>\n <th align=center>Age<br>(seconds)</th>\n <th align=center>Free<br>(seconds)</th>\n <th align=center>Free<br>(percent)</th>\n <th align=center>Alloc<br>(seconds)</th>\n <th align=center>Alloc<br>(percent)</th>\n <th align=center>Down<br>(seconds)</th>\n <th align=center>Down<br>(percent)</th>\n </tr>\n </thead>\n";
while ($row = mysql_fetch_array($query_result)) {
$node_id = $row["node_id"];
$inception = $row["inception"];
$age = $row["age"];
示例14: RequiredPageArguments
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
require "defs.php3";
#
# Verify page arguments.
#
$reqargs = RequiredPageArguments("user", PAGEARG_USER, "key", PAGEARG_STRING);
$optargs = OptionalPageArguments("redirected", PAGEARG_BOOLEAN);
if (!$PORTAL_ENABLE) {
USERERROR("No Portal", 1);
}
#
# Need this extra redirect so that the cookies get set properly.
#
if (!isset($redirected) || $redirected == 0) {
$uri = $_SERVER['REQUEST_URI'] . "&redirected=1";
header("Location: https://{$WWWHOST}" . $uri);
return;
}
#
# Check the login table for the user, and see if the key is really
# the md5 of the login hash. If so, do a login.
#
示例15: CheckLoginOrDie
#
# }}}
#
include "defs.php3";
include_once "template_defs.php";
#
# Only known and logged in users.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
#
# Verify page arguments.
#
$reqargs = RequiredPageArguments("instance", PAGEARG_INSTANCE);
$optargs = OptionalPageArguments("canceled", PAGEARG_BOOLEAN, "confirmed", PAGEARG_BOOLEAN);
$template = $instance->GetTemplate();
# Canceled operation redirects back to template page.
if (isset($canceled) && $canceled) {
header("Location: " . CreateURL("template_show", $template));
return;
}
# Need these below.
$guid = $template->guid();
$vers = $template->vers();
$pid = $template->pid();
$eid = $instance->eid();
$unix_gid = $template->UnixGID();
$project = $template->GetProject();
$unix_pid = $project->unix_gid();
#