See changelog
[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('tt_news')) {
735 $this->TSdataArray[]='
736 // Setting defaults for tt_news author / email...
737 TCAdefaults.tt_news.author = '.$this->user['realName'].'
738 TCAdefaults.tt_news.author_email = '.$this->user['email'].'
739 ';
740 }
741 if (t3lib_extMgm::isLoaded('sys_note')) {
742 $this->TSdataArray[]='
743 // Setting defaults for sys_note author / email...
744 TCAdefaults.sys_note.author = '.$this->user['realName'].'
745 TCAdefaults.sys_note.email = '.$this->user['email'].'
746 ';
747 }
748 }
749
750 // FILE MOUNTS:
751 // Admin users has the base fileadmin dir mounted
752 if ($this->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']) {
753 $this->addFileMount($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '', PATH_site.$GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], 0, '');
754 }
755
756 // If userHomePath is set, we attempt to mount it
757 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['userHomePath']) {
758 // First try and mount with [uid]_[username]
759 $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');
760 if (!$didMount) {
761 // If that failed, try and mount with only [uid]
762 $this->addFileMount($this->user['username'], '', $GLOBALS['TYPO3_CONF_VARS']['BE']['userHomePath'].$this->user['uid'].$GLOBALS['TYPO3_CONF_VARS']['BE']['userUploadDir'], 0, 'user');
763 }
764 }
765
766 // BE_GROUPS:
767 // Get the groups...
768 # $grList = t3lib_BEfunc::getSQLselectableList($this->user[$this->usergroup_column],$this->usergroup_table,$this->usergroup_table);
769 $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.
770 if ($grList) {
771 // Fetch groups will add a lot of information to the internal arrays: modules, accesslists, TSconfig etc. Refer to fetchGroups() function.
772 $this->fetchGroups($grList);
773 }
774
775 // Add the TSconfig for this specific user:
776 $this->TSdataArray[] = $this->addTScomment('USER TSconfig field').$this->user['TSconfig'];
777 // Check include lines.
778 $this->TSdataArray = t3lib_TSparser::checkIncludeLines_array($this->TSdataArray);
779
780 // Parsing the user TSconfig (or getting from cache)
781 $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.
782 $hash = md5('userTS:'.$this->userTS_text);
783 $cachedContent = t3lib_BEfunc::getHash($hash,0);
784 if (isset($cachedContent) && !$this->userTS_dontGetCached) {
785 $this->userTS = unserialize($cachedContent);
786 } else {
787 $parseObj = t3lib_div::makeInstance('t3lib_TSparser');
788 $parseObj->parse($this->userTS_text);
789 $this->userTS = $parseObj->setup;
790 t3lib_BEfunc::storeHash($hash,serialize($this->userTS),'BE_USER_TSconfig');
791 // Update UC:
792 $this->userTSUpdated=1;
793 }
794
795 // Processing webmounts
796 if ($this->isAdmin() && !$this->getTSConfigVal('options.dontMountAdminMounts')) { // Admin's always have the root mounted
797 $this->dataLists['webmount_list']='0,'.$this->dataLists['webmount_list'];
798 }
799
800 // Processing filemounts
801 $this->dataLists['filemount_list'] = t3lib_div::uniqueList($this->dataLists['filemount_list']);
802 if ($this->dataLists['filemount_list']) {
803 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_filemounts', 'deleted=0 AND hidden=0 AND pid=0 AND uid IN ('.$this->dataLists['filemount_list'].')');
804 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
805 $this->addFileMount($row['title'], $row['path'], $row['path'], $row['base']?1:0, '');
806 }
807 }
808
809 // The lists are cleaned for duplicates
810 $this->groupData['webmounts'] = t3lib_div::uniqueList($this->dataLists['webmount_list']);
811 $this->groupData['pagetypes_select'] = t3lib_div::uniqueList($this->dataLists['pagetypes_select']);
812 $this->groupData['tables_select'] = t3lib_div::uniqueList($this->dataLists['tables_modify'].','.$this->dataLists['tables_select']);
813 $this->groupData['tables_modify'] = t3lib_div::uniqueList($this->dataLists['tables_modify']);
814 $this->groupData['non_exclude_fields'] = t3lib_div::uniqueList($this->dataLists['non_exclude_fields']);
815 $this->groupData['explicit_allowdeny'] = t3lib_div::uniqueList($this->dataLists['explicit_allowdeny']);
816 $this->groupData['allowed_languages'] = t3lib_div::uniqueList($this->dataLists['allowed_languages']);
817 $this->groupData['custom_options'] = t3lib_div::uniqueList($this->dataLists['custom_options']);
818 $this->groupData['modules'] = t3lib_div::uniqueList($this->dataLists['modList']);
819
820 // populating the $this->userGroupsUID -array with the groups in the order in which they were LAST included.!!
821 $this->userGroupsUID = array_reverse(array_unique(array_reverse($this->includeGroupArray)));
822
823 // 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)
824 $this->groupList = implode(',',$this->userGroupsUID);
825 $this->setCachedList($this->groupList);
826 }
827 }
828
829 /**
830 * Fetches the group records, subgroups and fills internal arrays.
831 * Function is called recursively to fetch subgroups
832 *
833 * @param string Commalist of be_groups uid numbers
834 * @param string List of already processed be_groups-uids so the function will not fall into a eternal recursion.
835 * @return void
836 * @access private
837 */
838 function fetchGroups($grList,$idList='') {
839
840 // Fetching records of the groups in $grList (which are not blocked by lockedToDomain either):
841 $lockToDomain_SQL = ' AND (lockToDomain=\'\' OR lockToDomain=\''.t3lib_div::getIndpEnv('HTTP_HOST').'\')';
842 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->usergroup_table, 'deleted=0 AND hidden=0 AND pid=0 AND uid IN ('.$grList.')'.$lockToDomain_SQL);
843
844 // The userGroups array is filled
845 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
846 $this->userGroups[$row['uid']] = $row;
847 }
848
849 // Traversing records in the correct order
850 $include_staticArr = t3lib_div::intExplode(',',$grList);
851 reset($include_staticArr);
852 while(list(,$uid)=each($include_staticArr)) { // traversing list
853
854 // Get row:
855 $row=$this->userGroups[$uid];
856 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
857
858 // Include sub groups
859 if (trim($row['subgroup'])) {
860 $theList = implode(',',t3lib_div::intExplode(',',$row['subgroup'])); // Make integer list
861 $this->fetchGroups($theList, $idList.','.$uid); // Call recursively, pass along list of already processed groups so they are not recursed again.
862 }
863 // Add the group uid, current list, TSconfig to the internal arrays.
864 $this->includeGroupArray[]=$uid;
865 $this->includeHierarchy[]=$idList;
866 $this->TSdataArray[] = $this->addTScomment('Group "'.$row['title'].'" ['.$row['uid'].'] TSconfig field:').$row['TSconfig'];
867
868 // Mount group database-mounts
869 if (($this->user['options']&1) == 1) { $this->dataLists['webmount_list'].= ','.$row['db_mountpoints']; }
870
871 // Mount group file-mounts
872 if (($this->user['options']&2) == 2) { $this->dataLists['filemount_list'].= ','.$row['file_mountpoints']; }
873
874 // Mount group home-dirs
875 if (($this->user['options']&2) == 2) {
876 // If groupHomePath is set, we attempt to mount it
877 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['groupHomePath']) {
878 $this->addFileMount($row['title'], '', $GLOBALS['TYPO3_CONF_VARS']['BE']['groupHomePath'].$row['uid'], 0, 'group');
879 }
880 }
881
882 // The lists are made: groupMods, tables_select, tables_modify, pagetypes_select, non_exclude_fields, explicit_allowdeny, allowed_languages, custom_options
883 if ($row['inc_access_lists']==1) {
884 $this->dataLists['modList'].= ','.$row['groupMods'];
885 $this->dataLists['tables_select'].= ','.$row['tables_select'];
886 $this->dataLists['tables_modify'].= ','.$row['tables_modify'];
887 $this->dataLists['pagetypes_select'].= ','.$row['pagetypes_select'];
888 $this->dataLists['non_exclude_fields'].= ','.$row['non_exclude_fields'];
889 $this->dataLists['explicit_allowdeny'].= ','.$row['explicit_allowdeny'];
890 $this->dataLists['allowed_languages'].= ','.$row['allowed_languages'];
891 $this->dataLists['custom_options'].= ','.$row['custom_options'];
892 }
893 // 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.
894 if (!strcmp($idList,'') && !$this->firstMainGroup) {
895 $this->firstMainGroup=$uid;
896 }
897 }
898 }
899
900 }
901
902 /**
903 * Updates the field be_users.usergroup_cached_list if the groupList of the user has changed/is different from the current list.
904 * 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.
905 *
906 * @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.
907 * @return void
908 * @access private
909 */
910 function setCachedList($cList) {
911 if ((string)$cList != (string)$this->user['usergroup_cached_list']) {
912 $GLOBALS['TYPO3_DB']->exec_UPDATEquery('be_users', 'uid='.intval($this->user['uid']), array('usergroup_cached_list' => $cList));
913 }
914 }
915
916 /**
917 * Adds a filemount to the users array of filemounts, $this->groupData['filemounts'][hash_key] = Array ('name'=>$name, 'path'=>$path, 'type'=>$type);
918 * Is a part of the authentication proces of the user.
919 * 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!
920 * Paths in the mounted information will always be absolute and have a trailing slash.
921 *
922 * @param string $title will be the (root)name of the filemount in the folder tree
923 * @param string $altTitle will be the (root)name of the filemount IF $title is not true (blank or zero)
924 * @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.
925 * @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.
926 * @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.
927 * @return boolean Returns "1" if the requested filemount was mounted, otherwise no return value.
928 * @access private
929 */
930 function addFileMount($title, $altTitle, $path, $webspace, $type) {
931 // Return false if fileadminDir is not set and we try to mount a relative path
932 if ($webspace && !$GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']) return false;
933
934 // Trimming and pre-processing
935 $path=trim($path);
936 if ($this->OS=='WIN') { // with WINDOWS convert backslash to slash!!
937 $path=str_replace('\\','/',$path);
938 }
939 // If the path is true and validates as a valid path string:
940 if ($path && t3lib_div::validPathStr($path)) {
941 // these lines remove all slashes and dots before and after the path
942 $path=ereg_replace('^[\/\. ]*','',$path);
943 $path=trim(ereg_replace('[\/\. ]*$','',$path));
944
945
946 if ($path) { // there must be some chars in the path
947 $fdir=PATH_site.$GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']; // fileadmin dir, absolute
948 if ($webspace) {
949 $path=$fdir.$path; // PATH_site + fileadmin dir is prepended
950 } else {
951 if ($this->OS!='WIN') { // with WINDOWS no prepending!!
952 $path='/'.$path; // root-level is the start...
953 }
954 }
955 $path.='/';
956
957 // We now have a path with slash after and slash before (if unix)
958 if (@is_dir($path) &&
959 (($GLOBALS['TYPO3_CONF_VARS']['BE']['lockRootPath'] && t3lib_div::isFirstPartOfStr($path,$GLOBALS['TYPO3_CONF_VARS']['BE']['lockRootPath'])) || t3lib_div::isFirstPartOfStr($path,$fdir))) {
960 // Alternative title?
961 $name = $title ? $title : $altTitle;
962 // 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.
963 $this->groupData['filemounts'][md5($name.'|'.$path.'|'.$type)] = Array('name'=>$name, 'path'=>$path, 'type'=>$type);
964 // Return true - went well, success!
965 return 1;
966 }
967 }
968 }
969 }
970
971 /**
972 * Creates a TypoScript comment with the string text inside.
973 *
974 * @param string The text to wrap in comment prefixes and delimiters.
975 * @return string TypoScript comment with the string text inside.
976 */
977 function addTScomment($str) {
978 $delimiter = '# ***********************************************';
979
980 $out = $delimiter.chr(10);
981 $lines = t3lib_div::trimExplode(chr(10),$str);
982 foreach($lines as $v) {
983 $out.= '# '.$v.chr(10);
984 }
985 $out.= $delimiter.chr(10);
986 return $out;
987 }
988
989
990
991
992
993
994
995
996
997
998
999
1000 /************************************
1001 *
1002 * Logging
1003 *
1004 ************************************/
1005
1006
1007 /**
1008 * Writes an entry in the logfile
1009 * ... Still missing documentation for syntax etc...
1010 *
1011 * @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
1012 * @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 !!)
1013 * @param integer $error: flag. 0 = message, 1 = error (user problem), 2 = System Error (which should not happen), 3 = security notice (admin)
1014 * @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
1015 * @param string $details: Default text that follows the message
1016 * @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...
1017 * @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.)
1018 * @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.)
1019 * @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.)
1020 * @param integer $event_pid: The page_uid (pid) where the event occurred. Used to select log-content for specific pages.
1021 * @param string $NEWid: NEWid string
1022 * @return void
1023 */
1024 function writelog($type,$action,$error,$details_nr,$details,$data,$tablename='',$recuid='',$recpid='',$event_pid=-1,$NEWid='') {
1025
1026 $fields_values = Array (
1027 'userid' => intval($this->user['uid']),
1028 'type' => intval($type),
1029 'action' => intval($action),
1030 'error' => intval($error),
1031 'details_nr' => intval($details_nr),
1032 'details' => $details,
1033 'log_data' => serialize($data),
1034 'tablename' => $tablename,
1035 'recuid' => intval($recuid),
1036 'recpid' => intval($recpid),
1037 'IP' => t3lib_div::getIndpEnv('REMOTE_ADDR'),
1038 'tstamp' => $GLOBALS['EXEC_TIME'],
1039 'event_pid' => intval($event_pid),
1040 'NEWid' => $NEWid
1041 );
1042
1043 $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_log', $fields_values);
1044 return $GLOBALS['TYPO3_DB']->sql_insert_id();
1045 }
1046
1047 /**
1048 * Sends a warning to $email if there has been a certain amount of failed logins during a period.
1049 * 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.
1050 *
1051 * @param string Email address
1052 * @param integer Number of sections back in time to check. This is a kind of limit for how many failures an hour for instance.
1053 * @param integer Max allowed failures before a warning mail is sent
1054 * @return void
1055 * @access private
1056 */
1057 function checkLogFailures($email, $secondsBack=3600, $max=3) {
1058
1059 if ($email) {
1060
1061 // get last flag set in the log for sending
1062 $theTimeBack = time()-$secondsBack;
1063 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1064 'tstamp',
1065 'sys_log',
1066 'type=255 AND action=4 AND tstamp>'.intval($theTimeBack),
1067 '',
1068 'tstamp DESC',
1069 '1'
1070 );
1071 if ($testRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1072 $theTimeBack = $testRow['tstamp'];
1073 }
1074
1075 // Check for more than $max number of error failures with the last period.
1076 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1077 '*',
1078 'sys_log',
1079 'type=255 AND action=3 AND error!=0 AND tstamp>'.intval($theTimeBack),
1080 '',
1081 'tstamp'
1082 );
1083 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) > $max) {
1084 // OK, so there were more than the max allowed number of login failures - so we will send an email then.
1085 $subject = 'TYPO3 Login Failure Warning (at '.$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'].')';
1086 $email_body = '
1087 There has been numerous attempts ('.$GLOBALS['TYPO3_DB']->sql_num_rows($res).') to login at the TYPO3
1088 site "'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'].'" ('.t3lib_div::getIndpEnv('HTTP_HOST').').
1089
1090 This is a dump of the failures:
1091
1092 ';
1093 while($testRows = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1094 $theData = unserialize($testRows['log_data']);
1095 $email_body.=date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'].' H:i',$testRows['tstamp']).': '.@sprintf($testRows['details'],''.$theData[0],''.$theData[1],''.$theData[2]);
1096 $email_body.=chr(10);
1097 }
1098 mail( $email,
1099 $subject,
1100 $email_body,
1101 'From: TYPO3 Login WARNING<>'
1102 );
1103 $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
1104 }
1105 }
1106 }
1107 }
1108
1109
1110
1111 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_userauthgroup.php']) {
1112 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_userauthgroup.php']);
1113 }
1114 ?>