1<?php
2
3/**
4 * CAPTCHA antispam plugin - Image generator
5 *
6 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
7 * @author     Andreas Gohr <gohr@cosmocode.de>
8 */
9
10if (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../../');
11define('NOSESSION', true);
12define('DOKU_DISABLE_GZIP_OUTPUT', 1);
13require_once(DOKU_INC . 'inc/init.php');
14require_once(DOKU_INC . 'inc/auth.php');
15
16global $INPUT;
17global $ID;
18
19$ID = $INPUT->str('id');
20
21/** @var helper_plugin_captcha $plugin */
22$plugin = plugin_load('helper', 'captcha');
23
24if ($plugin->getConf('mode') != 'image' && $plugin->getConf('mode') != 'audio') {
25    http_status(404);
26    exit;
27}
28
29header("Content-type: image/png");
30
31$code = $plugin->generateCaptchaCode(
32    $plugin->fixedIdent(),
33    $plugin->decrypt($INPUT->str('secret'))
34);
35echo $plugin->imageCaptcha($code);
36