2008-01-29 16:14:35 +01:00
|
|
|
<?php
|
|
|
|
/**
|
2012-02-27 14:18:52 +01:00
|
|
|
* EGroupware Admin: Hooks
|
2008-01-29 16:14:35 +01:00
|
|
|
*
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @author Stefan Becker <StefanBecker-AT-outdoor-training.de>
|
2012-02-27 14:18:52 +01:00
|
|
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
2009-11-17 10:24:10 +01:00
|
|
|
* @package admin
|
2008-01-29 16:14:35 +01:00
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
2009-11-22 10:03:46 +01:00
|
|
|
* @version $Id$
|
2008-01-29 16:14:35 +01:00
|
|
|
*/
|
|
|
|
|
2009-11-17 10:24:10 +01:00
|
|
|
/**
|
|
|
|
* Static hooks for admin application
|
|
|
|
*/
|
2008-01-29 16:14:35 +01:00
|
|
|
class admin_prefs_sidebox_hooks
|
|
|
|
{
|
2010-04-27 19:23:30 +02:00
|
|
|
/**
|
|
|
|
* Functions callable via menuaction
|
|
|
|
*
|
|
|
|
* @var unknown_type
|
|
|
|
*/
|
|
|
|
var $public_functions = array(
|
2012-02-27 14:18:52 +01:00
|
|
|
'register_all_hooks' => True,
|
2010-04-27 19:23:30 +02:00
|
|
|
);
|
|
|
|
|
2008-01-29 16:14:35 +01:00
|
|
|
/**
|
|
|
|
* hooks to build projectmanager's sidebox-menu plus the admin and preferences sections
|
|
|
|
*
|
|
|
|
* @param string/array $args hook args
|
|
|
|
*/
|
2009-11-17 10:24:10 +01:00
|
|
|
static function all_hooks($args)
|
2008-01-29 16:14:35 +01:00
|
|
|
{
|
2009-11-17 10:24:10 +01:00
|
|
|
if (!isset($_GET['menuaction']) && substr($_SERVER['PHP_SELF'],-16) == '/admin/index.php')
|
|
|
|
{
|
|
|
|
admin_statistics::check();
|
|
|
|
}
|
2008-01-29 16:14:35 +01:00
|
|
|
$appname = 'admin';
|
|
|
|
$location = is_array($args) ? $args['location'] : $args;
|
2009-04-27 12:31:23 +02:00
|
|
|
|
2008-01-29 16:14:35 +01:00
|
|
|
if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'admins')
|
|
|
|
{
|
2009-04-27 12:31:23 +02:00
|
|
|
|
2008-01-29 16:14:35 +01:00
|
|
|
if (! $GLOBALS['egw']->acl->check('site_config_access',1,'admin'))
|
|
|
|
{
|
2009-11-17 10:24:10 +01:00
|
|
|
$file['Site Configuration'] = egw::link('/index.php','menuaction=admin.uiconfig.index&appname=admin');
|
2008-02-29 14:05:22 +01:00
|
|
|
}
|
|
|
|
|
2009-11-17 10:24:10 +01:00
|
|
|
/* disabled it, til it does something useful
|
2008-01-29 16:14:35 +01:00
|
|
|
if (! $GLOBALS['egw']->acl->check('peer_server_access',1,'admin'))
|
|
|
|
{
|
2009-11-17 10:24:10 +01:00
|
|
|
$file['Peer Servers'] = egw::link('/index.php','menuaction=admin.uiserver.list_servers');
|
2008-01-29 16:14:35 +01:00
|
|
|
}
|
2009-11-17 10:24:10 +01:00
|
|
|
*/
|
2008-01-29 16:14:35 +01:00
|
|
|
if (! $GLOBALS['egw']->acl->check('account_access',1,'admin'))
|
|
|
|
{
|
2009-11-17 10:24:10 +01:00
|
|
|
$file['User Accounts'] = egw::link('/index.php','menuaction=admin.uiaccounts.list_users');
|
2008-01-29 16:14:35 +01:00
|
|
|
}
|
|
|
|
|
2011-04-01 15:35:16 +02:00
|
|
|
if (! $GLOBALS['egw']->acl->check('account_access',16,'admin'))
|
|
|
|
{
|
2011-04-01 20:49:42 +02:00
|
|
|
$file['Bulk password reset'] = egw::link('/index.php','menuaction=admin.admin_passwordreset.index');
|
2011-04-01 15:35:16 +02:00
|
|
|
}
|
|
|
|
|
2008-01-29 16:14:35 +01:00
|
|
|
if (! $GLOBALS['egw']->acl->check('group_access',1,'admin'))
|
|
|
|
{
|
2009-11-17 10:24:10 +01:00
|
|
|
$file['User Groups'] = egw::link('/index.php','menuaction=admin.uiaccounts.list_groups');
|
2008-01-29 16:14:35 +01:00
|
|
|
}
|
|
|
|
|
2010-06-25 14:55:33 +02:00
|
|
|
if (! $GLOBALS['egw']->acl->check('applications_access',1,'admin'))
|
|
|
|
{
|
|
|
|
$file['Applications'] = egw::link('/index.php','menuaction=admin.admin_applications.index');
|
|
|
|
}
|
2008-01-29 16:14:35 +01:00
|
|
|
if (! $GLOBALS['egw']->acl->check('global_categories_access',1,'admin'))
|
|
|
|
{
|
2010-01-31 04:29:32 +01:00
|
|
|
$file['Global Categories'] = egw::link('/index.php','menuaction=admin.admin_categories.index&appname=phpgw');
|
2008-01-29 16:14:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!$GLOBALS['egw']->acl->check('mainscreen_message_access',1,'admin') || !$GLOBALS['egw']->acl->check('mainscreen_message_access',2,'admin'))
|
|
|
|
{
|
2009-11-17 10:24:10 +01:00
|
|
|
$file['Change Main Screen Message'] = egw::link('/index.php','menuaction=admin.uimainscreen.index');
|
2008-01-29 16:14:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (! $GLOBALS['egw']->acl->check('current_sessions_access',1,'admin'))
|
|
|
|
{
|
2011-04-13 16:11:09 +02:00
|
|
|
$file['View Sessions'] = egw::link('/index.php','menuaction=admin.admin_accesslog.sessions');
|
2008-01-29 16:14:35 +01:00
|
|
|
}
|
2009-04-27 12:31:23 +02:00
|
|
|
|
2008-01-29 16:14:35 +01:00
|
|
|
if (! $GLOBALS['egw']->acl->check('access_log_access',1,'admin'))
|
|
|
|
{
|
2009-04-27 12:31:23 +02:00
|
|
|
$file['View Access Log'] = egw::link('/index.php','menuaction=admin.admin_accesslog.index');
|
2008-01-29 16:14:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (! $GLOBALS['egw']->acl->check('error_log_access',1,'admin'))
|
|
|
|
{
|
2009-11-17 10:24:10 +01:00
|
|
|
$file['View Error Log'] = egw::link('/index.php','menuaction=admin.uilog.list_log');
|
2008-01-29 16:14:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (! $GLOBALS['egw']->acl->check('applications_access',16,'admin'))
|
|
|
|
{
|
2012-11-05 15:10:23 +01:00
|
|
|
$file['Clear cache and register hooks'] = egw::link('/index.php','menuaction=admin.admin_prefs_sidebox_hooks.register_all_hooks');
|
2008-01-29 16:14:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (! $GLOBALS['egw']->acl->check('asyncservice_access',1,'admin'))
|
|
|
|
{
|
2009-11-17 10:24:10 +01:00
|
|
|
$file['Asynchronous timed services'] = egw::link('/index.php','menuaction=admin.uiasyncservice.index');
|
2008-01-29 16:14:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (! $GLOBALS['egw']->acl->check('db_backup_access',1,'admin'))
|
|
|
|
{
|
2009-11-17 10:24:10 +01:00
|
|
|
$file['DB backup and restore'] = egw::link('/index.php','menuaction=admin.admin_db_backup.index');
|
2008-01-29 16:14:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (! $GLOBALS['egw']->acl->check('info_access',1,'admin'))
|
|
|
|
{
|
2010-06-02 20:28:27 +02:00
|
|
|
$file['phpInfo'] = "javascript:egw_openWindowCentered2('" . egw::link('/admin/phpinfo.php','',false) . "','phpinfoWindow',700,600,'yes')";
|
2008-01-29 16:14:35 +01:00
|
|
|
}
|
2009-11-17 10:24:10 +01:00
|
|
|
$file['Admin queue and history'] = egw::link('/index.php','menuaction=admin.admin_cmds.index');
|
|
|
|
$file['Remote administration instances'] = egw::link('/index.php','menuaction=admin.admin_cmds.remotes');
|
2011-11-17 13:43:59 +01:00
|
|
|
$file['Custom translation'] = egw::link('/index.php','menuaction=admin.admin_customtranslation.index');
|
2009-11-17 10:24:10 +01:00
|
|
|
|
|
|
|
$file['Submit statistic information'] = egw::link('/index.php','menuaction=admin.admin_statistics.submit');
|
2008-01-29 16:14:35 +01:00
|
|
|
|
|
|
|
if ($location == 'admin')
|
|
|
|
{
|
|
|
|
display_section($appname,$file);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
display_sidebox($appname,lang('Admin'),$file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-04-27 19:23:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Register all hooks
|
|
|
|
*/
|
|
|
|
function register_all_hooks()
|
|
|
|
{
|
|
|
|
if ($GLOBALS['egw']->acl->check('applications_access',16,'admin'))
|
|
|
|
{
|
|
|
|
$GLOBALS['egw']->redirect_link('/index.php');
|
|
|
|
}
|
2012-11-05 15:10:23 +01:00
|
|
|
egw_cache::flush(egw_cache::INSTANCE);
|
|
|
|
|
2010-04-27 19:23:30 +02:00
|
|
|
$GLOBALS['egw']->hooks->register_all_hooks();
|
|
|
|
|
|
|
|
if (method_exists($GLOBALS['egw'],'invalidate_session_cache')) // egw object in setup is limited
|
|
|
|
{
|
|
|
|
$GLOBALS['egw']->invalidate_session_cache(); // in case with cache the egw_info array in the session
|
|
|
|
}
|
|
|
|
$GLOBALS['egw']->redirect_link('/admin/index.php');
|
|
|
|
}
|
2008-01-29 16:14:35 +01:00
|
|
|
}
|