Beispiel #1
0
function lang_get_default()
{
    global $g_active_language;
    $t_lang = false;
    # Confirm that the user's language can be determined
    if (auth_is_user_authenticated()) {
        $t_lang = user_pref_get_language(auth_get_current_user_id());
    }
    # Otherwise fall back to default
    if (false === $t_lang) {
        $t_lang = config_get('default_language');
    }
    if ('auto' == $t_lang) {
        $t_lang = lang_map_auto();
    }
    # Remember the language
    $g_active_language = $t_lang;
    return $t_lang;
}
}
# if the user is already protected and the admin is not removing the
#  protected flag then don't update the access level and enabled flag.
#  If the user was unprotected or the protected flag is being turned off
#  then proceed with a full update.
$query_params = array();
if ($f_protected && $t_old_protected) {
    $query = "UPDATE {$t_user_table}\n\t\t\tSET username="******", email=" . db_param() . ",\n\t\t\t\tprotected=" . db_param() . ", realname=" . db_param() . "\n\t\t\tWHERE id=" . db_param();
    $query_params = array($c_username, $c_email, $c_protected, $c_realname, $c_user_id);
} else {
    $query = "UPDATE {$t_user_table}\n\t\t\tSET username="******", email=" . db_param() . ",\n\t\t\t\taccess_level=" . db_param() . ", enabled=" . db_param() . ",\n\t\t\t\tprotected=" . db_param() . ", realname=" . db_param() . "\n\t\t\tWHERE id=" . db_param();
    $query_params = array($c_username, $c_email, $c_access_level, $c_enabled, $c_protected, $c_realname, $c_user_id);
}
$result = db_query_bound($query, $query_params);
if ($f_send_email_notification) {
    lang_push(user_pref_get_language($f_user_id));
    $t_changes = "";
    if (strcmp($f_username, $t_old_username)) {
        $t_changes .= lang_get('username_label') . lang_get('word_separator') . $t_old_username . ' => ' . $f_username . "\n";
    }
    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";
    }
Beispiel #3
0
/**
 * Send a bug reminder to the given user(s), or to each user if the first parameter is an array
 *
 * @param int|array $p_recipients user id or list of user ids array to send reminder to
 * @param int $p_bug_id Issue for which the reminder is sent
 * @param string $p_message Optional message to add to the e-mail
 * @return array List of users ids to whom the reminder e-mail was actually sent
 */
function email_bug_reminder($p_recipients, $p_bug_id, $p_message)
{
    if (!is_array($p_recipients)) {
        $p_recipients = array($p_recipients);
    }
    $t_project_id = bug_get_field($p_bug_id, 'project_id');
    $t_sender_id = auth_get_current_user_id();
    $t_sender = user_get_name($t_sender_id);
    $t_subject = email_build_subject($p_bug_id);
    $t_date = date(config_get('normal_date_format'));
    $result = array();
    foreach ($p_recipients as $t_recipient) {
        lang_push(user_pref_get_language($t_recipient, $t_project_id));
        $t_email = user_get_email($t_recipient);
        if (access_has_project_level(config_get('show_user_email_threshold'), $t_project_id, $t_recipient)) {
            $t_sender_email = ' <' . user_get_email($t_sender_id) . '>';
        } else {
            $t_sender_email = '';
        }
        $t_header = "\n" . lang_get('on_date') . " {$t_date}, {$t_sender} {$t_sender_email} " . lang_get('sent_you_this_reminder_about') . ": \n\n";
        $t_contents = $t_header . string_get_bug_view_url_with_fqdn($p_bug_id, $t_recipient) . " \n\n{$p_message}";
        if (ON == config_get('enable_email_notification')) {
            $t_id = email_store($t_email, $t_subject, $t_contents);
            if ($t_id !== null) {
                $result[] = $t_recipient;
            }
            log_event(LOG_EMAIL, "queued reminder email #{$t_id} for U{$t_recipient}");
        }
        lang_pop();
    }
    if (OFF == config_get('email_send_using_cronjob')) {
        email_send_all();
    }
    return $result;
}
function formatBugEntry($data)
{
    lang_push(user_pref_get_language($data['handler_id']));
    $p_visible_bug_data = $data;
    $p_visible_bug_data['email_project'] = project_get_name($data['project_id']);
    $p_visible_bug_data['email_category'] = category_get_name($data['category_id']);
    $t_email_separator1 = config_get('email_separator1');
    $t_email_separator2 = config_get('email_separator2');
    $p_visible_bug_data['email_bug'] = $data['id'];
    $p_visible_bug_data['email_status'] = get_enum_element('status', $p_visible_bug_data['status'], $data['handler_id'], $data['project_id']);
    $p_visible_bug_data['email_severity'] = get_enum_element('severity', $p_visible_bug_data['severity']);
    $p_visible_bug_data['email_priority'] = get_enum_element('priority', $p_visible_bug_data['priority']);
    $p_visible_bug_data['email_reproducibility'] = get_enum_element('reproducibility', $p_visible_bug_data['reproducibility']);
    $p_visible_bug_data['email_summary'] = $data['summary'];
    $t_message = $t_email_separator1 . " \n";
    $t_message .= string_get_bug_view_url_with_fqdn($data['id'], $data['handler_id']) . " \n";
    $t_message .= $t_email_separator1 . " \n";
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_project');
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_bug');
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_category');
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_priority');
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_status');
    $t_message .= $t_email_separator1 . " \n";
    $t_message .= email_format_attribute($p_visible_bug_data, 'email_summary');
    $t_message .= $t_email_separator1 . " \n\n\n";
    return $t_message;
}
Beispiel #5
0
/**
 * Send a notification to user or set of users that were mentioned in an issue
 * or an issue note.
 *
 * @param integer       $p_bug_id     Issue for which the reminder is sent.
 * @param array         $p_mention_user_ids User id or list of user ids array.
 * @param string        $p_message    Optional message to add to the e-mail.
 * @param array         $p_removed_mention_user_ids  The users that were removed due to lack of access.
 * @return array List of users ids to whom the reminder e-mail was actually sent
 */
