xref: /dokuwiki/lib/exe/ajax.php (revision 54cc7aa41e0f453bd6887b0e79242a139d84a47a)
1<?php
2use dokuwiki\Utf8\Clean;
3use dokuwiki\Ajax;
4/**
5 * DokuWiki AJAX call handler
6 *
7 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
8 * @author     Andreas Gohr <andi@splitbrain.org>
9 */
10
11if (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../');
12require_once(DOKU_INC . 'inc/init.php');
13
14//close session
15session_write_close();
16
17// default header, ajax call may overwrite it later
18header('Content-Type: text/html; charset=utf-8');
19
20//call the requested function
21global $INPUT;
22if ($INPUT->has('call')) {
23    $call = $INPUT->filter([Clean::class, 'stripspecials'])->str('call');
24    new Ajax($call);
25} else {
26    http_status(404);
27}
28