CoreCommunity ExtensionsIncubatorDistributionsTYPO3 4.5 ProjectsTYPO3 4.6 ProjectsTYPO3 4.7 ProjectsTYPO3 6.0 ProjectsTYPO3 6.1 ProjectsTYPO3 6.2 Projects (+)

mm_forum-feature2146-0.2.patch

Alexander Stehlik, 2010-06-04 16:11

Download (22.8 kB)

 
pi1/class.tx_mmforum_pi1.php (Arbeitskopie)
5744 5744
	 */
5745 5745

  
5746 5746
	/**
5747
	 * Generates an SQL condition for checking the user PID.
5748
	 *
5749
	 * @param  string $table The table name (default 'fe_users')
5750
	 * @return string        A condition checking the PID of fe_user
5747
	 * Generates an SQL condition for checking the user using 
5748
	 * getUserGroupPIDQuery() from tx_mmforum_tools
5749
	 * 
5750
	 * @author  Alexander Stehlik <astehlik@intera.de>
5751
	 * @version 2010-05-20
5752
	 * @param   string $table The table name (default 'fe_users')
5753
	 * @return  string        A condition checking the PID of fe_user
5751 5754
	 *                       records.
5752 5755
	 */
5753 5756
	function getUserPidQuery($table = 'fe_users') {
5754
		return ' AND ' . $table . '.pid = ' . intval($this->conf['userPID']) . ' ';
5757
		return tx_mmforum_tools::getUserGroupPIDQuery($this->conf, $table);
5755 5758
	}
5756 5759

  
5757 5760
    /**
res/ts/tx_mmforum_pagetsconfig.ts (Arbeitskopie)
79 79
						userPID {
80 80
							type = group
81 81
							type.table = pages
82
							type.size = 3
83
							type.maxitems = 22
82 84
						}
85
						
86
						userPIDRecursive = MMFORUM_CONF_ITEM
87
						userPIDRecursive {
88
							type = select
89
							type.handler = getRecusiveOptions
90
						}
83 91

  
84 92
						userGroup = MMFORUM_CONF_ITEM
85 93
						userGroup {
res/ts/tx_mmforum_base.ts (Arbeitskopie)
10 10
		
11 11
	# User storage PID
12 12
		userPID 			= {$plugin.tx_mmforum.userPID}
13
		userPIDRecursive	= {$plugin.tx_mmforum.userPIDRecursive}
13 14
		
14 15
		
15 16
		
pi2/class.tx_mmforum_pi2.php (Arbeitskopie)
283 283
	function saveData()
284 284
	{
285 285
		$usergroup	= $this->conf['userGroup'];
286
		$pid		= $this->conf['userPID'];
287 286

  
288 287
		$this->data['reghash'] = substr(md5(time().$this->data['username']), 1, 15);
289 288

  
......
309 308
		}
310 309

  
311 310
		$insertArray = array(
312
			'pid'				    => $pid,
311
			'pid'				    => tx_mmforum_tools::getUserGroupPIDQuery($this->conf, 'fe_users', TRUE, TRUE),
313 312
			'tstamp'			    => time(),
314 313
			'crdate'			    => time(),
315 314
			'username'			    => $this->data['username'],
......
623 622
			$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
624 623
				'*',
625 624
				'fe_users',
626
				'username LIKE "'.$this->data['username'].'" AND deleted=0 AND pid='.$this->conf['userPID']
625
				'username LIKE "'.$this->data['username'].'" AND deleted=0' . tx_mmforum_tools::getUserGroupPIDQuery($this->conf, 'fe_users')
627 626
			);
628 627
			if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
629 628
				$marker["###ERROR_username###"] = $this->cObj->wrap($this->pi_getLL('error.usernameExists'), $this->conf['errorwrap']);
pi3/class.tx_mmforum_pi3.php (Arbeitskopie)
558 558
			else
559 559
			{
560 560
				// Retrieve userId from username
561
				$where = "deleted = 0 AND disable = 0 AND username=".$GLOBALS['TYPO3_DB']->fullQuoteStr($to_username,'fe_users')." AND pid=".$this->conf['userPID'];
561
				$pidquery = tx_mmforum_tools::getUserGroupPIDQuery($this->conf, 'fe_users');
562
				$where = "deleted = 0 AND disable = 0 AND username=".$GLOBALS['TYPO3_DB']->fullQuoteStr($to_username,'fe_users') . $pidquery;
562 563
				$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid','fe_users',$where);
563 564
				$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
564 565

  
......
708 709

  
709 710
			session_start();
710 711
			$_SESSION[$this->prefixId]['userPID'] = $this->conf['userPID'];
712
			$_SESSION[$this->prefixId]['userPIDRecursive'] = $this->conf['userPIDRecursive'];
711 713
			$_SESSION[$this->prefixId]['userGID'] = $this->conf['userGroup'];
712 714

  
713 715
			// If PM is a reply to another PM, there is a prefix in subject/msg-text
......
815 817

  
816 818
		$usersearch = $GLOBALS['TYPO3_DB']->quoteStr($this->piVars['user'],'fe_users');
817 819

  
818
		$where = 'disable = 0 AND deleted = 0 AND username LIKE \'%'.$usersearch.'%\' AND pid='.$this->conf['userPID'].'';
820
		$where = 'disable = 0 AND deleted = 0 AND username LIKE \'%'.$usersearch.'%\'' . tx_mmforum_tools::getUserGroupPIDQuery($this->conf, 'fe_users');
819 821
		$orderBy = 'username ASC';
820 822
		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*','fe_users',$where,$groupBy='',$orderBy,'100');
821 823

  
pi3/ajax.tx_mmforum_usersearch.php (Arbeitskopie)
52 52
$search = $TYPO3_DB->quoteStr(t3lib_div::_GP('userSearch'), 'fe_users');
53 53

  
54 54
$arr = array();
55
require_once(t3lib_extMgm::extPath('mm_forum') . 'includes/class.tx_mmforum_tools.php');
56
$pidquery = tx_mmforum_tools::getUserGroupPIDQuery($_SESSION['tx_mmforum_pi3'], 'fe_users');
55 57
$res = $TYPO3_DB->exec_SELECTquery( 'username', 'fe_users',
56
                                    "username LIKE '$search%' AND pid=$pid AND FIND_IN_SET($gid,usergroup)",
58
                                    "username LIKE '$search%'" . $pidquery . " AND disable=0 AND deleted=0 AND FIND_IN_SET($gid,usergroup)",
57 59
                                    '', 'username ASC', '8' );
58 60
while(list($username) = $TYPO3_DB->sql_fetch_row($res)) array_push($arr, $username);
59 61

  
pi6/class.tx_mmforum_pi6.php (Arbeitskopie)
561 561
	 * @version 2007-04-16
562 562
	 */
