Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
--—XML-Envelope------------------------------— | | | Encrypted-Symmetric-key-------------— | | |_____________________________________| | | | | Encrypted data----------------------— | | | | | | | -XML-Envelope---------------— | | | | | | | | | | | –Signature----------— | | | | | | |______________________| | | | | | | | | | | | | –Signed-Payload-----— | | | | | | | | | | | | | | | XML-RPC Request | | | | | | | |______________________| | | | | | | | | | | | |_____________________________| | | | |_____________________________________| | | | |________________________________________________| More...
Classes | |
class | mnet_server_exception |
mnet server exception. More... | |
Functions | |
mnet_keyswap ($function, $params) | |
Accepts a public key from a new remote host and returns the public key for this host. More... | |
mnet_server_dispatch ($payload) | |
If security checks are passed, dispatch the request to the function/method. More... | |
mnet_server_dummy_method ($methodname, $argsarray, $functionname) | |
Dummy function for the XML-RPC dispatcher - use to call a method on an object or to call a function. More... | |
mnet_server_fault ($code, $text, $param=null) | |
Return the proper XML-RPC content to report an error in the local language. More... | |
mnet_server_fault_xml ($code, $text, $privatekey=null) | |
Return the proper XML-RPC content to report an error. More... | |
mnet_server_invoke_dangerous_method ($includefile, $methodname, $method, $payload) | |
Initialize the object (if necessary), execute the method or function, and return the response. More... | |
mnet_server_invoke_plugin_method ($method, $callstack, $rpcrecord, $payload) | |
Invoke a normal style plugin method This will verify permissions first. More... | |
mnet_server_prepare_response ($response, $privatekey=null) | |
Package a response in any required envelope, and return it to the client. More... | |
mnet_server_strip_encryption ($rawpostdata) | |
mnet_server_strip_signature ($plaintextmessage) | |
mnet_setup_dummy_method ($method, $callstack, $rpcrecord) | |
Figure out exactly what needs to be called and stashes it in $remoteclient Does some further verification that the method is callable. More... | |
mnet_system ($method, $params, $hostinfo) | |
Execute the system functions - mostly for introspection. More... | |
mnet_verify_permissions ($rpcrecord) | |
Verify that the requested xmlrpc method can be called This just checks the method exists in the rpc table and is enabled. More... | |
--—XML-Envelope------------------------------— | | | Encrypted-Symmetric-key-------------— | | |_____________________________________| | | | | Encrypted data----------------------— | | | | | | | -XML-Envelope---------------— | | | | | | | | | | | –Signature----------— | | | | | | |______________________| | | | | | | | | | | | | –Signed-Payload-----— | | | | | | | | | | | | | | | XML-RPC Request | | | | | | | |______________________| | | | | | | | | | | | |_____________________________| | | | |_____________________________________| | | | |________________________________________________|
mnet_keyswap | ( | $function, | |
$params | |||
) |
Accepts a public key from a new remote host and returns the public key for this host.
If 'register all hosts' is turned on, it will bootstrap a record for the remote host in the mnet_host table (if it's not already there)
string | $function | XML-RPC requires this but we don't... discard! |
array | $params | Array of parameters $params[0] is the remote wwwroot $params[1] is the remote public key |
string | The XML-RPC response |
mnet_server_dispatch | ( | $payload | ) |
If security checks are passed, dispatch the request to the function/method.
The config variable 'mnet_dispatcher_mode' can be: strict: Only execute functions that are in specific files off: The default - don't execute anything
string | $payload | The XML-RPC request |
mnet_server_exception |
No | return val - just echo the response |
mnet_server_dummy_method | ( | $methodname, | |
$argsarray, | |||
$functionname | |||
) |
Dummy function for the XML-RPC dispatcher - use to call a method on an object or to call a function.
Translate XML-RPC's strange function call syntax into a more straightforward PHP-friendly alternative. This dummy function will be called by the dispatcher, and can be used to call a method on an object, or just a function
The methodName argument (eg. mnet/testlib/mnet_concatenate_strings) is ignored.
mnet_server_exception |
string | $methodname | We discard this - see 'functionname' |
array | $argsarray | Each element is an argument to the real function |
string | $functionname | The name of the PHP function you want to call |
mixed | The return value will be that of the real function, whatever it may be. |
mnet_server_fault | ( | $code, | |
$text, | |||
$param = null |
|||
) |
Return the proper XML-RPC content to report an error in the local language.
int | $code | The ID code of the error message |
string | $text | The full string of the error message (get_string will not be called) |
string | $param | The $a param for the error message in the lang file |
string::$text | The text of the error message |
mnet_server_fault_xml | ( | $code, | |
$text, | |||
$privatekey = null |
|||
) |
Return the proper XML-RPC content to report an error.
int | $code | The ID code of the error message |
string | $text | The error message |
resource | $privatekey | The private key that should be used to sign the response |
string::$text | The XML text of the error message |
mnet_server_invoke_dangerous_method | ( | $includefile, | |
$methodname, | |||
$method, | |||
$payload | |||
) |
Initialize the object (if necessary), execute the method or function, and return the response.
string | $includefile | The file that contains the object definition |
string | $methodname | The name of the method to execute |
string | $method | The full path to the method |
string | $payload | The XML-RPC request payload |
string | $class | The name of the class to instantiate (or false) |
mnet_server_exception |
string | The XML-RPC response |
mnet_server_invoke_plugin_method | ( | $method, | |
$callstack, | |||
$rpcrecord, | |||
$payload | |||
) |
Invoke a normal style plugin method This will verify permissions first.
string | $method | the full xmlrpc method that was called eg auth/mnet/auth.php/user_authorise |
array | $callstack | the exploded callstack |
stdclass | $rpcrecord | the record from mnet_rpc |
mixed | the response from the invoked method |
mnet_server_prepare_response | ( | $response, | |
$privatekey = null |
|||
) |
Package a response in any required envelope, and return it to the client.
string | $response | The XMLRPC response string |
resource | $privatekey | The private key to sign the response with |
string | The encoded response string |
mnet_setup_dummy_method | ( | $method, | |
$callstack, | |||
$rpcrecord | |||
) |
Figure out exactly what needs to be called and stashes it in $remoteclient Does some further verification that the method is callable.
string | $method | the full xmlrpc method that was called eg auth/mnet/auth.php/user_authorise |
array | $callstack | the exploded callstack |
stdclass | $rpcrecord | the record from mnet_rpc |
mnet_server_exception |
mnet_system | ( | $method, | |
$params, | |||
$hostinfo | |||
) |
Execute the system functions - mostly for introspection.
string | $method | XMLRPC method name, e.g. system.listMethods |
array | $params | Array of parameters from the XMLRPC request |
string | $hostinfo | Hostinfo object from the mnet_host table |
mnet_server_exception |
mixed | Response data - any kind of PHP variable |
mnet_verify_permissions | ( | $rpcrecord | ) |
Verify that the requested xmlrpc method can be called This just checks the method exists in the rpc table and is enabled.
stdclass | $rpcrecord | the record from mnet_rpc |
mnet_server_exception |