diff --git a/include/errors/class_SimplePluginError.inc b/include/errors/class_SimplePluginError.inc index 0bb239ac5cba3383bc9551d0e32ae06035a3da10..a2d8ef1efde4f16bddecf62effea80830d499b1a 100644 --- a/include/errors/class_SimplePluginError.inc +++ b/include/errors/class_SimplePluginError.inc @@ -36,7 +36,7 @@ class SimplePluginError extends FusionDirectoryError public function setOrigin ($origin) { - if ($origin instanceof Attribute) { + if ($origin instanceof \FusionDirectory\Core\SimplePlugin\Attribute) { $this->attribute = $origin; $this->tab = $origin->getParent(); $this->object = $this->tab->parent; diff --git a/include/functions.inc b/include/functions.inc index c681e4f718355e2dfaf20e9fd99c60b4894c94e7..e75dfa313f32b495fc3193b669f83e1a754a749f 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -61,6 +61,10 @@ function __fusiondirectory_autoload ($class_name) return; } + if (strpos($class_name, 'FusionDirectory\\') === 0) { + $class_name = preg_replace('/^.+\\\\([^\\\\]+)$/', '\\1', "$class_name"); + } + if (isset($class_mapping["$class_name"])) { require_once($BASE_DIR.'/'.$class_mapping["$class_name"]); } else { diff --git a/include/management/snapshot/class_SnapshotAttribute.inc b/include/management/snapshot/class_SnapshotAttribute.inc index 17c22fd8ed7fe54f390d1b31f8978d159f8c5cd2..895e2e677e4819632053b2149fb7aba3d6cd4c85 100644 --- a/include/management/snapshot/class_SnapshotAttribute.inc +++ b/include/management/snapshot/class_SnapshotAttribute.inc @@ -27,7 +27,7 @@ class SnapshotsAttribute extends OrderedArrayAttribute { function __construct ($label, $description, $ldapName, $required = FALSE, $defaultValue = [], $acl = '') { - Attribute::__construct($label, $description, $ldapName, $required, $defaultValue, $acl); + \FusionDirectory\Core\SimplePlugin\Attribute::__construct($label, $description, $ldapName, $required, $defaultValue, $acl); $this->edit_enabled = FALSE; $this->order = FALSE; $this->attribute = FALSE; diff --git a/include/simpleplugin/attributes/class_BaseSelectorAttribute.inc b/include/simpleplugin/attributes/class_BaseSelectorAttribute.inc index 19644d559c3b6820eb09728c60f615f74aa74d4b..0e02df61e3f8b6241e28db7edd3352481d047cff 100644 --- a/include/simpleplugin/attributes/class_BaseSelectorAttribute.inc +++ b/include/simpleplugin/attributes/class_BaseSelectorAttribute.inc @@ -21,7 +21,7 @@ /*! \brief This class allow to handle easily an Base selector attribute * */ -class BaseSelectorAttribute extends Attribute +class BaseSelectorAttribute extends \FusionDirectory\Core\SimplePlugin\Attribute { private $baseSelector = NULL; private $orig_dn = NULL; diff --git a/include/simpleplugin/attributes/class_BooleanAttribute.inc b/include/simpleplugin/attributes/class_BooleanAttribute.inc index a89c136aef29095f637e64c6f5e067f2facf183f..4fb4589507eff20c0f5b895798ba4b57f9c14237 100644 --- a/include/simpleplugin/attributes/class_BooleanAttribute.inc +++ b/include/simpleplugin/attributes/class_BooleanAttribute.inc @@ -21,7 +21,7 @@ /*! \brief This class allow to handle easily a Boolean LDAP attribute * */ -class BooleanAttribute extends Attribute +class BooleanAttribute extends \FusionDirectory\Core\SimplePlugin\Attribute { public $trueValue; public $falseValue; diff --git a/include/simpleplugin/attributes/class_CompositeAttribute.inc b/include/simpleplugin/attributes/class_CompositeAttribute.inc index 4277ed01e4737415666ecda448809b7495a6df00..fbf4fda71f964be20201d498da3e2ad30a34f6cd 100644 --- a/include/simpleplugin/attributes/class_CompositeAttribute.inc +++ b/include/simpleplugin/attributes/class_CompositeAttribute.inc @@ -25,7 +25,7 @@ * you should inherit this class and write your own readValues and writeValues method * */ -class CompositeAttribute extends Attribute +class CompositeAttribute extends \FusionDirectory\Core\SimplePlugin\Attribute { public $attributes; protected $readFormat; diff --git a/include/simpleplugin/attributes/class_DateAttribute.inc b/include/simpleplugin/attributes/class_DateAttribute.inc index 7cd2c315f21415f19001b51807a263731a1dec72..fa7981fce80979c79c25fac8369b4fb0ce1edeb4 100644 --- a/include/simpleplugin/attributes/class_DateAttribute.inc +++ b/include/simpleplugin/attributes/class_DateAttribute.inc @@ -23,7 +23,7 @@ * * We are using UTC timezone because we don't care about time, we just want date. */ -class DateAttribute extends Attribute +class DateAttribute extends \FusionDirectory\Core\SimplePlugin\Attribute { protected $format; protected $minDate = NULL; diff --git a/include/simpleplugin/attributes/class_FileAttribute.inc b/include/simpleplugin/attributes/class_FileAttribute.inc index 05abb5e686c0fddb514033b4414d56228a2d80dd..0a3ce86602fe4ce6694ad51676b7d408eb829bd4 100644 --- a/include/simpleplugin/attributes/class_FileAttribute.inc +++ b/include/simpleplugin/attributes/class_FileAttribute.inc @@ -21,7 +21,7 @@ /*! \brief This class allow to handle easily an File LDAP attribute * */ -class FileAttribute extends Attribute +class FileAttribute extends \FusionDirectory\Core\SimplePlugin\Attribute { protected $binary = TRUE; diff --git a/include/simpleplugin/attributes/class_IntAttribute.inc b/include/simpleplugin/attributes/class_IntAttribute.inc index 077db5bc664ce06bf658c93af94930cc4532a535..a057292c1ece9feec2c171df13f29c20e6c67d7e 100644 --- a/include/simpleplugin/attributes/class_IntAttribute.inc +++ b/include/simpleplugin/attributes/class_IntAttribute.inc @@ -21,7 +21,7 @@ /*! \brief This class allow to handle easily an Integer LDAP attribute * */ -class IntAttribute extends Attribute +class IntAttribute extends \FusionDirectory\Core\SimplePlugin\Attribute { protected $min; protected $max; diff --git a/include/simpleplugin/attributes/class_SelectAttribute.inc b/include/simpleplugin/attributes/class_SelectAttribute.inc index 431eafa942899eb797f45e42cd713b7fd8d74661..0e67fc98c65f165af312567ad9bc3c73f410bfe0 100644 --- a/include/simpleplugin/attributes/class_SelectAttribute.inc +++ b/include/simpleplugin/attributes/class_SelectAttribute.inc @@ -27,7 +27,7 @@ /*! \brief This class allow to handle easily a Select LDAP attribute with a set of choices * */ -class SelectAttribute extends Attribute +class SelectAttribute extends \FusionDirectory\Core\SimplePlugin\Attribute { protected $choices; protected $outputs = NULL; diff --git a/include/simpleplugin/attributes/class_SetAttribute.inc b/include/simpleplugin/attributes/class_SetAttribute.inc index dadfc17999c8832e5d57549b22aba3af4408a76d..cb0a7de621fe63857559541fd5791311682b0287 100644 --- a/include/simpleplugin/attributes/class_SetAttribute.inc +++ b/include/simpleplugin/attributes/class_SetAttribute.inc @@ -21,7 +21,7 @@ /*! \brief This class allow to handle easily a multi-valuated attribute * */ -class SetAttribute extends Attribute +class SetAttribute extends \FusionDirectory\Core\SimplePlugin\Attribute { public $attribute; protected $valueUnicity = TRUE; @@ -35,7 +35,7 @@ class SetAttribute extends Attribute * \param array $values The default values * \param boolean $valueUnicity Should the value unicity be checked */ - function __construct (Attribute $attribute, array $values = [], bool $valueUnicity = TRUE) + function __construct (\FusionDirectory\Core\SimplePlugin\Attribute $attribute, array $values = [], bool $valueUnicity = TRUE) { parent::__construct( $attribute->getLabel(), $attribute->getDescription(), diff --git a/include/simpleplugin/attributes/class_StringAttribute.inc b/include/simpleplugin/attributes/class_StringAttribute.inc index e5cf499b35914e311d09975218638b90123f42f0..ca3ab88bfa0a99d1a25db78a798d196151dc610a 100644 --- a/include/simpleplugin/attributes/class_StringAttribute.inc +++ b/include/simpleplugin/attributes/class_StringAttribute.inc @@ -21,7 +21,7 @@ /*! \brief This class allow to handle easily a String LDAP attribute * */ -class StringAttribute extends Attribute +class StringAttribute extends \FusionDirectory\Core\SimplePlugin\Attribute { protected $pattern; protected $example; diff --git a/include/simpleplugin/attributes/dialog/class_ButtonAttribute.inc b/include/simpleplugin/attributes/dialog/class_ButtonAttribute.inc index 5861fdafada3aa3d930e3a1faa6e70563f6cd11a..dbe84570e4a31df36943967204e17b53582097f6 100644 --- a/include/simpleplugin/attributes/dialog/class_ButtonAttribute.inc +++ b/include/simpleplugin/attributes/dialog/class_ButtonAttribute.inc @@ -21,7 +21,7 @@ /*! * \brief Attribute showing a button */ -class ButtonAttribute extends Attribute +class ButtonAttribute extends \FusionDirectory\Core\SimplePlugin\Attribute { protected $buttonText = NULL; protected $action; diff --git a/include/simpleplugin/attributes/dialog/class_DialogAttribute.inc b/include/simpleplugin/attributes/dialog/class_DialogAttribute.inc index c0bca3ee9da5812d7bdb00617201e46c846f5f81..a44d79deb239828f2dd95586acb0a630ed25534c 100644 --- a/include/simpleplugin/attributes/dialog/class_DialogAttribute.inc +++ b/include/simpleplugin/attributes/dialog/class_DialogAttribute.inc @@ -39,7 +39,7 @@ abstract class DialogAttribute extends SetAttribute */ function __construct ($label, $description, $ldapName, $required = FALSE, $defaultValue = [], $acl = "") { - Attribute::__construct($label, $description, $ldapName, $required, $defaultValue, $acl); + \FusionDirectory\Core\SimplePlugin\Attribute::__construct($label, $description, $ldapName, $required, $defaultValue, $acl); $this->attribute = FALSE; } diff --git a/include/simpleplugin/attributes/dialog/class_DialogOrderedArrayAttribute.inc b/include/simpleplugin/attributes/dialog/class_DialogOrderedArrayAttribute.inc index fc667d0222b8675ef6b49599be4c2493c36e91bf..7818821a05b3932d8af8174d43e602f9afe0151f 100644 --- a/include/simpleplugin/attributes/dialog/class_DialogOrderedArrayAttribute.inc +++ b/include/simpleplugin/attributes/dialog/class_DialogOrderedArrayAttribute.inc @@ -27,7 +27,7 @@ abstract class DialogOrderedArrayAttribute extends OrderedArrayAttribute function __construct ($label, $description, $ldapName, $required = FALSE, $defaultValue = [], $acl = "") { - Attribute::__construct($label, $description, $ldapName, $required, $defaultValue, $acl); + \FusionDirectory\Core\SimplePlugin\Attribute::__construct($label, $description, $ldapName, $required, $defaultValue, $acl); $this->edit_enabled = TRUE; $this->attribute = FALSE; } diff --git a/include/simpleplugin/class_Attribute.inc b/include/simpleplugin/class_Attribute.inc index 2d298f490387ff4515492d436b63fbb99c0bd50e..0bf4242a9697b64905ab15f9ef303176b75a313e 100644 --- a/include/simpleplugin/class_Attribute.inc +++ b/include/simpleplugin/class_Attribute.inc @@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +namespace FusionDirectory\Core\SimplePlugin; + /*! * \file class_Attribute.inc * Source code for the main Attribute class @@ -819,7 +821,7 @@ class Attribute /*! * \brief Attribute hidden from the user */ -class HiddenAttribute extends Attribute +class HiddenAttribute extends \FusionDirectory\Core\SimplePlugin\Attribute { /*! \brief The constructor of HiddenAttribute * @@ -868,7 +870,7 @@ class HiddenArrayAttribute extends HiddenAttribute /*! * \brief Dummy attribute class in order to give stats information to the template */ -class FakeAttribute extends Attribute +class FakeAttribute extends \FusionDirectory\Core\SimplePlugin\Attribute { function __construct (string $ldapName) { @@ -887,7 +889,7 @@ class FakeAttribute extends Attribute * It can be used to display an attribute value the user is never allowed to modify. * (But FD might edit it) */ -class DisplayLDAPAttribute extends Attribute +class DisplayLDAPAttribute extends \FusionDirectory\Core\SimplePlugin\Attribute { protected $allowHTML = FALSE; protected $allowSmarty = FALSE; @@ -932,7 +934,7 @@ class ReadOnlyLDAPAttribute extends DisplayLDAPAttribute * * It can be used to display an attribute value the user is never allowed to modify. */ -class DisplayLDAPArrayAttribute extends Attribute +class DisplayLDAPArrayAttribute extends \FusionDirectory\Core\SimplePlugin\Attribute { protected function loadAttrValue (array $attrs) { diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc index 3efe722f6d9d8a2a68c4d75f444a7a27009cad42..00dcaa3d0fa0739db79ea7a4bd60dd0bffb06d37 100644 --- a/include/simpleplugin/class_simplePlugin.inc +++ b/include/simpleplugin/class_simplePlugin.inc @@ -502,7 +502,7 @@ class simplePlugin implements SimpleTab return $attr.'='.ldap_escape_dn($this->attributesAccess[$attr]->computeLdapValue()).','.$ou.$base; } - protected function addAttribute (string $section, Attribute $attr) + protected function addAttribute (string $section, \FusionDirectory\Core\SimplePlugin\Attribute $attr) { $name = $attr->getLdapName(); $this->attributesInfo[$section]['attrs'][$name] = $attr;