0006239.patch

Administrator Admin, 2007-12-12 16:32

Download (2.6 kB)

 
t3lib/class.t3lib_tcemain.php (working copy)
6381 6381
	}
6382 6382

  
6383 6383
	/**
6384
	 * Return emails addresses of be_users from input list.
6384
	 * Return emails addresses of be_users or be_groups from input list.
6385 6385
	 *
6386
	 * @param	string		List of backend users, on the form "be_users_10,be_users_2" or "10,2" in case noTablePrefix is set.
6387
	 * @param	boolean		If set, the input list are integers and not strings.
6386
	 * @param	string		Mixed List of backend users and backend groups on the form "be_users_10,be_users_2,be_groups_11" 
6387
	 * @param	boolean		If set, the input list contain only backend users and are integers and not strings.
6388 6388
	 * @return	array		Array of emails
6389 6389
	 */
6390
	function notifyStageChange_getEmails($listOfUsers,$noTablePrefix=FALSE)	{
6391
		$users = t3lib_div::trimExplode(',',$listOfUsers,1);
6390
	function notifyStageChange_getEmails($listOfEntries,$noTablePrefix=FALSE)	{
6391
		if (!$noTablePrefix) {
6392
			preg_match_all('/be_groups_[0-9]*/', $listOfEntries, $groups);
6393
			preg_match_all('/be_users_[0-9]*/', $listOfEntries, $users);
6394
		} else {
6395
			$users = t3lib_BEfunc::trimExplode(',',$listOfEntries,1);
6396
		}
6392 6397
		$emails = array();
6393
		foreach($users as $userIdent)	{
6394
			if ($noTablePrefix)	{
6395
				$id = intval($userIdent);
6396
			} else {
6397
				list($table,$id) = t3lib_div::revExplode('_',$userIdent,2);
6398
		if (count($users[0])>0) {
6399
			foreach($users[0] as $userRef) {
6400
				if ($noTablePrefix)	{
6401
					$id = intval($userRef);
6402
				} else {		
6403
					list($table,$id) = t3lib_div::revExplode('_',$userRef,2);
6404
				}
6405
				$user = t3lib_BEfunc::getRecord('be_users', $id, 'email');
6406
				if (strlen(trim($user['email'])))	{
6407
					$emails[$id] = $user['email'];
6408
				}
6398 6409
			}
6399
			if ($table==='be_users' || $noTablePrefix)	{
6400
				if ($userRecord = t3lib_BEfunc::getRecord('be_users', $id, 'email'))	{
6401
					if (strlen(trim($userRecord['email'])))	{
6402
						$emails[$id] = $userRecord['email'];
6410
		}
6411
		if (!$noTablePrefix) {
6412
			if (count($groups[0])>0) {
6413
				$groupIds = array();
6414
				foreach($groups[0] as $groupRef) {
6415
					list($table,$id) = t3lib_div::revExplode('_',$groupRef,2);
6416
					$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'be_users', 'pid=0 AND '.$GLOBALS['TYPO3_DB']->listQuery('usergroup',intval($id),'be_users').t3lib_BEfunc::deleteClause('be_users'));
6417
					while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))	{
6418
						if (strlen(trim($row['email'])))	{
6419
							$emails[$row['uid']] = $row['email'];
6420
						}
6403 6421
					}
6404 6422
				}
6405 6423
			}