142a27035SAndreas Gohr<?php 209b1e97eSAndreas 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 1009b1e97eSAndreas 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 1609b1e97eSAndreas Gohrglobal $INPUT; 1709b1e97eSAndreas Gohrglobal $ID; 1809b1e97eSAndreas Gohr 1909b1e97eSAndreas Gohr$ID = $INPUT->str('id'); 2009b1e97eSAndreas Gohr 21104ec268SAndreas Gohr/** @var helper_plugin_captcha $plugin */ 2277e00bf9SAndreas Gohr$plugin = plugin_load('helper', 'captcha'); 2309b1e97eSAndreas Gohr 24*fddee47eSAndreas Gohrif ($plugin->getConf('mode') != 'image' && $plugin->getConf('mode') != 'audio') { 2509b1e97eSAndreas Gohr http_status(404); 2609b1e97eSAndreas Gohr exit; 2709b1e97eSAndreas Gohr} 2809b1e97eSAndreas Gohr 2909b1e97eSAndreas Gohrheader("Content-type: image/png"); 3009b1e97eSAndreas Gohr 3109b1e97eSAndreas Gohr$code = $plugin->generateCaptchaCode( 3209b1e97eSAndreas Gohr $plugin->fixedIdent(), 3309b1e97eSAndreas Gohr $plugin->decrypt($INPUT->str('secret')) 3409b1e97eSAndreas Gohr); 3509b1e97eSAndreas Gohrecho $plugin->imageCaptcha($code); 36