xref: /plugin/captcha/img.php (revision 09b1e97e3cb9f2c4be8ca729baa9d49a3ba58ba1)
142a27035SAndreas Gohr<?php
2*09b1e97eSAndreas Gohr
342a27035SAndreas Gohr/**
442a27035SAndreas Gohr * CAPTCHA antispam plugin - Image generator
542a27035SAndreas Gohr *
642a27035SAndreas Gohr * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
742a27035SAndreas Gohr * @author     Andreas Gohr <gohr@cosmocode.de>
842a27035SAndreas Gohr */
942a27035SAndreas Gohr
10*09b1e97eSAndreas Gohrif (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../../');
1142a27035SAndreas Gohrdefine('NOSESSION', true);
1242a27035SAndreas Gohrdefine('DOKU_DISABLE_GZIP_OUTPUT', 1);
1342a27035SAndreas Gohrrequire_once(DOKU_INC . 'inc/init.php');
1442a27035SAndreas Gohrrequire_once(DOKU_INC . 'inc/auth.php');
1542a27035SAndreas Gohr
16*09b1e97eSAndreas Gohrglobal $INPUT;
17*09b1e97eSAndreas Gohrglobal $ID;
18*09b1e97eSAndreas Gohr
19*09b1e97eSAndreas Gohr$ID = $INPUT->str('id');
20*09b1e97eSAndreas Gohr
21104ec268SAndreas Gohr/** @var helper_plugin_captcha $plugin */
2277e00bf9SAndreas Gohr$plugin = plugin_load('helper', 'captcha');
23*09b1e97eSAndreas Gohr
24*09b1e97eSAndreas Gohrif ($plugin->getConf('mode') != 'audio' && $plugin->getConf('mode') != 'svgaudio') {
25*09b1e97eSAndreas Gohr    http_status(404);
26*09b1e97eSAndreas Gohr    exit;
27*09b1e97eSAndreas Gohr}
28*09b1e97eSAndreas Gohr
29*09b1e97eSAndreas Gohrheader("Content-type: image/png");
30*09b1e97eSAndreas Gohr
31*09b1e97eSAndreas Gohr$code = $plugin->generateCaptchaCode(
32*09b1e97eSAndreas Gohr    $plugin->fixedIdent(),
33*09b1e97eSAndreas Gohr    $plugin->decrypt($INPUT->str('secret'))
34*09b1e97eSAndreas Gohr);
35*09b1e97eSAndreas Gohrecho $plugin->imageCaptcha($code);
36