Skip to content

Commit

Permalink
Minor mnet bugfixing.
Browse files Browse the repository at this point in the history
  • Loading branch information
donal72 committed Aug 2, 2007
1 parent 11a1499 commit b26a847
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions mnet/xmlrpc/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ function mnet_server_dispatch($payload) {
// xmlrpc_decode_request($xml, &$method)
$params = xmlrpc_decode_request($payload, $method);

// $method is something like: "mod/forum/lib/forum_add_instance"
// $method is something like: "mod/forum/lib.php/forum_add_instance"
// $params is an array of parameters. A parameter might itself be an array.

// Whitelist characters that are permitted in a method name
Expand All @@ -366,8 +366,12 @@ function mnet_server_dispatch($payload) {
exit(mnet_server_fault(713, 'nosuchfunction'));
}

$callstack = explode('/', $method);
// callstack will look like array('mod', 'forum', 'lib', 'forum_add_instance');
if(preg_match("/^system./", $method)) {
$callstack = explode('.', $method);
} else {
$callstack = explode('/', $method);
// callstack will look like array('mod', 'forum', 'lib.php', 'forum_add_instance');
}

/**
* What has the site administrator chosen as his dispatcher setting?
Expand Down Expand Up @@ -485,7 +489,7 @@ function mnet_server_dispatch($payload) {
// The call stack holds the path to any include file
$includefile = $CFG->dirroot.'/'.implode('/',$callstack).'/'.$filename.'.php';

$response = mnet_server_invoke_function($includefile, $functionname, $method, $payload);
$response = mnet_server_invoke_method($includefile, $functionname, $method, $payload);
echo $response;
}

Expand Down

0 comments on commit b26a847

Please sign in to comment.