コード例 #1
0
ファイル: Job.class.php プロジェクト: jorge683/job_board
 /**
  * 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();
     }
 }
コード例 #2
0
ファイル: module_cron.php プロジェクト: genaromendezl/ATutor
function calendar_cron()
{
    require 'includes/classes/events.class.php';
    require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php';
    //Iterate through each member's preference
    $sql = "SELECT * FROM %scalendar_notification WHERE 1=1";
    $rows_notify = queryDB($sql, array(TABLE_PREFIX));
    $event_obj = new Events();
    foreach ($rows_notify as $row) {
        //Send email only when preference is 1
        if ($row['status'] == 1) {
            $all_events = array();
            $mail = new ATutorMailer();
            //Get personal events
            $personal_events = $event_obj->get_personal_events($row['memberid']);
            foreach ($personal_events as $event) {
                $all_events[] = $event;
            }
            //Get course events
            $sql_q = "SELECT course_id FROM %scourse_enrollment WHERE member_id = %d";
            $rows_enrolled = queryDB($sql_q, array(TABLE_PREFIX, TABLE_PREFIX));
            foreach ($rows_enrolled as $row_q) {
                $course_events = $event_obj->get_atutor_events($row['memberid'], $row_q['course_id']);
                foreach ($course_events as $event) {
                    $all_events[] = $event;
                }
            }
            //Iterate through each event and keep only those events which will start tomorrow
            $email_msg = _AT('calendar_noti_mail_1') . "\n";
            $index = 1;
            foreach ($all_events as $id => $event) {
                if (strtotime(substr($event['start'], 0, 10)) == strtotime('tomorrow')) {
                    $email_msg .= _AT('calendar_noti_mail_2') . " #" . $index . " \n";
                    $email_msg .= _AT('calendar_noti_mail_3') . ": " . substr($event['start'], 0, 10) . " \n";
                    $email_msg .= _AT('calendar_noti_mail_4') . ": " . substr($event['end'], 0, 10) . " \n";
                    $email_msg .= _AT('calendar_noti_mail_5') . ": " . $event['title'] . " \n\n";
                    $index++;
                }
            }
            //Send email using ATutor mailer
            $mail->From = $_config['contact_email'];
            $mail->FromName = $_config['site_name'];
            $mail->AddAddress($_config['contact_email']);
            $mail->Subject = $stripslashes(_AT('calendar_noti_title'));
            $mail->Body = $email_msg;
            $sql_email = "SELECT email FROM %smembers WHERE member_id = %d";
            $row_email = queryDB($sql_email, array(TABLE_PREFIX, $row['memberid']), TRUE);
            $mail->AddBCC($row_email['email']);
            $mail->Send();
            unset($mail);
            //For testing
            // echo "<br/>".$email_msg."<br/>".$row_email['mail'];
        }
    }
}
コード例 #3
0
ファイル: connections.php プロジェクト: genaromendezl/ATutor
    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;
    }
}
//handle search friends request
if ($rand_key != '' && isset($_POST['search_friends_' . $rand_key]) || isset($_GET['search_friends'])) {
コード例 #4
0
ファイル: admin_deny.php プロジェクト: genaromendezl/ATutor
    $row_member = queryDB($sql, array(TABLE_PREFIX, $_POST['id']), TRUE);
    if (count($row_member) > 0) {
        $to_email = $row_member['email'];
        $message = _AT('instructor_request_deny', AT_BASE_HREF) . " \n";
        if ($_POST['msg_option'] == $other_option) {
            $message .= addslashes($_POST['other_msg']);
        } else {
            if ($_POST['msg_option']) {
                $message .= "\n" . $msg_options[$_POST['msg_option']];
            }
        }
        if ($to_email != '') {
            require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php';
            $mail = new ATutorMailer();
            $mail->From = $_config['contact_email'];
            $mail->AddAddress($to_email);
            $mail->Subject = _AT('instructor_request');
            $mail->Body = $message;
            if (!$mail->Send()) {
                //echo 'There was an error sending the message';
                $msg->printErrors('SENDING_ERROR');
                exit;
            }
            unset($mail);
        }
    }
    $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
    Header('Location: index.php');
    exit;
} else {
    if ($_POST['cancel']) {
コード例 #5
0
ファイル: new_thread.php プロジェクト: zort77/ATutor
     $rows_email = queryDB($sql, array(TABLE_PREFIX, $subscriber_list));
     foreach ($rows_email as $row) {
         $subscriber_email_list[] = array('email' => $row['email'], 'full_name' => $row['first_name'] . ' ' . $row['second_name'] . ' ' . $row['last_name'], 'member_id' => $row['member_id']);
     }
 }
 $sql = "UPDATE %sforums_threads SET num_comments=num_comments+1, last_comment='%s', date=date WHERE post_id=%d";
 $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);
コード例 #6
0
    if ($missing_fields) {
        $missing_fields = implode(', ', $missing_fields);
        $msg->addError(array('EMPTY_FIELDS', $missing_fields));
    }
    if (!$msg->containsErrors()) {
        require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php';
        if (empty($_POST['from_email'])) {
            $_POST['from_email'] = $instructor_email;
        }
        if (empty($_POST['from'])) {
            $_POST['from'] = '';
        }
        $mail = new ATutorMailer();
        $mail->From = $_POST['from_email'];
        $mail->FromName = $_POST['from'];
        $mail->AddAddress($instructor_email, $instructor_name);
        $mail->Subject = stripslashes($addslashes($_POST['subject']));
        $mail->Body = stripslashes($addslashes($_POST['body']));
        if (!$mail->Send()) {
            $msg->addError('SENDING_ERROR');
            header('Location: ' . $to);
            exit;
        }
        unset($mail);
        $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
        header('Location: ' . $to);
        exit;
    }
}
require AT_INCLUDE_PATH . 'header.inc.php';
$savant->display('contact_instructor.tmpl.php');
コード例 #7
0
         } 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');
         }
         header('Location: ../../../../users/index.php');
         exit;
     }
 }
コード例 #8
0
     $sql = "UPDATE " . TABLE_PREFIX . "members SET password='******', last_login=last_login, creation_date=creation_date WHERE member_id=" . intval($_REQUEST['id']);
     $result = mysql_query($sql, $db);
     //reset login attempts
     if ($result) {
         $sql = "SELECT login FROM " . TABLE_PREFIX . "members WHERE member_id=" . intval($_REQUEST['id']);
         $result = mysql_query($sql, $db);
         $row = mysql_fetch_array($result);
         $sql = "DELETE FROM " . TABLE_PREFIX . "member_login_attempt WHERE login='******'login']}'";
         mysql_query($sql, $db);
     }
     //send confirmation email
     require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php';
     $tmp_message = _AT(array('password_change_confirm', $_config['site_name'], $_base_href)) . "\n\n";
     $mail = new ATutorMailer();
     $mail->From = $_config['contact_email'];
     $mail->AddAddress($email);
     $mail->Subject = $_config['site_name'] . ': ' . _AT('password_forgot');
     $mail->Body = $tmp_message;
     if (!$mail->Send()) {
         $msg->printErrors('SENDING_ERROR');
         exit;
     }
     $msg->addFeedback('PASSWORD_CHANGED');
     unset($mail);
     header('Location:index.php');
 } else {
     $savant->assign('id', $_REQUEST['id']);
     $savant->assign('g', $_REQUEST['g']);
     $savant->assign('h', $_REQUEST['h']);
     $savant->display('password_change.tmpl.php');
 }
コード例 #9
0
ファイル: confirm.php プロジェクト: vicentborja/ATutor
            $_POST['email'] = $addslashes($_POST['email']);
            $sql = "SELECT member_id, email, creation_date, status FROM " . TABLE_PREFIX . "members WHERE email='{$_POST['email']}'";
            $result = mysql_query($sql, $db);
            if ($row = mysql_fetch_assoc($result)) {
                if ($row['status'] == AT_STATUS_UNCONFIRMED) {
                    $code = substr(md5($row['email'] . $row['creation_date'] . $row['member_id']), 0, 10);
                    if ($_POST["en_id"] != "") {
                        $confirmation_link = $_base_href . 'confirm.php?id=' . $row['member_id'] . SEP . 'm=' . $code . '&en_id=' . $_POST["en_id"];
                    } else {
                        $confirmation_link = $_base_href . 'confirm.php?id=' . $row['member_id'] . SEP . 'm=' . $code;
                    }
                    /* send the email confirmation message: */
                    require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php';
                    $mail = new ATutorMailer();
                    $mail->From = $_config['contact_email'];
                    $mail->AddAddress($row['email']);
                    $mail->Subject = SITE_NAME . ': ' . _AT('email_confirmation_subject');
                    $mail->Body = _AT('email_confirmation_message', $_base_href, $confirmation_link) . "\n\n";
                    $mail->Send();
                    $msg->addFeedback('CONFIRMATION_SENT');
                } else {
                    $msg->addFeedback('ACCOUNT_CONFIRMED');
                }
                header('Location: ' . $_base_href . 'login.php');
                exit;
            } else {
                $msg->addError('EMAIL_NOT_FOUND');
            }
        }
    }
}
コード例 #10
0
ファイル: enroll.inc.php プロジェクト: genaromendezl/ATutor
function add_users($user_list, $enroll, $course)
{
    global $db;
    global $msg;
    global $_config;
    global $addslashes;
    require_once AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php';
    if (defined('AT_EMAIL_CONFIRMATION') && AT_EMAIL_CONFIRMATION) {
        $status = AT_STATUS_UNCONFIRMED;
    } else {
        $status = AT_STATUS_STUDENT;
    }
    foreach ($user_list as $student) {
        if (!$student['remove']) {
            $student['uname'] = $addslashes($student['uname']);
            $student['email'] = $addslashes($student['email']);
            $student['fname'] = $addslashes($student['fname']);
            $student['lname'] = $addslashes($student['lname']);
            if (!$student['exists']) {
                $sql = "INSERT INTO %smembers \n\t\t\t\t              (login,\n\t\t\t\t               password,\n\t\t\t\t               email,\n\t\t\t\t               first_name,\n\t\t\t\t               last_name,\n\t\t\t\t               gender,\n\t\t\t\t               status,\n\t\t\t\t               preferences,\n\t\t\t\t               creation_date,\n\t\t\t\t               language,\n\t\t\t\t               inbox_notify,\n\t\t\t\t               private_email)\n\t\t\t\t              VALUES \n\t\t\t\t              ('{$student['uname']}',\n\t\t\t\t               '" . sha1($student[uname]) . "',\n\t\t\t\t               '{$student['email']}',\n\t\t\t\t               '{$student['fname']}',\n\t\t\t\t               '{$student['lname']}',\n\t\t\t\t               'n', \n\t\t\t\t               {$status}, \n\t\t\t\t               '{$_config['pref_defaults']}', \n\t\t\t\t               NOW(),\n\t\t\t\t               '{$_config['default_language']}', \n\t\t\t\t               {$_config['pref_inbox_notify']}, \n\t\t\t\t               1)";
                $result = queryDB($sql, array(TABLE_PREFIX));
                if ($result == 1) {
                    $m_id = at_insert_id();
                    $student['exists'] = _AT('import_err_email_exists');
                    $role = "Student";
                    $sql = "INSERT INTO %scourse_enrollment (member_id, course_id, approved, last_cid, role) VALUES (%d, %d, '%s', 0, '%s')";
                    $result = queryDB($sql, array(TABLE_PREFIX, $m_id, $course, $enroll, $role));
                    if ($result > 0) {
                        $enrolled_list .= '<li>' . $student['uname'] . '</li>';
                        if (defined('AT_EMAIL_CONFIRMATION') && AT_EMAIL_CONFIRMATION) {
                            $sql = "SELECT email, creation_date FROM %smembers WHERE member_id=%d";
                            $row = queryDB($sql, array(TABLE_PREFIX, $m_id), TRUE);
                            $code = substr(md5($row['email'] . $row['creation_date'] . $m_id), 0, 10);
                            // send email here.
                            $confirmation_link = AT_BASE_HREF . 'confirm.php?id=' . $m_id . SEP . 'm=' . $code;
                            $subject = $_config['site_name'] . ': ' . _AT('email_confirmation_subject');
                            $body = _AT(array('new_account_enroll_confirm', $_SESSION['course_title'], $confirmation_link)) . "\n\n";
                        } else {
                            $subject = $_config['site_name'] . ': ' . _AT('account_information');
                            $body = _AT(array('new_account_enroll', AT_BASE_HREF, $_SESSION['course_title'])) . "\n\n";
                        }
                        //$body .= SITE_NAME.': '._AT('account_information')."\n";
                        $body .= _AT('web_site') . ' : ' . AT_BASE_HREF . "\n";
                        $body .= _AT('login_name') . ' : ' . $student['uname'] . "\n";
                        $body .= _AT('password') . ' : ' . $student['uname'] . "\n";
                        $mail = new ATutorMailer();
                        $mail->From = $_config['contact_email'];
                        $mail->AddAddress($student['email']);
                        $mail->Subject = $subject;
                        $mail->Body = $body;
                        $mail->Send();
                        unset($mail);
                    } else {
                        $already_enrolled .= '<li>' . $student['uname'] . '</li>';
                    }
                } else {
                    //$msg->addError('LIST_IMPORT_FAILED');
                }
            } else {
                if (!$student['err_disabled']) {
                    $sql = "SELECT member_id FROM %smembers WHERE email='%s'";
                    $rows_members = queryDB($sql, array(TABLE_PREFIX, $student['email']), TRUE);
                    $role = "Student";
                    if (count($rows_members) > 0) {
                        $row = $rows_members;
                        $m_id = $row['member_id'];
                        $sql = "INSERT INTO %scourse_enrollment (member_id, course_id, approved, last_cid, role) VALUES (%d, %d, '%s', 0, '%s')";
                        $result = queryDB($sql, array(TABLE_PREFIX, $m_id, $course, $enroll, $role));
                        if ($result > 0) {
                            $enrolled_list .= '<li>' . $student['uname'] . '</li>';
                        } else {
                            $sql = "REPLACE INTO %scourse_enrollment (member_id, course_id, approved, last_cid, role) VALUES (%d, %s, '%s', 0, '%s')";
                            $result = queryDB($sql, array(TABLE_PREFIX, $m_id, $course, $enroll, $role));
                            $enrolled_list .= '<li>' . $student['uname'] . '</li>';
                        }
                        $subject = $_config['site_name'] . ': ' . _AT('email_confirmation_subject');
                        $body = _AT(array('enrol_message_approved', $_SESSION['course_title'], AT_BASE_HREF)) . "\n\n";
                        $body .= _AT('web_site') . ' : ' . AT_BASE_HREF . "\n";
                        $body .= _AT('login_name') . ' : ' . $student['uname'] . "\n";
                        $mail = new ATutorMailer();
                        $mail->From = $_config['contact_email'];
                        $mail->AddAddress($student['email']);
                        $mail->Subject = $subject;
                        $mail->Body = $body;
                        $mail->Send();
                        unset($mail);
                    }
                } else {
                    if ($student['err_disabled']) {
                        $not_enrolled_list .= '<li>' . $student['uname'] . '</li>';
                    }
                }
            }
        }
    }
    if ($already_enrolled) {
        $feedback = array('ALREADY_ENROLLED', $already_enrolled);
        $msg->addFeedback($feedback);
    }
    if ($enrolled_list) {
        $feedback = array('ENROLLED', $enrolled_list);
        $msg->addFeedback($feedback);
    }
    if ($not_enrolled_list) {
        $feedback = array('NOT_ENROLLED', $not_enrolled_list);
        $msg->addFeedback($feedback);
    }
}
コード例 #11
0
ファイル: password_user.php プロジェクト: codedust/ATutor
            $_POST['id'] = intval($_POST['id']);
            $sql = "UPDATE %smembers SET password= '******', creation_date=creation_date, last_login=last_login WHERE member_id=%d";
            $result = queryDB($sql, array(TABLE_PREFIX, $_POST['form_password_hidden'], $_POST['id']));
            $sql = "SELECT login, email FROM %smembers WHERE member_id=%d";
            $row = queryDB($sql, array(TABLE_PREFIX, $_POST['id']), TRUE);
            if (count($row) > 0) {
                $r_login = $row['login'];
                $r_email = $row['email'];
                $tmp_message = _AT('password_change_msg') . "\n\n";
                $tmp_message .= _AT('web_site') . ' : ' . AT_BASE_HREF . "\n";
                $tmp_message .= _AT('login_name') . ' : ' . $r_login . "\n";
                $tmp_message .= _AT('password') . ' : ' . $_POST['password2'] . "\n";
                require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php';
                $mail = new ATutorMailer();
                $mail->From = $_config['contact_email'];
                $mail->AddAddress($r_email);
                $mail->Subject = $_config['site_name'] . ': ' . _AT('password_changed');
                $mail->Body = $tmp_message;
                if (!$mail->Send()) {
                    $msg->printErrors('SENDING_ERROR');
                    exit;
                }
            }
            $msg->addFeedback('PROFILE_UPDATED_ADMIN');
            header('Location: ' . AT_BASE_HREF . 'mods/_core/users/users.php');
            exit;
        }
        $_GET['id'] = $_POST['id'];
    }
}
$onload = 'document.form.password.focus();';
コード例 #12
0
/**
* Enrolls students into course enrollement
* @access  private
* @param   array $list			the IDs of the members to be added
* @author  Shozub Qureshi
*/
function enroll($list)
{
    global $db, $msg, $_config, $course_id, $owner;
    require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php';
    $num_list = count($list);
    $members = '(member_id=' . $list[0] . ')';
    for ($i = 0; $i < $num_list; $i++) {
        $id = intval($list[$i]);
        $members .= ' OR (member_id=' . $id . ')';
        $sql = "INSERT INTO " . TABLE_PREFIX . "course_enrollment VALUES ({$id}, {$course_id}, 'y', 0, '', 0)";
        $result = mysql_query($sql, $db);
        if (mysql_affected_rows($db) != 1) {
            $sql = "UPDATE " . TABLE_PREFIX . "course_enrollment SET approved='y' WHERE course_id={$course_id} AND member_id={$id}";
            $result = mysql_query($sql, $db);
        }
    }
    //get First_name, Last_name of course Instructor
    $sql_from = "SELECT first_name, last_name, email FROM " . TABLE_PREFIX . "members WHERE member_id = {$owner}";
    $result_from = mysql_query($sql_from, $db);
    $row_from = mysql_fetch_assoc($result_from);
    $email_from_name = $row_from['first_name'] . ' ' . $row_from['last_name'];
    $email_from = $row_from['email'];
    //get email addresses of users:
    $sql_to = "SELECT email FROM " . TABLE_PREFIX . "members WHERE ({$members})";
    $result_to = mysql_query($sql_to, $db);
    while ($row_to = mysql_fetch_assoc($result_to)) {
        // send email here.
        $login_link = AT_BASE_HREF . 'login.php?course=' . $course_id;
        $subject = SITE_NAME . ': ' . _AT('enrol_message_subject');
        $body = SITE_NAME . ': ' . _AT('enrol_message_approved', $_SESSION['course_title'], $login_link) . "\n\n";
        $mail = new ATutorMailer();
        $mail->From = $_config['contact_email'];
        $mail->FromName = $_config['site_name'];
        $mail->AddAddress($row_to['email']);
        $mail->Subject = $subject;
        $mail->Body = $body;
        if (!$mail->Send()) {
            $msg->addError('SENDING_ERROR');
        }
        unset($mail);
    }
}
コード例 #13
0
/**
* Enrolls students into course enrollement
* @access  private
* @param   array $list			the IDs of the members to be added
* @author  Shozub Qureshi
*/
function enroll($list)
{
    global $msg, $_config, $course_id, $owner;
    require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php';
    $num_list = count($list);
    $members = '(member_id=' . $list[0] . ')';
    for ($i = 0; $i < $num_list; $i++) {
        $id = intval($list[$i]);
        $members .= ' OR (member_id=' . $id . ')';
        $sql = "REPLACE INTO %scourse_enrollment VALUES (%d, %d, 'y', 0, 'Student', 0)";
        $result_enrolled = queryDB($sql, array(TABLE_PREFIX, $id, $course_id));
        if ($result_enrolled != 1) {
            $sql = "UPDATE %scourse_enrollment SET approved='y' WHERE course_id=%d AND member_id=%d";
            $result = queryDB($sql, array(TABLE_PREFIX, $course_id, $id));
        }
    }
    //get First_name, Last_name of course Instructor
    $sql_from = "SELECT first_name, last_name, email FROM %smembers WHERE member_id = %d";
    $row_from = queryDB($sql_from, array(TABLE_PREFIX, $owner), TRUE);
    $email_from_name = $row_from['first_name'] . ' ' . $row_from['last_name'];
    $email_from = $row_from['email'];
    //get email addresses of users:
    $sql_to = "SELECT email FROM %smembers WHERE (%s)";
    $rows_to = queryDB($sql_to, array(TABLE_PREFIX, $members));
    foreach ($rows_to as $row_to) {
        // send email here.
        $login_link = AT_BASE_HREF . 'login.php?course=' . $course_id;
        $subject = SITE_NAME . ': ' . _AT('enrol_message_subject');
        $body = SITE_NAME . ': ' . _AT('enrol_message_approved', $_SESSION['course_title'], $login_link) . "\n\n";
        $mail = new ATutorMailer();
        $mail->From = $_config['contact_email'];
        $mail->FromName = $_config['site_name'];
        $mail->AddAddress($row_to['email']);
        $mail->Subject = $subject;
        $mail->Body = $body;
        if (!$mail->Send()) {
            $msg->addError('SENDING_ERROR');
        }
        unset($mail);
    }
}
コード例 #14
0
ファイル: send_mail.php プロジェクト: genaromendezl/ATutor
 if (isset($_POST['subject']) && $_POST['subject'] != '') {
     $calname = $_POST['subject'];
 } else {
     $calname = _AT('calendar_of') . " " . get_display_name($_SESSION['member_id']);
 }
 $body = get_display_name($_SESSION['member_id']) . _AT('calendar_email_part1') . '"' . $calname . '"' . _AT('calendar_email_part2');
 $sql = "SELECT * FROM %smembers WHERE member_id = %d";
 $rows_members = queryDB($sql, array(TABLE_PREFIX, $_SESSION['member_id']));
 $fromemail = $_config['contact_email'];
 foreach ($rows_members as $row) {
     $fromemail = $row['email'];
 }
 $body .= AT_BASE_HREF . "mods/_standard/calendar/index_public.php?mid=" . urlencode(base64_encode($_SESSION['member_id'])) . "&email=1&cid=" . $_SESSION['course_id'] . "&calname=" . urlencode($calname);
 $mail->From = $fromemail;
 $mail->FromName = $_config['site_name'];
 $mail->AddAddress($fromemail);
 $mail->Subject = $stripslashes(_AT('calendar_mail_title'));
 $mail->Body = $body;
 if (!$mail->Send()) {
     //echo 'There was an error sending the message';
     $msg->printErrors('SENDING_ERROR');
     exit;
 }
 /*//For testing email
   $to      = '*****@*****.**';
   $subject = $stripslashes(_AT("calendar_mail_title"));
   $message = $body;
   $headers = 'From: abc@gmail.com' . "\r\n" .
       'Reply-To: abc@gmail.com' . "\r\n" .
       'X-Mailer: PHP/' . phpversion();
   
コード例 #15
0
ファイル: course_email.php プロジェクト: genaromendezl/ATutor
            // Added by Thomas Taennier (ipool)
            foreach ($mail_list as $recip) {
                $recipient_list .= "<li>" . $recip . "</li>";
                $subject = $_POST['subject'];
                $body = $_POST['body'];
                $mail = new ATutorMailer();
                $mail->From = $row['email'];
                $mail->FromName = $row['first_name'] . ' ' . $row['last_name'];
                $subject = str_replace('{AT_FNAME}', $fname_list[$recip], $subject);
                $subject = str_replace('{AT_LNAME}', $lname_list[$recip], $subject);
                $body = str_replace('{AT_FNAME}', $fname_list[$recip], $body);
                $body = str_replace('{AT_LNAME}', $lname_list[$recip], $body);
                $body = str_replace('{AT_EMAIL}', $recip, $body);
                $body = str_replace('{AT_USER}', $login_list[$recip], $body);
                $mail->Subject = $subject;
                $mail->AddAddress($recip);
                $mail->Body = $body;
                if (!$mail->Send()) {
                    $msg->addError('SENDING_ERROR');
                    header('Location: ' . $_SERVER['PHP_SELF']);
                    exit;
                }
                unset($mail);
            }
            $list_feedback = array('COURSE_EMAIL_RECIPIENT_LIST', $recipient_list);
            $msg->addFeedback($list_feedback);
            header('Location: ' . $_base_href . 'tools/index.php');
            exit;
        }
    }
}
コード例 #16
0
 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);
     }
 }
コード例 #17
0
ファイル: create_user.php プロジェクト: codedust/ATutor
         $sql = "UPDATE %smaster_list SET member_id=%d WHERE public_field='%s'";
         $result = queryDB($sql, array(TABLE_PREFIX, $m_id, $student_id));
         if ($result > 0) {
             $sql = "REPLACE INTO %smaster_list VALUES ('%s', '%s', %d)";
             $result = queryDB($sql, array(TABLE_PREFIX, $student_id, $student_pin, $m_id));
         }
     }
 }
 if ($_POST['pref'] == 'access') {
     $_SESSION['member_id'] = $m_id;
     save_prefs();
     unset($_SESSION['member_id']);
 }
 require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php';
 $mail = new ATutorMailer();
 $mail->AddAddress($_POST['email']);
 $mail->From = $_config['contact_email'];
 if (defined('AT_EMAIL_CONFIRMATION') && AT_EMAIL_CONFIRMATION && $_POST['status'] == AT_STATUS_UNCONFIRMED) {
     $code = substr(md5($_POST['email'] . $now . $m_id), 0, 10);
     $confirmation_link = AT_BASE_HREF . 'confirm.php?id=' . $m_id . SEP . 'm=' . $code;
     /* send the email confirmation message: */
     $mail->Subject = $_config['site_name'] . ': ' . _AT('email_confirmation_subject');
     $body .= _AT('admin_new_account_confirm', $_config['site_name'], $confirmation_link) . "\n\n";
 } else {
     $mail->Subject = $_config['site_name'] . ": " . _AT('account_information');
     $body .= _AT('admin_new_account', $_config['site_name']) . "\n\n";
 }
 $body .= _AT('web_site') . ' : ' . AT_BASE_HREF . "\n";
 $body .= _AT('login_name') . ' : ' . $_POST['login'] . "\n";
 $body .= _AT('password') . ' : ' . $_POST['form_password2'] . "\n";
 $mail->Body = $body;
