function add_test($test_id, $title) { global $db, $msg; $no_error = true; $studs_take_num = get_studs_take_more_than_once($_SESSION["course_id"], $test_id); foreach ($studs_take_num as $member_id => $num) { if ($no_error) $no_error = false; $error_msg .= get_display_name($member_id) . ": " . $num . " times<br>"; } if (!$no_error) { $f = array('ADD_TEST_INTO_GRADEBOOK', $title, $error_msg); $msg->addFeedback($f); } if ($no_error) // add into gradebook { $_POST["selected_grade_scale_id"] = intval($_POST["selected_grade_scale_id"]); $sql_insert = "INSERT INTO ".TABLE_PREFIX."gradebook_tests (id, type, grade_scale_id) VALUES (". $test_id. ", 'ATutor Test', ".$_POST["selected_grade_scale_id"].")"; $result_insert = mysql_query($sql_insert, $db) or die(mysql_error()); } }
function print_entry2($row) { global $page, $system_courses, $forum_info; static $counter; $counter++; $reply_link = '<a href="forum/view.php?fid=' . $row['forum_id'] . SEP . 'pid='; if ($row['parent_id'] == 0) { $reply_link .= $row['post_id']; } else { $reply_link .= $row['parent_id']; } $reply_link .= SEP . 'reply=' . $row['post_id'] . SEP . 'page=' . $page . '#post" >' . _AT('reply') . '</a>'; ?> <li class="<?php if ($counter % 2) { echo 'odd'; } else { echo 'even'; } ?> "> <a name="<?php echo $row['post_id']; ?> "></a> <div class="forum-post-author"> <label class="title"><?php echo htmlspecialchars(get_display_name($row['member_id'])); ?> </label><br /> </div> <div class="forum-post-content"> <div class="date"> <p><?php echo AT_date(_AT('forum_date_format'), $row['date'], AT_DATE_MYSQL_DATETIME); ?> </p> </div> <div class="postheader"><h3><?php echo AT_Print($row['subject'], 'forums_threads.subject'); ?> </h3></div> <div class="body"> <p><?php echo AT_print($row['body'], 'forums_threads.body'); ?> </p> </div> </div> </li> <?php }
/** * Add a job posting to the database. * @param string job title * @param string description * @param Array categories id * @param int 1 if public; 0 otherwise. * @param string Closing date for this job post, mysql TIMESTAMP format * @precondition ATutor Mailer class imported. */ function addJob($title, $description, $categories, $is_public, $closing_date) { require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php'; global $addslashes, $db, $msg, $_config, $_base_href; if ($_SESSION['jb_employer_id'] < 1) { $msg->addError(); //authentication error exit; } else { include AT_JB_INCLUDE . 'Employer.class.php'; $employer = new Employer($_SESSION['jb_employer_id']); $employer_id = $employer->getId(); } $title = $addslashes($title); $description = $addslashes($description); $is_public = isset($is_public) ? 1 : 0; $closing_date = $addslashes($closing_date); $approval_state = $_config['jb_posting_approval'] == 1 ? AT_JB_POSTING_STATUS_UNCONFIRMED : AT_JB_POSTING_STATUS_CONFIRMED; $sql = 'INSERT INTO ' . TABLE_PREFIX . "jb_postings (employer_id, title, description, is_public, closing_date, created_date, revised_date, approval_state) VALUES ({$employer_id}, '{$title}', '{$description}', {$is_public}, '{$closing_date}', NOW(), NOW(), {$approval_state})"; $result = mysql_query($sql, $db); $posting_id = mysql_insert_id(); //add to posting category table if (!empty($categories)) { foreach ($categories as $id => $category) { $category = intval($category); $sql = 'INSERT INTO ' . TABLE_PREFIX . "jb_posting_categories (posting_id, category_id) VALUES ({$posting_id}, {$category})"; mysql_query($sql, $db); //send out notification if the person is subscribed to the category. $sql = 'SELECT m.member_id, m.email FROM ' . TABLE_PREFIX . 'jb_category_subscribes cs LEFT JOIN ' . TABLE_PREFIX . "members m ON cs.member_id=m.member_id WHERE category_id={$category}"; $result = mysql_query($sql, $db); $post_link = $_base_href . AT_JB_BASENAME . 'view_post.php?jid=' . $posting_id; if ($result) { while ($row = mysql_fetch_assoc($result)) { $mail = new ATutorMailer(); $mail->AddAddress($row['email'], get_display_name($row['member_id'])); $body = _AT('jb_subscription_msg', $title, $this->getCategoryNameById($category), $post_link); $body .= "\n\n"; $body .= _AT('jb_posted_by') . ": " . htmlentities_utf8($employer->getCompany()) . "\n"; $mail->FromName = $_config['site_name']; $mail->From = $_config['contact_email']; $mail->Subject = _AT('jb_subscription_mail_subject'); $mail->Body = $body; if (!$mail->Send()) { $msg->addError('SENDING_ERROR'); } unset($mail); } } } } if (!$result) { //TODO: db error message $msg->addError(); } }
function add_test($test_id, $title) { global $msg; $no_error = true; $studs_take_num = get_studs_take_more_than_once($_SESSION["course_id"], $test_id); foreach ($studs_take_num as $member_id => $num) { if ($no_error) { $no_error = false; } $error_msg .= get_display_name($member_id) . ": " . $num . " times<br>"; } if (!$no_error) { $f = array('ADD_TEST_INTO_GRADEBOOK', $title, $error_msg); $msg->addFeedback($f); } if ($no_error) { $sql_insert = "INSERT INTO %sgradebook_tests (id, type, grade_scale_id) VALUES (%d, 'ATutor Test', %d)"; $result_insert = queryDB($sql_insert, array(TABLE_PREFIX, $test_id, $_POST["selected_grade_scale_id"])); } }
function is_test_updatable($gradebook_test_id) { global $msg; $sql = "SELECT g.id, t.title FROM %sgradebook_tests g, %stests t WHERE g.id=t.test_id AND g.type='ATutor Test' AND g.gradebook_test_id = %d"; $row = queryDB($sql, array(TABLE_PREFIX, TABLE_PREFIX, $gradebook_test_id), TRUE); $no_error = true; $studs_take_num = get_studs_take_more_than_once($_SESSION["course_id"], $row["id"]); foreach ($studs_take_num as $member_id => $num) { if ($no_error) { $no_error = false; } $error_msg .= get_display_name($member_id) . ": " . $num . " times<br>"; } if (!$no_error) { $f = array('UPDATE_GRADEBOOK', $row['title'], $error_msg); $msg->addFeedback($f); } if ($no_error) { return true; } else { return false; } }
function is_test_updatable($gradebook_test_id) { global $db, $msg; $sql = "SELECT g.id, t.title FROM " . TABLE_PREFIX . "gradebook_tests g, " . TABLE_PREFIX . "tests t WHERE g.id=t.test_id AND g.type='ATutor Test' AND g.gradebook_test_id = " . $gradebook_test_id; $result = mysql_query($sql, $db) or die(mysql_error()); $row = mysql_fetch_assoc($result); $no_error = true; $studs_take_num = get_studs_take_more_than_once($_SESSION["course_id"], $row["id"]); foreach ($studs_take_num as $member_id => $num) { if ($no_error) { $no_error = false; } $error_msg .= get_display_name($member_id) . ": " . $num . " times<br>"; } if (!$no_error) { $f = array('UPDATE_GRADEBOOK', $row['title'], $error_msg); $msg->addFeedback($f); } if ($no_error) { return true; } else { return false; } }
<div class="table-panel"> <table class="table table-bordered"> <thead> <tr> <?php foreach ($headers as $header) { ?> <th class="<?php echo get_sorting_class($header); ?> " data-column="<?php echo $header['column_name']; ?> "> <?php echo get_display_name($header); ?> </th> <?php } ?> </tr> </thead> <tbody> <?php foreach ($body as $data) { ?> <tr> <?php foreach ($headers as $header) { ?>
echo $_base_href; ?> themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?> /images/profile.gif" alt="" border="0" class="pa_tool_image"/><?php echo _AT('pa_set_profile_pic'); ?> </a> </div> <?php } else { ?> <div class="photo_actions"> <p><?php echo _AT('pa_uploaded_by') . ': ' . AT_print(get_display_name($this->photo_info['member_id']), 'members.full_name'); ?> </p> </div> <?php } ?> </div> </div> <script type="text/javascript"> jQuery(document).ready(function () { //the ATutor undo function var undo = function (that, targetContainer) { var markup = "<span class='flc-undo' aria-live='polite' aria-relevant='all'>" + "<span class='flc-undo-undoContainer'><a href='#' class='flc-undo-undoControl'>[<?php
<input type="submit" name="move" value="<?php echo _AT('move_to_inbox'); ?>"/> </td> </tr> </tfoot> <tbody> <?php if ($row = mysql_fetch_assoc($this->result)): ?> <?php do { ?> <?php if ($row['message_id'] == $_GET['view']): ?> <tr class="selected"> <?php else: ?> <tr onmousedown="document.form['m<?php echo $row['message_id']; ?>'].checked = !document.form['m<?php echo $row['message_id']; ?>'].checked; rowselectbox(this, document.form['m<?php echo $row['message_id']; ?>'].checked, '');" id="r_<?php echo $row['message_id']; ?>_1"> <?php endif; ?> <td><input type="checkbox" name="id[]" value="<?php echo $row['message_id']; ?>" id="m<?php echo $row['message_id']; ?>" <?php if (isset($_POST['id']) && in_array($row['message_id'], $_POST['id'])) { echo 'checked="checked"'; } ?> title="<?php echo _AT('delete').': '.AT_print($row['subject'], 'messages.subject');?>" onmouseup="this.checked=!this.checked" /></td> <?php $name = get_display_name($row['to_member_id']); echo '<td align="left" valign="middle">'; if ($_GET['view'] != $row['message_id']) { echo $name; } else { echo '<strong>'.$name.'</strong>'; } echo '</td>'; echo '<td><label for="m'.$row['message_id'].'">'; if ($_GET['view'] != $row['message_id']) { echo '<a href="'.$_SERVER['PHP_SELF'].'?view='.$row['message_id'].'">'.AT_print($row['subject'], 'messages.subject').'</a>'; } else { echo '<strong>'.AT_print($row['subject'], 'messages.subject').'</strong>';
$to = $_base_href . 'browse.php'; } if (isset($_POST['cancel'])) { $msg->addFeedback('CANCELLED'); header('Location: ' . $to); exit; } $row = array(); $id = intval($_REQUEST['id']); if (isset($system_courses[$id], $system_courses[$id]['member_id'])) { $sql = "SELECT M.member_id, M.first_name, M.last_name, M.email FROM " . TABLE_PREFIX . "members M WHERE M.member_id={$system_courses[$id][member_id]}"; $result = mysql_query($sql, $db); $row = mysql_fetch_assoc($result); } if ($row) { $instructor_name = get_display_name($row['member_id']); $instructor_email = AT_print($row['email'], 'members.email'); } else { $msg->addError('INST_INFO_NOT_FOUND'); header('Location: ' . $to); exit; } if (isset($_POST['submit'])) { $missing_fields = array(); $to_email = $_POST['email']; $_POST['subject'] = trim($_POST['subject']); $_POST['body'] = trim($_POST['body']); if ($_POST['subject'] == '') { $missing_fields[] = _AT('subject'); } if ($_POST['body'] == '') {
$result = queryDB($sql, array(TABLE_PREFIX, $now, $_POST['parent_id'])); if ($subscriber_email_list) { require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php'; if ($_POST['parent_name'] == '') { $_POST['parent_name'] = $_POST['subject']; } $_POST['parent_name'] = urldecode($_POST['parent_name']); foreach ($subscriber_email_list as $subscriber) { $mail = new ATutorMailer(); $mail->AddAddress($subscriber['email'], get_display_name($subscriber['member_id'])); $body = _AT('forum_new_submsg', $_SESSION['course_title'], get_forum_name($_POST['fid']), $_POST['parent_name'], AT_BASE_HREF . 'mods/_standard/forums/forum/view.php?fid=' . $_POST['fid'] . SEP . 'pid=' . $_POST['parent_id']); $body .= "\n----------------------------------------------\n"; $body .= _AT('course') . ': ' . $_SESSION['course_title'] . "\n"; $body .= _AT('forum') . ': ' . get_forum_name($_POST['fid']) . "\n"; $body .= _AT('thread') . ': ' . $_POST['parent_name'] . "\n"; $body .= _AT('posted_by') . ": " . get_display_name($_SESSION['member_id']) . "\n"; $body .= $_POST['body'] . "\n"; $mail->FromName = $_config['site_name']; $mail->From = $_config['contact_email']; $mail->Subject = _AT('thread_notify1') . ': ' . $_POST['parent_name']; $mail->Body = $body; if (!$mail->Send()) { $msg->addError('SENDING_ERROR'); } unset($mail); } } if ($_REQUEST['subscribe']) { if ($_POST['parent_id'] != 0) { $this_id = $_POST['parent_id']; $subject = $_POST['parent_name'];
echo htmlspecialchars($file_info['file_name']); ?> </label> <?php if ($file_info['description']) { ?> <p class="fm-desc"><?php echo htmlspecialchars($file_info['description']); ?> </p> <?php } ?> </td> <td valign="top"><?php echo get_display_name($file_info['member_id']); ?> </td> <td valign="top"> <?php if ($_config['fs_versioning']) { ?> <?php if ($file_info['num_revisions']) { if ($file_info['num_revisions'] == 1) { $lang_var = 'fs_revision'; } else { $lang_var = 'fs_revisions'; } ?>
if (defined('AUTO_APPROVE_INSTRUCTORS') && AUTO_APPROVE_INSTRUCTORS) { $sql = "UPDATE " . TABLE_PREFIX . "members SET status=" . AT_STATUS_INSTRUCTOR . ", creation_date=creation_date, last_login=last_login WHERE member_id={$_SESSION['member_id']}"; $result = mysql_query($sql, $db); $msg->addFeedback('ACCOUNT_APPROVED'); } else { $_POST['description'] = $addslashes($_POST['description']); $sql = "INSERT INTO " . TABLE_PREFIX . "instructor_approvals VALUES ({$_SESSION['member_id']}, NOW(), '{$_POST['description']}')"; $result = mysql_query($sql, $db); /* email notification send to admin upon instructor request */ if (EMAIL_NOTIFY && $_config['contact_email'] != '') { $sql = "SELECT login, email FROM " . TABLE_PREFIX . "members WHERE member_id={$_SESSION['member_id']}"; $result = mysql_query($sql, $db); if ($row = mysql_fetch_assoc($result)) { $email = $row['email']; } $tmp_message = _AT('req_message_instructor', get_display_name($_SESSION['member_id']), $_POST['description'], AT_BASE_HREF); require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php'; $mail = new ATutorMailer(); $mail->From = $email; $mail->AddAddress($_config['contact_email']); $mail->Subject = _AT('req_message9'); $mail->Body = stripslashes($tmp_message); if (!$mail->Send()) { //echo 'There was an error sending the message'; $msg->printErrors('SENDING_ERROR'); exit; } unset($mail); } $msg->addFeedback('APPROVAL_PENDING'); }
echo $this->cats[$row['cat_id']]; ?> </a> <?php } ?> </td> <td> <a href="<?php echo AT_BASE_HREF; ?> contact_instructor.php?id=<?php echo $row['course_id']; ?> "><?php echo get_display_name($row['member_id']); ?> </a> </td> <td> <?php echo _AT($row['access']); ?> </td> <td class="hidecol700"> <?php // insert enrolment link if allowed if (isset($row['enroll_link'])) { ?> - <small><?php
$msg = _AT('from') . ': ' . get_display_name($row['from_member_id']) . "\r\n"; $msg .= _AT('to') . ': ' . $my_display_name . "\r\n"; $msg .= _AT('subject') . ': ' . $row['subject'] . "\r\n"; $msg .= _AT('date') . ': ' . $row['date_sent'] . "\r\n"; $msg .= _AT('body') . ': ' . $row['body'] . "\r\n"; $msg .= "\r\n=============================================\r\n\r\n"; $inbox_messages .= $msg; } } // sent messages if ($_POST['messages'] == 1 || $_POST['messages'] == 3) { $sql = "SELECT * FROM " . TABLE_PREFIX . "messages_sent WHERE from_member_id={$_SESSION['member_id']} ORDER BY date_sent"; $result = mysql_query($sql, $db); while ($row = mysql_fetch_assoc($result)) { $msg = _AT('from') . ': ' . $my_display_name . "\r\n"; $msg .= _AT('to') . ': ' . get_display_name($row['from_member_id']) . "\r\n"; $msg .= _AT('subject') . ': ' . $row['subject'] . "\r\n"; $msg .= _AT('date') . ': ' . $row['date_sent'] . "\r\n"; $msg .= _AT('body') . ': ' . $row['body'] . "\r\n"; $msg .= "\r\n=============================================\r\n\r\n"; $sent_messages .= $msg; } } if ($inbox_messages && $sent_messages) { // add the two to a zip file require AT_INCLUDE_PATH . 'classes/zipfile.class.php'; // for zipfile $zipfile = new zipfile(); $zipfile->add_file($inbox_messages, _AT('inbox') . '.txt'); $zipfile->add_file($sent_messages, _AT('sent_messages') . '.txt'); $zipfile->close();
<tr class="dataTableHead"> <td > <a href="<?php echo site_url("payment/billing_detail/{$student->student_id}"); ?> " target="_blank"> <?php echo $student->child_key; ?> </a> </td> <td > <a href="<?php echo site_url("child/view/{$student->student_id}"); ?> " target="_blank"> <?php echo get_display_name($student->name, $student->alias); ?> </a> </td> <td ><?php echo format_money($student->invoice_amount - $student->invoice_balance, $current_currency); ?> </td> <td > <a href="<?php echo site_url("payment/summary_of_account/{$student->student_id}"); ?> " getLink="<?php echo site_url("payment/summary_of_account/{$student->student_id}"); ?> " class="backable_link da-button gray">Summary</a>
echo $comment_array['id']; ?> " ><?php echo AT_print($comment_array['comment'], 'photo_albums.comment'); ?> </span> </div> <?php } else { ?> <div> <a href="profile.php?id=<?php echo $comment_array['member_id']; ?> "><strong><?php echo AT_print(get_display_name($comment_array['member_id']), 'members.full_name'); ?> </a></strong> <?php echo htmlentities_utf8($comment_array['comment'], true); ?> </div> <?php } ?> <div class="comment_actions"> <!-- TODO: if author, add in-line "edit" --> <?php echo AT_date(_AT('forum_date_format'), $comment_array['created_date'], AT_DATE_MYSQL_DATETIME); ?> <?php
function print_search_pages($result) { global $count; foreach ($result as $items) { uasort($result, 'score_cmp'); echo '<h5>' . $count . '. '; if (isset($items['forum_title'])) { //Forum if ($_SESSION['course_id'] != $items['course_id']) { echo '<a href="bounce.php?course=' . $items['course_id'] . SEP . 'p=' . urlencode('forum/view.php?fid=' . $items['forum_id'] . SEP . 'pid=' . $items['post_id'] . SEP . 'words=' . $_GET['words']) . '">' . $items['forum_title'] . ' - ' . $items['subject'] . '</a> '; } else { echo '<a href="' . url_rewrite('mods/_standard/forums/forum/view.php?fid=' . $items['forum_id'] . SEP . 'pid=' . $items['post_id'] . SEP . 'words=' . $_GET['words']) . '">' . $items['forum_title'] . ' - ' . $items['subject'] . '</a> '; } echo '</h5>' . "\n"; echo '<p><small>' . $items['body']; } else { //Content if ($_SESSION['course_id'] != $items['course_id']) { echo '<a href="bounce.php?course=' . $items['course_id'] . SEP . 'p=' . urlencode('content.php?cid=' . $items['content_id'] . SEP . 'words=' . $_GET['words']) . '">' . $items['title'] . '</a> '; } else { echo '<a href="' . url_rewrite('content.php?cid=' . $items['content_id'] . SEP . 'words=' . $_GET['words']) . '">' . $items['title'] . '</a> '; } echo '</h5>' . "\n"; echo '<p><small>' . $items['text']; } echo '<br /><small class="search-info">[<strong>' . _AT('keywords') . ':</strong> '; if (isset($items['keywords'])) { echo $items['keywords']; } else { echo '<strong>' . _AT('none') . '</strong>'; } echo '. <strong>' . _AT('author') . ':</strong> '; if (isset($items['member_id'])) { echo AT_print(get_display_name($items['member_id']), 'members.login'); } else { echo '<strong>' . _AT('none') . '</strong>'; } echo '. <strong>' . _AT('updated') . ':</strong> '; echo AT_date(_AT('inbox_date_format'), isset($items['last_modified']) && $items['last_modified'] != '' ? $items['last_modified'] : $items['last_comment'], AT_DATE_MYSQL_DATETIME); echo ']</small>'; echo '</small></p>' . "\n"; $count++; } }
} // Initialize all applicable tests array and all enrolled students array $all_tests = array(); $all_students = array(); // generate test array $sql = "(SELECT g.gradebook_test_id, g.id, g.type, t.title" . " FROM " . TABLE_PREFIX . "gradebook_tests g, " . TABLE_PREFIX . "tests t" . " WHERE g.type='ATutor Test'" . " AND g.id = t.test_id" . " AND t.course_id=" . $_SESSION["course_id"] . " ORDER BY title)" . " UNION (SELECT g.gradebook_test_id, g.id, g.type, a.title" . " FROM " . TABLE_PREFIX . "gradebook_tests g, " . TABLE_PREFIX . "assignments a" . " WHERE g.type='ATutor Assignment'" . " AND g.id = a.assignment_id" . " AND a.course_id=" . $_SESSION["course_id"] . " ORDER BY title)" . " UNION (SELECT gradebook_test_id, id, type, title" . " FROM " . TABLE_PREFIX . "gradebook_tests" . " WHERE course_id=" . $_SESSION["course_id"] . " ORDER BY title)"; $result = mysql_query($sql, $db) or die(mysql_error()); while ($row = mysql_fetch_assoc($result)) { $no_error = true; if ($row["type"] == "ATutor Test") { $studs_take_num = get_studs_take_more_than_once($_SESSION["course_id"], $row["id"]); foreach ($studs_take_num as $member_id => $num) { if ($no_error) { $no_error = false; } $error_msg .= get_display_name($member_id) . ": " . $num . " times<br>"; } if (!$no_error) { $f = array('ADD_TEST_INTO_GRADEBOOK', $row['title'], $error_msg); $msg->addFeedback($f); } } if ($no_error) { array_push($all_tests, $row); } } // generate students array $sql_students = "SELECT m.first_name, m.last_name, e.member_id FROM " . TABLE_PREFIX . "members m, " . TABLE_PREFIX . "course_enrollment e WHERE m.member_id = e.member_id AND e.course_id=" . $_SESSION["course_id"] . " AND e.approved='y' AND e.role!='Instructor'"; if ($order_col == "name") { $sql_students .= " ORDER BY m.first_name " . $order . ",m.last_name " . $order; }
} global $db; global $_base_path; global $savant; //Number of posts to display $post_limit = 5; ob_start(); // global $_course_id is set when a guest accessing a public course. // This is to solve the issue that the google indexing fails as the session vars are lost. global $_course_id; if (isset($_SESSION['course_id'])) { $_course_id = $_SESSION['course_id']; } $forum_list = get_group_concat('forums_courses', 'forum_id', "course_id={$_course_id}"); if ($forum_list != 0) { $sql = "SELECT subject, post_id, forum_id, member_id FROM " . TABLE_PREFIX . "forums_threads WHERE parent_id=0 AND forum_id IN ({$forum_list}) ORDER BY last_comment DESC LIMIT {$post_limit}"; $result = mysql_query($sql, $db); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { echo '° <a href="' . $_base_path . url_rewrite('forum/view.php?fid=' . $row['forum_id'] . htmlentities(SEP) . 'pid=' . $row['post_id']) . '" title="' . $row['subject'] . ': ' . htmlspecialchars(get_display_name($row['member_id'])) . '">' . AT_print(validate_length($row['subject'], 20, VALIDATE_LENGTH_FOR_DISPLAY), 'forums_threads.subject') . '</a><br />'; } } else { echo '<strong>' . _AT('none_found') . '</strong>'; } } else { echo '<strong>' . _AT('none_found') . '</strong>'; } $savant->assign('dropdown_contents', ob_get_contents()); ob_end_clean(); $savant->assign('title', _AT('forum_posts')); $savant->display('include/box.tmpl.php');
public function send_mail($entity_type, $entity_id, $post_id) { // We need the automailer require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php'; //Also, we need to know what ballpark we're in $ent_param = $this->entity_switch($entity_type); // Now, what are we going to send? $fetch = !empty($ent_param[content_head]) ? $ent_param[content_head] . "," . $ent_param[content_body] : $ent_param[content_body]; $sql = "SELECT {$fetch} FROM {$ent_param['content_table']} WHERE {$ent_param['content_id']} = '{$post_id}'"; $post = queryDB($sql, array()); //Get all subscribers $sql = "SELECT t1.email, t1.member_id FROM " . TABLE_PREFIX . "members t1, {$ent_param['sub_table']} t2 WHERE t2.{$ent_param['sub_id']} = '{$entity_id}' AND t1.member_id=t2.member_id"; $rows_subscribers = queryDB($sql, array()); //get system email $sysinfo = $this->get_system_email(); //Send lots of mails foreach ($rows_subscribers as $subscriber) { $mail = new ATutorMailer(); $mail->AddAddress($subscriber['email'], get_display_name($subscriber['member_id'])); $body = $ent_param[mail_header]; $body .= "<hr />"; $body .= _AT('posted_by') . ": " . get_display_name($_SESSION['member_id']) . "<br />"; $body .= !empty($ent_param[content_head]) ? "<h2>" . $post[$ent_param[content_head]] . "</h2><br />" : ''; $body .= format_content($post[$ent_param[content_body]], $_POST['formatting'], $glossary) . "<br />"; $mail->CharSet = 'utf-8'; $mail->ContentType = 'text/html'; $mail->FromName = $sysinfo['site_name']; $mail->From = $sysinfo['contact_email']; $mail->Subject = $ent_param[mail_subject]; $mail->Body = $body; if (!$mail->Send()) { $msg->addError('SENDING_ERROR'); } unset($mail); } }
</thead> <tbody class="NormalType"> <?php if (!empty($class_info['classDetails'])) { $attendees++; ?> <?php foreach ($class_info['classDetails'] as $i => $classDetail) { ?> <tr class="dataTableHead"> <td><?php echo $i + 1; ?> </td> <td><?php echo get_display_name($classDetail->name, $classDetail->alias); ?> </td> <td><input type="checkbox" name="present[<?php echo $class_id; ?> ][<?php echo $classDetail->id; ?> ]" class="present" id="present_<?php echo $classDetail->id; ?> " <?php if (isset($class_info['child_attendance'][$classDetail->id]) and $class_info['child_attendance'][$classDetail->id]->present == "1") { echo 'checked="checked"'; }
echo '</div>'; } exit; } //safe guard if (isset($_GET['id'])) { $id = intval($_GET['id']); if ($id > 0) { addFriendRequest($id); $msg->addFeedback('REQUEST_FRIEND_ADDED'); $sql_notify = "SELECT first_name, last_name, email FROM %smembers WHERE member_id=%d"; $row_notify = queryDB($sql_notify, array(TABLE_PREFIX, $id), TRUE); if ($row_notify['email'] != '') { require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php'; $body = _AT('notification_new_contact', get_display_name($_SESSION['member_id']), $_base_href . AT_SOCIAL_BASENAME . 'index.php'); $sender = get_display_name($_SESSION['member_id']); $mail = new ATutorMailer(); $mail->AddAddress($row_notify['email'], $sender); $mail->FromName = $_config['site_name']; $mail->From = $_config['contact_email']; $mail->Subject = _AT('contact_request'); $mail->Body = $body; if (!$mail->Send()) { $msg->addError('SENDING_ERROR'); } unset($mail); } header('Location: ' . url_rewrite(AT_SOCIAL_BASENAME . 'connections.php', AT_PRETTY_URL_IS_HEADER)); exit; } }
function print_entry($row) { global $page, $system_courses, $forum_info; static $counter; $counter++; ?> <script type="text/javascript"> /* // script to control popin reply/edit boxs, disabled for now due to ID conflicts jQuery(document).ready( function () { $("a#reply-<?php echo $row['post_id']; ?> ").click(function() { $("div#reply-<?php echo $row['post_id']; ?> ").toggle('slow'); return false; }); $("a#reply-<?php echo $row['post_id']; ?> ").keypress(function(e) { var code = e.keyCode || e.which; if(code == 13 || code == 32) { $("div#reply-<?php echo $row['post_id']; ?> ").toggle('slow'); $("div#reply-<?php echo $row['post_id']; ?> #subject" ).focus(); return false; } }); $("a#edit-<?php echo $row['post_id']; ?> ").click(function() { $("div#edit-<?php echo $row['post_id']; ?> ").toggle('slow'); return false; }); $("a#edit-<?php echo $row['post_id']; ?> ").keypress(function(e) { var code = e.keyCode || e.which; if(code == 13 || code == 32) { $("div#edit-<?php echo $row['post_id']; ?> ").toggle('slow'); $("div#edit-<?php echo $row['post_id']; ?> #subject" ).focus(); return false; } }); }); */ </script> <?php $reply_link = '<a href="#" id="reply-' . $row['post_id'] . '">'; $reply_link = '<a href="mods/_standard/forums/forum/view.php?fid=' . $row['forum_id'] . SEP . 'pid='; if ($row['parent_id'] == 0) { $reply_link .= $row['post_id']; } else { $reply_link .= $row['parent_id']; } //$reply_link .= SEP.'reply='.$row['post_id'].SEP.'page='.$page.'#post" >'; $reply_link .= '#post" onClick="javascript:document.getElementById(\'subject\').value = \'Re: ' . $row['subject'] . '\'; " >'; $reply_link .= '<img src="images/forum/forum_reply.png" alt="' . _AT('reply') . '" title="' . _AT('reply') . '"/></a>'; ?> <li class="<?php if ($counter % 2) { echo 'odd'; } else { echo 'even'; } ?> "> <a name="<?php echo $row['post_id']; ?> "></a> <div class="forum-post-author"> <a href="profile.php?id=<?php echo $row['member_id']; ?> " class="title"><?php echo htmlspecialchars(get_display_name($row['member_id'])); ?> </a><br /> <?php print_profile_img($row['member_id']); ?> </div> <div class="forum-post-content"> <h3><?php echo AT_print($row['subject'], 'forums_threads.subject'); ?> </h3> <div> <div class="forum-post-ctrl"> <?php if (authenticate(AT_PRIV_FORUMS, AT_PRIV_RETURN)) { ?> <?php echo $reply_link; ?> <a href="mods/_standard/forums/edit_post.php?fid=<?php echo $row['forum_id'] . SEP . 'pid=' . $row['post_id']; ?> "><img src="images/forum/forum_edit.png" alt="<?php echo _AT('edit'); ?> " title="<?php echo _AT('edit'); ?> "/></a> <a href="mods/_standard/forums/forum/delete_thread.php?fid=<?php echo $row['forum_id'] . SEP . 'pid=' . $row['post_id'] . SEP . 'ppid=' . $row['parent_id'] . SEP; ?> nest=1"><img src="images/forum/forum_delete.png" alt="<?php echo _AT('delete'); ?> " title="<?php echo _AT('delete'); ?> "/></a> <!-- <?php echo $reply_link; ?> <a href="#" id="edit-<?php echo $row['post_id']; ?> "><img src="images/forum/forum_edit.png" alt="<?php echo _AT('edit'); ?> " title="<?php echo _AT('edit'); ?> "/></a> <a href="mods/_standard/forums/forum/delete_thread.php?fid=<?php echo $row['forum_id'] . SEP . 'pid=' . $row['post_id'] . SEP . 'ppid=' . $row['parent_id'] . SEP; ?> nest=1"><img src="images/forum/forum_delete.png" alt="<?php echo _AT('delete'); ?> " title="<?php echo _AT('delete'); ?> "/></a> --> <?php } elseif ($row['member_id'] == $_SESSION['member_id'] && $row['udate'] + $forum_info['mins_to_edit'] * 60 > time()) { ?> <?php echo $reply_link; ?> <a href="mods/_standard/forums/edit_post.php?fid=<?php echo $row['forum_id'] . SEP . 'pid=' . $row['post_id']; ?> "><img src="images/forum/forum_edit.png" alt="<?php echo _AT('edit'); ?> " title="<?php echo _AT('edit'); ?> "></a> <span>(<?php echo _AT('edit_for_minutes', round(($row['udate'] + $forum_info['mins_to_edit'] * 60 - time()) / 60)); ?> )</span> <!-- <?php echo $reply_link; ?> <a href="#" id="edit-<?php echo $row['post_id']; ?> "><img src="images/forum/forum_edit.png" alt="<?php echo _AT('edit'); ?> " title="<?php echo _AT('edit'); ?> "></a> <span>(<?php echo _AT('edit_for_minutes', round(($row['udate'] + $forum_info['mins_to_edit'] * 60 - time()) / 60)); ?> )</span> --> <?php } elseif ($_SESSION['valid_user'] == true) { ?> <?php echo $reply_link; ?> <?php } ?> </div> <p class="date"> <?php echo AT_date(_AT('forum_date_format'), $row['date'], AT_DATE_MYSQL_DATETIME); ?> </p> </div> <div class="body"> <p><?php echo apply_customized_format(AT_print($row['body'], 'forums_threads.body')); ?> </p> </div> </div> <?php // popin edit/reply forms / disabled until ID conflict issue can be resolved //echo '<div class="forum_reply" id="reply-'.$row['post_id'].'">'; //require(AT_INCLUDE_PATH.'../mods/_standard/forums/html/new_thread.inc.php'); //echo '</div>'; //echo '<div class="forum_edit" id="edit-'.$row['post_id'].'">'; //require(AT_INCLUDE_PATH.'../mods/_standard/forums/edit_post.php'); //echo '</div>'; ?> </li> <?php }
function add_user_online() { if (!isset($_SESSION['member_id']) || !($_SESSION['member_id'] > 0)) { return; } global $addslashes; $expiry = time() + 900; // 15min $sql = "REPLACE INTO %susers_online VALUES (%d, %d, '%s', %d)"; $user_name = get_display_name($_SESSION['member_id']); $result = queryDB($sql, array(TABLE_PREFIX, $_SESSION['member_id'], $_SESSION['course_id'], $user_name, $expiry)); /* garbage collect and optimize the table every so often */ mt_srand((double) microtime() * 1000000); $rand = mt_rand(1, 20); if ($rand == 1) { $sql = 'DELETE FROM %susers_online WHERE expiry<' . time(); $result = queryDB($sql, array(TABLE_PREFIX)); } }
$file = fs_get_file_path($id); if (file_exists($file . $id)) { @unlink($file . $id); } $back_id = FALSE; foreach ($path as $file) { if ($file['file_id'] != $id) { $back_id = $file['file_id']; break; } } $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); if ($back_id) { header('Location: ' . url_rewrite('mods/_standard/file_storage/revisions.php' . $owner_arg_prefix . 'id=' . $back_id, AT_PRETTY_URL_IS_HEADER)); } else { header('Location: ' . url_rewrite('mods/_standard/file_storage/index.php' . $owner_arg_prefix, AT_PRETTY_URL_IS_HEADER)); } exit; } } require AT_INCLUDE_PATH . 'header.inc.php'; $sql = "SELECT file_id, file_name, owner_type, owner_id, date, member_id FROM " . TABLE_PREFIX . "files WHERE file_id={$id} AND owner_type={$owner_type} AND owner_id={$owner_id}"; $result = mysql_query($sql, $db); if (!($row = mysql_fetch_assoc($result))) { $msg->printErrors('FILE_NOT_EXIST'); } else { $hidden_vars = array('id' => $id, 'ot' => $owner_type, 'oid' => $owner_id); $msg->addConfirm(array('FILE_DELETE', '<li>' . $row['date'] . ' - ' . $row['file_name'] . ' - ' . get_display_name($row['member_id']) . '</li>'), $hidden_vars); $msg->printConfirm(); } require AT_INCLUDE_PATH . 'footer.inc.php';
global $contentManager; ?> <form name="form" action="<?php echo $_SERVER['PHP_SELF']; ?> " method="get"> <div class="input-form"> <div class="row"> <label for="id"><?php echo _AT('select_member'); ?> </label><br /> <select name="id" id="id"> <?php foreach ($this->rows_members as $row) { $sender = get_display_name($row['member_id']); echo '<option value="' . $row['member_id'] . '"'; if ($row['member_id'] == $_GET['id']) { echo ' selected="selected"'; } echo '>' . $sender . '</option>'; } ?> </select> </div> <div class="row buttons"> <input type="submit" name="submit" value="<?php echo _AT('view'); ?> " />
?> title="<?php echo _AT('delete') . ': ' . AT_print($row['subject'], 'messages.subject'); ?> " onmouseup="this.checked=!this.checked" /></td> <td valign="middle"> <?php if ($row['new'] == 1) { echo _AT('new'); } else { if ($row['replied'] == 1) { echo _AT('replied'); } } echo '</td>'; $name = get_display_name($row['from_member_id']); echo '<td align="left" valign="middle">'; if ($_GET['view'] != $row['message_id']) { echo $name; } else { echo '<strong>' . $name . '</strong>'; } echo '</td>'; echo '<td><label for="m' . $row['message_id'] . '">'; if ($_GET['view'] != $row['message_id']) { echo '<a href="' . $_SERVER['PHP_SELF'] . '?view=' . $row['message_id'] . '">' . AT_print($row['subject'], 'messages.subject') . '</a>'; } else { echo '<strong>' . AT_print($row['subject'], 'messages.subject') . '</strong>'; } echo '</label></td>'; echo '<td valign="middle" align="left" nowrap="nowrap">';
<a href="" class="pref_wiz_launcher"><img alt="<?php echo _AT('preferences') . ' - ' . _AT('new_window'); ?> " title="<?php echo _AT('preferences') . ' - ' . _AT('new_window'); ?> " src="<?php echo $this->img; ?> wand.png" class="img1616" style="margin-bottom:-.5em;"/></a> | <?php } ?> <strong><?php echo get_display_name($_SESSION['member_id']); ?> </strong> | <a href="<?php echo $this->base_path; ?> logout.php"><?php echo _AT('logout'); ?> </a> <?php } else { ?> <a href="<?php echo $this->base_path; ?>
<?php if (!admin_authenticate(AT_ADMIN_PRIV_ADMIN, AT_PRIV_RETURN) && $last_path_part != 'preferences.php') {?> <a class="pref_wiz_launcher"><img border="0" alt="<?php echo _AT('preferences').' - '._AT('new_window'); ?>" src="<?php echo $this->base_href; ?>images/wand.png" /></a> | <?php } ?> <strong><?php echo get_display_name($_SESSION['member_id']); ?></strong> | <?php if ($_SESSION['course_id'] > -1): ?> <?php if (get_num_new_messages()): ?> <strong><a href="<?php echo $this->base_path; ?>inbox/index.php"><?php echo _AT('inbox'); ?> - <?php echo get_num_new_messages(); ?></a></strong> | <?php else: ?> <a href="<?php echo $this->base_path; ?>inbox/index.php"><?php echo _AT('inbox'); ?></a> | <?php endif; ?> <?php endif; ?> <a href="<?php echo $this->base_path; ?>search.php"><?php echo _AT('search'); ?></a> | <a href="<?php echo $this->base_path; ?>help/index.php"><?php echo _AT('help'); ?></a> | <a href="<?php echo $this->base_path; ?>logout.php"><?php echo _AT('logout'); ?></a> <?php elseif ($_SESSION['course_id'] == -1): ?> <img src="<?php echo $this->img;?>user-star.gif" style="vertical-align: middle;" class="img-size-star" alt="" /><strong><?php echo get_display_name($_SESSION['member_id']); ?></strong> | <a href="<?php echo $this->base_path; ?>search.php"><?php echo _AT('search'); ?></a> | <a href="<?php echo $this->base_path; ?>help/index.php"><?php echo _AT('help'); ?></a> | <a href="<?php echo $this->base_path; ?>logout.php"><?php echo _AT('logout'); ?></a> <?php else: ?> <a href="<?php echo $this->base_path; ?>browse.php"><?php echo _AT('browse_courses'); ?></a> | <a href="<?php echo $this->base_path; ?>login.php?course=<?php echo $_SESSION['course_id']; ?>"><?php echo _AT('login'); ?></a> | <a href="<?php echo $this->base_path; ?>search.php"><?php echo _AT('search'); ?></a> | <a href="<?php echo $this->base_path; ?>help/index.php"><?php echo _AT('help'); ?></a> <?php endif; ?> </div> <div style="float: right;"> <?php if (isset($_SESSION['member_id']) && $_SESSION['member_id']): ?> <!-- start the jump menu --> <?php if (empty($_GET)): ?>