Fixed bug #9786: Remove duplicate JS-Files in backend.php
[Packages/TYPO3.CMS.git] / typo3 / sysext / rtehtmlarea / htmlarea / plugins / SpellChecker / spell-check-logic.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2003-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 is the script to invoke the spell checker for TYPO3 htmlArea RTE (rtehtmlarea)
26 *
27 * @author Stanislas Rolland <typo3(arobas)sjbr.ca>
28 *
29 * TYPO3 SVN ID: $Id$
30 *
31 */
32 error_reporting (E_ALL ^ E_NOTICE);
33 define('TYPO3_OS', (stristr(PHP_OS,'win') && !stristr(PHP_OS,'darwin')) ? 'WIN' : '');
34 if (!defined('PATH_thisScript')) 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']))));
35 if (!defined('PATH_site')) define('PATH_site', dirname(dirname(dirname(dirname(dirname(dirname(dirname(PATH_thisScript))))))).'/');
36 if (!defined('PATH_t3lib')) define('PATH_t3lib', PATH_site.'t3lib/');
37 define('PATH_typo3conf', PATH_site.'typo3conf/');
38 define('TYPO3_mainDir', 'typo3/');
39 if (!defined('PATH_typo3')) define('PATH_typo3', PATH_site.TYPO3_mainDir);
40 if (!defined('PATH_tslib')) {
41 if (@is_dir(PATH_site.'typo3/sysext/cms/tslib/')) {
42 define('PATH_tslib', PATH_site.'typo3/sysext/cms/tslib/');
43 } elseif (@is_dir(PATH_site.'tslib/')) {
44 define('PATH_tslib', PATH_site.'tslib/');
45 }
46 }
47 define('TYPO3_MODE','FE');
48
49 require_once(PATH_t3lib.'class.t3lib_div.php');
50 require_once(PATH_t3lib.'class.t3lib_extmgm.php');
51 require_once(PATH_t3lib.'config_default.php');
52 require_once(PATH_typo3conf.'localconf.php');
53 require_once(PATH_tslib.'class.tslib_fe.php');
54 require_once(PATH_t3lib.'class.t3lib_tstemplate.php');
55 require_once(PATH_t3lib.'class.t3lib_page.php');
56 require_once(PATH_tslib.'class.tslib_content.php');
57 require_once(t3lib_extMgm::extPath('rtehtmlarea').'pi1/class.tx_rtehtmlarea_pi1.php');
58 require_once(PATH_t3lib.'class.t3lib_userauth.php');
59 require_once(PATH_tslib.'class.tslib_feuserauth.php');
60
61 $typoVersion = t3lib_div::int_from_ver($GLOBALS['TYPO_VERSION']);
62 require_once(PATH_t3lib.'class.t3lib_cs.php');
63
64 if (!defined ('TYPO3_db')) die ('The configuration file was not included.');
65 if (isset($HTTP_POST_VARS['GLOBALS']) || isset($HTTP_GET_VARS['GLOBALS'])) die('You cannot set the GLOBALS-array from outside this script.');
66
67 require_once(PATH_t3lib.'class.t3lib_db.php');
68 $TYPO3_DB = t3lib_div::makeInstance('t3lib_DB');
69
70 require_once(PATH_t3lib.'class.t3lib_timetrack.php');
71 $GLOBALS['TT'] = new t3lib_timeTrack;
72
73 // ***********************************
74 // Initializing the Caching System
75 // ***********************************
76
77 $GLOBALS['TT']->push('Initializing the Caching System','');
78 require_once(PATH_t3lib . 'class.t3lib_cache.php');
79
80 require_once(PATH_t3lib . 'cache/class.t3lib_cache_abstractbackend.php');
81 require_once(PATH_t3lib . 'cache/class.t3lib_cache_abstractcache.php');
82 require_once(PATH_t3lib . 'cache/class.t3lib_cache_exception.php');
83 require_once(PATH_t3lib . 'cache/class.t3lib_cache_factory.php');
84 require_once(PATH_t3lib . 'cache/class.t3lib_cache_manager.php');
85 require_once(PATH_t3lib . 'cache/class.t3lib_cache_variablecache.php');
86
87 require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_classalreadyloaded.php');
88 require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_duplicateidentifier.php');
89 require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_invalidbackend.php');
90 require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_invalidcache.php');
91 require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_invaliddata.php');
92 require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_nosuchcache.php');
93
94 $typo3CacheManager = t3lib_div::makeInstance('t3lib_cache_Manager');
95 $cacheFactoryClass = t3lib_div::makeInstanceClassName('t3lib_cache_Factory');
96 $typo3CacheFactory = new $cacheFactoryClass($typo3CacheManager);
97
98 unset($cacheFactoryClass);
99 $GLOBALS['TT']->pull();
100
101 // ***********************************
102 // Creating a fake $TSFE object
103 // ***********************************
104 $TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
105 $id = isset($HTTP_GET_VARS['id'])?$HTTP_GET_VARS['id']:0;
106 $GLOBALS['TSFE'] = new $TSFEclassName($TYPO3_CONF_VARS, $id, '0', 1, '', '','','');
107 $GLOBALS['TSFE']->initCaches();
108 $GLOBALS['TSFE']->set_no_cache();
109 $GLOBALS['TSFE']->connectToMySQL();
110 $GLOBALS['TSFE']->initFEuser();
111 $GLOBALS['TSFE']->fetch_the_id();
112 $GLOBALS['TSFE']->getPageAndRootline();
113 $GLOBALS['TSFE']->initTemplate();
114 $GLOBALS['TSFE']->tmpl->getFileName_backPath = PATH_site;
115 $GLOBALS['TSFE']->forceTemplateParsing = 1;
116 $GLOBALS['TSFE']->getConfigArray();
117
118 // *********
119 // initialize a BE_USER if applicable
120 // *********
121 $BE_USER='';
122 if ($_COOKIE['be_typo_user']) { // If the backend cookie is set, we proceed and checks if a backend user is logged in.
123 $TYPO3_MISC['microtime_BE_USER_start'] = microtime();
124 $TT->push('Back End user initialized','');
125 require_once (PATH_t3lib.'class.t3lib_befunc.php');
126 require_once (PATH_t3lib.'class.t3lib_userauthgroup.php');
127 require_once (PATH_t3lib.'class.t3lib_beuserauth.php');
128 require_once (PATH_t3lib.'class.t3lib_tsfebeuserauth.php');
129
130 // the value this->formfield_status is set to empty in order to disable login-attempts to the backend account through this script
131 $BE_USER = t3lib_div::makeInstance('t3lib_tsfeBeUserAuth'); // New backend user object
132 $BE_USER->OS = TYPO3_OS;
133 $BE_USER->lockIP = $TYPO3_CONF_VARS['BE']['lockIP'];
134 $BE_USER->start(); // Object is initialized
135 $BE_USER->unpack_uc('');
136 if ($BE_USER->user['uid']) {
137 $BE_USER->fetchGroupData();
138 $TSFE->beUserLogin = 1;
139 }
140 // Now we need to do some additional checks for IP/SSL
141 if (!$BE_USER->checkLockToIP() || !$BE_USER->checkBackendAccessSettingsFromInitPhp()) {
142 // Unset the user initialization.
143 $BE_USER='';
144 $TSFE->beUserLogin=0;
145 }
146 }
147
148 $spellChecker = t3lib_div::makeInstance('tx_rtehtmlarea_pi1');
149 $spellChecker->cObj = t3lib_div::makeInstance('tslib_cObj');
150 $conf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$spellChecker->prefixId.'.'];
151 $spellChecker->main($conf);
152 ?>