function last_visited_get_array($p_user_id = null)
{
    $t_value = token_get_value(TOKEN_LAST_VISITED, $p_user_id);
    if (is_null($t_value)) {
        return array();
    }
    # we don't slice the array here to optimise for performance.  If the user reduces the number of recently
    # visited to track, then he/she will get the extra entries until visiting an issue.
    $t_ids = explode(',', $t_value);
    return $t_ids;
}
Example #2
0
/**
 * 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');
    }
}
<?php

# Mantis - a php based bugtracking system
# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
# Copyright (C) 2002 - 2004  Mantis Team   - mantisbt-dev@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
# --------------------------------------------------------
# $Id: summary_graph_bystatus_pct.php,v 1.15 2005/02/12 20:01:08 jlatour Exp $
# --------------------------------------------------------
require_once 'core.php';
$t_core_path = config_get('core_path');
require_once $t_core_path . 'graph_api.php';
access_ensure_project_level(config_get('view_summary_threshold'));
$f_width = gpc_get_int('width', 300);
$f_token = gpc_get_int('token', 0);
if (0 == $f_token) {
    $t_metrics = create_bug_enum_summary(lang_get('status_enum_string'), 'status');
} else {
    $t_metrics = unserialize(token_get_value($f_token));
}
graph_pie($t_metrics, lang_get('by_status_pct'), $f_width, $f_width);
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.
/**
 * @package MantisBT
 * @copyright Copyright 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
 * @copyright Copyright 2002  MantisBT Team - mantisbt-dev@lists.sourceforge.net
 * @link http://www.mantisbt.org
 */
/**
 * MantisBT Core API's
 */
require_once 'core.php';
require_once 'graph_api.php';
access_ensure_project_level(config_get('view_summary_threshold'));
$f_width = gpc_get_int('width', 300);
$t_token = token_get_value(TOKEN_GRAPH);
if ($t_token == null) {
    $t_metrics = create_bug_enum_summary(lang_get('status_enum_string'), 'status');
} else {
    $t_metrics = unserialize($t_token);
}
graph_pie($t_metrics, plugin_lang_get('by_status_pct'), $f_width, $f_width);
Example #5
0
/**
 * Returns the issue filter parameters for the current user
 *
 * @return Active issue filter for current user or false if no filter is currently defined.
 * @access public
 */
function current_user_get_bug_filter($p_project_id = null)
{
    $f_filter_string = gpc_get_string('filter', '');
    $t_view_all_cookie = '';
    $t_cookie_detail = '';
    $t_filter = '';
    if (!is_blank($f_filter_string)) {
        if (is_numeric($f_filter_string)) {
            $t_token = token_get_value(TOKEN_FILTER);
            if (null != $t_token) {
                $t_filter = unserialize($t_token);
            }
        } else {
            $t_filter = unserialize($f_filter_string);
        }
    } else {
        if (!filter_is_cookie_valid()) {
            return false;
        } else {
            $t_user_id = auth_get_current_user_id();
            $t_filter = user_get_bug_filter($t_user_id, $p_project_id);
        }
    }
    $t_filter = filter_ensure_valid_filter($t_filter);
    return $t_filter;
}
<?php

# Mantis - a php based bugtracking system
# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
# Copyright (C) 2002 - 2004  Mantis Team   - mantisbt-dev@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
# --------------------------------------------------------
# $Id: summary_graph_byseverity_pct.php,v 1.15 2005/02/12 20:01:08 jlatour Exp $
# --------------------------------------------------------
require_once 'core.php';
$t_core_path = config_get('core_path');
require_once $t_core_path . 'graph_api.php';
access_ensure_project_level(config_get('view_summary_threshold'));
$f_width = gpc_get_int('width', 300);
$f_token = gpc_get_int('token', 0);
if (0 == $f_token) {
    $t_metrics = create_bug_enum_summary(lang_get('severity_enum_string'), 'severity');
} else {
    $t_metrics = graph_total_metrics(unserialize(token_get_value($f_token)));
}
graph_pie($t_metrics, lang_get('by_severity_pct'), $f_width, $f_width);
Example #7
0
require_api('constant_inc.php');
require_api('current_user_api.php');
require_api('email_api.php');
require_api('form_api.php');
require_api('gpc_api.php');
require_api('html_api.php');
require_api('lang_api.php');
require_api('print_api.php');
require_api('string_api.php');
require_api('user_api.php');
require_api('utility_api.php');
form_security_validate('account_update');
$t_user_id = auth_get_current_user_id();
# If token is set, it's a password reset request from verify.php, and if
# not we need to reauthenticate the user
$t_account_verification = token_get_value(TOKEN_ACCOUNT_VERIFY, $t_user_id);
if (!$t_account_verification) {
    auth_reauthenticate();
}
auth_ensure_user_authenticated();
current_user_ensure_unprotected();
$f_email = gpc_get_string('email', '');
$f_realname = gpc_get_string('realname', '');
$f_password_current = gpc_get_string('password_current', '');
$f_password = gpc_get_string('password', '');
$f_password_confirm = gpc_get_string('password_confirm', '');
$t_redirect_url = 'index.php';
# @todo Listing what fields were updated is not standard behaviour of MantisBT - it also complicates the code.
$t_email_updated = false;
$t_password_updated = false;
$t_realname_updated = false;
Example #8
0
/**
* Returns the issue filter parameters for the current user
*
* @param integer $p_project_id Project id. This argument is only used if a 'filter' string is not passed via the web request.
*                              The default value is null meaning return the current filter for user's current project
                               if a filter string is not supplied.
* @return array User filter, if not set, then default filter.
* @access public
*/
function current_user_get_bug_filter($p_project_id = null)
{
    $f_filter_string = gpc_get_string('filter', '');
    $t_filter = '';
    if (!is_blank($f_filter_string)) {
        if (is_numeric($f_filter_string)) {
            $t_token = token_get_value(TOKEN_FILTER);
            if (null != $t_token) {
                $t_filter = json_decode($t_token, true);
            }
        } else {
            $t_filter = json_decode($f_filter_string, true);
        }
        $t_filter = filter_ensure_valid_filter($t_filter);
    } else {
        if (!filter_is_cookie_valid()) {
            $t_filter = filter_get_default();
        } else {
            $t_user_id = auth_get_current_user_id();
            $t_filter = user_get_bug_filter($t_user_id, $p_project_id);
        }
    }
    return $t_filter;
}
Example #9
0
		$category_name = category_full_name($category_id, false);

		if (isset($categories[$category_name]))
		{
			$categories[$category_name][] = $category_id;
		}
		else
		{
			$categories[$category_name] = array($category_id);
		}
	}
}

