Bug #17569 » 0006239.patch
t3lib/class.t3lib_tcemain.php (working copy) | ||
---|---|---|
}
|
||
|
||
/**
|
||
* Return emails addresses of be_users from input list.
|
||
* Return emails addresses of be_users or be_groups from input list.
|
||
*
|
||
* @param string List of backend users, on the form "be_users_10,be_users_2" or "10,2" in case noTablePrefix is set.
|
||
* @param boolean If set, the input list are integers and not strings.
|
||
* @param string Mixed List of backend users and backend groups on the form "be_users_10,be_users_2,be_groups_11"
|
||
* @param boolean If set, the input list contain only backend users and are integers and not strings.
|
||
* @return array Array of emails
|
||
*/
|
||
function notifyStageChange_getEmails($listOfUsers,$noTablePrefix=FALSE) {
|
||
$users = t3lib_div::trimExplode(',',$listOfUsers,1);
|
||
function notifyStageChange_getEmails($listOfEntries,$noTablePrefix=FALSE) {
|
||
if (!$noTablePrefix) {
|
||
preg_match_all('/be_groups_[0-9]*/', $listOfEntries, $groups);
|
||
preg_match_all('/be_users_[0-9]*/', $listOfEntries, $users);
|
||
} else {
|
||
$users = t3lib_BEfunc::trimExplode(',',$listOfEntries,1);
|
||
}
|
||
$emails = array();
|
||
foreach($users as $userIdent) {
|
||
if ($noTablePrefix) {
|
||
$id = intval($userIdent);
|
||
} else {
|
||
list($table,$id) = t3lib_div::revExplode('_',$userIdent,2);
|
||
if (count($users[0])>0) {
|
||
foreach($users[0] as $userRef) {
|
||
if ($noTablePrefix) {
|
||
$id = intval($userRef);
|
||
} else {
|
||
list($table,$id) = t3lib_div::revExplode('_',$userRef,2);
|
||
}
|
||
$user = t3lib_BEfunc::getRecord('be_users', $id, 'email');
|
||
if (strlen(trim($user['email']))) {
|
||
$emails[$id] = $user['email'];
|
||
}
|
||
}
|
||
if ($table==='be_users' || $noTablePrefix) {
|
||
if ($userRecord = t3lib_BEfunc::getRecord('be_users', $id, 'email')) {
|
||
if (strlen(trim($userRecord['email']))) {
|
||
$emails[$id] = $userRecord['email'];
|
||
}
|
||
if (!$noTablePrefix) {
|
||
if (count($groups[0])>0) {
|
||
$groupIds = array();
|
||
foreach($groups[0] as $groupRef) {
|
||
list($table,$id) = t3lib_div::revExplode('_',$groupRef,2);
|
||
$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'));
|
||
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
if (strlen(trim($row['email']))) {
|
||
$emails[$row['uid']] = $row['email'];
|
||
}
|
||
}
|
||
}
|
||
}
|