function email_user_mention($p_bug_id, $p_mention_user_ids, $p_message, $p_removed_mention_user_ids = array())
{
    if (OFF == config_get('enable_email_notification')) {
        log_event(LOG_EMAIL_VERBOSE, 'email notifications disabled.');
        return array();
    }
    $t_project_id = bug_get_field($p_bug_id, 'project_id');
    $t_sender_id = auth_get_current_user_id();
    $t_sender = user_get_name($t_sender_id);
    $t_subject = email_build_subject($p_bug_id);
    $t_date = date(config_get('normal_date_format'));
    $t_user_id = auth_get_current_user_id();
    $t_users_processed = array();
    foreach ($p_removed_mention_user_ids as $t_removed_mention_user_id) {
        log_event(LOG_EMAIL_VERBOSE, 'skipped mention email for U' . $t_removed_mention_user_id . ' (no access to issue or note).');
    }
    $t_result = array();
    foreach ($p_mention_user_ids as $t_mention_user_id) {
        # Don't trigger mention emails for self mentions
        if ($t_mention_user_id == $t_user_id) {
            log_event(LOG_EMAIL_VERBOSE, 'skipped mention email for U' . $t_mention_user_id . ' (self-mention).');
            continue;
        }
        # Don't process a user more than once
        if (isset($t_users_processed[$t_mention_user_id])) {
            continue;
        }
        $t_users_processed[$t_mention_user_id] = true;
        # Don't email mention notifications to disabled users.
        if (!user_is_enabled($t_mention_user_id)) {
            continue;
        }
        lang_push(user_pref_get_language($t_mention_user_id, $t_project_id));
        $t_email = user_get_email($t_mention_user_id);
        if (access_has_project_level(config_get('show_user_email_threshold'), $t_project_id, $t_mention_user_id)) {
            $t_sender_email = ' <' . user_get_email($t_sender_id) . '> ';
        } else {
            $t_sender_email = '';
        }
        $t_complete_subject = sprintf(lang_get('mentioned_in'), $t_subject);
        $t_header = "\n" . lang_get('on_date') . ' ' . $t_date . ', ' . $t_sender . ' ' . $t_sender_email . lang_get('mentioned_you') . "\n\n";
        $t_contents = $t_header . string_get_bug_view_url_with_fqdn($p_bug_id) . " \n\n" . $p_message;
        $t_id = email_store($t_email, $t_complete_subject, $t_contents);
        if ($t_id !== null) {
            $t_result[] = $t_mention_user_id;
        }
        log_event(LOG_EMAIL_VERBOSE, 'queued mention email ' . $t_id . ' for U' . $t_mention_user_id);
        lang_pop();
    }
    return $t_result;
}
require_once AGILEMANTIS_CORE_URI . 'config_api.php';
$_COOKIE[$g_cookie_prefix . '_STRING_COOKIE'] = $_POST['cookie_string'];
// Zugriff auf die Mantis Funktionen
//require_once ($mantisPath . 'core.php');
// Lade die Konfigurationsdatei und stelle die Datenbankverbindung her
// Zugriff auf die agileMantis Funktionen
if ($_POST['timezone']) {
    date_default_timezone_set($_POST['timezone']);
}
ob_end_clean();
if ($_POST['user']) {
    $sitekey = $agilemantis_tasks->getConfigValue('plugin_agileMantis_gadiv_sitekey');
    $heute = mktime(0, 0, 0, date('m'), date('d'), date('y'));
    $generatedKey = md5($sitekey . $heute);
    $user_id = $_POST['user'];
    $language = user_pref_get_language($user_id);
    lang_load($language, $mantisBtPath . 'plugins' . DIRECTORY_SEPARATOR . 'agileMantis' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR);
    lang_push($language);
    // Load language stuff
    if ($language == 'german') {
        require_once $mantisBtPath . 'lang' . DIRECTORY_SEPARATOR . 'strings_german.txt';
        require_once $mantisBtPath . 'plugins' . DIRECTORY_SEPARATOR . 'agileMantis' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . 'strings_german.txt';
    } else {
        require_once $mantisBtPath . 'lang' . DIRECTORY_SEPARATOR . 'strings_english.txt';
        require_once $mantisBtPath . 'plugins' . DIRECTORY_SEPARATOR . 'agileMantis' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . 'strings_english.txt';
    }
    if ($_POST['event'] == 'checkIdentity') {
        if ($generatedKey == $_POST['appletkey']) {
            echo true;
        } else {
            echo false;