...
 
Commits (7)
......@@ -37,58 +37,6 @@ define("LDAP_AUTH", 6);
*/
class msgPool
{
public static function selectToView ($type, $o_type = "")
{
if ($o_type == "") {
return sprintf(_("Select to list objects of type '%s'."), $type);
} elseif ($o_type == "contains") {
return sprintf(_("Select to list objects containig '%s'."), $type);
} elseif ($o_type == "enabled") {
return sprintf(_("Select to list objects that have '%s' enabled"), $type);
} elseif ($o_type == "subsearch") {
return _("Select to search within subtrees");
} elseif ($o_type == "subsearch_small") {
return _("Search in subtrees");
}
}
/*!
* \brief Display the deleted informations
*
* \param string $name Name of the object which will be deleted
*
* \param string $type Type of the object which will be deleted
*/
public static function deleteInfo ($name = "", $type = "")
{
if ($name == "") {
if ($type == "") {
return _("This object will be deleted!");
} else {
return sprintf(_("This '%s' object will be deleted!"), $type);
}
}
if (!is_array($name)) {
if ($type == "") {
return sprintf(_("This object will be deleted: %s"), "<br><br><i>$name</i>");
} else {
return sprintf(_("This '%s' object will be deleted: %s"), $type, "<br><br><i>$name</i>");
}
}
if (count($name) == 1) {
if ($type == "") {
return _("This object will be deleted:")."<br>".msgPool::buildList($name);
} else {
return sprintf(_("This '%s' object will be deleted:"), $type). "<br>".msgPool::buildList($name);
}
}
if ($type == "") {
return sprintf(_("These objects will be deleted: %s"), "<br>".msgPool::buildList($name));
} else {
return sprintf(_("These '%s' objects will be deleted: %s"), $type, "<br>".msgPool::buildList($name));
}
}
/*!
* \brief Display that we have no permission to delete an object
*
......@@ -204,76 +152,6 @@ class msgPool
return _("You have no permission to move these objects:")."<br>".msgPool::buildList($name);
}
/*!
* \brief Display informations about database connection
*
* \param string $name Name of the database
*
* \param string $error Error messsage to display
*
* \param string $dbinfo Database information
*/
public static function dbconnect ($name, $error = "", $dbinfo = "")
{
if ($error != "") {
$error = "<br><br><i>"._("Error").":</i> ".$error;
}
if ($dbinfo != "") {
$error .= "<br><br><i>"._("Connection information").":</i> ".$dbinfo;
}
return sprintf(_("Cannot connect to %s database!"), $name).$error;
}
/*!
* \brief Display informations about database select
*
* \param string $name Name of the database
*
* \param string $error Error messsage to display
*
* \param string $dbinfo Database information
*/
public static function dbselect ($name, $error = "", $dbinfo = "")
{
if ($error != "") {
$error = "<br><br><i>"._("Error").":</i> ".$error;
}
if ($dbinfo != "") {
$error .= "<br><br><i>"._("Connection information").":</i> ".$dbinfo;
}
return sprintf(_("Cannot select %s database!"), $name).$error;
}
/*!
* \brief Display error about no server found
*
* \param string $name Name of the server
*/
public static function noserver ($name)
{
return sprintf(_("No %s server defined!"), $name);
}
/*!
* \brief Display informations about database query
*
* \param string $name Name of the database
*
* \param string $error Error messsage to display
*
* \param string $dbinfo Database information
*/
public static function dbquery ($name, $error = "", $dbinfo = "")
{
if ($error != "") {
$error = "<br><br><i>"._("Error").":</i> ".$error;
}
if ($dbinfo != "") {
$error .= "<br><br><i>"._("Connection information").":</i> ".$dbinfo;
}
return sprintf(_("Cannot query %s database!"), $name).$error;
}
/*!
* \brief Display field contains reserved keyword
*
......@@ -284,44 +162,6 @@ class msgPool
return sprintf(_("The field '%s' contains a reserved keyword!"), $name);
}
/*!
* \brief Display that a command doesn't exist in this plugin
*
* \param string $type Command type
*
* \param string $plugin Name of the plugin
*/
public static function cmdnotfound ($type, $plugin)
{
return sprintf(_('Command specified as %s trigger for plugin "%s" does not exist!'), $type, $plugin);
}
/*!
* \brief Display that a command doesn't valid in this plugin
*
* \param string $type Command type
*
* \param string $command Command name
*
* \param string $plugin Name of the plugin
*/
public static function cmdinvalid ($type, $command = "", $plugin = "")
{
if ($command == "") {
if ($plugin == "") {
return sprintf(_("'%s' command is invalid!"), $type);
} else {
return sprintf(_("'%s' command for plugin %s is invalid!"), $type, $plugin);
}
} else {
if ($plugin == "") {
return sprintf(_("'%s' command (%s) is invalid!"), $type, $command);
} else {
return sprintf(_("'%s' command (%s) for plugin %s is invalid!"), $type, $command, $plugin);
}
}
}
/*!
* \brief Display that a command execution failed in this plugin
*
......@@ -698,97 +538,6 @@ class msgPool
return sprintf(_("Communication failure with the infrastructure service: %s"), "<br><br>"._("Error").": ".$error);
}
/*!
* \brief Display which it still in use
*
* \param $type Type
*
* \param array $objects
*/
public static function stillInUse ($type, $objects = [])
{
if (!is_array($objects)) {
return sprintf(_("This '%s' is still in use by this object: %s"), $type, "<br><br>".$objects);
}
if (count($objects) == 1) {
return sprintf(_("This '%s' is still in use by this object: %s"), $type, "<br>".msgPool::buildList($objects));
}
if (count($objects) == 0) {
return sprintf(_("This '%s' is still in use."), $type);
}
return sprintf(_("This '%s' is still in use by these objects: %s"), $type, "<br>".msgPool::buildList($objects));
}
/*!
* \brief Display file doesn't exist
*
* \param string $file Name of the file not found
*/
public static function fileDoesNotExist ($file)
{
return sprintf(_("File '%s' does not exist!"), $file);
}
/*!
* \brief Display file isn't readable
*
* \param string $file Name of the file not readable
*/
public static function cannotReadFile ($file)
{
return sprintf(_("Cannot open file '%s' for reading!"), $file);
}
/*!
* \brief Display file isn't writable
*
* \param string $file Name of the file not writable
*/
public static function cannotWriteFile ($file)
{
return sprintf(_("Cannot open file '%s' for writing!"), $file);
}
/*!
* \brief Display error in the configuration
*
* \param string $attr Name of the invalide attribute
*/
public static function invalidConfigurationAttribute ($attr)
{
return sprintf(_("The value for '%s' is currently unconfigured or invalid, please check your configuration file!"), $attr);
}
/*!
* \brief Display error when cannot delete a file
*
* \param string $file Filename which can't be deleted
*/
public static function cannotDeleteFile ($file)
{
return sprintf(_("Cannot delete file '%s'!"), $file);
}
/*!
* \brief Display error when cannot create a folder
*
* \param string $path Name of folder which can't be created
*/
public static function cannotCreateFolder ($path)
{
return sprintf(_("Cannot create folder '%s'!"), $path);
}
/*!
* \brief Display error when cannot delete a folder
*
* \param string $path Name of folder which can't be deleted
*/
public static function cannotDeleteFolder ($path)
{
return sprintf(_("Cannot delete folder '%s'!"), $path);
}
/*!
* \brief Display checking for a support
*
......@@ -809,26 +558,6 @@ class msgPool
return sprintf(_("Install and activate the %s PHP module."), $what);
}
/*!
* \brief Display install or activate a PEAR module
*
* \param string $what Name of the module
*/
public static function installPearModule ($what)
{
return sprintf(_("Install and activate the %s Pear module."), $what);
}
/*!
* \brief Display error when a class is not found
*
* \param string $plugin Name of the class which can'b be initialized
*/
public static function class_not_found ($plugin)
{
return sprintf(_("Cannot initialize class '%s'! Maybe there is a plugin missing in your FusionDirectory setup?"), $plugin);
}
/*!
* \brief Display error when checking the base
*/
......
......@@ -222,11 +222,9 @@ class userinfo
continue;
}
if (!empty($ACLRule['userfilter'])) {
/* Check if we match the user filter */
if (!$ldap->object_match_filter($this->dn, $ACLRule['userfilter'])) {
continue;
}
if (!empty($ACLRule['userfilter']) && !$ldap->object_match_filter($this->dn, $ACLRule['userfilter'])) {
/* We do not match the user filter */
continue;
}
if (!empty($ACLRule['targetfilter'])) {
......@@ -530,7 +528,7 @@ class userinfo
$adn = preg_replace("/^[^,]*+,/", "", $adn);
}
if (isset($this->ACLperPath[$adn])) {
$ACL = $this->ACLperPath[$adn];
$ACLs = $this->ACLperPath[$adn];
} else {
$ACL_CACHE["$dn+$object+$attribute"] = '';
return '';
......@@ -575,10 +573,10 @@ class userinfo
$cpath = $element.','.$cpath;
}
if (isset($ACL[$cpath])) {
if (isset($ACLs[$cpath])) {
/* Inspect this ACL, place the result into ACL */
foreach ($ACL[$cpath] as $subacl) {
foreach ($ACLs[$cpath] as $subacl) {
/* Reset? Just clean the ACL and turn over to the next one... */
if ($subacl['type'] == 'reset') {
......
......@@ -264,7 +264,9 @@ class managementFilter
$objectTypeCount[$type] = count($ldapEntries);
foreach ($ldapEntries as $dn => $entry) {
// TODO: check collisions?
if (isset($entries[$dn])) {
trigger_error('Same dn '.$dn.' found as several object types');
}
$entries[$dn] = new ListingEntry($this->parent->listing, $type, $dn, $entry, $row++);
}
}
......
......@@ -58,15 +58,15 @@ class PropertiesColumn extends Column
function renderCell (ListingEntry $entry): string
{
$tabs = $this->computeIcons($entry);
$result = '';
foreach ($tabs as $tab) {
if (empty($tab['icon'])) {
$result .= '<img src="images/empty.png" alt="" class="optional '.$tab['tab'].'"/>';
$tabInfos = $this->computeIcons($entry);
$result = '';
foreach ($tabInfos as $tabInfo) {
if (empty($tabInfo['icon'])) {
$result .= '<img src="images/empty.png" alt="" class="optional '.$tabInfo['tab'].'"/>';
} else {
$result .= '<input type="image" src="'.htmlentities($tab['icon'], ENT_COMPAT, 'UTF-8').'" '.
'alt="'.htmlentities($tab['title'], ENT_COMPAT, 'UTF-8').'" title="'.htmlentities($tab['title'], ENT_COMPAT, 'UTF-8').'" '.
'name="listing_edit_tab_'.$tab['tab'].'_'.$entry->row.'"/>';
$result .= '<input type="image" src="'.htmlentities($tabInfo['icon'], ENT_COMPAT, 'UTF-8').'" '.
'alt="'.htmlentities($tabInfo['title'], ENT_COMPAT, 'UTF-8').'" title="'.htmlentities($tabInfo['title'], ENT_COMPAT, 'UTF-8').'" '.
'name="listing_edit_tab_'.$tabInfo['tab'].'_'.$entry->row.'"/>';
}
}
......
......@@ -111,6 +111,7 @@ class GroupMembersAttribute extends ObjectsAttribute
$infos = objects::infos(ogroup::$objectTypes[$this->types[$key]]);
}
} catch (NonExistingObjectTypeException $e) {
/* Ignore non-existing types, plugins may have been removed */
}
if (isset($infos['icon'])) {
$img = $infos['icon'];
......
......@@ -183,6 +183,7 @@ class userRoles extends simplePlugin
$g->getBaseObject()->attributesAccess['member']->searchAndRemove($this->dn);
$g->save();
} catch (NonExistingLdapNodeException $e) {
/* Ignore deleted groups */
}
}
/* Remove all roles */
......@@ -192,6 +193,7 @@ class userRoles extends simplePlugin
$r->getBaseObject()->attributesAccess['roleOccupant']->searchAndRemove($this->dn);
$r->save();
} catch (NonExistingLdapNodeException $e) {
/* Ignore deleted roles */
}
}
}
......