- fix for bug 536: removed a hardcoded tt_news reference which inserted the admin...
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_userauthgroup.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
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 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Contains an extension class specifically for authentication/initialization of backend users in TYPO3
29 *
30 * $Id$
31 * Revised for TYPO3 3.6 July/2003 by Kasper Skaarhoj
32 *
33 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
34 */
35 /**
36 * [CLASS/FUNCTION INDEX of SCRIPT]
37 *
38 *
39 *
40 * 115: class t3lib_userAuthGroup extends t3lib_userAuth
41 *
42 * SECTION: Permission checking functions:
43 * 176: function isAdmin()
44 * 188: function isMemberOfGroup($groupId)
45 * 210: function doesUserHaveAccess($row,$perms)
46 * 227: function isInWebMount($id,$readPerms='',$exitOnError=0)
47 * 254: function modAccess($conf,$exitOnError)
48 * 290: function getPagePermsClause($perms)
49 * 329: function calcPerms($row)
50 * 367: function isRTE()
51 * 401: function check($type,$value)
52 * 418: function checkAuthMode($table,$field,$value,$authMode)
53 * 484: function checkLanguageAccess($langValue)
54 * 504: function recordEditAccessInternals($table,$idOrRow)
55 * 569: function isPSet($lCP,$table,$type='')
56 * 586: function mayMakeShortcut()
57 *
58 * SECTION: Miscellaneous functions
59 * 614: function getTSConfig($objectString,$config='')
60 * 640: function getTSConfigVal($objectString)
61 * 652: function getTSConfigProp($objectString)
62 * 664: function inList($in_list,$item)
63 * 675: function returnWebmounts()
64 * 685: function returnFilemounts()
65 *
66 * SECTION: Authentication methods
67 * 715: function fetchGroupData()
68 * 838: function fetchGroups($grList,$idList='')
69 * 910: function setCachedList($cList)
70 * 930: function addFileMount($title, $altTitle, $path, $webspace, $type)
71 * 977: function addTScomment($str)
72 *
73 * SECTION: Logging
74 * 1024: function writelog($type,$action,$error,$details_nr,$details,$data,$tablename='',$recuid='',$recpid='',$event_pid=-1,$NEWid='')
75 * 1057: function checkLogFailures($email, $secondsBack=3600, $max=3)
76 *
77 * TOTAL FUNCTIONS: 27
78 * (This index is automatically created/updated by the extension "extdeveval")
79 *
80 */
81
82 // Need this for parsing User TSconfig
83 require_once (PATH_t3lib.'class.t3lib_tsparser.php');
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105 /**
106 * Extension to class.t3lib_userauth.php; Authentication of users in TYPO3 Backend
107 *
108 * Actually this class is extended again by t3lib_beuserauth which is the actual backend user class that will be instantiated.
109 * In fact the two classes t3lib_beuserauth and this class could just as well be one, single class since t3lib_userauthgroup is not - to my knowledge - used separately elsewhere. But for historical reasons they are two separate classes.
110 *
111 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
112 * @package TYPO3
113 * @subpackage t3lib
114 */
115 class t3lib_userAuthGroup extends t3lib_userAuth {
116 var $usergroup_column = 'usergroup'; // Should be set to the usergroup-column (id-list) in the user-record
117 var $usergroup_table = 'be_groups'; // The name of the group-table
118
119 // internal
120 var $groupData = Array( // This array holds lists of eg. tables, fields and other values related to the permission-system. See fetchGroupData
121 'filemounts' => Array() // Filemounts are loaded here
122 );
123
124 var $userGroups = Array(); // This array will hold the groups that the user is a member of
125 var $userGroupsUID = Array(); // This array holds the uid's of the groups in the listed order
126 var $groupList =''; // This is $this->userGroupsUID imploded to a comma list... Will correspond to the 'usergroup_cached_list'
127 var $dataLists=array( // Used internally to accumulate data for the user-group. DONT USE THIS EXTERNALLY! Use $this->groupData instead
128 'webmount_list'=>'',
129 'filemount_list'=>'',
130 'modList'=>'',
131 'tables_select'=>'',
132 'tables_modify'=>'',
133 'pagetypes_select'=>'',
134 'non_exclude_fields'=>'',
135 'explicit_allowdeny'=>'',
136 'allowed_languages' => '',
137 'custom_options' => '',
138 );
139 var $includeHierarchy=array(); // For debugging/display of order in which subgroups are included.
140 var $includeGroupArray=array(); // List of group_id's in the order they are processed.
141
142 var $OS=''; // Set to 'WIN', if windows
143 var $TSdataArray=array(); // Used to accumulate the TSconfig data of the user
144 var $userTS_text = ''; // Contains the non-parsed user TSconfig
145 var $userTS = array(); // Contains the parsed user TSconfig
146 var $userTSUpdated=0; // Set internally if the user TSconfig was parsed and needs to be cached.
147 var $userTS_dontGetCached=0; // Set this from outside if you want the user TSconfig to ALWAYS be parsed and not fetched from cache.
148
149 var $RTE_errors = array(); // RTE availability errors collected.
150 var $errorMsg = ''; // Contains last error message
151
152
153
154
155
156
157
158
159
160
161
162
163
164 /************************************
165 *
166 * Permission checking functions:
167 *
168 ************************************/
169
170 /**
171 * Returns true if user is admin
172 * Basically this function evaluates if the ->user[admin] field has bit 0 set. If so, user is admin.
173 *
174 * @return boolean
175 */
176 function isAdmin() {
177 return (($this->user['admin']&1) ==1);
178 }
179
180 /**
181 * Returns true if the current user is a member of group $groupId
182 * $groupId must be set. $this->groupList must contain groups
183 * Will return true also if the user is a member of a group through subgroups.
184 *
185 * @param integer Group ID to look for in $this->groupList
186 * @return boolean
187 */
188 function isMemberOfGroup($groupId) {
189 $groupId = intval($groupId);
190 if ($this->groupList && $groupId) {
191 return $this->inList($this->groupList, $groupId);
192 }
193 }
194
195 /**
196 * Checks if the permissions is granted based on a page-record ($row) and $perms (binary and'ed)
197 *
198 * Bits for permissions, see $perms variable:
199 *
200 * 1 - Show: See/Copy page and the pagecontent.
201 * 16- Edit pagecontent: Change/Add/Delete/Move pagecontent.
202 * 2- Edit page: Change/Move the page, eg. change title, startdate, hidden.
203 * 4- Delete page: Delete the page and pagecontent.
204 * 8- New pages: Create new pages under the page.
205 *
206 * @param array $row is the pagerow for which the permissions is checked
207 * @param integer $perms is the binary representation of the permission we are going to check. Every bit in this number represents a permission that must be set. See function explanation.
208 * @return boolean True or False upon evaluation
209 */
210 function doesUserHaveAccess($row,$perms) {
211 $userPerms = $this->calcPerms($row);
212 return ($userPerms & $perms)==$perms;
213 }
214
215 /**
216 * Checks if the page id, $id, is found within the webmounts set up for the user.
217 * This should ALWAYS be checked for any page id a user works with, whether it's about reading, writing or whatever.
218 * The point is that this will add the security that a user can NEVER touch parts outside his mounted pages in the page tree. This is otherwise possible if the raw page permissions allows for it. So this security check just makes it easier to make safe user configurations.
219 * If the user is admin OR if this feature is disabled (fx. by setting TYPO3_CONF_VARS['BE']['lockBeUserToDBmounts']=0) then it returns "1" right away
220 * Otherwise the function will return the uid of the webmount which was first found in the rootline of the input page $id
221 *
222 * @param integer Page ID to check
223 * @param string Content of "->getPagePermsClause(1)" (read-permissions). If not set, they will be internally calculated (but if you have the correct value right away you can save that database lookup!)
224 * @param boolean If set, then the function will exit with an error message.
225 * @return integer The page UID of a page in the rootline that matched a mount point
226 */
227 function isInWebMount($id,$readPerms='',$exitOnError=0) {
228 if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts'] || $this->isAdmin()) return 1;
229 $id = intval($id);
230 if (!$readPerms) $readPerms = $this->getPagePermsClause(1);
231 if ($id>0) {
232 $wM = $this->returnWebmounts();
233 $rL = t3lib_BEfunc::BEgetRootLine($id,' AND '.$readPerms);
234
235 foreach($rL as $v) {
236 if ($v['uid'] && in_array($v['uid'],$wM)) {
237 return $v['uid'];
238 }
239 }
240 }
241 if ($exitOnError) {
242 t3lib_BEfunc::typo3PrintError ('Access Error','This page is not within your DB-mounts',0);
243 exit;
244 }
245 }
246
247 /**
248 * Checks access to a backend module with the $MCONF passed as first argument
249 *
250 * @param array $MCONF array of a backend module!
251 * @param boolean If set, an array will issue an error message and exit.
252 * @return boolean Will return true if $MCONF['access'] is not set at all, if the BE_USER is admin or if the module is enabled in the be_users/be_groups records of the user (specifically enabled). Will return false if the module name is not even found in $TBE_MODULES
253 */
254 function modAccess($conf,$exitOnError) {
255 if (!t3lib_BEfunc::isModuleSetInTBE_MODULES($conf['name'])) {
256 if ($exitOnError) {
257 t3lib_BEfunc::typo3PrintError ('Fatal Error','This module "'.$conf['name'].'" is not enabled in TBE_MODULES',0);
258 exit;
259 }
260 return false;
261 }
262
263 // Returns true if conf[access] is not set at all or if the user is admin
264 if (!$conf['access'] || $this->isAdmin()) return true;
265
266 // If $conf['access'] is set but not with 'admin' then we return true, if the module is found in the modList
267 if (!strstr($conf['access'],'admin') && $conf['name']) {
268 $acs = $this->check('modules',$conf['name']);
269 }
270 if (!$acs && $exitOnError) {
271 t3lib_BEfunc::typo3PrintError ('Access Error','You don\'t have access to this module.',0);
272 exit;
273 } else return $acs;
274 }
275
276 /**
277 * Returns a WHERE-clause for the pages-table where user permissions according to input argument, $perms, is validated.
278 * $perms is the 'mask' used to select. Fx. if $perms is 1 then you'll get all pages that a user can actually see!
279 * 2^0 = show (1)
280 * 2^1 = edit (2)
281 * 2^2 = delete (4)
282 * 2^3 = new (8)
283 * If the user is 'admin' " 1=1" is returned (no effect)
284 * If the user is not set at all (->user is not an array), then " 1=0" is returned (will cause no selection results at all)
285 * The 95% use of this function is "->getPagePermsClause(1)" which will return WHERE clauses for *selecting* pages in backend listings - in other words will this check read permissions.
286 *
287 * @param integer Permission mask to use, see function description
288 * @return string Part of where clause. Prefix " AND " to this.
289 */
290 function getPagePermsClause($perms) {
291 global $TYPO3_CONF_VARS;
292 if (is_array($this->user)) {
293 if ($this->isAdmin()) {
294 return ' 1=1';
295 }
296
297 $perms = intval($perms); // Make sure it's integer.
298 $str= ' ('.
299 '(pages.perms_everybody & '.$perms.' = '.$perms.')'. // Everybody
300 'OR(pages.perms_userid = '.$this->user['uid'].' AND pages.perms_user & '.$perms.' = '.$perms.')'; // User
301 if ($this->groupList){$str.='OR(pages.perms_groupid in ('.$this->groupList.') AND pages.perms_group & '.$perms.' = '.$perms.')';} // Group (if any is set)
302 $str.=')';
303
304 // ****************
305 // getPagePermsClause-HOOK
306 // ****************
307 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['getPagePermsClause'])) {
308
309 foreach($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['getPagePermsClause'] as $_funcRef) {
310 $_params = array('currentClause' => $str, 'perms' => $perms);
311 $str = t3lib_div::callUserFunction($_funcRef, $_params, $this);
312 }
313 }
314
315 return $str;
316 } else {
317 return ' 1=0';
318 }
319 }
320
321 /**
322 * Returns a combined binary representation of the current users permissions for the page-record, $row.
323 * The perms for user, group and everybody is OR'ed together (provided that the page-owner is the user and for the groups that the user is a member of the group
324 * If the user is admin, 31 is returned (full permissions for all five flags)
325 *
326 * @param array Input page row with all perms_* fields available.
327 * @return integer Bitwise representation of the users permissions in relation to input page row, $row
328 */
329 function calcPerms($row) {
330 global $TYPO3_CONF_VARS;
331 if ($this->isAdmin()) {return 31;} // Return 31 for admin users.
332
333 $out=0;
334 if (isset($row['perms_userid']) && isset($row['perms_user']) && isset($row['perms_groupid']) && isset($row['perms_group']) && isset($row['perms_everybody']) && isset($this->groupList)) {
335 if ($this->user['uid']==$row['perms_userid']) {
336 $out|=$row['perms_user'];
337 }
338 if ($this->isMemberOfGroup($row['perms_groupid'])) {
339 $out|=$row['perms_group'];
340 }
341 $out|=$row['perms_everybody'];
342 }
343
344 // ****************
345 // CALCPERMS hook
346 // ****************
347 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['calcPerms'])) {
348 foreach($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_userauthgroup.php']['calcPerms'] as $_funcRef) {
349 $_params = array(
350 'row' => $row,
351 'outputPermissions' => $out
352 );
353 $out = t3lib_div::callUserFunction($_funcRef, $_params, $this);
354 }
355 }
356
357 return $out;
358 }
359
360 /**
361 * Returns true if the RTE (Rich Text Editor) can be enabled for the user
362 * Strictly this is not permissions being checked but rather a series of settings like a loaded extension, browser/client type and a configuration option in ->uc[edit_RTE]
363 * The reasons for a FALSE return can be found in $this->RTE_errors
364 *
365 * @return boolean
366 */
367 function isRTE() {
368 global $CLIENT;
369
370 // Start:
371 $this->RTE_errors = array();
372 if (!$this->uc['edit_RTE'])
373 $this->RTE_errors[] = 'RTE is not enabled for user!';
374 if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled'])
375 $this->RTE_errors[] = 'RTE is not enabled in $TYPO3_CONF_VARS["BE"]["RTEenabled"]';
376
377
378 // Acquire RTE object:
379 $RTE = &t3lib_BEfunc::RTEgetObj();
380 if (!is_object($RTE)) {
381 $this->RTE_errors = array_merge($this->RTE_errors, $RTE);
382 }
383
384 if (!count($this->RTE_errors)) {
385 return TRUE;
386 } else {
387 return FALSE;
388 }
389 }
390
391 /**
392 * Returns true if the $value is found in the list in a $this->groupData[] index pointed to by $type (array key).
393 * Can thus be users to check for modules, exclude-fields, select/modify permissions for tables etc.
394 * If user is admin true is also returned
395 * Please see the document Inside TYPO3 for examples.
396 *
397 * @param string The type value; "webmounts", "filemounts", "pagetypes_select", "tables_select", "tables_modify", "non_exclude_fields", "modules"
398 * @param string String to search for in the groupData-list
399 * @return boolean True if permission is granted (that is, the value was found in the groupData list - or the BE_USER is "admin")
400 */
401 function check($type,$value) {
402 if (isset($this->groupData[$type])) {
403 if ($this->isAdmin() || $this->inList($this->groupData[$type],$value)) {
404 return 1;
405 }
406 }
407 }
408
409 /**
410 * Checking the authMode of a select field with authMode set
411 *
412 * @param string Table name
413 * @param string Field name (must be configured in TCA and of type "select" with authMode set!)
414 * @param string Value to evaluation (single value, must not contain any of the chars ":,|")
415 * @param string Auth mode keyword (explicitAllow, explicitDeny, individual)
416 * @return boolean True or false whether access is granted or not.
417 */
418 function checkAuthMode($table,$field,$value,$authMode) {
419 global $TCA;
420
421 // Admin users can do anything:
422 if ($this->isAdmin()) return TRUE;
423
424 // Allow all blank values:
425 if (!strcmp($value,'')) return TRUE;
426
427 // Certain characters are not allowed in the value
428 if (ereg('[:|,]',$value)) {
429 return FALSE;
430 }
431
432 // Initialize:
433 $testValue = $table.':'.$field.':'.$value;
434 $out = TRUE;
435
436 // Checking value:
437 switch((string)$authMode) {
438 case 'explicitAllow':
439 if (!$this->inList($this->groupData['explicit_allowdeny'],$testValue.':ALLOW')) {
440 $out = FALSE;
441 }
442 break;
443 case 'explicitDeny':
444 if ($this->inList($this->groupData['explicit_allowdeny'],$testValue.':DENY')) {
445 $out = FALSE;
446 }
447 break;
448 case 'individual':
449 t3lib_div::loadTCA($table);
450 if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$field])) {
451 $items = $TCA[$table]['columns'][$field]['config']['items'];
452 if (is_array($items)) {
453 foreach($items as $iCfg) {
454 if (!strcmp($iCfg[1],$value) && $iCfg[4]) {
455 switch((string)$iCfg[4]) {
456 case 'EXPL_ALLOW':
457 if (!$this->inList($this->groupData['explicit_allowdeny'],$testValue.':ALLOW')) {
458 $out = FALSE;
459 }
460 break;
461 case 'EXPL_DENY':
462 if ($this->inList($this->groupData['explicit_allowdeny'],$testValue.':DENY')) {
463 $out = FALSE;
464 }
465 break;
466 }
467 break;
468 }
469 }
470 }
471 }
472 break;
473 }
474
475 return $out;
476 }
477
478 /**
479 * Checking if a language value (-1, 0 and >0 for sys_language records) is allowed to be edited by the user.
480 *
481 * @param integer Language value to evaluate
482 * @return boolean Returns true if the language value is allowed, otherwise false.
483 */
484 function checkLanguageAccess($langValue) {
485 if (strcmp($this->groupData['allowed_languages'],'')) { // The users language list must be non-blank - otherwise all languages are allowed.
486 $langValue = intval($langValue);
487 if ($langValue != -1 && !$this->check('allowed_languages',$langValue)) { // Language must either be explicitly allowed OR the lang Value be "-1" (all languages)
488 return FALSE;
489 }
490 }
491 return TRUE;
492 }
493
494 /**
495 * Checking if a user has editing access to a record from a $TCA table.
496 * The checks does not take page permissions and other "environmental" things into account. It only deal with record internals; If any values in the record fields disallows it.
497 * For instance languages settings, authMode selector boxes are evaluated (and maybe more in the future).
498 * The function takes an ID (integer) or row (array) as second argument.
499 *
500 * @param string Table name
501 * @param mixed If integer, then this is the ID of the record. If Array this just represents fields in the record.
502 * @return boolean True if OK, otherwise false
503 */
504 function recordEditAccessInternals($table,$idOrRow) {
505 global $TCA;
506
507 if (isset($TCA[$table])) {
508 t3lib_div::loadTCA($table);
509
510 // Always return true for Admin users.
511 if ($this->isAdmin()) return TRUE;
512
513 // Fetching the record if the $idOrRow variable was not an array on input:
514 if (!is_array($idOrRow)) {
515 $idOrRow = t3lib_BEfunc::getRecord($table, $idOrRow);
516 if (!is_array($idOrRow)) {
517 $this->errorMsg = 'ERROR: Record could not be fetched.';
518 return FALSE;
519 }
520 }
521
522 // Checking languages:
523 if ($TCA[$table]['ctrl']['languageField']) {
524 if (isset($idOrRow[$TCA[$table]['ctrl']['languageField']])) { // Language field must be found in input row - otherwise it does not make sense.
525 if (!$this->checkLanguageAccess($idOrRow[$TCA[$table]['ctrl']['languageField']])) {
526 $this->errorMsg = 'ERROR: Language was not allowed.';
527 return FALSE;
528 }
529 }
530 }
531
532 // Checking authMode fields:
533 if (is_array($TCA[$table]['columns'])) {
534 foreach($TCA[$table]['columns'] as $fN => $fV) {
535 if (isset($idOrRow[$fN])) { //
536 if ($fV['config']['type']=='select' && $fV['config']['authMode'] && !strcmp($fV['config']['authMode_enforce'],'strict')) {
537 if (!$this->checkAuthMode($table,$fN,$idOrRow[$fN],$fV['config']['authMode'])) {
538 $this->errorMsg = 'ERROR: authMode "'.$fV['config']['authMode'].'" failed for field "'.$fN.'" with value "'.$idOrRow[$fN].'" evaluated';
539 return FALSE;
540 }
541 }
542 }
543 }
544 }
545
546 // Checking "editlock" feature
547 if ($TCA[$table]['ctrl']['editlock'] && $idOrRow[$TCA[$table]['ctrl']['editlock']]) {
548 $this->errorMsg = 'ERROR: Record was locked for editing. Only admin users can change this state.';
549 return FALSE;
550 }
551
552 // Checking record permissions
553 // THIS is where we can include a check for "perms_" fields for other records than pages...
554
555 // Finally, return true if all is well.
556 return TRUE;
557 }
558 }
559
560 /**
561 * Will check a type of permission against the compiled permission integer, $lCP, and in relation to table, $table
562 *
563 * @param integer $lCP could typically be the "compiled permissions" integer returned by ->calcPerms
564 * @param string $table is the tablename to check: If "pages" table then edit,new,delete and editcontent permissions can be checked. Other tables will be checked for "editcontent" only (and $type will be ignored)
565 * @param string For $table='pages' this can be 'edit' (2), 'new' (8 or 16), 'delete' (4), 'editcontent' (16). For all other tables this is ignored. (16 is used)
566 * @return boolean
567 * @access private
568 */
569 function isPSet($lCP,$table,$type='') {
570 if ($this->isAdmin()) return true;
571 if ($table=='pages') {
572 if ($type=='edit') return $lCP & 2;
573 if ($type=='new') return ($lCP & 8) || ($lCP & 16); // Create new page OR pagecontent
574 if ($type=='delete') return $lCP & 4;
575 if ($type=='editcontent') return $lCP & 16;
576 } else {
577 return $lCP & 16;
578 }
579 }
580
581 /**
582 * Returns true if the BE_USER is allowed to *create* shortcuts in the backend modules
583 *
584 * @return boolean
585 */
586 function mayMakeShortcut() {
587 return $this->getTSConfigVal('options.shortcutFrame') && !$this->getTSConfigVal('options.mayNotCreateEditShortcuts');
588 }
589
590
591
592
593
594
595
596
597
598
599 /*************************************
600 *
601 * Miscellaneous functions
602 *
603 *************************************/
604
605 /**
606 * Returns the value/properties of a TS-object as given by $objectString, eg. 'options.dontMountAdminMounts'
607 * Nice (general!) function for returning a part of a TypoScript array!
608 *
609 * @param string Pointer to an "object" in the TypoScript array, fx. 'options.dontMountAdminMounts'
610 * @param array Optional TSconfig array: If array, then this is used and not $this->userTS. If not array, $this->userTS is used.
611 * @return array An array with two keys, "value" and "properties" where "value" is a string with the value of the objectsting and "properties" is an array with the properties of the objectstring.
612 * @params array An array with the TypoScript where the $objectString is located. If this argument is not an array, then internal ->userTS (User TSconfig for the current BE_USER) will be used instead.
613 */
614 function getTSConfig($objectString,$config='') {
615 if (!is_array($config)) {
616 $config=$this->userTS; // Getting Root-ts if not sent
617 }
618 $TSConf=array();
619 $parts = explode('.',$objectString,2);
620 $key = $parts[0];
621 if (trim($key)) {
622 if (count($parts)>1 && trim($parts[1])) {
623 // Go on, get the next level
624 if (is_array($config[$key.'.'])) $TSConf = $this->getTSConfig($parts[1],$config[$key.'.']);
625 } else {
626 $TSConf['value']=$config[$key];
627 $TSConf['properties']=$config[$key.'.'];
628 }
629 }
630 return $TSConf;
631 }
632
633 /**
634 * Returns the "value" of the $objectString from the BE_USERS "User TSconfig" array
635 *
636 * @param string Object string, eg. "somestring.someproperty.somesubproperty"
637 * @return string The value for that object string (object path)
638 * @see getTSConfig()
639 */
640 function getTSConfigVal($objectString) {
641 $TSConf = $this->getTSConfig($objectString);
642 return $TSConf['value'];
643 }
644
645 /**
646 * Returns the "properties" of the $objectString from the BE_USERS "User TSconfig" array
647 *
648 * @param string Object string, eg. "somestring.someproperty.somesubproperty"
649 * @return array The properties for that object string (object path) - if any
650 * @see getTSConfig()
651 */
652 function getTSConfigProp($objectString) {
653 $TSConf = $this->getTSConfig($objectString);
654 return $TSConf['properties'];
655 }
656
657 /**
658 * Returns true if $item is in $in_list
659 *
660 * @param string Comma list with items, no spaces between items!
661 * @param string The string to find in the list of items
662 * @return string Boolean
663 */
664 function inList($in_list,$item) {
665 return strstr(','.$in_list.',', ','.$item.',');
666 }
667
668 /**
669 * Returns an array with the webmounts.
670 * If no webmounts, and empty array is returned.
671 * NOTICE: Deleted pages WILL NOT be filtered out! So if a mounted page has been deleted it is STILL coming out as a webmount. This is not checked due to performance.
672 *
673 * @return array
674 */
675 function returnWebmounts() {
676 return (string)($this->groupData['webmounts'])!='' ? explode(',',$this->groupData['webmounts']) : Array();
677 }
678
679 /**
680 * Returns an array with the filemounts for the user. Each filemount is represented with an array of a "name", "path" and "type".
681 * If no filemounts an empty array is returned.
682 *
683 * @return array
684 */
685 function returnFilemounts() {
686 return $this->groupData['filemounts'];
687 }
688
689
690
691
692
693
694
695
696
697
698
699
700 /*************************************
701 *
702 * Authentication methods
703 *
704 *************************************/
705
706
707 /**
708 * Initializes a lot of stuff like the access-lists, database-mountpoints and filemountpoints
709 * This method is called by ->backendCheckLogin() (from extending class t3lib_beuserauth) if the backend user login has verified OK.
710 *
711 * @return void
712 * @access private
713 * @see t3lib_TSparser
714 */
715 function fetchGroupData() {
716 if ($this->user['uid']) {
717
718 // Get lists for the be_user record and set them as default/primary values.
719 $this->dataLists['modList'] = $this->user['userMods']; // Enabled Backend Modules
720 $this->dataLists['allowed_languages'] = $this->user['allowed_languages']; // Add Allowed Languages
721 $this->dataLists['webmount_list'] = $this->user['db_mountpoints']; // Database mountpoints
722 $this->dataLists['filemount_list'] = $this->user['file_mountpoints']; // File mountpoints
723
724 // Setting default User TSconfig:
725 $this->TSdataArray[]=$this->addTScomment('From $GLOBALS["TYPO3_CONF_VARS"]["BE"]["defaultUserTSconfig"]:').
726 $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultUserTSconfig'];
727
728 // Default TSconfig for admin-users
729 if ($this->isAdmin()) {
730 $this->TSdataArray[]=$this->addTScomment('"admin" user presets:').'
731 admPanel.enable.all = 1
732 options.shortcutFrame = 1
733 ';
734 if (t3lib_extMgm::isLoaded('sys_note')) {
735 $this->TSdataArray[]='
736 // Setting defaults for sys_note author / email...
737 TCAdefaults.sys_note.author = '.$this->user['realName'].'
738 TCAdefaults.sys_note.email = '.$this->user['email'].'
739 ';
740 }
741 }
742
743 // FILE MOUNTS:
744 // Admin users has the base fileadmin dir mounted
745 if ($this->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']) {
746 $this->addFileMount($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '', PATH_site.$GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], 0, '');
747 }
748
749 // If userHomePath is set, we attempt to mount it
750 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['userHomePath']) {
751 // First try and mount with [uid]_[username]
752 $didMount=$this->addFileMount($this->user['username'], '',$GLOBALS['TYPO3_CONF_VARS']['BE']['userHomePath'].$this->user['uid'].'_'.$this->user['username'].$GLOBALS['TYPO3_CONF_VARS']['BE']['userUploadDir'], 0, 'user');
753 if (!$didMount) {
754 // If that failed, try and mount with only [uid]
755 $this->addFileMount($this->user['username'], '', $GLOBALS['TYPO3_CONF_VARS']['BE']['userHomePath'].$this->user['uid'].$GLOBALS['TYPO3_CONF_VARS']['BE']['userUploadDir'], 0, 'user');
756 }
757 }
758
759 // BE_GROUPS:
760 // Get the groups...
761 # $grList = t3lib_BEfunc::getSQLselectableList($this->user[$this->usergroup_column],$this->usergroup_table,$this->usergroup_table);
762 $grList = $GLOBALS['TYPO3_DB']->cleanIntList($this->user[$this->usergroup_column]); // 240203: Since the group-field never contains any references to groups with a prepended table name we think it's safe to just intExplode and re-implode - which should be much faster than the other function call.
763 if ($grList) {
764 // Fetch groups will add a lot of information to the internal arrays: modules, accesslists, TSconfig etc. Refer to fetchGroups() function.
765 $this->fetchGroups($grList);
766 }
767
768 // Add the TSconfig for this specific user:
769 $this->TSdataArray[] = $this->addTScomment('USER TSconfig field').$this->user['TSconfig'];
770 // Check include lines.
771 $this->TSdataArray = t3lib_TSparser::checkIncludeLines_array($this->TSdataArray);
772
773 // Parsing the user TSconfig (or getting from cache)
774 $this->userTS_text = implode(chr(10).'[GLOBAL]'.chr(10),$this->TSdataArray); // Imploding with "[global]" will make sure that non-ended confinements with braces are ignored.
775 $hash = md5('userTS:'.$this->userTS_text);
776 $cachedContent = t3lib_BEfunc::getHash($hash,0);
777 if (isset($cachedContent) && !$this->userTS_dontGetCached) {
778 $this->userTS = unserialize($cachedContent);
779 } else {
780 $parseObj = t3lib_div::makeInstance('t3lib_TSparser');
781 $parseObj->parse($this->userTS_text);
782 $this->userTS = $parseObj->setup;
783 t3lib_BEfunc::storeHash($hash,serialize($this->userTS),'BE_USER_TSconfig');
784 // Update UC:
785 $this->userTSUpdated=1;
786 }
787
788 // Processing webmounts
789 if ($this->isAdmin() && !$this->getTSConfigVal('options.dontMountAdminMounts')) { // Admin's always have the root mounted
790 $this->dataLists['webmount_list']='0,'.$this->dataLists['webmount_list'];
791 }
792
793 // Processing filemounts
794 $this->dataLists['filemount_list'] = t3lib_div::uniqueList($this->dataLists['filemount_list']);
795 if ($this->dataLists['filemount_list']) {
796 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_filemounts', 'deleted=0 AND hidden=0 AND pid=0 AND uid IN ('.$this->dataLists['filemount_list'].')');
797 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
798 $this->addFileMount($row['title'], $row['path'], $row['path'], $row['base']?1:0, '');
799 }
800 }
801
802 // The lists are cleaned for duplicates
803 $this->groupData['webmounts'] = t3lib_div::uniqueList($this->dataLists['webmount_list']);
804 $this->groupData['pagetypes_select'] = t3lib_div::uniqueList($this->dataLists['pagetypes_select']);
805 $this->groupData['tables_select'] = t3lib_div::uniqueList($this->dataLists['tables_modify'].','.$this->dataLists['tables_select']);
806 $this->groupData['tables_modify'] = t3lib_div::uniqueList($this->dataLists['tables_modify']);
807 $this->groupData['non_exclude_fields'] = t3lib_div::uniqueList($this->dataLists['non_exclude_fields']);
808 $this->groupData['explicit_allowdeny'] = t3lib_div::uniqueList($this->dataLists['explicit_allowdeny']);
809 $this->groupData['allowed_languages'] = t3lib_div::uniqueList($this->dataLists['allowed_languages']);
810 $this->groupData['custom_options'] = t3lib_div::uniqueList($this->dataLists['custom_options']);
811 $this->groupData['modules'] = t3lib_div::uniqueList($this->dataLists['modList']);
812
813 // populating the $this->userGroupsUID -array with the groups in the order in which they were LAST included.!!
814 $this->userGroupsUID = array_reverse(array_unique(array_reverse($this->includeGroupArray)));
815
816 // Finally this is the list of group_uid's in the order they are parsed (including subgroups!) and without duplicates (duplicates are presented with their last entrance in the list, which thus reflects the order of the TypoScript in TSconfig)
817 $this->groupList = implode(',',$this->userGroupsUID);
818 $this->setCachedList($this->groupList);
819 }
820 }
821
822 /**
823 * Fetches the group records, subgroups and fills internal arrays.
824 * Function is called recursively to fetch subgroups
825 *
826 * @param string Commalist of be_groups uid numbers
827 * @param string List of already processed be_groups-uids so the function will not fall into a eternal recursion.
828 * @return void
829 * @access private
830 */
831 function fetchGroups($grList,$idList='') {
832
833 // Fetching records of the groups in $grList (which are not blocked by lockedToDomain either):
834 $lockToDomain_SQL = ' AND (lockToDomain=\'\' OR lockToDomain=\''.t3lib_div::getIndpEnv('HTTP_HOST').'\')';
835 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->usergroup_table, 'deleted=0 AND hidden=0 AND pid=0 AND uid IN ('.$grList.')'.$lockToDomain_SQL);
836
837 // The userGroups array is filled
838 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
839 $this->userGroups[$row['uid']] = $row;
840 }
841
842 // Traversing records in the correct order
843 $include_staticArr = t3lib_div::intExplode(',',$grList);
844 reset($include_staticArr);
845 while(list(,$uid)=each($include_staticArr)) { // traversing list
846
847 // Get row:
848 $row=$this->userGroups[$uid];
849 if (is_array($row) && !t3lib_div::inList($idList,$uid)) { // Must be an array and $uid should not be in the idList, because then it is somewhere previously in the grouplist
850
851 // Include sub groups
852 if (trim($row['subgroup'])) {
853 $theList = implode(',',t3lib_div::intExplode(',',$row['subgroup'])); // Make integer list
854 $this->fetchGroups($theList, $idList.','.$uid); // Call recursively, pass along list of already processed groups so they are not recursed again.
855 }
856 // Add the group uid, current list, TSconfig to the internal arrays.
857 $this->includeGroupArray[]=$uid;
858 $this->includeHierarchy[]=$idList;
859 $this->TSdataArray[] = $this->addTScomment('Group "'.$row['title'].'" ['.$row['uid'].'] TSconfig field:').$row['TSconfig'];
860
861 // Mount group database-mounts
862 if (($this->user['options']&1) == 1) { $this->dataLists['webmount_list'].= ','.$row['db_mountpoints']; }
863
864 // Mount group file-mounts
865 if (($this->user['options']&2) == 2) { $this->dataLists['filemount_list'].= ','.$row['file_mountpoints']; }
866
867 // Mount group home-dirs
868 if (($this->user['options']&2) == 2) {
869 // If groupHomePath is set, we attempt to mount it
870 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['groupHomePath']) {
871 $this->addFileMount($row['title'], '', $GLOBALS['TYPO3_CONF_VARS']['BE']['groupHomePath'].$row['uid'], 0, 'group');
872 }
873 }
874
875 // The lists are made: groupMods, tables_select, tables_modify, pagetypes_select, non_exclude_fields, explicit_allowdeny, allowed_languages, custom_options
876 if ($row['inc_access_lists']==1) {
877 $this->dataLists['modList'].= ','.$row['groupMods'];
878 $this->dataLists['tables_select'].= ','.$row['tables_select'];
879 $this->dataLists['tables_modify'].= ','.$row['tables_modify'];
880 $this->dataLists['pagetypes_select'].= ','.$row['pagetypes_select'];
881 $this->dataLists['non_exclude_fields'].= ','.$row['non_exclude_fields'];
882 $this->dataLists['explicit_allowdeny'].= ','.$row['explicit_allowdeny'];
883 $this->dataLists['allowed_languages'].= ','.$row['allowed_languages'];
884 $this->dataLists['custom_options'].= ','.$row['custom_options'];
885 }
886 // If this function is processing the users OWN group-list (not subgroups) AND if the ->firstMainGroup is not set, then the ->firstMainGroup will be set.
887 if (!strcmp($idList,'') && !$this->firstMainGroup) {
888 $this->firstMainGroup=$uid;
889 }
890 }
891 }
892
893 }
894
895 /**
896 * Updates the field be_users.usergroup_cached_list if the groupList of the user has changed/is different from the current list.
897 * The field "usergroup_cached_list" contains the list of groups which the user is a member of. After authentication (where these functions are called...) one can depend on this list being a representation of the exact groups/subgroups which the BE_USER has membership with.
898 *
899 * @param string The newly compiled group-list which must be compared with the current list in the user record and possibly stored if a difference is detected.
900 * @return void
901 * @access private
902 */
903 function setCachedList($cList) {
904 if ((string)$cList != (string)$this->user['usergroup_cached_list']) {
905 $GLOBALS['TYPO3_DB']->exec_UPDATEquery('be_users', 'uid='.intval($this->user['uid']), array('usergroup_cached_list' => $cList));
906 }
907 }
908
909 /**
910 * Adds a filemount to the users array of filemounts, $this->groupData['filemounts'][hash_key] = Array ('name'=>$name, 'path'=>$path, 'type'=>$type);
911 * Is a part of the authentication proces of the user.
912 * A final requirement for a path being mounted is that a) it MUST return true on is_dir(), b) must contain either PATH_site+'fileadminDir' OR 'lockRootPath' - if lockRootPath is set - as first part of string!
913 * Paths in the mounted information will always be absolute and have a trailing slash.
914 *
915 * @param string $title will be the (root)name of the filemount in the folder tree
916 * @param string $altTitle will be the (root)name of the filemount IF $title is not true (blank or zero)
917 * @param string $path is the path which should be mounted. Will accept backslash in paths on windows servers (will substituted with forward slash). The path should be 1) relative to TYPO3_CONF_VARS[BE][fileadminDir] if $webspace is set, otherwise absolute.
918 * @param boolean If $webspace is set, the $path is relative to 'fileadminDir' in TYPO3_CONF_VARS, otherwise $path is absolute. 'fileadminDir' must be set to allow mounting of relative paths.
919 * @param string Type of filemount; Can be blank (regular) or "user" / "group" (for user and group filemounts presumably). Probably sets the icon first and foremost.
920 * @return boolean Returns "1" if the requested filemount was mounted, otherwise no return value.
921 * @access private
922 */
923 function addFileMount($title, $altTitle, $path, $webspace, $type) {
924 // Return false if fileadminDir is not set and we try to mount a relative path
925 if ($webspace && !$GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']) return false;
926
927 // Trimming and pre-processing
928 $path=trim($path);
929 if ($this->OS=='WIN') { // with WINDOWS convert backslash to slash!!
930 $path=str_replace('\\','/',$path);
931 }
932 // If the path is true and validates as a valid path string:
933 if ($path && t3lib_div::validPathStr($path)) {
934 // these lines remove all slashes and dots before and after the path
935 $path=ereg_replace('^[\/\. ]*','',$path);
936 $path=trim(ereg_replace('[\/\. ]*$','',$path));
937
938
939 if ($path) { // there must be some chars in the path
940 $fdir=PATH_site.$GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']; // fileadmin dir, absolute
941 if ($webspace) {
942 $path=$fdir.$path; // PATH_site + fileadmin dir is prepended
943 } else {
944 if ($this->OS!='WIN') { // with WINDOWS no prepending!!
945 $path='/'.$path; // root-level is the start...
946 }
947 }
948 $path.='/';
949
950 // We now have a path with slash after and slash before (if unix)
951 if (@is_dir($path) &&
952 (($GLOBALS['TYPO3_CONF_VARS']['BE']['lockRootPath'] && t3lib_div::isFirstPartOfStr($path,$GLOBALS['TYPO3_CONF_VARS']['BE']['lockRootPath'])) || t3lib_div::isFirstPartOfStr($path,$fdir))) {
953 // Alternative title?
954 $name = $title ? $title : $altTitle;
955 // Adds the filemount. The same filemount with same name, type and path cannot be set up twice because of the hash string used as key.
956 $this->groupData['filemounts'][md5($name.'|'.$path.'|'.$type)] = Array('name'=>$name, 'path'=>$path, 'type'=>$type);
957 // Return true - went well, success!
958 return 1;
959 }
960 }
961 }
962 }
963
964 /**
965 * Creates a TypoScript comment with the string text inside.
966 *
967 * @param string The text to wrap in comment prefixes and delimiters.
968 * @return string TypoScript comment with the string text inside.
969 */
970 function addTScomment($str) {
971 $delimiter = '# ***********************************************';
972
973 $out = $delimiter.chr(10);
974 $lines = t3lib_div::trimExplode(chr(10),$str);
975 foreach($lines as $v) {
976 $out.= '# '.$v.chr(10);
977 }
978 $out.= $delimiter.chr(10);
979 return $out;
980 }
981
982
983
984
985
986
987
988
989
990
991
992
993 /************************************
994 *
995 * Logging
996 *
997 ************************************/
998
999
1000 /**
1001 * Writes an entry in the logfile
1002 * ... Still missing documentation for syntax etc...
1003 *
1004 * @param integer $type: denotes which module that has submitted the entry. This is the current list: 1=tce_db; 2=tce_file; 3=system (eg. sys_history save); 4=modules; 254=Personal settings changed; 255=login / out action: 1=login, 2=logout, 3=failed login (+ errorcode 3), 4=failure_warning_email sent
1005 * @param integer $action: denotes which specific operation that wrote the entry (eg. 'delete', 'upload', 'update' and so on...). Specific for each $type. Also used to trigger update of the interface. (see the log-module for the meaning of each number !!)
1006 * @param integer $error: flag. 0 = message, 1 = error (user problem), 2 = System Error (which should not happen), 3 = security notice (admin)
1007 * @param integer $details_nr: The message number. Specific for each $type and $action. in the future this will make it possible to translate errormessages to other languages
1008 * @param string $details: Default text that follows the message
1009 * @param array $data: Data that follows the log. Might be used to carry special information. If an array the first 5 entries (0-4) will be sprintf'ed the details-text...
1010 * @param string $tablename: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.)
1011 * @param integer $recuid: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.)
1012 * @param integer $recpid: Special field used by tce_main.php. These ($tablename, $recuid, $recpid) holds the reference to the record which the log-entry is about. (Was used in attic status.php to update the interface.)
1013 * @param integer $event_pid: The page_uid (pid) where the event occurred. Used to select log-content for specific pages.
1014 * @param string $NEWid: NEWid string
1015 * @return void
1016 */
1017 function writelog($type,$action,$error,$details_nr,$details,$data,$tablename='',$recuid='',$recpid='',$event_pid=-1,$NEWid='') {
1018
1019 $fields_values = Array (
1020 'userid' => intval($this->user['uid']),
1021 'type' => intval($type),
1022 'action' => intval($action),
1023 'error' => intval($error),
1024 'details_nr' => intval($details_nr),
1025 'details' => $details,
1026 'log_data' => serialize($data),
1027 'tablename' => $tablename,
1028 'recuid' => intval($recuid),
1029 'recpid' => intval($recpid),
1030 'IP' => t3lib_div::getIndpEnv('REMOTE_ADDR'),
1031 'tstamp' => $GLOBALS['EXEC_TIME'],
1032 'event_pid' => intval($event_pid),
1033 'NEWid' => $NEWid
1034 );
1035
1036 $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_log', $fields_values);
1037 return $GLOBALS['TYPO3_DB']->sql_insert_id();
1038 }
1039
1040 /**
1041 * Sends a warning to $email if there has been a certain amount of failed logins during a period.
1042 * If a login fails, this function is called. It will look up the sys_log to see if there has been more than $max failed logins the last $secondsBack seconds (default 3600). If so, an email with a warning is sent to $email.
1043 *
1044 * @param string Email address
1045 * @param integer Number of sections back in time to check. This is a kind of limit for how many failures an hour for instance.
1046 * @param integer Max allowed failures before a warning mail is sent
1047 * @return void
1048 * @access private
1049 */
1050 function checkLogFailures($email, $secondsBack=3600, $max=3) {
1051
1052 if ($email) {
1053
1054 // get last flag set in the log for sending
1055 $theTimeBack = time()-$secondsBack;
1056 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1057 'tstamp',
1058 'sys_log',
1059 'type=255 AND action=4 AND tstamp>'.intval($theTimeBack),
1060 '',
1061 'tstamp DESC',
1062 '1'
1063 );
1064 if ($testRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1065 $theTimeBack = $testRow['tstamp'];
1066 }
1067
1068 // Check for more than $max number of error failures with the last period.
1069 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1070 '*',
1071 'sys_log',
1072 'type=255 AND action=3 AND error!=0 AND tstamp>'.intval($theTimeBack),
1073 '',
1074 'tstamp'
1075 );
1076 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) > $max) {
1077 // OK, so there were more than the max allowed number of login failures - so we will send an email then.
1078 $subject = 'TYPO3 Login Failure Warning (at '.$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'].')';
1079 $email_body = '
1080 There has been numerous attempts ('.$GLOBALS['TYPO3_DB']->sql_num_rows($res).') to login at the TYPO3
1081 site "'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'].'" ('.t3lib_div::getIndpEnv('HTTP_HOST').').
1082
1083 This is a dump of the failures:
1084
1085 ';
1086 while($testRows = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1087 $theData = unserialize($testRows['log_data']);
1088 $email_body.=date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'].' H:i',$testRows['tstamp']).': '.@sprintf($testRows['details'],''.$theData[0],''.$theData[1],''.$theData[2]);
1089 $email_body.=chr(10);
1090 }
1091 mail( $email,
1092 $subject,
1093 $email_body,
1094 'From: TYPO3 Login WARNING<>'
1095 );
1096 $this->writelog(255,4,0,3,'Failure warning (%s failures within %s seconds) sent by email to %s',Array($GLOBALS['TYPO3_DB']->sql_num_rows($res),$secondsBack,$email)); // Logout written to log
1097 }
1098 }
1099 }
1100 }
1101
1102
1103
1104 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_userauthgroup.php']) {
1105 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_userauthgroup.php']);
1106 }
1107 ?>