Skip to content

Commit

Permalink
Fix callback logic in ToolProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
Izumi-kun committed May 28, 2019
1 parent 4203d0f commit 4828769
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions src/ToolProvider/ToolProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,36 +531,31 @@ function doOnLoad() {

/**
* Process a valid launch request
*
* @return boolean True if no error
*/
protected function onLaunch()
{

$this->onError();
$this->ok = false;

}

/**
* Process a valid content-item request
*
* @return boolean True if no error
*/
protected function onContentItem()
{

$this->onError();
$this->ok = false;

}

/**
* Process a valid tool proxy registration request
*
* @return boolean True if no error
*/
protected function onRegister() {
protected function onRegister()
{

$this->onError();
$this->ok = false;

}

Expand All @@ -572,7 +567,7 @@ protected function onRegister() {
protected function onError()
{

$this->doCallback('onError');
return false;

}

Expand All @@ -582,8 +577,6 @@ protected function onError()
* This function may set the redirect_url and output properties.
*
* @param string|null $method
*
* @return void True if no error reported
*/
protected function doCallback($method = null)
{
Expand All @@ -593,7 +586,7 @@ protected function doCallback($method = null)
$callback = self::$METHOD_NAMES[$_POST['lti_message_type']];
}
if (method_exists($this, $callback)) {
$result = $this->$callback();
$this->$callback();
} else if (is_null($method) && $this->ok) {
$this->ok = false;
$this->reason = "Message type not supported: {$_POST['lti_message_type']}";
Expand All @@ -608,8 +601,6 @@ protected function doCallback($method = null)
* Perform the result of an action.
*
* This function may redirect the user to another URL rather than returning a value.
*
* @return string Output to be displayed (redirection, or display HTML or message)
*/
protected function result()
{
Expand Down

0 comments on commit 4828769

Please sign in to comment.