<?php
  include_once '../doc-typo3-funcs.php';
  $doxygen_vars = array(	"title" => "TYPO3 4.0.1: typo3_src-4.0.1/typo3/init.php Source File",
				"datetime" => "Sat Dec 2 19:22:21 2006",
				"date" => "2 Dec 2006",
				"doxygenversion" => "1.4.6",
				"projectname" => "TYPO3 4.0.1",
				"projectnumber" => "4.0.1"
			);
  get_header($doxygen_vars);
?>
<!-- Generated by Doxygen 1.4.6 -->
<div class="tabs">
  <ul>
    <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="namespaces.html"><span>Namespaces</span></a></li>
    <li><a href="classes.html"><span>Classes</span></a></li>
    <li id="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="dirs.html"><span>Directories</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
    <li><a href="examples.html"><span>Examples</span></a></li>
    <li>
      <form action="search.php" method="get">
        <table cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
          </tr>
        </table>
      </form>
    </li>
  </ul></div>
<div class="nav">
<a class="el" href="dir_c8daf1ad746050abf985cc546c89e248.html">typo3_src-4.0.1</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_18071ae4545d8b3e0364d30c0659c74a.html">typo3</a></div>
<h1>init.php</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 &lt;?php
<a name="l00002"></a>00002 <span class="comment">/***************************************************************</span>
<a name="l00003"></a>00003 <span class="comment">*  Copyright notice</span>
<a name="l00004"></a>00004 <span class="comment">*</span>
<a name="l00005"></a>00005 <span class="comment">*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)</span>
<a name="l00006"></a>00006 <span class="comment">*  All rights reserved</span>
<a name="l00007"></a>00007 <span class="comment">*</span>
<a name="l00008"></a>00008 <span class="comment">*  This script is part of the TYPO3 project. The TYPO3 project is</span>
<a name="l00009"></a>00009 <span class="comment">*  free software; you can redistribute it and/or modify</span>
<a name="l00010"></a>00010 <span class="comment">*  it under the terms of the GNU General Public License as published by</span>
<a name="l00011"></a>00011 <span class="comment">*  the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00012"></a>00012 <span class="comment">*  (at your option) any later version.</span>
<a name="l00013"></a>00013 <span class="comment">*</span>
<a name="l00014"></a>00014 <span class="comment">*  The GNU General Public License can be found at</span>
<a name="l00015"></a>00015 <span class="comment">*  http://www.gnu.org/copyleft/gpl.html.</span>
<a name="l00016"></a>00016 <span class="comment">*  A copy is found in the textfile GPL.txt and important notices to the license</span>
<a name="l00017"></a>00017 <span class="comment">*  from the author is found in LICENSE.txt distributed with these scripts.</span>
<a name="l00018"></a>00018 <span class="comment">*</span>
<a name="l00019"></a>00019 <span class="comment">*</span>
<a name="l00020"></a>00020 <span class="comment">*  This script is distributed in the hope that it will be useful,</span>
<a name="l00021"></a>00021 <span class="comment">*  but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00022"></a>00022 <span class="comment">*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00023"></a>00023 <span class="comment">*  GNU General Public License for more details.</span>
<a name="l00024"></a>00024 <span class="comment">*</span>
<a name="l00025"></a>00025 <span class="comment">*  This copyright notice MUST APPEAR in all copies of the script!</span>
<a name="l00026"></a>00026 <span class="comment">***************************************************************/</span>
<a name="l00061"></a>00061 <span class="comment">// *******************************</span>
<a name="l00062"></a>00062 <span class="comment">// Set error reporting</span>
<a name="l00063"></a>00063 <span class="comment">// *******************************</span>
<a name="l00064"></a>00064 error_reporting (E_ALL ^ E_NOTICE);
<a name="l00065"></a>00065 
<a name="l00066"></a>00066 
<a name="l00067"></a>00067 <span class="comment">// *******************************</span>
<a name="l00068"></a>00068 <span class="comment">// Define constants</span>
<a name="l00069"></a>00069 <span class="comment">// *******************************</span>
<a name="l00070"></a>00070 define('TYPO3_OS', stristr(PHP_OS,'win')&amp;&amp;!stristr(PHP_OS,'darwin')?'WIN<span class="charliteral">':'</span>');
<a name="l00071"></a>00071 define('TYPO3_MODE<span class="charliteral">','</span>BE');
<a name="l00072"></a>00072 define('PATH_thisScript',str_replace('<span class="comment">//','/', str_replace('\\','/', (php_sapi_name()=='cgi'||php_sapi_name()=='isapi' ||php_sapi_name()=='cgi-fcgi')&amp;&amp;($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED'])? ($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED']):($_SERVER['ORIG_SCRIPT_FILENAME']?$_SERVER['ORIG_SCRIPT_FILENAME']:$_SERVER['SCRIPT_FILENAME']))));</span>
<a name="l00073"></a>00073 define('TYPO3_mainDir', 'typo3/');              <span class="comment">// This is the directory of the backend administration for the sites of this TYPO3 installation.</span>
<a name="l00074"></a>00074 
<a name="l00075"></a>00075 
<a name="l00076"></a>00076 <span class="comment">// *******************************</span>
<a name="l00077"></a>00077 <span class="comment">// Checking path</span>
<a name="l00078"></a>00078 <span class="comment">// *******************************</span>
<a name="l00079"></a>00079 $temp_path = str_replace(<span class="charliteral">'\\'</span>,<span class="charliteral">'/'</span>,dirname(PATH_thisScript).<span class="charliteral">'/'</span>);
<a name="l00080"></a>00080 $temp_modPath='';
<a name="l00081"></a>00081         <span class="comment">// If TYPO3_MOD_PATH is defined we must calculate the modPath since init.php must be included by a module</span>
<a name="l00082"></a>00082 <span class="keywordflow">if</span> (substr($temp_path,-strlen(TYPO3_mainDir))!=TYPO3_mainDir)   {
<a name="l00083"></a>00083         <span class="keywordflow">if</span> (defined('TYPO3_MOD_PATH'))  {
<a name="l00084"></a>00084                 <span class="keywordflow">if</span> (substr($temp_path,-strlen(TYPO3_MOD_PATH))==TYPO3_MOD_PATH) {
<a name="l00085"></a>00085                         $temp_path=substr($temp_path,0,-strlen(TYPO3_MOD_PATH));
<a name="l00086"></a>00086                         $temp_modPath=TYPO3_MOD_PATH;
<a name="l00087"></a>00087                 } elseif (substr(TYPO3_MOD_PATH,0,13)=='../typo3conf/' &amp;&amp; (substr(TYPO3_MOD_PATH,3)==substr($temp_path,-strlen(substr(TYPO3_MOD_PATH,3))))) {
<a name="l00088"></a>00088                         $temp_path = substr($temp_path,0,-strlen(substr(TYPO3_MOD_PATH,3))).TYPO3_mainDir;
<a name="l00089"></a>00089                         $temp_modPath=TYPO3_MOD_PATH;
<a name="l00090"></a>00090                 }
<a name="l00091"></a>00091                 <span class="keywordflow">if</span> (!@is_dir($temp_path))       {
<a name="l00092"></a>00092                         $temp_path='';
<a name="l00093"></a>00093                 }
<a name="l00094"></a>00094         }
<a name="l00095"></a>00095 }
<a name="l00096"></a>00096 
<a name="l00097"></a>00097 <span class="comment">// OUTPUT error message and exit if there are problems with the path. Otherwise define constants and continue.</span>
<a name="l00098"></a>00098 <span class="keywordflow">if</span> (!$temp_path || substr($temp_path,-strlen(TYPO3_mainDir))!=TYPO3_mainDir)    {       <span class="comment">// This must be the case in order to proceed</span>
<a name="l00099"></a>00099         <span class="keywordflow">if</span> (TYPO3_OS=='WIN')    {
<a name="l00100"></a>00100                 $thisPath_base = basename(substr($temp_path,-strlen(TYPO3_mainDir)));
<a name="l00101"></a>00101                 $mainPath_base = basename(TYPO3_mainDir);
<a name="l00102"></a>00102                 <span class="keywordflow">if</span> (!strcasecmp($thisPath, $mainPath))  {       <span class="comment">// Seems like the requested URL is not case-specific. This may happen on Windows only. -case. Otherwise, redirect to the correct URL. TYPO3_mainDir must be lower-case!!</span>
<a name="l00103"></a>00103                         $script_name = (php_sapi_name()=='cgi'||php_sapi_name()=='cgi-fcgi')&amp;&amp;($_SERVER['ORIG_PATH_INFO']?$_SERVER['ORIG_PATH_INFO']:$_SERVER['PATH_INFO']) ? ($_SERVER['ORIG_PATH_INFO']?$_SERVER['ORIG_PATH_INFO']:$_SERVER['PATH_INFO']) : ($_SERVER['ORIG_SCRIPT_NAME']?$_SERVER['ORIG_SCRIPT_NAME']:$_SERVER['SCRIPT_NAME']);      <span class="comment">// Copied from t3lib_div::getIndpEnv()</span>
<a name="l00104"></a>00104                         header('Location: '.str_replace($thisPath_base, $mainPath_base, $script_name));
<a name="l00105"></a>00105                         exit;
<a name="l00106"></a>00106                 }
<a name="l00107"></a>00107         }
<a name="l00108"></a>00108 
<a name="l00109"></a>00109         echo ('Error in init.php: Path to TYPO3 main dir could not be resolved correctly. &lt;br /&gt;&lt;br /&gt;
<a name="l00110"></a>00110                 This happens <span class="keywordflow">if</span> the last '.strlen(TYPO3_mainDir).' characters of <span class="keyword">this</span> path, '.$temp_path.', (\$temp_path) is NOT <span class="stringliteral">"'.TYPO3_mainDir.'"</span> <span class="keywordflow">for</span> some reason. &lt;br /&gt;
<a name="l00111"></a>00111                 You may have a strange server configuration.
<a name="l00112"></a>00112                 Or maybe you didn\'t set constant TYPO3_MOD_PATH in your module?');
<a name="l00113"></a>00113         echo '&lt;br /&gt;&lt;strong&gt;If you expect any help from anybody on <span class="keyword">this</span> issue, you should save <span class="keyword">this</span> page as an html document and send it along with your request <span class="keywordflow">for</span> help!&lt;/strong&gt;';
<a name="l00114"></a>00114         <span class="keywordflow">if</span> (strstr($temp_path,'typo3_src'))     {
<a name="l00115"></a>00115                 echo '&lt;br /&gt;&lt;font color=<span class="stringliteral">"red"</span>&gt;&lt;strong&gt; It seems you are trying to run the TYPO3 source libraries DIRECTLY! You cannot <span class="keywordflow">do</span> that. Please read the installation documents <span class="keywordflow">for</span> more information.&lt;br /&gt;
<a name="l00116"></a>00116                 However here is a little tip <span class="keywordflow">for</span> now: Download one of the zip-file <span class="stringliteral">"packages"</span>, eg the <span class="stringliteral">"testsite"</span> or <span class="stringliteral">"dummy"</span> package.&lt;/strong&gt;&lt;/font&gt;';
<a name="l00117"></a>00117         }
<a name="l00118"></a>00118         echo '&lt;HR&gt;&lt;pre&gt;';
<a name="l00119"></a>00119         print_r(array(
<a name="l00120"></a>00120                 'TYPO3_OS'=&gt;TYPO3_OS,
<a name="l00121"></a>00121                 'PATH_thisScript'=&gt;PATH_thisScript,
<a name="l00122"></a>00122                 'php_sapi_name()'=&gt;php_sapi_name(),
<a name="l00123"></a>00123                 'TYPO3_MOD_PATH'=&gt;TYPO3_MOD_PATH,
<a name="l00124"></a>00124                 'PATH_TRANSLATED'=&gt;$_SERVER['PATH_TRANSLATED'],
<a name="l00125"></a>00125                 'SCRIPT_FILENAME'=&gt;$_SERVER['SCRIPT_FILENAME']
<a name="l00126"></a>00126         ));
<a name="l00127"></a>00127         echo '&lt;/pre&gt;&lt;HR&gt;';
<a name="l00128"></a>00128         phpinfo();
<a name="l00129"></a>00129         exit;
<a name="l00130"></a>00130 } <span class="keywordflow">else</span> {
<a name="l00131"></a>00131         define('PATH_typo3', $temp_path);                       <span class="comment">// Abs. path of the TYPO3 admin dir (PATH_site + TYPO3_mainDir).</span>
<a name="l00132"></a>00132         define('PATH_typo3_mod', $temp_modPath);        <span class="comment">// Relative path (from the PATH_typo3) to a properly configured module</span>
<a name="l00133"></a>00133         define('PATH_site', substr(PATH_typo3,0,-strlen(TYPO3_mainDir)));       <span class="comment">// Abs. path to directory with the frontend (one above the admin-dir)</span>
<a name="l00134"></a>00134         $temp_path_t3lib = @is_dir(PATH_site.'t3lib/') ? PATH_site.'t3lib/' : PATH_typo3.'t3lib/';
<a name="l00135"></a>00135         define('PATH_t3lib', $temp_path_t3lib);                 <span class="comment">// Abs. path to t3lib/ (general TYPO3 library) within the TYPO3 admin dir</span>
<a name="l00136"></a>00136         define('PATH_typo3conf', PATH_site.'typo3conf/');       <span class="comment">// Abs. TYPO3 configuration path (local, not part of source)</span>
<a name="l00137"></a>00137 }
<a name="l00138"></a>00138 
<a name="l00139"></a>00139 
<a name="l00140"></a>00140 <span class="comment">// *************************************************</span>
<a name="l00141"></a>00141 <span class="comment">// t3lib_div + extention management class included</span>
<a name="l00142"></a>00142 <span class="comment">// *************************************************</span>
<a name="l00143"></a>00143 require_once(PATH_t3lib.'<span class="keyword">class</span>.t3lib_div.php');         <span class="comment">// The standard-library is included</span>
<a name="l00144"></a>00144 require_once(PATH_t3lib.'<span class="keyword">class</span>.t3lib_extmgm.php');      <span class="comment">// Extension API Management library included</span>
<a name="l00145"></a>00145 
<a name="l00146"></a>00146 <span class="comment">// ****************************************************</span>
<a name="l00147"></a>00147 <span class="comment">// Include configuration (localconf + ext_localconf)</span>
<a name="l00148"></a>00148 <span class="comment">// ****************************************************</span>
<a name="l00149"></a>00149 require(PATH_t3lib.'config_default.php');
<a name="l00150"></a>00150 <span class="keywordflow">if</span> (!defined ('TYPO3_db'))      die ('The configuration file was not included.');
<a name="l00151"></a>00151 
<a name="l00152"></a>00152 require_once(PATH_t3lib.'<span class="keyword">class</span>.t3lib_db.php');          <span class="comment">// The database library</span>
<a name="l00153"></a>00153 $TYPO3_DB = <a class="code" href="classt3lib__div.html#b47f8a8e8be44b79a0b8064dcd427bc1">t3lib_div::makeInstance</a>('<a class="code" href="classt3lib__DB.html">t3lib_DB</a>');
<a name="l00154"></a>00154 $TYPO3_DB-&gt;debugOutput = $TYPO3_CONF_VARS['SYS']['sqlDebug'];
<a name="l00155"></a>00155 
<a name="l00156"></a>00156 $CLIENT = <a class="code" href="classt3lib__div.html#4ab1e28e6e09d7c9470411b9bcc5f25e">t3lib_div::clientInfo</a>();                                      <span class="comment">// $CLIENT includes information about the browser/user-agent</span>
<a name="l00157"></a>00157 $PARSETIME_START = <a class="code" href="classt3lib__div.html#4351f76abf45f1fbae8dd0075744aa3c">t3lib_div::milliseconds</a>();           <span class="comment">// Is set to the system time in milliseconds. This could be used to output script parsetime in the end of the script</span>
<a name="l00158"></a>00158 
<a name="l00159"></a>00159 
<a name="l00160"></a>00160 <span class="comment">// *********************</span>
<a name="l00161"></a>00161 <span class="comment">// Libraries included</span>
<a name="l00162"></a>00162 <span class="comment">// *********************</span>
<a name="l00163"></a>00163 require_once(PATH_t3lib.'<span class="keyword">class</span>.t3lib_userauth.php');
<a name="l00164"></a>00164 require_once(PATH_t3lib.'<span class="keyword">class</span>.t3lib_userauthgroup.php');
<a name="l00165"></a>00165 require_once(PATH_t3lib.'<span class="keyword">class</span>.t3lib_beuserauth.php');
<a name="l00166"></a>00166 require_once(PATH_t3lib.'<span class="keyword">class</span>.t3lib_iconworks.php');
<a name="l00167"></a>00167 require_once(PATH_t3lib.'<span class="keyword">class</span>.t3lib_befunc.php');
<a name="l00168"></a>00168 require_once(PATH_t3lib.'<span class="keyword">class</span>.t3lib_cs.php');
<a name="l00169"></a>00169 
<a name="l00170"></a>00170 <span class="comment">// **********************</span>
<a name="l00171"></a>00171 <span class="comment">// Check Hardcoded lock on BE:</span>
<a name="l00172"></a>00172 <span class="comment">// **********************</span>
<a name="l00173"></a>00173 <span class="keywordflow">if</span> ($TYPO3_CONF_VARS['BE']['adminOnly'] &lt; 0)    {
<a name="l00174"></a>00174         header('Status: 404 Not Found');        <span class="comment">// Send Not Found header - if the webserver can make use of it...</span>
<a name="l00175"></a>00175         header('Location: http:<span class="comment">//');    // Just point us away from here...</span>
<a name="l00176"></a>00176         exit;   <span class="comment">// ... and exit good!</span>
<a name="l00177"></a>00177 }
<a name="l00178"></a>00178 
<a name="l00179"></a>00179 <span class="comment">// **********************</span>
<a name="l00180"></a>00180 <span class="comment">// Check IP</span>
<a name="l00181"></a>00181 <span class="comment">// **********************</span>
<a name="l00182"></a>00182 <span class="keywordflow">if</span> (trim($TYPO3_CONF_VARS['BE']['IPmaskList'])) {
<a name="l00183"></a>00183         <span class="keywordflow">if</span> (!<a class="code" href="classt3lib__div.html#abe065a28b50e8a6e4b12523db7d4895">t3lib_div::cmpIP</a>(<a class="code" href="classt3lib__div.html#cd7ecd00954e9a6b0c14eb23cf875d3f">t3lib_div::getIndpEnv</a>('REMOTE_ADDR'), $TYPO3_CONF_VARS['BE']['IPmaskList']))      {
<a name="l00184"></a>00184                 header('Status: 404 Not Found');        <span class="comment">// Send Not Found header - if the webserver can make use of it...</span>
<a name="l00185"></a>00185                 header('Location: http:<span class="comment">//');    // Just point us away from here...</span>
<a name="l00186"></a>00186                 exit;   <span class="comment">// ... and exit good!</span>
<a name="l00187"></a>00187         }
<a name="l00188"></a>00188 }
<a name="l00189"></a>00189 
<a name="l00190"></a>00190 
<a name="l00191"></a>00191 <span class="comment">// **********************</span>
<a name="l00192"></a>00192 <span class="comment">// Check SSL (https)</span>
<a name="l00193"></a>00193 <span class="comment">// **********************</span>
<a name="l00194"></a>00194 <span class="keywordflow">if</span> (intval($TYPO3_CONF_VARS['BE']['lockSSL']) &amp;&amp; !(defined('TYPO3_cliMode') &amp;&amp; TYPO3_cliMode))  {
<a name="l00195"></a>00195         <span class="keywordflow">if</span> ($TYPO3_CONF_VARS['BE']['lockSSL'] == 3)     {
<a name="l00196"></a>00196                 $requestStr = substr(<a class="code" href="classt3lib__div.html#cd7ecd00954e9a6b0c14eb23cf875d3f">t3lib_div::getIndpEnv</a>('TYPO3_REQUEST_SCRIPT'), strlen(<a class="code" href="classt3lib__div.html#cd7ecd00954e9a6b0c14eb23cf875d3f">t3lib_div::getIndpEnv</a>('TYPO3_SITE_URL').TYPO3_mainDir));
<a name="l00197"></a>00197                 <span class="keywordflow">if</span>($requestStr == 'index.php' &amp;&amp; !<a class="code" href="classt3lib__div.html#cd7ecd00954e9a6b0c14eb23cf875d3f">t3lib_div::getIndpEnv</a>('TYPO3_SSL'))   {
<a name="l00198"></a>00198                         list(,$url) = explode(':<span class="comment">//',t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'),2);</span>
<a name="l00199"></a>00199                         header('Location: https:<span class="comment">//'.$url);</span>
<a name="l00200"></a>00200                 }
<a name="l00201"></a>00201         } elseif (!<a class="code" href="classt3lib__div.html#cd7ecd00954e9a6b0c14eb23cf875d3f">t3lib_div::getIndpEnv</a>('TYPO3_SSL') ) {
<a name="l00202"></a>00202                 <span class="keywordflow">if</span> ($TYPO3_CONF_VARS['BE']['lockSSL'] == 2)     {
<a name="l00203"></a>00203                         list(,$url) = explode(':<span class="comment">//',t3lib_div::getIndpEnv('TYPO3_SITE_URL').TYPO3_mainDir,2);</span>
<a name="l00204"></a>00204                         header('Location: https:<span class="comment">//'.$url);      // Just point us away from here...</span>
<a name="l00205"></a>00205                 } <span class="keywordflow">else</span> {
<a name="l00206"></a>00206                         header('Status: 404 Not Found');        <span class="comment">// Send Not Found header - if the webserver can make use of it...</span>
<a name="l00207"></a>00207                         header('Location: http:<span class="comment">//');    // Just point us away from here...</span>
<a name="l00208"></a>00208                 }
<a name="l00209"></a>00209                 exit;   <span class="comment">// ... and exit good!</span>
<a name="l00210"></a>00210         }
<a name="l00211"></a>00211 }
<a name="l00212"></a>00212 
<a name="l00213"></a>00213 
<a name="l00214"></a>00214 <span class="comment">// *******************************</span>
<a name="l00215"></a>00215 <span class="comment">// Checking environment</span>
<a name="l00216"></a>00216 <span class="comment">// *******************************</span>
<a name="l00217"></a>00217 <span class="keywordflow">if</span> (<a class="code" href="classt3lib__div.html#764fcca6287e86a8c2aad10a5752b847">t3lib_div::int_from_ver</a>(phpversion())&lt;4001000)      die ('TYPO3 runs with PHP4.1.0+ only');
<a name="l00218"></a>00218 if (isset($_POST['GLOBALS']) || isset($_GET['GLOBALS']))        die('You cannot set the GLOBALS-array from outside the script.');
<a name="l00219"></a>00219 if (!get_magic_quotes_gpc())    {
<a name="l00220"></a>00220         <a class="code" href="classt3lib__div.html#89f103256c4b1b61ac5d5fb735b55ada">t3lib_div::addSlashesOnArray</a>($_GET);
<a name="l00221"></a>00221         <a class="code" href="classt3lib__div.html#89f103256c4b1b61ac5d5fb735b55ada">t3lib_div::addSlashesOnArray</a>($_POST);
<a name="l00222"></a>00222         $HTTP_GET_VARS = $_GET;
<a name="l00223"></a>00223         $HTTP_POST_VARS = $_POST;
<a name="l00224"></a>00224 }
<a name="l00225"></a>00225 
<a name="l00226"></a>00226 
<a name="l00227"></a>00227 <span class="comment">// ********************************************</span>
<a name="l00228"></a>00228 <span class="comment">// Check if the install script should be run:</span>
<a name="l00229"></a>00229 <span class="comment">// ********************************************</span>
<a name="l00230"></a>00230 <span class="keywordflow">if</span> (defined('TYPO3_enterInstallScript') &amp;&amp; TYPO3_enterInstallScript)    {
<a name="l00231"></a>00231         <span class="keywordflow">if</span> (!<a class="code" href="classt3lib__extMgm.html#297116a3b1e17045ff193f170b8c4a29">t3lib_extMgm::isLoaded</a>('install')) die('Install Tool is not loaded as an extension.&lt;br/&gt;You must add the key <span class="stringliteral">"install"</span> to the list of installed extensions in typo3conf/localconf.php, $TYPO3_CONF_VARS[<span class="stringliteral">"EXT"</span>][<span class="stringliteral">"extList"</span>].');
<a name="l00232"></a>00232 
<a name="l00233"></a>00233         require_once(<a class="code" href="classt3lib__extMgm.html#f395b211d97293002bbf92c3802392f5">t3lib_extMgm::extPath</a>('install').'mod/<span class="keyword">class</span>.<a class="code" href="classtx__install.html">tx_install</a>.php');
<a name="l00234"></a>00234         $install_check = <a class="code" href="classt3lib__div.html#b47f8a8e8be44b79a0b8064dcd427bc1">t3lib_div::makeInstance</a>('<a class="code" href="classtx__install.html">tx_install</a>');
<a name="l00235"></a>00235         $install_check-&gt;allowUpdateLocalConf = 1;
<a name="l00236"></a>00236         $install_check-&gt;init();
<a name="l00237"></a>00237         exit;
<a name="l00238"></a>00238 }
<a name="l00239"></a>00239 
<a name="l00240"></a>00240 
<a name="l00241"></a>00241 <span class="comment">// *************************</span>
<a name="l00242"></a>00242 <span class="comment">// Connect to the database</span>
<a name="l00243"></a>00243 <span class="comment">// *************************</span>
<a name="l00244"></a>00244 <span class="keywordflow">if</span> ($GLOBALS['TYPO3_DB']-&gt;sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password))    {
<a name="l00245"></a>00245         <span class="keywordflow">if</span> (!TYPO3_db)  {
<a name="l00246"></a>00246                 <a class="code" href="classt3lib__BEfunc.html#5128bd912d99ed04990947fe9ca68e1e">t3lib_BEfunc::typo3PrintError</a> ('No database selected<span class="charliteral">','</span>Database Error');
<a name="l00247"></a>00247                 exit;
<a name="l00248"></a>00248         } elseif (!$GLOBALS['TYPO3_DB']-&gt;sql_select_db(TYPO3_db))       {
<a name="l00249"></a>00249                 <a class="code" href="classt3lib__BEfunc.html#5128bd912d99ed04990947fe9ca68e1e">t3lib_BEfunc::typo3PrintError</a> ('Cannot connect to the current database, <span class="stringliteral">"'.TYPO3_db.'"</span><span class="charliteral">','</span>Database Error');
<a name="l00250"></a>00250                 exit;
<a name="l00251"></a>00251         }
<a name="l00252"></a>00252 } <span class="keywordflow">else</span> {
<a name="l00253"></a>00253         <a class="code" href="classt3lib__BEfunc.html#5128bd912d99ed04990947fe9ca68e1e">t3lib_BEfunc::typo3PrintError</a> ('The current username, password or host was not accepted when the connection to the database was attempted to be established!<span class="charliteral">','</span>Database Error');
<a name="l00254"></a>00254         exit;
<a name="l00255"></a>00255 }
<a name="l00256"></a>00256 
<a name="l00257"></a>00257 
<a name="l00258"></a>00258 <span class="comment">// *******************************</span>
<a name="l00259"></a>00259 <span class="comment">// Checks for proper browser</span>
<a name="l00260"></a>00260 <span class="comment">// *******************************</span>
<a name="l00261"></a>00261 <span class="keywordflow">if</span> (!$CLIENT['BROWSER'] &amp;&amp; !(defined('TYPO3_cliMode') &amp;&amp; TYPO3_cliMode))        {
<a name="l00262"></a>00262         <a class="code" href="classt3lib__BEfunc.html#5128bd912d99ed04990947fe9ca68e1e">t3lib_BEfunc::typo3PrintError</a> ('Browser error<span class="charliteral">','</span>You must use 4+ browsers with TYPO3!',0);
<a name="l00263"></a>00263         exit;
<a name="l00264"></a>00264 }
<a name="l00265"></a>00265 
<a name="l00266"></a>00266 
<a name="l00267"></a>00267 <span class="comment">// ****************************************************</span>
<a name="l00268"></a>00268 <span class="comment">// Include tables customization (tables + ext_tables)</span>
<a name="l00269"></a>00269 <span class="comment">// ****************************************************</span>
<a name="l00270"></a>00270 include (TYPO3_tables_script ? PATH_typo3conf.TYPO3_tables_script : PATH_t3lib.'stddb/tables.php');
<a name="l00271"></a>00271         <span class="comment">// Extension additions</span>
<a name="l00272"></a>00272 <span class="keywordflow">if</span> ($TYPO3_LOADED_EXT['_CACHEFILE'])    {
<a name="l00273"></a>00273         include (PATH_typo3conf.$TYPO3_LOADED_EXT['_CACHEFILE'].'_ext_tables.php');
<a name="l00274"></a>00274 } <span class="keywordflow">else</span> {
<a name="l00275"></a>00275         include (PATH_t3lib.'stddb/load_ext_tables.php');
<a name="l00276"></a>00276 }
<a name="l00277"></a>00277         <span class="comment">// extScript</span>
<a name="l00278"></a>00278 <span class="keywordflow">if</span> (TYPO3_extTableDef_script)   {
<a name="l00279"></a>00279         include (PATH_typo3conf.TYPO3_extTableDef_script);
<a name="l00280"></a>00280 }
<a name="l00281"></a>00281 
<a name="l00282"></a>00282 <span class="comment">// *******************************</span>
<a name="l00283"></a>00283 <span class="comment">// BackEnd User authentication</span>
<a name="l00284"></a>00284 <span class="comment">// *******************************</span>
<a name="l00285"></a>00285 <span class="comment">/*</span>
<a name="l00286"></a>00286 <span class="comment">        NOTICE:</span>
<a name="l00287"></a>00287 <span class="comment">        if constant TYPO3_PROCEED_IF_NO_USER is defined true (in the mainscript), this script will return even though a user did not log in!</span>
<a name="l00288"></a>00288 <span class="comment">*/</span>
<a name="l00289"></a>00289 $BE_USER = <a class="code" href="classt3lib__div.html#b47f8a8e8be44b79a0b8064dcd427bc1">t3lib_div::makeInstance</a>('<a class="code" href="classt3lib__beUserAuth.html">t3lib_beUserAuth</a>'); <span class="comment">// New backend user object</span>
<a name="l00290"></a>00290 $BE_USER-&gt;warningEmail = $TYPO3_CONF_VARS['BE']['warning_email_addr'];
<a name="l00291"></a>00291 $BE_USER-&gt;lockIP = $TYPO3_CONF_VARS['BE']['lockIP'];
<a name="l00292"></a>00292 $BE_USER-&gt;auth_timeout_field = intval($TYPO3_CONF_VARS['BE']['sessionTimeout']);
<a name="l00293"></a>00293 $BE_USER-&gt;OS = TYPO3_OS;
<a name="l00294"></a>00294 $BE_USER-&gt;start();                      <span class="comment">// Object is initialized</span>
<a name="l00295"></a>00295 $BE_USER-&gt;checkCLIuser();
<a name="l00296"></a>00296 $BE_USER-&gt;backendCheckLogin();  <span class="comment">// Checking if there's a user logged in</span>
<a name="l00297"></a>00297 $BE_USER-&gt;trackBeUser($TYPO3_CONF_VARS['BE']['trackBeUser']);   <span class="comment">// Tracking backend user script hits</span>
<a name="l00298"></a>00298 
<a name="l00299"></a>00299         <span class="comment">// Setting the web- and filemount global vars:</span>
<a name="l00300"></a>00300 $WEBMOUNTS = $BE_USER-&gt;returnWebmounts();               <span class="comment">// ! WILL INCLUDE deleted mount pages as well!</span>
<a name="l00301"></a>00301 $FILEMOUNTS = $BE_USER-&gt;returnFilemounts();
<a name="l00302"></a>00302 
<a name="l00303"></a>00303 
<a name="l00304"></a>00304 <span class="comment">// ****************</span>
<a name="l00305"></a>00305 <span class="comment">// CLI processing</span>
<a name="l00306"></a>00306 <span class="comment">// ****************</span>
<a name="l00307"></a>00307 <span class="keywordflow">if</span> (defined('TYPO3_cliMode') &amp;&amp; TYPO3_cliMode)  {
<a name="l00308"></a>00308                 <span class="comment">// Status output:</span>
<a name="l00309"></a>00309         <span class="keywordflow">if</span> (!strcmp($_SERVER['argv'][1],'status'))      {
<a name="l00310"></a>00310                 echo <span class="stringliteral">"Status of TYPO3 CLI script:\n\n"</span>;
<a name="l00311"></a>00311                 echo <span class="stringliteral">"Username [uid]: "</span>.$BE_USER-&gt;user['username'].<span class="stringliteral">" ["</span>.$BE_USER-&gt;user['uid'].<span class="stringliteral">"]\n"</span>;
<a name="l00312"></a>00312                 echo <span class="stringliteral">"Database: "</span>.TYPO3_db.<span class="stringliteral">"\n"</span>;
<a name="l00313"></a>00313                 echo <span class="stringliteral">"PATH_site: "</span>.PATH_site.<span class="stringliteral">"\n"</span>;
<a name="l00314"></a>00314                 echo <span class="stringliteral">"\n"</span>;
<a name="l00315"></a>00315                 exit;
<a name="l00316"></a>00316         }
<a name="l00317"></a>00317 }
<a name="l00318"></a>00318 
<a name="l00319"></a>00319 <span class="comment">// ****************</span>
<a name="l00320"></a>00320 <span class="comment">// compression</span>
<a name="l00321"></a>00321 <span class="comment">// ****************</span>
<a name="l00322"></a>00322 <span class="keywordflow">if</span> ($TYPO3_CONF_VARS['BE']['compressionLevel']) {
<a name="l00323"></a>00323         ob_start();
<a name="l00324"></a>00324         require_once (PATH_t3lib.'<span class="keyword">class</span>.gzip_encode.php');
<a name="l00325"></a>00325 }
<a name="l00326"></a>00326 ?&gt;
</pre></div><?php
  include_once '../doc-typo3-funcs.php';
  get_footer();
?>