# Get the selected category
$categories_by_project = array();
$token_categories_by_project = token_get_value(ScrumPlugin::TOKEN_SCRUM_CATEGORY);

if ( !is_null( $token_categories_by_project ) )
{
	$categories_by_project = unserialize( $token_categories_by_project );
}

if ( gpc_isset("category") )
{
	$category = gpc_get_string("category", "");
} else
{
	if ( array_key_exists( $current_project, $categories_by_project) )
	{
		$category = $categories_by_project[ $current_project ];
	}
Example #10
0
require_api('gpc_api.php');
require_api('print_api.php');
require_api('user_api.php');
# check if at least one way to get here is enabled
if (OFF == config_get('allow_signup') && OFF == config_get('lost_password_feature') && OFF == config_get('send_reset_password')) {
    trigger_error(ERROR_LOST_PASSWORD_NOT_ENABLED, ERROR);
}
$f_user_id = gpc_get_string('id');
$f_confirm_hash = gpc_get_string('confirm_hash');
# force logout on the current user if already authenticated
if (auth_is_user_authenticated()) {
    auth_logout();
    # reload the page after logout
    print_header_redirect('verify.php?id=' . $f_user_id . '&confirm_hash=' . $f_confirm_hash);
}
$t_token_confirm_hash = token_get_value(TOKEN_ACCOUNT_ACTIVATION, $f_user_id);
if ($f_confirm_hash != $t_token_confirm_hash) {
    trigger_error(ERROR_LOST_PASSWORD_CONFIRM_HASH_INVALID, ERROR);
}
user_reset_failed_login_count_to_zero($f_user_id);
user_reset_lost_password_in_progress_count_to_zero($f_user_id);
# fake login so the user can set their password
auth_attempt_script_login(user_get_field($f_user_id, 'username'));
user_increment_login_count($f_user_id);
# extracts the user information
# and prefixes it with u_
$t_row = user_get_row($f_user_id);
extract($t_row, EXTR_PREFIX_ALL, 'u');
$t_can_change_password = helper_call_custom_function('auth_can_change_password', array());
html_page_top1();
html_page_top2a();
Example #11
0
require_api('constant_inc.php');
require_api('current_user_api.php');
require_api('email_api.php');
require_api('form_api.php');
require_api('gpc_api.php');
require_api('html_api.php');
require_api('lang_api.php');
require_api('print_api.php');
require_api('string_api.php');
require_api('user_api.php');
require_api('utility_api.php');
form_security_validate('account_update');
# If token is set, it's a password reset request from verify.php, and if
# not we need to reauthenticate the user
$t_verify_user_id = gpc_get('verify_user_id', false);
$t_account_verification = $t_verify_user_id ? token_get_value(TOKEN_ACCOUNT_VERIFY, $t_verify_user_id) : false;
if (!$t_account_verification) {
    auth_reauthenticate();
    $t_user_id = auth_get_current_user_id();
} else {
    # set a temporary cookie so the login information is passed between pages.
    auth_set_cookies($t_verify_user_id, false);
    # fake login so the user can set their password
    auth_attempt_script_login(user_get_field($t_verify_user_id, 'username'));
    $t_user_id = $t_verify_user_id;
}
auth_ensure_user_authenticated();
current_user_ensure_unprotected();
$f_email = gpc_get_string('email', '');
$f_realname = gpc_get_string('realname', '');
$f_password_current = gpc_get_string('password_current', '');