Skip to content
Snippets Groups Projects
Commit c2e830f2 authored by chris's avatar chris
Browse files

add ACTION_DISPATCH event

The 'ACTION_DISPATCH' event[1] is triggered prior to any processing of the $ACT
variable[2]. This gives custom content the opportunity to add new "do" commands
and to process any custom form data.

This event is advisory only (there are no '_before' or '_after' advise)

Preventing default action will skip Dokuwiki's own processing of the $ACT value, this
includes its cleansing of the $ACT variable.

[1] also refer ACTION_TEMPLATE event
[2] $ACT is the do variable from the query string

darcs-hash:20060414195601-9b6ab-8ae62d2c3a7c6f8c09c77436d9adbaba5404f51b.gz
parent f65bfee1
No related branches found
No related tags found
No related merge requests found
......@@ -23,87 +23,87 @@ function act_dispatch(){
global $lang;
global $conf;
//sanitize $ACT
$ACT = act_clean($ACT);
//check if searchword was given - else just show
$s = cleanID($QUERY);
if($ACT == 'search' && empty($s)){
$ACT = 'show';
}
//login stuff
if(in_array($ACT,array('login','logout')))
$ACT = act_auth($ACT);
//check if user is asking to (un)subscribe a page
if($ACT == 'subscribe' || $ACT == 'unsubscribe')
$ACT = act_subscription($ACT);
//check permissions
$ACT = act_permcheck($ACT);
//register
if($ACT == 'register' && register()){
$ACT = 'login';
}
if ($ACT == 'resendpwd' && act_resendpwd()) {
$ACT = 'login';
}
//update user profile
if (($ACT == 'profile') && updateprofile()) {
msg($lang['profchanged'],1);
$ACT = 'show';
}
//save
if($ACT == 'save')
$ACT = act_save($ACT);
//draft deletion
if($ACT == 'draftdel')
$ACT = act_draftdel($ACT);
//draft saving on preview
if($ACT == 'preview')
$ACT = act_draftsave($ACT);
//edit
if(($ACT == 'edit' || $ACT == 'preview') && $INFO['editable']){
$ACT = act_edit($ACT);
}else{
unlock($ID); //try to unlock
}
//handle export
if(substr($ACT,0,7) == 'export_')
$ACT = act_export($ACT);
//display some infos
if($ACT == 'check'){
check();
$ACT = 'show';
}
//handle admin tasks
if($ACT == 'admin'){
// retrieve admin plugin name from $_REQUEST['page']
if ($_REQUEST['page']) {
$pluginlist = plugin_list('admin');
if (in_array($_REQUEST['page'], $pluginlist)) {
// attempt to load the plugin
if ($plugin =& plugin_load('admin',$_REQUEST['page']) !== NULL)
$plugin->handle();
}
// give plugins an opportunity to process the action
$evt = new event('ACTION_DISPATCH',$ACT);
$evt->trigger();
if ($evt->_default) {
//sanitize $ACT
$ACT = act_clean($ACT);
//check if searchword was given - else just show
$s = cleanID($QUERY);
if($ACT == 'search' && empty($s)){
$ACT = 'show';
}
//login stuff
if(in_array($ACT,array('login','logout')))
$ACT = act_auth($ACT);
//check if user is asking to (un)subscribe a page
if($ACT == 'subscribe' || $ACT == 'unsubscribe')
$ACT = act_subscription($ACT);
//check permissions
$ACT = act_permcheck($ACT);
//register
if($ACT == 'register' && register()){
$ACT = 'login';
}
/*
if($_REQUEST['page'] == 'acl'){
require_once(DOKU_INC.'inc/admin_acl.php');
admin_acl_handler();
if ($ACT == 'resendpwd' && act_resendpwd()) {
$ACT = 'login';
}
//update user profile
if (($ACT == 'profile') && updateprofile()) {
msg($lang['profchanged'],1);
$ACT = 'show';
}
//save
if($ACT == 'save')
$ACT = act_save($ACT);
//draft deletion
if($ACT == 'draftdel')
$ACT = act_draftdel($ACT);
//draft saving on preview
if($ACT == 'preview')
$ACT = act_draftsave($ACT);
//edit
if(($ACT == 'edit' || $ACT == 'preview') && $INFO['editable']){
$ACT = act_edit($ACT);
}else{
unlock($ID); //try to unlock
}
//handle export
if(substr($ACT,0,7) == 'export_')
$ACT = act_export($ACT);
//display some infos
if($ACT == 'check'){
check();
$ACT = 'show';
}
//handle admin tasks
if($ACT == 'admin'){
// retrieve admin plugin name from $_REQUEST['page']
if ($_REQUEST['page']) {
$pluginlist = plugin_list('admin');
if (in_array($_REQUEST['page'], $pluginlist)) {
// attempt to load the plugin
if ($plugin =& plugin_load('admin',$_REQUEST['page']) !== NULL)
$plugin->handle();
}
}
}
*/
}
//call template FIXME: all needed vars available?
......@@ -418,4 +418,4 @@ function act_subscription($act){
return 'show';
}
//Setup VIM: ex: et ts=2 enc=utf-8 :
//Setup VIM: ex: et ts=2 enc=utf-8 :
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment