Skip to content

Commit

Permalink
* core/helper_api.php
Browse files Browse the repository at this point in the history
  (helper_get_current_project): account for the case where a the project
    specified in a user's preference doesn't exist or is no longer
    accessible.  Return 0 in these cases.


git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@1841 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Julian Fitzell committed Feb 15, 2003
1 parent b9f85e5 commit b8a6b82
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions core/helper_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: helper_api.php,v 1.34 2003-01-16 10:36:20 jfitzell Exp $
# $Id: helper_api.php,v 1.35 2003-02-15 07:43:49 jfitzell Exp $
# --------------------------------------------------------

###########################################################################
Expand Down Expand Up @@ -130,10 +130,15 @@ function helper_get_current_project() {
$t_project_id = gpc_get_cookie( $t_cookie_name, null );

if ( null === $t_project_id ) {
return (int)current_user_get_pref( 'default_project' );
} else {
return (int)$t_project_id;
$t_project_id = current_user_get_pref( 'default_project' );

if ( ! project_exists( $t_project_id ) ||
! access_has_project_level( VIEWER, $t_project_id ) ) {
$t_project_id = 0;
}
}

return (int)$t_project_id;
}
# --------------------
# Set the current project id (stored in a cookie)
Expand Down

0 comments on commit b8a6b82

Please sign in to comment.