logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

mantisbt/core summary_api.php,1.32,1.33: msg#00066

Subject: mantisbt/core summary_api.php,1.32,1.33
Update of /cvsroot/mantisbt/mantisbt/core
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22861/core

Modified Files:
        summary_api.php 
Log Message:
0004737: [bugtracker] Summary page gives #401 error when no projects have been 
created.

Index: summary_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/summary_api.php,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- summary_api.php     23 Sep 2004 18:19:37 -0000      1.32
+++ summary_api.php     20 Oct 2004 01:11:01 -0000      1.33
@@ -39,7 +39,11 @@
                if ( ALL_PROJECTS == $t_project_id ) {
                        # Only projects to which the user have access
                        $t_accessible_projects_array = 
user_get_accessible_projects( $t_user_id );
-                       $t_project_filter = ' (project_id='. implode( ' OR 
project_id=', $t_accessible_projects_array ).')';
+                       if ( count( $t_accessible_projects_array ) > 0 ) {
+                               $t_project_filter = ' (project_id='. implode( ' 
OR project_id=', $t_accessible_projects_array ).')';
+                       } else {
+                               $t_project_filter = '1=1';
+                       }
                } else {
                        $t_project_filter = " project_id='$t_project_id'";
                }
@@ -170,7 +174,11 @@
                if ( ALL_PROJECTS == $t_project_id ) {
                        # Only projects to which the user have access
                        $t_accessible_projects_array = 
user_get_accessible_projects( $t_user_id );
-                       $specific_where = ' (project_id='. implode( ' OR 
project_id=', $t_accessible_projects_array ).')';
+                       if ( count( $t_accessible_projects_array ) > 0 ) {
+                               $specific_where = ' (project_id='. implode( ' 
OR project_id=', $t_accessible_projects_array ).')';
+                       } else {
+                               $specific_where = '1=1';
+                       }
                } else {
                        $specific_where = " project_id='$t_project_id'";
                }
@@ -213,7 +221,11 @@
                if ( ALL_PROJECTS == $t_project_id ) {
                        # Only projects to which the user have access
                        $t_accessible_projects_array = 
user_get_accessible_projects( $t_user_id );
-                       $specific_where = ' (project_id='. implode( ' OR 
project_id=', $t_accessible_projects_array ).')';
+                       if ( count( $t_accessible_projects_array ) > 0 ) {
+                               $specific_where = ' (project_id='. implode( ' 
OR project_id=', $t_accessible_projects_array ).')';
+                       } else {
+                               $specific_where = '1=1';
+                       }
                } else {
                        $specific_where = " project_id='$t_project_id'";
                }
@@ -308,7 +320,11 @@
                if ( ALL_PROJECTS == $t_project_id ) {
                        # Only projects to which the user have access
                        $t_accessible_projects_array = 
user_get_accessible_projects( $t_user_id );
-                       $specific_where = ' (project_id='. implode( ' OR 
project_id=', $t_accessible_projects_array ).')';
+                       if ( count( $t_accessible_projects_array ) > 0 ) {
+                               $specific_where = ' (project_id='. implode( ' 
OR project_id=', $t_accessible_projects_array ).')';
+                       } else {
+                               $specific_where = '1=1';
+                       }
                } else {
                        $specific_where = " project_id='$t_project_id'";
                }
@@ -386,7 +402,11 @@
                if ( ALL_PROJECTS == $t_project_id ) {
                        # Only projects to which the user have access
                        $t_accessible_projects_array = 
user_get_accessible_projects( $t_user_id );
-                       $specific_where = ' (project_id='. implode( ' OR 
project_id=', $t_accessible_projects_array ).')';
+                       if ( count( $t_accessible_projects_array ) > 0 ) {
+                               $specific_where = ' (project_id='. implode( ' 
OR project_id=', $t_accessible_projects_array ).')';
+                       } else {
+                               $specific_where = '1=1';
+                       }
                } else {
                        $specific_where = " project_id='$t_project_id'";
                }
@@ -510,7 +530,11 @@
                
                # Only projects to which the user have access
                $t_accessible_projects_array = user_get_accessible_projects( 
$t_user_id );
-               $specific_where = ' (project_id='. implode( ' OR project_id=', 
$t_accessible_projects_array ).')';
+               if ( count( $t_accessible_projects_array ) > 0 ) {
+                       $specific_where = ' (project_id='. implode( ' OR 
project_id=', $t_accessible_projects_array ).')';
+               } else {
+                       $specific_where = '1=1';
+               }
 
                $query = "SELECT project_id, status
                                FROM $t_mantis_bug_table
@@ -592,7 +616,11 @@
                if ( 0 == $t_project_id ) {
                        # Only projects to which the user have access
                        $t_accessible_projects_array = 
user_get_accessible_projects( $t_user_id );
-                       $specific_where = ' (project_id='. implode( ' OR 
project_id=', $t_accessible_projects_array ).')';
+                       if ( count( $t_accessible_projects_array ) > 0 ) {
+                               $specific_where = ' (project_id='. implode( ' 
OR project_id=', $t_accessible_projects_array ).')';
+                       } else {
+                               $specific_where = '1=1';
+                       }
                } else {
                        $specific_where = " project_id='$t_project_id'";
                }
@@ -701,7 +729,11 @@
                if ( 0 == $t_project_id ) {
                        # Only projects to which the user have access
                        $t_accessible_projects_array = 
user_get_accessible_projects( $t_user_id );
-                       $specific_where = ' (project_id='. implode( ' OR 
project_id=', $t_accessible_projects_array ).')';
+                       if ( count( $t_accessible_projects_array ) > 0 ) {
+                               $specific_where = ' (project_id='. implode( ' 
OR project_id=', $t_accessible_projects_array ).')';
+                       } else {
+                               $specific_where = '1=1';
+                       }
                } else {
                        $specific_where = " project_id='$t_project_id'";
                }
@@ -839,7 +871,11 @@
                if ( 0 == $t_project_id ) {
                        # Only projects to which the user have access
                        $t_accessible_projects_array = 
user_get_accessible_projects( $t_user_id );
-                       $specific_where = ' (project_id='. implode( ' OR 
project_id=', $t_accessible_projects_array ).')';
+                       if ( count( $t_accessible_projects_array ) > 0 ) {
+                               $specific_where = ' (project_id='. implode( ' 
OR project_id=', $t_accessible_projects_array ).')';
+                       } else {
+                               $specific_where = '1=1';
+                       }
                } else {
                        $specific_where = " project_id='$t_project_id'";
                }



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl


<Prev in Thread] Current Thread [Next in Thread>