phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] phpbrain/inc/class.bokb.inc.php, 1.17.2.1


From: nomail
Subject: [Phpgroupware-cvs] phpbrain/inc/class.bokb.inc.php, 1.17.2.1
Date: Fri, 21 May 2004 04:18:19 +0200

Update of /phpbrain/inc
Modified Files:
        Branch: Version-0_9_16-branch
          class.bokb.inc.php

date: 2004/05/21 02:18:19;  author: skwashd;  state: Exp;  lines: +36 -30

Log Message:
fix bug in support #103083, bug #8966 & update headers
=====================================================================
Index: phpbrain/inc/class.bokb.inc.php
diff -u phpbrain/inc/class.bokb.inc.php:1.17 
phpbrain/inc/class.bokb.inc.php:1.17.2.1
--- phpbrain/inc/class.bokb.inc.php:1.17        Sun Sep  7 04:09:54 2003
+++ phpbrain/inc/class.bokb.inc.php     Fri May 21 02:18:19 2004
@@ -8,9 +8,6 @@
  *                                                                     *
  * Originally Written by Dave Hall - <skwashd at phpgroupware.org>     *
  * Loosely Based on phpBrain from Bart Veldhuizen - http://vrotvrot.com *
- * --------------------------------------------                                
*
- *  Development Sponsored by Creativix                                 *
- * --------------------------------------------                                
*
  * This program is Free Software; you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
  * the Free Software Foundation; either version 2 of the License, or   *
@@ -36,39 +33,48 @@
                
                function get_cat_data($cat_id)
                {
-                       $cat_id = (int) $cat_id;
-                       $cats = $this->cats->return_array('all', 0, False, '', 
'', '', False, $cat_id);
-                       if(is_array($cats))
+                       if($cat_id)
                        {
-                       foreach ($cats as $c_key => $c_vals)
-                       {
-                               $id = $c_vals['id'];
-                               $return_cats[$id] = array('name'                
=> $c_vals['name'],
-                                                                               
'num_entries'   => $this->so->get_count($id)
-                                                                               
);
-  
-                               $sub_cats = $this->cats->return_array('subs', 
0, False, '', '', '', False, $id);
-                               if(is_array($sub_cats))
+                               $level = 'subs';
+                       }
+                       else
+                       {
+                               $level = 'mains';
+                       }
+
+                       $cats = $this->cats->return_array($level, 0, False, '', 
'', '', False, $cat_id);
+                       
+                       if( count($cats) )
+                       {
+                               foreach ($cats as $c_key => $c_vals)
                                {
-                                       foreach($sub_cats as $sub_key => 
$sub_vals)
-                                       {
-                                               $sub_id = $sub_vals['id'];
-                                               
$return_cats[$id]['subs'][$sub_id] 
-                                                       = array('name'  => 
$sub_vals['name'],
-                                                               'num_entries'   
=> $this->so->get_count($sub_id)
-                                                               );
-                                       }//end foreach(subcats)
-                                       unset($sub_cats);
-                               }//end if is_array(sub_cats)
-                       }//end foreach(cats)
+                                       $id = $c_vals['id'];
+                                       $return_cats[$id] = array('name'        
=> $c_vals['name'],
+                                                               'num_entries'   
=> $this->so->get_count($id)
+                                                       );
+  
+                                       $sub_cats = 
$this->cats->return_array('subs', 0, False, '', '', '', False, $id);
+                                       if( count($sub_cats) )
+                                       {
+                                               foreach($sub_cats as $sub_key 
=> $sub_vals)
+                                               {
+                                                       $sub_id = 
$sub_vals['id'];
+                                                       
$return_cats[$id]['subs'][$sub_id] 
+                                                               = array('name'  
=> $sub_vals['name'],
+                                                                       
'num_entries'   => $this->so->get_count($sub_id)
+                                                                       );
+                                               }
+                                               unset($sub_cats);
+                                       }
+                               }
                                return $return_cats;
                        }
                        else //no cats
                        {
-                               return false;
-                       }//end if is_array(cats)
+                               return array();
+                       }
 
-               }//end get_cat_data
+               }
                
                function delete_comment($comment_id)
                {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]