本文整理汇总了PHP中user_get_field函数的典型用法代码示例。如果您正苦于以下问题:PHP user_get_field函数的具体用法?PHP user_get_field怎么用?PHP user_get_field使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_get_field函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare_user_name
/**
* prepares the name of the user given the id. also makes it an email link.
* @param int $p_user_id
* @return string
*/
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_username = string_display_line($t_username);
// WK/BFE: Original-Zeile auskommentiert: , LB/BFE 2015
// return '<a href="' . string_sanitize_url( 'view_user_page.php?id=' . $p_user_id, true ) . '">' . $t_username . '</a>';
// ersetzt durch: (Link auf view_user_page nur wenn globale Rolle mindestens $g_manage_user_threshold
if (user_is_administrator(auth_get_current_user_id())) {
return '<a href="' . string_sanitize_url('view_user_page.php?id=' . $p_user_id, true) . '">' . $t_username . '</a>';
} else {
return $t_username;
}
// WK/BFE: Ende der Modifikation
} else {
$t_result = '<font STYLE="text-decoration: line-through">';
$t_result .= string_display_line($t_username);
$t_result .= '</font>';
return $t_result;
}
}
示例2: displayResultsCore
function displayResultsCore($query, $fields)
{
$result = db_query_bound($query);
$nbRows = 0;
while ($row = db_fetch_array($result)) {
$nbRows++;
$t_bug = bug_get($row['id']);
print "<tr> \n";
print '<td><a href="' . string_get_bug_view_url($row['id']) . '">' . bug_format_id($row['id']) . '</a></td>';
//print "<td> ".string_get_bug_view_url( ))." </td>\n";
print "<td> " . string_display_line(get_enum_element('status', $t_bug->status)) . " </td>\n";
print "<td> " . category_get_row($t_bug->category_id)['name'] . " </td>\n";
print "<td> " . $t_bug->summary . " </td>\n";
print "<td> " . user_get_field($t_bug->reporter_id, 'username') . " </td>\n";
if ($t_bug->handler_id != null) {
print "<td> " . user_get_field($t_bug->handler_id, 'username') . " </td>\n";
}
if (sizeof($fields) > 0) {
for ($i = 0; $i < sizeof($fields); $i++) {
print "<td> " . $row[$fields[$i]] . " </td>\n";
}
}
print "</tr>\n";
}
return $nbRows;
}
示例3: mci_account_get_array_by_id
/**
* 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;
}
示例4: rss_calculate_key
/**
* Calculates a key to be used for RSS authentication based on user name, cookie and password.
* if the user changes his user name or password, then the key becomes invalid.
* @param int $p_user_id
* @return string
*/
function rss_calculate_key($p_user_id = null)
{
if ($p_user_id === null) {
$t_user_id = auth_get_current_user_id();
} else {
$t_user_id = $p_user_id;
}
$t_seed = config_get_global('rss_key_seed');
$t_username = user_get_field($t_user_id, 'username');
$t_password = user_get_field($t_user_id, 'password');
$t_cookie = user_get_field($t_user_id, 'cookie_string');
return md5($t_seed . $t_username . $t_cookie . $t_password);
}
示例5: email_group_reminder
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();
}
}
}
示例6: prepare_user_name
/**
* prepares the name of the user given the id. also makes it an email link.
* @param int $p_user_id
* @return string
*/
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 );
$t_username = string_display_line( $t_username );
if( user_exists( $p_user_id ) && user_get_field( $p_user_id, 'enabled' ) ) {
return '<a class="user" href="' . string_sanitize_url( 'view_user_page.php?id=' . $p_user_id, true ) . '">' . $t_username . '</a>';
} else {
return '<del class="user">' . $t_username . '</del>';
}
}
示例7: rss_calculate_key
/**
* Calculates a key to be used for RSS authentication based on user name,
* cookie and password. If the user changes their user name or password, this
* RSS authentication key will become invalidated.
* @param integer $p_user_id User ID for the user which the key is being calculated for.
* @return string RSS authentication key (384bit) encoded according to the base64 with URI safe alphabet approach described in RFC4648.
*/
function rss_calculate_key($p_user_id = null)
{
if ($p_user_id === null) {
$t_user_id = auth_get_current_user_id();
} else {
$t_user_id = $p_user_id;
}
$t_username = user_get_field($t_user_id, 'username');
$t_password = user_get_field($t_user_id, 'password');
$t_cookie = user_get_field($t_user_id, 'cookie_string');
$t_key_raw = hash('whirlpool', 'rss_key' . config_get_global('crypto_master_salt') . $t_username . $t_password . $t_cookie, true);
# Note: We truncate the last 8 bits from the hash output so that base64
# encoding can be performed without any trailing padding.
$t_key_base64_encoded = base64_encode(substr($t_key_raw, 0, 63));
$t_key = strtr($t_key_base64_encoded, '+/', '-_');
return $t_key;
}
示例8: prepare_user_name
/**
* prepares the name of the user given the id. also makes it an email link.
* @param int $p_user_id
* @return string
*/
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_username = string_display_line($t_username);
return '<a href="' . string_sanitize_url('view_user_page.php?id=' . $p_user_id, true) . '">' . $t_username . '</a>';
} else {
$t_result = '<font STYLE="text-decoration: line-through">';
$t_result .= string_display_line($t_username);
$t_result .= '</font>';
return $t_result;
}
}
示例9: mci_account_get_array_by_id
/**
* 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_result['name'] = user_get_field($p_user_id, 'username');
$t_dummy = user_get_field($p_user_id, 'realname');
if (!empty($t_dummy)) {
$t_result['real_name'] = $t_dummy;
}
$t_dummy = user_get_field($p_user_id, 'email');
if (!empty($t_dummy)) {
$t_result['email'] = $t_dummy;
}
}
return $t_result;
}
示例10: addExtraBugData
function addExtraBugData($bug)
{
$bug["project_name"] = project_get_name($bug["project_id"]);
if ($bug["reporter_id"] != "") {
$bug["reporter_name"] = user_get_field($bug["reporter_id"], 'username');
}
$bug["severity_name"] = get_enum_element('severity', $bug["severity"]);
$bug["priority_name"] = get_enum_element('priority', $bug["priority"]);
$bug["status_name"] = get_enum_element('status', $bug["status"]);
$bug["reproducibility_name"] = get_enum_element('reproducibility', $bug["reproducibility"]);
if ($bug["handler_id"] == "") {
$bug["handler_name"] = user_get_field($bug["handler_id"], 'username');
}
$bug["projection_name"] = get_enum_element('projection', $bug["projection"]);
$bug["eta_name"] = get_enum_element('eta', $bug["eta"]);
$bug["resolution_name"] = get_enum_element('resolution', $bug["resolution"]);
$bug["description"] = bug_get_text_field($bug["id"], 'description');
return $bug;
}
示例11: prepare_user_name
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;
}
}
示例12: user_reset_password
/**
* Reset the user's password
* Take into account the 'send_reset_password' setting
* - if it is ON, generate a random password and send an email
* (unless the second parameter is false)
* - if it is OFF, set the password to blank
* Return false if the user is protected, true if the password was
* successfully reset
*
* @param integer $p_user_id A valid user identifier.
* @param boolean $p_send_email Whether to send confirmation email.
* @return boolean
*/
function user_reset_password($p_user_id, $p_send_email = true)
{
$t_protected = user_get_field($p_user_id, 'protected');
# Go with random password and email it to the user
if (ON == $t_protected) {
return false;
}
# @@@ do we want to force blank password instead of random if
# email notifications are turned off?
# How would we indicate that we had done this with a return value?
# Should we just have two functions? (user_reset_password_random()
# and user_reset_password() )?
if (ON == config_get('send_reset_password') && ON == config_get('enable_email_notification')) {
$t_email = user_get_field($p_user_id, 'email');
if (is_blank($t_email)) {
trigger_error(ERROR_LOST_PASSWORD_NO_EMAIL_SPECIFIED, ERROR);
}
# Create random password
$t_password = auth_generate_random_password();
$t_password2 = auth_process_plain_password($t_password);
user_set_field($p_user_id, 'password', $t_password2);
# Send notification email
if ($p_send_email) {
$t_confirm_hash = auth_generate_confirm_hash($p_user_id);
email_send_confirm_hash_url($p_user_id, $t_confirm_hash);
}
} else {
# use blank password, no emailing
$t_password = auth_process_plain_password('');
user_set_field($p_user_id, 'password', $t_password);
# reset the failed login count because in this mode there is no emailing
user_reset_failed_login_count_to_zero($p_user_id);
}
return true;
}
示例13: current_user_get_field
/**
* Returns the specified field of the currently logged in user
*
* @param field_name Name of user property as in the table definition.
* @return Get the value of the specified field for current user.
* @access public
*/
function current_user_get_field($p_field_name)
{
return user_get_field(auth_get_current_user_id(), $p_field_name);
}
示例14: user_get_id_by_name
return;
}
$t_anonymous_user_id = user_get_id_by_name( $t_anonymous_account );
check_print_test_row(
'anonymous_account is a valid user account',
$t_anonymous_user_id !== false,
array( false => 'You need to specify a valid user account to use with the anonymous_account configuration options.' )
);
check_print_test_row(
'anonymous_account user has the enabled flag set',
user_is_enabled( $t_anonymous_user_id ),
array( false => 'The anonymous user account must be enabled before it can be used.' )
);
check_print_test_row(
'anonymous_account user has the protected flag set',
user_get_field( $t_anonymous_user_id, 'protected' ),
array( false => 'The anonymous user account needs to have the protected flag set to prevent anonymous users modifying the account.' )
);
check_print_test_row(
'anonymous_account user does not have administrator permissions',
!user_is_administrator( $t_anonymous_user_id ),
array(
true => 'The anonymous user account currently has an access level of: ' . htmlentities( get_enum_element( 'access_levels', user_get_access_level( $t_anonymous_user_id ) ) ),
false => 'The anonymous user account should not have administrator level permissions.'
)
);
示例15: bug_format_id
$t_bug = $t_issues[$i];
$about = $link = $t_path . "view.php?id=" . $t_bug->id;
$title = bug_format_id($t_bug->id) . ': ' . $t_bug->summary;
if ($t_bug->view_state == VS_PRIVATE) {
$title .= ' [' . lang_get('private') . ']';
}
$description = string_rss_links($t_bug->description);
# subject is category.
$subject = category_full_name($t_bug->category_id, false);
# optional DC value
$date = $t_bug->last_updated;
# author of item
$author = '';
if (access_has_global_level(config_get('show_user_email_threshold'))) {
$t_author_name = user_get_name($t_bug->reporter_id);
$t_author_email = user_get_field($t_bug->reporter_id, 'email');
if (!is_blank($t_author_email)) {
if (!is_blank($t_author_name)) {
$author = $t_author_name . ' <' . $t_author_email . '>';
} else {
$author = $t_author_email;
}
}
}
# $comments = 'http://www.example.com/sometext.php?somevariable=somevalue&comments=1'; # url to comment page rss 2.0 value
$comments = $t_path . 'view.php?id=' . $t_bug->id . '#bugnotes';
# optional mod_im value for dispaying a different pic for every item
$image = '';
$rssfile->addRSSItem($about, $title, $link, $description, $subject, $date, $author, $comments, $image);
}
/** @todo consider making this a configuration option - 0.91 / 1.0 / 2.0 */