Fix the simple ACL configuration

This commit is contained in:
Deon George 2009-07-26 01:17:47 +10:00
parent 196aa00218
commit 5938302012
20 changed files with 134 additions and 234 deletions

View File

@ -79,38 +79,55 @@
/* Command availability ; if you don't authorize a command the command
links will not be shown and the command action will not be permitted.
For better security, set also ACL in your ldap directory. */
/*
$config->custom->commands['all'] = array(
'home' => true,
'external_links' => array('feature' => true,
'forum' => true,
'bug' => true,
'donation' => true,
'help' => true,
'credits' => true),
'purge' => true,
'schema' => true,
'import' => true,
'export' => true,
'logout' => true,
'search' => array('simple_search' => true,
'predefined_search' => true,
'advanced_search' => true),
'server_refresh' => true,
'server_info' => true,
'entry_refresh' => true,
'entry_move' => true,
'entry_internal_attributes_show' => true,
'entry_delete' => array('simple_delete' => true,
'mass_delete' => false),
'entry_rename' => true,
'entry_compare' => true,
'entry_create' => true,
'attribute_add' => true,
'attribute_add_value' => true,
'attribute_delete' => true,
'attribute_delete_value' => true);
$config->custom->commands['cmd'] = array(
'entry_internal_attributes_show' => true,
'entry_refresh' => true,
'oslinks' => true,
'switch_template' => true
);
$config->custom->commands['script'] = array(
'add_attr_form' => true,
'add_oclass_form' => true,
'add_value_form' => true,
'collapse' => true,
'compare' => true,
'compare_form' => true,
'copy' => true,
'copy_form' => true,
'create' => true,
'create_confirm' => true,
'delete' => true,
'delete_attr' => true,
'delete_form' => true,
'draw_tree_node' => true,
'expand' => true,
'export' => true,
'export_form' => true,
'import' => true,
'import_form' => true,
'login' => true,
'logout' => true,
'login_form' => true,
'mass_delete' => true,
'mass_edit' => true,
'mass_update' => true,
'modify_member_form' => true,
'monitor' => true,
'purge_cache' => true,
'query_engine' => true,
'rename' => true,
'rename_form' => true,
'rdelete' => true,
'refresh' => true,
'schema' => true,
'server_info' => true,
'show_cache' => true,
'template_engine' => true,
'update_confirm' => true,
'update' => true
);
*/
/*********************************************/

View File

@ -31,13 +31,6 @@ $request['template'] = $request['page']->getTemplate();
/*
if ($request['attribute']->isReadOnly())
error(sprintf(_('The attribute (%s) is in readonly mode.'),$request['attr']),'error','index.php');
# Check our permissions
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value'))
error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('add attribute value')),'error','index.php');
if (($request['attribute']->getValueCount() == 0) && ! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add'))
error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('add attribute')),'error','index.php');
*/
# Render the form

View File

@ -23,9 +23,6 @@ $ldap['SRC'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_src'));
$ldap['DST'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_dst'));
# Error checking
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_move'))
error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('copy entry')),'error','index.php');
if (! trim($request['dnDST']))
error(_('You left the destination DN blank.'),'error','index.php');

View File

@ -19,9 +19,6 @@ if (get_request('cancel','REQUEST')) {
die();
}
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_create'))
error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('create entry')),'error','index.php');
$request = array();
$request['redirect'] = get_request('redirect','POST',false,false);

View File

@ -13,9 +13,6 @@
require './common.php';
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_create'))
error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('create entry')),'error','index.php');
$request = array();
$request['redirect'] = get_request('redirect','POST',false,false);

View File

@ -20,9 +20,6 @@ $request['dn'] = get_request('dn','REQUEST',true);
if (! $app['server']->dnExists($request['dn']))
error(sprintf('%s (%s)',_('No such entry.'),'<b>'.pretty_print_dn($request['dn']).'</b>'),'error','index.php');
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete','simple_delete'))
error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('delete entry')),'error','index.php');
# Delete the entry.
$result = $app['server']->delete($request['dn']);

