Fixed bug #3472: No image rendering in T3 V4.3 alpha3.
[TYPO3CMS/Extensions/sr_freecap.git] / pi1 / captcha.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2005-2009 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 the freecap CAPTCHA image generation
26 *
27 */
28 error_reporting (E_ALL ^ E_NOTICE);
29 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']))));
30 if (!defined('PATH_site')) define('PATH_site', dirname(dirname(dirname(dirname(dirname(PATH_thisScript))))).'/');
31 if (!defined('PATH_t3lib')) define('PATH_t3lib', PATH_site.'t3lib/');
32 define('PATH_typo3conf', PATH_site.'typo3conf/');
33 define('TYPO3_mainDir', 'typo3/');
34 if (!defined('PATH_typo3')) define('PATH_typo3', PATH_site.TYPO3_mainDir);
35 if (!defined('PATH_tslib')) {
36 if (@is_dir(PATH_site.'typo3/sysext/cms/tslib/')) {
37 define('PATH_tslib', PATH_site.'typo3/sysext/cms/tslib/');
38 } elseif (@is_dir(PATH_site.'tslib/')) {
39 define('PATH_tslib', PATH_site.'tslib/');
40 }
41 }
42 define('TYPO3_MODE','FE');
43 define('TYPO3_OS', stristr(PHP_OS,'win')&&!stristr(PHP_OS,'darwin')?'WIN':'');
44
45 require_once(PATH_t3lib.'class.t3lib_div.php');
46 require_once(PATH_t3lib.'class.t3lib_extmgm.php');
47 require_once(PATH_t3lib.'config_default.php');
48 require_once(PATH_typo3conf.'localconf.php');
49 require_once(PATH_tslib.'class.tslib_fe.php');
50 require_once(PATH_t3lib.'class.t3lib_tstemplate.php');
51 require_once(PATH_t3lib.'class.t3lib_page.php');
52 require_once(PATH_tslib.'class.tslib_content.php');
53 require_once(t3lib_extMgm::extPath('sr_freecap').'pi1/class.tx_srfreecap_pi1.php');
54 require_once(PATH_t3lib.'class.t3lib_userauth.php');
55 require_once(PATH_tslib.'class.tslib_feuserauth.php');
56 require_once(PATH_t3lib.'class.t3lib_cs.php');
57
58 if (!defined ('TYPO3_db')) die ('The configuration file was not included.');
59 if (isset($_GET['GLOBALS']) || isset($_POST['GLOBALS']) || isset($_FILES['GLOBALS']) || isset($_COOKIE['GLOBALS'])) die('You cannot set the GLOBALS-array from outside this script.');
60
61 // *********************
62 // Autoloader
63 // *********************
64 if (t3lib_div::int_from_ver($GLOBALS['TYPO_VERSION']) >= 4003000) {
65 require_once(PATH_t3lib . 'class.t3lib_autoloader.php');
66 t3lib_autoloader::registerAutoloader();
67 }
68
69 require_once(PATH_t3lib.'class.t3lib_db.php');
70 $GLOBALS['TYPO3_DB'] = t3lib_div::makeInstance('t3lib_DB');
71
72 require_once(PATH_t3lib.'class.t3lib_timetrack.php');
73 $GLOBALS['TT'] = new t3lib_timeTrack;
74
75 // ***********************************
76 // Creating a $TSFE object
77 // ***********************************
78 $TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
79 $id = t3lib_div::_GET('id');
80 if (!isset($id)) $id = 0;
81 $id = htmlspecialchars($id);
82 $GLOBALS['TSFE'] = new $TSFEclassName($TYPO3_CONF_VARS, $id, '0', 1, '', '','','');
83 $GLOBALS['TSFE']->connectToDB();
84 $GLOBALS['TSFE']->initFEuser();
85 $GLOBALS['TSFE']->determineId();
86 // *******************************************
87 // Get compressed $TCA-Array();
88 // After this, we should now have a valid $TCA, though minimized
89 // *******************************************
90 $GLOBALS['TSFE']->getCompressedTCarray();
91 $GLOBALS['TSFE']->initTemplate();
92 $GLOBALS['TSFE']->tmpl->getFileName_backPath = PATH_site;
93
94 // ******************************************************
95 // Get config if not already gotten
96 // After this, we should have a valid config-array ready
97 // ******************************************************
98 $GLOBALS['TSFE']->getConfigArray();
99
100 // *******************************************
101 // Setting language and locale
102 // *******************************************
103 $GLOBALS['TT']->push('Setting language and locale','');
104 $GLOBALS['TSFE']->settingLanguage();
105 $GLOBALS['TSFE']->settingLocale();
106 $GLOBALS['TT']->pull();
107
108 // *******************************************
109 // Invoke the freecap plugin
110 // *******************************************
111 $freecap = t3lib_div::makeInstance('tx_srfreecap_pi1');
112 $freecap->cObj = t3lib_div::makeInstance('tslib_cObj');
113 $conf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$freecap->prefixId.'.'];
114 $freecap->main($conf);
115 ?>