示例#1
0
/**
 * Update a token
 * @param integer Token ID
 * @param string Token value
 * @param integer Token expiration in seconds
 * @return always true.
 */
function token_update($p_token_id, $p_value, $p_expiry = TOKEN_EXPIRY)
{
    token_ensure_exists($p_token_id);
    $c_token_id = db_prepare_int($p_token_id);
    $c_expiry = time() + $p_expiry;
    $t_tokens_table = db_get_table('mantis_tokens_table');
    $t_query = "UPDATE {$t_tokens_table}\n\t\t\t\t\tSET value=" . db_param() . ", expiry=" . db_param() . "\n\t\t\t\t\tWHERE id=" . db_param();
    db_query_bound($t_query, array((string) $p_value, $c_expiry, $c_token_id));
    return true;
}
示例#2
0
/**
 * Update a token
 * @param integer Token ID
 * @param string Token value
 * @param integer Token expiration in seconds
 */
function token_update($p_token_id, $p_value, $p_expiry = TOKEN_EXPIRY)
{
    token_ensure_exists($p_token_id);
    $c_token_id = db_prepare_int($p_token_id);
    $c_value = db_prepare_string($p_value);
    $c_expiry = db_timestamp(db_date(time() + $p_expiry));
    $t_tokens_table = config_get('mantis_tokens_table');
    $query = "UPDATE {$t_tokens_table} \n\t\t\t\t\tSET value='{$c_value}', expiry={$c_expiry}\n\t\t\t\t\tWHERE id={$c_token_id}";
    db_query($query);
    return true;
}
示例#3
0
/**
 * Update a token
 * @param integer Token ID
 * @param string Token value
 * @param integer Token expiration in seconds
 * @return always true.
 */
function token_update( $p_token_id, $p_value, $p_expiry = TOKEN_EXPIRY ) {
	token_ensure_exists( $p_token_id );
	$c_token_id = db_prepare_int( $p_token_id );
	$c_expiry = time() + $p_expiry;

	$t_tokens_table = db_get_table( 'tokens' );

	$t_query = "UPDATE $t_tokens_table
					SET value=" . db_param() . ", expiry=" . db_param() . "
					WHERE id=" . db_param();
	db_query_bound( $t_query, Array( $p_value, $c_expiry, $c_token_id ) );

	return true;
}
示例#4
0
/**
 * Update a token
 * @param integer $p_token_id A token identifier.
 * @param string  $p_value    The new token value.
 * @param integer $p_expiry   Token expiration in seconds.
 * @return boolean always true.
 */
function token_update($p_token_id, $p_value, $p_expiry = TOKEN_EXPIRY)
{
    token_ensure_exists($p_token_id);
    $c_token_id = (int) $p_token_id;
    $c_expiry = time() + $p_expiry;
    db_param_push();
    $t_query = 'UPDATE {tokens}
					SET value=' . db_param() . ', expiry=' . db_param() . '
					WHERE id=' . db_param();
    db_query($t_query, array((string) $p_value, $c_expiry, $c_token_id));
    return true;
}