本文整理汇总了PHP中USERERROR函数的典型用法代码示例。如果您正苦于以下问题:PHP USERERROR函数的具体用法?PHP USERERROR怎么用?PHP USERERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了USERERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PAGEARGERROR
PAGEARGERROR("Invalid characters in {$pid}");
}
if (!($project = Project::Lookup($pid))) {
PAGEARGERROR("Project {$pid} is not a valid project!");
}
# Must be admin
if (!$isadmin) {
USERERROR("You do not have permission to toggle {$type}!", 1);
}
$zapurl = CreateURL("showproject", $project);
$project->SetAllowWorkbench($value);
} elseif ($type == "hiderun") {
RequiredPageArguments("instance", PAGEARG_INSTANCE, "runidx", PAGEARG_INTEGER);
if (!$instance->AccessCheck($this_user, $TB_EXPT_MODIFY)) {
USERERROR("You do not have permission to modify this instance", 1);
}
$instance->SetRunHidden($runidx, $value);
} else {
USERERROR("Nobody has permission to toggle {$type}!", 1);
}
#
# Spit out a redirect
#
if (isset($HTTP_REFERER) && $HTTP_REFERER != "" && strpos($HTTP_REFERER, $_SERVER["SCRIPT_NAME"]) === false) {
# Make sure the referer is not me!
header("Location: {$HTTP_REFERER}");
} elseif ($zapurl) {
header("Location: {$zapurl}");
} else {
header("Location: {$TBBASE}/showuser.php3");
}
示例2: ISADMIN
$isadmin = ISADMIN();
#
# Verify page arguments.
#
$reqargs = RequiredPageArguments("instance", PAGEARG_INSTANCE, "runidx", PAGEARG_INTEGER);
$template = $instance->GetTemplate();
# Need these below.
$guid = $template->guid();
$vers = $template->vers();
$pid = $template->pid();
$eid = $instance->eid();
if (!$template->AccessCheck($this_user, $TB_EXPT_READINFO)) {
USERERROR("You do not have permission to view experiment template " . "{$guid}/{$version}!", 1);
}
if (!$instance->ValidRun($runidx)) {
USERERROR("The run {$runidx} is not a valid experiment run!", 1);
}
#
# For the Sajax Interface
#
function ModifyAnno($newtext)
{
global $this_user, $template, $instance, $runidx;
$instance->SetRunAnnotation($this_user, $runidx, $newtext);
return 0;
}
#
# See if this request is to the above function. Does not return
# if it is. Otherwise return and continue on.
#
sajax_handle_client_request();
示例3: str_replace
} else {
echo "<tr>\n <td class='pad4'>Your auto-generated NS file:  </td>\n <input type=hidden name=\"formfields[nsref]\"\n value={$nsref}>\n <td class='pad4'>\n <a target=_blank href=spitnsdata.php3?nsref={$nsref}>\n View NS File</a></td>\n </tr>\n";
}
} else {
echo "<tr>\n <td class='pad4'>Your NS file: </td>\n <td><table cellspacing=0 cellpadding=0 border=0>\n <tr>\n <td class='pad4'>Upload<br>\n\t\t\t<font size='-1'>(500k max)</font></td>\n <td class='pad4'>\n <input type=hidden name=MAX_FILE_SIZE value=512000>\n\t <input type=file\n name=nsfile\n value=\"" . $formfields["nsfile"] . "\"\n\t size=30>\n </td>\n </tr><tr>\n <td> <b>or</b></td><td></td>\n </tr><tr>\n <td class='pad4'>On Server<br>\n <font size='-1'>({$TBVALIDDIRS_HTML})</font></td>\n <td class='pad4'>\n\t <input type=text\n name=\"formfields[localnsfile]\"\n value=\"" . $formfields["localnsfile"] . "\"\n\t size=40>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n";
}
echo "<tr>\n <td colspan=2>\n Use this text area to describe your template:\n </td>\n </tr>\n <tr>\n <td colspan=2 align=center class=left>\n <textarea name=\"formfields[description]\"\n rows=10 cols=80>" . str_replace("\r", "", $formfields["description"]) . "</textarea>\n </td>\n </tr>\n";
echo "<tr>\n <td class='pad4' align=center colspan=2>\n <b><input type=submit name=create value='Create Template'></b>\n </td>\n </tr>\n </form>\n </table>\n";
echo "<blockquote><blockquote>\n <ol>\n <li> Please read this\n <a href='{$WIKIDOCURL}/kb112'>KB entry</a>\n to see what NS extensions are available for templates.\n </ol>\n </blockquote></blockquote>\n";
}
#
# See what projects the uid can create experiments in. Must be at least one.
#
$projlist = $this_user->ProjectAccessList($TB_PROJECT_CREATEEXPT);
if (!count($projlist)) {
USERERROR("You do not appear to be a member of any Projects in which " . "you have permission to create new experiment templates.", 1);
}
#
# On first load, display virgin form and exit.
#
if (!isset($create)) {
$defaults = array();
$defaults["pid"] = "";
$defaults["gid"] = "";
$defaults["tid"] = "";
$defaults["pid"] = "";
$defaults["description"] = "";
$defaults["localnsfile"] = "";
$defaults["nsfile"] = "";
# Multipart data.
#
示例4: SPEWCLEANUP
#
# 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;
}
register_shutdown_function("SPEWCLEANUP");
if ($fp = popen("{$TBSUEXEC_PATH} {$uid} {$unix_pid} webspewevents -w {$pid} {$eid}", "r")) {
header("Content-Type: text/plain");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
flush();
while (!feof($fp)) {
$string = fgets($fp, 1024);
echo "{$string}";
flush();
}
pclose($fp);
$fp = 0;
} else {
USERERROR("Experiment {$pid}/{$eid} is no longer in transition!", 1);
}
示例5: foreach
echo "</center>\n";
foreach ($showtypes as $type) {
if ($type == "cm" && isset($query) && $query != $defaultsearchstring) {
$slicelist = array();
$uuidlist = array();
$safe_query = escapeshellarg($query);
$fp = popen("{$TBSUEXEC_PATH} {$uid} nobody " . "webmaptoslice -w {$safe_query}", "r");
if (!$fp) {
TBERROR("Could not start maptoslice: {$safe_query}", 1);
}
while ($line = fgets($fp)) {
$uuidlist[] = rtrim($line);
}
$status = pclose($fp);
if ($status > 0 || !count($uuidlist)) {
USERERROR("No slices matching your search term", 1);
} elseif ($status < 0) {
TBERROR("Could not run maptoslice: {$safe_query}", 1);
}
foreach ($uuidlist as $uuid) {
$slicelist[] = GeniSlice::Lookup($type, $uuid);
}
} else {
$slicelist = GeniSlice::AllSlices($type);
}
$which = $type == "cm" ? "Component Manager" : ($type == "sa" ? "Slice Authority" : "Clearing House");
if (!$slicelist || !count($slicelist)) {
continue;
}
# The form attributes:
$table = array('#id' => $type, '#title' => $which, '#sortable' => 1, '#headings' => array("idx" => "ID", "hrn" => "HRN", "created" => "Created", "expires" => "Expires"));
示例6: addslashes
}
if (isset($search) && isset($searchfor)) {
$safe_searchfor = addslashes($searchfor);
if (preg_match("/^\\w+\\-\\w+\\-\\w+\\-\\w+\\-\\w+\$/", $searchfor)) {
$clause = "{$clause} and a.slice_uuid='{$safe_searchfor}' ";
} elseif (preg_match("/^urn:publicid:IDN\\+[-\\w\\.]+\\+slice\\+[-\\w]*\$/", $searchfor)) {
$clause = "{$clause} and a.slice_urn='{$safe_searchfor}' ";
} elseif (preg_match("/^urn:publicid:IDN\\+[-\\w\\.]+\\+user\\+[-\\w]*\$/", $searchfor)) {
$clause = "{$clause} and a.creator_urn='{$safe_searchfor}' ";
} elseif (strtotime($searchfor)) {
$ts = strtotime($searchfor);
$clause = "{$clause} and ({$ts} >= UNIX_TIMESTAMP(a.created) && " . "(a.destroyed is null or {$ts} <= UNIX_TIMESTAMP(a.destroyed)))";
} elseif ($searchfor == $searchbox) {
# Just a press of the ch box, so dump out the CH records.
} else {
USERERROR("Invalid search specification", 1);
}
}
}
$query_result = DBQueryFatal("select a.*,s.idx as slice_idx " . " from aggregate_history as a " . "left join geni_slices as s on s.uuid=a.slice_uuid " . "where a.type='Aggregate' {$clause} " . "order by a.idx desc limit 20", $dblink);
$table = array('#id' => 'aggregate', '#title' => "Aggregate History", '#headings' => array("idx" => "ID", "slice_hrn" => "Slice HRN/URN", "creator_hrn" => "Creator HRN/URN", "created" => "Created", "Destroyed" => "Destroyed", "Manifest" => "Manifest"));
$rows = array();
$popups = array();
if (mysql_num_rows($query_result)) {
while ($row = mysql_fetch_array($query_result)) {
$idx = $row["idx"];
$slice_idx = $row["slice_idx"];
$uuid = $row["uuid"];
$slice_hrn = $row["slice_hrn"];
$slice_uuid = $row["slice_uuid"];
$creator_hrn = $row["creator_hrn"];
示例7: PAGEHEADER
if (!isset($showtype)) {
$showtype = 'sa';
}
#
# Standard Testbed Header
#
PAGEHEADER("Geni Slice");
if (!($isadmin || STUDLY())) {
USERERROR("You do not have permission to view Geni slices!", 1);
}
if (!($showtype == "sa" || $showtype == "cm" || $showtype == "ch")) {
USERERROR("Improper argument: showtype={$showtype}", 1);
}
$slice = GeniSlice::Lookup($showtype, $slice_idx);
if (!$slice) {
USERERROR("No such slice {$slice_idx}", 1);
}
function GeneratePopupDiv($id, $text)
{
return "<div id=\"{$id}\" " . "style='display:none;width:700;height:400;overflow:auto;'>\n" . "{$text}\n" . "</div>\n";
}
$manifestidx = 0;
# The table attributes:
$table = array('#id' => 'form1', '#title' => "Slice {$slice_idx} ({$showtype})");
$rows = array();
$popups = array();
$rows[] = array("idx" => $slice->idx());
$rows[] = array("hrn" => $slice->hrn());
$urn = $slice->urn();
if ($urn) {
$rows[] = array("urn" => $slice->urn());
示例8: ISADMIN
$isadmin = ISADMIN();
#
# Verify Page Arguments.
#
$optargs = OptionalPageArguments("slice_idx", PAGEARG_INTEGER, "slice_uuid", PAGEARG_STRING, "download", PAGEARG_BOOLEAN);
if (!isset($download)) {
$download = 0;
}
#
# Standard Testbed Header
#
if (!$download) {
PAGEHEADER("Geni Slice Logs");
}
if (!($isadmin || STUDLY())) {
USERERROR("You do not have permission to view Geni slices!", 1);
}
if (!(isset($slice_idx) || isset($slice_uuid))) {
PAGEARGERROR("Must provide a slice idx or UUID");
}
$whereclause = isset($slice_idx) ? "where m.metakey='slice_idx' and m.metaval='{$slice_idx}'" : "where m.metakey='slice_uuid' and m.metaval='{$slice_uuid}'";
$urlarg = isset($slice_idx) ? "slice_idx={$slice_idx}" : "slice_uuid={$slice_uuid}";
#
# Find all logs associated with this slice.
#
$query_result = DBQueryFatal("select m.logidx,l.logid,l.date_created,m2.metaval " . " from logfile_metadata as m " . "left join logfiles as l on l.logidx=m.logidx " . "left join logfile_metadata as m2 on " . " m2.logidx=m.logidx and m2.metakey='Method' " . "{$whereclause} " . "order by l.date_created asc");
if ($query_result && mysql_num_rows($query_result)) {
if ($download) {
header("Content-Type: text/plain");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate");
示例9: RequiredPageArguments
#
$reqargs = RequiredPageArguments("instance", PAGEARG_INSTANCE);
$optargs = OptionalPageArguments("action", PAGEARG_STRING, "exprun", PAGEARG_STRING, "parameters", PAGEARG_ARRAY, "formfields", PAGEARG_ARRAY);
$template = $instance->GetTemplate();
# Need these below.
$guid = $template->guid();
$vers = $template->vers();
$pid = $template->pid();
$eid = $instance->eid();
$unix_gid = $template->UnixGID();
$exptidx = $instance->exptidx();
$experiment = $instance->GetExperiment();
$project = $template->GetProject();
$unix_pid = $project->unix_gid();
if (!$template->AccessCheck($this_user, $TB_EXPT_MODIFY)) {
USERERROR("You do not have permission to export in template " . "{$guid}/{$vers}!", 1);
}
#
# Run the script backend
#
function DOIT($instance, $action, $command_options)
{
global $guid, $vers, $pid, $unix_pid, $unix_gid, $eid, $uid;
global $deletexmlfile, $parameter_xmlfile;
$message = "";
$template = $instance->GetTemplate();
$experiment = $instance->GetExperiment();
$command_options = "-e {$eid} " . $command_options;
if ($action == "start") {
PAGEHEADER("Start new Run");
$message = "Starting new experiment run";
示例10: CheckLoginOrDie
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("template", PAGEARG_TEMPLATE);
# Need these below.
$guid = $template->guid();
$vers = $template->vers();
if (!$template->AccessCheck($this_user, $TB_EXPT_UPDATE)) {
USERERROR("You do not have permission to instantiate experiment template " . "{$guid}/{$vers}!", 1);
}
#
# Spit the form out using the array of data.
#
function SPITFORM($template, $formfields, $errors)
{
PAGEHEADER("Edit Template Events");
if ($template->EventList($eventlist) != 0) {
TBERROR("Could not get eventlist for template!", 1);
}
$guid = $template->guid();
$vers = $template->vers();
echo $template->PageHeader();
echo "<br>\n";
echo "<center>\n";
示例11: PAGEHEADER
PAGEHEADER("USRP Preorder List");
#
# Only known and logged in users allowed.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
if (!$isadmin) {
USERERROR("You do not have permission to view the USRP preorder list!", 1);
}
#
# Get the list. Date order, most recent first.
#
$query_result = DBQueryFatal("select * from usrp_orders " . "order by order_date desc");
if (($count = mysql_num_rows($query_result)) == 0) {
USERERROR("There are no USRP preorders!", 1);
}
#
# Grab some totals for the top of the page.
#
$total_mobos = 0;
$total_dboards = 0;
while ($row = mysql_fetch_array($query_result)) {
$num_mobos = $row["num_mobos"];
$num_dboards = $row["num_dboards"];
$total_mobos += $num_mobos;
$total_dboards += $num_dboards;
}
mysql_data_seek($query_result, 0);
echo "<center>\n <font size=+1>There are {$count} USRP preorders</font><br><br>\n";
echo "<table align=center border=2 cellpadding=5 cellspacing=2>\n <tr>\n <td>Total Motherboards:</td>\n <td align=left>{$total_mobos}</td>\n </tr>\n <tr>\n <td>Total Daughterboards:</td>\n <td align=left>{$total_dboards}</td>\n </tr>\n </table>\n";
示例12: RequiredPageArguments
$reqargs = RequiredPageArguments("peer", PAGEARG_STRING);
$optargs = OptionalPageArguments("user", PAGEARG_USER);
$safe_peer = addslashes($peer);
$query_result = DBQueryFatal("select * from emulab_peers " . "where name='{$safe_peer}' or urn='{$safe_peer}'");
if (!mysql_num_rows($query_result)) {
USERERROR("Unknown peer: {$peer}", 1);
}
$row = mysql_fetch_array($query_result);
$urn = $row['urn'];
$url = $row['weburl'];
#
# Allow admin to xlogin as another user.
#
if (isset($user) && !$this_user->SameUser($user)) {
if ($isadmin) {
$uid = $user->uid();
} else {
USERERROR("Not allowed to login as another user", 1);
}
}
STARTBUSY("Contacting peer");
#
# Do the xlogin, which gives us back a hash to stick in the redirect URL.
#
SUEXEC($uid, "nobody", "webmanageremote xlogin " . escapeshellarg($urn) . " {$uid}", SUEXEC_ACTION_DIE);
STOPBUSY();
if (!preg_match("/^(\\w*)\$/", $suexec_output, $matches)) {
TBERROR($suexec_output, 1);
}
$hash = $matches[1];
PAGEREPLACE("{$url}/peer_login.php?user={$uid}&key={$hash}");
示例13: RequiredPageArguments
# Verify page arguments.
#
$reqargs = RequiredPageArguments("instance", PAGEARG_INSTANCE, "runidx", PAGEARG_INTEGER);
$optargs = OptionalPageArguments("submit", PAGEARG_STRING, "referrer", PAGEARG_STRING, "formfields", PAGEARG_ARRAY);
$template = $instance->GetTemplate();
# Need these below.
$pid = $instance->pid();
$eid = $instance->eid();
$gid = $instance->gid();
$project = $instance->Project();
$unix_pid = $project->unix_gid();
$group = Group::LookupByPidGid($pid, $gid);
$unix_gid = $group->unix_gid();
# Permission
if (!$isadmin && !$instance->AccessCheck($this_user, $TB_EXPT_MODIFY)) {
USERERROR("You do not have permission to change this record!", 1);
}
#
# Standard Testbed Header
#
PAGEHEADER("Revise Run Record");
function SPITFORM($formfields, $errors)
{
global $instance, $runidx, $TBDB_ARCHIVE_TAGLEN, $referrer;
$iid = $instance->id();
$runid = $instance->GetRunID($runidx);
echo $instance->RunPageHeader($runidx);
echo "<br><br><center>\n Revise Record {$runid} in Instance {$iid} </center><br>\n";
if ($errors) {
echo "<table class=nogrid\n align=center border=0 cellpadding=6 cellspacing=0>\n <tr>\n <th align=center colspan=2>\n <font size=+1 color=red>\n Oops, please fix the following errors! \n </font>\n </td>\n </tr>\n";
while (list($name, $message) = each($errors)) {
示例14: pclose
{
global $fp;
if (connection_aborted() && $fp) {
pclose($fp);
}
exit;
}
register_shutdown_function("SPEWCLEANUP");
ignore_user_abort(1);
# Pass the tag through.
$options = isset($tag) ? "-t " . escapeshellarg($tag) : "";
$options .= " -q {$query} ";
$options .= isset($file) ? " -i " . escapeshellarg($file) : "";
$fp = popen("{$TBSUEXEC_PATH} {$uid} " . " {$pid},{$gid} webarchive_list {$options} {$archive_idx} {$idx}", "r");
if (!$fp) {
USERERROR("Archive listing failed!", 1);
}
#
# Yuck. Since we cannot tell php to shut up and not print headers, we have to
# 'merge' headers from the backend with PHPs.
#
while ($line = fgets($fp)) {
# This indicates the end of headers
if ($line == "\n") {
break;
}
header(rtrim($line));
}
flush();
fpassthru($fp);
$fp = 0;
示例15: PAGEARGERROR
if (!isset($template)) {
PAGEARGERROR("Must provide a template guid");
}
$template_guid = $template->guid();
$template_vers = $template->vers();
if (isset($metadata_type) && $metadata_type != "") {
if (!TBvalid_template_metadata_type($metadata_type)) {
PAGEARGERROR("Invalid characters in metadata type!");
}
} else {
unset($metadata_type);
}
}
# Perm check for add/modify to the template.
if (!$template->AccessCheck($this_user, $TB_EXPT_MODIFY)) {
USERERROR("You do not have permission to {$action} metadata in " . " template {$template_guid}!", 1);
}
#
# Okay, validate form arguments.
#
$errors = array();
$command_opts = "";
#
# Name
#
if (!isset($formfields["name"]) || $formfields["name"] == "") {
$errors["Metadata Name"] = "Missing Field";
} elseif (!TBvalid_template_metadata_name($formfields["name"])) {
$errors["Metadata Name"] = TBFieldErrorString();
}
if ($action == "add") {