xref: /plugin/captcha/wav.php (revision 09b1e97e3cb9f2c4be8ca729baa9d49a3ba58ba1)
142a27035SAndreas Gohr<?php
2*09b1e97eSAndreas Gohr
342a27035SAndreas Gohr/**
442a27035SAndreas Gohr * CAPTCHA antispam plugin - sound 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
2163609b6eSAndreas Gohr/** @var helper_plugin_captcha $plugin */
2277e00bf9SAndreas Gohr$plugin = plugin_load('helper', 'captcha');
232cab8f1fSAndreas Gohr
2408f248e4SAndreas Gohrif ($plugin->getConf('mode') != 'audio' && $plugin->getConf('mode') != 'svgaudio') {
252cab8f1fSAndreas Gohr    http_status(404);
262cab8f1fSAndreas Gohr    exit;
272cab8f1fSAndreas Gohr}
282cab8f1fSAndreas Gohr
29*09b1e97eSAndreas Gohrheader('Content-type: audio/x-wav');
30*09b1e97eSAndreas Gohrheader('Content-Disposition: attachment;filename=captcha.wav');
31*09b1e97eSAndreas Gohr
32*09b1e97eSAndreas Gohr$code = $plugin->generateCaptchaCode(
33*09b1e97eSAndreas Gohr    $plugin->fixedIdent(),
34*09b1e97eSAndreas Gohr    $plugin->decrypt($INPUT->str('secret'))
35*09b1e97eSAndreas Gohr);
36*09b1e97eSAndreas Gohrecho $plugin->audioCaptcha($code);
37