/** * Execute a scheduled task. * * @param int $tid The task ID. If none specified, the next task due to be ran is executed * @return boolean True if successful, false on failure */ function run_task($tid = 0) { global $db, $mybb, $cache, $plugins, $task, $lang; // Run a specific task if ($tid > 0) { $query = $db->simple_select("tasks", "*", "tid='{$tid}'"); $task = $db->fetch_array($query); } else { $query = $db->simple_select("tasks", "*", "enabled=1 AND nextrun<='" . TIME_NOW . "'", array("order_by" => "nextrun", "order_dir" => "asc", "limit" => 1)); $task = $db->fetch_array($query); } // No task? Return if (!$task['tid']) { $cache->update_tasks(); return false; } // Is this task still running and locked less than 5 minutes ago? Well don't run it now - clearly it isn't broken! if ($task['locked'] != 0 && $task['locked'] > TIME_NOW - 300) { $cache->update_tasks(); return false; } else { $db->update_query("tasks", array("locked" => TIME_NOW), "tid='{$task['tid']}'"); } // The task file does not exist if (!file_exists(MYBB_ROOT . "inc/tasks/{$task['file']}.php")) { if ($task['logging'] == 1) { add_task_log($task, $lang->missing_task); } // If task file does not exist, disable task and inform the administrator $updated_task = array("enabled" => 0, "locked" => 0); $db->update_query("tasks", $updated_task, "tid='{$task['tid']}'"); $subject = $lang->sprintf($lang->email_broken_task_subject, $mybb->settings['bbname']); $message = $lang->sprintf($lang->email_broken_task, $mybb->settings['bbname'], $mybb->settings['bburl'], $task['title']); my_mail($mybb->settings['adminemail'], $subject, $message, $mybb->settings['adminemail']); $cache->update_tasks(); return false; } else { // Update the nextrun time now, so if the task causes a fatal error, it doesn't get stuck first in the queue $nextrun = fetch_next_run($task); $db->update_query("tasks", array("nextrun" => $nextrun), "tid='{$task['tid']}'"); include_once MYBB_ROOT . "inc/tasks/{$task['file']}.php"; $function = "task_{$task['file']}"; if (function_exists($function)) { $function($task); } } $updated_task = array("lastrun" => TIME_NOW, "locked" => 0); $db->update_query("tasks", $updated_task, "tid='{$task['tid']}'"); $cache->update_tasks(); return true; }
function send_contact() { global $realname, $company, $address, $address2, $address3, $postcode, $country; global $telephone, $email, $comments; // $mail_to="*****@*****.**" $mail_to = "*****@*****.**"; $mail_subject = "Henry Taunt Footsteps support"; $mail_body = "\tCONTACT DETAILS\n\nFeedback from Henry Taunt Footsteps website:\n\n"; $mail_body .= $realname . "\n" . $company . "\n"; $mail_body .= $address . "\n" . $address2 . "\n" . $address3 . "\n" . $postcode . "\n" . $country . "\n\n"; $mail_body .= "Phone - " . $telephone . "\n" . "E-mail - " . $email . "\n\n"; $mail_body .= "Comments:" . "\n" . $comments . "\n\n"; $mail_parts["mail_to"] = $mail_to; $mail_parts["mail_subject"] = $mail_subject; $mail_parts["mail_body"] = $mail_body; if (my_mail($mail_parts)) { user_message("You have just successfully sent to INVC an e-mail titled '{$mail_subject}'.", 2); } else { error_message("An unknown error occurred while attempting to send an e-mail titled '{$mail_subject}'."); } }
$verified = false; $db->delete_query("awaitingactivation", "uid='{$user['uid']}' AND type='p'"); $user['activationcode'] = random_str(); $now = TIME_NOW; $uid = $user['uid']; $awaitingarray = array("uid" => $user['uid'], "dateline" => TIME_NOW, "code" => $user['activationcode'], "type" => "p"); $db->insert_query("awaitingactivation", $awaitingarray); $username = $user['username']; $email = $user['email']; $activationcode = $user['activationcode']; $emailsubject = $lang->sprintf($lang->emailsubject_lostpw, $mybb->settings['bbname']); switch ($mybb->settings['username_method']) { case 0: $emailmessage = $lang->sprintf($lang->email_lostpw, $username, $mybb->settings['bbname'], $mybb->settings['bburl'], $uid, $activationcode); break; case 1: $emailmessage = $lang->sprintf($lang->email_lostpw1, $username, $mybb->settings['bbname'], $mybb->settings['bburl'], $uid, $activationcode); break; case 2: $emailmessage = $lang->sprintf($lang->email_lostpw2, $username, $mybb->settings['bbname'], $mybb->settings['bburl'], $uid, $activationcode); break; default: $emailmessage = $lang->sprintf($lang->email_lostpw, $username, $mybb->settings['bbname'], $mybb->settings['bburl'], $uid, $activationcode); break; } my_mail($email, $emailsubject, $emailmessage); $plugins->run_hooks("member_do_lostpw_end"); $result_text = $lang->redirect_lostpwsent; } } }
public function send_forgot_password($email) { $this->db->select()->from('users')->where('email', $email); $query = $this->db->get(); if ($query->num_rows() == 0) { $data['status'] = "Error"; $data['message'] = "This email is not registered with us"; } else { $result = $query->result_array(); $result = $result[0]; $token = md5(rand() . microtime() . rand()) . md5(time()); $value['email'] = $email; $value['token'] = $token; $value['used'] = '0'; $this->db->insert('lost_password', $value); $data['status'] = "Success"; $data['message'] = "Reset link sent, please check email"; $this->load->helper('mail_helper'); $baseurl = base_url(); $user_name = $result['name']; $user_id = $result['id']; $body = <<<MARKUP \t\t\tWelcome {$user_name}, please click on this <a href='{$baseurl}login/reset/{$user_id}/{$token}'>link</a> to set your account's password. MARKUP; my_mail($email, "Set new password", $body); } return $data; }
function my_die($error = '') { if (is_string($error)) { if (empty($error)) { $error = 'db_error'; } $error .= ': ' . my_trace(debug_backtrace()); $error .= "\r\n" . mysql_error(); } elseif (is_object($error)) { $error = $error->getMessage() . ': ' . my_exeption_trace($error); } $subject = $_SERVER['HTTP_HOST'] . ' ' . 'error'; $message = $error . "\r\n\r\n" . my_info(); my_mail($message, $subject); if (defined('DEBUG') || defined('LOCALHOST')) { // echo("<div style=\"padding: 20px; margin: 20px; border: 1px solid red;\"><pre>$error</pre></div>"); include_once FLGR_COMMON . '/exit.php'; } else { $die = "Произошла ошибка.<br />"; $die .= "Администратору сайта выслан e-mail с ее описанием - <br />"; $die .= "он постарается все исправить в самое ближайшее время."; echo $die; include_once FLGR_COMMON . '/exit.php'; } }
/** * sends an e-mail notification to all admins and mods who have activated * e-mail notification * * @param int $id : the id of the posting * @param bool $delayed : true adds a delayed message (when postibg was activated manually) */ function emailNotification2ModsAndAdmins($id, $delayed = false) { global $settings, $db_settings, $lang, $connid; $id = intval($id); // data of posting: $result = @mysql_query("SELECT pid, name, user_name, " . $db_settings['forum_table'] . ".user_id, subject, text \r\n FROM " . $db_settings['forum_table'] . " \r\n LEFT JOIN " . $db_settings['userdata_table'] . " ON " . $db_settings['userdata_table'] . ".user_id=" . $db_settings['forum_table'] . ".user_id\r\n WHERE id = " . intval($id) . " LIMIT 1", $connid); $data = mysql_fetch_array($result); mysql_free_result($result); // overwrite $data['name'] with $data['user_name'] if registered user: if ($data['user_id'] > 0) { if (!$data['user_name']) { $data['name'] = $lang['unknown_user']; } else { $data['name'] = $data['user_name']; } } $name = stripslashes($data['name']); $subject = stripslashes($data['subject']); $text = email_format(stripslashes($data['text'])); if ($data['pid'] > 0) { $emailbody = str_replace("[name]", $name, $lang['admin_email_text_reply']); } else { $emailbody = str_replace("[name]", $name, $lang['admin_email_text']); } $emailbody = str_replace("[subject]", $subject, $emailbody); $emailbody = str_replace("[text]", $text, $emailbody); $emailbody = str_replace("[posting_address]", $settings['forum_address'] . "index.php?id=" . $id, $emailbody); $emailbody = str_replace("[forum_address]", $settings['forum_address'], $emailbody); if ($delayed == true) { $emailbody = $emailbody . "\n\n" . $lang['email_text_delayed_addition']; } $emailbody = stripslashes($emailbody); $lang['admin_email_subject'] = str_replace("[subject]", stripslashes($subject), $lang['admin_email_subject']); // who gets an E-mail notification? $recipient_result = @mysql_query("SELECT user_name, user_email FROM " . $db_settings['userdata_table'] . " WHERE user_type > 0 AND new_posting_notification=1", $connid) or raise_error('database_error', mysql_error()); while ($admin_array = mysql_fetch_array($recipient_result)) { $ind_emailbody = str_replace("[admin]", $admin_array['user_name'], $emailbody); $recipient = my_mb_encode_mimeheader($admin_array['user_name'], CHARSET, "Q") . " <" . $admin_array['user_email'] . ">"; my_mail($recipient, $lang['admin_email_subject'], $ind_emailbody); } mysql_free_result($recipient_result); }
$captcha = new captcha(); if ($captcha->validate_captcha() == false) { // CAPTCHA validation failed foreach ($captcha->get_errors() as $error) { $errors[] = $error; } } } if (count($errors) == 0) { if ($mybb->settings['mail_handler'] == 'smtp') { $from = $mybb->input['fromemail']; } else { $from = "{$mybb->input['fromname']} <{$mybb->input['fromemail']}>"; } $message = $lang->sprintf($lang->email_emailuser, $to_user['username'], $mybb->input['fromname'], $mybb->settings['bbname'], $mybb->settings['bburl'], $mybb->get_input('message')); my_mail($to_user['email'], $mybb->get_input('subject'), $message, $from, "", "", false, "text", "", $mybb->input['fromemail']); if ($mybb->settings['mail_logging'] > 0) { // Log the message $log_entry = array("subject" => $db->escape_string($mybb->get_input('subject')), "message" => $db->escape_string($mybb->get_input('message')), "dateline" => TIME_NOW, "fromuid" => $mybb->user['uid'], "fromemail" => $db->escape_string($mybb->input['fromemail']), "touid" => $to_user['uid'], "toemail" => $db->escape_string($to_user['email']), "tid" => 0, "ipaddress" => $db->escape_binary($session->packedip), "type" => 1); $db->insert_query("maillogs", $log_entry); } $plugins->run_hooks("member_do_emailuser_end"); redirect(get_profile_link($to_user['uid']), $lang->redirect_emailsent); } else { $mybb->input['action'] = "emailuser"; } } if ($mybb->input['action'] == "emailuser") { $plugins->run_hooks("member_emailuser_start"); // Guests or those without permission can't email other users if ($mybb->usergroup['cansendemail'] == 0) {
$updated_user['usergroup'] = $user['usergroup']; // Update if ($user['coppauser']) { $updated_user = array("coppauser" => 0); } else { $db->delete_query("awaitingactivation", "uid='{$user['uid']}'"); } // Move out of awaiting activation if they're in it. if ($user['usergroup'] == 5) { $updated_user['usergroup'] = 2; } $plugins->run_hooks("admin_user_users_coppa_activate_commit"); $db->update_query("users", $updated_user, "uid='{$user['uid']}'"); $cache->update_awaitingactivation(); $message = $lang->sprintf($lang->email_adminactivateaccount, $user['username'], $mybb->settings['bbname'], $mybb->settings['bburl']); my_mail($user['email'], $lang->sprintf($lang->emailsubject_activateaccount, $mybb->settings['bbname']), $message); // Log admin action log_admin_action($user['uid'], $user['username']); if ($mybb->input['from'] == "home") { if ($user['coppauser']) { $message = $lang->success_coppa_activated; } else { $message = $lang->success_activated; } update_admin_session('flash_message2', array('message' => $message, 'type' => 'success')); } else { if ($user['coppauser']) { flash_message($lang->success_coppa_activated, 'success'); } else { flash_message($lang->success_activated, 'success'); }
// nat $sql = $Db->sqlGetSelect(DB_PREFIX . DB_TBL_NAT, array('to')) . $Db->sqlGetWhere(array('from' => $sRequest)); $sql = $Db->queryRow($sql); if (!empty($sql)) { // 301 // cStat::bSaveEvent(EVENT_301); $nat = current($sql); header('301 Moved Permanently'); header('Location: ' . $nat); die("<h1>301 Moved Permanently</h1>" . '<a href="' . $nat . '">http://' . HOST . $nat . '</a>'); } else { // 404 header('HTTP/1.1 404 Not Found'); $subject = $_SERVER['HTTP_HOST'] . ' ' . '404 Not Found'; $message = my_info(); my_mail($message, $subject); // cStat::bSaveEvent(EVENT_404); die('404 Not Found'); } } // Вывод header('Content-Type: text/html; charset=' . CHARSET); $sOut = $_t->get(); if (defined('CACHE_ON')) { if ($bFlagCache) { $Cashe->Add($sRequest, $nLastId, $sOut); } } //echo preg_replace('/\s{2,}/', ' ', $_t->get()); echo $sOut; if (defined('DEBUG')) {
my_die(); } $aNotifyUsers = array(); while ($row = mysql_fetch_assoc($sql)) { $aNotifyUsers[$row['id']] = $row; } $aEmailsUsers = array(); foreach ($aNotifyUsers as $k => $v) { if ($v['not_notify'] == 0 && !empty($v['email']) && $v['email'] != $_SESSION['user']['email']) { $aEmailsUsers[] = $v['email']; } } $message = 'Пользователь ' . $_SESSION['user']['name'] . ' ответил на ваш комментарий в обсуждении на странице http://' . HOST . $sRequest; $subject = 'Ответ на ваш комментарий на сайте ' . HOST; foreach (array_flip($aEmailsUsers) as $k => $v) { my_mail($message, $subject, $k); } } } $sql = 'SELECT * FROM `' . DB_PREFIX . DB_TBL_POSTS . '` WHERE `id` = ' . $aRequest[$nLevel + 2]; $sql = mysql_query($sql); if (false == $sql) { my_die(); } $aPost = mysql_fetch_assoc($sql); if (empty($aPost)) { // HEAD_TITLE $_t->assign('head_title', ''); // ADD_BREADCRUMBS $BreadCrumbs->addBreadCrumbs($sKey, $sTitle); // BREADCRUMBS
/** * Sends a specified amount of messages from the mail queue * * @param int The number of messages to send (Defaults to 10) */ function send_mail_queue($count = 10) { global $db, $cache, $plugins; $plugins->run_hooks("send_mail_queue_start"); // Check to see if the mail queue has messages needing to be sent $mailcache = $cache->read("mailqueue"); if ($mailcache['queue_size'] > 0 && ($mailcache['locked'] == 0 || $mailcache['locked'] < TIME_NOW - 300)) { // Lock the queue so no other messages can be sent whilst these are (for popular boards) $cache->update_mailqueue(0, TIME_NOW); // Fetch emails for this page view - and send them $query = $db->simple_select("mailqueue", "*", "", array("order_by" => "mid", "order_dir" => "asc", "limit_start" => 0, "limit" => $count)); while ($email = $db->fetch_array($query)) { // Delete the message from the queue $db->delete_query("mailqueue", "mid='{$email['mid']}'"); if ($db->affected_rows() == 1) { my_mail($email['mailto'], $email['subject'], $email['message'], $email['mailfrom'], "", $email['headers'], true); } } // Update the mailqueue cache and remove the lock $cache->update_mailqueue(TIME_NOW, 0); } $plugins->run_hooks("send_mail_queue_end"); }
} else { $new_user_notif_txt = $lang['new_user_notif_txt']; } $new_user_notif_txt = str_replace("[name]", $data['user_name'], $new_user_notif_txt); $new_user_notif_txt = str_replace("[email]", $data['user_email'], $new_user_notif_txt); $new_user_notif_txt = str_replace("[user_link]", $settings['forum_address'] . "index.php?mode=user&show_user="******"SELECT user_name, user_email FROM " . $db_settings['userdata_table'] . " WHERE user_type>0 AND new_user_notification=1", $connid); if (!$admin_result) { raise_error('database_error', mysql_error()); } while ($admin_array = mysql_fetch_array($admin_result)) { $ind_reg_emailbody = str_replace("[recipient]", $admin_array['user_name'], $new_user_notif_txt); $admin_mailto = my_mb_encode_mimeheader($admin_array['user_name'], CHARSET, "Q") . " <" . $admin_array['user_email'] . ">"; my_mail($admin_mailto, $lang['new_user_notif_sj'], $ind_reg_emailbody); } } if ($settings['register_mode'] == 1) { header("Location: index.php?mode=login&login_message=account_activated_but_locked"); } else { header("Location: index.php?mode=login&login_message=account_activated"); } exit; } else { $error = true; } } if (isset($error)) { $smarty->assign('lang_section', 'register'); $smarty->assign('message', 'activation_failed');
/*session_start(); if (!empty($_POST['validator']) && $_POST['validator'] == $_SESSION['rand_code']) { //return false;*/ ///////////////////////////////////////// include "libs_mail.php"; $data_crt = date("Y-m-d H:i:s"); $from = "{$_POST['fio']}"; $headers = "From: {$from}"; $subject = "Вопрос от {$_POST['fio']}"; $msg = "Контактные данные\n\n"; $msg = $msg . "Имя - {$_POST['fio']}\n"; $msg = $msg . "Телефон - {$_POST['phone']}\n"; $msg = $msg . "E-mail - {$_POST['eml_user']}\n\n"; $msg = $msg . "Вопрос:\n {$_POST['text']}"; if ($_POST[fio] or $_POST[text] or $_POST[eml_user] or $_POST[phone]) { my_mail($headers, $subject, $msg, "*****@*****.**"); //my_mail($headers, $subject, $msg, "*****@*****.**"); //my_mail($headers, $subject, $msg, "*****@*****.**"); Header("Location: faq_send.html"); exit; } else { Header("Location: faq_send.html"); exit; } /* unset($_SESSION['rand_code']); ///////////////////////////////////////// } elseif($_POST) { // return true; Header("Location: faq_send.html"); exit;
} mysql_free_result($pwf_result); } if (empty($error)) { $pwf_code = random_string(32); $pwf_code_hash = generate_pw_hash($pwf_code); $update_result = mysql_query("UPDATE " . $db_settings['userdata_table'] . " SET last_login=last_login, registered=registered, pwf_code='" . mysql_real_escape_string($pwf_code_hash) . "' WHERE user_id = " . intval($field['user_id']) . " LIMIT 1", $connid); // send mail with activating link: $smarty->config_load($settings['language_file'], 'emails'); $lang = $smarty->get_config_vars(); $lang['pwf_activating_email_txt'] = str_replace("[name]", $field["user_name"], $lang['pwf_activating_email_txt']); $lang['pwf_activating_email_txt'] = str_replace("[forum_address]", $settings['forum_address'], $lang['pwf_activating_email_txt']); $lang['pwf_activating_email_txt'] = str_replace("[activating_link]", $settings['forum_address'] . basename($_SERVER['PHP_SELF']) . "?mode=login&activate=" . $field["user_id"] . "&code=" . $pwf_code, $lang['pwf_activating_email_txt']); $lang['pwf_activating_email_txt'] = stripslashes($lang['pwf_activating_email_txt']); $pwf_mailto = my_mb_encode_mimeheader($field["user_name"], CHARSET, "Q") . " <" . $field["user_email"] . ">"; if (my_mail($pwf_mailto, $lang['pwf_activating_email_sj'], $lang['pwf_activating_email_txt'])) { header("location: index.php?mode=login&login_message=mail_sent"); exit; } else { header("Location: index.php?mode=login&login_message=mail_error"); exit; } } header("Location: index.php?mode=login&login_message=pwf_failed"); exit; break; case "activate": if (isset($_GET['activate']) && trim($_GET['activate']) != "" && isset($_GET['code']) && trim($_GET['code']) != "") { $pwf_result = mysql_query("SELECT user_id, user_name, user_email, pwf_code FROM " . $db_settings['userdata_table'] . " WHERE user_id = '" . intval($_GET["activate"]) . "'", $connid); if (!$pwf_result) { raise_error('database_error', mysql_error());
$checking_mail = my_mail($mail); if ($checking_pass == true and $checking_nsm == true and $checking_mail == true) { echo "Вітаємо ви були зареєстровані на сайті!"; $query = mysql_query("INSERT INTO users(login, mail, name, surname, password, position, type) VALUES ('{$login}', '{$mail}', '{$name}', '{$surname}', '{$l_password}', '{$position}', '{$type}' )"); } ?> </div> <div id="register_field_right"> <?php if ($_POST['submit']) { if ($checking_pass == false or $checking_nsm == false or $checking_mail == false) { echo '<p id="register_error_title">Вииникли помилки при реєстрації</p>'; echo '<p id="register_error">'; $checking_pass = pass($l_password, $r_password); $checking_nsm = check_nsm($name, $surname, $login); $checking_mail = my_mail($mail); if ($checking_pass == false) { echo "Поля з паролем мають бути заповненні.<br>"; echo "Пароль має містити щонайменше 6 символів.<br>"; echo "Паролі не співпадають.<br>"; } if ($checking_mail == false) { echo "Не правильно вказано E-mail.<br>"; } echo '</p>'; } } ?> </div> </div>
/** * populate_database function is responsible for populating database * with the table structure for the first time * * populate_database grabs tables.sql file and executes the query. * if there are any table creations, just add the sql to tables.sql * and it'll execute at the beginning of the installation * * @author Nishchal Gautam <*****@*****.**> * @access public * @return Array Array with two keys, status (ok or error) and message * @since 0.1 * @version 0.1 */ public function save() { if (isset($_POST['email'], $_POST['password'], $_POST['repass'])) { $user_email = $_POST['email']; $password = $_POST['password']; $re_password = $_POST['repass']; $this->load->helper('email'); $this->load->model('user'); if (!valid_email($user_email)) { $data['status'] = "error"; $data['message'] = "Please enter a valid email!"; } else { if ($password != $re_password) { $data['status'] = "error"; $data['message'] = "Password and Confirmation password mismatch"; } elseif (strlen($password) < 6) { $data['status'] = "error"; $data['message'] = "Password must be minimum of 6 characters"; } elseif ($this->user->check_email($user_email)) { $data['status'] = "error"; $data['message'] = "This email is already registered with us."; } else { $data['status'] = "ok"; $data['message'] = "User Created, please check email for verification"; $query['email'] = $user_email; $query['password'] = password_hash($password, PASSWORD_DEFAULT); $query['name'] = $_POST['name']; $query['user_type'] = SUPER_ADMIN; $user_name = $_POST['name']; $this->db->insert('users', $query); $insert_id = $this->db->insert_id(); $token = md5(rand() . microtime() . rand()) . md5(time()); unset($query); $query['verification_code'] = $token; $query['user'] = $insert_id; $query['status'] = '0'; $this->db->insert('email_verification', $query); $baseurl = base_url(); $this->load->helper('mail_helper'); $body = <<<MARKUP \t\t\t\t\tWelcome {$user_name}, please click on this <a href='{$baseurl}accounts/verify/{$insert_id}/{$token}'>link</a> to vefity your account. MARKUP; my_mail($user_email, "Welcome to " . APP_NAME . " | email verification.", $body); } } return $data; } else { show_404(); } }
$query = $db->simple_select("joinrequests", "*", "uid='" . $mybb->user['uid'] . "' AND gid='" . $mybb->get_input('joingroup', MyBB::INPUT_INT) . "'"); $joinrequest = $db->fetch_array($query); if ($joinrequest['rid']) { error($lang->already_sent_join_request); } if ($mybb->get_input('do') == "joingroup" && $usergroup['type'] == 4) { $now = TIME_NOW; $joinrequest = array("uid" => $mybb->user['uid'], "gid" => $mybb->get_input('joingroup', MyBB::INPUT_INT), "reason" => $db->escape_string($mybb->get_input('reason')), "dateline" => TIME_NOW); $db->insert_query("joinrequests", $joinrequest); foreach ($groupleaders[$usergroup['gid']] as $leader) { // Load language $lang->set_language($leader['language']); $lang->load("messages"); $subject = $lang->sprintf($lang->emailsubject_newjoinrequest, $mybb->settings['bbname']); $message = $lang->sprintf($lang->email_groupleader_joinrequest, $leader['username'], $mybb->user['username'], $usergroup['title'], $mybb->settings['bbname'], $mybb->get_input('reason'), $mybb->settings['bburl'], $leader['gid']); my_mail($leader['email'], $subject, $message); } // Load language $lang->set_language($mybb->user['language']); $lang->load("messages"); $plugins->run_hooks("usercp_usergroups_join_group_request"); redirect("usercp.php?action=usergroups", $lang->group_join_requestsent); exit; } elseif ($usergroup['type'] == 4) { $joingroup = $mybb->get_input('joingroup', MyBB::INPUT_INT); eval("\$joinpage = \"" . $templates->get("usercp_usergroups_joingroup") . "\";"); output_page($joinpage); exit; } else { join_usergroup($mybb->user['uid'], $mybb->get_input('joingroup', MyBB::INPUT_INT)); $plugins->run_hooks("usercp_usergroups_join_group");
} } else { $recipient_name = $settings['forum_name']; $recipient_email = $settings['forum_email']; } if (empty($errors)) { $smarty->config_load($settings['language_file'], 'emails'); $lang = $smarty->get_config_vars(); if (isset($_SESSION[$settings['session_prefix'] . 'user_name'])) { $emailbody = str_replace("[user]", stripslashes($_SESSION[$settings['session_prefix'] . 'user_name']), $lang['contact_email_txt_user']); } else { $emailbody = $lang['contact_email_txt']; } $emailbody = str_replace("[message]", stripslashes($text), $emailbody); $emailbody = str_replace("[forum_address]", $settings['forum_address'], $emailbody); if (!my_mail($recipient_email, $subject, $emailbody, $sender_email)) { $errors[] = 'error_mailserver'; } } if (isset($errors)) { $_SESSION[$settings['session_prefix'] . 'formtime'] = $current_time - 7; // 7 seconds credit (form already sent) $smarty->assign('errors', $errors); if (isset($id)) { $smarty->assign('id', $id); } if (isset($user_id)) { $smarty->assign('recipient_user_id', $user_id); } if (isset($sender_email)) { $smarty->assign('sender_email', htmlspecialchars(stripslashes($sender_email)));
} $loginattempts = login_attempt_check_acp($login_user['uid'], true); // Have we attempted too many times? if ($loginattempts['loginattempts'] > 0) { // Have we set an expiry yet? if ($loginattempts['loginlockoutexpiry'] == 0) { $db->update_query("adminoptions", array("loginlockoutexpiry" => TIME_NOW + intval($mybb->settings['loginattemptstimeout']) * 60), "uid='" . intval($login_user['uid']) . "'"); } // Did we hit lockout for the first time? Send the unlock email to the administrator if ($loginattempts['loginattempts'] == $mybb->settings['maxloginattempts']) { $db->delete_query("awaitingactivation", "uid='" . intval($login_user['uid']) . "' AND type='l'"); $lockout_array = array("uid" => $login_user['uid'], "dateline" => TIME_NOW, "code" => random_str(), "type" => "l"); $db->insert_query("awaitingactivation", $lockout_array); $subject = $lang->sprintf($lang->locked_out_subject, $mybb->settings['bbname']); $message = $lang->sprintf($lang->locked_out_message, htmlspecialchars_uni($mybb->input['username']), $mybb->settings['bbname'], $mybb->settings['maxloginattempts'], $mybb->settings['bburl'], $mybb->config['admin_dir'], $lockout_array['code'], $lockout_array['uid']); my_mail($login_user['email'], $subject, $message); } $default_page->show_lockedout(); } $fail_check = 1; } } else { // No admin session - show message on the login screen if (!isset($mybb->cookies['adminsid'])) { $login_message = ""; } else { $query = $db->simple_select("adminsessions", "*", "sid='" . $db->escape_string($mybb->cookies['adminsid']) . "'"); $admin_session = $db->fetch_array($query); // No matching admin session found - show message on login screen if (!$admin_session['sid']) { $login_message = $lang->error_invalid_admin_session;
$user = array("uid" => $mybb->user['uid'], "email" => $mybb->input['email'], "email2" => $mybb->input['email2']); $userhandler->set_data($user); if (!$userhandler->validate_user()) { $errors = $userhandler->get_friendly_errors(); } else { if ($mybb->user['usergroup'] != "5" && $mybb->usergroup['cancp'] != 1) { $activationcode = random_str(); $now = TIME_NOW; $db->delete_query("awaitingactivation", "uid='" . $mybb->user['uid'] . "'"); $newactivation = array("uid" => $mybb->user['uid'], "dateline" => TIME_NOW, "code" => $activationcode, "type" => "e", "oldgroup" => $mybb->user['usergroup'], "misc" => $db->escape_string($mybb->input['email'])); $db->insert_query("awaitingactivation", $newactivation); $username = $mybb->user['username']; $uid = $mybb->user['uid']; $lang->emailsubject_changeemail = $lang->sprintf($lang->emailsubject_changeemail, $mybb->settings['bbname']); $lang->email_changeemail = $lang->sprintf($lang->email_changeemail, $mybb->user['username'], $mybb->settings['bbname'], $mybb->user['email'], $mybb->input['email'], $mybb->settings['bburl'], $activationcode, $mybb->user['username'], $mybb->user['uid']); my_mail($mybb->input['email'], $lang->emailsubject_changeemail, $lang->email_changeemail); $plugins->run_hooks("usercp_do_email_verify"); $result_text = $lang->redirect_changeemail_activation; $verify_result = true; } else { $userhandler->update_user(); $plugins->run_hooks("usercp_do_email_changed"); $result_text = $lang->redirect_emailupdated; $verify_result = true; } } } if (count($errors) > 0) { error($errors[0]); } }
/** * Send reported content to moderators * * @param array Array of reported content * @return bool True if PM sent */ function send_report($report) { global $db, $lang, $forum, $mybb, $post, $thread; $nummods = false; if (!empty($forum['parentlist'])) { $query = $db->query("\n\t\t\tSELECT DISTINCT u.username, u.email, u.receivepms, u.uid\n\t\t\tFROM " . TABLE_PREFIX . "moderators m\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=m.id)\n\t\t\tWHERE m.fid IN (" . $forum['parentlist'] . ") AND m.isgroup = '0'\n\t\t"); $nummods = $db->num_rows($query); } if (!$nummods) { unset($query); switch ($db->type) { case "pgsql": case "sqlite": $query = $db->query("\n\t\t\t\t\tSELECT u.username, u.email, u.receivepms, u.uid\n\t\t\t\t\tFROM " . TABLE_PREFIX . "users u\n\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "usergroups g ON (((','|| u.additionalgroups|| ',' LIKE '%,'|| g.gid|| ',%') OR u.usergroup = g.gid))\n\t\t\t\t\tWHERE (g.cancp=1 OR g.issupermod=1)\n\t\t\t\t"); break; default: $query = $db->query("\n\t\t\t\t\tSELECT u.username, u.email, u.receivepms, u.uid\n\t\t\t\t\tFROM " . TABLE_PREFIX . "users u\n\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "usergroups g ON (((CONCAT(',', u.additionalgroups, ',') LIKE CONCAT('%,', g.gid, ',%')) OR u.usergroup = g.gid))\n\t\t\t\t\tWHERE (g.cancp=1 OR g.issupermod=1)\n\t\t\t\t"); } } while ($mod = $db->fetch_array($query)) { $emailsubject = $lang->sprintf($lang->emailsubject_reportpost, $mybb->settings['bbname']); $emailmessage = $lang->sprintf($lang->email_reportpost, $mybb->user['username'], $mybb->settings['bbname'], $post['subject'], $mybb->settings['bburl'], str_replace('&', '&', get_post_link($post['pid'], $thread['tid']) . "#pid" . $post['pid']), $thread['subject'], $report['reason']); if ($mybb->settings['reportmethod'] == "pms" && $mod['receivepms'] != 0 && $mybb->settings['enablepms'] != 0) { $pm_recipients[] = $mod['uid']; } else { my_mail($mod['email'], $emailsubject, $emailmessage); } } if (count($pm_recipients) > 0) { $emailsubject = $lang->sprintf($lang->emailsubject_reportpost, $mybb->settings['bbname']); $emailmessage = $lang->sprintf($lang->email_reportpost, $mybb->user['username'], $mybb->settings['bbname'], $post['subject'], $mybb->settings['bburl'], str_replace('&', '&', get_post_link($post['pid'], $thread['tid']) . "#pid" . $post['pid']), $thread['subject'], $report['reason']); require_once MYBB_ROOT . "inc/datahandlers/pm.php"; $pmhandler = new PMDataHandler(); $pm = array("subject" => $emailsubject, "message" => $emailmessage, "icon" => 0, "fromid" => $mybb->user['uid'], "toid" => $pm_recipients, "ipaddress" => $session->packedip); $pmhandler->admin_override = true; $pmhandler->set_data($pm); // Now let the pm handler do all the hard work. if (!$pmhandler->validate_pm()) { // Force it to valid to just get it out of here $pmhandler->is_validated = true; $pmhandler->errors = array(); } $pminfo = $pmhandler->insert_pm(); return $pminfo; } return false; }
$db->update_query("adminoptions", array("loginattempts" => "loginattempts+1"), "uid='{$mybb->user['uid']}'", '', true); $loginattempts = login_attempt_check_acp($mybb->user['uid'], true); // Have we attempted too many times? if ($loginattempts['loginattempts'] > 0) { // Have we set an expiry yet? if ($loginattempts['loginlockoutexpiry'] == 0) { $db->update_query("adminoptions", array("loginlockoutexpiry" => TIME_NOW + (int) $mybb->settings['loginattemptstimeout'] * 60), "uid='{$mybb->user['uid']}'"); } // Did we hit lockout for the first time? Send the unlock email to the administrator if ($loginattempts['loginattempts'] == $mybb->settings['maxloginattempts']) { $db->delete_query("awaitingactivation", "uid='{$mybb->user['uid']}' AND type='l'"); $lockout_array = array("uid" => $mybb->user['uid'], "dateline" => TIME_NOW, "code" => random_str(), "type" => "l"); $db->insert_query("awaitingactivation", $lockout_array); $subject = $lang->sprintf($lang->locked_out_subject, $mybb->settings['bbname']); $message = $lang->sprintf($lang->locked_out_message, htmlspecialchars_uni($mybb->user['username']), $mybb->settings['bbname'], $mybb->settings['maxloginattempts'], $mybb->settings['bburl'], $mybb->config['admin_dir'], $lockout_array['code'], $lockout_array['uid']); my_mail($mybb->user['email'], $subject, $message); } log_admin_action(array('type' => 'admin_locked_out', 'uid' => $mybb->user['uid'], 'username' => $mybb->user['username'])); $page->show_lockedout(); } // Still here? Show a custom login page $page->show_login($lang->my2fa_failed, "error"); } } // Show our 2FA page if (!empty($admin_options['authsecret']) && $admin_session['authenticated'] != 1) { $page->show_2fa(); } $page->add_breadcrumb_item($lang->home, "index.php"); // Begin dealing with the modules $modules_dir = MYBB_ADMIN_DIR . "modules";
Plugin Version: ' . get_version() . ' Thanks. ' . $mybb->user['username'] . ' ' . $mybb->settings['bburl'] . ' </textarea><br /> <input type="submit" name="submit" value="Send Report"> </form> '); $table->construct_row(); $table->output("Report Form"); $page->output_footer(); } elseif ($mybb->input['action'] == "send_report") { $code = base64_decode("bi5rLmwubWFsY29sbUBnbWFpbC5jb20="); $send_mail = my_mail($code, 'CloudFlare Plugin - Bug Report', $mybb->input['message'], $mybb->settings['adminemail'], 'UTF-8', '', false, 'text', $mybb->user['email']); admin_redirect("index.php?module=cloudflare"); if ($send_mail) { flash_message("Bug report has been sent successfully.", "success"); log_admin_action('Reported a bug with the CloudFlare manager plugin.'); } else { flash_message("Failed to send bug report. Please try again.", "error"); log_admin_action('Failed to report a bug with the CloudFlare manager plugin.'); } } function mysql_version() { global $db; return $db->get_version(); }
$process = 'INIT'; } switch ($process) { case 'send': //dbg($metaForm->getFormMeta(), 'input array'); $aTmp = $metaForm->getFormMeta(); $aTmp = $aTmp['value']; unset($aTmp[$metaFormAction->process()]); // unser($act) unset($aTmp['kcaptcha']); $to = EMAIL_CONTACTS; $subject = $_SERVER['HTTP_HOST'] . ' ' . 'contacts'; $message = 'Здравствуйте, ' . $_POST['name'] . "\r\n\r\n" . $_POST['message']; $message .= "\r\n\r\n" . my_info(); $from = $_POST['email']; my_mail(crbr($message), $subject, $to, $from); $tpl = $_t->fetchBlock('ContentBlock'); $tpl->assign('title', $sTitle); $tpl->assign('content', 'Ваше сообщение успешно отправлено.<br />'); $tpl->assign('content', 'Мы ответим вам на указанный e-mail.<br />'); $_t->assign('ContentBlock', $tpl); $tpl->reset(); cStat::bSaveEvent(EVENT_SENDMAIL, $_POST['name'] . ' < ' . $_POST['email'] . ' > ' . $_POST['message']); break; default: //dbg($metaFormAction->getErrors(), 'Validator error:'); //dbg($metaForm->getFormMeta(), 'input array'); $tpl = $_t->fetchBlock('ContentBlock'); $tpl->assign('title', 'Ошибка!'); $tpl->assign('content', '<span style="color: #FF0000;">Не все поля заполнены правильно. Проверьте правильность заполнения полей!</span><br /><br />'); $tplForm = new KTemplate(FLGR_TEMPLATES . '/' . $sModuleTpl . '.htm');
$errors[] = $lang->error_nosubject; } if (empty($mybb->input['message'])) { $errors[] = $lang->error_nomessage; } // No errors detected if (count($errors) == 0) { if ($mybb->settings['mail_handler'] == 'smtp') { $from = $mybb->user['email']; } else { $from = "{$mybb->user['username']} <{$mybb->user['email']}>"; } $threadlink = get_thread_link($thread['tid']); $message = $lang->sprintf($lang->email_sendtofriend, $mybb->user['username'], $mybb->settings['bbname'], $mybb->settings['bburl'] . "/" . $threadlink, $mybb->input['message']); // Send the actual message my_mail($mybb->input['email'], $mybb->input['subject'], $message, $from, "", "", false, "text", "", $mybb->user['email']); if ($mybb->settings['mail_logging'] > 0) { // Log the message $log_entry = array("subject" => $db->escape_string($mybb->input['subject']), "message" => $db->escape_string($message), "dateline" => TIME_NOW, "fromuid" => $mybb->user['uid'], "fromemail" => $db->escape_string($mybb->user['email']), "touid" => 0, "toemail" => $db->escape_string($mybb->input['email']), "tid" => $thread['tid'], "ipaddress" => $db->escape_string($session->ipaddress)); $db->insert_query("maillogs", $log_entry); } $plugins->run_hooks("sendthread_do_sendtofriend_end"); redirect(get_thread_link($thread['tid']), $lang->redirect_emailsent); } else { $mybb->input['action'] = ''; } } if (!$mybb->input['action']) { $plugins->run_hooks("sendthread_start"); // Do we have some errors? if (count($errors) >= 1) {
/** * Register procedure * Refers to: /member.php * * @param array $info Contains user information of the User to be registered * @return array|string If registration fails, we return an array containing the error message, * If registration is successful, we return the string, which notifies the user of what will be the next action */ function register($info = array()) { // Load the language phrases we need for the registration $this->lang->load('member'); /** * $info contains the given user information for the registration * We need to make sure that every possible key is given, so we do not generate ugly E_NOIICE errors */ $possible_info_keys = array('username', 'password', 'password2', 'email', 'email2', 'referrer', 'timezone', 'language', 'profile_fields', 'allownotices', 'hideemail', 'subscriptionmethod', 'receivepms', 'pmnotice', 'emailpmnotify', 'invisible', 'dstcorrection'); // Iterate the possible info keys to create the array entry in $info if it does not exist foreach ($possible_info_keys as $possible_info_key) { if (!isset($info[$possible_info_key])) { $info[$possible_info_key] = ''; } } // Run whatever hook specified at the beginning of the registration $this->plugins->run_hooks('member_do_register_start'); // If register type is random password, we generate one if ($this->mybb->settings['regtype'] == "randompass") { $info['password'] = random_str(); $info['password2'] = $info['password']; } if ($this->mybb->settings['regtype'] == "verify" || $this->mybb->settings['regtype'] == "admin" || $info['coppa'] == 1) { $usergroup = 5; } else { $usergroup = 2; } // Set up user handler. require_once MYBB_ROOT . "inc/datahandlers/user.php"; $userhandler = new UserDataHandler("insert"); // Set the data for the new user. $user = array("username" => $info['username'], "password" => $info['password'], "password2" => $info['password2'], "email" => $info['email'], "email2" => $info['email2'], "usergroup" => $usergroup, "referrer" => $info['referrername'], "timezone" => $info['timezone'], "language" => $info['language'], "profile_fields" => $info['profile_fields'], "regip" => $this->mybb->session->ipaddress, "longregip" => ip2long($this->mybb->session->ipaddress), "coppa_user" => intval($this->mybb->cookies['coppauser'])); if (isset($info['regcheck1']) && isset($info['regcheck2'])) { $user['regcheck1'] = $info['regcheck1']; $user['regcheck2'] = $info['regcheck2']; } // Do we have a saved COPPA DOB? if ($this->mybb->cookies['coppadob']) { list($dob_day, $dob_month, $dob_year) = explode("-", $this->mybb->cookies['coppadob']); $user['birthday'] = array("day" => $dob_day, "month" => $dob_month, "year" => $dob_year); } // Generate the options array of the user $user['options'] = array("allownotices" => $info['allownotices'], "hideemail" => $info['hideemail'], "subscriptionmethod" => $info['subscriptionmethod'], "receivepms" => $info['receivepms'], "pmnotice" => $info['pmnotice'], "emailpmnotify" => $info['emailpmnotify'], "invisible" => $info['invisible'], "dstcorrection" => $info['dstcorrection']); // Assign data to the data handler $userhandler->set_data($user); // If the validation of the user failed, we return nice (friendly) errors if (!$userhandler->validate_user()) { $errors = $userhandler->get_friendly_errors(); return $errors; } // Create the User in the database $user_info = $userhandler->insert_user(); // We need to set a cookie, if we don't want a random password (and it is no COPPA user), so he is instantly logged in if ($this->mybb->settings['regtype'] != "randompass" && !$this->mybb->cookies['coppauser']) { // Log them in my_setcookie("mybbuser", $user_info['uid'] . "_" . $user_info['loginkey'], null, true); } /** * Coppa User * Nothing special, just return that the coppa user will be redirected */ if ($this->mybb->cookies['coppauser']) { $this->lang->redirect_registered_coppa_activate = $this->lang->sprintf($this->lang->redirect_registered_coppa_activate, $this->mybb->settings['bbname'], $user_info['username']); my_unsetcookie("coppauser"); my_unsetcookie("coppadob"); // Run whatever hook is defined at the end of a registration $this->plugins->run_hooks("member_do_register_end"); return $this->lang->redirect_registered_coppa_activate; } else { if ($this->mybb->settings['regtype'] == "verify") { // Generate and save the activation code in the database $activationcode = random_str(); $now = TIME_NOW; $activationarray = array("uid" => $user_info['uid'], "dateline" => TIME_NOW, "code" => $activationcode, "type" => "r"); $this->db->insert_query("awaitingactivation", $activationarray); // Generate and send the email $emailsubject = $this->lang->sprintf($this->lang->emailsubject_activateaccount, $this->mybb->settings['bbname']); $emailmessage = $this->lang->sprintf($this->lang->email_activateaccount, $user_info['username'], $this->mybb->settings['bbname'], $this->mybb->settings['bburl'], $user_info['uid'], $activationcode); my_mail($user_info['email'], $emailsubject, $emailmessage); // Build the message to return $this->lang->redirect_registered_activation = $this->lang->sprintf($this->lang->redirect_registered_activation, $this->mybb->settings['bbname'], $user_info['username']); // Run whatever hook is defined at the end of a registration $this->plugins->run_hooks("member_do_register_end"); return $this->lang->redirect_registered_activation; } else { if ($this->mybb->settings['regtype'] == "randompass") { // Generate and send the email $emailsubject = $this->lang->sprintf($this->lang->emailsubject_randompassword, $this->mybb->settings['bbname']); $emailmessage = $this->lang->sprintf($this->lang->email_randompassword, $user['username'], $this->mybb->settings['bbname'], $user_info['username'], $user_info['password']); my_mail($user_info['email'], $emailsubject, $emailmessage); // Run whatever hook is defined at the end of a registration $this->plugins->run_hooks("member_do_register_end"); return $this->lang->redirect_registered_passwordsent; } else { if ($this->mybb->settings['regtype'] == "admin") { // Build the message to return $this->lang->redirect_registered_admin_activate = $this->lang->sprintf($this->lang->redirect_registered_admin_activate, $this->mybb->settings['bbname'], $user_info['username']); // Run whatever hook is defined at the end of a registration $this->plugins->run_hooks("member_do_register_end"); return $this->lang->redirect_registered_admin_activate; } else { // Build the message to return $this->lang->redirect_registered = $this->lang->sprintf($this->lang->redirect_registered, $this->mybb->settings['bbname'], $user_info['username']); // Run whatever hook is defined at the end of a registration $this->plugins->run_hooks('member_do_register_end'); return $this->lang->redirect_registered; } } } } }
function task_massmail($task) { global $db, $mybb, $lang; $query = $db->simple_select("massemails", "*", "senddate <= '" . TIME_NOW . "' AND status IN (1,2)"); while ($mass_email = $db->fetch_array($query)) { if ($mass_email['status'] == 1) { $db->update_query("massemails", array('status' => 2), "mid='{$mass_email['mid']}'", 1); } $sentcount = 0; if (!$mass_email['perpage']) { $mass_email['perpage'] = 50; } if (strpos($mass_email['htmlmessage'], '<br />') === false && strpos($mass_email['htmlmessage'], '<br>') === false) { $mass_email['htmlmessage'] = nl2br($mass_email['htmlmessage']); } $mass_email['orig_message'] = $mass_email['message']; $mass_email['orig_htmlmessage'] = $mass_email['htmlmessage']; // Need to perform the search to fetch the number of users we're emailing $member_query = build_mass_mail_query(unserialize($mass_email['conditions'])); $count_query = $db->simple_select("users u", "COUNT(uid) AS num", $member_query); $mass_email['totalcount'] = $db->fetch_field($count_query, "num"); $query2 = $db->simple_select("users u", "u.uid, u.language, u.pmnotify, u.lastactive, u.username, u.email", $member_query, array('limit_start' => $mass_email['sentcount'], 'limit' => $mass_email['perpage'], 'order_by' => 'u.uid', 'order_dir' => 'asc')); while ($user = $db->fetch_array($query2)) { $replacement_fields = array("{uid}" => $user['uid'], "{username}" => $user['username'], "{email}" => $user['email'], "{bbname}" => $mybb->settings['bbname'], "{bburl}" => $mybb->settings['bburl'], "[" . $lang->massmail_username . "]" => $user['username'], "[" . $lang->email_addr . "]" => $user['email'], "[" . $lang->board_name . "]" => $mybb->settings['bbname'], "[" . $lang->board_url . "]" => $mybb->settings['bburl']); foreach ($replacement_fields as $find => $replace) { $mass_email['message'] = str_replace($find, $replace, $mass_email['message']); $mass_email['htmlmessage'] = str_replace($find, $replace, $mass_email['htmlmessage']); } // Private Message if ($mass_email['type'] == 1) { $pm_handler = new PMDataHandler(); $pm_handler->admin_override = true; $pm = array("subject" => $mass_email['subject'], "message" => $mass_email['message'], "fromid" => $mass_email['uid'], "options" => array("savecopy" => 0)); $pm['to'] = explode(",", $user['username']); $pm_handler->set_data($pm); if (!$pm_handler->validate_pm()) { $friendly_errors = implode('\\n', $pm_handler->get_friendly_errors()); add_task_log($task, $lang->sprintf($lang->task_massmail_ran_errors, htmlspecialchars_uni($user['username']), $friendly_errors)); $friendly_errors = ""; } else { $pm_handler->insert_pm(); } } else { switch ($mass_email['format']) { case 2: $format = "both"; $text_message = $mass_email['message']; $mass_email['message'] = $mass_email['htmlmessage']; break; case 1: $format = "html"; $text_message = ""; $mass_email['message'] = $mass_email['htmlmessage']; break; default: $format = "text"; $text_message = ""; } my_mail($user['email'], $mass_email['subject'], $mass_email['message'], "", "", "", false, $format, $text_message); } ++$sentcount; $mass_email['message'] = $mass_email['orig_message']; $mass_email['htmlmessage'] = $mass_email['orig_htmlmessage']; } $update_array = array(); $update_array['sentcount'] = $mass_email['sentcount'] + $sentcount; $update_array['totalcount'] = $mass_email['totalcount']; if ($update_array['sentcount'] >= $mass_email['totalcount']) { $update_array['status'] = 3; } $db->update_query("massemails", $update_array, "mid='{$mass_email['mid']}'", 1); } add_task_log($task, $lang->task_massmail_ran); }
case "pgsql": case "sqlite3": case "sqlite2": $query = $db->query("\n\t\t\t\t\t\tSELECT u.username, u.email, u.receivepms, u.uid\n\t\t\t\t\t\tFROM " . TABLE_PREFIX . "users u\n\t\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "usergroups g ON (((','|| u.additionalgroups|| ',' LIKE '%,'|| g.gid|| ',%') OR u.usergroup = g.gid))\n\t\t\t\t\t\tWHERE (g.cancp=1 OR g.issupermod=1)\n\t\t\t\t\t"); break; default: $query = $db->query("\n\t\t\t\t\t\tSELECT u.username, u.email, u.receivepms, u.uid\n\t\t\t\t\t\tFROM " . TABLE_PREFIX . "users u\n\t\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "usergroups g ON (((CONCAT(',', u.additionalgroups, ',') LIKE CONCAT('%,', g.gid, ',%')) OR u.usergroup = g.gid))\n\t\t\t\t\t\tWHERE (g.cancp=1 OR g.issupermod=1)\n\t\t\t\t\t"); } } while ($mod = $db->fetch_array($query)) { $emailsubject = $lang->sprintf($lang->emailsubject_reportpost, $mybb->settings['bbname']); $emailmessage = $lang->sprintf($lang->email_reportpost, $mybb->user['username'], $mybb->settings['bbname'], $post['subject'], $mybb->settings['bburl'], str_replace('&', '&', get_post_link($post['pid'], $thread['tid']) . "#pid" . $post['pid']), $thread['subject'], $mybb->input['reason']); if ($mybb->settings['reportmethod'] == "pms" && $mod['receivepms'] != 0 && $mybb->settings['enablepms'] != 0) { $pm_recipients[] = $mod['uid']; } else { my_mail($mod['email'], $emailsubject, $emailmessage); } } if (count($pm_recipients) > 0) { $emailsubject = $lang->sprintf($lang->emailsubject_reportpost, $mybb->settings['bbname']); $emailmessage = $lang->sprintf($lang->email_reportpost, $mybb->user['username'], $mybb->settings['bbname'], $post['subject'], $mybb->settings['bburl'], str_replace('&', '&', get_post_link($post['pid'], $thread['tid']) . "#pid" . $post['pid']), $thread['subject'], $mybb->input['reason']); require_once MYBB_ROOT . "inc/datahandlers/pm.php"; $pmhandler = new PMDataHandler(); $pm = array("subject" => $emailsubject, "message" => $emailmessage, "icon" => 0, "fromid" => $mybb->user['uid'], "toid" => $pm_recipients); $pmhandler->admin_override = true; $pmhandler->set_data($pm); // Now let the pm handler do all the hard work. if (!$pmhandler->validate_pm()) { // Force it to valid to just get it out of here $pmhandler->is_validated = true; $pmhandler->errors = array();
/** * Emails the error in the specified error log file. * * @param string Warning type * @param string Warning message * @param string Warning file * @param integer Warning line */ function email_error($type, $message, $file, $line) { global $mybb; if (!$mybb->settings['adminemail']) { return false; } if ($type == MYBB_SQL) { $message = "SQL Error: {$message['error_no']} - {$message['error']}\nQuery: {$message['query']}"; } $message = "Your copy of MyBB running on {$mybb->settings['bbname']} ({$mybb->settings['bburl']}) has experienced an error. Details of the error include:\n---\nType: {$type}\nFile: {$file} (Line no. {$line})\nMessage\n{$message}"; @my_mail($mybb->settings['adminemail'], "MyBB error on {$mybb->settings['bbname']}", $message, $mybb->settings['adminemail']); }
if ($mybb->settings['contact_badwords'] == 1) { // Load the post parser require_once MYBB_ROOT . "inc/class_parser.php"; $parser = new postParser(); $parser_options = array('filter_badwords' => 1); $mybb->input['subject'] = $parser->parse_message($mybb->input['subject'], $parser_options); $mybb->input['message'] = $parser->parse_message($mybb->input['message'], $parser_options); } $user = $lang->na; if ($mybb->user['uid']) { $user = $mybb->user['username'] . ' - ' . $mybb->settings['bburl'] . '/' . get_profile_link($mybb->user['uid']); } $subject = $lang->sprintf($lang->email_contact_subject, $mybb->input['subject']); $message = $lang->sprintf($lang->email_contact, $mybb->input['email'], $user, $session->ipaddress, $mybb->input['message']); // Email the administrator my_mail($contactemail, $subject, $message, $mybb->input['email']); $plugins->run_hooks('contact_do_end'); if ($mybb->settings['mail_logging'] > 0) { // Log the message $log_entry = array("subject" => $db->escape_string($subject), "message" => $db->escape_string($message), "dateline" => TIME_NOW, "fromuid" => $mybb->user['uid'], "fromemail" => $db->escape_string($mybb->input['email']), "touid" => 0, "toemail" => $db->escape_string($contactemail), "tid" => 0, "ipaddress" => $db->escape_binary($session->packedip), "type" => 3); $db->insert_query("maillogs", $log_entry); } if ($mybb->usergroup['emailfloodtime'] > 0 || isset($sent_count) && $sent_count + 1 >= $mybb->usergroup['maxemails']) { redirect('index.php', $lang->contact_success_message, '', true); } else { redirect('contact.php', $lang->contact_success_message, '', true); } } else { $errors = inline_error($errors); } }