563 563
	function getUserPidQuery($table="fe_users") {
564
		if($this->conf['userPID']==-1) return "";
565
		if($this->conf['userPID']=="") return "";
566
		else return " AND $table.pid='".$this->conf['userPID']."'";
564
		return tx_mmforum_tools::getUserGroupPIDQuery($this->conf, $table);
567 565
	}
568 566
}
569 567

  
mod1/locallang_install.xml (Arbeitskopie)
40 40
			<!-- GENERAL OPTIONS -->
41 41
			<label index="install.field.storagePID.title">Data storage page</label>
42 42
			<label index="install.field.storagePID.desc">This value defines the page on which all mm_forum data are stored.</label>
43
			<label index="install.field.userPID.title">User data storage page</label>
44
			<label index="install.field.userPID.desc">This value defines the page on which all user data, i.e. users and user groups, are stored.</label>
43
			<label index="install.field.userPID.title">User data storage pages</label>
44
			<label index="install.field.userPID.desc">This value defines the pages on which all user data, i.e. users and user groups, are stored. New users will be stored in the first page in the list.</label>
45 45
			<label index="install.field.userGroup.title">Default user group</label>
46 46
			<label index="install.field.userGroup.desc">This is the default mm_forum user group. All newly registered users will be added to this group. Only members of this group will be regarded as mm_forum users.</label>
47 47
			<label index="install.field.moderatorGroup.title">Moderator group</label>
......
208 208
			<label index="install.sampleData.desc">Check this input field if you want some sample data to be inserted into your new forum.</label>
209 209
			<label index="install.firstAdmin.title">First admin user</label>
210 210
			<label index="install.firstAdmin.desc">Here you can select a user that will automatically be made an administrator user for the forum. Can be left empty.</label>
211
			
212
			<!-- ADDED IN 1.10.0 -->
213
			<label index="install.field.userPIDRecursive.title">Search user data storage pages recursively</label>
214
			<label index="install.field.userPIDRecursive.desc">If this value is set, the subpages of the defined user data storage pages will also be accessed to the specified level.</label>
211 215
		</languageKey>
