function email_group_reminder($p_user_id, $issues) { $t_username = user_get_field($p_user_id, 'username'); $t_email = user_get_email($p_user_id); $t_message = $issues; $t_subject = config_get('plugin_Reminder_reminder_subject'); if (!is_blank($t_email)) { email_store($t_email, $t_subject, $t_message); if (OFF == config_get('email_send_using_cronjob')) { email_send_all(); } } }
if (strcmp($t_realname, $t_old_realname)) { $t_changes .= lang_get('realname_label') . lang_get('word_separator') . $t_old_realname . ' => ' . $t_realname . "\n"; } if (strcmp($t_email, $t_old_email)) { $t_changes .= lang_get('email_label') . lang_get('word_separator') . $t_old_email . ' => ' . $t_email . "\n"; } if (strcmp($f_access_level, $t_old_access_level)) { $t_old_access_string = get_enum_element('access_levels', $t_old_access_level); $t_new_access_string = get_enum_element('access_levels', $f_access_level); $t_changes .= lang_get('access_level_label') . lang_get('word_separator') . $t_old_access_string . ' => ' . $t_new_access_string . "\n\n"; } if (!empty($t_changes)) { $t_subject = '[' . config_get('window_title') . '] ' . lang_get('email_user_updated_subject'); $t_updated_msg = lang_get('email_user_updated_msg'); $t_message = $t_updated_msg . "\n\n" . config_get('path') . 'account_page.php' . "\n\n" . $t_changes; email_store($t_email, $t_subject, $t_message); log_event(LOG_EMAIL, sprintf('Account update notification sent to ' . $f_username . ' (' . $t_email . ')')); if (config_get('email_send_using_cronjob') == OFF) { email_send_all(); } } lang_pop(); } $t_redirect_url = 'manage_user_edit_page.php?user_id=' . $c_user_id; form_security_purge('manage_user_update'); html_page_top(null, $result ? $t_redirect_url : null); if ($f_protected && $t_old_protected) { # PROTECTED echo '<div class="failure-msg">'; echo lang_get('manage_user_protected_msg') . '<br />'; print_bracket_link($t_redirect_url, lang_get('proceed'));
/** * Send bug info to given user * return true on success * @param array $p_visible_bug_data * @param string $p_message_id * @param int $p_project_id * @param int $p_user_id * @param array $p_header_optional_params * @return bool */ function email_bug_info_to_one_user($p_visible_bug_data, $p_message_id, $p_project_id, $p_user_id, $p_header_optional_params = null) { $t_user_email = user_get_email($p_user_id); # check whether email should be sent # @@@ can be email field empty? if yes - then it should be handled here if (ON !== config_get('enable_email_notification') || is_blank($t_user_email)) { return true; } # build subject $t_subject = '[' . $p_visible_bug_data['email_project'] . ' ' . bug_format_id($p_visible_bug_data['email_bug']) . ']: ' . $p_visible_bug_data['email_summary']; # build message $t_message = lang_get_defaulted($p_message_id, null); if (is_array($p_header_optional_params)) { $t_message = vsprintf($t_message, $p_header_optional_params); } if ($t_message !== null && !is_blank($t_message)) { $t_message .= " \n"; } $t_message .= email_format_bug_message($p_visible_bug_data); # build headers $t_bug_id = $p_visible_bug_data['email_bug']; $t_message_md5 = md5($t_bug_id . $p_visible_bug_data['email_date_submitted']); $t_mail_headers = array('keywords' => $p_visible_bug_data['set_category']); if ($p_message_id == 'email_notification_title_for_action_bug_submitted') { $t_mail_headers['Message-ID'] = $t_message_md5; } else { $t_mail_headers['In-Reply-To'] = $t_message_md5; } # send mail $t_ok = email_store($t_user_email, $t_subject, $t_message, $t_mail_headers); return $t_ok; }
if (strcmp($t_realname, $t_old_realname)) { $t_changes .= lang_get('realname') . ': ' . $t_old_realname . ' => ' . $t_realname . "\n"; } if (strcmp($t_email, $t_old_email)) { $t_changes .= lang_get('email') . ': ' . $t_old_email . ' => ' . $t_email . "\n"; } if (strcmp($f_access_level, $t_old_access_level)) { $t_old_access_string = get_enum_element('access_levels', $t_old_access_level); $t_new_access_string = get_enum_element('access_levels', $f_access_level); $t_changes .= lang_get('access_level') . ': ' . $t_old_access_string . ' => ' . $t_new_access_string . "\n\n"; } if (!empty($t_changes)) { $t_subject = '[' . config_get('window_title') . '] ' . lang_get('email_user_updated_subject'); $t_updated_msg = lang_get('email_user_updated_msg'); $t_message = $t_updated_msg . "\n\n" . config_get('path') . 'account_page.php' . "\n\n" . $t_changes; if (null === email_store($t_email, $t_subject, $t_message)) { log_event(LOG_EMAIL, sprintf('Notification was NOT sent to ' . $f_username)); } else { log_event(LOG_EMAIL, sprintf('Account update notification sent to ' . $f_username . ' (' . $t_email . ')')); if (config_get('email_send_using_cronjob') == OFF) { email_send_all(); } } } lang_pop(); } $t_redirect_url = 'manage_user_edit_page.php?user_id=' . $c_user_id; form_security_purge('manage_user_update'); html_page_top(null, $result ? $t_redirect_url : null); ?>
/** * Send bug info to given user * return true on success * @param array $p_visible_bug_data * @param string $p_message_id * @param int $p_project_id * @param int $p_user_id * @param array $p_header_optional_params * @return bool */ function email_bug_info_to_one_user($p_visible_bug_data, $p_message_id, $p_project_id, $p_user_id, $p_header_optional_params = null) { $t_user_email = user_get_email($p_user_id); # check whether email should be sent # @@@ can be email field empty? if yes - then it should be handled here if (ON !== config_get('enable_email_notification') || is_blank($t_user_email)) { return true; } # busco el tipo de usuario que es $access_level = ''; $query = 'SELECT access_level FROM mantis_user_table WHERE id = ' . $p_user_id; $access_level = db_query_bound($query); $access_level = db_result($access_level); $user_information = '<br>'; if ($access_level == 90) { // administrador $user_information .= 'administrador'; } else { if ($access_level == 55) { // desarrollador - médico $user_information .= 'medico'; } else { if ($access_level == 25) { // informador - usuario $user_information .= 'usuario'; } } } # build subject //$t_subject = '[' . $p_visible_bug_data['email_project'] . ' ' . bug_format_id( $p_visible_bug_data['email_bug'] ) . ']: ' . $p_visible_bug_data['email_summary']; $t_subject = '[Medicnexus]: ' . lang_project_name($p_visible_bug_data['email_project']); # build message # se agrega el encabezado del mensaje $t_message = lang_get('tpl_mn_email_header'); $t_message .= lang_get_defaulted($p_message_id, null); if (is_array($p_header_optional_params)) { $t_message = vsprintf($t_message, $p_header_optional_params); } if ($t_message !== null && !is_blank($t_message)) { $t_message .= " <br>"; } //$t_message .= email_format_bug_message( $p_visible_bug_data ); // se agrega la información relacionada con los datos de la incidencia. $t_message .= email_format_bug_message_medicnexus($p_visible_bug_data); // se agrega la información adicional correspondiente al tipo de usuario. $t_message .= " <br>" . $user_information; # se colocal final del formato del mensaje $t_message .= lang_get('tpl_mn_email_footer'); # build headers $t_bug_id = $p_visible_bug_data['email_bug']; $t_message_md5 = md5($t_bug_id . $p_visible_bug_data['email_date_submitted']); $t_mail_headers = array('keywords' => $p_visible_bug_data['set_category']); if ($p_message_id == 'email_notification_title_for_action_bug_submitted') { $t_mail_headers['Message-ID'] = $t_message_md5; } else { $t_mail_headers['In-Reply-To'] = $t_message_md5; } # send mail $t_ok = email_store($t_user_email, $t_subject, $t_message, $t_mail_headers); return $t_ok; }
/** * Send bug info to given user * return true on success * @param array $p_visible_bug_data * @param string $p_message_id * @param int $p_project_id * @param int $p_user_id * @param array $p_header_optional_params * @return bool */ function email_bug_info_to_one_user($p_visible_bug_data, $p_message_id, $p_project_id, $p_user_id, $p_header_optional_params = null) { $t_user_email = user_get_email($p_user_id); # check whether email should be sent # @@@ can be email field empty? if yes - then it should be handled here if (ON !== config_get('enable_email_notification') || is_blank($t_user_email)) { return true; } # build subject $t_subject = email_build_subject($p_visible_bug_data['email_bug']); # build message $t_message = lang_get_defaulted($p_message_id, null); if (is_array($p_header_optional_params)) { $t_message = vsprintf($t_message, $p_header_optional_params); } if ($t_message !== null && !is_blank($t_message)) { $t_message .= " \n"; } $t_message .= email_format_bug_message($p_visible_bug_data); # build headers $t_bug_id = $p_visible_bug_data['email_bug']; $t_message_md5 = md5($t_bug_id . $p_visible_bug_data['email_date_submitted']); $t_mail_headers = array('keywords' => $p_visible_bug_data['set_category']); if ($p_message_id == 'email_notification_title_for_action_bug_submitted') { $t_mail_headers['Message-ID'] = $t_message_md5; } else { $t_mail_headers['In-Reply-To'] = $t_message_md5; } # send mail $t_ok = email_store($t_user_email, $t_subject, $t_message, $t_mail_headers); #LB/BFE: hook for plugin getting additional cc email for $p_user_id and sending email via email store $t_cc_ok = event_signal('EVENT_SEND_EMAIL_TO_CC_ADDRESS', array($p_user_id, $t_subject, $t_message, $t_mail_headers, $p_project_id)); #$t_recipients_include_data = event_signal( 'EVENT_NOTIFY_USER_INCLUDE', array( $p_bug_id, $p_notify_type ) ); return $t_ok; }
$results = db_query_bound($query); if (!$results) { echo 'Query failed.'; exit(1); } # Loop through all assigned bugs, building a list of what to email $emails = array(); while ($row = db_fetch_array($results)) { # New recipient if (!isset($emails[$row['handler_id']])) { $emails[$row['handler_id']] = array('recipient' => array('email' => $row['email'], 'name' => $row['realname']), 'bugs' => array()); } # Add current bug to this recipient's list $emails[$row['handler_id']]['bugs'][$row['bug_id']] = $row['summary']; } # Construct and send emails foreach ($emails as $email) { # Build list of issues with summary and link $list = ''; foreach ($email['bugs'] as $bug_id => $summary) { $url = string_get_bug_view_url_with_fqdn($bug_id); $list .= " * {$summary}\n {$url}\n"; } # Queue email for sending (and send it, if cron sending is disabled) $message = "Assigned to " . $email['recipient']['name'] . ":\n\n{$list}\n"; $subject = config_get('plugin_Reminder_reminder_subject'); email_store($email['recipient']['email'], $subject, $message); if (OFF == config_get('email_send_using_cronjob')) { email_send_all(); } }