Initial upload to TYPO3 Forge
[TYPO3CMS/Extensions/sr_freecap.git] / pi3 / audioCaptcha.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
6 * All rights reserved
7 *
8 * This script is part of the Typo3 project. The Typo3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24 /**
25 * This script invokes SysTurn speech generation
26 *
27 */
28
29 error_reporting (E_ALL ^ E_NOTICE);
30 define('PATH_thisScript',str_replace('//','/', str_replace('\\','/', (php_sapi_name()=='cgi'||php_sapi_name()=='xcgi'||php_sapi_name()=='isapi' ||php_sapi_name()=='cgi-fcgi')&&((!empty($_SERVER['ORIG_PATH_TRANSLATED'])&&isset($_SERVER['ORIG_PATH_TRANSLATED']))?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED'])? ((!empty($_SERVER['ORIG_PATH_TRANSLATED'])&&isset($_SERVER['ORIG_PATH_TRANSLATED']))?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED']):((!empty($_SERVER['ORIG_SCRIPT_FILENAME'])&&isset($_SERVER['ORIG_SCRIPT_FILENAME']))?$_SERVER['ORIG_SCRIPT_FILENAME']:$_SERVER['SCRIPT_FILENAME']))));
31 if (!defined('PATH_site')) define('PATH_site', dirname(dirname(dirname(dirname(dirname(PATH_thisScript))))).'/');
32 if (!defined('PATH_t3lib')) define('PATH_t3lib', PATH_site.'t3lib/');
33 define('PATH_typo3conf', PATH_site.'typo3conf/');
34 define('TYPO3_mainDir', 'typo3/');
35 if (!defined('PATH_typo3')) define('PATH_typo3', PATH_site.TYPO3_mainDir);
36 if (!defined('PATH_tslib')) {
37 if (@is_dir(PATH_site.'typo3/sysext/cms/tslib/')) {
38 define('PATH_tslib', PATH_site.'typo3/sysext/cms/tslib/');
39 } elseif (@is_dir(PATH_site.'tslib/')) {
40 define('PATH_tslib', PATH_site.'tslib/');
41 }
42 }
43 define('TYPO3_MODE','FE');
44 define('TYPO3_OS', stristr(PHP_OS,'win')&&!stristr(PHP_OS,'darwin')?'WIN':'');
45
46 require_once(PATH_t3lib.'class.t3lib_div.php');
47 require_once(PATH_t3lib.'class.t3lib_extmgm.php');
48 require_once(PATH_t3lib.'config_default.php');
49 require_once(PATH_typo3conf.'localconf.php');
50 require_once(PATH_tslib.'class.tslib_fe.php');
51 require_once(PATH_t3lib.'class.t3lib_tstemplate.php');
52 require_once(PATH_t3lib.'class.t3lib_page.php');
53 require_once(PATH_tslib.'class.tslib_content.php');
54 require_once(t3lib_extMgm::extPath('sr_freecap').'pi3/class.tx_srfreecap_pi3.php');
55 require_once(PATH_t3lib.'class.t3lib_userauth.php');
56 require_once(PATH_tslib.'class.tslib_feuserauth.php');
57 require_once(PATH_t3lib.'class.t3lib_cs.php');
58
59 if (!defined ('TYPO3_db')) die ('The configuration file was not included.');
60 if (isset($_GET['GLOBALS']) || isset($_POST['GLOBALS']) || isset($_FILES['GLOBALS']) || isset($_COOKIE['GLOBALS'])) die('You cannot set the GLOBALS-array from outside this script.');
61
62 require_once(PATH_t3lib.'class.t3lib_db.php');
63 $TYPO3_DB = t3lib_div::makeInstance('t3lib_DB');
64
65 require_once(PATH_t3lib.'class.t3lib_timetrack.php');
66 $GLOBALS['TT'] = new t3lib_timeTrack;
67
68 if (t3lib_div::int_from_ver( TYPO3_version ) >= 4003000) {
69 // ***********************************
70 // Initializing the Caching System
71 // ***********************************
72 $GLOBALS['TT']->push('Initializing the Caching System','');
73 require_once(PATH_t3lib . 'class.t3lib_cache.php');
74
75 require_once(PATH_t3lib . 'cache/class.t3lib_cache_abstractbackend.php');
76 require_once(PATH_t3lib . 'cache/class.t3lib_cache_abstractcache.php');
77 require_once(PATH_t3lib . 'cache/class.t3lib_cache_exception.php');
78 require_once(PATH_t3lib . 'cache/class.t3lib_cache_factory.php');
79 require_once(PATH_t3lib . 'cache/class.t3lib_cache_manager.php');
80 require_once(PATH_t3lib . 'cache/class.t3lib_cache_variablecache.php');
81
82 require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_classalreadyloaded.php');
83 require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_duplicateidentifier.php');
84 require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_invalidbackend.php');
85 require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_invalidcache.php');
86 require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_invaliddata.php');
87 require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_nosuchcache.php');
88
89 $typo3CacheManager = t3lib_div::makeInstance('t3lib_cache_Manager');
90 $cacheFactoryClass = t3lib_div::makeInstanceClassName('t3lib_cache_Factory');
91 $typo3CacheFactory = new $cacheFactoryClass($typo3CacheManager);
92
93 unset($cacheFactoryClass);
94 $GLOBALS['TT']->pull();
95 }
96
97 // ***********************************
98 // Creating a $TSFE object
99 // ***********************************
100 $TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
101 $id = t3lib_div::_GET('id');
102 if (!isset($id)) $id = 0;
103 $id = htmlspecialchars($id);
104 $TSFE = new $TSFEclassName($TYPO3_CONF_VARS, $id, '0', 1, '', '','','');
105 if (t3lib_div::int_from_ver( TYPO3_version ) >= 4003000) {
106 $TSFE->initCaches();
107 }
108 $TSFE->set_no_cache();
109 $TSFE->connectToDB();
110 $TSFE->initFEuser();
111 $TSFE->determineId();
112 $TSFE->initTemplate();
113 $TSFE->tmpl->getFileName_backPath = PATH_site;
114
115 // ******************************************************
116 // Get config if not already gotten
117 // After this, we should have a valid config-array ready
118 // ******************************************************
119 $TSFE->getConfigArray();
120
121 // *******************************************
122 // Setting language and locale
123 // *******************************************
124 $GLOBALS['TT']->push('Setting language and locale','');
125 $TSFE->settingLanguage();
126 $TSFE->settingLocale();
127 $GLOBALS['TT']->pull();
128
129 // *******************************************
130 // Invoke the freecap plugin
131 // *******************************************
132 $freecap = t3lib_div::makeInstance('tx_srfreecap_pi3');
133 $freecap->cObj = t3lib_div::makeInstance('tslib_cObj');
134 $conf = $TSFE->tmpl->setup['plugin.'][$freecap->prefixId.'.'];
135 $freecap->main($conf);
136 ?>