diff --git a/README.md b/README.md
index 6b3da59..598953d 100644
--- a/README.md
+++ b/README.md
@@ -29,6 +29,7 @@ Take a look at the [Docker Container](https://github.com/leenooks/phpLDAPadmin/w
The update to v2 is progressing well - here is a list of work to do and done:
- [ ] Creating new LDAP entries
+- [ ] Delete existing LDAP entries
- [X] Updating existing LDAP Entries
- [X] Password attributes
- [X] Support different password hash options
diff --git a/hooks/functions/README b/hooks/functions/README
deleted file mode 100644
index e5b29d7..0000000
--- a/hooks/functions/README
+++ /dev/null
@@ -1 +0,0 @@
-Put your hook function files here.
\ No newline at end of file
diff --git a/hooks/functions/example.php b/hooks/functions/example.php
deleted file mode 100644
index 1ba34da..0000000
--- a/hooks/functions/example.php
+++ /dev/null
@@ -1,402 +0,0 @@
-sprintf('Hook called [%s]',__METHOD__),
- 'body'=>sprintf('Global Vars: %s',join('| ',array_keys($GLOBALS))),
- 'type'=>'info','special'=>true));
-
- return true;
-}
-add_hook('post_session_init','example_post_session_init');
-
-/**
- * This pre_connect function is called before making a connection to the LDAP server.
- * While PLA makes many calls to connect to the LDAP server, this is called only once
- * when caching is turned on.
- *
- * Arguments available are:
- * @param int Server ID of the server to be connected to
- * @param string Method. The user connection method, normally 'user'.
- * @see post_connect
- */
-function example_pre_connect() {
- $args = func_get_args();
-
- system_message(array(
- 'title'=>sprintf('Hook called [%s]',__METHOD__),
- 'body'=>sprintf('Arguments:
Server ID: %s
Method: %s
',$args[0],$args[1]),
- 'type'=>'info','special'=>true));
-
- return true;
-}
-add_hook('pre_connect','example_pre_connect');
-
-/**
- * This post_connect function is called after making a connection to the LDAP server.
- * While PLA makes many calls to connect to the LDAP server, this is called only once
- * when caching is turned on.
- *
- * Arguments available are:
- * @param int Server ID of the server to be connected to
- * @param string Method. The user connection method, normally 'user'.
- * @param string User ID of the user who successfully made the connection.
- * @see pre_connect
- */
-function example_post_connect() {
- $args = func_get_args();
-
- system_message(array(
- 'title'=>sprintf('Hook called [%s]',__METHOD__),
- 'body'=>sprintf('Arguments:
Server ID: %s
Method: %s
User DN: %s
',$args[0],$args[1],$args[2]),
- 'type'=>'info','special'=>true));
-
- return true;
-}
-add_hook('post_connect','example_post_connect');
-
-/**
- * This pre_entry_create function is called before an entry is created in ds_ldap_pla::add().
- *
- * Arguments available are:
- * @param int Server ID of the server to be connected to
- * @param string Method. The user connection method, normally 'user'.
- * @param string DN of the entry created
- * @param array Attributes for the new DN
- * @see post_entry_create
- */
-function example_pre_entry_create() {
- $args = func_get_args();
-
- system_message(array(
- 'title'=>sprintf('Hook called [%s]',__METHOD__),
- 'body'=>sprintf('Arguments:
Server ID: %s
Method: %s
DN: %s
Attributes: %s
',$args[0],$args[1],$args[2],join(',',(array_keys($args[3])))),
- 'type'=>'info','special'=>true));
-
- return true;
-}
-add_hook('pre_entry_create','example_pre_entry_create');
-
-/**
- * This post_entry_create function is called after an entry is created in ds_ldap_pla::add().
- *
- * Arguments available are:
- * @param int Server ID of the server to be connected to
- * @param string Method. The user connection method, normally 'user'.
- * @param string DN of the entry created
- * @param array Attributes for the new DN
- * @see pre_entry_create
- */
-function example_post_entry_create() {
- $args = func_get_args();
-
- system_message(array(
- 'title'=>sprintf('Hook called [%s]',__METHOD__),
- 'body'=>sprintf('Arguments:
Server ID: %s
Method: %s
DN: %s
Attributes: %s
',$args[0],$args[1],$args[2],join(',',(array_keys($args[3])))),
- 'type'=>'info','special'=>true));
-
- return true;
-}
-add_hook('post_entry_create','example_post_entry_create');
-
-/**
- * This pre_entry_delete function is called before an entry is deleted in ds_ldap_pla::delete().
- *
- * Arguments available are:
- * @param int Server ID of the server to be connected to
- * @param string Method. The user connection method, normally 'user'.
- * @param string DN of the entry deleted
- * @see post_entry_delete
- */
-function example_pre_entry_delete() {
- $args = func_get_args();
-
- system_message(array(
- 'title'=>sprintf('Hook called [%s]',__METHOD__),
- 'body'=>sprintf('Arguments:
Server ID: %s
Method: %s
DN: %s
',$args[0],$args[1],$args[2]),
- 'type'=>'info','special'=>true));
-
- return true;
-}
-add_hook('pre_entry_delete','example_pre_entry_delete');
-
-/**
- * This post_entry_delete function is called after an entry is deleted in ds_ldap_pla::delete().
- *
- * Arguments available are:
- * @param int Server ID of the server to be connected to
- * @param string Method. The user connection method, normally 'user'.
- * @param string DN of the entry deleted
- * @see pre_entry_delete
- */
-function example_post_entry_delete() {
- $args = func_get_args();
-
- system_message(array(
- 'title'=>sprintf('Hook called [%s]',__METHOD__),
- 'body'=>sprintf('Arguments:
Server ID: %s
Method: %s
DN: %s
',$args[0],$args[1],$args[2]),
- 'type'=>'info','special'=>true));
-
- return true;
-}
-add_hook('post_entry_delete','example_post_entry_delete');
-
-/**
- * This pre_entry_rename function is called before an entry is renamed in ds_ldap_pla::rename().
- *
- * Arguments available are:
- * @param int Server ID of the server to be connected to
- * @param string Method. The user connection method, normally 'user'.
- * @param string Old DN of the entry to be renamed
- * @param string New RDN for the new entry
- * @param string Container for the new entry
- * @see post_entry_rename
- */
-function example_pre_entry_rename() {
- $args = func_get_args();
-
- system_message(array(
- 'title'=>sprintf('Hook called [%s]',__METHOD__),
- 'body'=>sprintf('Arguments:
Server ID: %s
Method: %s
DN: %s
New RDN: %s
New Container: %s
',$args[0],$args[1],$args[2],$args[3],$args[4]),
- 'type'=>'info','special'=>true));
-
- return true;
-}
-add_hook('pre_entry_rename','example_pre_entry_rename');
-
-/**
- * This post_entry_rename function is called after an entry is renamed in ds_ldap_pla::rename().
- *
- * Arguments available are:
- * @param int Server ID of the server to be connected to
- * @param string Method. The user connection method, normally 'user'.
- * @param string Old DN of the entry to be renamed
- * @param string New RDN for the new entry
- * @param string Container for the new entry
- * @see pre_entry_rename
- */
-function example_post_entry_rename() {
- $args = func_get_args();
-
- system_message(array(
- 'title'=>sprintf('Hook called [%s]',__METHOD__),
- 'body'=>sprintf('Arguments:
Server ID: %s
Method: %s
DN: %s
New RDN: %s
New Container: %s
',$args[0],$args[1],$args[2],$args[3],$args[4]),
- 'type'=>'info','special'=>true));
-
- return true;
-}
-add_hook('post_entry_rename','example_post_entry_rename');
-
-/**
- * This pre_entry_modify function is called before an entry is modified in ds_ldap_pla::modify().
- *
- * Arguments available are:
- * @param int Server ID of the server to be connected to
- * @param string Method. The user connection method, normally 'user'.
- * @param string DN of the entry to be modified
- * @param array Attributes to be modified
- * @see post_entry_modify
- */
-function example_pre_entry_modify() {
- $args = func_get_args();
-
- system_message(array(
- 'title'=>sprintf('Hook called [%s]',__METHOD__),
- 'body'=>sprintf('Arguments:
Server ID: %s
Method: %s
DN: %s
Attributes: %s
',$args[0],$args[1],$args[2],join('|',array_keys($args[3]))),
- 'type'=>'info','special'=>true));
-
- return true;
-}
-add_hook('pre_entry_modify','example_pre_entry_modify');
-
-/**
- * This post_entry_modify function is called after an entry is modified in ds_ldap_pla::modify().
- *
- * Arguments available are:
- * @param int Server ID of the server to be connected to
- * @param string Method. The user connection method, normally 'user'.
- * @param string DN of the entry to be modified
- * @param array Attributes to be modified
- * @see pre_entry_modify
- */
-function example_post_entry_modify() {
- $args = func_get_args();
-
- system_message(array(
- 'title'=>sprintf('Hook called [%s]',__METHOD__),
- 'body'=>sprintf('Arguments:
Server ID: %s
Method: %s
DN: %s
Attributes: %s
',$args[0],$args[1],$args[2],join('|',array_keys($args[3]))),
- 'type'=>'info','special'=>true));
-
- return true;
-}
-add_hook('post_entry_modify','example_post_entry_modify');
-
-// pre_attr_add
-// post_attr_add
-/**
- * This pre_attr_add function is called before an attribute is deleted in ds_ldap_pla::modify().
- *
- * Arguments available are:
- * @param int Server ID of the server to be connected to
- * @param string Method. The user connection method, normally 'user'.
- * @param string DN of the attribute to be deleted
- * @param string Attribute to be deleted
- * @param array Old values
- * @see post_attr_add
- */
-function example_pre_attr_add() {
- $args = func_get_args();
-
- system_message(array(
- 'title'=>sprintf('Hook called [%s]',__METHOD__),
- 'body'=>sprintf('Arguments:
Server ID: %s
Method: %s
DN: %s
Attribute: %s
New Values: %s
',$args[0],$args[1],$args[2],$args[3],join('|',$args[4])),
- 'type'=>'info','special'=>true));
-
- return true;
-}
-add_hook('pre_attr_add','example_pre_attr_add');
-
-/**
- * This post_attr_add function is called after an attribute is added in ds_ldap_pla::modify().
- *
- * Arguments available are:
- * @param int Server ID of the server to be connected to
- * @param string Method. The user connection method, normally 'user'.
- * @param string DN of the attribute to be added
- * @param string Attribute to be added
- * @param array New values
- * @see pre_attr_add
- */
-function example_post_attr_add() {
- $args = func_get_args();
-
- system_message(array(
- 'title'=>sprintf('Hook called [%s]',__METHOD__),
- 'body'=>sprintf('Arguments:
Server ID: %s
Method: %s
DN: %s
Attribute: %s
New Values: %s
',$args[0],$args[1],$args[2],$args[3],join('|',$args[4])),
- 'type'=>'info','special'=>true));
-
- return true;
-}
-add_hook('post_attr_add','example_post_attr_add');
-
-// pre_attr_modify
-// post_attr_modify
-/**
- * This pre_attr_modify function is called before an attribute is modified in ds_ldap_pla::modify().
- *
- * Arguments available are:
- * @param int Server ID of the server to be connected to
- * @param string Method. The user connection method, normally 'user'.
- * @param string DN of the attribute to be modified
- * @param string Attribute to be modified
- * @param array New values
- * @see post_attr_modify
- */
-function example_pre_attr_modify() {
- $args = func_get_args();
-
- system_message(array(
- 'title'=>sprintf('Hook called [%s]',__METHOD__),
- 'body'=>sprintf('Arguments:
Server ID: %s
Method: %s
DN: %s
Attribute: %s
Old Values: %s
New Values: %s
',$args[0],$args[1],$args[2],$args[3],join('|',$args[4]),join('|',$args[5])),
- 'type'=>'info','special'=>true));
-
- return true;
-}
-add_hook('pre_attr_modify','example_pre_attr_modify');
-
-/**
- * This post_attr_modify function is called after an attribute is deleted in ds_ldap_pla::modify().
- *
- * Arguments available are:
- * @param int Server ID of the server to be connected to
- * @param string Method. The user connection method, normally 'user'.
- * @param string DN of the attribute to be deleted
- * @param string Attribute to be deleted
- * @param array Old values
- * @see pre_attr_modify
- */
-function example_post_attr_modify() {
- $args = func_get_args();
-
- system_message(array(
- 'title'=>sprintf('Hook called [%s]',__METHOD__),
- 'body'=>sprintf('Arguments:
Server ID: %s
Method: %s
DN: %s
Attribute: %s
Old Values: %s
New Values: %s
',$args[0],$args[1],$args[2],$args[3],join('|',$args[4]),join('|',$args[5])),
- 'type'=>'info','special'=>true));
-
- return true;
-}
-add_hook('post_attr_modify','example_post_attr_modify');
-
-/**
- * This pre_attr_delete function is called before an attribute is deleted in ds_ldap_pla::modify().
- *
- * Arguments available are:
- * @param int Server ID of the server to be connected to
- * @param string Method. The user connection method, normally 'user'.
- * @param string DN of the attribute to be deleted
- * @param string Attribute to be deleted
- * @param array Old values
- * @see post_attr_delete
- */
-function example_pre_attr_delete() {
- $args = func_get_args();
-
- system_message(array(
- 'title'=>sprintf('Hook called [%s]',__METHOD__),
- 'body'=>sprintf('Arguments:
Server ID: %s
Method: %s
DN: %s
Attribute: %s
Old Values: %s
',$args[0],$args[1],$args[2],$args[3],join('|',$args[4])),
- 'type'=>'info','special'=>true));
-
- return true;
-}
-add_hook('pre_attr_delete','example_pre_attr_delete');
-
-/**
- * This post_attr_delete function is called after an attribute is deleted in ds_ldap_pla::modify().
- *
- * Arguments available are:
- * @param int Server ID of the server to be connected to
- * @param string Method. The user connection method, normally 'user'.
- * @param string DN of the attribute to be deleted
- * @param string Attribute to be deleted
- * @param array Old values
- * @see pre_attr_delete
- */
-function example_post_attr_delete() {
- $args = func_get_args();
-
- system_message(array(
- 'title'=>sprintf('Hook called [%s]',__METHOD__),
- 'body'=>sprintf('Arguments:
Server ID: %s
Method: %s
DN: %s
Attribute: %s
Old Values: %s
',$args[0],$args[1],$args[2],$args[3],join('|',$args[4])),
- 'type'=>'info','special'=>true));
-
- return true;
-}
-add_hook('post_attr_delete','example_post_attr_delete');
-?>
diff --git a/htdocs/add_oclass_form.php b/htdocs/add_oclass_form.php
deleted file mode 100644
index d2353c9..0000000
--- a/htdocs/add_oclass_form.php
+++ /dev/null
@@ -1,117 +0,0 @@
-dnExists($request['dn']))
- error(sprintf(_('The entry (%s) does not exist.'),$request['dn']),'error','index.php');
-
-$request['page'] = new TemplateRender($app['server']->getIndex(),get_request('template','REQUEST',false,null));
-$request['page']->setDN($request['dn']);
-$request['page']->accept(true);
-$request['template'] = $request['page']->getTemplate();
-
-$attribute_factory = new AttributeFactory();
-
-# Grab the required attributes for the new objectClass
-$ldap = array();
-$ldap['attrs']['must'] = array();
-
-foreach ($request['template']->getAttribute('objectclass')->getValues() as $oclass_name) {
- # Exclude "top" if its there.
- if (! strcasecmp('top',$oclass_name))
- continue;
-
- if ($soc = $app['server']->getSchemaObjectClass($oclass_name))
- $ldap['attrs']['must'] = array_merge($ldap['attrs']['must'],$soc->getMustAttrNames(true));
-}
-
-$ldap['attrs']['must'] = array_unique($ldap['attrs']['must']);
-
-/* Build a list of the attributes that this new objectClass requires,
- * but that the object does not currently contain */
-$ldap['attrs']['need'] = array();
-foreach ($ldap['attrs']['must'] as $attr)
- if (is_null($request['template']->getAttribute($attr)))
- array_push($ldap['attrs']['need'],$attribute_factory->newAttribute($attr,array('values'=>array()),$app['server']->getIndex()));
-
-# Mark all the need attributes as shown
-foreach ($ldap['attrs']['need'] as $index => $values)
- $ldap['attrs']['need'][$index]->show();
-
-if (count($ldap['attrs']['need']) > 0) {
- $request['page']->drawTitle(sprintf('%s %s',_('Add new objectClass to'),get_rdn($request['dn'])));
- $request['page']->drawSubTitle();
-
- echo '
';
- printf('%s: %s %s %s %s',
- _('Instructions'),
- _('In order to add these objectClass(es) to this entry, you must specify'),
- count($ldap['attrs']['need']),_('new attributes'),
- _('that this objectClass requires.'));
-
- echo '
';
-
- echo '';
- echo '
';
-
-# There are no other required attributes, so we just need to add the objectclass to the DN.
-} else {
- $result = $app['server']->modify($request['dn'],$request['template']->getLDAPmodify());
-
- if ($result) {
- $href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s&modified_attrs[]=objectclass',
- $app['server']->getIndex(),rawurlencode($request['dn']));
-
- if (get_request('meth','REQUEST') == 'ajax')
- $href .= '&meth=ajax';
-
- header(sprintf('Location: %s',$href));
- die();
- }
-}
-?>
diff --git a/htdocs/add_value_form.php b/htdocs/add_value_form.php
deleted file mode 100644
index c30f348..0000000
--- a/htdocs/add_value_form.php
+++ /dev/null
@@ -1,173 +0,0 @@
-dnExists($request['dn']))
- error(sprintf(_('The entry (%s) does not exist.'),$request['dn']),'error','index.php');
-
-$request['page'] = new TemplateRender($app['server']->getIndex(),get_request('template','REQUEST',false,null));
-$request['page']->setDN($request['dn']);
-$request['page']->accept(true);
-$request['template'] = $request['page']->getTemplate();
-
-/*
-if ($request['attribute']->isReadOnly())
- error(sprintf(_('The attribute (%s) is in readonly mode.'),$request['attr']),'error','index.php');
-*/
-
-# Render the form
-if (! strcasecmp($request['attr'],'objectclass') || get_request('meth','REQUEST') != 'ajax') {
- # Render the form.
- $request['page']->drawTitle(sprintf('%s %s %s %s',_('Add new'),htmlspecialchars($request['attr']),_('value to'),htmlspecialchars(get_rdn($request['dn']))));
- $request['page']->drawSubTitle();
-
- if (! strcasecmp($request['attr'],'objectclass')) {
- echo '