// -------------------------------- // notify users // -------------------------------- $subject_notify = "{$logo} - {$langNewForumNotify}"; $category_id = forum_category($forum_id); $cat_name = category_name($category_id); $c = course_code_to_title($course_code); $name = uid_to_name($uid); $title = course_id_to_title($course_id); $forum_message = "-------- {$langBodyMessage} ({$langSender}: {$name})\n{$message}--------"; $plain_forum_message = q(html2text($forum_message)); $body_topic_notify = "{$langBodyForumNotify} {$langInForums} '" . q($forum_name) . "' \n {$langInCat} '" . q($cat_name) . "' {$langTo} {$langCourseS} '{$c}' <br /><br />" . q($forum_message) . "<br />\n <br />{$gunet}<br /><a href='{$urlServer}courses/{$course_code}'>{$urlServer}courses/{$course_code}</a>"; $plain_body_topic_notify = "{$langBodyForumNotify} {$langInForums} '" . q($forum_name) . "' {$langInCat} '" . q($cat_name) . "' {$langTo} {$langCourseS} '{$c}' \n\n{$plain_forum_message} \n\n{$gunet}\n<a href='{$urlServer}courses/{$course_code}'>{$urlServer}courses/{$course_code}</a>"; $linkhere = " <a href='{$urlServer}main/profile/emailunsubscribe.php?cid={$course_id}'>{$langHere}</a>."; $unsubscribe = "<br /><br />{$langNote}: " . sprintf($langLinkUnsubscribe, $title); $plain_body_topic_notify .= $unsubscribe . $linkhere; $body_topic_notify .= $unsubscribe . $linkhere; $sql = Database::get()->queryArray("SELECT DISTINCT user_id FROM forum_notify\n\t\t\tWHERE (forum_id = ?d OR cat_id = ?d)\n\t\t\tAND notify_sent = 1 AND course_id = ?d AND user_id != ?d", $forum_id, $category_id, $course_id, $uid); foreach ($sql as $r) { if (get_user_email_notification($r->user_id, $course_id)) { $emailaddr = uid_to_email($r->user_id); send_mail_multipart('', '', '', $emailaddr, $subject_notify, $plain_body_topic_notify, $body_topic_notify, $charset); } } // end of notification Session::Messages($langStored, 'alert-success'); redirect_to_home_page("modules/forum/viewforum.php?course={$course_code}&forum={$forum_id}"); } else { $tool_content .= "\n <div class='form-wrapper'>\n <form class='form-horizontal' role='form' action='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&topic={$topic}&forum={$forum_id}' method='post'>\n <fieldset>\n <div class='form-group'>\n <label for='subject' class='col-sm-2 control-label'>{$langSubject}:</label>\n <div class='col-sm-10'>\n <input type='text' name='subject' id='subject' class='form-control' maxlength='100'>\n </div>\n </div> \n <div class='form-group'>\n <label for='message' class='col-sm-2 control-label'>{$langBodyMessage}:</label>\n <div class='col-sm-10'>\n " . rich_text_editor('message', 14, 50, '') . "\n </div>\n </div>\n <div class='form-group'>\n <div class='col-sm-10 col-sm-offset-2'>\n <input class='btn btn-primary' type='submit' name='submit' value='{$langSubmit}'>\n <a class='btn btn-default' href='viewforum.php?course={$course_code}&forum={$forum_id}'>{$langCancel}</a>\n </div>\n </div> \n\t</fieldset>\n\t</form>\n </div>"; } draw($tool_content, 2, null, $head_content);
$user_id = $person->id; // check email syntax validity if (!email_seems_valid($emailTo)) { $invalid++; } elseif (get_user_email_notification($user_id, $course_id)) { // checks if user is notified by email array_push($recipients, $emailTo); } // send mail message per 50 recipients if (count($recipients) >= 50) { send_mail_multipart("{$_SESSION['givenname']} {$_SESSION['surname']}", $_SESSION['email'], $general_to, $recipients, $emailSubject, $emailBody, $emailContent, $charset); $recipients = array(); } }, $course_id); if (count($recipients) > 0) { send_mail_multipart("{$_SESSION['givenname']} {$_SESSION['surname']}", $_SESSION['email'], $general_to, $recipients, $emailSubject, $emailBody, $emailContent, $charset); } $messageInvalid = " {$langOn} {$countEmail} {$langRegUser}, {$invalid} {$langInvalidMail}"; $message = "<div class='alert alert-success'>{$langAnnAdd} {$langEmailSent}<br />{$messageInvalid}</div>"; } else { $message = "<div class='alert alert-success'>{$langAnnAdd}</div>"; } } // end of if $submit // teacher display if (isset($message) && $message) { $tool_content .= $message . "<br/>"; $displayForm = false; //do not show form } /* display form */
<div> <small>" . sprintf($langLinkUnsubscribeFromPlatform, $siteName) ." <a href='${urlServer}main/profile/emailunsubscribe.php?cid=$course_id'>$langHere</a></small> </div> </div> "; $emailcontent = $emailheader.$emailmain.$emailfooter; $emailbody = html2text($emailcontent); if (count($recipients) >= 50) { send_mail_multipart('', '', '', $recipients, $emailsubject, $emailbody, $emailcontent, $charset); $recipients = array(); } } if (count($recipients) > 0) { send_mail_multipart('', '', '', $recipients, $emailsubject, $emailbody, $emailcontent, $charset); } // Display result and close table correctly $tool_content .= "<div class='alert alert-success'>$emailsuccess</div>"; } else { $body_mail = $email_title = ''; // Display form to administrator $tool_content .= "<div class='form-wrapper'> <form class='form-horizontal' role='form' action='$_SERVER[SCRIPT_NAME]' method='post'> <fieldset> <div class='form-group'> <label for='email_title' class='col-sm-2 control-label'>$langTitle</label> <div class='col-sm-10'> <input class='form-control' type='text' name='email_title' value='$email_title' size='50' /> </div> </div>
/** * @brief update scheduled session data into database * @global type $tool_content * @global type $langBBBAddSuccessful * @global type $course_id * @global type $langBBBScheduleSessionInfo * @global type $langBBBScheduledSession * @global type $langBBBScheduleSessionInfoJoin * @param type $session_id * @param type $course_id * @param type $title * @param type $desc * @param type $start_session * @param type $type * @param type $status * @param type $notifyUsers * @param type $minutes_before * @param type $external_users */ function update_bbb_session($session_id,$title,$desc,$start_session,$type,$status,$notifyUsers,$minutes_before,$external_users,$record,$sessionUsers) { global $course_id; global $langBBBScheduleSessionInfo , $langBBBScheduledSession, $langBBBScheduleSessionInfo2, $langBBBScheduleSessionInfoJoin; // Groups of participants per session $r_group = ""; if (isset($_POST['groups'])) { foreach ($_POST['groups'] as $group) { $r_group .= "'$group'" .','; } } $r_group = rtrim($r_group,','); // Enable recording or not switch($record) { case 0: $record="false"; break; case 1: $record="true"; break; } Database::get()->querySingle("UPDATE bbb_session SET title=?s,description=?s," . "start_date=?t,public=?s,active=?s,unlock_interval=?d,external_users=?s,participants=?s,record=?s,sessionUsers=?d WHERE id=?d",$title, $desc, $start_session, $type, $status, $minutes_before, $external_users, $r_group, $record, $sessionUsers, $session_id); // if we have to notify users for new session if ($notifyUsers == "1") { $recipients = array(); $result = Database::get()->queryArray("SELECT course_user.user_id, user.email FROM course_user, user WHERE course_id = ?d AND user.id IN ($r_group) AND course_user.user_id = user.id", $course_id); foreach($result as $row) { $emailTo = $row->email; $user_id = $row->user_id; // we check if email notification are enabled for each user if (get_user_email_notification($user_id)) { //and add user to recipients array_push($recipients, $emailTo); } } if (count($recipients) > 0) { $emailsubject = $langBBBScheduledSession; $emailbody = $langBBBScheduleSessionInfo . " \"" . q($title) . "\" " . $langBBBScheduleSessionInfo2 . " " . q($start_session) . ""; $emailcontent = $emailbody; //Notify course users for new bbb session send_mail_multipart('', '', '', $recipients, $emailsubject, $emailbody, $emailcontent, 'UTF-8'); } //Notify external users for new bbb session if (isset($external_users)) { $recipients = explode(',', $external_users); $q = Database::get()->querySingle("SELECT meeting_id, att_pw FROM bbb_session WHERE id = ?d", $_GET['id']); foreach ($recipients as $row) { //$bbblink = bbb_join_user($q->meeting_id, $q->att_pw, $row, ''); $bbblink = get_config('base_url')."modules/bbb/ext.php?meeting_id=" . urlencode($q->meeting_id) . "&username="******" \"" . q($title) . "\" " . $langBBBScheduleSessionInfo2 . " " . q($start_session) . "<br><br>$langBBBScheduleSessionInfoJoin:<br> $bbblink"; $emailcontent = $emailbody; send_mail_multipart('', '', '', $row, $emailsubject, $emailbody, $emailcontent, 'UTF-8'); } } } $orderMax = Database::get()->querySingle("SELECT MAX(`order`) AS maxorder FROM announcement WHERE course_id = ?d", $course_id)->maxorder; $order = $orderMax + 1; Database::get()->querySingle("INSERT INTO announcement (content,title,`date`,course_id,`order`,visible) VALUES ('".$langBBBScheduleSessionInfo . " \"" . $title . "\" " . $langBBBScheduleSessionInfo2 . " " . $start_session."', '$langBBBScheduledSession',NOW(), '$course_id','$order','1')"); }
send_mail_multipart('', '', '', $emailaddr, $subject_dropbox, $plain_body_dropbox_message, $body_dropbox_message, $charset); } } } else { //message in personal context $subject_dropbox = $langNewDropboxFile; foreach ($recipients as $userid) { if (get_user_email_notification($userid)) { $linkhere = "<a href='{$urlServer}main/profile/profile.php'>{$langHere}</a>."; //$unsubscribe = "<br />" . sprintf($langLinkUnsubscribe, $title); $body_dropbox_message = "{$langSender}: " . q($_SESSION['givenname']) . " " . q($_SESSION['surname']) . " <br /><br /> {$subject} <br /><br />" . $_POST['body'] . "<br />"; $body_dropbox_message .= "{$langNote}: {$langDoNotReply} <a href='{$urlServer}modules/dropbox/index.php'>{$langHere}</a>.<br />"; //$body_dropbox_message .= "$unsubscribe $linkhere"; $plain_body_dropbox_message = html2text($body_dropbox_message); $emailaddr = uid_to_email($userid); send_mail_multipart('', '', '', $emailaddr, $subject_dropbox, $plain_body_dropbox_message, $body_dropbox_message, $charset); } } } } $tool_content .= "<div class='alert alert-success'>{$langdocAdd}<br>"; } else { //end if(!$error) $tool_content .= "<div class='alert alert-danger'>{$errormsg}<br>"; } if ($course_id == 0) { $tool_content .= "<a href='index.php'>{$langBack}</a></div><br>"; } else { $tool_content .= "<a href='index.php?course={$course_code}'>{$langBack}</a></div><br>"; } }
function notify_users($forum_id, $forum_name, $topic_id, $subject, $message, $topic_date) { global $logo, $langNewForumNotify, $course_code, $course_code, $course_id, $langForumFrom, $uid, $langBodyForumNotify, $langInForums, $urlServer, $langdate, $langSender, $langCourse, $langCategory, $langForum, $langSubject, $langNote, $langLinkUnsubscribe, $langHere, $charset, $langMailBody; $subject_notify = "$logo - $langNewForumNotify"; $category_id = forum_category($forum_id); $cat_name = category_name($category_id); $c = course_code_to_title($course_code); $name = uid_to_name($uid); $title = course_id_to_title($course_id); $header_html_topic_notify = "<!-- Header Section --> <div id='mail-header'> <br> <div> <div id='header-title'>$langBodyForumNotify <a href='{$urlServer}courses/$course_code'>".q($title)."</a>.</div> <ul id='forum-category'> <li><span><b>$langCategory:</b></span> <span>" . q($cat_name) . "</span></li> <li><span><b>$langForum:</b></span> <span><a href='{$urlServer}modules/forum/viewforum.php?course=$course_code&forum=$forum_id'>" . q($forum_name) . "</a></span></li> <li><span><b>$langForumFrom :</b></span> <span>$name</span></li> <li><span><b>$langdate:</b></span> <span> $topic_date </span></li> </ul> </div> </div>"; $body_html_topic_notify = "<!-- Body Section --> <div id='mail-body'> <br> <div><b>$langSubject:</b> <span class='left-space'><a href='{$urlServer}modules/forum/viewforum.php?course=$course_code&forum=$forum_id&topic=$topic_id'>" . q($subject) . "</a></span></div><br> <div><b>$langMailBody:</b></div> <div id='mail-body-inner'> $message </div> </div>"; $footer_html_topic_notify = "<!-- Footer Section --> <div id='mail-footer'> <br> <div> <small>" . sprintf($langLinkUnsubscribe, q($title)) ." <a href='${urlServer}main/profile/emailunsubscribe.php?cid=$course_id'>$langHere</a></small> </div> </div>"; $html_topic_notify = $header_html_topic_notify.$body_html_topic_notify.$footer_html_topic_notify; $plain_message = html2text($message); $plain_topic_notify = "$langBodyForumNotify $langInForums\n" . "$langSender: $name\n" . "$langCourse: $title\n {$urlServer}courses/$course_code/\n" . "$langCategory: $cat_name\n" . "$langForum: $forum_name\n {$urlServer}modules/forum/viewforum.php?course=$course_code&forum=$forum_id\n" . "$langSubject: $subject\n {$urlServer}modules/forum/viewforum.php?course=$course_code&forum=$forum_id&topic=$topic_id\n" . "--------------------------------------------\n$plain_message\n" . "--------------------------------------------\n" . "$langNote: " . canonicalize_whitespace(str_replace('<br />', "\n", sprintf($langLinkUnsubscribe, q($title)))) . " $langHere:\n${urlServer}main/profile/emailunsubscribe.php?cid=$course_id\n"; $users = Database::get()->queryArray("SELECT DISTINCT user_id FROM forum_notify WHERE (forum_id = ?d OR cat_id = ?d) AND notify_sent = 1 AND course_id = ?d AND user_id != ?d", $forum_id, $category_id, $course_id, $uid); $email = array(); foreach ($users as $user) { if (get_user_email_notification($user->user_id, $course_id)) { $email[] = uid_to_email($user->user_id); } } send_mail_multipart('', '', '', $email, $subject_notify, $plain_topic_notify, $html_topic_notify, $charset); }
/** * @brief update scheduled session data into database * @global type $tool_content * @global type $langBBBAddSuccessful * @global type $course_id * @global type $langBBBScheduleSessionInfo * @global type $langBBBScheduledSession * @global type $langBBBScheduleSessionInfo2 * @param type $session_id * @param type $title * @param type $desc * @param type $start_session * @param type $type * @param type $status * @param type $notifyUsers * @param type $minutes_before * @param type $external_users */ function update_bbb_session($session_id, $title, $desc, $start_session, $type, $status, $notifyUsers, $minutes_before, $external_users, $record, $sessionUsers) { global $tool_content, $course_id; global $langBBBScheduleSessionInfo, $langBBBScheduledSession, $langBBBScheduleSessionInfo2; // Groups of participants per session $r_group = ""; foreach ($_POST['groups'] as $group) { $r_group .= $group . ','; } $r_group = rtrim($r_group, ','); // Enable recording or not switch ($record) { case 0: $record = "false"; break; case 1: $record = "true"; break; } Database::get()->querySingle("UPDATE bbb_session SET title=?s,description=?s," . "start_date=?t,public=?s,active=?s,unlock_interval=?d,external_users=?s,participants=?s,record=?s,sessionUsers=?d WHERE id=?d", $title, $desc, $start_session, $type, $status, $minutes_before, $external_users, $r_group, $record, $sessionUsers, $session_id); // if we have to notify users for new session if ($notifyUsers == "1") { $recipients = array(); $result = Database::get()->queryArray("SELECT user_id, email FROM course_user, user\n WHERE course_user.course_id = {$course_id} AND course_user.user_id = user.id"); foreach ($result as $row) { $emailTo = $row->email; $user_id = $row->user_id; // we check if email notification are enabled for each user if (get_user_email_notification($user_id)) { //and add user to recipients array_push($recipients, $emailTo); } } if (count($recipients) > 0) { $emailsubject = $langBBBScheduledSession; $emailbody = $langBBBScheduleSessionInfo . " \"" . q($title) . "\" " . $langBBBScheduleSessionInfo2 . " " . q($start_session); $emailcontent = $langBBBScheduleSessionInfo . " \"" . q($title) . "\" " . $langBBBScheduleSessionInfo2 . " " . q($start_session); //Notify course users for new bbb session send_mail_multipart('', '', '', $recipients, $emailsubject, $emailbody, $emailcontent, 'UTF-8'); } } $orderMax = Database::get()->querySingle("SELECT MAX(`order`) AS maxorder FROM announcement\n WHERE course_id = ?d", $course_id)->maxorder; $order = $orderMax + 1; Database::get()->querySingle("INSERT INTO announcement (content,title,`date`,course_id,`order`,visible) VALUES ('" . $langBBBScheduleSessionInfo . " \"" . $title . "\" " . $langBBBScheduleSessionInfo2 . " " . $start_session . "',\n '{$langBBBScheduledSession}',NOW(),\n '{$course_id}','{$order}','1')"); }
<br> <p>$langProblem</p><br>" . get_config('admin_name') . ": <ul id='forum-category'> <li>$langManager: $siteName</li> <li>$langTel: $telephone</li> <li>$langEmail: " . get_config('email_helpdesk') . "</li> </ul></p> </div> </div>"; $emailbody = $emailheader.$emailmain; $emailbodyplain = html2text($emailbody); send_mail_multipart('', '', '', $email_form, $emailsubject, $emailbodyplain, $emailbody, $charset); Session::Messages(array($message, "$langTheU \"$givenname_form $surname_form\" $langAddedU" . ((isset($auth) and $auth == 1)? " $langAndP": '')), 'alert-success'); } } $navigation[] = array('url' => 'index.php', 'name' => $langAdmin); // javascript load_js('jstree3'); load_js('pwstrength.js'); $head_content .= <<<hContent <script type="text/javascript"> /* <![CDATA[ */