View File

@ -13,9 +13,6 @@
require './common.php';
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete'))
error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('delete attribute')),'error','index.php');
$request = array();
$request['dn'] = get_request('dn','REQUEST',true);
$request['attr'] = get_request('attr','REQUEST',true);

View File

@ -14,9 +14,6 @@
require './common.php';
require LIBDIR.'export_functions.php';
if (! $_SESSION[APPCONFIG]->isCommandAvailable('export'))
error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('export')),'error','index.php');
# Prevent script from bailing early for long search
@set_time_limit(0);

View File

@ -14,9 +14,6 @@
require './common.php';
require LIBDIR.'import_functions.php';
if (! $_SESSION[APPCONFIG]->isCommandAvailable('import'))
error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('import')),'error','index.php');
$request = array();
$request['importer'] = new Importer($app['server']->getIndex(),'LDIF');
$request['import'] = $request['importer']->getTemplate();

View File

@ -13,9 +13,6 @@
require './common.php';
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete','simple_delete'))
error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('delete entry')),'error','index.php');
$request = array();
$request['dn'] = get_request('dn','REQUEST',true);

View File

@ -20,9 +20,6 @@ $request['rdnDST'] = get_request('new_rdn','REQUEST');
$request['container'] = $app['server']->getContainer($request['dnSRC']);
# Error checking
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_rename'))
error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('rename entry')),'error','index.php');
if (! $app['server']->isBranchRenameEnabled()) {
# We search all children, not only the visible children in the tree
$children = $app['server']->getContainerContents($request['dnSRC'],null,0,'(objectClass=*)',LDAP_DEREF_NEVER);

View File

@ -20,23 +20,10 @@ echo '<br /><br />';
echo _('Use the menu to the left to navigate');
echo '<br /><br />';
$links = '';
if ($_SESSION[APPCONFIG]->isCommandAvailable('external_links','credits'))
$links .= sprintf('<a href="%s" target="_blank">%s</a>',get_href('credits'),_('Credits'));
if ($_SESSION[APPCONFIG]->isCommandAvailable('external_links','help')) {
if ($links) $links .= ' | ';
$links .= sprintf('<a href="%s" target="_blank">%s</a>',get_href('documentation'),_('Documentation'));
}
if ($_SESSION[APPCONFIG]->isCommandAvailable('external_links','donation')) {
if ($links) $links .= ' | ';
$links .= sprintf('<a href="%s" target="_blank">%s</a>',get_href('donate'),_('Donate'));
}
if ($links) {
echo $links;
if ($_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks')) {
printf('<a href="%s" target="_blank">%s</a>',get_href('credits'),_('Credits'));
printf(' | <a href="%s" target="_blank">%s</a>',get_href('documentation'),_('Documentation'));
printf(' | <a href="%s" target="_blank">%s</a>',get_href('donate'),_('Donate'));
echo '<br /><br />';
}

View File

@ -207,6 +207,7 @@ class HTMLTree extends Tree {
$menu['title'] = _('View schema for');
$menu['img'] = 'schema-big.png';
$menu['name'] = _('schema');
break;
case 'search':
@ -219,6 +220,7 @@ class HTMLTree extends Tree {
$menu['title'] = _('Search');
$menu['img'] = 'search-big.png';
$menu['name'] = _('search');
break;
case 'refresh':
@ -232,6 +234,7 @@ class HTMLTree extends Tree {
$menu['title'] = _('Refresh');
$menu['img'] = 'refresh-big.png';
$menu['name'] = _('refresh');
break;
case 'server_info':
@ -244,6 +247,7 @@ class HTMLTree extends Tree {
$menu['title'] = _('Info');
$menu['img'] = 'info-big.png';
$menu['name'] = _('info');
break;
case 'monitor':
@ -260,10 +264,11 @@ class HTMLTree extends Tree {
$menu['title'] = _('Monitor');
$menu['img'] = 'monitorserver-big.png';
$menu['name'] = _('monitor');
break;
case 'import':
if (! $_SESSION[APPCONFIG]->isCommandAvailable('script','import') || $server->isReadOnly())
if (! $_SESSION[APPCONFIG]->isCommandAvailable('script','import_form') || ! $_SESSION[APPCONFIG]->isCommandAvailable('script','import') || $server->isReadOnly())
return '';
$menu['cmd'] = 'import_form';
@ -272,10 +277,11 @@ class HTMLTree extends Tree {
$menu['title'] = _('Import');
$menu['img'] = 'import-big.png';
$menu['name'] = _('import');
break;
case 'export':
if (! $_SESSION[APPCONFIG]->isCommandAvailable('script','export'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('script','export_form') || ! $_SESSION[APPCONFIG]->isCommandAvailable('script','export'))
return '';
$menu['cmd'] = 'export_form';
@ -284,10 +290,11 @@ class HTMLTree extends Tree {
$menu['title'] = _('Export');
$menu['img'] = 'export-big.png';
$menu['name'] = _('export');
break;
case 'logout':
if (in_array($server->getAuthType(),array('config','http','proxy')))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('script','logout') || in_array($server->getAuthType(),array('config','http','proxy')))
return '';
$href = sprintf('cmd.php?cmd=logout&server_id=%s',$server->getIndex());

View File

@ -623,7 +623,7 @@ class PageRender extends Visitor {
echo '<br/>';
if (! $attribute->isReadOnly() && $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete'))
if (! $attribute->isReadOnly() && $_SESSION[APPCONFIG]->isCommandAvailable('script','delete_attr'))
printf('<a href="javascript:deleteAttribute(\'%s\',\'%s\',\'%s\');" style="color:red;"><img src="%s/trash.png" alt="Trash" /> %s</a>',
$attribute->getName(),$attribute->getFriendlyName(),$i,IMGDIR,_('delete attribute'));

View File

@ -561,7 +561,7 @@ var deon=0;
printf('<td>%s: <b>%s</b><br/><br/><div class="execution_time">(%s %s)</div></td>',_('Entries found'),
number_format($results),$this->template->resultsdata[$base]['time'],_('seconds'));
if ($_SESSION[APPCONFIG]->isCommandAvailable('export')) {
if ($_SESSION[APPCONFIG]->isCommandAvailable('script','export') && $_SESSION[APPCONFIG]->isCommandAvailable('script','export_form')) {
$href = htmlspecialchars(sprintf('cmd.php?cmd=export_form&server_id=%s&scope=%s&dn=%s&filter=%s&attributes=%s',
$server->getIndex(),$this->template->resultsdata[$base]['scope'],
$base,rawurlencode($this->template->resultsdata[$base]['filter']),

View File

@ -914,40 +914,43 @@ class TemplateRender extends PageRender {
switch ($i) {
case 'entryrefresh':
if ($_SESSION[APPCONFIG]->isCommandAvailable('entry_refresh'))
if ($_SESSION[APPCONFIG]->isCommandAvailable('cmd','entry_refresh'))
return $this->getMenuItemRefresh();
else
return '';
case 'switchtemplate':
return $this->getMenuItemSwitchTemplate();
if ($_SESSION[APPCONFIG]->isCommandAvailable('cmd','switch_template'))
return $this->getMenuItemSwitchTemplate();
else
return '';
case 'entryexport':
if ($_SESSION[APPCONFIG]->isCommandAvailable('script','export_form'))
if ($_SESSION[APPCONFIG]->isCommandAvailable('script','export_form') && $_SESSION[APPCONFIG]->isCommandAvailable('script','export'))
return $this->getMenuItemExportBase();
else
return '';
case 'entrycopy':
if ($_SESSION[APPCONFIG]->isCommandAvailable('script','copy_form') && ! $this->template->isReadOnly())
if ($_SESSION[APPCONFIG]->isCommandAvailable('script','copy_form') && $_SESSION[APPCONFIG]->isCommandAvailable('script','copy') && ! $this->template->isReadOnly())
return $this->getMenuItemMove();
else
return '';
case 'showinternal':
if ($_SESSION[APPCONFIG]->isCommandAvailable('entry_internal_attributes_show'))
if ($_SESSION[APPCONFIG]->isCommandAvailable('cmd','entry_internal_attributes_show'))
return $this->getMenuItemInternalAttributes();
else
return '';
case 'entrydelete':
if ($_SESSION[APPCONFIG]->isCommandAvailable('script','delete_form') && ! $this->template->isReadOnly())
if ($_SESSION[APPCONFIG]->isCommandAvailable('script','delete_form') && $_SESSION[APPCONFIG]->isCommandAvailable('script','delete') && ! $this->template->isReadOnly())
return $this->getMenuItemDelete();
else
return '';
case 'entryrename':
if ($_SESSION[APPCONFIG]->isCommandAvailable('entry_rename') && ! $this->template->isReadOnly()) {
if ($_SESSION[APPCONFIG]->isCommandAvailable('script','rename_form') && $_SESSION[APPCONFIG]->isCommandAvailable('script','rename') && ! $this->template->isReadOnly()) {
# Check if any of the RDN's are read only.
$rdnro = false;
@ -968,25 +971,25 @@ class TemplateRender extends PageRender {
case 'msgdel':
if ($_SESSION[APPCONFIG]->getValue('appearance','show_hints')
&& $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete') && ! $this->template->isReadOnly())
&& $_SESSION[APPCONFIG]->isCommandAvailable('script','delete_form') && $_SESSION[APPCONFIG]->isCommandAvailable('script','delete') && ! $this->template->isReadOnly())
return array('',$this->getDeleteAttributeMessage());
else
return '';
case 'entrycompare':
if ($_SESSION[APPCONFIG]->isCommandAvailable('entry_compare') && ! $this->template->isReadOnly())
if ($_SESSION[APPCONFIG]->isCommandAvailable('script','compare_form') && $_SESSION[APPCONFIG]->isCommandAvailable('script','compare') && ! $this->template->isReadOnly())
return $this->getMenuItemCompare();
else
return '';
case 'childcreate':
if ($_SESSION[APPCONFIG]->isCommandAvailable('entry_create') && ! $this->template->isReadOnly())
if ($_SESSION[APPCONFIG]->isCommandAvailable('script','create') && ! $this->template->isReadOnly())
return $this->getMenuItemCreate();
else
return '';
case 'addattr':
if ($_SESSION[APPCONFIG]->isCommandAvailable('attribute_add') && ! $this->template->isReadOnly())
if ($_SESSION[APPCONFIG]->isCommandAvailable('script','add_attr_form') && ! $this->template->isReadOnly())
return $this->getMenuItemAddAttribute();
else
return '';
@ -1027,7 +1030,7 @@ class TemplateRender extends PageRender {
if ($i == 'childview')
return $this->getMenuItemShowChildren($children_count);
elseif ($i == 'childexport' && $_SESSION[APPCONFIG]->isCommandAvailable('export'))
elseif ($i == 'childexport' && $_SESSION[APPCONFIG]->isCommandAvailable('script','export_form') && $_SESSION[APPCONFIG]->isCommandAvailable('script','export'))
return $this->getMenuItemExportSub();
else
return '';
@ -1036,7 +1039,7 @@ class TemplateRender extends PageRender {
return '';
case 'msgschema':
if ($_SESSION[APPCONFIG]->getValue('appearance','show_hints') && $_SESSION[APPCONFIG]->isCommandAvailable('schema'))
if ($_SESSION[APPCONFIG]->getValue('appearance','show_hints') && $_SESSION[APPCONFIG]->isCommandAvailable('script','schema'))
return array('',$this->getViewSchemaMessage());
else
return array();
@ -1068,7 +1071,7 @@ class TemplateRender extends PageRender {
protected function getDeleteAttributeMessage() {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if ($_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete_value') && ! $this->template->isReadOnly())
if ($_SESSION[APPCONFIG]->isCommandAvailable('script','delete_attr') && ! $this->template->isReadOnly())
return sprintf($this->layout['hint'],_('Hint: To delete an attribute, empty the text field and click save.'));
else
return '';
@ -1982,7 +1985,7 @@ function fillRec(id,value) {
switch ($action) {
case 'add':
if ($attribute->isVisible() && ! $attribute->isReadOnly()
&& $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value')) {
&& $_SESSION[APPCONFIG]->isCommandAvailable('script','add_value_form')) {
if ($attribute->haveMoreValues())
return $this->get('AddValueMenuItem',$attribute);
@ -1993,8 +1996,7 @@ function fillRec(id,value) {
case 'modify':
if (in_array($attribute->getName(),arrayLower($_SESSION[APPCONFIG]->getValue('modify_member','groupattr')))) {
if ($attribute->isVisible() && ! $attribute->isReadOnly() && ! $attribute->isRDN()
&& ($_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value')
|| $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete_value')))
&& $_SESSION[APPCONFIG]->isCommandAvailable('script','modify_member_form'))
return $this->get('ModifyMemberMenuItem',$attribute);
}
@ -2002,7 +2004,8 @@ function fillRec(id,value) {
case 'rename':
if ($attribute->isVisible() && $attribute->isRDN() && ! $attribute->isReadOnly()
&& $_SESSION[APPCONFIG]->isCommandAvailable('entry_rename'))
&& $_SESSION[APPCONFIG]->isCommandAvailable('script','rename_form')
&& $_SESSION[APPCONFIG]->isCommandAvailable('script','rename'))
return $this->get('RenameMenuItem',$attribute);
return '';

View File

@ -290,6 +290,15 @@ class Config {
* Define command availability ; if the value of a command is true,
* the command will be available.
*/
$this->default->commands['cmd'] = array(
'desc'=>'Define command availability',
'default'=> array(
'entry_internal_attributes_show' => true,
'entry_refresh' => true,
'oslinks' => true,
'switch_template' => true
));
$this->default->commands['script'] = array(
'desc'=>'Define scripts availability',
'default'=> array(
@ -331,42 +340,7 @@ class Config {
'show_cache' => true,
'template_engine' => true,
'update_confirm' => true,
'update' => true,
'test' => true
));
$this->default->commands['all'] = array(
'desc'=>'Define command availability',
'default'=> array(
'home' => true,
'external_links' => array('feature' => true,
'forum' => true,
'bug' => true,
'donation' => true,
'help' => true,
'credits' => true),
'purge' => true,
'schema' => true,
'import' => true,
'export' => true,
'logout' => true,
'search' => array('simple_search' => true,
'predefined_search' => true,
'advanced_search' => true),
'server_refresh' => true,
'server_info' => true,
'entry_refresh' => true,
'entry_move' => true,
'entry_internal_attributes_show' => true,
'entry_delete' => array('simple_delete' => true,
'mass_delete' => false),
'entry_rename' => true,
'entry_compare' => true,
'entry_create' => true,
'attribute_add' => true,
'attribute_add_value' => true,
'attribute_delete' => true,
'attribute_delete_value' => true
'update' => true
));
/** Aliases and Referrrals
@ -666,48 +640,20 @@ class Config {
}
/**
* The parameter number is variable.
* For example : isCommandAvailable('search','simple_search')
* Simple ACL to see if commands can be run
*/
public function isCommandAvailable($index='all') {
public function isCommandAvailable($index='cmd') {
$a = func_get_args();
if (! in_array($index,array('all','script')))
$index = 'all';
else
array_shift($a);
if (count($a) == 1 && is_array($a[0]))
$a = $a[0];
$i = 0;
array_shift($a);
$a = $a[0];
# Command availability list
$cmd = $this->getValue('commands',$index);
# Search for the command
while ($i < count($a)) {
if (! is_array($cmd))
return $cmd;
if (! is_string($a) || ! isset($cmd[$a]))
debug_dump(array('Unknown command '=>$a),1);
if (! isset($cmd[$a[$i]]))
return false;
$cmd = $cmd[$a[$i]];
$i++;
}
# If this is a leaf command, return its availability
if (! is_array($cmd))
return $cmd;
# Else the command is available, if one of its sub-command is available
$a[] = '';
foreach ($cmd as $c => $v) {
$a[$i] = $c;
if ($this->isCommandAvailable($a))
return true;
}
return false;
return $cmd[$a];
}
public function configDefinition($key,$index,$config) {

View File

@ -122,31 +122,6 @@ class ldap_pla extends ldap {
}
/** FUNCTIONS TO BE REWORKED BELOW HERE **/
/**
* Returns true if the user has configured the specified server to enable mass deletion.
*
* Mass deletion is enabled in config.php this:
* <code>
* $config->custom->commands['all'] = array('entry_delete' => array('mass_delete' => true));
* </code>
* Notice that mass deletes are not enabled on a per-server basis, but this
* function checks that the server is not in a read-only state as well.
*
* @return boolean
*/
function isMassDeleteEnabled() {
if (DEBUG_ENABLED)
debug_log('Entered with ()',17,__FILE__,__LINE__,__METHOD__);
if ($this->connect(false) && $this->haveAuthInfo() && ! $this->isReadOnly() &&
$_SESSION[APPCONFIG]->isCommandAvailable('entry_delete', 'mass_delete'))
return true;
else
return false;
}
/**
* Gets whether the admin has configured phpLDAPadmin to show the "Create New" link in the tree viewer.
* <code>
@ -166,7 +141,7 @@ class ldap_pla extends ldap {
if (DEBUG_ENABLED)
debug_log('Entered with ()',17,__FILE__,__LINE__,__METHOD__);
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_create'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('script','create'))
return false;
else
return $this->getValue('appearance','show_create');

View File

@ -358,50 +358,60 @@ function cmd_control_pane($type) {
return array(
'home'=>array(
'title'=>_('Home'),
'enable'=>true,
'link'=>sprintf('href="index.php" title="%s"',_('Home')),
'image'=>sprintf('<img src="%s/home-big.png" alt="%s" />',IMGDIR,_('Home'))),
'purge'=>array(
'title'=>_('Purge caches'),
'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('script','purge_cache'),
'link'=>sprintf('href="cmd.php?cmd=purge_cache" onclick="return displayAJ(\'BODY\',\'cmd=purge_cache\',\'%s\');" title="%s"',
_('Clearing cache'),_('Purge caches')),
'image'=>sprintf('<img src="%s/trash-big.png" alt="%s" />',IMGDIR,_('Purge caches'))),
'appearance:hide_debug_info'=>array(
'hide_debug_info'=>array(
'title'=>_('Show Cache'),
'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('script','show_cache'),
'link'=>sprintf('href="cmd.php?cmd=show_cache" onclick="return displayAJ(\'BODY\',\'cmd=show_cache\',\'%s\');" title="%s"',
_('Loading'),_('Show Cache'),_('Show Cache')),
'image'=>sprintf('<img src="%s/debug-cache.png" alt="%s" />',IMGDIR,_('Show Cache'))),
);
break;
case 'top' :
return array(
'external_links:forum'=>array(
'forum'=>array(
'title'=>_('Forum'),
'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks'),
'link'=>sprintf('href="%s" title="%s" target="_blank"',get_href('forum'),_('Forum')),
'image'=>sprintf('<img src="%s/forum-big.png" alt="%s" />',IMGDIR,_('Forum'))),
'external_links:feature'=>array(
'feature'=>array(
'title'=>_('Request feature'),
'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks'),
'link'=>sprintf('href="%s" title="%s" target="_blank"',get_href('add_rfe'),_('Request feature')),
'image'=>sprintf('<img src="%s/request-feature-big.png" alt="%s" />',IMGDIR,_('Request feature'))),
'external_links:bug'=>array(
'bug'=>array(
'title'=>_('Report a bug'),
'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks'),
'link'=>sprintf('href="%s" title="%s" target="_blank"',get_href('add_bug'),_('Report a bug')),
'image'=>sprintf('<img src="%s/bug-big.png" alt="%s" />',IMGDIR,_('Report a bug'))),
'external_links:donation'=>array(
'donation'=>array(
'title'=>_('Donate'),
'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks'),
'link'=>sprintf('href="%s" title="%s" target="_blank"',get_href('donate'),_('Donate')),
'image'=>sprintf('<img src="%s/smile-big.png" alt="%s" />',IMGDIR,_('Donate'))),
'external_links:help'=>array(
'help'=>array(
'title'=>_('Help'),
'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks'),
'link'=>sprintf('href="%s" title="%s" target="_blank"',get_href('documentation'),_('Help')),
'image'=>sprintf('<img src="%s/help-big.png" alt="%s" />',IMGDIR,_('Help')))
);
break;
}
}

View File

@ -154,24 +154,19 @@ class page {
echo '<td class="imagetop">';
$empty = true;
if (function_exists('cmd_control_pane'))
foreach (cmd_control_pane('top') as $cmd => $cmddetails) {
$cmds = explode(':',$cmd);
foreach (cmd_control_pane('top') as $cmddetails)
if ((isset($cmddetails['enable']) && $cmddetails['enable']) || ! isset($cmddetails['enable'])) {
if (! $empty)
echo ' ';
if (defined('APPCONFIG') && isset($_SESSION[APPCONFIG]) && method_exists($_SESSION[APPCONFIG],'isCommandAvailable'))
if ($_SESSION[APPCONFIG]->isCommandAvailable('all',$cmds)) {
if ((isset($cmddetails['enable']) && trim($cmddetails['enable'])) || ! isset($cmddetails['enable'])) {
if (! $empty)
echo ' ';
printf('<a %s>%s</a>',$cmddetails['link'],$cmddetails['image']);
printf('<a %s>%s</a>',$cmddetails['link'],$cmddetails['image']);
$empty = false;
}
}
}
$empty = false;
}
if ($empty)
echo '&nbsp;';
echo '</td>';
echo '</tr></table></div></td>';
echo '</tr>';
@ -187,22 +182,16 @@ class page {
$empty = true;
if (function_exists('cmd_control_pane'))
foreach (cmd_control_pane('main') as $cmd => $cmddetails) {
$cmds = explode(':',$cmd);
if (defined('APPCONFIG') && isset($_SESSION[APPCONFIG]) && method_exists($_SESSION[APPCONFIG],'isCommandAvailable'))
if ($_SESSION[APPCONFIG]->isCommandAvailable('all',$cmds)) {
if ((isset($cmddetails['enable']) && trim($cmddetails['enable'])) || ! isset($cmddetails['enable'])) {
if (! $empty)
foreach (cmd_control_pane('main') as $cmddetails)
if ((isset($cmddetails['enable']) && trim($cmddetails['enable'])) || ! isset($cmddetails['enable'])) {
if (! $empty)
echo ' | ';
printf('<a %s>%s</a>',$cmddetails['link'],
$_SESSION[APPCONFIG]->getValue('appearance','control_icons') ? $cmddetails['image'] : $cmddetails['title']);
printf('<a %s>%s</a>',$cmddetails['link'],
$_SESSION[APPCONFIG]->getValue('appearance','control_icons') ? $cmddetails['image'] : $cmddetails['title']);
$empty = false;
}
}
}
$empty = false;
}
echo '</td>';
if ($empty)