212 216
        <!-- GERMAN LANGUAGE DATA -->
213 217
		<languageKey index="de" type="array">
......
244 248
			<!-- GENERAL OPTIONS -->
245 249
			<label index="install.field.storagePID.title">Datenspeicherseite</label>
246 250
			<label index="install.field.storagePID.desc">Dieser Wert beschreibt die Seite, auf der die mm_forum-Daten gespeichert werden.</label>
247
			<label index="install.field.userPID.title">Benutzerspeicherseite</label>
248
			<label index="install.field.userPID.desc">Dieser Wert beschreibt die Seite, auf der alle Benutzerdaten, d.h. Benutzer und Benutzergruppen, gespeichert werden.</label>
251
			<label index="install.field.userPID.title">Benutzerspeicherseiten</label>
252
			<label index="install.field.userPID.desc">Dieser Wert beschreibt die Seiten, auf denen alle Benutzerdaten, d.h. Benutzer und Benutzergruppen, gespeichert werden. Neue Benutzer werden in der ersten Seite in der Liste gespeichert.</label>
249 253
			<label index="install.field.userGroup.title">Standardbenutzergruppe</label>
250 254
			<label index="install.field.userGroup.desc">Die Standard-mm_forum-Benutzergruppe. Alle neu registrierten Benutzer werden dieser Gruppe hinzugefügt. Nur Mitglieder dieser Gruppe werden als mm_forum-Benutzer erachtet.</label>
251 255
			<label index="install.field.moderatorGroup.title">Moderatorengruppe</label>
......
404 408
			<label index="install.field.requiredFields.desc">Die Felder, die bei der Registrierung zwingend ausgefüllt werden müssen. &lt;br&gt;Der Benutzername und das Passwort sind immer Pflichtfelder.</label>
405 409
			<label index="install.field.emailConfirm.title">Anmeldung bestätigen</label>
406 410
			<label index="install.field.emailConfirm.desc">Gibt an, ob Anmeldungen über einen per E-Mail verschickten Aktivierungslink bestätigt werden müssen.</label>
411
			
412
			<!-- ADDED IN 1.10.0 -->
413
			<label index="install.field.userPIDRecursive.title">Benutzerspeicherseiten rekursiv durchsuchen</label>
414
			<label index="install.field.userPIDRecursive.desc">Wenn dieser Wert gesetzt ist, dann werden die Unterseiten der angegeben Benutzerspeicherseiten bis zur ausgewählten Tiefe durchsucht.</label>
407 415
		</languageKey>
408 416

  
409 417
        <!-- FINNISH LANGUAGE DATA -->
mod1/index.php (Arbeitskopie)
390 390
            #$userGroup_query = "(".$this->confArr['userGroup']." IN (usergroup) OR ".$this->confArr['modGroup']." IN (usergroup) OR ".$this->confArr['adminGroup']." IN (usergroup))";
391 391
            $userGroup_query = "(FIND_IN_SET('".$this->confArr['userGroup']."',usergroup) OR FIND_IN_SET('".$this->confArr['modGroup']."',usergroup) OR FIND_IN_SET('".$this->confArr['adminGroup']."',usergroup))";
392 392
            #$userGroup_query = "1";
393
            $res	= $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)','fe_users',"$filter and pid='".$this->confArr['userPID']."' and ".$userGroup_query." and deleted=0");
393
            $pid_query = tx_mmforum_BeTools::getPIDQuery($this->confArr['userPID'], 'fe_users', $this->confArr['userPIDRecursive']);
394
            $res	= $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'fe_users', $filter . $pid_query . ' and ' . $userGroup_query . ' and deleted=0');
394 395
			$row	= $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
395 396
			$records= $row[0];
396 397
			$pages	= ceil($records/$this->confArr['recordsPerPage']);
......
424 425

  
425 426
		// Display userdata table
426 427
			// Execute database query
427
			$res=$GLOBALS['TYPO3_DB']->exec_SELECTquery('*','fe_users',"$filter and pid='".$this->confArr['userPID']."' and deleted=0 AND ".$userGroup_query,'',$order,($offset*$this->confArr['recordsPerPage']).",".$this->confArr['recordsPerPage']);
428
			$res=$GLOBALS['TYPO3_DB']->exec_SELECTquery('*','fe_users', $filter . $pid_query . " and deleted=0 AND ".$userGroup_query,'',$order,($offset*$this->confArr['recordsPerPage']).",".$this->confArr['recordsPerPage']);
