"using the global db object"

This commit is contained in:
Ralf Becker 2008-03-15 15:00:15 +00:00
parent 426fc2825e
commit ec042e0f4d

View File

@ -1,28 +1,16 @@
<?php <?php
/**************************************************************************\ /**
* eGroupWare API - Hooks * * eGroupWare API - Hooks
* This file written by Dan Kuykendall <seek3r@phpgroupware.org> * *
* Allows applications to "hook" into each other * * @link http://www.egroupware.org
* Copyright (C) 2000, 2001 Dan Kuykendall * * @author Dan Kuykendall <seek3r@phpgroupware.org>
* New method hooks and docu are written by <RalfBecker@outdoor-training.de>* * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* -------------------------------------------------------------------------* * Copyright (C) 2000, 2001 Dan Kuykendall
* This library is part of the eGroupWare API * * New method hooks and docu are written by <RalfBecker@outdoor-training.de>
* http://www.egroupware.org/api * * @license http://opensource.org/licenses/lgpl-license.php LGPL - GNU Lesser General Public License
* ------------------------------------------------------------------------ * * @package api
* This library is free software; you can redistribute it and/or modify it * * @version $Id$
* under the terms of the GNU Lesser General Public License as published by * */
* the Free Software Foundation; either version 2.1 of the License, *
* or any later version. *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
\**************************************************************************/
/* $Id$ */
/** /**
* class which gives ability for applications to set and use hooks to communicate with each other * class which gives ability for applications to set and use hooks to communicate with each other
@ -41,17 +29,15 @@
* - old type, which are included files. Values can only be passed by global values and they cant return anything. * - old type, which are included files. Values can only be passed by global values and they cant return anything.
* Old declaration in setup.inc.php: * Old declaration in setup.inc.php:
* $setup_info['appname']['hooks'][] = 'location'; * $setup_info['appname']['hooks'][] = 'location';
*
* @author Dan Kuykendall
* @author Ralf Becker <RalfBecker@outdoor-training.de> new method hooks
* @license LGPL
* @package phpgwapi
* @access public
*/ */
class hooks class hooks
{ {
var $found_hooks = Array(); var $found_hooks = Array();
/**
* Reference to the global db object
*
* @var egw_db
*/
var $db; var $db;
var $table = 'egw_hooks'; var $table = 'egw_hooks';
@ -64,14 +50,11 @@
{ {
$this->db = $db ? $db : $GLOBALS['egw']->db; // this is to allow setup to set the db $this->db = $db ? $db : $GLOBALS['egw']->db; // this is to allow setup to set the db
$this->db->select($this->table,'hook_appname,hook_location,hook_filename',false,__LINE__,__FILE__); foreach($this->db->select($this->table,'hook_appname,hook_location,hook_filename',false,__LINE__,__FILE__) as $row)
while( $this->db->next_record() )
{ {
$this->found_hooks[$this->db->f('hook_appname')][$this->db->f('hook_location')] = $this->db->f('hook_filename'); $this->found_hooks[$row['hook_appname']][$row['hook_location']] = $row['hook_filename'];
} }
//echo '<pre>'; //_debug_array($this->found_hooks);
//print_r($this->found_hooks);
//echo '</pre>';
} }
/** /**