<?php
  include_once '../doc-typo3-funcs.php';
  $doxygen_vars = array(	"title" => "TYPO3 4.0.1: typo3_src-4.0.1/t3lib/class.t3lib_beuserauth.php Source File",
				"datetime" => "Sat Dec 2 19:22:17 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_9d0e5c424a38b69aeeedc616a9634e5f.html">t3lib</a></div>
<h1>class.t3lib_beuserauth.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-2006 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="l00076"></a><a class="code" href="classt3lib__beUserAuth.html">00076</a> <span class="keyword">class </span><a class="code" href="classt3lib__beUserAuth.html">t3lib_beUserAuth</a> <span class="keyword">extends</span> <a class="code" href="classt3lib__userAuthGroup.html">t3lib_userAuthGroup</a> {
<a name="l00077"></a><a class="code" href="classt3lib__beUserAuth.html#f11e3d46fe22a4cbf77e1143d826321a">00077</a>         var <a class="code" href="classt3lib__beUserAuth.html#f11e3d46fe22a4cbf77e1143d826321a">$session_table</a> = 'be_sessions';             <span class="comment">// Table to use for session data.</span>
<a name="l00078"></a><a class="code" href="classt3lib__beUserAuth.html#b17c7b277e779a21c4f0ef3147e6a32e">00078</a>         var <a class="code" href="classt3lib__beUserAuth.html#b17c7b277e779a21c4f0ef3147e6a32e">$name</a> = 'be_typo_user';                 <span class="comment">// Session/Cookie name</span>
<a name="l00079"></a>00079 
<a name="l00080"></a><a class="code" href="classt3lib__beUserAuth.html#8c3cda24b6401bd9e3c421edc266c953">00080</a>         var <a class="code" href="classt3lib__beUserAuth.html#8c3cda24b6401bd9e3c421edc266c953">$user_table</a> = 'be_users';                                   <span class="comment">// Table in database with userdata</span>
<a name="l00081"></a><a class="code" href="classt3lib__beUserAuth.html#7d3d5da554bc4f6bee8b6c5e7045ab5f">00081</a>         var <a class="code" href="classt3lib__beUserAuth.html#7d3d5da554bc4f6bee8b6c5e7045ab5f">$username_column</a> = 'username';                      <span class="comment">// Column for login-name</span>
<a name="l00082"></a><a class="code" href="classt3lib__beUserAuth.html#8df2798e40f0b175cbf21346765df124">00082</a>         var <a class="code" href="classt3lib__beUserAuth.html#8df2798e40f0b175cbf21346765df124">$userident_column</a> = 'password';             <span class="comment">// Column for password</span>
<a name="l00083"></a><a class="code" href="classt3lib__beUserAuth.html#338acda876dd190d30daa22970dc50a3">00083</a>         var <a class="code" href="classt3lib__beUserAuth.html#338acda876dd190d30daa22970dc50a3">$userid_column</a> = 'uid';                                     <span class="comment">// Column for user-id</span>
<a name="l00084"></a><a class="code" href="classt3lib__beUserAuth.html#beb1d2db0b6bfa0d6d612010b5dccc42">00084</a>         var <a class="code" href="classt3lib__beUserAuth.html#beb1d2db0b6bfa0d6d612010b5dccc42">$lastLogin_column</a> = 'lastlogin';
<a name="l00085"></a><a class="code" href="classt3lib__beUserAuth.html#ffaae6dea8524fe101b5cc0f93e6bd18">00085</a>         var <a class="code" href="classt3lib__beUserAuth.html#ffaae6dea8524fe101b5cc0f93e6bd18">$notifyHeader</a> = 'From: TYPO3 Login notify &lt;no_reply@no_reply.no_reply&gt;';
<a name="l00086"></a>00086 
<a name="l00087"></a><a class="code" href="classt3lib__beUserAuth.html#6badf7cabbc0bca61d85c4f9a262fdcc">00087</a>         var <a class="code" href="classt3lib__beUserAuth.html#6badf7cabbc0bca61d85c4f9a262fdcc">$enablecolumns</a> = Array (
<a name="l00088"></a>00088                 'rootLevel' =&gt; 1,
<a name="l00089"></a>00089                 'deleted' =&gt; 'deleted',
<a name="l00090"></a>00090                 'disabled' =&gt; 'disable',
<a name="l00091"></a>00091                 'starttime' =&gt; 'starttime',
<a name="l00092"></a>00092                 'endtime' =&gt; 'endtime'
<a name="l00093"></a>00093         );
<a name="l00094"></a>00094 
<a name="l00095"></a><a class="code" href="classt3lib__beUserAuth.html#c9f6197438b1446451b41f76c6c91332">00095</a>         var <a class="code" href="classt3lib__beUserAuth.html#c9f6197438b1446451b41f76c6c91332">$formfield_uname</a> = 'username';                      <span class="comment">// formfield with login-name</span>
<a name="l00096"></a><a class="code" href="classt3lib__beUserAuth.html#b387f3bf837135b64c168045940d6b7a">00096</a>         var <a class="code" href="classt3lib__beUserAuth.html#b387f3bf837135b64c168045940d6b7a">$formfield_uident</a> = 'userident';            <span class="comment">// formfield with password</span>
<a name="l00097"></a><a class="code" href="classt3lib__beUserAuth.html#cb79642ddcd71408ffc6cbae5dd13fe5">00097</a>         var <a class="code" href="classt3lib__beUserAuth.html#cb79642ddcd71408ffc6cbae5dd13fe5">$formfield_chalvalue</a> = 'challenge';         <span class="comment">// formfield with a unique value which is used to encrypt the password and username</span>
<a name="l00098"></a><a class="code" href="classt3lib__beUserAuth.html#b17a07d6973c98f1509d98a58ad8c566">00098</a>         var <a class="code" href="classt3lib__beUserAuth.html#b17a07d6973c98f1509d98a58ad8c566">$formfield_status</a> = 'login_status';         <span class="comment">// formfield with status: *'login', 'logout'</span>
<a name="l00099"></a><a class="code" href="classt3lib__beUserAuth.html#28048c98ad70886f5b35d98612dcae01">00099</a>         var <a class="code" href="classt3lib__beUserAuth.html#28048c98ad70886f5b35d98612dcae01">$security_level</a> = 'superchallenged';        <span class="comment">// sets the level of security. *'normal' = clear-text. 'challenged' = hashed password/username from form in $formfield_uident. 'superchallenged' = hashed password hashed again with username.</span>
<a name="l00100"></a>00100 
<a name="l00101"></a><a class="code" href="classt3lib__beUserAuth.html#7183d6dc965e278ce8f1037a60b276bc">00101</a>         var <a class="code" href="classt3lib__beUserAuth.html#7183d6dc965e278ce8f1037a60b276bc">$writeStdLog</a> = 1;                                   <span class="comment">// Decides if the writelog() function is called at login and logout</span>
<a name="l00102"></a><a class="code" href="classt3lib__beUserAuth.html#283010604cdfa7eb605b7544cbabf859">00102</a>         var <a class="code" href="classt3lib__beUserAuth.html#283010604cdfa7eb605b7544cbabf859">$writeAttemptLog</a> = 1;                               <span class="comment">// If the writelog() functions is called if a login-attempt has be tried without success</span>
<a name="l00103"></a>00103 
<a name="l00104"></a><a class="code" href="classt3lib__beUserAuth.html#3e6c8e6de6a5183beb9e847236157e86">00104</a>         var <a class="code" href="classt3lib__beUserAuth.html#3e6c8e6de6a5183beb9e847236157e86">$auth_include</a> = '';                                         <span class="comment">// this is the name of the include-file containing the login form. If not set, login CAN be anonymous. If set login IS needed.</span>
<a name="l00105"></a>00105 
<a name="l00106"></a><a class="code" href="classt3lib__beUserAuth.html#35c5e570015d7a8b196753ae7a7f7eee">00106</a>         var <a class="code" href="classt3lib__beUserAuth.html#35c5e570015d7a8b196753ae7a7f7eee">$auth_timeout_field</a> = 6000;                         <span class="comment">// if &gt; 0 : session-timeout in seconds. if false/&lt;0 : no timeout. if string: The string is fieldname from the usertable where the timeout can be found.</span>
<a name="l00107"></a><a class="code" href="classt3lib__beUserAuth.html#ea5deedeaf599e614ff8fc7f147272d9">00107</a>         var <a class="code" href="classt3lib__beUserAuth.html#ea5deedeaf599e614ff8fc7f147272d9">$lifetime</a> = 0;                              <span class="comment">// 0 = Session-cookies. If session-cookies, the browser will stop session when the browser is closed. Else it keeps the session for $lifetime seconds.</span>
<a name="l00108"></a><a class="code" href="classt3lib__beUserAuth.html#4d4e8b58db7ccdde9ef8ac13b7b1c8bf">00108</a>         var <a class="code" href="classt3lib__beUserAuth.html#4d4e8b58db7ccdde9ef8ac13b7b1c8bf">$challengeStoredInCookie</a> = TRUE;
<a name="l00109"></a>00109 
<a name="l00110"></a>00110 
<a name="l00111"></a>00111                 <span class="comment">// User Config:</span>
<a name="l00112"></a><a class="code" href="classt3lib__beUserAuth.html#708b6f044e6911dca64a9acfe64b9053">00112</a>         var <a class="code" href="classt3lib__beUserAuth.html#708b6f044e6911dca64a9acfe64b9053">$uc</a>;
<a name="l00113"></a>00113 
<a name="l00114"></a>00114                 <span class="comment">// User Config Default values:</span>
<a name="l00115"></a>00115                 <span class="comment">// The array may contain other fields for configuration. For this, see "setup" extension and "TSConfig" document (User TSconfig, "setup.[xxx]....")</span>
<a name="l00116"></a>00116                 <span class="comment">/*</span>
<a name="l00117"></a>00117 <span class="comment">                        Reserved keys for other storage of session data:</span>
<a name="l00118"></a>00118 <span class="comment">                        moduleData</span>
<a name="l00119"></a>00119 <span class="comment">                        moduleSessionID</span>
<a name="l00120"></a>00120 <span class="comment">                */</span>
<a name="l00121"></a><a class="code" href="classt3lib__beUserAuth.html#95e6281b28805156f54cb0d98e7115a3">00121</a>         var <a class="code" href="classt3lib__beUserAuth.html#95e6281b28805156f54cb0d98e7115a3">$uc_default</a> = Array (
<a name="l00122"></a>00122                 'interfaceSetup' =&gt; '', <span class="comment">// serialized content that is used to store interface pane and menu positions. Set by the logout.php-script</span>
<a name="l00123"></a>00123                 'moduleData' =&gt; Array(),        <span class="comment">// user-data for the modules</span>
<a name="l00124"></a>00124                 'thumbnailsByDefault' =&gt; 0,
<a name="l00125"></a>00125                 'emailMeAtLogin' =&gt; 0,
<a name="l00126"></a>00126                 'condensedMode' =&gt; 0,
<a name="l00127"></a>00127                 'noMenuMode' =&gt; 0,
<a name="l00128"></a>00128                 'startInTaskCenter' =&gt; 0,
<a name="l00129"></a>00129                 'hideSubmoduleIcons' =&gt; 0,
<a name="l00130"></a>00130                 'helpText' =&gt; 1,
<a name="l00131"></a>00131                 'titleLen' =&gt; 30,
<a name="l00132"></a>00132                 'edit_wideDocument' =&gt; <span class="charliteral">'0'</span>,
<a name="l00133"></a>00133                 'edit_showFieldHelp' =&gt; 'icon',
<a name="l00134"></a>00134                 'edit_RTE' =&gt; <span class="charliteral">'1'</span>,
<a name="l00135"></a>00135                 'edit_docModuleUpload' =&gt; <span class="charliteral">'1'</span>,
<a name="l00136"></a>00136                 'disableCMlayers' =&gt; 0,
<a name="l00137"></a>00137                 'navFrameWidth' =&gt; '',  <span class="comment">// Default is 245 pixels</span>
<a name="l00138"></a>00138                 'navFrameResizable' =&gt; 0,
<a name="l00139"></a>00139         );
<a name="l00140"></a>00140 
<a name="l00141"></a>00141 
<a name="l00150"></a><a class="code" href="classt3lib__beUserAuth.html#2a4582f0bc3800b6f4ab4c57b08ca260">00150</a>         function <a class="code" href="classt3lib__beUserAuth.html#2a4582f0bc3800b6f4ab4c57b08ca260">trackBeUser</a>($flag)     {
<a name="l00151"></a>00151                 <span class="keywordflow">if</span> ($flag &amp;&amp; <a class="code" href="classt3lib__extMgm.html#297116a3b1e17045ff193f170b8c4a29">t3lib_extMgm::isLoaded</a>('beuser_tracking')) {
<a name="l00152"></a>00152                         $insertFields = array(
<a name="l00153"></a>00153                                 'userid' =&gt; intval($this-&gt;user['uid']),
<a name="l00154"></a>00154                                 'tstamp' =&gt; time(),
<a name="l00155"></a>00155                                 'script' =&gt; <a class="code" href="classt3lib__div.html#cd7ecd00954e9a6b0c14eb23cf875d3f">t3lib_div::getIndpEnv</a>('REQUEST_URI')
<a name="l00156"></a>00156                         );
<a name="l00157"></a>00157 
<a name="l00158"></a>00158                         $GLOBALS['TYPO3_DB']-&gt;exec_INSERTquery('sys_trackbeuser', $insertFields);
<a name="l00159"></a>00159                 }
<a name="l00160"></a>00160         }
<a name="l00161"></a>00161 
<a name="l00168"></a><a class="code" href="classt3lib__beUserAuth.html#e05186ed10dab6674b7de6ed67d039ae">00168</a>         function <a class="code" href="classt3lib__beUserAuth.html#e05186ed10dab6674b7de6ed67d039ae">checkLockToIP</a>()        {
<a name="l00169"></a>00169                 global $TYPO3_CONF_VARS;
<a name="l00170"></a>00170                 $out = 1;
<a name="l00171"></a>00171                 <span class="keywordflow">if</span> ($TYPO3_CONF_VARS['BE']['enabledBeUserIPLock'])      {
<a name="l00172"></a>00172                         $IPList = $this-&gt;<a class="code" href="classt3lib__userAuthGroup.html#fff30664946d054d6e69c8ef945f47c6">getTSConfigVal</a>('options.lockToIP');
<a name="l00173"></a>00173                         <span class="keywordflow">if</span> (trim($IPList))      {
<a name="l00174"></a>00174                                 $baseIP = <a class="code" href="classt3lib__div.html#cd7ecd00954e9a6b0c14eb23cf875d3f">t3lib_div::getIndpEnv</a>('REMOTE_ADDR');
<a name="l00175"></a>00175                                 $out = <a class="code" href="classt3lib__div.html#abe065a28b50e8a6e4b12523db7d4895">t3lib_div::cmpIP</a>($baseIP, $IPList);
<a name="l00176"></a>00176                         }
<a name="l00177"></a>00177                 }
<a name="l00178"></a>00178                 <span class="keywordflow">return</span> $out;
<a name="l00179"></a>00179         }
<a name="l00180"></a>00180 
<a name="l00188"></a><a class="code" href="classt3lib__beUserAuth.html#f16385989f8d979c8275df4e0859a2c1">00188</a>         function <a class="code" href="classt3lib__beUserAuth.html#f16385989f8d979c8275df4e0859a2c1">backendCheckLogin</a>()    {
<a name="l00189"></a>00189                 <span class="keywordflow">if</span> (!$this-&gt;user['uid'])        {
<a name="l00190"></a>00190                         <span class="keywordflow">if</span> (!defined('TYPO3_PROCEED_IF_NO_USER') || !TYPO3_PROCEED_IF_NO_USER)  {
<a name="l00191"></a>00191                                 <a class="code" href="classt3lib__BEfunc.html#5128bd912d99ed04990947fe9ca68e1e">t3lib_BEfunc::typo3PrintError</a> ('Login-error or session timed-out', 'No user logged in! Sorry, I can\'t proceed then!&lt;br /&gt;&lt;br /&gt;(You must have cookies enabled!)&lt;br /&gt;&lt;br /&gt;If your session has just timed-out, you may&lt;br /&gt;&lt;a href=<span class="stringliteral">"'.t3lib_div::locationHeaderUrl(t3lib_div::getIndpEnv('TYPO3_SITE_URL').TYPO3_mainDir.'index.php'.'"</span> target=<span class="stringliteral">"_top"</span>&gt;click here to re-login&lt;/a&gt;.',0));
<a name="l00192"></a>00192                                 exit;
<a name="l00193"></a>00193                         }
<a name="l00194"></a>00194                 } <span class="keywordflow">else</span> {        <span class="comment">// ...and if that's the case, call these functions</span>
<a name="l00195"></a>00195                         $this-&gt;<a class="code" href="classt3lib__userAuthGroup.html#2a33dc6e555248a650ea2b95ca696c93">fetchGroupData</a>();        <span class="comment">//      The groups are fetched and ready for permission checking in this initialization.        Tables.php must be read before this because stuff like the modules has impact in this</span>
<a name="l00196"></a>00196                         <span class="keywordflow">if</span> ($this-&gt;<a class="code" href="classt3lib__beUserAuth.html#e05186ed10dab6674b7de6ed67d039ae">checkLockToIP</a>())     {
<a name="l00197"></a>00197                                 <span class="keywordflow">if</span> (!$GLOBALS['TYPO3_CONF_VARS']['BE']['adminOnly'] || $this-&gt;<a class="code" href="classt3lib__userAuthGroup.html#4886dfa70720552a3a77a426aa208b11">isAdmin</a>())        {
<a name="l00198"></a>00198                                         $this-&gt;<a class="code" href="classt3lib__beUserAuth.html#ccff4e6d365b14fb64ec1fa0c3d58c63">backendSetUC</a>();          <span class="comment">// Setting the UC array. It's needed with fetchGroupData first, due to default/overriding of values.</span>
<a name="l00199"></a>00199                                         $this-&gt;<a class="code" href="classt3lib__beUserAuth.html#d8b9f8e989e8cd2d0b456da672b76132">emailAtLogin</a>();          <span class="comment">// email at login - if option set.</span>
<a name="l00200"></a>00200                                 } <span class="keywordflow">else</span> {
<a name="l00201"></a>00201                                         <a class="code" href="classt3lib__BEfunc.html#5128bd912d99ed04990947fe9ca68e1e">t3lib_BEfunc::typo3PrintError</a> ('Login-error<span class="charliteral">','</span>TYPO3 is in maintenance mode at the moment. Only administrators are allowed access.',0);
<a name="l00202"></a>00202                                         exit;
<a name="l00203"></a>00203                                 }
<a name="l00204"></a>00204                         } <span class="keywordflow">else</span> {
<a name="l00205"></a>00205                                 <a class="code" href="classt3lib__BEfunc.html#5128bd912d99ed04990947fe9ca68e1e">t3lib_BEfunc::typo3PrintError</a> ('Login-error<span class="charliteral">','</span>IP locking prevented you from being authorized. Can\'t proceed, sorry.',0);
<a name="l00206"></a>00206                                 exit;
<a name="l00207"></a>00207                         }
<a name="l00208"></a>00208                 }
<a name="l00209"></a>00209         }
<a name="l00210"></a>00210 
<a name="l00216"></a><a class="code" href="classt3lib__beUserAuth.html#1e1058084dd5d44e5be340d3eec13d33">00216</a>         function <a class="code" href="classt3lib__beUserAuth.html#1e1058084dd5d44e5be340d3eec13d33">checkCLIuser</a>() {
<a name="l00217"></a>00217                         <span class="comment">// First, check if cliMode is enabled:</span>
<a name="l00218"></a>00218                 <span class="keywordflow">if</span> (defined('TYPO3_cliMode') &amp;&amp; TYPO3_cliMode)  {
<a name="l00219"></a>00219                         <span class="keywordflow">if</span> (!$this-&gt;user['uid'])        {
<a name="l00220"></a>00220                                 <span class="keywordflow">if</span> (substr($GLOBALS['MCONF']['name'],0,5)=='_CLI_')     {
<a name="l00221"></a>00221                                         $userName = strtolower($GLOBALS['MCONF']['name']);
<a name="l00222"></a>00222                                         $this-&gt;<a class="code" href="classt3lib__userAuth.html#248eda4a84a2b26a130160232d278cc8">setBeUserByName</a>($userName);
<a name="l00223"></a>00223                                         <span class="keywordflow">if</span> ($this-&gt;user['uid']) {
<a name="l00224"></a>00224                                                 <span class="keywordflow">if</span> (!$this-&gt;<a class="code" href="classt3lib__userAuthGroup.html#4886dfa70720552a3a77a426aa208b11">isAdmin</a>())  {
<a name="l00225"></a>00225                                                         <span class="keywordflow">return</span> TRUE;
<a name="l00226"></a>00226                                                 } <span class="keywordflow">else</span> die('ERROR: CLI backend user <span class="stringliteral">"'.$userName.'"</span> was ADMIN which is not allowed!'.chr(10).chr(10));
<a name="l00227"></a>00227                                         } <span class="keywordflow">else</span> die('ERROR: No backend user named <span class="stringliteral">"'.$userName.'"</span> was found! [Database: '.TYPO3_db.<span class="charliteral">']'</span>.chr(10).chr(10));
<a name="l00228"></a>00228                                 } <span class="keywordflow">else</span> die('ERROR: Module name, <span class="stringliteral">"'.$GLOBALS['MCONF']['name'].'"</span>, was not prefixed with <span class="stringliteral">"_CLI_"</span>'.chr(10).chr(10));
<a name="l00229"></a>00229                         } <span class="keywordflow">else</span> die('ERROR: Another user was already loaded which is impossible in CLI mode!'.chr(10).chr(10));
<a name="l00230"></a>00230                 }
<a name="l00231"></a>00231         }
<a name="l00232"></a>00232 
<a name="l00240"></a><a class="code" href="classt3lib__beUserAuth.html#ccff4e6d365b14fb64ec1fa0c3d58c63">00240</a>         function <a class="code" href="classt3lib__beUserAuth.html#ccff4e6d365b14fb64ec1fa0c3d58c63">backendSetUC</a>() {
<a name="l00241"></a>00241                 global $TYPO3_CONF_VARS;
<a name="l00242"></a>00242 
<a name="l00243"></a>00243                         <span class="comment">// UC - user configuration is a serialized array inside the userobject</span>
<a name="l00244"></a>00244                 $temp_theSavedUC=unserialize($this-&gt;user['uc']);                <span class="comment">// if there is a saved uc we implement that instead of the default one.</span>
<a name="l00245"></a>00245                 <span class="keywordflow">if</span> (is_array($temp_theSavedUC)) {
<a name="l00246"></a>00246                         $this-&gt;<a class="code" href="classt3lib__userAuth.html#2eb92f3d72b787a52bb0de0fe435c82f">unpack_uc</a>($temp_theSavedUC);
<a name="l00247"></a>00247                 }
<a name="l00248"></a>00248                         <span class="comment">// Setting defaults if uc is empty</span>
<a name="l00249"></a>00249                 <span class="keywordflow">if</span> (!is_array($this-&gt;uc))       {
<a name="l00250"></a>00250                         $this-&gt;uc = array_merge($this-&gt;uc_default, (array)$TYPO3_CONF_VARS['BE']['defaultUC'], (array)$this-&gt;<a class="code" href="classt3lib__userAuthGroup.html#ee6e2392b93374a5120c3b3a0c369cb4">getTSConfigProp</a>('setup.default')); <span class="comment">// Candidate for t3lib_div::array_merge() if integer-keys will some day make trouble...</span>
<a name="l00251"></a>00251                         $this-&gt;<a class="code" href="classt3lib__beUserAuth.html#b356dda2deae74464c85ed5dccda4b23">overrideUC</a>();
<a name="l00252"></a>00252                         $U=1;
<a name="l00253"></a>00253                 }
<a name="l00254"></a>00254                         <span class="comment">// If TSconfig is updated, update the defaultUC.</span>
<a name="l00255"></a>00255                 <span class="keywordflow">if</span> ($this-&gt;userTSUpdated)       {
<a name="l00256"></a>00256                         $this-&gt;<a class="code" href="classt3lib__beUserAuth.html#b356dda2deae74464c85ed5dccda4b23">overrideUC</a>();
<a name="l00257"></a>00257                         $U=1;
<a name="l00258"></a>00258                 }
<a name="l00259"></a>00259                         <span class="comment">// Setting default lang from be_user record.</span>
<a name="l00260"></a>00260                 <span class="keywordflow">if</span> (!isset($this-&gt;uc['lang']))  {
<a name="l00261"></a>00261                         $this-&gt;uc['lang']=$this-&gt;user['lang'];
<a name="l00262"></a>00262                         $U=1;
<a name="l00263"></a>00263                 }
<a name="l00264"></a>00264 
<a name="l00265"></a>00265                         <span class="comment">// Saving if updated.</span>
<a name="l00266"></a>00266                 <span class="keywordflow">if</span> ($U) {
<a name="l00267"></a>00267                         $this-&gt;<a class="code" href="classt3lib__userAuth.html#65af6924cdc30fa7a8972e8b4d47ede7">writeUC</a>();       <span class="comment">// Method from the t3lib_userauth class.</span>
<a name="l00268"></a>00268                 }
<a name="l00269"></a>00269         }
<a name="l00270"></a>00270 
<a name="l00278"></a><a class="code" href="classt3lib__beUserAuth.html#b356dda2deae74464c85ed5dccda4b23">00278</a>         function <a class="code" href="classt3lib__beUserAuth.html#b356dda2deae74464c85ed5dccda4b23">overrideUC</a>()   {
<a name="l00279"></a>00279                 $this-&gt;uc = array_merge((array)$this-&gt;uc, (array)$this-&gt;<a class="code" href="classt3lib__userAuthGroup.html#ee6e2392b93374a5120c3b3a0c369cb4">getTSConfigProp</a>('setup.override'));     <span class="comment">// Candidate for t3lib_div::array_merge() if integer-keys will some day make trouble...</span>
<a name="l00280"></a>00280         }
<a name="l00281"></a>00281 
<a name="l00288"></a><a class="code" href="classt3lib__beUserAuth.html#e12259c76f9d8c2a000834612eb6c065">00288</a>         function <a class="code" href="classt3lib__beUserAuth.html#e12259c76f9d8c2a000834612eb6c065">resetUC</a>()      {
<a name="l00289"></a>00289                 $this-&gt;user['uc']='';
<a name="l00290"></a>00290                 $this-&gt;uc='';
<a name="l00291"></a>00291                 $this-&gt;<a class="code" href="classt3lib__beUserAuth.html#ccff4e6d365b14fb64ec1fa0c3d58c63">backendSetUC</a>();
<a name="l00292"></a>00292         }
<a name="l00293"></a>00293 
<a name="l00301"></a><a class="code" href="classt3lib__beUserAuth.html#d8b9f8e989e8cd2d0b456da672b76132">00301</a>         function <a class="code" href="classt3lib__beUserAuth.html#d8b9f8e989e8cd2d0b456da672b76132">emailAtLogin</a>() {
<a name="l00302"></a>00302                 <span class="keywordflow">if</span> ($this-&gt;loginSessionStarted) {
<a name="l00303"></a>00303                                 <span class="comment">// Send notify-mail</span>
<a name="l00304"></a>00304                         $subject = 'At <span class="stringliteral">"'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'].'"</span>'.
<a name="l00305"></a>00305                                                 ' from '.t3lib_div::getIndpEnv('REMOTE_ADDR').
<a name="l00306"></a>00306                                                 (<a class="code" href="classt3lib__div.html#cd7ecd00954e9a6b0c14eb23cf875d3f">t3lib_div::getIndpEnv</a>('REMOTE_HOST') ? ' ('.t3lib_div::getIndpEnv('REMOTE_HOST').<span class="charliteral">')'</span> : '');
<a name="l00307"></a>00307                         $msg = sprintf ('User <span class="stringliteral">"%s"</span> logged in from %s (%s) at <span class="stringliteral">"%s"</span> (%s)',
<a name="l00308"></a>00308                                 $this-&gt;user['username'],
<a name="l00309"></a>00309                                 <a class="code" href="classt3lib__div.html#cd7ecd00954e9a6b0c14eb23cf875d3f">t3lib_div::getIndpEnv</a>('REMOTE_ADDR'),
<a name="l00310"></a>00310                                 <a class="code" href="classt3lib__div.html#cd7ecd00954e9a6b0c14eb23cf875d3f">t3lib_div::getIndpEnv</a>('REMOTE_HOST'),
<a name="l00311"></a>00311                                 $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'],
<a name="l00312"></a>00312                                 <a class="code" href="classt3lib__div.html#cd7ecd00954e9a6b0c14eb23cf875d3f">t3lib_div::getIndpEnv</a>('HTTP_HOST')
<a name="l00313"></a>00313                         );
<a name="l00314"></a>00314 
<a name="l00315"></a>00315                                 <span class="comment">// Warning email address</span>
<a name="l00316"></a>00316                         <span class="keywordflow">if</span> ($GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr'])    {
<a name="l00317"></a>00317                                 $warn=0;
<a name="l00318"></a>00318                                 $prefix='';
<a name="l00319"></a>00319                                 <span class="keywordflow">if</span> (intval($GLOBALS['TYPO3_CONF_VARS']['BE']['warning_mode']) &amp; 1)      {       <span class="comment">// first bit: All logins</span>
<a name="l00320"></a>00320                                         $warn=1;
<a name="l00321"></a>00321                                         $prefix= $this-&gt;<a class="code" href="classt3lib__userAuthGroup.html#4886dfa70720552a3a77a426aa208b11">isAdmin</a>() ? '[AdminLoginWarning]' : '[LoginWarning]';
<a name="l00322"></a>00322                                 }
<a name="l00323"></a>00323                                 <span class="keywordflow">if</span> ($this-&gt;<a class="code" href="classt3lib__userAuthGroup.html#4886dfa70720552a3a77a426aa208b11">isAdmin</a>() &amp;&amp; (intval($GLOBALS['TYPO3_CONF_VARS']['BE']['warning_mode']) &amp; 2))        {       <span class="comment">// second bit: Only admin-logins</span>
<a name="l00324"></a>00324                                         $warn=1;
<a name="l00325"></a>00325                                         $prefix='[AdminLoginWarning]';
<a name="l00326"></a>00326                                 }
<a name="l00327"></a>00327                                 <span class="keywordflow">if</span> ($warn)      {
<a name="l00328"></a>00328                                         mail($GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr'],
<a name="l00329"></a>00329                                                 $prefix.<span class="charliteral">' '</span>.$subject,
<a name="l00330"></a>00330                                                 $msg,
<a name="l00331"></a>00331                                                 $this-&gt;notifyHeader
<a name="l00332"></a>00332                                         );
<a name="l00333"></a>00333                                 }
<a name="l00334"></a>00334                         }
<a name="l00335"></a>00335 
<a name="l00336"></a>00336                                 <span class="comment">// If An email should be sent to the current user, do that:</span>
<a name="l00337"></a>00337                         <span class="keywordflow">if</span> ($this-&gt;uc['emailMeAtLogin'] &amp;&amp; strstr($this-&gt;user['email'],<span class="charliteral">'@'</span>))    {
<a name="l00338"></a>00338                                 mail($this-&gt;user['email'],
<a name="l00339"></a>00339                                         $subject,
<a name="l00340"></a>00340                                         $msg,
<a name="l00341"></a>00341                                         $this-&gt;notifyHeader
<a name="l00342"></a>00342                                 );
<a name="l00343"></a>00343                         }
<a name="l00344"></a>00344                 }
<a name="l00345"></a>00345         }
<a name="l00346"></a>00346 
<a name="l00353"></a><a class="code" href="classt3lib__beUserAuth.html#1f99c2df088ae2b2ec0a312ae0f11ef7">00353</a>         function <a class="code" href="classt3lib__beUserAuth.html#1f99c2df088ae2b2ec0a312ae0f11ef7">veriCode</a>()     {
<a name="l00354"></a>00354                 <span class="keywordflow">return</span> substr(md5($this-&gt;<span class="keywordtype">id</span>.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']),0,10);
<a name="l00355"></a>00355         }
<a name="l00356"></a>00356 }
<a name="l00357"></a>00357 
<a name="l00358"></a>00358 
<a name="l00359"></a>00359 
<a name="l00360"></a>00360 
<a name="l00361"></a>00361 <span class="keywordflow">if</span> (defined('TYPO3_MODE') &amp;&amp; $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/<span class="keyword">class</span>.t3lib_beuserauth.php'])        {
<a name="l00362"></a>00362         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/<span class="keyword">class</span>.t3lib_beuserauth.php']);
<a name="l00363"></a>00363 }
<a name="l00364"></a>00364 ?&gt;
</pre></div><?php
  include_once '../doc-typo3-funcs.php';
  get_footer();
?>