d25ac5f21997b9c1958253d380daa26bfb035d78
[atutor.git] / mods / atalker / admin / play_voice.php
1 <?php
2 /****************************************************************/
3 /* ATalker                                                                                                      */
4 /****************************************************************/
5 /* Copyright (c) 2002-2005 by Greg Gay                                  */
6 /* Adaptive Technology Resource Centre / University of Toronto  */
7 /* http://atutor.ca                                                                                             */
8 /*                                                              */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License  */
11 /* as published by the Free Software Foundation.                                */
12 /****************************************************************/
13 // $Id: play_voice.php 5123 2005-07-12 14:59:03Z greg
14
15 // This file is required to prevent browsers from caching content of 
16 // TTS files if they were to  access speech file  directly through a URL 
17
18
19         define('AT_INCLUDE_PATH', '../../../include/');
20
21         require (AT_INCLUDE_PATH.'vitals.inc.php');
22
23         define('AT_SPEECH_TEMPLATE_URL', $_base_href.'content/template/'.$_SESSION['lang'].'/');
24
25         if(strstr($_GET['play_voice'], '.mp3')){
26
27                 header('Content-type: audio/x-mp3');
28
29         }else if(strstr($_GET['play_voice'], '.ogg')){
30
31                 header('Content-type: audio/x-ogg');
32
33         }
34
35         header('Content-Disposition: inline; filename="'.str_replace("-","/",AT_SPEECH_TEMPLATE_URL).$_GET['play_voice'].'"');
36         readfile(AT_SPEECH_TEMPLATE_URL.$_GET['play_voice']);
37
38 ?>