phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: phpgwapi/inc class.browser.inc.php, 1.14.2.2, 1


From: Dave Hall <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.browser.inc.php, 1.14.2.2, 1.14.2.2.2.1 class.contacts_sql.inc.php, 1.17.2.2.2.5, 1.17.2.2.2.6 class.sql_entity.inc.php, 1.1.2.3, 1.1.2.4
Date: Tue, 16 Sep 2003 19:28:07 -0400

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv15426

Modified Files:
      Tag: Version-0_9_16-branch
        class.browser.inc.php class.contacts_sql.inc.php 
        class.sql_entity.inc.php 
Log Message:
code from jarg - dunno what it does :)

Index: class.browser.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.browser.inc.php,v
retrieving revision 1.14.2.2
retrieving revision 1.14.2.2.2.1
diff -C2 -r1.14.2.2 -r1.14.2.2.2.1
*** class.browser.inc.php       25 Apr 2002 09:45:50 -0000      1.14.2.2
--- class.browser.inc.php       16 Sep 2003 23:28:04 -0000      1.14.2.2.2.1
***************
*** 36,40 ****
                function browser()
                {
!                       global $HTTP_USER_AGENT;
                        /*
                                Determine browser and version
--- 36,40 ----
                function browser()
                {
!                       $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
                        /*
                                Determine browser and version
***************
*** 57,64 ****
                                $this->BROWSER_AGENT = 'iCab';
                        } 
!                       
elseif(eregi('Netscape6/([0-9].[0-9a-zA-Z]{1,4})',$HTTP_USER_AGENT,$log_version))
 
                        {
                                $this->BROWSER_VER   = $log_version[1];
!                               $this->BROWSER_AGENT = 'Netscape';
                        }
                        
elseif(ereg('Konqueror/([0-9].[0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version) 
||
--- 57,64 ----
                                $this->BROWSER_AGENT = 'iCab';
                        } 
!                       elseif(ereg('Gecko',$HTTP_USER_AGENT,$log_version))
                        {
                                $this->BROWSER_VER   = $log_version[1];
!                               $this->BROWSER_AGENT = 'MOZILLA';
                        }
                        
elseif(ereg('Konqueror/([0-9].[0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version) 
||
***************
*** 68,76 ****
                                $this->BROWSER_AGENT='Konqueror';
                        }
-                       
elseif(ereg('Mozilla/([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version))
-                       {
-                               $this->BROWSER_VER=$log_version[1];
-                               $this->BROWSER_AGENT='MOZILLA';
-                       }
                        else
                        {
--- 68,71 ----
***************
*** 258,264 ****
                function 
content_header($fn='',$mime='',$length='',$nocache=True)
                {
!                       if(!$mime)
                        {
!                               $mime='application/octet-stream';
                        }
                        if($fn)
--- 253,260 ----
                function 
content_header($fn='',$mime='',$length='',$nocache=True)
                {
!                       if($mime != 'text/plain')
                        {
!                               $mime_magic = 
createObject('phpgwapi.mime_magic');
!                               $mime = $mime_magic->ext2mime($fn);
                        }
                        if($fn)

Index: class.contacts_sql.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.contacts_sql.inc.php,v
retrieving revision 1.17.2.2.2.5
retrieving revision 1.17.2.2.2.6
diff -C2 -r1.17.2.2.2.5 -r1.17.2.2.2.6
*** class.contacts_sql.inc.php  12 Sep 2003 23:33:14 -0000      1.17.2.2.2.5
--- class.contacts_sql.inc.php  16 Sep 2003 23:28:04 -0000      1.17.2.2.2.6
***************
*** 1747,1750 ****
--- 1747,1767 ----
  
                /**
+               * Delete relations between an org and their related person
+               *
+               * @param mixed $cid The contact_id or any list of contacts_id
+               * @param integer $action PHPGW_SQL_RETURN_SQL | 
PHPGW_SQL_RUN_SQL
+               */
+               function delete_org_person_relation($org_id, $person_id, 
$action=PHPGW_SQL_RUN_SQL)
+               {
+                       $relations = 
CreateObject('phpgwapi.contact_org_person');
+                       $this->lock_table($relations->table);
+                       $criteria = 
$relations->entity_criteria(sql_criteria::token_and(sql_criteria::_equal('my_org_id',
 $org_id),
+                                                                               
        sql_criteria::_equal('my_person_id', $person_id)));
+                       $sql = $relations->delete($criteria, $action);
+                       $this->unlock_table();
+                       return $sql;
+               }
+ 
+               /**
                * Delete the address information of contact.
                * 
***************
*** 1790,1793 ****
--- 1807,1853 ----
                }
  
+               /**
+               * Delete the specified communication media.
+               * 
+               * @param integer|array $id Key of the comm media what you want
+               * @param integer $action PHPGW_SQL_RETURN_SQL | 
PHPGW_SQL_RUN_SQL
+               */
+               function delete_specified_comm($id, 
$action=PHPGW_SQL_RETURN_SQL)
+               {
+                       return 
$this->_delete(sql_criteria::_equal('key_comm_id',$id), $action);
+               }
+ 
+               /**
+               * Delete the specified address.
+               * 
+               * @param integer|array $id Key of the address what you want
+               * @param integer $action PHPGW_SQL_RETURN_SQL | 
PHPGW_SQL_RUN_SQL
+               */
+               function delete_specified_location($id, 
$action=PHPGW_SQL_RETURN_SQL)
+               {
+                       return 
$this->_delete(sql_criteria::_equal('key_addr_id',$id), $action);
+               }
+               /**
+               * Delete the specified others field.
+               * 
+               * @param integer|array $id Key of the other field what you want
+               * @param integer $action PHPGW_SQL_RETURN_SQL | 
PHPGW_SQL_RUN_SQL
+               */
+               function delete_specified_other($id, 
$action=PHPGW_SQL_RETURN_SQL)
+               {
+                       return 
$this->_delete(sql_criteria::_equal('key_other_id',$id), $action);
+               }
+ 
+               /**
+               * Delete the specified note.
+               * 
+               * @param integer|array $id Key of the note what you want
+               * @param integer $action PHPGW_SQL_RETURN_SQL | 
PHPGW_SQL_RUN_SQL
+               */
+               function delete_specified_note($id, 
$action=PHPGW_SQL_RETURN_SQL)
+               {
+                       return 
$this->_delete(sql_criteria::_equal('key_note_id',$id), $action);
+               }
+ 
                /* This is for the admin script deleteaccount.php */
                function delete_all($owner=0)
***************
*** 2326,2337 ****
                }
  
