| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Captcha audio handling for Mambo 4 * @package Mambo 5 * @author Mambo Foundation Inc see README.php 6 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 7 * See COPYRIGHT.php for copyright notices and details. 8 * @license GNU/GPL Version 2, see LICENSE.php 9 * 10 * Redistributions of files must retain the above copyright notice. 11 * 12 * Mambo is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; version 2 of the License. 15 */ 16 17 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 18 19 global $mosConfig_lang, $mosConfig_absolute_path; 20 21 mos_session_start(); 22 23 $code = $_SESSION['captcha_code']; 24 25 // language select (for future addition of own wav files) 26 $lang = $mosConfig_absolute_path.'/includes/captchaAudio/'.$mosConfig_lang.'/'; 27 if (!is_dir($lang)) { 28 $lang = $mosConfig_absolute_path.'/includes/captchaAudio/en/'; 29 } 30 31 $wavs = array(); 32 33 for($i=0;$i<5;$i++){ 34 $file = $lang.$code{$i}.'.wav'; 35 $wavs[] = $file; 36 } 37 38 //$totalsize = filesize($filename); 39 header("Cache-Control: no-cache, must-revalidate"); 40 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 41 header('Content-type: audio/x-wav'); 42 header("Content-Transfer-Encoding: binary"); 43 //header("Content-Length: ".$totalsize); 44 header('Content-Disposition: attachment;filename=captcha.wav'); 45 46 echo joinwavs($wavs); 47 48 /** 49 * CAPTCHA antispam plugin - sound generator 50 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 51 * @author Andreas Gohr <gohr@cosmocode.de> 52 */ 53 54 function joinwavs($wavs){ 55 $fields = join('/',array( 'H8ChunkID', 'VChunkSize', 'H8Format', 56 'H8Subchunk1ID', 'VSubchunk1Size', 57 'vAudioFormat', 'vNumChannels', 'VSampleRate', 58 'VByteRate', 'vBlockAlign', 'vBitsPerSample' )); 59 60 $data = ''; 61 62 foreach($wavs as $wav){ 63 $fp = fopen($wav,'rb'); 64 $header = fread($fp,36); 65 $info = unpack($fields,$header); 66 if($info['Subchunk1Size'] > 16){ 67 $header .= fread($fp,($info['Subchunk1Size']-16)); 68 } 69 $header .= fread($fp,4); 70 $size = unpack('vsize',fread($fp, 4)); 71 $size = $size['size']; 72 $data .= fread($fp,$size); 73 } 74 75 return $header.pack('V',strlen($data)).$data; 76 } 77 78 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |