$invitegroups[$agroup['groupName']] = $agroup['groupDesc']; $smarty->assign("invitegroups", $invitegroups); $smarty->assign("usergroups", $user_details['groups']); if (isset($_REQUEST['send'])) { $_text=$_REQUEST["emailcontent"]; $_text=str_replace("\r\n", "\n", $_text); $_text=str_replace("\n\r", "\n", $_text); $_text=str_replace("\r", "\n", $_text); $mails=$_REQUEST["emailslist"]; switch($_REQUEST['emailslist_format']) { case 'all': $emails=parsemails_all($mails); break; case 'csv': $emails=parsemails_csv($mails); break; default: $emails=array(); } $igroups=$_REQUEST['invitegroups']; if (!empty($_REQUEST['confirm'])) { $tikilib->query( "INSERT INTO `tiki_invite` (inviter, groups, ts, emailsubject,emailcontent,wikicontent,wikipageafter) VALUES (?,?,?,?,?,?,?)", array( $user, count($igroups) ? implode(',', $igroups) : null, $tikilib->now,
$allgroups = $userlib->get_groups(0, -1, 'groupName_desc', '', '', 'n'); $invitegroups = array(); foreach ($allgroups['data'] as $agroup) { $invitegroups[$agroup['groupName']] = $agroup['groupDesc']; } $smarty->assign("invitegroups", $invitegroups); $smarty->assign("usergroups", $user_details['groups']); if (isset($_REQUEST['send'])) { $_text = $_REQUEST["emailcontent"]; $_text = str_replace("\r\n", "\n", $_text); $_text = str_replace("\n\r", "\n", $_text); $_text = str_replace("\r", "\n", $_text); $mails = $_REQUEST["emailslist"]; switch ($_REQUEST['emailslist_format']) { case 'all': $emails = parsemails_all($mails); break; case 'csv': $emails = parsemails_csv($mails); break; default: $emails = array(); } $igroups = $_REQUEST['invitegroups']; if (!empty($_REQUEST['confirm'])) { $tikilib->query("INSERT INTO `tiki_invite` (inviter, groups, ts, emailsubject,emailcontent,wikicontent,wikipageafter) VALUES (?,?,?,?,?,?,?)", array($user, count($igroups) ? implode(',', $igroups) : null, $tikilib->now, $_REQUEST['emailsubject'], $_REQUEST['emailcontent'], $_REQUEST['wikicontent'], empty($_REQUEST['wikipageafter']) ? NULL : $_REQUEST['wikipageafter'])); $res = $tikilib->query("SELECT MAX(id) as `id` FROM `tiki_invite` WHERE `inviter`=? AND `ts`=?", array($user, $tikilib->now)); $row = $res->fetchRow(); $id = $row['id']; foreach ($emails as $m) { $tikilib->query("INSERT INTO `tiki_invited` (id_invite, email, firstname, lastname, used) VALUES (?,?,?,?,?)", array($id, $m['email'], $m['firstname'], $m['lastname'], "no"));