!               function lock_table($table)
!               {
!                       if (!($this->locked[$table]))
!                       {
                                $this->db->lock($table);
                                $this->locked[$table] = TRUE;
                        }
                }
                function unlock_table()
                {
--- 2386,2399 ----
                }
  
! 
!               function lock_table($table, $action=PHPGW_SQL_RUN_SQL)
!               {       
!                       if (!($this->locked[$table]) && $action == 
PHPGW_SQL_RUN_SQL)
!                       {       
                                $this->db->lock($table);
                                $this->locked[$table] = TRUE;
                        }
                }
+               
                function unlock_table()
                {

Index: class.sql_entity.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/Attic/class.sql_entity.inc.php,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -r1.1.2.3 -r1.1.2.4
*** class.sql_entity.inc.php    10 Sep 2003 23:58:01 -0000      1.1.2.3
--- class.sql_entity.inc.php    16 Sep 2003 23:28:05 -0000      1.1.2.4
***************
*** 330,335 ****
                                if(count($element['value']) == 1)
                                {
!                                       $value = current($element['value']);
!                                       return sql_criteria::equal($field, 
sql::string($value));
                                }
                                elseif(count($element['value']) > 1)
--- 330,335 ----
                                if(count($element['value']) == 1)
                                {
!                                       $value = 
$this->cast(current($element['value']), $element['field']);
!                                       return sql_criteria::equal($field, 
$value);
                                }
                                elseif(count($element['value']) > 1)
***************
*** 340,347 ****
                        else
                        {
!                               return sql_criteria::equal($field, 
sql::string($element['value']));
                        }
                }
!               
                /*************************************************************\
                * Insert (input data) section                                 *
--- 340,398 ----
                        else
                        {
!                               $value = $this->cast($element['value'], 
$element['field']);
!                               return sql_criteria::equal($field, 
$element['value']);
                        }
                }
! 
!               /**
!               * Analize a criteria created by tokens and create a string that 
represent it, useful for any kind of operation that use criteria I guess.
!               * 
!               * @param $token_criteria array Array with all the criteria in 
tokens, generated with sql_criteria
!               * @return string Criteria string (All that goes in WHERE clause)
!               * @see sql_criteria
!               */
! 
!               function entity_criteria($token_criteria)
!               {
!                       /*
!                       Things to care about:
!                       - `_append_and', `_append_or' arrays have two elements: 
1. array with criterias, 2. token
!                       - `in' is a three element: 1. field name, 2. array with 
values, 3. token
!                       */
!                       
!                       $num_elements = count($token_criteria);
!                       switch($num_elements)
!                       {
!                       case 0:
!                       case 1:
!                               $local_criteria = $token_criteria;
!                               break;
!                       case 2:
!                       case 3:
!                               $operator = array_pop($token_criteria);
!                               $left = array_shift($token_criteria);
!                               $right = array_shift($token_criteria);
!                               
!                               if(is_array($left) && $operator != 'in')
!                               {
!                                       $left = $this->entity_criteria($left);
!                               }
!                               else
!                               {
!                                       $left = $this->real_field($left);
!                               }
!                               if(is_array($right))
!                               {
!                                       $right = $this->entity_criteria($right);
!                               }
!                               $local_criteria = 
sql_criteria::operate($operator,$left,$right);
!                               break;
!                       default:
!                               $operator = array_pop($token_criteria);
!                               $local_criteria = 
sql_criteria::operate($operator,$token_criteria);
!                       }
!                       return $local_criteria;
!               }
! 
                /*************************************************************\
                * Insert (input data) section                                 *
***************
*** 944,949 ****
                function ldebug($myfoo, $data, $type = 'string', $err = '')
                {
! //                    if (!((($myfoo != 'update') xor
! //                           ($myfoo != '')) xor
  //                          ($myfoo == '')) xor
  //                        ($myfoo == ''))
--- 995,1000 ----
                function ldebug($myfoo, $data, $type = 'string', $err = '')
                {
! //                    if (!((($myfoo != '') xor
! //                           ($myfoo != 'default_criteria')) xor
  //                          ($myfoo == '')) xor
  //                        ($myfoo == ''))





reply via email to

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