[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: phpgwapi/inc class.categories.inc.php,1.106,1.10
From: |
Bettina Gille <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: phpgwapi/inc class.categories.inc.php,1.106,1.107 |
Date: |
Thu, 01 May 2003 19:23:24 -0400 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv14736
Modified Files:
class.categories.inc.php
Log Message:
update cats
Index: class.categories.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.categories.inc.php,v
retrieving revision 1.106
retrieving revision 1.107
diff -C2 -r1.106 -r1.107
*** class.categories.inc.php 21 Apr 2003 00:49:42 -0000 1.106
--- class.categories.inc.php 1 May 2003 23:23:22 -0000 1.107
***************
*** 54,58 ****
$this->account_id = $account_id;
! $this->app_name = $app_name;
$this->db = $GLOBALS['phpgw']->db;
$this->db2 = $this->db;
--- 54,58 ----
$this->account_id = $account_id;
! $this->app_name =
$GLOBALS['phpgw']->db->db_addslashes($app_name);
$this->db = $GLOBALS['phpgw']->db;
$this->db2 = $this->db;
***************
*** 70,79 ****
switch ($type)
{
! case 'subs': $s = " AND cat_parent
!= '0'"; break;
! case 'mains': $s = " AND cat_parent =
'0'"; break;
! case 'appandmains': $s = " AND
cat_appname='" . $this->app_name . "' AND cat_parent ='0'"; break;
! case 'appandsubs': $s = " AND
cat_appname='" . $this->app_name . "' AND cat_parent !='0'"; break;
case 'noglobal': $s = " AND cat_appname
!= '" . $this->app_name . "'"; break;
! case 'noglobalapp': $s = " AND cat_appname
= '" . $this->app_name . "' AND cat_owner != '" . $this->account_id . "'";
break;
default: return False;
}
--- 70,79 ----
switch ($type)
{
! case 'subs': $s = ' AND cat_parent
!= 0'; break;
! case 'mains': $s = ' AND cat_parent =
0'; break;
! case 'appandmains': $s = " AND
cat_appname='" . $this->app_name . "' AND cat_parent =0"; break;
! case 'appandsubs': $s = " AND
cat_appname='" . $this->app_name . "' AND cat_parent !=0"; break;
case 'noglobal': $s = " AND cat_appname
!= '" . $this->app_name . "'"; break;
! case 'noglobalapp': $s = " AND cat_appname
= '" . $this->app_name . "' AND cat_owner != " . $this->account_id; break;
default: return False;
}
***************
*** 92,99 ****
{
case 'app': $w = " WHERE
cat_appname='" . $this->app_name . "'"; break;
! case 'appandmains': $w = " WHERE
cat_appname='" . $this->app_name . "' AND cat_parent ='0'"; break;
! case 'appandsubs': $w = " WHERE
cat_appname='" . $this->app_name . "' AND cat_parent !='0'"; break;
! case 'subs': $w = " WHERE cat_parent
!= '0'"; break;
! case 'mains': $w = " WHERE cat_parent
= '0'"; break;
default: return False;
}
--- 92,99 ----
{
case 'app': $w = " WHERE
cat_appname='" . $this->app_name . "'"; break;
! case 'appandmains': $w = " WHERE
cat_appname='" . $this->app_name . "' AND cat_parent =0"; break;
! case 'appandsubs': $w = " WHERE
cat_appname='" . $this->app_name . "' AND cat_parent !=0"; break;
! case 'subs': $w = " WHERE cat_parent
!= 0"; break;
! case 'mains': $w = " WHERE cat_parent
= 0"; break;
default: return False;
}
***************
*** 120,124 ****
'name' =>
$this->db->f('cat_name'),
'descr' =>
$this->db->f('cat_description'),
! 'data' =>
$this->db->f('cat_data')
);
}
--- 120,125 ----
'name' =>
$this->db->f('cat_name'),
'descr' =>
$this->db->f('cat_description'),
! 'data' =>
$this->db->f('cat_data'),
! 'last_mod' =>
$this->db->f('last_mod')
);
}
***************
*** 138,143 ****
@result $cats array
*/
! function return_array($type,$start,$limit = True,$query =
'',$sort = '',$order = '',$globals = False, $parent_id = '')
{
if ($globals)
{
--- 139,149 ----
@result $cats array
*/
! function return_array($type,$start,$limit = True,$query =
'',$sort = '',$order = '',$globals = False, $parent_id = '',$lastmod = -1)
{
+ $start = intval($start);
+ $query = $this->db->db_addslashes($query);
+ $sort = $this->db->db_addslashes($sort);
+ $order = $this->db->db_addslashes($order);
+
if ($globals)
{
***************
*** 185,194 ****
if (strlen($parent_id) != 0)
{
! $parent_filter = " AND cat_parent='$parent_id'";
}
if ($query)
{
! $querymethod = " AND (cat_name LIKE '%$query%'
OR cat_description LIKE '%$query%') ";
}
--- 191,206 ----
if (strlen($parent_id) != 0)
{
! $parent_id = (int) $parent_id;
! $parent_filter = ' AND cat_parent=' .
$parent_id;
}
if ($query)
{
! $querymethod = " AND (cat_name LIKE '%$query%'
OR cat_description LIKE '%$query%')";
! }
!
! if($lastmod >= 0)
! {
! $querymethod .= ' AND lastmod > ' . $lastmod;
}
***************
*** 213,216 ****
--- 225,234 ----
function return_sorted_array($start,$limit = True,$query =
'',$sort = '',$order = '',$globals = False, $parent_id = '')
{
+ $start = intval($start);
+ $query = $this->db->db_addslashes($query);
+ $sort = $this->db->db_addslashes($sort);
+ $order = $this->db->db_addslashes($order);
+ $parent_id = intval($parent_id);
+
if ($globals)
{
***************
*** 234,238 ****
if ($this->account_id == '-1')
{
! $grant_cats = " cat_owner='-1' ";
}
else
--- 252,256 ----
if ($this->account_id == '-1')
{
! $grant_cats = ' cat_owner=-1 ';
}
else
***************
*** 254,265 ****
}
! if ($parent_id)
! {
! $parent_select = " AND cat_parent='$parent_id'";
! }
! else
! {
! $parent_select = " AND cat_parent='0'";
! }
if ($query)
--- 272,276 ----
}
! $parent_select = ' AND cat_parent=' . $parent_id;
if ($query)
***************
*** 289,293 ****
for ($i=0;$i < $num_cats;$i++)
{
! $sub_select = " AND cat_parent='" .
$cats[$i]['cat_id'] . "' AND cat_level='" . ($cats[$i]['level']+1) . "'";
/*$this->db2->query($sql .
$sub_select,__LINE__,__FILE__);
--- 300,304 ----
for ($i=0;$i < $num_cats;$i++)
{
! $sub_select = ' AND cat_parent=' .
$cats[$i]['cat_id'] . ' AND cat_level=' . ($cats[$i]['level']+1);
/*$this->db2->query($sql .
$sub_select,__LINE__,__FILE__);
***************
*** 542,548 ****
}
$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) VALUES ($id_val'" .
intval($values['parent']) . "','" . $this->account_id . "','" .
$values['access']
. "','" . $this->app_name . "','" .
$values['name'] . "','" . $values['descr'] . "','" . $values['data']
! . "','" . $values['main'] . "','" .
$values['level'] . "')",__LINE__,__FILE__);
$max =
$this->db->get_last_insert_id('phpgw_categories','cat_id');
--- 553,559 ----
}
$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']
! . "'," . $values['main'] . "," .
$values['level'] . "," . time() . ")",__LINE__,__FILE__);
$max =
$this->db->get_last_insert_id('phpgw_categories','cat_id');
***************
*** 550,555 ****
if (!$values['parent'] || $values['parent'] == 0)
{
! $this->db->query("UPDATE phpgw_categories SET
cat_main='" . $max . "' WHERE cat_id='"
! . $max .
"'",__LINE__,__FILE__);
}
return $max;
--- 561,565 ----
if (!$values['parent'] || $values['parent'] == 0)
{
! $this->db->query("UPDATE phpgw_categories SET
cat_main=" . $max . " WHERE cat_id=" . $max,__LINE__,__FILE__);
}
return $max;
***************
*** 587,592 ****
if ($cats[$i]['level'] == 1)
{
!
$this->db->query("UPDATE phpgw_categories set cat_level=0, cat_parent=0,
cat_main='" . intval($cats[$i]['cat_id'])
!
. "' WHERE cat_id='" . intval($cats[$i]['cat_id']) . "' AND cat_appname='" .
$this->app_name . "'",__LINE__,__FILE__);
$new_main =
$cats[$i]['cat_id'];
}
--- 597,602 ----
if ($cats[$i]['level'] == 1)
{
!
$this->db->query('UPDATE phpgw_categories set cat_level=0, cat_parent=0,
cat_main=' . intval($cats[$i]['cat_id'])
!
. ' WHERE cat_id=' . intval($cats[$i]['cat_id']) . "' AND cat_appname='" .
$this->app_name . "'",__LINE__,__FILE__);
$new_main =
$cats[$i]['cat_id'];
}
***************
*** 603,613 ****
}
!
$this->db->query("UPDATE phpgw_categories set cat_level='" .
($cats[$i]['level']-1) . "'" . $update_main . $update_parent
!
. " WHERE cat_id='" . intval($cats[$i]['cat_id']) . "' AND
cat_appname='" . $this->app_name . "'",__LINE__,__FILE__);
}
}
}
! $this->db->query("DELETE FROM phpgw_categories
WHERE cat_id='" . $cat_id . $subdelete . "'AND cat_appname='"
.
$this->app_name . "'",__LINE__,__FILE__);
}
--- 613,623 ----
}
!
$this->db->query('UPDATE phpgw_categories set cat_level=' .
($cats[$i]['level']-1) . $update_main . $update_parent
!
. ' WHERE cat_id=' . intval($cats[$i]['cat_id']) . "' AND
cat_appname='" . $this->app_name . "'",__LINE__,__FILE__);
}
}
}
! $this->db->query('DELETE FROM phpgw_categories
WHERE cat_id=' . $cat_id . $subdelete . "' AND cat_appname='"
.
$this->app_name . "'",__LINE__,__FILE__);
}
***************
*** 618,622 ****
if (!is_array($main))
{
! $this->db->query("SELECT * from
phpgw_categories WHERE cat_main = $main",__LINE__,__FILE__);
$main = $this->db2cats();
//echo "main: "; _debug_array($main);
--- 628,632 ----
if (!is_array($main))
{
! $this->db->query('SELECT * from
phpgw_categories WHERE cat_main=' . $main,__LINE__,__FILE__);
$main = $this->db2cats();
//echo "main: "; _debug_array($main);
***************
*** 714,718 ****
$sql = "UPDATE phpgw_categories SET cat_name='" .
$values['name'] . "', cat_description='" . $values['descr']
. "', cat_data='" . $values['data'] .
"', cat_parent=" . intval($values['parent']) . ", cat_access='"
! . $values['access'] . "', cat_main=" .
$values['main'] . ", cat_level=" . $values['level']
. " WHERE cat_appname='" .
$this->app_name . "' AND cat_id=" . intval($values['cat_id']);
$this->db->query($sql,__LINE__,__FILE__);
--- 724,728 ----
$sql = "UPDATE phpgw_categories SET cat_name='" .
$values['name'] . "', cat_description='" . $values['descr']
. "', cat_data='" . $values['data'] .
"', cat_parent=" . intval($values['parent']) . ", cat_access='"
! . $values['access'] . "', cat_main=" .
$values['main'] . ", cat_level=" . $values['level'] . ", last_mod=" . time()
. " WHERE cat_appname='" .
$this->app_name . "' AND cat_id=" . intval($values['cat_id']);
$this->db->query($sql,__LINE__,__FILE__);
***************
*** 763,767 ****
}
! $this->db->query("SELECT $value FROM phpgw_categories
WHERE cat_id='" . $cat_id . "'",__LINE__,__FILE__);
$this->db->next_record();
--- 773,777 ----
}
! $this->db->query("SELECT $value FROM phpgw_categories
WHERE cat_id=" . $cat_id,__LINE__,__FILE__);
$this->db->next_record();
***************
*** 807,816 ****
if ($cat_id)
{
! $cat_exists = " cat_parent='$cat_id' ";
}
if ($cat_name && $cat_id)
{
! $cat_exists = " cat_name='" .
$this->db->db_addslashes($cat_name) . "' AND cat_id != '$cat_id' ";
}
--- 817,826 ----
if ($cat_id)
{
! $cat_exists = ' cat_parent=' . $cat_id;
}
if ($cat_name && $cat_id)
{
! $cat_exists = " cat_name='" .
$this->db->db_addslashes($cat_name) . "' AND cat_id != " . $cat_id;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: phpgwapi/inc class.categories.inc.php,1.106,1.107,
Bettina Gille <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: felamimail/templates/default mainscreen.tpl,1.1.1.1.2.5,1.1.1.1.2.5.2.1
- Next by Date:
[Phpgroupware-cvs] CVS: phpgwapi/setup setup.inc.php,1.55,1.56 tables_current.inc.php,1.44,1.45 tables_update.inc.php,1.69,1.70
- Previous by thread:
[Phpgroupware-cvs] CVS: felamimail/templates/default mainscreen.tpl,1.1.1.1.2.5,1.1.1.1.2.5.2.1
- Next by thread:
[Phpgroupware-cvs] CVS: phpgwapi/setup setup.inc.php,1.55,1.56 tables_current.inc.php,1.44,1.45 tables_update.inc.php,1.69,1.70
- Index(es):