diff --git a/include/class_objects.inc b/include/class_objects.inc index 2b9db93ba62685a53f21dcd8d7f25829f8df1c11..e93415b0c1c8fb67264ec90cf9c60360b3f3defa 100644 --- a/include/class_objects.inc +++ b/include/class_objects.inc @@ -316,21 +316,23 @@ class objects return $tabObject; } - static function link ($dn, $type, $subaction = '', $text = NULL, $icon = TRUE) + static function link ($dn, $type, $subaction = '', $text = NULL, $icon = TRUE, $link = TRUE) { global $config; $infos = static::infos($type); - if (!isset($infos['management'])) { - throw new NoManagementClassException('Asked for link for type "'.$type.'" but it does not have a management class'); - } - $pInfos = pluglist::pluginInfos($infos['management']); - $index = $pInfos['INDEX']; - $action = 'edit'; - if ($subaction != '') { - $action .= '_'.$subaction; + if ($link) { + if (!isset($infos['management'])) { + throw new NoManagementClassException('Asked for link for type "'.$type.'" but it does not have a management class'); + } + $pInfos = pluglist::pluginInfos($infos['management']); + $index = $pInfos['INDEX']; + $action = 'edit'; + if ($subaction != '') { + $action .= '_'.$subaction; + } + $href = "main.php?plug=$index&reset=1&act=listing_$action&dn=".urlencode($dn); } - $href = "main.php?plug=$index&reset=1&act=listing_$action&dn=".urlencode($dn); if ($text === NULL) { $ldap = $config->get_ldap_link(); @@ -348,11 +350,17 @@ class objects $text = $text[$infos['nameAttr']][0]; } + $text = htmlentities($text, ENT_COMPAT, 'UTF-8'); + if ($icon && isset($infos['icon'])) { $text = '<img alt="'.$infos['name'].'" title="'.$dn.'" src="'.htmlentities($infos['icon'], ENT_COMPAT, 'UTF-8').'" class="center"/> '.$text; } - return '<a href="'.$href.'">'.$text.'</a>'; + if ($link) { + $text = '<a href="'.$href.'">'.$text.'</a>'; + } + + return $text; } static function create ($type)