コード例 #18
0
ファイル: enroll.inc.php プロジェクト: radiocontrolled/ATutor
function add_users($user_list, $enroll, $course) {
	global $db;
	global $msg;
	global $_config;
	global $addslashes;

	require_once(AT_INCLUDE_PATH.'classes/phpmailer/atutormailer.class.php');

	if (defined('AT_EMAIL_CONFIRMATION') && AT_EMAIL_CONFIRMATION) {
		$status = AT_STATUS_UNCONFIRMED;
	} else {
		$status = AT_STATUS_STUDENT;
	}


	foreach ($user_list as $student) {
		if (!$student['remove'])  {
				$student['uname'] = $addslashes($student['uname']);
				$student['email'] = $addslashes($student['email']);
				$student['fname'] = $addslashes($student['fname']);
				$student['lname'] = $addslashes($student['lname']);

			if (!$student['exists']) {
				$sql = "INSERT INTO ".TABLE_PREFIX."members 
				              (login,
				               password,
				               email,
				               first_name,
				               last_name,
				               gender,
				               status,
				               preferences,
				               creation_date,
				               language,
				               inbox_notify,
				               private_email)
				              VALUES 
				              ('$student[uname]',
				               '". sha1($student[uname]). "',
				               '$student[email]',
				               '$student[fname]',
				               '$student[lname]',
				               'n', 
				               $status, 
				               '$_config[pref_defaults]', 
				               NOW(),
				               '$_config[default_language]', 
				               $_config[pref_inbox_notify], 
				               1)";

				$result = mysql_query($sql, $db);
				if (mysql_affected_rows($db) == 1) {
					$m_id = mysql_insert_id($db);

					$student['exists'] = _AT('import_err_email_exists');

					$sql = "INSERT INTO ".TABLE_PREFIX."course_enrollment (member_id, course_id, approved, last_cid) VALUES ($m_id, $course, '$enroll', 0)";

					if ($result = mysql_query($sql,$db)) {
						$enrolled_list .= '<li>' . $student['uname'] . '</li>';

						if (defined('AT_EMAIL_CONFIRMATION') && AT_EMAIL_CONFIRMATION) {

							$sql    = "SELECT email, creation_date FROM ".TABLE_PREFIX."members WHERE member_id=$m_id";
							$result = mysql_query($sql, $db);
							$row    = mysql_fetch_assoc($result);
							$code   = substr(md5($row['email'] . $row['creation_date'] . $m_id), 0, 10);

							// send email here.
							$confirmation_link = AT_BASE_HREF . 'confirm.php?id='.$m_id.SEP.'m='.$code;
			
							$subject = $_config['site_name'].': '._AT('email_confirmation_subject');
							$body = _AT(array('new_account_enroll_confirm', $_SESSION['course_title'], $confirmation_link))."\n\n";
						} else {
							$subject = $_config['site_name'].': '._AT('account_information');
							$body = _AT(array('new_account_enroll',AT_BASE_HREF, $_SESSION['course_title']))."\n\n";
						}
						
						//$body .= SITE_NAME.': '._AT('account_information')."\n";
						$body .= _AT('web_site') .' : '.AT_BASE_HREF."\n";
						$body .= _AT('login_name') .' : '.$student['uname'] . "\n";
						$body .= _AT('password') .' : '.$student['uname'] . "\n";

						$mail = new ATutorMailer;
						$mail->From     = $_config['contact_email'];
						$mail->AddAddress($student['email']);
						$mail->Subject = $subject;
						$mail->Body    = $body;
						$mail->Send();

						unset($mail);
					} else {
						$already_enrolled .= '<li>' . $student['uname'] . '</li>';
					}
				} else {
					//$msg->addError('LIST_IMPORT_FAILED');	
				}
			} else if (! $student['err_disabled']) {
				$sql = "SELECT member_id FROM ".TABLE_PREFIX."members WHERE email='$student[email]'";
				$result = mysql_query($sql, $db);
				if ($row = mysql_fetch_assoc($result)) {
				
					$m_id = $row['member_id'];

					$sql = "INSERT INTO ".TABLE_PREFIX."course_enrollment (member_id, course_id, approved, last_cid, role) VALUES ($m_id, $course, '$enroll', 0, '$role')";

					if($result = mysql_query($sql,$db)) {
						$enrolled_list .= '<li>' . $student['uname'] . '</li>';
					} else {
						$sql = "REPLACE INTO ".TABLE_PREFIX."course_enrollment (member_id, course_id, approved, last_cid, role) VALUES ($m_id, $course, '$enroll', 0, '$role')";
						$result = mysql_query($sql,$db);
						$enrolled_list .= '<li>' . $student['uname'] . '</li>';
					}
				$subject = $_config['site_name'].': '._AT('email_confirmation_subject');
				$body = _AT(array('enrol_message_approved',$_SESSION['course_title'],AT_BASE_HREF))."\n\n";
				$body .= _AT('web_site') .' : '.AT_BASE_HREF."\n";
				$body .= _AT('login_name') .' : '.$student['uname'] . "\n";
				$mail = new ATutorMailer;
				$mail->From     = $_config['contact_email'];
				$mail->AddAddress($student['email']);
				$mail->Subject = $subject;
				$mail->Body    = $body;
				$mail->Send();

				unset($mail);


				}




			} else if ($student['err_disabled']) {
				$not_enrolled_list .= '<li>' . $student['uname'] . '</li>';
			}
		}
	}
	if ($already_enrolled) {
		$feedback = array('ALREADY_ENROLLED', $already_enrolled);
		$msg->addFeedback($feedback);
	}
	if ($enrolled_list) {
		$feedback = array('ENROLLED', $enrolled_list);
		$msg->addFeedback($feedback);
	}
	if ($not_enrolled_list) {
		$feedback = array('NOT_ENROLLED', $not_enrolled_list);
		$msg->addFeedback($feedback);
	}
}