diff options
author | andi <andi@splitbrain.org> | 2005-06-05 12:38:42 +0200 |
---|---|---|
committer | andi <andi@splitbrain.org> | 2005-06-05 12:38:42 +0200 |
commit | f62ea8a1d1cf10eddeae777b11420624e111b7ea (patch) | |
tree | 87a15e898308a5de1ef37874645a4cdcb83c707b /lib/exe/ajax.php | |
parent | 248a73214063d2fe47787c8c4aa292777cddb12b (diff) | |
download | rpg-f62ea8a1d1cf10eddeae777b11420624e111b7ea.tar.gz rpg-f62ea8a1d1cf10eddeae777b11420624e111b7ea.tar.bz2 |
directory layout cleanup !IMPORTANT
This patch changes the directory structure of dokuwiki as suggested
in http://www.freelists.org/archives/dokuwiki/06-2005/msg00045.html
As the changes.log is not managed through darcs you need to move it your
self to the new location in data/changes.log
I think I modified the code at all nessessary places, but I may have
forgotten a few things.
darcs-hash:20050605103842-9977f-af20f63c1d604888375d175d89ac6bd71566d47d.gz
Diffstat (limited to 'lib/exe/ajax.php')
-rw-r--r-- | lib/exe/ajax.php | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/exe/ajax.php b/lib/exe/ajax.php new file mode 100644 index 000000000..dfe0d2ceb --- /dev/null +++ b/lib/exe/ajax.php @@ -0,0 +1,53 @@ +<?php +/** + * DokuWiki AJAX call handler + * + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * @author Andreas Gohr <andi@splitbrain.org> + */ + +//fix for Opera XMLHttpRequests +if(!count($_POST) && $HTTP_RAW_POST_DATA){ + parse_str($HTTP_RAW_POST_DATA, $_POST); +} + +if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +require_once(DOKU_INC.'inc/init.php'); +require_once(DOKU_INC.'inc/common.php'); +require_once(DOKU_INC.'inc/pageutils.php'); +require_once(DOKU_INC.'inc/auth.php'); + +//call the requested function +$call = 'ajax_'.$_POST['call']; +if(function_exists($call)){ + $call(); +}else{ + print "The called function does not exist!"; +} + +/** + * Searches for matching pagenames + * + * @author Andreas Gohr <andi@splitbrain.org> + */ +function ajax_qsearch(){ + global $conf; + global $lang; + + $query = cleanID($_POST['q']); + if(empty($query)) return; + + $nsdir = str_replace(':','/',getNS($query)); + require_once(DOKU_INC.'inc/search.php'); + require_once(DOKU_INC.'inc/html.php'); + + $data = array(); + search($data,$conf['datadir'],'search_qsearch',array(query => $query),$nsdir); + + if(!count($data)) return; + + print '<b>'.$lang['quickhits'].'</b>'; + print html_buildlist($data,'qsearch','html_list_index'); +} + +?> |