2014-03-27 20:00:52 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* EGroupware Admin: Hooks
|
|
|
|
*
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @author Stefan Becker <StefanBecker-AT-outdoor-training.de>
|
|
|
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
|
|
|
* @package admin
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
* @version $Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Static hooks for admin application
|
|
|
|
*/
|
|
|
|
class admin_hooks
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Functions callable via menuaction
|
|
|
|
*
|
|
|
|
* @var unknown_type
|
|
|
|
*/
|
|
|
|
var $public_functions = array(
|
|
|
|
'register_all_hooks' => True,
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* hooks to build projectmanager's sidebox-menu
|
|
|
|
*
|
|
|
|
* @param string/array $args hook args
|
|
|
|
*/
|
|
|
|
static function all_hooks($args)
|
|
|
|
{
|
|
|
|
unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);
|
|
|
|
|
|
|
|
$appname = 'admin';
|
|
|
|
$location = is_array($args) ? $args['location'] : $args;
|
|
|
|
|
|
|
|
if ($location == 'sidebox_menu')
|
|
|
|
{
|
|
|
|
// Destination div for folder tree
|
|
|
|
$file[] = array(
|
|
|
|
'no_lang' => true,
|
2014-05-27 00:46:49 +02:00
|
|
|
// Tree has about 20 leaves (or more) in it, but the sidebox starts
|
|
|
|
// with no content. Set some minimum height to make sure scrolling is triggered.
|
|
|
|
'text' => '<div id="admin_tree_target" class="admin_tree" style="min-height:20em"/>',
|
2014-03-27 20:00:52 +01:00
|
|
|
'link' => false,
|
|
|
|
'icon' => false
|
|
|
|
);
|
|
|
|
display_sidebox($appname,lang('Admin'),$file);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ($GLOBALS['egw_info']['user']['apps']['admin'])
|
|
|
|
{
|
|
|
|
|
|
|
|
if (! $GLOBALS['egw']->acl->check('site_config_access',1,'admin'))
|
|
|
|
{
|
|
|
|
$file['Site Configuration'] = egw::link('/index.php','menuaction=admin.uiconfig.index&appname=admin');
|
|
|
|
}
|
|
|
|
|
2014-04-01 09:49:32 +02:00
|
|
|
if (! $GLOBALS['egw']->acl->check('account_access',1,'admin'))
|
|
|
|
{
|
|
|
|
$file['User Accounts'] = array(
|
|
|
|
'id' => '/accounts',
|
|
|
|
'icon' => common::image('addressbook', 'accounts'),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-03-27 20:00:52 +01:00
|
|
|
if (! $GLOBALS['egw']->acl->check('account_access',16,'admin'))
|
|
|
|
{
|
2015-07-01 20:35:43 +02:00
|
|
|
$file['Bulk password reset'] = egw::link('/index.php','menuaction=admin.admin_passwordreset.index&ajax=true');
|
2014-03-27 20:00:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (! $GLOBALS['egw']->acl->check('group_access',1,'admin'))
|
|
|
|
{
|
|
|
|
$file['User Groups'] = array(
|
|
|
|
'id' => '/groups',
|
|
|
|
'icon' => common::image('addressbook', 'group'),
|
|
|
|
'child' => 1,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $GLOBALS['egw']->acl->check('applications_access',1,'admin'))
|
|
|
|
{
|
|
|
|
$file['Applications'] = egw::link('/index.php','menuaction=admin.admin_applications.index');
|
|
|
|
}
|
|
|
|
if (! $GLOBALS['egw']->acl->check('global_categories_access',1,'admin'))
|
|
|
|
{
|
2015-07-01 20:35:43 +02:00
|
|
|
$file['Global Categories'] = egw::link('/index.php','menuaction=admin.admin_categories.index&appname=phpgw&ajax=true');
|
2014-03-27 20:00:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!$GLOBALS['egw']->acl->check('mainscreen_message_access',1,'admin') || !$GLOBALS['egw']->acl->check('mainscreen_message_access',2,'admin'))
|
|
|
|
{
|
|
|
|
$file['Change Main Screen Message'] = egw::link('/index.php','menuaction=admin.uimainscreen.index');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $GLOBALS['egw']->acl->check('current_sessions_access',1,'admin'))
|
|
|
|
{
|
2015-07-01 20:35:43 +02:00
|
|
|
$file['View Sessions'] = egw::link('/index.php','menuaction=admin.admin_accesslog.sessions&ajax=true');
|
2014-03-27 20:00:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (! $GLOBALS['egw']->acl->check('access_log_access',1,'admin'))
|
|
|
|
{
|
2015-07-01 20:35:43 +02:00
|
|
|
$file['View Access Log'] = egw::link('/index.php','menuaction=admin.admin_accesslog.index&ajax=true');
|
2014-03-27 20:00:52 +01:00
|
|
|
}
|
|
|
|
|
2014-07-04 16:11:32 +02:00
|
|
|
/* disable old EGroupware error_log, as it is not used anymore
|
2014-03-27 20:00:52 +01:00
|
|
|
if (! $GLOBALS['egw']->acl->check('error_log_access',1,'admin'))
|
|
|
|
{
|
|
|
|
$file['View Error Log'] = egw::link('/index.php','menuaction=admin.uilog.list_log');
|
2014-07-04 16:11:32 +02:00
|
|
|
}*/
|
2014-03-27 20:00:52 +01:00
|
|
|
|
|
|
|
if (! $GLOBALS['egw']->acl->check('applications_access',16,'admin'))
|
|
|
|
{
|
|
|
|
$file['Clear cache and register hooks'] = egw::link('/index.php','menuaction=admin.admin_hooks.register_all_hooks');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $GLOBALS['egw']->acl->check('asyncservice_access',1,'admin'))
|
|
|
|
{
|
|
|
|
$file['Asynchronous timed services'] = egw::link('/index.php','menuaction=admin.uiasyncservice.index');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $GLOBALS['egw']->acl->check('db_backup_access',1,'admin'))
|
|
|
|
{
|
|
|
|
$file['DB backup and restore'] = egw::link('/index.php','menuaction=admin.admin_db_backup.index');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $GLOBALS['egw']->acl->check('info_access',1,'admin'))
|
|
|
|
{
|
2015-04-09 09:05:57 +02:00
|
|
|
$file['phpInfo'] = "javascript:egw.openPopup('" . egw::link('/admin/phpinfo.php','',false) . "',960,600,'phpinfoWindow')";
|
2014-03-27 20:00:52 +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['Custom translation'] = egw::link('/index.php','menuaction=admin.admin_customtranslation.index');
|
2014-06-25 21:02:06 +02:00
|
|
|
$file['Changelog and versions'] = egw::link('/about.php');
|
2014-03-27 20:00:52 +01:00
|
|
|
|
|
|
|
$file['Submit statistic information'] = egw::link('/index.php','menuaction=admin.admin_statistics.submit');
|
|
|
|
|
|
|
|
if ($location == 'admin')
|
|
|
|
{
|
|
|
|
display_section($appname,$file);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
foreach($file as &$url)
|
|
|
|
{
|
|
|
|
if (is_array($url) && $url['link']) $url = $url['link'];
|
|
|
|
}
|
|
|
|
display_sidebox($appname,lang('Admin'),$file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register all hooks
|
|
|
|
*/
|
|
|
|
function register_all_hooks()
|
|
|
|
{
|
|
|
|
if ($GLOBALS['egw']->acl->check('applications_access',16,'admin'))
|
|
|
|
{
|
|
|
|
$GLOBALS['egw']->redirect_link('/index.php');
|
|
|
|
}
|
|
|
|
egw_cache::flush(egw_cache::INSTANCE);
|
|
|
|
|
|
|
|
$GLOBALS['egw']->hooks->register_all_hooks();
|
|
|
|
|
|
|
|
common::delete_image_map();
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
// allow apps to hook into "Admin >> Clear cache and register hooks"
|
|
|
|
$GLOBALS['egw']->hooks->process('clear_cache', array(), true);
|
|
|
|
|
|
|
|
$GLOBALS['egw']->redirect_link('/admin/index.php');
|
|
|
|
}
|
2014-03-28 19:54:40 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Actions for context menu of users
|
|
|
|
*
|
|
|
|
* @return array of actions
|
|
|
|
*/
|
|
|
|
public static function edit_user()
|
|
|
|
{
|
|
|
|
$actions = array();
|
|
|
|
|
2014-04-01 17:49:08 +02:00
|
|
|
$actions[] = array(
|
|
|
|
'id' => 'acl',
|
|
|
|
'caption' => 'Access control',
|
|
|
|
'url' => 'menuaction=admin.admin_acl.index&account_id=$id',
|
|
|
|
'popup' => '900x450',
|
|
|
|
'icon' => 'lock',
|
|
|
|
);
|
|
|
|
|
2014-03-28 19:54:40 +01:00
|
|
|
if (!$GLOBALS['egw']->acl->check('current_sessions_access',1,'admin')) // no rights to view
|
|
|
|
{
|
|
|
|
$actions[] = array(
|
|
|
|
'description' => 'Login History',
|
|
|
|
'url' => '/index.php',
|
2014-04-01 17:49:08 +02:00
|
|
|
'extradata' => 'menuaction=admin.admin_accesslog.index',
|
|
|
|
'icon' => 'timesheet',
|
2014-03-28 19:54:40 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$GLOBALS['egw']->acl->check('account_access',64,'admin')) // no rights to set ACL-rights
|
|
|
|
{
|
|
|
|
$actions[] = array(
|
|
|
|
'description' => 'Deny access',
|
|
|
|
'url' => '/index.php',
|
2014-04-01 17:49:08 +02:00
|
|
|
'extradata' => 'menuaction=admin.uiaclmanager.list_apps',
|
|
|
|
'icon' => 'cancel',
|
2014-03-28 19:54:40 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
return $actions;
|
|
|
|
}
|
2014-03-27 20:00:52 +01:00
|
|
|
}
|