mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-15 18:38:57 +01:00
Added the 'Find and Register Application Hooks'.
This commit is contained in:
parent
ade7a6bdbf
commit
6b8ddd566b
@ -13,6 +13,10 @@
|
|||||||
|
|
||||||
class boapplications
|
class boapplications
|
||||||
{
|
{
|
||||||
|
var $public_functions = array(
|
||||||
|
'register_all_hooks' => True
|
||||||
|
);
|
||||||
|
|
||||||
var $so;
|
var $so;
|
||||||
|
|
||||||
function boapplications()
|
function boapplications()
|
||||||
@ -54,4 +58,37 @@
|
|||||||
{
|
{
|
||||||
return $this->so->delete($app_name);
|
return $this->so->delete($app_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function register_hook($hook_app)
|
||||||
|
{
|
||||||
|
return $this->so->register_hook($hook_app);
|
||||||
|
}
|
||||||
|
|
||||||
|
function register_all_hooks()
|
||||||
|
{
|
||||||
|
$SEP = filesystem_separator();
|
||||||
|
$app_list = $this->get_list();
|
||||||
|
$hooks = CreateObject('phpgwapi.hooks');
|
||||||
|
while(list($app_name,$app) = each($app_list))
|
||||||
|
{
|
||||||
|
$f = PHPGW_SERVER_ROOT . $SEP . $app_name . $SEP . 'setup' . $SEP . 'setup.inc.php';
|
||||||
|
if(@file_exists($f))
|
||||||
|
{
|
||||||
|
include($f);
|
||||||
|
while(list(,$hook) = each($setup_info[$app_name]['hooks']))
|
||||||
|
{
|
||||||
|
if(!$hooks->found_hooks[$hook][$appname])
|
||||||
|
{
|
||||||
|
$this->register_hook(
|
||||||
|
Array(
|
||||||
|
'app_name' => $app_name,
|
||||||
|
'hook' => $hook
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Header('Location: '.$GLOBALS['phpgw']->link('/admin/index.php'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
function get_list()
|
function get_list()
|
||||||
{
|
{
|
||||||
$this->db->query("SELECT * FROM phpgw_applications WHERE app_enabled<3",__LINE__,__FILE__);
|
$this->db->query('SELECT * FROM phpgw_applications WHERE app_enabled<3',__LINE__,__FILE__);
|
||||||
if($this->db->num_rows())
|
if($this->db->num_rows())
|
||||||
{
|
{
|
||||||
while ($this->db->next_record())
|
while ($this->db->next_record())
|
||||||
@ -59,11 +59,11 @@
|
|||||||
/* Yes, the sequence should work, but after a mass import in setup (new install)
|
/* Yes, the sequence should work, but after a mass import in setup (new install)
|
||||||
it does not work on pg
|
it does not work on pg
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT MAX(app_id) from phpgw_applications";
|
$sql = 'SELECT MAX(app_id) from phpgw_applications';
|
||||||
$this->db->query($sql,__LINE__,__FILE__);
|
$this->db->query($sql,__LINE__,__FILE__);
|
||||||
$this->db->next_record();
|
$this->db->next_record();
|
||||||
$app_id = $this->db->f(0) + 1;
|
$app_id = $this->db->f(0) + 1;
|
||||||
$sql = "INSERT INTO phpgw_applications (app_id,app_name,app_title,app_enabled,app_order) VALUES("
|
$sql = 'INSERT INTO phpgw_applications (app_id,app_name,app_title,app_enabled,app_order) VALUES('
|
||||||
. $app_id . ",'" . addslashes($data['n_app_name']) . "','" . addslashes($data['n_app_title']) . "','"
|
. $app_id . ",'" . addslashes($data['n_app_name']) . "','" . addslashes($data['n_app_title']) . "','"
|
||||||
. $data['n_app_status'] . "','" . $data['app_order'] . "')";
|
. $data['n_app_status'] . "','" . $data['app_order'] . "')";
|
||||||
|
|
||||||
@ -95,7 +95,7 @@
|
|||||||
|
|
||||||
function app_order()
|
function app_order()
|
||||||
{
|
{
|
||||||
$this->db->query("SELECT (MAX(app_order)+1) AS max FROM phpgw_applications");
|
$this->db->query('SELECT (MAX(app_order)+1) AS max FROM phpgw_applications',__LINE__,__FILE__);
|
||||||
$this->db->next_record();
|
$this->db->next_record();
|
||||||
return $this->db->f('max');
|
return $this->db->f('max');
|
||||||
}
|
}
|
||||||
@ -104,4 +104,11 @@
|
|||||||
{
|
{
|
||||||
$this->db->query("DELETE FROM phpgw_applications WHERE app_name='$app_name'",__LINE__,__FILE__);
|
$this->db->query("DELETE FROM phpgw_applications WHERE app_name='$app_name'",__LINE__,__FILE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function register_hook($app)
|
||||||
|
{
|
||||||
|
$this->db->query("INSERT INTO phpgw_hooks(hook_appname,hook_location,hook_filename) "
|
||||||
|
. "VALUES ('".$app['app_name']."','".$app['hook']."','hook_".$app['hook'].".inc.php')",__LINE__,__FILE__
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
/* These need to be added still */
|
/* These need to be added still */
|
||||||
$file['View Access Log'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccess_history.list_history');
|
$file['View Access Log'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccess_history.list_history');
|
||||||
$file['View Error Log'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uilog.list_log');
|
$file['View Error Log'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uilog.list_log');
|
||||||
|
$file['Find and Register all Application Hooks'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.boapplications.register_all_hooks');
|
||||||
$file['phpInfo'] = "javascript:openwindow('" . $GLOBALS['phpgw']->link('/admin/phpinfo.php') . "')"; //$GLOBALS['phpgw']->link('/admin/phpinfo.php');
|
$file['phpInfo'] = "javascript:openwindow('" . $GLOBALS['phpgw']->link('/admin/phpinfo.php') . "')"; //$GLOBALS['phpgw']->link('/admin/phpinfo.php');
|
||||||
|
|
||||||
/* Do not modify below this line */
|
/* Do not modify below this line */
|
||||||
|
Loading…
Reference in New Issue
Block a user