1<?php
2
3/**
4 * Markdown Ajax Parser.
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public License,
7 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
8 * obtain one at http://mozilla.org/MPL/2.0/.
9 *
10 * @package phpMyFAQ
11 * @author Jerry van Kooten <jerry@jvkooten.info>
12 * @author Thorsten Rinne <thorsten@phpmyfaq.de>
13 * @copyright 2015-2020 phpMyFAQ Team
14 * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
15 * @link https://www.phpmyfaq.de
16 * @since 2015-03-30
17 */
18
19use phpMyFAQ\Filter;
20use phpMyFAQ\Helper\HttpHelper;
21
22if (!defined('IS_VALID_PHPMYFAQ')) {
23    http_response_code(400);
24    exit();
25}
26
27$answer = Filter::filterInput(INPUT_POST, 'text', FILTER_SANITIZE_STRING);
28$http = new HttpHelper();
29$http->addHeader();
30
31$parsedown = new ParsedownExtra();
32
33$http->sendWithHeaders($parsedown->text($answer));
34