예제 #1
0
/**
 * Set parameters for this plugin.
 *
 * @return array The JSON encoding of the installed languages.
 */
function atto_multilang2_params_for_js()
{
    $languages = json_encode(get_string_manager()->get_list_of_translations());
    $capability = get_capability();
    $highlight = get_config('atto_multilang2', 'highlight') === '1' ? true : false;
    $css = get_config('atto_multilang2', 'customcss');
    return array('languages' => $languages, 'capability' => $capability, 'highlight' => $highlight, 'css' => $css);
}
예제 #2
0
{
    global $gStartTime;
    $elapsed = microtime(true) - $gStartTime;
    log_message('debug', "Executed login in {$elapsed} seconds");
}
register_shutdown_function('shutdown');
///////////////////////////////////////////////////////////////////////////////
// XML-RPC Server
$xmlrpc_server = xmlrpc_server_create();
xmlrpc_server_register_method($xmlrpc_server, "login_to_simulator", "process_login");
// Read the request
$request_xml = file_get_contents("php://input");
// Check for a login capability
$authUserID = NULL;
if (!empty($_GET['cap'])) {
    $authUserID = get_capability($_GET['cap']);
}
// Build the response
$response = xmlrpc_server_call_method($xmlrpc_server, $request_xml, $authUserID);
header('Content-Type: text/xml');
echo $response;
xmlrpc_server_destroy($xmlrpc_server);
exit;
///////////////////////////////////////////////////////////////////////////////
function make_seed()
{
    list($usec, $sec) = explode(' ', microtime());
    return (double) $sec + (double) $usec * 100000;
}
function inform_scene_of_logout($sceneID, $userID)
{
예제 #3
0
                    RequestFailed('Error decoding JSON request');
                }
            }
        }
        $capability = trim($request['cap']);
        $operation = trim($request['RequestMethod']);
    }
}
log_message('debug', sprintf("cap=%s, op=%s, request=%s", $capability, $operation, json_encode($request)));
// --------------- validate the capability ---------------
if (!empty($config['authorize_commands'])) {
    if (!UUID::TryParse($capability, $capid)) {
        log_message('warn', sprintf("invalid uuid %s", $capability));
        RequestFailed('Invalid capability');
    }
    $cap = get_capability($capability);
    if ($cap == null) {
        log_message('warn', sprintf("invalid capability %s", $capability));
        RequestFailed('Invalid capability');
    }
    // log_message('debug',sprintf("Capability=%s",json_encode($cap)));
}
// execute_command($operation, $capability, $request);
if (file_exists(BASEPATH . "lib/Class.{$operation}.php")) {
    if (include_once BASEPATH . "lib/Class.{$operation}.php") {
        $gMethodName = $operation;
        $instance = new $operation();
        $instance->Execute($request);
        exit;
    }
}