diff options
author | Ben Coburn <btcoburn@silicodon.net> | 2006-08-09 21:45:01 +0200 |
---|---|---|
committer | Ben Coburn <btcoburn@silicodon.net> | 2006-08-09 21:45:01 +0200 |
commit | 3cb4b39f357ab6389dcfd0aab594b43ae13ecb4c (patch) | |
tree | 4c3cff8a2536ebc328933cd621791d4144708724 /lib | |
parent | 742c66f88fe7a65996ebfb3800910c99bdff1a8f (diff) | |
download | rpg-3cb4b39f357ab6389dcfd0aab594b43ae13ecb4c.tar.gz rpg-3cb4b39f357ab6389dcfd0aab594b43ae13ecb4c.tar.bz2 |
Add AJAX_CALL_UNKNOWN event
Allows action plugins to support custom ajax calls.
The event data is the call name from $_POST['call'].
When handling a custom ajax call, remember to use
$event->preventDefault();
to avoid having the
'AJAX call <call> unknown!'
message appended to the output.
darcs-hash:20060809194501-05dcb-0082e4f2a83fc8657fc7cdcf32d44aac8d1a6b99.gz
Diffstat (limited to 'lib')
-rw-r--r-- | lib/exe/ajax.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/exe/ajax.php b/lib/exe/ajax.php index 0100f3130..9e89d6bd3 100644 --- a/lib/exe/ajax.php +++ b/lib/exe/ajax.php @@ -23,11 +23,18 @@ header('Content-Type: text/html; charset=utf-8'); //call the requested function +if (!isset($_POST['call'])) { return; } $call = 'ajax_'.$_POST['call']; if(function_exists($call)){ $call(); }else{ - print "The called function '".htmlspecialchars($call)."' does not exist!"; + $call = $_POST['call']; + $evt = new Doku_Event('AJAX_CALL_UNKNOWN', $call); + if ($evt->advise_before()) { + print "AJAX call '".htmlspecialchars($_POST['call'])."' unknown!\n"; + } + $evt->advise_after(); + unset($evt); } /** |