Project

General

Profile

Bug #17569 » 0006239_v2.patch

Administrator Admin, 2008-03-02 22:42

View differences:

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) {
$emails = array();
foreach($users as $userIdent) {
if ($noTablePrefix) {
$id = intval($userIdent);
} else {
list($table,$id) = t3lib_div::revExplode('_',$userIdent,2);
}
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) {
preg_match_all('/be_groups_([0-9]+)/', $listOfEntries, $match_groups);
preg_match_all('/be_users_([0-9]+)/', $listOfEntries, $match_users);
$groups = $match_groups[1];
$users = $match_users[1];
foreach($groups as $id) {
$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'];
}
}
}
} else {
$users = t3lib_div::trimExplode(',',$listOfEntries,1);
}
foreach($users as $id) {
$user = t3lib_BEfunc::getRecord('be_users', $id, 'email');
if (strlen(trim($user['email']))) {
$emails[$id] = $user['email'];
}
}
return $emails;
}
(2-2/3)