function lang_get_failsave_custom_field($p_custom_field_name) { if (lang_exists($p_custom_field_name, lang_get_current())) { $t_str = lang_get($p_custom_field_name); } else { $t_str = plugin_lang_get($p_custom_field_name); } return $t_str; }
/** * Get language: * - If found, return the appropriate string (as lang_get()). * - If not found, no default supplied, return the supplied string as is. * - If not found, default supplied, return default. * @param string $p_string * @param string $p_default * @param string $p_lang * @return string */ function lang_get_defaulted($p_string, $p_default = null, $p_lang = null) { $t_lang = $p_lang; if (null === $t_lang) { $t_lang = lang_get_current(); } # Now we'll make sure that the requested language is loaded lang_ensure_loaded($t_lang); if (lang_exists($p_string, $t_lang)) { return lang_get($p_string); } else { if (null === $p_default) { return $p_string; } else { return $p_default; } } }
/** * Initialize a single plugin. * @param string Plugin basename * @return boolean True if plugin initialized, false otherwise. */ function plugin_init($p_basename) { global $g_plugin_cache, $g_plugin_cache_init; # handle dependent plugins if (isset($g_plugin_cache[$p_basename])) { $t_plugin = $g_plugin_cache[$p_basename]; # hard dependencies; return false if the dependency is not registered, # does not meet the version requirement, or is not yet initialized. if (is_array($t_plugin->requires)) { foreach ($t_plugin->requires as $t_required => $t_version) { if (plugin_dependency($t_required, $t_version, true) !== 1) { return false; } } } # soft dependencies; only return false if the soft dependency is # registered, but not yet initialized. if (is_array($t_plugin->uses)) { foreach ($t_plugin->uses as $t_used => $t_version) { if (isset($g_plugin_cache[$t_used]) && !isset($g_plugin_cache_init[$t_used])) { return false; } } } # if plugin schema needs an upgrade, do not initialize if (plugin_needs_upgrade($t_plugin)) { return false; } plugin_push_current($p_basename); # load plugin error strings global $g_lang_strings; $t_lang = lang_get_current(); $t_plugin_errors = $t_plugin->errors(); foreach ($t_plugin_errors as $t_error_name => $t_error_string) { $t_error_code = "plugin_{$p_basename}_{$t_error_name}"; $g_lang_strings[$t_lang]['MANTIS_ERROR'][$t_error_code] = $t_error_string; } # finish initializing the plugin $t_plugin->__init(); $g_plugin_cache_init[$p_basename] = true; plugin_pop_current(); return true; } else { return false; } }
<tr> <td bgcolor="#f4f4f4"> <span class="title">Testing Email</span> <p>You can test the ability for Mantis to send email notifications with this form. Just click "Send Mail". If the page takes a very long time to reappear or results in an error then you will need to investigate your php/mail server settings (see PHPMailer related settings in your config_inc.php, if they don't exist, copy from config_defaults_inc.php). Note that errors can also appear in the server error log. More help can be found at the <a href="http://www.php.net/manual/en/ref.mail.php">PHP website</a> if you are using the mail() PHPMailer sending mode.</p> <?php if ($f_mail_test) { echo '<b><font color="#ff0000">Testing Mail</font></b> - '; # @@@ thraxisp - workaround to ensure a language is set without authenticating # will disappear when this is properly localized lang_push('english'); $t_email_data = new EmailData(); $t_email_data->email = config_get_global('administrator_email'); $t_email_data->subject = 'Testing PHP mail() function'; $t_email_data->body = 'Your PHP mail settings appear to be correctly set.'; $t_email_data->metadata['priority'] = config_get('mail_priority'); $t_email_data->metadata['charset'] = lang_get('charset', lang_get_current()); $result = email_send($t_email_data); #$result = email_send( config_get_global( 'administrator_email' ), 'Testing PHP mail() function', 'Your PHP mail settings appear to be correctly set.'); if (!$result) { echo ' PROBLEMS SENDING MAIL TO: ' . config_get_global('administrator_email') . '. Please check your php/mail server settings.<br />'; } else { echo ' mail() send successful.<br />'; } } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> #email"> Email Address: <?php echo config_get_global('administrator_email');
function custom_function_override_print_bug_view_page_custom_buttons($p_bug_id) { # Zuerst die lokalierten Buttontexte auslesen if (lang_get_current() === 'german') { $t_bfe_clone_issue_button = 'Klon in anderes Projekt...'; $t_bfe_edit_failure_class_button = 'Fehlerklasse bearbeiten...'; } else { $t_bfe_clone_issue_button = 'Clone To Other Project...'; $t_bfe_edit_failure_class_button = 'Edit Failure Class...'; } # Wenn Zugriff mindestens onsite developer, dann darf er Issues klonen if (access_has_project_level(50)) { echo '<td>'; html_button_bug_clone_to_project($p_bug_id, $t_bfe_clone_issue_button); echo '</td>'; } # Wenn Zugriff ändern von Fehlerklasse erlaubt, dann darf er sie ändern # Aber nur bis Status 'bestätigt' (40=confirmed) # Und nur für QS-Reporter (30) und ab Entwickler vor Ort (50) aufwärts if (custom_field_has_write_access(1, $p_bug_id)) { if (bug_get_field($p_bug_id, 'status') < 40) { if (access_compare_level(access_get_project_level(), array(30, 50, 55, 70, 90))) { echo '<td>'; $t_bfe_bugs[] = $p_bug_id; $t_src = relationship_get_all_src($p_bug_id); $t_src_count = count($t_src); $t_dest = relationship_get_all_dest($p_bug_id); $t_dest_count = count($t_dest); if ($t_src_count || $t_dest_count) { # Zunächst die Destination Bug IDs for ($x = 0; $x < $t_src_count; $x++) { $t_thisbugid = $t_src[$x]->dest_bug_id; if (access_has_bug_level(50, $t_thisbugid)) { $t_bfe_bugs[] = $t_thisbugid; } } # und jetzt die Source Bug IDs for ($y = 0; $y < $t_dest_count; $y++) { $t_thisbugid = $t_dest[$y]->src_bug_id; if (access_has_bug_level(50, $t_thisbugid)) { $t_bfe_bugs[] = $t_thisbugid; } } } if (count($t_bfe_bugs) > 1) { bfe_fehlerklasse_button('bug_actiongroup_page.php', $t_bfe_edit_failure_class_button, $t_bfe_bugs); } else { html_button('bug_actiongroup_page.php', $t_bfe_edit_failure_class_button, array('bug_arr[]' => $p_bug_id, 'action' => 'custom_field_1')); } echo '</td>'; } } } }
function email_store($p_recipient, $p_subject, $p_message, $p_headers = null) { $t_recipient = trim($p_recipient); $t_subject = string_email(trim($p_subject)); $t_message = string_email_links(trim($p_message)); # short-circuit if no recipient is defined, or email disabled # note that this may cause signup messages not to be sent if (is_blank($p_recipient) || OFF == config_get('enable_email_notification')) { return; } $t_email_data = new EmailData(); $t_email_data->email = $t_recipient; $t_email_data->subject = $t_subject; $t_email_data->body = $t_message; $t_email_data->metadata = array(); $t_email_data->metadata['headers'] = $p_headers === null ? array() : $p_headers; $t_email_data->metadata['priority'] = config_get('mail_priority'); # Urgent = 1, Not Urgent = 5, Disable = 0 $t_email_data->metadata['charset'] = lang_get('charset', lang_get_current()); $t_hostname = ''; $t_server = isset($_SERVER) ? $_SERVER : $HTTP_SERVER_VARS; if (isset($t_server['SERVER_NAME'])) { $t_hostname = $t_server['SERVER_NAME']; } else { $t_address = explode('@', config_get('from_email')); if (isset($t_address[1])) { $t_hostname = $t_address[1]; } } $t_email_data->metadata['hostname'] = $t_hostname; $t_email_id = email_queue_add($t_email_data); return $t_email_id; }
$s_Vorgaengerprozess_Voraussetzung = 'Vorgängerprozess/Voraussetzung'; $s_Aufgetreten_am = 'Aufgetreten am'; $s_Aufgetreten_um = 'Aufgetreten um'; $s_Wiedervorlage_am = 'Wiedervorlage am'; $s_Zu_erledigen_bis = 'Zu erledigen bis'; $s_Besprechung_am = 'Besprechung am'; $s_Kostentraeger = 'Kostenträger'; # email Notifications mit BFE-Anpassungen $s_email_notification_title_for_status_bug_acknowledged = 'Der folgende Eintrag ist in Bearbeitung.'; $s_email_notification_title_for_status_bug_assigned = 'Der folgende Eintrag ist in Behebung.'; $s_email_notification_title_for_status_bug_resolved = 'Der folgende Eintrag wurde behoben.'; $s_verify_change_password = '******'; # email notification string for new status bug in test $s_email_notification_title_for_status_bug_in_test = 'Der folgende Eintrag wurde behoben und ist nun zu testen.'; } if (lang_get_current() === 'english') { $s_status_enum_string = '10:new,20:feedback requested,30:in process,40:confirmed,50:issue solving,80:resolved,85:resolved and in test,90:closed'; $s_access_levels_enum_string = '10:viewer,25:reporter,30:qa-reporter,40:updater,50:onsite developer,55:developer,70:manager,90:administrator'; /* # bug_change_status_page.php $s_acknowledged_bug_title = 'Set Issue to In Process'; $s_acknowledged_bug_button = 'Set Issue to In Process'; $s_assigned_bug_title = 'Solve Issue'; $s_assigned_bug_button = 'Solve Issue'; */ #$s_in_test_bug_title = 'Set Issue to in Test'; $s_in_test_bug_title = 'Set Issue to resolved and in Test'; //LB/BFE 2015 geändert https://issuetracking.bfe.tv/view.php?id=18091 #$s_in_test_bug_button = 'Set Issue to in Test'; $s_in_test_bug_button = 'Set Issue to resolved and in Test'; # Custom Fields $s_Raum = 'Room';
function email_send($p_recipient, $p_subject, $p_message, $p_header = '', $p_category = '', $p_exit_on_error = true) { global $g_phpMailer_smtp; $t_recipient = trim($p_recipient); $t_subject = string_email(trim($p_subject)); $t_message = string_email_links(trim($p_message)); # short-circuit if no recipient is defined, or email disabled # note that this may cause signup messages not to be sent if (is_blank($p_recipient) || OFF == config_get('enable_email_notification')) { return; } # for debugging only #PRINT $t_recipient.'<br />'.$t_subject.'<br />'.$t_message.'<br />'.$t_headers; #exit; #PRINT '<br />xxxRecipient ='.$t_recipient.'<br />'; #PRINT 'Headers ='.nl2br($t_headers).'<br />'; #PRINT $t_subject.'<br />'; #PRINT nl2br($t_message).'<br />'; #exit; $t_debug_email = config_get('debug_email'); # Visit http://phpmailer.sourceforge.net # if you have problems with phpMailer $mail = new PHPMailer(); $mail->PluginDir = PHPMAILER_PATH; # @@@ should this be the current language (for the recipient) or the default one (for the user running the command) (thraxisp) $mail->SetLanguage(lang_get('phpmailer_language', lang_get_current()), PHPMAILER_PATH . 'language' . DIRECTORY_SEPARATOR); # Select the method to send mail switch (config_get('phpMailer_method')) { case 0: $mail->IsMail(); break; case 1: $mail->IsSendmail(); break; case 2: $mail->IsSMTP(); # SMTP collection is always kept alive # $mail->SMTPKeepAlive = true; # @@@ yarick123: It is said in phpMailer comments, that phpMailer::smtp has private access. # but there is no common method to reset PHPMailer object, so # I see the smallest evel - to initialize only one 'private' # field phpMailer::smtp in order to reuse smtp connection. if (is_null($g_phpMailer_smtp)) { register_shutdown_function('email_smtp_close'); } else { $mail->smtp = $g_phpMailer_smtp; } break; } $mail->IsHTML(false); # set email format to plain text $mail->WordWrap = 80; # set word wrap to 50 characters $mail->Priority = config_get('mail_priority'); # Urgent = 1, Not Urgent = 5, Disable = 0 $mail->CharSet = lang_get('charset', lang_get_current()); $mail->Host = config_get('smtp_host'); $mail->From = config_get('from_email'); $mail->Sender = config_get('return_path_email'); $mail->FromName = ''; if (!is_blank(config_get('smtp_username'))) { # Use SMTP Authentication $mail->SMTPAuth = true; $mail->Username = config_get('smtp_username'); $mail->Password = config_get('smtp_password'); } $t_debug_to = ''; # add to the Recipient list $t_recipient_list = split(',', $t_recipient); while (list(, $t_recipient) = each($t_recipient_list)) { if (!is_blank($t_recipient)) { if (OFF === $t_debug_email) { $mail->AddAddress($t_recipient, ''); } else { $t_debug_to .= !is_blank($t_debug_to) ? ', ' : ''; $t_debug_to .= $t_recipient; } } } # add to the BCC list $t_debug_bcc = ''; $t_bcc_list = split(',', $p_header); while (list(, $t_bcc) = each($t_bcc_list)) { if (!is_blank($t_bcc)) { if (OFF === $t_debug_email) { $mail->AddBCC($t_bcc, ''); } else { $t_debug_bcc .= !is_blank($t_debug_bcc) ? ', ' : ''; $t_debug_bcc .= $t_bcc; } } } if (OFF !== $t_debug_email) { $t_message = "\n" . $t_message; if (!is_blank($t_debug_bcc)) { $t_message = 'Bcc: ' . $t_debug_bcc . "\n" . $t_message; } if (!is_blank($t_debug_to)) { $t_message = 'To: ' . $t_debug_to . "\n" . $t_message; } $mail->AddAddress($t_debug_email, ''); } $mail->Subject = $t_subject; $mail->Body = make_lf_crlf("\n" . $t_message); if (EMAIL_CATEGORY_PROJECT_CATEGORY == config_get('email_set_category')) { $mail->AddCustomHeader("Keywords: {$p_category}"); } if (!$mail->Send()) { print "PROBLEMS SENDING MAIL TO: {$p_recipient}<br />"; print 'Mailer Error: ' . $mail->ErrorInfo . '<br />'; if ($p_exit_on_error) { exit; } else { return false; } } if (!is_null($mail->smtp)) { # @@@ yarick123: It is said in phpMailer comments, that phpMailer::smtp has private access. # but there is no common method to reset PHPMailer object, so # I see the smallest evel - to initialize only one 'private' # field phpMailer::smtp in order to reuse smtp connection. $g_phpMailer_smtp = $mail->smtp; } return true; }