phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: phpgwapi/inc class.setup.inc.php,1.15.2.1,1.15.2


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.setup.inc.php,1.15.2.1,1.15.2.2
Date: Sun, 27 Apr 2003 17:32:16 -0400

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

Modified Files:
      Tag: Version-0_9_16-branch
        class.setup.inc.php 
Log Message:
new type of hooks via methodes instead of separate files:
- allows to parse arguments ot the hook and return content
- all access to the hook-table is now handled by the hook-class (for admin and 
setup too)
- all existing hooks continue to work of cause

Index: class.setup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.setup.inc.php,v
retrieving revision 1.15.2.1
retrieving revision 1.15.2.2
diff -C2 -r1.15.2.1 -r1.15.2.2
*** class.setup.inc.php 27 Mar 2003 00:00:39 -0000      1.15.2.1
--- class.setup.inc.php 27 Apr 2003 21:32:14 -0000      1.15.2.2
***************
*** 560,584 ****
                        }
  
!                       $this->db->query("SELECT COUNT(hook_appname) FROM 
phpgw_hooks WHERE hook_appname='".$appname."'");
!                       $this->db->next_record();
!                       if($this->db->f(0))
                        {
!                               $this->deregister_hooks($appname);
!                       }
! 
!                       //echo "ADDING hooks for: " . 
$setup_info[$appname]['name'];
!                       if(is_array($setup_info[$appname]['hooks']))
!                       {
!                               while(list($key,$hook) = 
each($setup_info[$appname]['hooks']))
!                               {
!                                       $this->db->query("INSERT INTO 
phpgw_hooks "
!                                               . 
"(hook_appname,hook_location,hook_filename) "
!                                               . "VALUES ("
!                                               . "'" . 
$setup_info[$appname]['name']       . "',"
!                                               . "'" . $hook . "',"
!                                               . "'" . "hook_" . $hook . 
".inc.php" . "');"
!                                       );
!                               }
                        }
                }
  
--- 560,568 ----
                        }
  
!                       if (!is_object($this->hooks))
                        {
!                               $this->hooks = 
CreateObject('phpgwapi.hooks',$this->db);
                        }
+                       
$this->hooks->register_hooks($appname,$setup_info[$appname]['hooks']);
                }
  
***************
*** 590,621 ****
                function update_hooks($appname)
                {
!                       $setup_info = $GLOBALS['setup_info'];
! 
!                       if(!$appname)
!                       {
!                               return False;
!                       }
! 
!                       
if($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.8pre5'))
!                       {
!                               /* No phpgw_hooks table yet. */
!                               return False;
!                       }
! 
!                       $this->db->query("SELECT COUNT(*) FROM phpgw_hooks 
WHERE hook_appname='".$appname."'");
!                       $this->db->next_record();
!                       if(!$this->db->f(0))
!                       {
!                               return False;
!                       }
! 
!                       if($setup_info[$appname]['version'])
!                       {
!                               if(is_array($setup_info[$appname]['hooks']))
!                               {
!                                       $this->deregister_hooks($appname);
!                                       $this->register_hooks($appname);
!                               }
!                       }
                }
  
--- 574,578 ----
                function update_hooks($appname)
                {
!                       $this->register_hooks($appname);
                }
  
***************
*** 637,643 ****
                                return False;
                        }
! 
                        //echo "DELETING hooks for: " . 
$setup_info[$appname]['name'];
!                       $this->db->query("DELETE FROM phpgw_hooks WHERE 
hook_appname='". $appname ."'");
                }
  
--- 594,604 ----
                                return False;
                        }
!                       
                        //echo "DELETING hooks for: " . 
$setup_info[$appname]['name'];
!                       if (!is_object($this->hooks))
!                       {
!                               $this->hooks = 
CreateObject('phpgwapi.hooks',$this->db);
!                       }
!                       $this->hooks->register_hooks($appname);
                }
  
***************
*** 650,669 ****
                function hook($location, $appname='')
                {
!                       if(!$appname)
!                       {
!                               $appname = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
!                       }
!                       $SEP = filesystem_separator();
! 
!                       $f = PHPGW_SERVER_ROOT . $SEP . $appname . $SEP . 'inc' 
. $SEP . 'hook_' . $location . '.inc.php';
!                       if(file_exists($f))
                        {
!                               include($f);
!                               return True;
!                       }
!                       else
!                       {
!                               return False;
                        }
                }
  
--- 611,619 ----
                function hook($location, $appname='')
                {
!                       if (!is_object($this->hooks))
                        {
!                               $this->hooks = 
CreateObject('phpgwapi.hooks',$this->db);
                        }
+                       return $this->hooks->single($locaton,$appname);
                }
  





reply via email to

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