1<?php
2
3/**
4 * CAPTCHA antispam plugin - sound 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') != 'audio' && $plugin->getConf('mode') != 'svgaudio') {
25    http_status(404);
26    exit;
27}
28
29header('Content-type: audio/x-wav');
30header('Content-Disposition: attachment;filename=captcha.wav');
31
32$code = $plugin->generateCaptchaCode(
33    $plugin->fixedIdent(),
34    $plugin->decrypt($INPUT->str('secret'))
35);
36echo $plugin->audioCaptcha($code);
37