phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: todo/inc class.so.inc.php,1.7,1.8


From: Miles Lott <address@hidden>
Subject: [Phpgroupware-cvs] CVS: todo/inc class.so.inc.php,1.7,1.8
Date: Tue, 07 May 2002 08:59:51 -0400

Update of /cvsroot/phpgroupware/todo/inc
In directory subversions:/tmp/cvs-serv23736/todo/inc

Modified Files:
        class.so.inc.php 
Log Message:
May need some work, but try to trap quotes in a search



Index: class.so.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/todo/inc/class.so.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.so.inc.php    14 Apr 2002 03:41:54 -0000      1.7
--- class.so.inc.php    7 May 2002 12:59:48 -0000       1.8
***************
*** 18,30 ****
                var $grants;
                var $historylog;
  
                function so()
                {
!                       $this->db                       = $GLOBALS['phpgw']->db;
!                       $this->db2                      = $this->db;
!                       $this->grants           = 
$GLOBALS['phpgw']->acl->get_grants('todo');
!                       $this->user_groups      = 
$GLOBALS['phpgw']->accounts->membership($this->account);
!                       $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
!                       $this->historylog       = 
CreateObject('phpgwapi.historylog','todo');
  
                        // This is so our transactions follow across classes
--- 18,32 ----
                var $grants;
                var $historylog;
+               var $app_link;
  
                function so()
                {
!                       $this->db          = $GLOBALS['phpgw']->db;
!                       $this->db2         = $this->db;
!                       $this->grants      = 
$GLOBALS['phpgw']->acl->get_grants('todo');
!                       $this->user_groups = 
$GLOBALS['phpgw']->accounts->membership($this->account);
!                       $this->account     = 
$GLOBALS['phpgw_info']['user']['account_id'];
!                       $this->historylog  = 
CreateObject('phpgwapi.historylog','todo');
!                       $this->app_link    = 
CreateObject('phpgwapi.app_link','todo');
  
                        // This is so our transactions follow across classes
***************
*** 36,41 ****
                        switch ($tree)
                        {
!                               case 'mains':   $s = " and todo_id_parent = 
'0'"; break;
!                               case 'subs':    $s = " and todo_id_parent != 
'0'"; break;
                                default: return False;
                        }
--- 38,43 ----
                        switch ($tree)
                        {
!                               case 'mains': $s = " and todo_id_parent = '0'"; 
break;
!                               case 'subs':  $s = " and todo_id_parent != 
'0'"; break;
                                default: return False;
                        }
***************
*** 47,51 ****
                        $type = $this->type($tree);
  
!                       if ($order)
                        {
                                $ordermethod = 'order by ' . $order . ' ' . 
$sort;
--- 49,53 ----
                        $type = $this->type($tree);
  
!                       if($order)
                        {
                                $ordermethod = 'order by ' . $order . ' ' . 
$sort;
***************
*** 58,62 ****
                        $filter = strtolower($filter);
  
!                       if (! $filter)
                        {
                                $filter = 'none';
--- 60,64 ----
                        $filter = strtolower($filter);
  
!                       if(!$filter)
                        {
                                $filter = 'none';
***************
*** 64,70 ****
  
                        $filtermethod = "(( todo_owner='" . $this->account . "' 
OR todo_assigned like '%," . $this->account . ",%' OR todo_assigned='"
!                                                               . 
$this->account . "'";
  
!                       if (is_array($this->user_groups))
                        {
                                $groups = $this->user_groups;
--- 66,72 ----
  
                        $filtermethod = "(( todo_owner='" . $this->account . "' 
OR todo_assigned like '%," . $this->account . ",%' OR todo_assigned='"
!                               . $this->account . "'";
  
!                       if(is_array($this->user_groups))
                        {
                                $groups = $this->user_groups;
***************
*** 77,91 ****
                        $filtermethod .= ')';
  
!                       if ($filter == 'none')
                        {
!                               if (is_array($this->grants))
                                {
                                        $grants = $this->grants;
!                                       while (list($user) = each($grants))
                                        {
                                                $public_user_list[] = $user;
                                        }
                                        reset($public_user_list);
!                                       $filtermethod .= " OR 
(todo_access='public' AND todo_owner in(" . implode(',',$public_user_list) . 
"))";
                                }
                        }
--- 79,93 ----
                        $filtermethod .= ')';
  
!                       if($filter == 'none')
                        {
!                               if(is_array($this->grants))
                                {
                                        $grants = $this->grants;
!                                       while(list($user) = each($grants))
                                        {
                                                $public_user_list[] = $user;
                                        }
                                        reset($public_user_list);
!                                       $filtermethod .= " OR 
(todo_access='public' AND todo_owner IN(" . implode(',',$public_user_list) . 
"))";
                                }
                        }
***************
*** 93,112 ****
                        $filtermethod .= ')';
  
!                       if ($filter == 'private')
                        {
                                $filtermethod .=  " AND todo_access='private'";
                        }
  
!                       if ($cat_id)
                        {
                                $filtermethod .= " AND todo_cat='$cat_id'";
                        }
  
!                       if ($query)
                        {
!                               $querymethod = " AND (todo_des like '%$query%' 
OR todo_title like '%$query%')";
                        }
  
!                       if ($parent)
                        {
                                $parentmethod = " AND todo_id_parent='$parent'";
--- 95,117 ----
                        $filtermethod .= ')';
  
!                       if($filter == 'private')
                        {
                                $filtermethod .=  " AND todo_access='private'";
                        }
  
!                       if($cat_id)
                        {
                                $filtermethod .= " AND todo_cat='$cat_id'";
                        }
  
!                       if($query)
                        {
!                               $query = ereg_replace("'",'',$query);
!                               $query = ereg_replace('"','',$query);
! 
!                               $querymethod = " AND (todo_des LIKE '%$query%' 
OR todo_title LIKE '%$query%')";
                        }
  
!                       if($parent)
                        {
                                $parentmethod = " AND todo_id_parent='$parent'";
***************
*** 115,119 ****
                        $sql = "SELECT * FROM phpgw_todo WHERE $filtermethod 
$querymethod $type $parentmethod";
  
!                       if ($limit)
                        {
                                $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
--- 120,124 ----
                        $sql = "SELECT * FROM phpgw_todo WHERE $filtermethod 
$querymethod $type $parentmethod";
  
!                       if($limit)
                        {
                                $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
***************
*** 126,130 ****
                        $this->total_records = $this->db->num_rows();
  
!                       while ($this->db->next_record())
                        {
                                $todos[] = array
--- 131,135 ----
                        $this->total_records = $this->db->num_rows();
  
!                       while($this->db->next_record())
                        {
                                $todos[] = array
***************
*** 200,205 ****
                        if ($values['parent'] && $values['parent'] != 0)
                        {
!                               $values['main']         = 
$this->return_value($values['parent']);
!                               $values['level']        = 
$this->return_value($values['parent'],'level')+1;
                        }
  
--- 205,210 ----
                        if ($values['parent'] && $values['parent'] != 0)
                        {
!                               $values['main']  = 
$this->return_value($values['parent']);
!                               $values['level'] = 
$this->return_value($values['parent'],'level')+1;
                        }
  
***************
*** 223,227 ****
  
                                $this->db->query("update phpgw_todo set 
todo_id_main='" . $max . "' "
!                                                               . "where 
todo_id='" . $max . "'",__LINE__,__FILE__);
                        }
  
--- 228,232 ----
  
                                $this->db->query("update phpgw_todo set 
todo_id_main='" . $max . "' "
!                                       . "where todo_id='" . $max . 
"'",__LINE__,__FILE__);
                        }
  
***************
*** 233,237 ****
                {
                        $this->db->transaction_begin();
!                       if ($sub)
                        {
                                $subdelete = " or todo_id_parent='$todo_id' or 
todo_id_main='$todo_id' ";
--- 238,242 ----
                {
                        $this->db->transaction_begin();
!                       if($sub)
                        {
                                $subdelete = " or todo_id_parent='$todo_id' or 
todo_id_main='$todo_id' ";
***************
*** 239,243 ****
  
                        $this->db->query("delete from phpgw_todo where 
todo_id='$todo_id' $subdelete and ((todo_access='public' "
!                                                       . "and todo_owner != '" 
. $this->account . "') or (todo_owner='" . $this->account . 
"'))",__LINE__,__FILE__);
                        $this->historylog->delete($todo_id);
                        $this->db->transaction_commit();
--- 244,248 ----
  
                        $this->db->query("delete from phpgw_todo where 
todo_id='$todo_id' $subdelete and ((todo_access='public' "
!                               . "and todo_owner != '" . $this->account . "') 
or (todo_owner='" . $this->account . "'))",__LINE__,__FILE__);
                        $this->historylog->delete($todo_id);
                        $this->db->transaction_commit();
***************
*** 246,250 ****
                function edit_todo($values)
                {
!                       if ($values['parent'] && $values['parent'] != 0)
                        {
                                $values['main'] = 
$this->return_value($values['parent']);
--- 251,255 ----
                function edit_todo($values)
                {
!                       if($values['parent'] && $values['parent'] != 0)
                        {
                                $values['main'] = 
$this->return_value($values['parent']);
***************
*** 260,304 ****
  
                        $this->db->transaction_begin();
!                       if ($old_values['descr'] != $values['descr'])
                        {
                                
$this->historylog->add('D',$values['id'],$values['descr']);
                        }
  
!                       if (($old_values['parent'] || $values['parent']) && 
($old_values['parent'] != $values['parent']))
                        {
                                
$this->historylog->add('P',$values['id'],$values['parent']);
                        }
  
!                       if ($old_values['pri'] != $values['pri'])
                        {
                                
$this->historylog->add('U',$values['id'],$values['pri']);
                        }
  
!                       if ($old_values['status'] != $values['status'])
                        {
                                
$this->historylog->add('s',$values['id'],$values['status']);
                        }
  
!                       if ($old_values['access'] != $values['access'])
                        {
                                
$this->historylog->add('a',$values['id'],$values['access']);
                        }
  
!                       if (($old_values['sdate'] || $values['sdate']) && 
($old_values['sdate'] != $values['sdate']))
                        {
                                
$this->historylog->add('S',$values['id'],$values['sdate']);
                        }
  
!                       if (($old_values['edate'] || $values['edate']) && 
($old_values['edate'] != $values['edate']))
                        {
                                
$this->historylog->add('E',$values['id'],$values['edate']);
                        }
  
!                       if ($old_values['title'] != $values['title'])
                        {
                                
$this->historylog->add('T',$values['id'],$values['title']);
                        }
  
!                       if ($old_values['cat'] != $values['cat'])
                        {
                                
$this->historylog->add('C',$values['id'],$values['cat']);
--- 265,309 ----
  
                        $this->db->transaction_begin();
!                       if($old_values['descr'] != $values['descr'])
                        {
                                
$this->historylog->add('D',$values['id'],$values['descr']);
                        }
  
!                       if(($old_values['parent'] || $values['parent']) && 
($old_values['parent'] != $values['parent']))
                        {
                                
$this->historylog->add('P',$values['id'],$values['parent']);
                        }
  
!                       if($old_values['pri'] != $values['pri'])
                        {
                                
$this->historylog->add('U',$values['id'],$values['pri']);
                        }
  
!                       if($old_values['status'] != $values['status'])
                        {
                                
$this->historylog->add('s',$values['id'],$values['status']);
                        }
  
!                       if($old_values['access'] != $values['access'])
                        {
                                
$this->historylog->add('a',$values['id'],$values['access']);
                        }
  
!                       if(($old_values['sdate'] || $values['sdate']) && 
($old_values['sdate'] != $values['sdate']))
                        {
                                
$this->historylog->add('S',$values['id'],$values['sdate']);
                        }
  
!                       if(($old_values['edate'] || $values['edate']) && 
($old_values['edate'] != $values['edate']))
                        {
                                
$this->historylog->add('E',$values['id'],$values['edate']);
                        }
  
!                       if($old_values['title'] != $values['title'])
                        {
                                
$this->historylog->add('T',$values['id'],$values['title']);
                        }
  
!                       if($old_values['cat'] != $values['cat'])
                        {
                                
$this->historylog->add('C',$values['id'],$values['cat']);
***************
*** 321,330 ****
                        switch($action)
                        {
!                               case 'main':    $item = 'todo_id_main'; break;
!                               case 'level':   $item = 'todo_level'; break;
                        }
  
                        $this->db->query("select $item from phpgw_todo where 
todo_id='$todo_id'",__LINE__,__FILE__);
!                       if ($this->db->next_record())
                        {
                                return $this->db->f(0);
--- 326,335 ----
                        switch($action)
                        {
!                               case 'main':  $item = 'todo_id_main'; break;
!                               case 'level': $item = 'todo_level'; break;
                        }
  
                        $this->db->query("select $item from phpgw_todo where 
todo_id='$todo_id'",__LINE__,__FILE__);
!                       if($this->db->next_record())
                        {
                                return $this->db->f(0);
***************
*** 337,341 ****
                        $this->db->next_record();
  
!                       if ($this->db->f(0))
                        {
                                return True;
--- 342,346 ----
                        $this->db->next_record();
  
!                       if($this->db->f(0))
                        {
                                return True;




reply via email to

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