<commit_before><?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");

#
# No PAGEHEADER since we spit back plain XML output.
#
$errors    = array();

$session_interactive  = 0;
$session_errorhandler = 'handle_error';

#
# Capture script errors and report back to user.
#
function handle_error($message, $death)
{
    XMLSTATUS("weberror", $message);
    if ($death)
	exit(1);
}

#
# Form Errors. 
#
function XMLERROR()
{
    XMLSTATUS("xmlerror", "Invalid form arugments");
}

#
# Helper function to send back errors. This needs some work!
#
function XMLSTATUS($status, $message)
{
    global $errors;

    $results = array();
    $results[status]  = $status;
    $results[message] = $message;
    $results[errors]  = $errors;
    $xmlcode = xmlrpc_encode_request("dummy", $results);

    echo "$xmlcode\n";
    exit(1);
}

#
# Only known and logged in users can begin experiments. Must perform this
# check inline so we can report back status instead of simply dying. I
# need to investigate how to make this cleaner, perhaps with a global variable
# that changes how TBERROR and USERERROR operate. Needs more thought.
#
$uid    = GETLOGIN();
$status = CHECKLOGIN($uid);
if (($status & CHECKLOGIN_NOTLOGGEDIN) != CHECKLOGIN_NOTLOGGEDIN) {
    EXPERROR("autherror", "Not logged in");
}

# Need this below;
$idleswaptimeout = TBGetSiteVar("idle/threshold");

#
# We must get XML code.
# 
if (!isset($xmlcode)) {
    PAGEARGERROR();
}

# Convert the xml into PHP datatypes; an array of arguments. We ignore the
# the method for now. 
$foo = xmlrpc_decode_request($xmlcode, $meth);<commit_msg>Fix typo<commit_after><?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");

#
# No PAGEHEADER since we spit back plain XML output.
#
$errors    = array();

$session_interactive  = 0;
$session_errorhandler = 'handle_error';

#
# Capture script errors and report back to user.
#
function handle_error($message, $death)
{
    XMLSTATUS("weberror", $message);
    if ($death)
	exit(1);
}

#
# Form Errors. 
#
function XMLERROR()
{
    XMLSTATUS("xmlerror", "Invalid form arugments");
}

#
# Helper function to send back errors. This needs some work!
#
function XMLSTATUS($status, $message)
{
    global $errors;

    $results = array();
    $results[status]  = $status;
    $results[message] = $message;
    $results[errors]  = $errors;
    $xmlcode = xmlrpc_encode_request("dummy", $results);

    echo "$xmlcode\n";
    exit(1);
}

#
# Only known and logged in users can begin experiments. Must perform this
# check inline so we can report back status instead of simply dying. I
# need to investigate how to make this cleaner, perhaps with a global variable
# that changes how TBERROR and USERERROR operate. Needs more thought.
#
$uid    = GETLOGIN();
$status = CHECKLOGIN($uid);
if (($status & CHECKLOGIN_LOGGEDIN) != CHECKLOGIN_LOGGEDIN) {
    EXPERROR("autherror", "Not logged in");
}

# Need this below;
$idleswaptimeout = TBGetSiteVar("idle/threshold");

#
# We must get XML code.
# 
if (!isset($xmlcode)) {
    PAGEARGERROR();
}

# Convert the xml into PHP datatypes; an array of arguments. We ignore the
# the method for now. 
$foo = xmlrpc_decode_request($xmlcode, $meth);
{'fraction_non_alphanumeric': 0.1263851452530698, 'fraction_numerical': 0.0071877807726864335, 'mean_word_length': 4.154320987654321, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 16}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3999833', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1092, 'n_words': 354}