/** * Display online users. * @author Nicola Asuni * @since 2001-10-18 * @param $wherequery (string) users selection query * @param $order_field (string) order by column name * @param $orderdir (int) oreder direction * @param $firstrow (int) number of first row to display * @param $rowsperpage (int) number of rows per page * @return false in case of empty database, true otherwise */ function F_list_online_users($wherequery, $order_field, $orderdir, $firstrow, $rowsperpage) { global $l, $db; require_once '../config/tce_config.php'; require_once '../../shared/code/tce_functions_page.php'; require_once 'tce_functions_user_select.php'; //initialize variables $orderdir = intval($orderdir); $firstrow = intval($firstrow); $rowsperpage = intval($rowsperpage); // order fields for SQL query if (empty($order_field) or !in_array($order_field, array('cpsession_id', 'cpsession_data'))) { $order_field = 'cpsession_expiry'; } if ($orderdir == 0) { $nextorderdir = 1; $full_order_field = $order_field; } else { $nextorderdir = 0; $full_order_field = $order_field . ' DESC'; } if (!F_count_rows(K_TABLE_SESSIONS)) { //if the table is void (no items) display message echo '<h2>' . $l['m_databasempty'] . '</h2>'; return FALSE; } if (empty($wherequery)) { $sql = 'SELECT * FROM ' . K_TABLE_SESSIONS . ' ORDER BY ' . $full_order_field . ''; } else { $wherequery = F_escape_sql($db, $wherequery); $sql = 'SELECT * FROM ' . K_TABLE_SESSIONS . ' ' . $wherequery . ' ORDER BY ' . $full_order_field . ''; } if (K_DATABASE_TYPE == 'ORACLE') { $sql = 'SELECT * FROM (' . $sql . ') WHERE rownum BETWEEN ' . $firstrow . ' AND ' . ($firstrow + $rowsperpage) . ''; } else { $sql .= ' LIMIT ' . $rowsperpage . ' OFFSET ' . $firstrow . ''; } echo '<div class="container">' . K_NEWLINE; echo '<table class="userselect">' . K_NEWLINE; echo '<tr>' . K_NEWLINE; echo '<th>' . $l['w_user'] . '</th>' . K_NEWLINE; echo '<th>' . $l['w_level'] . '</th>' . K_NEWLINE; echo '<th>' . $l['w_ip'] . '</th>' . K_NEWLINE; echo '</tr>' . K_NEWLINE; if ($r = F_db_query($sql, $db)) { while ($m = F_db_fetch_array($r)) { $this_session = F_session_string_to_array($m['cpsession_data']); echo '<tr>'; echo '<td align="left">'; $user_str = ''; if ($this_session['session_user_lastname']) { $user_str .= urldecode($this_session['session_user_lastname']) . ', '; } if ($this_session['session_user_firstname']) { $user_str .= urldecode($this_session['session_user_firstname']) . ''; } $user_str .= ' (' . urldecode($this_session['session_user_name']) . ')'; if (F_isAuthorizedEditorForUser($this_session['session_user_id'])) { echo '<a href="tce_edit_user.php?user_id=' . $this_session['session_user_id'] . '">' . $user_str . '</a>'; } else { echo $user_str; } echo '</td>'; echo '<td>' . $this_session['session_user_level'] . '</td>'; echo '<td>' . $this_session['session_user_ip'] . '</td>'; echo '</tr>' . K_NEWLINE; } } else { F_display_db_error(); } echo '</table>' . K_NEWLINE; // --- ------------------------------------------------------ // --- page jump if ($rowsperpage > 0) { $sql = 'SELECT count(*) AS total FROM ' . K_TABLE_SESSIONS . ' ' . $wherequery . ''; if (!empty($order_field)) { $param_array = '&order_field=' . urlencode($order_field) . ''; } if (!empty($orderdir)) { $param_array .= '&orderdir=' . $orderdir . ''; } $param_array .= '&submitted=1'; F_show_page_navigator($_SERVER['SCRIPT_NAME'], $sql, $firstrow, $rowsperpage, $param_array); } echo '<div class="pagehelp">' . $l['hp_online_users'] . '</div>' . K_NEWLINE; echo '</div>' . K_NEWLINE; return TRUE; }
} elseif (isset($_POST['delgroup'])) { $menu_mode = 'delgroup'; } elseif (isset($_POST['move'])) { $menu_mode = 'move'; } if (isset($menu_mode) and !empty($menu_mode)) { $istart = 1 + $firstrow; $iend = $rowsperpage + $firstrow; for ($i = $istart; $i <= $iend; $i++) { // for each selected question $keyname = 'userid' . $i; if (isset(${$keyname})) { $user_id = intval(${$keyname}); switch ($menu_mode) { case 'delete': if ($_SESSION['session_user_level'] >= K_AUTH_DELETE_USERS and $user_id > 1 and $user_id != $_SESSION['session_user_id'] and F_isAuthorizedEditorForUser($user_id)) { $sql = 'DELETE FROM ' . K_TABLE_USERS . ' WHERE user_id=' . $user_id . ''; if (!($r = F_db_query($sql, $db))) { F_display_db_error(); } } break; case 'addgroup': if ($_SESSION['session_user_level'] >= K_AUTH_ADMIN_GROUPS and $new_group_id > 0 and F_isAuthorizedEditorForGroup($new_group_id)) { $groups = F_get_user_groups($user_id); if (!in_array($new_group_id, $groups)) { $sql = 'INSERT INTO ' . K_TABLE_USERGROUP . ' ( usrgrp_user_id, usrgrp_group_id ) VALUES (
* @param $_REQUEST['startdate'] (int) start date * @param $_REQUEST['enddate'] (int) end date * @param $_REQUEST['orderfield'] (string) ORDER BY portion of SQL selection query */ /** */ require_once '../config/tce_config.php'; require_once '../../shared/code/tce_authorization.php'; require_once '../../shared/code/tce_functions_tcecode.php'; require_once '../../shared/code/tce_functions_test.php'; require_once '../../shared/code/tce_functions_test_stats.php'; require_once '../code/tce_functions_statistics.php'; require_once 'tce_functions_user_select.php'; if (isset($_REQUEST['user_id']) and $_REQUEST['user_id'] > 0) { $user_id = intval($_REQUEST['user_id']); if (!F_isAuthorizedEditorForUser($user_id)) { exit; } } else { exit; } if (isset($_REQUEST['startdate']) and $_REQUEST['startdate'] > 0) { $startdate = urldecode($_REQUEST['startdate']); $startdate_time = strtotime($startdate); $startdate = date(K_TIMESTAMP_FORMAT, $startdate_time); } else { $startdate = date('Y') . '-01-01 00:00:00'; } if (isset($_REQUEST['enddate']) and $_REQUEST['enddate'] > 0) { $enddate = urldecode($_REQUEST['enddate']); $enddate_time = strtotime($enddate);
file_put_contents($logfile, 'OK' . "\t" . $answerfile . "\t" . 'SUCCESSFULLY DECODED' . "\n", FILE_APPEND); } else { F_print_error('ERROR', '[OMR ANSWER SHEET ' . $answerfile . '] ' . $l['m_omr_wrong_answer_sheet']); file_put_contents($logfile, 'ERROR' . "\t" . $answerfile . "\t" . 'UNABLE TO DECODE' . "\n", FILE_APPEND); } } else { F_print_error('ERROR', '[OMR ANSWER SHEET ' . $answerfile . '] ' . $l['m_omr_wrong_answer_sheet']); file_put_contents($logfile, 'ERROR' . "\t" . $answerfile . "\t" . 'MISSING IMAGE FILE' . "\n", FILE_APPEND); } } // sort answers ksort($omr_answers); // get user ID from user registration code $user_id = F_getUIDfromRegnum($matches[1]); // import answers if ($user_id > 0 and F_isAuthorizedEditorForUser($user_id) and F_importOMRTestData($user_id, $date, $omr_testdata, $omr_answers, $overwrite)) { F_print_error('MESSAGE', '[' . $matches[1] . '] ' . $l['m_import_ok'] . ': <a href="tce_show_result_user.php?testuser_id=32&test_id=' . $omr_testdata[0] . '&user_id=' . $user_id . '" title="' . $l['t_result_user'] . '" style="text-decoration:underline;color:#0000ff;">' . $l['w_results'] . '</a>'); file_put_contents($logfile, 'OK' . "\t" . $matches[1] . "\t" . 'SUCCESSFULLY IMPORTED - UID: ' . $user_id . "\n", FILE_APPEND); } else { F_print_error('ERROR', '[' . $matches[1] . '] ' . $l['m_import_error']); file_put_contents($logfile, 'ERROR' . "\t" . $matches[1] . "\t" . 'UNABLE TO IMPORT - UID: ' . $user_id . "\n", FILE_APPEND); } } } // if QR file } } // print a link to log file F_print_error('MESSAGE', 'LOGFILE: <a href="tce_filemanager.php?d=' . urlencode(K_PATH_CACHE . 'OMR/') . '&f=' . urlencode($logfile) . '&v=1" title="' . $l['w_select'] . '">' . $logfilename . '</a>'); } }
/** * Export all user's test results to CSV. * @author Nicola Asuni * @since 2008-12-26 * @param $user_id (int) user ID * @param $startdate (string) start date in yyyy-mm-dd hh:mm:ss format * @param $enddate (string) end date in yyyy-mm-dd hh:mm:ss format * @param $order_field (string) ORDER BY portion of the SQL query * @return CSV data */ function F_csv_export_allresults_user($user_id, $startdate, $enddate, $order_field = '') { global $l, $db; require_once '../config/tce_config.php'; require_once '../../shared/code/tce_authorization.php'; require_once '../../shared/code/tce_functions_test_stats.php'; require_once 'tce_functions_user_select.php'; require_once '../code/tce_functions_statistics.php'; $user_id = intval($user_id); $startdate = F_escape_sql($startdate); $enddate = F_escape_sql($enddate); $order_field = F_escape_sql($order_field); if (!F_isAuthorizedEditorForUser($user_id)) { return ''; } // statistical data $statsdata = array(); $statsdata['score'] = array(); $statsdata['right'] = array(); $statsdata['wrong'] = array(); $statsdata['unanswered'] = array(); $statsdata['undisplayed'] = array(); $statsdata['unrated'] = array(); $csv = ''; // CSV data to be returned // general data $csv .= 'TCExam User Results' . K_NEWLINE . K_NEWLINE; $csv .= 'version' . K_TAB . K_TCEXAM_VERSION . K_NEWLINE; $csv .= 'lang' . K_TAB . K_USER_LANG . K_NEWLINE; $csv .= 'date' . K_TAB . date(K_TIMESTAMP_FORMAT) . K_NEWLINE; $csv .= 'user_id' . K_TAB . $user_id . K_NEWLINE; $sql = 'SELECT user_name, user_lastname, user_firstname FROM ' . K_TABLE_USERS . ' WHERE user_id=' . $user_id . ''; if ($r = F_db_query($sql, $db)) { if ($m = F_db_fetch_array($r)) { $csv .= $l['w_user'] . K_TAB . $m['user_name'] . K_NEWLINE; $csv .= $l['w_lastname'] . K_TAB . $m['user_lastname'] . K_NEWLINE; $csv .= $l['w_firstname'] . K_TAB . $m['user_firstname'] . K_NEWLINE; } } else { F_display_db_error(); } $csv .= $l['w_time_begin'] . K_TAB . $startdate . K_NEWLINE; $csv .= $l['w_time_end'] . K_TAB . $enddate . K_NEWLINE; $csv .= K_NEWLINE . K_NEWLINE; // separator // print column names $csv .= '#'; $csv .= K_TAB . $l['w_time_begin']; $csv .= K_TAB . $l['w_time_end']; $csv .= K_TAB . $l['w_time']; $csv .= K_TAB . $l['w_test']; $csv .= K_TAB . $l['w_passed']; $csv .= K_TAB . $l['w_score']; $csv .= K_TAB . $l['w_answers_right']; $csv .= K_TAB . $l['w_answers_wrong']; $csv .= K_TAB . $l['w_questions_unanswered']; $csv .= K_TAB . $l['w_questions_undisplayed']; $csv .= K_TAB . $l['w_questions_unrated']; $csv .= K_TAB . $l['w_status']; $csv .= K_TAB . $l['w_comment']; $passed = 0; // output users stats $sqlr = 'SELECT testuser_id, test_id, test_name, test_duration_time, testuser_creation_time, testuser_status, SUM(testlog_score) AS total_score, MAX(testlog_change_time) AS testuser_end_time FROM ' . K_TABLE_TESTS_LOGS . ', ' . K_TABLE_TEST_USER . ', ' . K_TABLE_TESTS . ' WHERE testuser_status>0 AND testuser_creation_time>=\'' . $startdate . '\' AND testuser_creation_time<=\'' . $enddate . '\' AND testuser_user_id=' . $user_id . ' AND testlog_testuser_id=testuser_id AND testuser_test_id=test_id'; if ($_SESSION['session_user_level'] < K_AUTH_ADMINISTRATOR) { $sqlr .= ' AND test_user_id IN (' . F_getAuthorizedUsers($_SESSION['session_user_id']) . ')'; } $sqlr .= ' GROUP BY testuser_id, test_id, test_name, test_duration_time, testuser_creation_time, testuser_status ORDER BY ' . $order_field . ''; if ($rr = F_db_query($sqlr, $db)) { $itemcount = 0; while ($mr = F_db_fetch_array($rr)) { $itemcount++; $usrtestdata = F_getUserTestStat($mr['test_id'], $user_id); $halfscore = $usrtestdata['max_score'] / 2; $csv .= K_NEWLINE . $itemcount; $csv .= K_TAB . $mr['testuser_creation_time']; $csv .= K_TAB . $mr['testuser_end_time']; $time_diff = strtotime($mr['testuser_end_time']) - strtotime($mr['testuser_creation_time']); //sec $time_diff = gmdate('H:i:s', $time_diff); $csv .= K_TAB . $time_diff; $csv .= K_TAB . $mr['test_name']; if ($usrtestdata['score_threshold'] > 0) { if ($usrtestdata['score'] >= $usrtestdata['score_threshold']) { $csv .= K_TAB . 'true'; $passed++; } else { $csv .= K_TAB . 'false'; } } else { $csv .= K_TAB; if ($usrtestdata['score'] > $halfscore) { $passed++; } } $csv .= K_TAB . $mr['total_score']; $csv .= K_TAB . $usrtestdata['right']; $csv .= K_TAB . $usrtestdata['wrong']; $csv .= K_TAB . $usrtestdata['unanswered']; $csv .= K_TAB . $usrtestdata['undisplayed']; $csv .= K_TAB . $usrtestdata['unrated']; if ($mr['testuser_status'] == 4) { $csv .= K_TAB . $l['w_locked']; } else { $csv .= K_TAB . $l['w_unlocked']; } $csv .= K_TAB . F_compact_string(htmlspecialchars($usrtestdata['comment'], ENT_NOQUOTES, $l['a_meta_charset'])); // collects data for descriptive statistics $statsdata['score'][] = $mr['total_score'] / $usrtestdata['max_score']; $statsdata['right'][] = $usrtestdata['right'] / $usrtestdata['all']; $statsdata['wrong'][] = $usrtestdata['wrong'] / $usrtestdata['all']; $statsdata['unanswered'][] = $usrtestdata['unanswered'] / $usrtestdata['all']; $statsdata['undisplayed'][] = $usrtestdata['undisplayed'] / $usrtestdata['all']; $statsdata['unrated'][] = $usrtestdata['unrated'] / $usrtestdata['all']; } } else { F_display_db_error(); } $csv .= K_NEWLINE; // separator // calculate statistics $stats = F_getArrayStatistics($statsdata); $excludestat = array('sum', 'variance'); $calcpercent = array('mean', 'median', 'mode', 'minimum', 'maximum', 'range', 'standard_deviation'); $csv .= K_TAB . K_TAB . K_TAB . K_TAB . 'passed_total' . K_TAB . $passed . K_NEWLINE; $csv .= K_TAB . K_TAB . K_TAB . K_TAB . 'passed_percent [%]' . K_TAB . round(100 * ($passed / $itemcount)) . K_NEWLINE; $csv .= K_NEWLINE; // separator $csv .= $l['w_statistics'] . K_NEWLINE; // separator // headers $csv .= K_TAB . K_TAB . K_TAB . K_TAB . K_TAB . K_TAB; $csv .= $l['w_score'] . K_TAB; $csv .= $l['w_answers_right_th'] . K_TAB; $csv .= $l['w_answers_wrong_th'] . K_TAB; $csv .= $l['w_questions_unanswered_th'] . K_TAB; $csv .= $l['w_questions_undisplayed_th'] . K_TAB; $csv .= $l['w_questions_unrated'] . K_NEWLINE; foreach ($stats as $row => $columns) { if (!in_array($row, $excludestat)) { $csv .= K_TAB . K_TAB . K_TAB . K_TAB . K_TAB . $l['w_' . $row] . K_TAB; $csv .= round($columns['score'], 3) . K_TAB; $csv .= round($columns['right'], 3) . K_TAB; $csv .= round($columns['wrong'], 3) . K_TAB; $csv .= round($columns['unanswered'], 3) . K_TAB; $csv .= round($columns['undisplayed'], 3) . K_TAB; $csv .= round($columns['unrated'], 3) . K_NEWLINE; if (in_array($row, $calcpercent)) { $csv .= K_TAB . K_TAB . K_TAB . K_TAB . K_TAB . $row . ' [%]' . K_TAB; $csv .= round(100 * ($columns['score'] / $usrtestdata['max_score'])) . K_TAB; $csv .= round(100 * ($columns['right'] / $usrtestdata['all'])) . K_TAB; $csv .= round(100 * ($columns['wrong'] / $usrtestdata['all'])) . K_TAB; $csv .= round(100 * ($columns['unanswered'] / $usrtestdata['all'])) . K_TAB; $csv .= round(100 * ($columns['undisplayed'] / $usrtestdata['all'])) . K_TAB; $csv .= round(100 * ($columns['unrated'] / $usrtestdata['all'])) . K_NEWLINE; } } } return $csv; }
/** * Sends email test reports to users. * @author Nicola Asuni * @since 2005-02-24 * @param $test_id (int) TEST ID * @param $user_id (int) USER ID (0 means all users) * @param $group_id (int) GROUP ID (0 means all groups) * @param $mode (int) type of report to send: 0=detailed report; 1=summary report (without questions) */ function F_send_report_emails($test_id, $user_id = 0, $group_id = 0, $mode = 0) { global $l, $db; require_once '../config/tce_config.php'; require_once '../../shared/code/tce_functions_test.php'; require_once '../../shared/code/tce_functions_test_stats.php'; require_once '../../shared/code/tce_class_mailer.php'; require_once 'tce_functions_user_select.php'; $test_id = intval($test_id); $user_id = intval($user_id); $group_id = intval($group_id); $mode = intval($mode); if (!F_isAuthorizedUser(K_TABLE_TESTS, 'test_id', $test_id, 'test_user_id')) { return; } if (!F_isAuthorizedEditorForUser($user_id)) { return; } if (!F_isAuthorizedEditorForGroup($group_id)) { return; } // Instantiate C_mailer class $mail = new C_mailer(); //Load default values $mail->language = $l; $mail->Priority = $emailcfg['Priority']; $mail->ContentType = $emailcfg['ContentType']; $mail->Encoding = $emailcfg['Encoding']; $mail->WordWrap = $emailcfg['WordWrap']; $mail->Mailer = $emailcfg['Mailer']; $mail->Sendmail = $emailcfg['Sendmail']; $mail->UseMSMailHeaders = $emailcfg['UseMSMailHeaders']; $mail->Host = $emailcfg['Host']; $mail->Port = $emailcfg['Port']; $mail->Helo = $emailcfg['Helo']; $mail->SMTPAuth = $emailcfg['SMTPAuth']; $mail->SMTPSecure = $emailcfg['SMTPSecure']; $mail->Username = $emailcfg['Username']; $mail->Password = $emailcfg['Password']; $mail->Timeout = $emailcfg['Timeout']; $mail->SMTPDebug = $emailcfg['SMTPDebug']; $mail->PluginDir = $emailcfg['PluginDir']; $mail->Sender = $emailcfg['Sender']; $mail->From = $emailcfg['From']; $mail->FromName = $emailcfg['FromName']; if ($emailcfg['Reply']) { $mail->AddReplyTo($emailcfg['Reply'], $emailcfg['ReplyName']); } $mail->CharSet = $l['a_meta_charset']; if (!$mail->CharSet) { $mail->CharSet = $emailcfg['CharSet']; } $mail->Subject = $l['t_result_user']; $mail->IsHTML(TRUE); // Set message type to HTML. $email_num = 0; // count emails; if ($user_id == 0) { // for each user on selected test $sql = 'SELECT user_id, user_name, user_email, user_firstname, user_lastname, testuser_creation_time FROM ' . K_TABLE_TEST_USER . ', ' . K_TABLE_USERS . ' WHERE testuser_user_id=user_id AND testuser_test_id=' . $test_id . ' AND testuser_status>0'; if ($group_id > 0) { $sql .= ' AND testuser_user_id IN (SELECT usrgrp_user_id FROM ' . K_TABLE_USERGROUP . ' WHERE usrgrp_group_id=' . $group_id . ')'; } } else { // select only one test of one user $sql = 'SELECT user_id, user_name, user_email, user_firstname, user_lastname, testuser_creation_time FROM ' . K_TABLE_TEST_USER . ', ' . K_TABLE_USERS . ' WHERE testuser_user_id=user_id AND testuser_user_id=' . $user_id . ' AND testuser_test_id=' . $test_id . ' AND testuser_status>0 LIMIT 1'; } // get test data $testdata = F_getTestData($test_id); if ($r = F_db_query($sql, $db)) { while ($m = F_db_fetch_array($r)) { if (strlen($m['user_email']) > 3) { // get user's test stats $usrtestdata = F_getUserTestStat($test_id, $m['user_id']); // set HTML header $mail->Body = $emailcfg['MsgHeader']; // compose alternate TEXT message $mail->AltBody = '' . $l['t_result_user'] . ' [' . $m['testuser_creation_time'] . ']' . K_NEWLINE; $mail->AltBody .= $l['w_test'] . ': ' . $testdata['test_name'] . K_NEWLINE; $passmsg = ''; if ($testdata['test_score_threshold'] > 0) { $mail->AltBody .= $l['w_test_score_threshold'] . ': ' . $testdata['test_score_threshold']; if ($usrtestdata['score'] >= $testdata['test_score_threshold']) { $passmsg = ' - ' . $l['w_passed']; } else { $passmsg = ' - ' . $l['w_not_passed']; } $mail->AltBody .= K_NEWLINE; } $mail->AltBody .= $l['w_score'] . ': ' . $usrtestdata['score'] . ' (' . round(100 * $usrtestdata['score'] / $usrtestdata['max_score']) . '%)' . $passmsg . K_NEWLINE; $mail->AltBody .= $l['w_answers_right'] . ': ' . $usrtestdata['right'] . ' (' . round(100 * $usrtestdata['right'] / $usrtestdata['all']) . '%)' . K_NEWLINE; $mail->AltBody .= $l['w_answers_wrong'] . ': ' . $usrtestdata['wrong'] . ' (' . round(100 * $usrtestdata['wrong'] / $usrtestdata['all']) . '%)' . K_NEWLINE; $mail->AltBody .= $l['w_questions_unanswered'] . ': ' . $usrtestdata['unanswered'] . ' (' . round(100 * $usrtestdata['unanswered'] / $usrtestdata['all']) . '%)' . K_NEWLINE; $mail->AltBody .= $l['w_questions_undisplayed'] . ': ' . $usrtestdata['undisplayed'] . ' (' . round(100 * $usrtestdata['undisplayed'] / $usrtestdata['all']) . '%)' . K_NEWLINE; if ($mode == 0) { // create PDF doc $pdf_content = file_get_contents(K_PATH_HOST . K_PATH_TCEXAM . 'admin/code/tce_pdf_results.php?mode=3&testid=' . $test_id . '&groupid=0&userid=' . $m['user_id'] . '&email=' . md5(date('Y') . K_RANDOM_SECURITY . $test_id . $m['user_id'])); // attach doc $doc_name = 'test_' . date('Ymd', strtotime($m['testuser_creation_time'])) . '_' . $test_id . '_' . $m['user_id'] . '.pdf'; $mail->AddStringAttachment($pdf_content, $doc_name, $emailcfg['AttachmentsEncoding'], 'application/octet-stream'); $mail->AltBody .= K_NEWLINE . $l['w_attachment'] . ': ' . $doc_name . K_NEWLINE; } // convert alternate text to HTML $mail->Body .= str_replace(K_NEWLINE, '<br />' . K_NEWLINE, $mail->AltBody); // add HTML footer $mail->Body .= $emailcfg['MsgFooter']; //--- Elaborate user Templates --- $mail->Body = str_replace('#CHARSET#', $l['a_meta_charset'], $mail->Body); $mail->Body = str_replace('#LANG#', $l['a_meta_language'], $mail->Body); $mail->Body = str_replace('#LANGDIR#', $l['a_meta_dir'], $mail->Body); $mail->Body = str_replace('#EMAIL#', $m['user_email'], $mail->Body); $mail->Body = str_replace('#USERNAME#', htmlspecialchars($m['user_name'], ENT_NOQUOTES, $l['a_meta_charset']), $mail->Body); $mail->Body = str_replace('#USERFIRSTNAME#', htmlspecialchars($m['user_firstname'], ENT_NOQUOTES, $l['a_meta_charset']), $mail->Body); $mail->Body = str_replace('#USERLASTNAME#', htmlspecialchars($m['user_lastname'], ENT_NOQUOTES, $l['a_meta_charset']), $mail->Body); // add a "To" address $mail->AddAddress($m['user_email'], $m['user_name']); $email_num++; $progresslog = '' . $email_num . '. ' . $m['user_email'] . ' [' . $m['user_name'] . ']'; //output user data if (!$mail->Send()) { //send email to user $progresslog .= ' [' . $l['t_error'] . ']'; //display error message } $mail->ClearAddresses(); // Clear all addresses for next loop $mail->ClearAttachments(); // Clears all previously set filesystem, string, and binary attachments } else { $progresslog = '[' . $l['t_error'] . '] ' . $m['user_name'] . ': ' . $l['m_unknown_email'] . ''; //output user data } echo '' . $progresslog . '<br />' . K_NEWLINE; //output processed emails flush(); // force browser output } } else { F_display_db_error(false); } $mail->ClearAddresses(); // Clear all addresses for next loop $mail->ClearCustomHeaders(); // Clears all custom headers $mail->ClearAllRecipients(); // Clears all recipients assigned in the TO, CC and BCC $mail->ClearAttachments(); // Clears all previously set filesystem, string, and binary attachments $mail->ClearReplyTos(); // Clears all recipients assigned in the ReplyTo array return; }