2008-01-29 16:14:35 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Admin-, Preferences- and SideboxMenu-Hooks
|
|
|
|
*
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @author Stefan Becker <StefanBecker-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:04:41 +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
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
|
|
|
|
if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'admins')
|
|
|
|
{
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
if (! $GLOBALS['egw']->acl->check('applications_access',1,'admin'))
|
|
|
|
{
|
2009-11-17 10:24:10 +01:00
|
|
|
$file['Applications'] = egw::link('/index.php','menuaction=admin.uiapplications.get_list');
|
2008-01-29 16:14:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (! $GLOBALS['egw']->acl->check('global_categories_access',1,'admin'))
|
|
|
|
{
|
2009-11-17 10:24:10 +01:00
|
|
|
$file['Global Categories'] = egw::link('/index.php','menuaction=admin.uicategories.index');
|
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'))
|
|
|
|
{
|
2009-11-17 10:24:10 +01:00
|
|
|
$file['View Sessions'] = egw::link('/index.php','menuaction=admin.uicurrentsessions.list_sessions');
|
2008-01-29 16:14:35 +01:00
|
|
|
}
|
2008-02-29 14:05:22 +01:00
|
|
|
|
2008-01-29 16:14:35 +01:00
|
|
|
if (! $GLOBALS['egw']->acl->check('access_log_access',1,'admin'))
|
|
|
|
{
|
|
|
|
$file['View Access Log'] = $GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccess_history.list_history');
|
|
|
|
}
|
|
|
|
|
|
|
|
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'))
|
|
|
|
{
|
2009-11-17 10:24:10 +01:00
|
|
|
$file['Find and Register all Application Hooks'] = egw::link('/index.php','menuaction=admin.uiapplications.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'))
|
|
|
|
{
|
2009-11-17 10:24:10 +01:00
|
|
|
$file['phpInfo'] = "javascript:openwindow('" . egw::link('/admin/phpinfo.php') . "')"; //egw::link('/admin/phpinfo.php');
|
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');
|
|
|
|
|
|
|
|
$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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* populates $GLOBALS['settings'] for the preferences
|
|
|
|
*/
|
|
|
|
function settings()
|
|
|
|
{
|
|
|
|
$this->check_set_default_prefs();
|
|
|
|
|
|
|
|
return true; // otherwise prefs say it cant find the file ;-)
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if reasonable default preferences are set and set them if not
|
|
|
|
*
|
|
|
|
* It sets a flag in the app-session-data to be called only once per session
|
|
|
|
*/
|
|
|
|
function check_set_default_prefs()
|
|
|
|
{
|
|
|
|
if ($GLOBALS['egw']->session->appsession('default_prefs_set','admin'))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$GLOBALS['egw']->session->appsession('default_prefs_set','admin','set');
|
|
|
|
|
|
|
|
$default_prefs =& $GLOBALS['egw']->preferences->default['admin'];
|
|
|
|
|
|
|
|
$defaults = array(
|
|
|
|
);
|
|
|
|
foreach($defaults as $var => $default)
|
|
|
|
{
|
|
|
|
if (!isset($default_prefs[$var]) || $default_prefs[$var] === '')
|
|
|
|
{
|
|
|
|
$GLOBALS['egw']->preferences->add('admin',$var,$default,'default');
|
|
|
|
$need_save = True;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($need_save)
|
|
|
|
{
|
|
|
|
$GLOBALS['egw']->preferences->save_repository(False,'default');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|