Example #1
0
 *
 */
require 'ucsysconfig.inc.php';
require 'ucserver.inc.php';
require LIB_DIR . 'http_request.inc.php';
require INC_DIR . 'ucs_nodes_poll.inc.php';
// check total node poll
$total_conn = ucs_nodes_poll::check_poll($dbs);
if ($total_conn >= $sysconf['server']['max_node_all']) {
    die(json_encode(array('status' => 'POLL_MAX', 'message' => 'Sorry for inconvinience, server connection poll is busy right now. Please try again later')));
}
// create http request object
$http_request = new http_request();
$http_request->get_http_request();
// get http content
$referer = trim($http_request->headers('REFERER'));
$body = trim($http_request->body());
// sent HTTP header
header('Content-type: text/json');
// check content
if ($body) {
    // encode to PHP array
    $biblio = json_decode($body, true);
    if (function_exists('json_last_error')) {
        // Define the errors.
        $json_errors = array(JSON_ERROR_DEPTH => 'JSON error: The maximum stack depth has been exceeded', JSON_ERROR_CTRL_CHAR => 'JSON error: Control character error, possibly incorrectly encoded', JSON_ERROR_SYNTAX => 'JSON error: Syntax error');
        // get json error
        $json_error = json_last_error();
        if ($json_error) {
            die(json_encode(array('status' => 'JSON_ERROR', 'message' => $json_errors[$json_error])));
        }
{
    $host = $_SERVER['HTTP_HOST'];
    $uri = rtrim($_SERVER['PHP_SELF'], "/\\");
    $uri = str_replace(basename($_SERVER['PHP_SELF']), "", $uri);
    return "http://{$host}{$uri}{$file}";
}
$is_ll = FALSE;
foreach ($ll_subnets as $network) {
    if (net_match($network, $_SERVER['REMOTE_ADDR'])) {
        $is_ll = TRUE;
        break;
    }
}
// -- Process all request headers -- //
$request = new http_request();
$nheaders = array_map('strtolower', $request->headers());
$headers = array();
foreach ($nheaders as $key => $value) {
    $headers[strtolower($key)] = $value;
}
// -- Put Headers into Variables --//
// -- Simulator Information
$ll_grid = $headers['x-secondlife-shard'];
$ll_region_name = $headers['x-secondlife-region'];
// -- Owner Information
$ll_owner_key = $headers['x-secondlife-owner-key'];
$ll_owner_name = $headers['x-secondlife-owner-name'];
// -- Object Information
$ll_object_key = $headers['x-secondlife-object-key'];
$ll_object_name = $headers['x-secondlife-object-name'];
$ll_object_pos = $headers['x-secondlife-local-position'];