diff options
author | andi <andi@splitbrain.org> | 2005-04-19 20:56:03 +0200 |
---|---|---|
committer | andi <andi@splitbrain.org> | 2005-04-19 20:56:03 +0200 |
commit | ac83b9d8ee0da2839787d268e28b1bfe3066c1b7 (patch) | |
tree | 02dd400d04987c77c699a20b2ddf7c56336afd3c /inc/actions.php | |
parent | 71352def8211fd38eafe887a9ccd0e5365b34962 (diff) | |
download | rpg-ac83b9d8ee0da2839787d268e28b1bfe3066c1b7.tar.gz rpg-ac83b9d8ee0da2839787d268e28b1bfe3066c1b7.tar.bz2 |
fixes for the export
darcs-hash:20050419185603-9977f-4bc9a1ba1878436bd71795c5d7fec2a5582561bf.gz
Diffstat (limited to 'inc/actions.php')
-rw-r--r-- | inc/actions.php | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/inc/actions.php b/inc/actions.php index 7ed171dfb..be44471d4 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -45,7 +45,7 @@ function act_dispatch(){ } //handle export - if(substr($ACT,0,6) == 'export') + if(substr($ACT,0,7) == 'export_') $ACT = act_export($ACT); //display some infos @@ -85,18 +85,22 @@ function act_clean($act){ global $lang; global $conf; + //remove all bad chars + $act = strtolower($act); + $act = preg_replace('/[^a-z_]+/','',$act); + if($act == 'register' && !$conf['openregister']) return 'show'; if($act == $lang['btn_save']) $act = 'save'; if($act == $lang['btn_preview']) $act = 'preview'; if($act == $lang['btn_cancel']) $act = 'show'; - $act = strtolower($act); + if($act == 'export_html') $act = 'export_xhtml'; if(array_search($act,array('login','logout','register','save','edit', - 'preview','export_raw','export_html', - 'search','show','check','index','revisions', - 'diff','recent','backlink','admin',)) === false){ + 'preview','search','show','check','index','revisions', + 'diff','recent','backlink','admin',)) === false + && substr($act,0,7) != 'export_' ) { msg('Unknown command: '.htmlspecialchars($act),-1); return 'show'; } @@ -213,25 +217,37 @@ function act_export($act){ global $ID; global $REV; - if($act == 'export_html'){ + // no renderer for this + if($act == 'export_raw'){ + header('Content-Type: text/plain; charset=utf-8'); + print rawWiki($ID,$REV); + exit; + } + + // html export #FIXME what about the template's style? + if($act == 'export_xhtml'){ header('Content-Type: text/html; charset=utf-8'); ptln('<html>'); ptln('<head>'); tpl_metaheaders(); ptln('</head>'); ptln('<body>'); - print parsedWiki($ID,$REV,false); + print p_wiki_xhtml($ID,$REV,false); ptln('</body>'); ptln('</html>'); exit; } - if($act == 'export_raw'){ - header('Content-Type: text/plain; charset=utf-8'); - print rawWiki($ID,$REV); + // try to run renderer #FIXME use cached instructions + $mode = substr($act,7); + $text = p_render($mode,p_get_instructions(rawWiki($ID,$REV))); + if(!is_null($text)){ + print $text; exit; } + + return 'show'; } |