/** * Get username, realname and email from for a given user id * @param integer $p_user_id A valid user identifier. * @return array */ function mci_account_get_array_by_id($p_user_id) { $t_result = array(); $t_result['id'] = $p_user_id; if (user_exists($p_user_id)) { $t_current_user_id = auth_get_current_user_id(); $t_access_level = user_get_field($t_current_user_id, 'access_level'); $t_can_manage = access_has_global_level(config_get('manage_user_threshold')) && access_has_global_level($t_access_level); # this deviates from the behaviour of view_user_page.php, but it is more intuitive $t_is_same_user = $t_current_user_id === $p_user_id; $t_can_see_realname = access_has_project_level(config_get('show_user_realname_threshold')); $t_can_see_email = access_has_project_level(config_get('show_user_email_threshold')); $t_result['name'] = user_get_field($p_user_id, 'username'); if ($t_is_same_user || $t_can_manage || $t_can_see_realname) { $t_realname = user_get_realname($p_user_id); if (!empty($t_realname)) { $t_result['real_name'] = $t_realname; } } if ($t_is_same_user || $t_can_manage || $t_can_see_email) { $t_email = user_get_email($p_user_id); if (!empty($t_email)) { $t_result['email'] = $t_email; } } } return $t_result; }
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(); } } }
/** * Builds notification emails for the selected customers about changes made in bugs reports they are linked to * * @param array $customer_ids the ids of the customer to notify * @param string $from the start of the interval * @param string $to the end of the interval * * @return array notified customers */ static function buildNotificationEmails($customer_ids, $from, $to) { $emails = array(); lang_push(plugin_config_get('email_notification_language')); $fromDate = self::startOfDay(strtotime($from)); $toDate = self::endOfDay(strtotime($to)); $changedBugIds = CustomerManagementDao::findAllChangedBugIds($customer_ids, $fromDate, $toDate); $dateFormat = config_get('short_date_format'); foreach ($customer_ids as $customer_id) { $changesForCustomer = array(); foreach ($changedBugIds as $changedBugId) { if ($changedBugId['customer_id'] == $customer_id) { $changesForCustomer[] = array('bug' => bug_get($changedBugId['bug_id'])); } } if (count($changesForCustomer) > 0) { $counter = 0; $text = ''; foreach ($changesForCustomer as $changeForCustomer) { $counter++; $bugId = $changeForCustomer['bug']->id; $text .= $counter . '. '; $text .= sprintf(plugin_lang_get('email_notification_bug_header'), $changeForCustomer['bug']->id, $changeForCustomer['bug']->summary, date($dateFormat, $changeForCustomer['bug']->date_submitted), get_enum_element('status', $changeForCustomer['bug']->status)); $text .= "\n"; $reporterName = user_get_name($changeForCustomer['bug']->reporter_id); $reporterEmail = user_get_email($changeForCustomer['bug']->reporter_id); $text .= sprintf(plugin_lang_get('email_notification_bug_reported_by'), $reporterName, $reporterEmail); $text .= "\n"; $text .= sprintf(plugin_lang_get('email_notification_bug_description'), $changeForCustomer['bug']->description); $text .= "\n\n"; } $customer = CustomerManagementDao::getCustomer($customer_id); $email = new EmailData(); $email->email = $customer['email']; $email->subject = sprintf(plugin_lang_get('email_notification_title'), $customer['name'], $from, $to); $email->body = $text; $email->metadata['priority'] = config_get('mail_priority'); $email->metadata['charset'] = 'utf-8'; array_push($emails, $email); } } lang_pop(); return $emails; }
function prepare_user_name($p_user_id) { # Catch a user_id of NO_USER (like when a handler hasn't been assigned) if (NO_USER == $p_user_id) { return ''; } $t_username = user_get_name($p_user_id); if (user_exists($p_user_id) && user_get_field($p_user_id, 'enabled')) { $t_email = user_get_email($p_user_id); if (!is_blank($t_email)) { return prepare_email_link($t_email, $t_username); } else { return string_display($t_username); } } else { $t_result = '<font STYLE="text-decoration: line-through">'; $t_result .= string_display($t_username); $t_result .= '</font>'; return $t_result; } }
require_api('print_api.php'); require_api('string_api.php'); require_api('user_api.php'); require_api('utility_api.php'); auth_ensure_user_authenticated(); # extracts the user information for the currently logged in user # and prefixes it with u_ $f_user_id = gpc_get_int('id', auth_get_current_user_id()); $row = user_get_row($f_user_id); extract($row, EXTR_PREFIX_ALL, 'u'); $t_can_manage = access_has_global_level(config_get('manage_user_threshold')) && access_has_global_level($u_access_level); $t_can_see_realname = access_has_project_level(config_get('show_user_realname_threshold')); $t_can_see_email = access_has_project_level(config_get('show_user_email_threshold')); # In case we're using LDAP to get the email address... this will pull out # that version instead of the one in the DB $u_email = user_get_email($u_id); $u_realname = user_get_realname($u_id); html_page_top(); ?> <br /> <div align="center"> <table class="width75" cellspacing="1"> <tr> <td class="form-title"> <?php echo lang_get('view_account_title'); ?> </td> </tr> <tr <?php
/** * 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; }
function print_user_with_subject($p_user_id, $p_bug_id) { $c_user_id = db_prepare_int($p_user_id); if (NO_USER == $p_user_id) { return; } $t_username = user_get_name($p_user_id); if (user_exists($p_user_id) && user_get_field($p_user_id, 'enabled')) { $t_email = user_get_email($p_user_id); print_email_link_with_subject($t_email, $t_username, $p_bug_id); } else { echo '<span style="text-decoration: line-through">'; echo $t_username; echo '</span>'; } }
$t_removable_users_exist = false; for ($i = 0; $i < $t_users_count; $i++) { $t_user = $t_users[$i]; ?> <tr <?php echo helper_alternate_class(); ?> > <td> <?php echo $t_display[$i]; ?> </td> <td> <?php $t_email = user_get_email($t_user['id']); print_email_link($t_email, $t_email); ?> </td> <td> <?php echo get_enum_element('access_levels', $t_user['access_level']); ?> </td> <td class="center"> <?php # You need global or project-specific permissions to remove users # from this project if ($t_can_manage_users && access_has_project_level($t_user['access_level'], $f_project_id)) { if (project_includes_user($f_project_id, $t_user['id'])) { print_button("manage_proj_user_remove.php?project_id={$f_project_id}&user_id=" . $t_user['id'], lang_get('remove_link'));
<!-- Email --> <tr <?php echo helper_alternate_class(); ?> > <td class="category"> <?php echo lang_get('email'); ?> </td> <td> <?php // With LDAP if ($t_ldap && ON == config_get('use_ldap_email')) { echo string_display_line(user_get_email($t_user_id)); } else { print_email_input('email', $t_user['email']); } ?> </td> </tr> <!-- Access Level --> <tr <?php echo helper_alternate_class(); ?> > <td class="category"> <?php echo lang_get('access_level');
/** * Return the user avatar image URL * in this first implementation, only gravatar.com avatars are supported * @return array|bool an array( URL, width, height ) or false when the given user has no avatar */ function user_get_avatar($p_user_id) { $t_email = strtolower(user_get_email($p_user_id)); if (is_blank($t_email)) { $t_result = false; } else { $t_default_image = config_get('default_avatar'); $t_size = 80; $t_use_ssl = false; if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') { $t_use_ssl = true; } if (!$t_use_ssl) { $t_gravatar_domain = 'http://www.gravatar.com/'; } else { $t_gravatar_domain = 'https://secure.gravatar.com/'; } $t_avatar_url = $t_gravatar_domain . 'avatar.php?gravatar_id=' . md5($t_email) . '&default=' . urlencode($t_default_image) . '&size=' . $t_size . '&rating=G'; $t_result = array($t_avatar_url, $t_size, $t_size); } return $t_result; }
require_once 'core.php'; require_once 'current_user_api.php'; $t_use_gravatar = config_get('use_gravatar', false, auth_get_current_user_id(), ALL_PROJECTS); #============ Parameters ============ # (none) #============ Permissions ============ auth_ensure_user_authenticated(); current_user_ensure_unprotected(); # extracts the user information for the currently logged in user # and prefixes it with u_ $row = user_get_row(auth_get_current_user_id()); extract($row, EXTR_PREFIX_ALL, 'u'); $t_ldap = LDAP == config_get('login_method'); # In case we're using LDAP to get the email address... this will pull out # that version instead of the one in the DB $u_email = user_get_email($u_id, $u_username); # note if we are being included by a script of a different name, if so, # this is a mandatory password change request $t_force_pw_reset = is_page_name('verify.php'); # Only show the update button if there is something to update. $t_show_update_button = false; html_page_top(lang_get('account_link')); ?> <!-- # Edit Account Form BEGIN --> <br /> <?php if ($t_force_pw_reset) { ?> <center><div style="color:red; width:75%"> <?php
/** * 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; }
<!-- Email --> <tr <?php echo helper_alternate_class(); ?> > <th class="category"> <?php echo lang_get('email_label'); ?> </th> <td> <?php if (!$t_ldap || config_get('use_ldap_email') == OFF) { print_email_input('email', $t_user['email']); } else { echo string_display(user_get_email($f_user_id)); } ?> </td> </tr> <!-- Access Level --> <tr <?php echo helper_alternate_class(); ?> > <th class="category"> <?php echo lang_get('access_level_label'); ?> </th>
} } // Get reporter if (plugin_config_get('notify_reporter', PLUGINS_RELEASEMGT_NOTIFY_REPORTER_DEFAULT) == ON) { if ($t_version == 0) { $t_query = 'SELECT reporter_id FROM ' . db_get_table('mantis_bug_table') . ' WHERE project_id=' . db_prepare_int($t_project_id) . ' AND fixed_in_version=\'\''; } else { $t_query = 'SELECT reporter_id FROM ' . db_get_table('mantis_bug_table') . ' WHERE project_id=' . db_prepare_int($t_project_id) . ' AND fixed_in_version=\'' . db_prepare_string(version_get_field($t_version, 'version')) . '\''; } $t_result = db_query($t_query); while ($t_row = db_fetch_array($t_result)) { $t_id_list[] = $t_row['reporter_id']; } } for ($i = 0; $i < count($t_id_list); $i++) { $t_id_list[$i] = user_get_email($t_id_list[$i]); } // Add users $t_emails = explode(',', plugin_config_get('notify_email', PLUGINS_RELEASEMGT_NOTIFY_EMAIL_DEFAULT)); foreach ($t_emails as $t_email) { if (trim($t_email) != '') { $t_id_list[] = trim($t_email); } } $t_email_ids = array_unique($t_id_list); if (defined('MANTIS_VERSION')) { $t_mantis_version = MANTIS_VERSION; } else { $t_mantis_version = config_get('mantis_version'); } if (version_compare($t_mantis_version, '1.1.0a2', '>=')) {
function usermessage_send_to_user($user, $message_event) { // echo "<br />DEBUG1303: usermessage_send_to_user($user, $message_event)"; $sql = "SELECT type, subject, message, once, reward, sendby FROM " . PREFIX . "messages_to_users WHERE event='" . sql_safe($message_event) . "' ORDER BY activated DESC LIMIT 0,1"; if ($mm = mysql_query($sql)) { if ($m = mysql_fetch_array($mm)) { $adress = ""; $sendby = explode(",", $m['sendby']); if (in_array("insite_privmess", $sendby)) { //Skicka ett ingame-meddelande till användaren med meddelandet $privmess_id = privmess_send(0, $user, $m['subject'], $m['message'], FALSE); $adress .= "insite_privmess"; } if (in_array("insite_notice", $sendby)) { notice_send($user, $message_event, $m['type'], $m['subject'], $m['message']); if ($adress != "") { $adress .= ", "; } $adress .= "insite_notice"; } if (in_array("email", $sendby)) { $email = user_get_email($user); mailer_send_mail($adress, user_get_name($user), $m['subject'], $m['message']); if ($adress != "") { $adress .= ", "; } $adress .= $email; } //Ge eventuellt belöning if ($m['reward'] > 0) { money_transaction(0, $user, $m['reward'], "Reward", $m['subject']); } //lägg in att detta skickats i messages_to_users_sent $sql = "INSERT INTO " . PREFIX . "messages_to_users_sent SET\r\n\t\t\t\tuser='******', \r\n\t\t\t\tmessage_event='" . sql_safe($message_event) . "',\r\n\t\t\t\tadress='" . $adress . "'"; if (isset($privmess_id)) { $sql .= ", privmess_id=" . sql_safe($privmess_id); } $sql .= ";"; // echo "<br />DEBUG1753: $sql"; mysql_query($sql); } } }
function admin_get_user_email_matches($uid) { if (!($db = db::get())) { return false; } if (!is_numeric($uid)) { return false; } if (!($table_prefix = get_table_prefix())) { return false; } // Initialise array $user_email_aliases_array = array(); // Session UID $sess_uid = session::get_value('UID'); // Get the user's email address $user_email_address = user_get_email($uid); $sql = "SELECT DISTINCT USER.UID, USER.LOGON, USER.NICKNAME, "; $sql .= "USER_PEER.PEER_NICKNAME, USER.EMAIL FROM USER "; $sql .= "LEFT JOIN `{$table_prefix}USER_PEER` USER_PEER "; $sql .= "ON (USER_PEER.PEER_UID = USER.UID AND USER_PEER.UID = '{$sess_uid}') "; $sql .= "WHERE (USER.EMAIL = '{$user_email_address}') "; $sql .= "AND USER.UID <> {$uid} LIMIT 0, 10"; if (!($result = $db->query($sql))) { return false; } if ($result->num_rows == 0) { return false; } while ($user_aliases = $result->fetch_assoc()) { if (isset($user_aliases['LOGON']) && isset($user_aliases['PEER_NICKNAME'])) { if (!is_null($user_aliases['PEER_NICKNAME']) && strlen($user_aliases['PEER_NICKNAME']) > 0) { $user_aliases['NICKNAME'] = $user_aliases['PEER_NICKNAME']; } } if (!isset($user_aliases['LOGON'])) { $user_aliases['LOGON'] = gettext("Unknown user"); } if (!isset($user_aliases['NICKNAME'])) { $user_aliases['NICKNAME'] = ""; } $user_email_aliases_array[$user_aliases['UID']] = $user_aliases; } return $user_email_aliases_array; }
echo "<a class=\"attachments\" href=\"$t_href\" title=\"$t_href_title\"><img src=\"plugins/MantisKanban/files/paper-clip.png\" alt=\"$t_alt_text\" title=\"$t_alt_text\" /></a>"; } if( VS_PRIVATE == $t_bug->view_state ) { echo '<img src="' . $t_icon_path . 'protected.gif" width="8" height="15" alt="' . lang_get( 'private' ) . '" />'; } echo '</div>'; */ $t_submitted = date(config_get('normal_date_format'), $t_bug->date_submitted); echo '<div class="bugTime">' . $t_submitted . '<br>'; $t_last_updated = date(config_get('normal_date_format'), $t_bug->last_updated); echo $t_last_updated . '</div>'; // print username instead of status if (ON == config_get('show_assigned_names') && $t_bug->handler_id > 0 && user_exists($t_bug->handler_id) && access_has_project_level(config_get('view_handler_threshold'), $t_bug->project_id)) { $emailHash = md5(strtolower(trim(user_get_email($t_bug->handler_id)))); echo '<div class="owner">'; echo '<div class="img-wrap"><img src="http://www.gravatar.com/avatar/' . $emailHash . '?s=28&d=monsterid" width="28" height="28" /></div>'; echo user_get_realname($t_bug->handler_id); echo '</div>'; } echo '</div>'; $i++; } } } ?> </td><?php } ?> </td>
/** * Return the user avatar image URL * in this first implementation, only gravatar.com avatars are supported * @return array|bool an array( URL, width, height ) or false when the given user has no avatar */ function user_get_avatar($p_user_id, $p_size = 80) { $t_email = utf8_strtolower(trim(user_get_email($p_user_id))); if (is_blank($t_email)) { $t_result = false; } else { $t_size = $p_size; $t_use_ssl = false; if (isset($_SERVER['HTTPS']) && utf8_strtolower($_SERVER['HTTPS']) != 'off') { $t_use_ssl = true; } if (!$t_use_ssl) { $t_gravatar_domain = 'http://www.gravatar.com/'; } else { $t_gravatar_domain = 'https://secure.gravatar.com/'; } $t_avatar_url = $t_gravatar_domain . 'avatar/' . md5($t_email) . '?d=identicon&r=G&s=' . $t_size; $t_result = array($t_avatar_url, $t_size, $t_size); } return $t_result; }
if ($t_bug->project_id != helper_get_current_project()) { # in case the current project is not the same project of the bug we are viewing... # ... override the current project. This to avoid problems with categories and handlers lists etc. $g_project_override = $t_bug->project_id; } if (config_get('enable_sponsorship') == OFF) { trigger_error(ERROR_SPONSORSHIP_NOT_ENABLED, ERROR); } access_ensure_bug_level(config_get('sponsor_threshold'), $f_bug_id); helper_ensure_confirmed(sprintf(lang_get('confirm_sponsorship'), $f_bug_id, sponsorship_format_amount($f_amount)), lang_get('sponsor_issue')); if ($f_amount == 0) { # if amount == 0, delete sponsorship by current user (if any) $t_sponsorship_id = sponsorship_get_id($f_bug_id); if ($t_sponsorship_id !== false) { sponsorship_delete($t_sponsorship_id); } } else { # add sponsorship $t_user = auth_get_current_user_id(); if (is_blank(user_get_email($t_user))) { trigger_error(ERROR_SPONSORSHIP_SPONSOR_NO_EMAIL, ERROR); } else { $sponsorship = new SponsorshipData(); $sponsorship->bug_id = $f_bug_id; $sponsorship->user_id = $t_user; $sponsorship->amount = $f_amount; sponsorship_set($sponsorship); } } form_security_purge('bug_set_sponsorship'); print_header_redirect_view($f_bug_id);
/** * Return the user avatar image URL * in this first implementation, only gravatar.com avatars are supported * @return array|bool an array( URL, width, height ) or false when the given user has no avatar */ function user_get_avatar($p_user_id, $p_size = 80) { $t_email = utf8_strtolower(trim(user_get_email($p_user_id))); if (is_blank($t_email)) { $t_result = false; } else { $t_size = $p_size; if (http_is_protocol_https()) { $t_gravatar_domain = 'https://secure.gravatar.com/'; } else { $t_gravatar_domain = 'http://www.gravatar.com/'; } $t_avatar_url = $t_gravatar_domain . 'avatar/' . md5($t_email) . '?d=identicon&r=G&s=' . $t_size; $t_result = array($t_avatar_url, $t_size, $t_size); } return $t_result; }
/** * Return the user avatar image URL * in this first implementation, only gravatar.com avatars are supported * @param int $p_user_id User ID * @param int $p_size pixel size of image * @return array|bool an array( URL, width, height ) or false when the given user has no avatar */ function user_get_avatar($p_user_id, $p_size = 80) { $t_default_avatar = config_get('show_avatar'); if (OFF === $t_default_avatar) { # Avatars are not used return false; } # Set default avatar for legacy configuration if (ON === $t_default_avatar) { $t_default_avatar = 'identicon'; } # Default avatar is either one of Gravatar's options, or # assumed to be an URL to a default avatar image $t_default_avatar = urlencode($t_default_avatar); $t_rating = 'G'; $t_email_hash = md5(utf8_strtolower(trim(user_get_email($p_user_id)))); # Build Gravatar URL if (http_is_protocol_https()) { $t_avatar_url = 'https://secure.gravatar.com/'; } else { $t_avatar_url = 'http://www.gravatar.com/'; } $t_avatar_url .= "avatar/{$t_email_hash}?d={$t_default_avatar}&r={$t_rating}&s={$p_size}"; return array($t_avatar_url, $p_size, $p_size); }
/** * Set the user's email to the given string after checking that it is a valid email * @param integer $p_user_id A valid user identifier. * @param string $p_email An email address to set. * @return boolean */ function user_set_email($p_user_id, $p_email) { $p_email = trim($p_email); email_ensure_valid($p_email); email_ensure_not_disposable($p_email); $t_old_email = user_get_email($p_user_id); if (strcasecmp($t_old_email, $p_email) != 0) { user_ensure_email_unique($p_email); } return user_set_field($p_user_id, 'email', $p_email); }
html_page_top2(); } $f_id = gpc_get_int('f_id'); # Select the faq posts $query = "SELECT *, UNIX_TIMESTAMP(date_posted) as date_posted\n\t\t\tFROM {$g_mantis_worklog_table}\n\t\t\tWHERE id='{$f_id}'"; $result = db_query_bound($query); $worklog_count = db_num_rows($result); # Loop through results for ($i = 0; $i < $worklog_count; $i++) { $row = db_fetch_array($result); extract($row, EXTR_PREFIX_ALL, "v"); $v_headline = string_display($v_headline); $v_content = string_display_links($v_content); $v_date_posted = date($g_normal_date_format, $v_date_posted); $t_poster_name = user_get_name($v_poster_id); $t_poster_email = user_get_email($v_poster_id); $t_project_name = " "; if ($v_project_id != 0) { $t_project_name = project_get_field($v_project_id, "name"); } ?> <p> <div align="center"> <table class="width75" cellspacing="0"> <tr> <td class="worklog-heading"> <span class="worklog-subject"><?php echo '[' . worklog_type_display($v_log_type) . ']' . $v_subject; ?> </span> - <span class="worklog-date"><?php
function feedback_show_latest_short($antal = 3, $length = 150, $headline_size = 2) { // id subject text user nick email url flattrID created plusones comments accepted Admin har tänkt att detta ska ske resolved Admin tycker att detta är $sql = "SELECT id, subject, user, nick, email, url, flattrID, created, SUBSTRING(`text`, 1, " . sql_safe($length) . ") AS texten \n\tFROM " . PREFIX . "feedback \n\tWHERE is_spam<1\n\tORDER BY created DESC \n\tLIMIT 0," . sql_safe($antal) . ";"; // echo "<br />DEBUG1323: $sql"; if ($ff = mysql_query($sql)) { echo "<ul class=\"wdgtlist feedbacks\">"; $first = 1; while ($f = mysql_fetch_array($ff)) { $link = SITE_URL . "?p=feedback&id=" . $f['id']; if ($first) { echo "<li class=\"first\">"; $first = 0; } else { echo "<li>"; } echo "<h" . $headline_size . "><a href=\"{$link}\">" . $f['subject'] . "</a></h" . $headline_size . ">"; echo "<div class=\"comment_head\">"; //Skriv ut info om när kommentaren skrevs och av vem if ($f['user'] != NULL) { //Kolla om vi har en avatar $sql = "SELECT img_thumb FROM " . PREFIX . "userimage WHERE user='******'user']) . "';"; if ($ii = mysql_query($sql)) { if ($im = mysql_fetch_array($ii)) { if ($im['img_thumb'] != NULL) { if (file_exists(USER_IMG_URL . $im['img_thumb'])) { echo "<div class=\"left_avatar left\"><img src=\"" . USER_IMG_URL . $im['img_thumb'] . "\" /></div>"; } else { $sql = "UPDATE " . PREFIX . "userimage SET img_thumb=NULL WHERE user='******'user']) . "';"; mysql_query($sql); $im['img_thumb'] = NULL; } } } } if (!isset($im) || $im['img_thumb'] == NULL) { echo "<div class=\"left_avatar\"><img src=\"http://www.gravatar.com/avatar/" . md5(strtolower(trim(user_get_email($f['user'])))) . "?s=60\" /></div>"; } // echo "<div class=\"date\">Posted by <a href=\"?p=user&user="******"\"><strong>".user_get_name($f['user'])."</strong></a> at "; } else { if ($f['nick'] != NULL) { //Kolla om vi har en gravatar if ($f['email'] != NULL) { echo "<img class=\"left_avatar\" src=\"http://www.gravatar.com/avatar/" . md5(strtolower(trim($f['email']))) . "?s=60\" />"; } // if($f['url']!=NULL) // echo "<div class=\"date\">Posted by <a href=\"".$f['url']."\">".$f['nick']."</a> at "; // else // echo "<div class=\"date\">Posted by <strong>".$f['nick']."</strong> at "; } } // else // echo "<div class=\"date\">"._("Posted at "); echo "<div class=\"date\">"; // echo "<a href=\"$link\">".date("Y-m-d H:i:s",strtotime($f['created']))."</a>"; feedback_display_author_text($f['user'], $f['nick'], $f['url'], $f['id'], $f['created']); //Eventuell Flattr-knapp if ($f['user'] != NULL && flattr_get_flattr_choice($f['user'], "feedback")) { $flattrID = flattr_get_flattrID($f['user']); } else { if ($f['flattrID'] != NULL) { $flattrID = $f['flattrID']; } else { $flattrID = NULL; } } $text = str_replace("\n", "<br />", $f['texten']); $text = str_replace("<br /><br />", "<br />", $text); if ($flattrID) { echo "sadsad<br />"; if ($f['subject'] != NULL && $f['subject'] != "") { flattr_button_show($flattrID, $link, $f['subject'] . " - feedback on " . SITE_URL, $text, 'compact', 'en_GB'); } else { flattr_button_show($flattrID, $link, "Feedback " . $f['id'] . " - feedback on " . SITE_URL, $text, 'compact', 'en_GB'); } } echo "</div>"; // echo "<br />DEBUG 1252: $flattrID"; echo "</div>"; echo "<div class=\"comment_body\">"; //Skriv ut texten echo "<p>{$text}<a href=\"{$link}\">[...]</a></p>"; echo "</div>"; echo "<div class=\"clearer\"></div></li>"; } echo "</ul>"; } }
/** * Return the user avatar image URL * in this first implementation, only gravatar.com avatars are supported * * This function returns an array( URL, width, height ) or an empty array when the given user has no avatar. * * @param integer $p_user_id A valid user identifier. * @param integer $p_size The required number of pixel in the image to retrieve the link for. * @return array */ function user_get_avatar($p_user_id, $p_size = 80) { $t_default_avatar = config_get('show_avatar'); if (OFF === $t_default_avatar) { # Avatars are not used return array(); } # Set default avatar for legacy configuration if (ON === $t_default_avatar) { $t_default_avatar = 'identicon'; } # Default avatar is either one of Gravatar's options, or # assumed to be an URL to a default avatar image $t_default_avatar = urlencode($t_default_avatar); $t_rating = 'G'; if (user_exists($p_user_id)) { $t_email_hash = md5(strtolower(trim(user_get_email($p_user_id)))); } else { $t_email_hash = md5('generic-avatar-since-user-not-found'); } # Build Gravatar URL if (http_is_protocol_https()) { $t_avatar_url = 'https://secure.gravatar.com/'; } else { $t_avatar_url = 'http://www.gravatar.com/'; } $t_avatar_url .= 'avatar/' . $t_email_hash . '?d=' . $t_default_avatar . '&r=' . $t_rating . '&s=' . $p_size; return array($t_avatar_url, $p_size, $p_size); }
/** * 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; }
$f_realname = gpc_get_string('realname', ''); $f_password = gpc_get_string('password', ''); $f_password_confirm = gpc_get_string('password_confirm', ''); // get the user id once, so that if we decide in the future to enable this for // admins / managers to change details of other users. $t_user_id = auth_get_current_user_id(); $t_redirect = 'account_page.php'; $t_email_updated = false; $t_password_updated = false; $t_realname_updated = false; /** @todo Listing what fields were updated is not standard behaviour of MantisBT - it also complicates the code. */ if (OFF == config_get('use_ldap_email')) { $f_email = email_append_domain($f_email); email_ensure_valid($f_email); email_ensure_not_disposable($f_email); if ($f_email != user_get_email($t_user_id)) { user_set_email($t_user_id, $f_email); $t_email_updated = true; } } # strip extra spaces from real name $t_realname = string_normalize($f_realname); if ($t_realname != user_get_field($t_user_id, 'realname')) { # checks for problems with realnames $t_username = user_get_field($t_user_id, 'username'); user_ensure_realname_unique($t_username, $t_realname); user_set_realname($t_user_id, $t_realname); $t_realname_updated = true; } # Update password if the two match and are not empty if (!is_blank($f_password)) {
function ERP_update_check() { $t_config_version = plugin_config_get('config_version'); if ($t_config_version === 0) { $t_username = plugin_config_get('mail_reporter', ''); if (strlen($t_username) > 0) { $t_user_id = user_get_id_by_name($t_username); if ($t_user_id !== FALSE) { $t_user_email = user_get_email($t_user_id); if ($t_user_email === 'nomail') { plugin_require_api('core/config_api.php'); # We need to allow blank emails for a sec ERP_set_temporary_overwrite('allow_blank_email', ON); user_set_email($t_user_id, ''); } } } $t_schema = plugin_config_get('schema'); $t_reset_schema = plugin_config_get('reset_schema'); if ($t_schema !== -1 && $t_reset_schema === 0) { plugin_config_set('schema', -1); plugin_config_set('reset_schema', 1); } plugin_config_set('config_version', 1); } if ($t_config_version <= 1) { $t_mail_reporter = plugin_config_get('mail_reporter', ''); if (strlen($t_mail_reporter) > 0) { $t_mail_reporter_id = user_get_id_by_name($t_mail_reporter); plugin_config_set('mail_reporter_id', $t_mail_reporter_id); } plugin_config_delete('mail_directory'); plugin_config_delete('mail_reporter'); plugin_config_delete('mail_additional'); plugin_config_delete('random_user_number'); plugin_config_delete('mail_bug_priority_default'); plugin_config_set('config_version', 2); } if ($t_config_version <= 2) { plugin_config_delete('mail_cronjob_present'); plugin_config_delete('mail_check_timer'); plugin_config_delete('mail_last_check'); plugin_config_set('config_version', 3); } if ($t_config_version <= 3) { $t_mailboxes = plugin_config_get('mailboxes', array()); $t_indexes = array('mailbox_project' => 'mailbox_project_id', 'mailbox_global_category' => 'mailbox_global_category_id'); foreach ($t_mailboxes as $t_key => $t_array) { if (isset($t_array['mailbox_hostname'])) { # Correct the hostname if it is stored in an older format $t_hostname = $t_array['mailbox_hostname']; if (!is_array($t_hostname)) { // ipv6 also uses : so we need to work around that if (substr_count($t_hostname, ':') === 1) { $t_hostname = explode(':', $t_hostname, 2); } else { $t_hostname = array($t_hostname); } $t_hostname = array('hostname' => $t_hostname[0], 'port' => isset($t_hostname[1]) ? $t_hostname[1] : ''); $t_array['mailbox_hostname'] = $t_hostname; } } $t_mailboxes[$t_key] = $this->ERP_update_indexes($t_array, $t_indexes); } plugin_config_set('mailboxes', $t_mailboxes); plugin_config_set('config_version', 4); } if ($t_config_version <= 4) { $t_mail_remove_mantis_email = plugin_config_get('mail_remove_mantis_email', -1); $t_mail_identify_reply = plugin_config_get('mail_identify_reply', $t_mail_remove_mantis_email); if ($t_mail_remove_mantis_email !== -1 && $t_mail_identify_reply !== $t_mail_remove_mantis_email) { plugin_config_set('mail_remove_mantis_email', $t_mail_identify_reply); } plugin_config_delete('mail_identify_reply'); plugin_config_set('config_version', 5); } if ($t_config_version <= 5) { plugin_config_delete('mail_parse_mime'); plugin_config_set('config_version', 6); } if ($t_config_version <= 6) { $t_mailboxes = plugin_config_get('mailboxes', array()); $t_indexes = array('mailbox_enabled' => 'enabled', 'mailbox_description' => 'description', 'mailbox_type' => 'type', 'mailbox_hostname' => 'hostname', 'mailbox_encryption' => 'encryption', 'mailbox_username' => 'username', 'mailbox_password' => 'password', 'mailbox_auth_method' => 'auth_method', 'mailbox_project_id' => 'project_id', 'mailbox_global_category_id' => 'global_category_id', 'mailbox_basefolder' => 'basefolder', 'mailbox_createfolderstructure' => 'createfolderstructure'); foreach ($t_mailboxes as $t_key => $t_array) { $t_mailboxes[$t_key] = $this->ERP_update_indexes($t_array, $t_indexes); } plugin_config_set('mailboxes', $t_mailboxes); plugin_config_set('config_version', 7); } if ($t_config_version <= 7) { $t_mailboxes = plugin_config_get('mailboxes', array()); foreach ($t_mailboxes as $t_key => $t_array) { if (isset($t_array['hostname'])) { $t_hostname = $t_array['hostname']; if (is_array($t_hostname)) { $t_array['hostname'] = $t_hostname['hostname']; $t_array['port'] = $t_hostname['port']; } $t_mailboxes[$t_key] = $t_array; } } plugin_config_set('mailboxes', $t_mailboxes); plugin_config_set('config_version', 8); } if ($t_config_version <= 8) { plugin_config_delete('mail_tmp_directory'); plugin_config_set('config_version', 9); } if ($t_config_version <= 9) { $t_mailboxes = plugin_config_get('mailboxes', array()); $t_indexes = array('type' => 'mailbox_type', 'basefolder' => 'imap_basefolder', 'createfolderstructure' => 'imap_createfolderstructure'); foreach ($t_mailboxes as $t_key => $t_array) { $t_mailboxes[$t_key] = $this->ERP_update_indexes($t_array, $t_indexes); } plugin_config_set('mailboxes', $t_mailboxes); plugin_config_set('config_version', 10); } if ($t_config_version <= 10) { plugin_config_delete('mail_rule_system'); plugin_config_set('config_version', 11); } if ($t_config_version <= 11) { $t_mailboxes = plugin_config_get('mailboxes', array()); $t_indexes = array('username' => 'erp_username', 'password' => 'erp_password'); foreach ($t_mailboxes as $t_key => $t_array) { $t_mailboxes[$t_key] = $this->ERP_update_indexes($t_array, $t_indexes); } plugin_config_set('mailboxes', $t_mailboxes); plugin_config_delete('rules'); plugin_config_delete('mail_encoding'); plugin_config_set('config_version', 12); } if ($t_config_version <= 12) { plugin_config_set('reset_schema', 1); plugin_config_set('config_version', 13); } if ($t_config_version <= 13) { plugin_config_delete('mail_fetch_max'); plugin_config_set('config_version', 14); } if ($t_config_version <= 14) { $t_mail_reporter_id = plugin_config_get('mail_reporter_id', 'Mail'); $t_report_bug_threshold = config_get_global('report_bug_threshold'); if ($t_mail_reporter_id !== 'Mail' && user_exists($t_mail_reporter_id)) { if (!access_has_global_level($t_report_bug_threshold, $t_mail_reporter_id)) { user_set_field($t_mail_reporter_id, 'access_level', $t_report_bug_threshold); } } plugin_config_set('config_version', 15); } }
echo DB_FIELD_SIZE_REALNAME; ?> " name="realname" value="<?php echo string_attribute($t_user['realname']); ?> " /></span><?php } ?> <span class="label-style"></span> </div> <!-- Email --> <div class="field-container"><?php if ($t_ldap && ON == config_get('use_ldap_email')) { # With LDAP echo '<span class="display-label"><span>' . lang_get('email_label') . '</span></span>'; echo '<span class="input">' . string_display_line(user_get_email($t_user_id)) . '</span>'; } else { # Without LDAP echo '<label for="email-field"><span>' . lang_get('email_label') . '</span></label>'; echo '<span class="input">'; print_email_input('email', $t_user['email']); echo '</span>'; } ?> <span class="label-style"></span> </div> <!-- Access Level --> <div class="field-container"> <label for="edit-access-level"><span><?php echo lang_get('access_level_label'); ?>
function user_set_password($user_id, $new_password) { $crypt_pass = crypt($new_password, $user_id . user_get_email($user_id)); //If the new password is different from current if (strcmp($crypt_pass, user_get_password_hash($user_id))) { //set it $sql = "UPDATE " . PREFIX . "user SET password='******' WHERE id=" . sql_safe($user_id) . ";"; if (mysql_query($sql)) { add_message("New password set"); } else { add_error("New password could not be set: " . mysql_error()); } } }