1<?php
2@session_start();
3// Include library code
4require_once "./lib/config.php";
5require_once "JsHttpRequest/JsHttpRequest.php";
6// Init class...
7$JsHttpRequest =& new JsHttpRequest('utf-8');
8/*
9*  prevent DW from packing the content
10*/
11define('DOKU_DISABLE_GZIP_OUTPUT',1);
12
13/*
14*  define constants and load all required libraries
15*/
16if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../../').'/');
17
18require_once (DOKU_INC.'inc/init.php');
19require_once(DOKU_INC.'inc/html.php');
20require_once(DOKU_INC.'inc/auth.php');
21
22
23if (isset($_REQUEST['callback'])) {
24  /*
25  *  cleanup possible security hole
26  */
27  $_REQUEST['callback'] = preg_replace("/\.+/","",$_REQUEST['callback']);
28  /*
29  *  die, if there's no such a file
30  */
31  if (!@file_exists(DOKU_PLUGIN.$_REQUEST['callback']."/".$_REQUEST['callback'].".php")) die ('Cannot access callback library');
32
33  require_once DOKU_PLUGIN.$_REQUEST['callback']."/".$_REQUEST['callback'].".php";
34  /*
35  *  die, if callback function is not exists
36  */
37  if ((isset($_REQUEST['method']) && !function_exists($callback = $_REQUEST['callback']."_".$_REQUEST['method']))
38      ||
39      (!isset($_REQUEST['method']) && !function_exists($callback = $_REQUEST['callback']))
40     )
41    die ('Cannot start callback method');
42  /*
43  *  return the result
44  */
45  $_RESULT = call_user_func_array($callback,$_REQUEST['args']);
46
47}
48