428 429
			if($res) {
429 430

  
430 431
				$marker = array(
......
1045 1046

  
1046 1047
        $this->confArr['templatePath']      = $this->config['plugin.']['tx_mmforum.']['path_template'];
1047 1048
        $this->confArr['userPID']           = $this->config['plugin.']['tx_mmforum.']['userPID'];
1049
        $this->confArr['userPIDRecursive']  = $this->config['plugin.']['tx_mmforum.']['userPIDRecursive'];
1048 1050
        $this->confArr['forumPID']          = $this->config['plugin.']['tx_mmforum.']['storagePID'];
1049 1051
        $this->confArr['userGroup']         = $this->config['plugin.']['tx_mmforum.']['userGroup'];
1050 1052
        $this->confArr['modGroup']          = $this->config['plugin.']['tx_mmforum.']['moderatorGroup'];
mod1/class.tx_mmforum_forumadmin.php (Arbeitskopie)
945 945
				'config'				=> array(
946 946
					"type" => "select",
947 947
					"foreign_table" => "fe_groups",
948
					"foreign_table_where" => 'AND fe_groups.pid="'.$this->conf['userPID'].'"',
948
					"foreign_table_where" => tx_mmforum_BeTools::getPIDQuery($this->conf['userPID'], 'fe_groups', $this->conf['userPIDRecursive']),
949 949
					"size" => 4,
950 950
					"minitems" => 0,
951 951
					"maxitems" => 100,
mod1/class.tx_mmforum_install.php (Arbeitskopie)
353 353
					} else $options = $this->$config['type.']['handler']($this->conf[$field], $field, $config);
354 354
					$input = $this->getLSelectField($field,$this->conf[$field],$options);
355 355
				} elseif($config['type.']['table']) {
356
						if($config['type.']['table'] == 'fe_groups') $pid = $this->conf['userPID'];
357
					elseif($config['type.']['table'] == 'fe_users')  $pid = $this->conf['userPID'];
358
					else                                             $pid = $this->conf['storagePID'];
356
					$recursive = 0;
357
					if( ($config['type.']['table'] == 'fe_groups') || ($config['type.']['table'] == 'fe_users') ) {
358
						$pid = $this->conf['userPID'];
359
						$recursive = $this->conf['userPIDRecursive'];
360
					}
361
					else {
362
						$pid = $this->conf['storagePID'];
363
					}
359 364

  
360 365
					$limit = $config['type.']['limit']?$config['type.']['limit']:100;
361 366
					$bigField = ($limit>1);
362
					$input = $this->getSelectField($field,$this->conf[$field],$config['type.']['table'],$pid,$limit);
367
					$input = $this->getSelectField($field,$this->conf[$field],$config['type.']['table'],$pid,$limit,$recursive);
363 368
				} elseif($config['type.']['options.']) {
364 369
					$options = array();
365 370
					foreach($config['type.']['options.'] as $k => $v)
......
505 510
		 *
506 511
		 */
507 512

  
508
	function getSelectField($fieldname,$value,$table,$pid,$limit) {
513
	function getSelectField($fieldname,$value,$table,$pid,$limit,$recursive=0) {
509 514
		$size = ($limit<=5 && $limit > 0)?$limit:5;
510 515

  
511 516
        switch($table) {
......
523 528
				'config' => array(
524 529
					'type' => 'select',
525 530
					'foreign_table' => $table,
526
					'foreign_table_where' => 'AND '.$table.'.hidden=0 AND '.$table.'.pid='.$pid.'',
531
					'foreign_table_where' => 'AND '.$table.'.hidden=0' . tx_mmforum_betools::getPIDQuery($pid, $table, $recursive),
527 532
					'size' => $size,
528 533
					#'autoSizeMax' => 10,
529 534
					'minitems' => 0,
......
645 650
			$result[$k] = preg_replace('/:$/','',$GLOBALS['LANG']->sL($v['label']));
646 651
		return $result;
647 652
	}
653
	
654
	/**
655
	 * 
656
	 * Gets the options for the "recursive" select
657
	 * 
658
	 * @see    typo3/sysext/cms/tbl_tt_content.php (Configuration for "recursive" field)
659
	 * @author Alexander Stehlik <astehlik@intera.de>
660
	 * 
661
	 * @param  string $value     n/a
662
	 * @param  string $fieldname n/a
663
	 * @param  array  $config    n/a
664
	 * @return array The options for "recursive" select as an associative array
665
	 * 
666
	 */
667
	function getRecusiveOptions($value, $fieldname, $config) {
668
		
669
		$options = array(
670
			'0'		=> '',
671
			'1'		=> $GLOBALS['LANG']->sL('LLL:EXT:cms/locallang_ttc.php:recursive.I.1'),
672
			'2'		=> $GLOBALS['LANG']->sL('LLL:EXT:cms/locallang_ttc.php:recursive.I.2'),
673
			'3'		=> $GLOBALS['LANG']->sL('LLL:EXT:cms/locallang_ttc.php:recursive.I.3'),
674
			'4'		=> $GLOBALS['LANG']->sL('LLL:EXT:cms/locallang_ttc.php:recursive.I.4'),
675
			'250'	=> $GLOBALS['LANG']->sL('LLL:EXT:cms/locallang_ttc.php:recursive.I.5'),
676
		);
677
		
678
		return $options;
679
	}
648 680

  
649 681

  
650 682

  
......
655 687
		 * a record selector using a popup window and a page tree selector.
656 688
		 *
657 689
		 * @author  Martin Helmich <m.helmich@mittwald.de>
658
		 * @version 2007-05-14
690
		 * @version 2010-05-20
659 691
		 * @param   string  $table      The table from which the records are to be selected
660 692
		 * @param   string  $value      A commaseperated lists of record UIDs that are to be selected by default
661 693
		 * @param   string  $fieldname  The group field's name.
......
666 698
		 */
667 699

  
668 700
	function getGroupField($table,$value,$fieldname,$add_button=false,$add_pid=0) {
701
		
702
		$maxitems = 1;
703
		$size = 1;
704
		
705
		$fieldconfig = $this->fieldConfig[$this->instVars['ctg'].'.']['items.'][$fieldname.'.']['type.'];
706
		if(intval($fieldconfig['maxitems'])) {
707
			$maxitems = intval($fieldconfig['maxitems']);
708
		}
709
		if(intval($fieldconfig['size'])) {
710
			$size = intval($fieldconfig['size']);
711
		}
712
		
713
		if($value) {
714
			$values = t3lib_div::trimExplode(',', t3lib_div::rm_endcomma($value), 1);
715
			foreach($values as &$val) {
716
				$val = $table . '_' . $val;
717
			}
718
			$value = implode(',', $values);
719
		}
720
		
669 721
		$conf = array(
670 722
			'itemFormElName' => 'tx_mmforum_install[conf][0]['.$fieldname.']',
671
			'itemFormElValue' => $value?$table.'_'.$value:'',
723
			'itemFormElValue' => $value?$value:'',
672 724
			'fieldConf' => array(
673 725
				'config' => array(
674 726
					"type" => "group",
675 727
					"internal_type" => "db",
676 728
					"allowed" => $table,
677
					"size" => 1,
729
					"size" => $size,
678 730
					"minitems" => 0,
679
					"maxitems" => 1,
731
					"maxitems" => $maxitems,
680 732
					'wizards' => $add_button?array(
681 733
						'_PADDING' => 0,
682 734
						'_VERTICAL' => 1,
......
923 975
			$config = $ctg=='required' ? $this->getFieldConfigByIdentifier($var) : $this->fieldConfig["$ctg."]['items.']["$var."];
924 976
			$type = $config['type'];
925 977

  
926
			if($type == 'group')
927
				$value = preg_replace('/^'.$config['type.']['table'].'_/','',preg_replace('/,$/','',$value));
978
			if($type == 'group') {
979
				$value = t3lib_div::rm_endcomma($value);
980
				$value = preg_replace('/pages_/','',$value);
981
			}
928 982
            if($type == 'int') $value = intval($value);
929 983
            if($type == 'md5') {
930 984
                if(strlen(trim($value))==0) continue;
mod1/class.tx_mmforum_betools.php (Arbeitskopie)
99 99
		Return t3lib_parsehtml::getSubpart($template, $subpart);
100 100
	}
101 101
	
102
	
103
	/**
104
	 * 
105
	 * Returns a mysql query in the form AND ( tablename.pid=X OR tablename.pid=Y ... )
106
	 * 
107
	 * @author  Alexander Stehlik <astehlik@intera.de>
108
	 * @version 2010-05-19
109
	 * @see     typo3/sysext/cms/tslib/class.tslib_pibase.php (pi_getPidList function)
110
	 * @param   string $pid       comma seperated list of page IDs 
111
	 * @param   string $table     table name, that should be prepended to the pid field
112
	 * @param   int    $recursive depth of the recusive lookup of the page IDs
113
	 * @return  string            sql query string for selecting page IDs
114
	 */
115
	static function getPIDQuery($pid, $table, $recursive) {
116
		
117
		$recursive = t3lib_div::intInRange($recursive, 0);
118
		
119
		$pid_list_arr = array_unique(t3lib_div::trimExplode(',', $pid, 1));
120
		
121
		if( (sizeof($pid_list_arr)==1) && ($recursive==0)) {
122
			$pidquery = t3lib_div::intInRange($pid, 0);
123
		}
124
		else {
125
			$pid_list     = array();
126
			$querygen = t3lib_div::makeInstance('t3lib_queryGenerator');		
127
			
128
			foreach($pid_list_arr as $val) {
129
				
130
				$val = t3lib_div::intInRange($val, 0);
131
				
132
				if ($val) {
133
					$_list = $pidlist = $querygen->getTreeList($val, $recursive, 0, 1);
134
					if ($_list) {
135
						$pid_list = array_merge($pid_list, explode(',', $_list));
136
					}
137
				}
138
			}
139
			$pid_list = array_unique($pid_list, SORT_NUMERIC);
140
			$pidquery = implode(' OR ' . $table . '.pid=', $pid_list);
141
		}
142
		
143
		$query = ' AND ( ' . $table . '.pid=' . $pidquery . ' )';
144
		return $query;
145
	}
102 146
}
103 147

  
104 148
?>
includes/class.tx_mmforum_tools.php (Arbeitskopie)
640 640
		return str_replace(array_keys($replace), array_values($replace), $url);
641 641
	}
642 642

  
643

  
643
	/**
644
	 * 
645
	 * Returns a mysql query in the form AND ( tablename.pid=X OR tablename.pid=Y ... )
646
	 * 
647
	 * @author  Alexander Stehlik <astehlik@intera.de>
648
	 * @version 2010-05-19
649
	 * @see     typo3/sysext/cms/tslib/class.tslib_pibase.php (pi_getPidList function)
650
	 * @param   string  $conf      configuration array containing the properties userPID and userPIDRecursive  
651
	 * @param   string  $table     table name, that should be prepended to the pid field
652
	 * @param   boolean $firstOnly if true, only the first element in the userPID list will be returned (useful for new records)
653
	 * @param   boolean $pidList   if true, no query will be returned, but a comma seperated list of the PIDs
654
	 * @return  string             sql query string for selecting page IDs
655
	 */
656
	static function getUserGroupPIDQuery(&$conf, $table, $firstOnly=FALSE, $pidList=FALSE) {
657
		
658
		$recursive = t3lib_div::intInRange($conf['userPIDRecursive'], 0);
659
		
660
		$pid_list_arr = array_unique(t3lib_div::trimExplode(',', $conf['userPID'], 1));
661
				
662
		if( sizeof($pid_list_arr)==0 ) {
663
			die('mm_forum was not properly configured. No user storage pid was set. Please user the mm_forum Administration to set a user and group storage page.');
664
		}
665
		elseif( ($firstOnly) || ((sizeof($pid_list_arr)==1) && ($recursive==0)) ) {
666
			$pidquery = t3lib_div::intInRange($pid_list_arr[0], 0);
667
		}
668
		else {
669
			$pid_list     = array();
670
			$querygen = t3lib_div::makeInstance('t3lib_queryGenerator');		
671
			
672
			foreach($pid_list_arr as $val) {
673
				
674
				$val = t3lib_div::intInRange($val, 0);
675
				
676
				if ($val) {
677
					$_list = $querygen->getTreeList($val, $recursive, 0, 1);
678
					if ($_list) {
679
						$pid_list = array_merge($pid_list, explode(',', $_list));
680
					}
681
				}
682
			}
683
			$pid_list = array_unique($pid_list, SORT_NUMERIC);
684
			
685
			$glue = ' OR ' . $table . '.pid=';
686
			if($pidList) {
687
				$glue = ',';
688
			}			
689
			$pidquery = implode($glue, $pid_list);
690
		}
691
		
692
		if(!$pidList) {
693
			$query = ' AND ( ' . $table . '.pid=' . $pidquery . ' )';
694
		}
695
		else {
696
			$query = $pidquery;
697
		}
698
		
699
		return $query;
700
	}
701
	
644 702
}
645 703

  
646 704
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/mm_forum/includes/class.tx_mmforum_tools.php']) {