本文整理汇总了PHP中token_set函数的典型用法代码示例。如果您正苦于以下问题:PHP token_set函数的具体用法?PHP token_set怎么用?PHP token_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了token_set函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: last_visited_issue
/**
* This method should be called from view, update, print pages for issues,
* mantisconnect.
*
* @param integer $p_issue_id The issue id that was just visited.
* @param integer $p_user_id The user id that visited the issue, or null for current logged in user.
* @access public
* @return void
*/
function last_visited_issue($p_issue_id, $p_user_id = null)
{
if (!last_visited_enabled()) {
return;
}
$t_value = token_get_value(TOKEN_LAST_VISITED, $p_user_id);
if (is_null($t_value)) {
$t_value = $p_issue_id;
} else {
$t_ids = explode(',', $p_issue_id . ',' . $t_value);
$t_ids = array_unique($t_ids);
$t_ids = array_slice($t_ids, 0, config_get('recently_visited_count'));
$t_value = implode(',', $t_ids);
}
token_set(TOKEN_LAST_VISITED, $t_value, TOKEN_EXPIRY_LAST_VISITED, $p_user_id);
}
示例2: access_ensure_project_level
*/
/**
* MantisBT Core API's
*/
require_once 'core.php';
require_once 'graph_api.php';
access_ensure_project_level(config_get('view_summary_threshold'));
html_page_top();
print_summary_menu('summary_page.php');
echo '<br />';
print_summary_submenu();
$t_width = plugin_config_get('window_width');
$t_graph_width = (int) (($t_width - 50) * 0.6);
# gather the data for the graphs
$t_metrics = enum_bug_group(lang_get('priority_enum_string'), 'priority');
$t_token = token_set(TOKEN_GRAPH, serialize($t_metrics));
?>
<br />
<table class="width100" cellspacing="1">
<tr>
<td class="form-title">
<?php
echo plugin_lang_get('graph_imp_priority_title');
?>
</td>
</tr>
<tr valign="top">
<td>
<center><img src="<?php
echo plugin_page('summary_graph_bypriority.php');
示例3: collapse_cache_token
/**
* Cache collapse API data from the database for the current user.
* If the collapse cookie has been set, grab the changes and resave
* the token, or touch it otherwise.
*/
function collapse_cache_token()
{
global $g_collapse_cache_token;
if (!auth_is_user_authenticated() || current_user_is_anonymous()) {
$g_collapse_cache_token = array();
return;
}
if (isset($g_collapse_cache_token)) {
return;
}
$t_user_id = auth_get_current_user_id();
$t_token = token_get_value(TOKEN_COLLAPSE);
if (!is_null($t_token)) {
$t_data = unserialize($t_token);
} else {
$t_data = array();
}
$g_collapse_cache_token = $t_data;
$t_cookie = gpc_get_cookie('MANTIS_collapse_settings', '');
if (false !== $t_cookie && !is_blank($t_cookie)) {
$t_update = false;
$t_data = explode('|', $t_cookie);
foreach ($t_data as $t_pair) {
$t_pair = explode(',', $t_pair);
if (false !== $t_pair && count($t_pair) == 2) {
$g_collapse_cache_token[$t_pair[0]] = true == $t_pair[1];
$t_update = true;
}
}
if ($t_update) {
$t_token = serialize($g_collapse_cache_token);
token_set(TOKEN_COLLAPSE, $t_token, TOKEN_EXPIRY_COLLAPSE);
} else {
token_touch(TOKEN_COLLAPSE);
}
gpc_clear_cookie('MANTIS_collapse_settings');
}
}
示例4: plugin_require_api
* @copyright Copyright 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
* @copyright Copyright 2002 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
*/
require_once 'core.php';
plugin_require_api('core/graph_api.php');
access_ensure_project_level(config_get('view_summary_threshold'));
html_page_top();
print_summary_menu('summary_page.php');
echo '<br />';
print_summary_submenu();
$t_width = plugin_config_get('window_width');
$t_graph_width = (int) (($t_width - 50) * 0.6);
# gather the data for the graphs
$t_metrics = enum_bug_group(lang_get('priority_enum_string'), 'priority');
$t_token = token_set(TOKEN_GRAPH, json_encode($t_metrics));
?>
<br />
<table class="width100" cellspacing="1">
<tr>
<td class="form-title">
<?php
echo plugin_lang_get('graph_imp_priority_title');
?>
</td>
</tr>
<tr>
<td class="center">
<img src="<?php
echo plugin_page('summary_graph_bypriority.php');
?>
示例5: log_event
# does nothing. catch all case
# does nothing. catch all case
default:
log_event(LOG_FILTERING, 'view_all_set.php: default - do nothing');
break;
}
$tc_setting_arr = filter_ensure_valid_filter($t_setting_arr);
$t_settings_serialized = serialize($tc_setting_arr);
$t_settings_string = $t_cookie_version . '#' . $t_settings_serialized;
# If only using a temporary filter, don't store it in the database
if (!$f_temp_filter) {
# Store the filter string in the database: its the current filter, so some values won't change
$t_project_id = helper_get_current_project();
$t_project_id = $t_project_id * -1;
$t_row_id = filter_db_set_for_current_user($t_project_id, false, '', $t_settings_string);
# set cookie values
gpc_set_cookie(config_get('view_all_cookie'), $t_row_id, time() + config_get('cookie_time_length'), config_get('cookie_path'));
}
# redirect to print_all or view_all page
if ($f_print) {
$t_redirect_url = 'print_all_bug_page.php';
} else {
$t_redirect_url = 'view_all_bug_page.php';
}
if ($f_temp_filter) {
$t_token_id = token_set(TOKEN_FILTER, $t_settings_serialized);
$t_redirect_url = $t_redirect_url . '?filter=' . $t_token_id;
html_meta_redirect($t_redirect_url, 0);
} else {
print_header_redirect($t_redirect_url);
}
示例6: auth_set_tokens
/**
* Set authentication tokens for secure session.
* @param integer User ID
* @access public
*/
function auth_set_tokens($p_user_id)
{
$t_auth_token = token_get(TOKEN_AUTHENTICATED, $p_user_id);
if (null == $t_auth_token) {
token_set(TOKEN_AUTHENTICATED, true, config_get_global('reauthentication_expiry'), $p_user_id);
} else {
token_touch($t_auth_token['id'], config_get_global('reauthentication_expiry'));
}
}
示例7: lang_get
$t_show_update_button = true;
?>
<div class="field-container">
<span class="display-label"><span><?php
echo lang_get('username');
?>
</span></span>
<span class="input"><span class="field-value"><?php
echo string_display_line($u_username);
?>
</span></span>
<span class="label-style"></span>
</div><?php
# When verifying account, set a token and don't display current password
if ($t_account_verification) {
token_set(TOKEN_ACCOUNT_VERIFY, true, TOKEN_EXPIRY_AUTHENTICATED, $u_id);
} else {
?>
<div class="field-container">
<label for="password" <?php
echo $t_force_pw_reset_html;
?>
><span><?php
echo lang_get('current_password');
?>
</span></label>
<span class="input"><input id="password-current" type="password" name="password_current" size="32" maxlength="<?php
echo auth_get_password_max_size();
?>
" /></span>
<span class="label-style"></span>
示例8: 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);
token_set(TOKEN_ACCOUNT_ACTIVATION, $t_confirm_hash, TOKEN_EXPIRY_ACCOUNT_ACTIVATION, $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;
}
示例9: gpc_get_string
$category = gpc_get_string("category", "");
} else
{
if ( array_key_exists( $current_project, $categories_by_project) )
{
$category = $categories_by_project[ $current_project ];
}
}
if (isset($categories[$category]))
{
$category_ids = $categories[$category];
}
$categories_by_project[ $current_project ] = $category;
token_set( ScrumPlugin::TOKEN_SCRUM_CATEGORY, serialize( $categories_by_project), plugin_config_get('token_expiry') );
# Retrieve all bugs with the matching target version
$params = array();
$query = "SELECT id FROM {$bug_table} WHERE project_id IN (" . join(", ", $project_ids) . ")";
if ($target_version)
{
$query .= " AND target_version=" . db_param();
$params[] = $target_version;
}
if ($category_name)
{
$query .= " AND category_id IN (" . join(", ", $category_ids) . ")";
}
示例10: auth_set_tokens
/**
* Set authentication tokens for secure session.
* @param integer User ID
*/
function auth_set_tokens($p_user_id)
{
$t_auth_token = token_get(TOKEN_AUTHENTICATED, $p_user_id);
if (null == $t_auth_token) {
token_set(TOKEN_AUTHENTICATED, true, TOKEN_EXPIRY_AUTHENTICATED, $p_user_id);
} else {
token_touch($t_auth_token['id'], TOKEN_EXPIRY_AUTHENTICATED);
}
}
示例11: db_fetch_array
$t_row = db_fetch_array($t_result);
if (!$t_row) {
trigger_error(ERROR_LOST_PASSWORD_NOT_MATCHING_DATA, ERROR);
}
if (is_blank($f_email)) {
trigger_error(ERROR_LOST_PASSWORD_NO_EMAIL_SPECIFIED, ERROR);
}
$t_user_id = $t_row['id'];
if (user_is_protected($t_user_id)) {
trigger_error(ERROR_PROTECTED_ACCOUNT, ERROR);
}
if (!user_is_lost_password_request_allowed($t_user_id)) {
trigger_error(ERROR_LOST_PASSWORD_MAX_IN_PROGRESS_ATTEMPTS_REACHED, ERROR);
}
$t_confirm_hash = auth_generate_confirm_hash($t_user_id);
token_set(TOKEN_ACCOUNT_ACTIVATION, $t_confirm_hash, TOKEN_EXPIRY_ACCOUNT_ACTIVATION, $t_user_id);
email_send_confirm_hash_url($t_user_id, $t_confirm_hash);
user_increment_lost_password_in_progress_count($t_user_id);
form_security_purge('lost_pwd');
$t_redirect_url = 'login_page.php';
html_page_top();
?>
<br />
<div>
<table class="width50" cellspacing="1">
<tr>
<td class="center">
<strong><?php
echo lang_get('lost_password_done_title');
?>