<?php

/**
 * DokuWiki AJAX call handler
 *
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     Andreas Gohr <andi@splitbrain.org>
 */

if (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../../');
require_once(DOKU_INC . 'inc/init.php');

#include_once('/var/www/html/zdebug/inc.php');

//close session
session_write_close();

//mb_internal_encoding("UTF-16");
 
// default header, ajax call may overwrite it later
header('Content-Type: text/html; charset=utf-8');
$input = file_get_contents('php://input');

// Unpack
$id = substr($input,0,5);
$md5 = substr($input,5,32);
$text =  substr($input,37);
//sleep(5);
$info = [];
$html = p_render('xhtml', p_get_instructions($text), $info);
echo $id.md5($html).$html;

