phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] phpgwapi/inc class.categories.inc.php


From: Dave Hall
Subject: [Phpgroupware-cvs] phpgwapi/inc class.categories.inc.php
Date: Wed, 04 Oct 2006 01:25:30 +0000

CVSROOT:        /sources/phpgwapi
Module name:    phpgwapi
Changes by:     Dave Hall <skwashd>     06/10/04 01:25:30

Modified files:
        inc            : class.categories.inc.php 

Log message:
        notices

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.categories.inc.php?cvsroot=phpgwapi&r1=1.133&r2=1.134

Patches:
Index: class.categories.inc.php
===================================================================
RCS file: /sources/phpgwapi/phpgwapi/inc/class.categories.inc.php,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -b -r1.133 -r1.134
--- class.categories.inc.php    9 Sep 2006 11:41:03 -0000       1.133
+++ class.categories.inc.php    4 Oct 2006 01:25:30 -0000       1.134
@@ -7,7 +7,7 @@
        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage utilities
-       * @version $Id: class.categories.inc.php,v 1.133 2006/09/09 11:41:03 
skwashd Exp $
+       * @version $Id: class.categories.inc.php,v 1.134 2006/10/04 01:25:30 
skwashd Exp $
        */
 
        /**
@@ -41,7 +41,7 @@
                                $app_name = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        }
 
-                       $this->account_id       = $account_id;
+                       $this->account_id       = (int) $account_id;
                        $this->db                       =& 
$GLOBALS['phpgw']->db;
                        $this->set_appname($app_name);
                }
@@ -380,7 +380,8 @@
                                $k=0;
                                for($i=$start;$i<$max;++$i)
                                {
-                                       if(is_array($cats[$i]))
+                                       if ( isset($cats[$i]) && 
+                                               is_array($cats[$i]) )
                                        {
                                                $scats[$k] = $cats[$i];
                                                ++$k;
@@ -552,7 +553,7 @@
                        }
                        else
                        {
-                               return False;
+                               return array();
                        }
 
                        if (!is_array($selected))
@@ -562,11 +563,11 @@
 
                        if ($type != 'all')
                        {
-                               $cats = 
$this->return_array($type,$start,False,$query,$sort,$order,$globals);
+                               $cats = $this->return_array($type, 0, false, 
'', '', '',$globals);
                        }
                        else
                        {
-                               $cats = 
$this->return_sorted_array($start,False,$query,$sort,$order,$globals);
+                               $cats = $this->return_sorted_array(0, false, 
'', '', '',$globals);
                        }
 
                        
$GLOBALS['phpgw']->xslttpl->add_file($GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','base')
 . SEP . 'categories');
@@ -636,28 +637,32 @@
                */
                function add($values)
                {
-                       $values['id']           = intval($values['id']);
-                       $values['parent']       = intval($values['parent']);
+                       $values['id']           = isset($values['id']) ? (int) 
$values['id'] : 0;
+                       $values['parent']       = isset($values['parent']) ? 
(int) $values['parent'] : 0;
 
+                       $values['level'] = 0;
+                       $values['main'] = 0;
                        if ($values['parent'] > 0)
                        {
-                               $values['level']        = 
$this->id2name($values['parent'],'level')+1;
-                               $values['main']         = 
$this->id2name($values['parent'],'main');
+                               $values['level']        = (int) 
$this->id2name($values['parent'],'level')+1;
+                               $values['main']         = (int) 
$this->id2name($values['parent'],'main');
                        }
 
                        $values['descr'] = 
$this->db->db_addslashes($values['descr']);
                        $values['name'] = 
$this->db->db_addslashes($values['name']);
+                       $values['data'] = isset($values['data']) ? 
$this->db->db_addslashes($values['data']) : '';
 
+                       $id_col = '';
+                       $id_val = '';
                        if ($values['id'] > 0)
                        {
                                $id_col = 'cat_id,';
                                $id_val = $values['id'] . ',';
                        }
 
-                       $this->db->query('INSERT INTO phpgw_categories (' . 
$id_col . 
'cat_parent,cat_owner,cat_access,cat_appname,cat_name,cat_description,cat_data,'
-                               . 'cat_main,cat_level, last_mod) VALUES (' . 
$id_val  . intval($values['parent']) . ',' . $this->account_id . ",'" . 
$values['access']
-                               . "','" . $this->app_name . "','" . 
$values['name'] . "','" . $values['descr'] . "','" . $values['data']
-                               . "'," . intval($values['main']) . ',' . 
intval($values['level']) . ',' . time() . ')',__LINE__,__FILE__);
+                       $this->db->query("INSERT INTO phpgw_categories ($id_col 
cat_parent, cat_owner, cat_access, cat_appname, cat_name, cat_description, 
cat_data, cat_main ,cat_level, last_mod)"
+                               . " VALUES ($id_val {$values['parent']}, 
{$this->account_id}, '{$values['access']}', '{$this->app_name}',"
+                                       ."'{$values['name']}', 
'{$values['descr']}', '{$values['data']}', {$values['main']}, 
{$values['level']}," . time() . ')',__LINE__,__FILE__);
 
                        if ($values['id'] > 0)
                        {
@@ -695,7 +700,9 @@
                */
                function delete($cat_id, $drop_subs = False, $modify_subs = 
False)
                {
-                       $cat_id = intval($cat_id);
+                       $cat_id = (int)$cat_id;
+
+                       $subdelete = '';
                        if ($drop_subs)
                        {
                                $subdelete = ' OR cat_parent=' . $cat_id . ' OR 
cat_main=' . $cat_id; 




reply via email to

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