Compare commits
125 Commits
RELEASE-1.
...
RELEASE-1.
Author | SHA1 | Date | |
---|---|---|---|
|
5080e204cf | ||
|
b46941f7fd | ||
|
03d1166103 | ||
|
676a675c7c | ||
|
4598d3ae39 | ||
|
2416230c61 | ||
|
d90fe5a6fa | ||
|
ec8902a223 | ||
|
2090e7c34a | ||
|
2393c5d5e3 | ||
|
efd1860a91 | ||
|
23a2da1f26 | ||
|
d4483f961f | ||
|
b1139658bf | ||
|
f8cacb7dd0 | ||
|
ee35f81ce5 | ||
|
088ebf4a2b | ||
|
a6dc80616b | ||
|
9196bb9e41 | ||
|
7121f560e9 | ||
|
e7466c948b | ||
|
f0a6d312ab | ||
|
d062308f32 | ||
|
352a87fee8 | ||
|
242d06673a | ||
|
a3ac658756 | ||
|
e83aba595c | ||
|
3ffe6878f3 | ||
|
02e9f8477a | ||
|
259179a1b3 | ||
|
96bad27d64 | ||
|
c69cd68fcb | ||
|
9cb27e3a70 | ||
|
52fbd24b2c | ||
|
f83a922589 | ||
|
3e446fddf4 | ||
|
bdb423d0d3 | ||
|
2c99cc9016 | ||
|
b93b92f430 | ||
|
26fa2ba2c5 | ||
|
76ddeccf8c | ||
|
1336fc21b6 | ||
|
356f319291 | ||
|
6e6a7a6e4e | ||
|
95aedef718 | ||
|
b0f9fa8806 | ||
|
ec482c70fe | ||
|
9fda881a8e | ||
|
46c100660b | ||
|
4c56f3e678 | ||
|
ebe2cb6eda | ||
|
5669c92371 | ||
|
0eaf3bb67b | ||
|
9f1a207eba | ||
|
5706ad1b4a | ||
|
ba553353b0 | ||
|
803a4c821a | ||
|
a5b9e43a57 | ||
|
df404d435a | ||
|
cf4f339b5c | ||
|
48faaba955 | ||
|
898eabaa11 | ||
|
9eca46d0cc | ||
|
8a21bbee12 | ||
|
59c4e7896f | ||
|
cc3b67b71a | ||
|
a0816d068c | ||
|
fb48055d2d | ||
|
86c8f13065 | ||
|
7dd52f8219 | ||
|
29cb490571 | ||
|
5938302012 | ||
|
196aa00218 | ||
|
dc3e477778 | ||
|
869b9be7e9 | ||
|
a1cfa2f60c | ||
|
3ada58fb7d | ||
|
22bcaf0136 | ||
|
008b463e8e | ||
|
0de55e552b | ||
|
2725bb16da | ||
|
bbe87c6e2f | ||
|
45ca83411f | ||
|
3c9f63ae6b | ||
|
0171853f1d | ||
|
6627c7bea4 | ||
|
223086b58e | ||
|
5481f61ce3 | ||
|
57d405fe3b | ||
|
ed4784b1b6 | ||
|
d364af141f | ||
|
e2c74f9467 | ||
|
0d71a96e34 | ||
|
4eed1d8982 | ||
|
899f83aa17 | ||
|
775c7751ae | ||
|
664c05decd | ||
|
ea0fdab6ba | ||
|
1aa88e4dc3 | ||
|
7273ad292b | ||
|
b4653e84a2 | ||
|
4cab46a55e | ||
|
e7ce1030c0 | ||
|
6270967ec0 | ||
|
d501393d49 | ||
|
08199e67e0 | ||
|
03bc1ce70e | ||
|
fcaa4d8db6 | ||
|
ee9533c770 | ||
|
07b40c1c34 | ||
|
84bf604cba | ||
|
4f6d661c12 | ||
|
97fcaed8f7 | ||
|
d601121dba | ||
|
aa2719f8fe | ||
|
54df56bb1a | ||
|
db2e8861fa | ||
|
c230058d3f | ||
|
a0ae7bf111 | ||
|
7591eefb70 | ||
|
20bdaa4663 | ||
|
640abcbf3b | ||
|
8e8db2e4ed | ||
|
ea17aadef4 | ||
|
388783fc84 |
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
config/config.php
|
||||
queries/custom_*
|
||||
templates/*/custom_*
|
@@ -6,6 +6,7 @@
|
||||
|
||||
/**
|
||||
* The phpLDAPadmin config file
|
||||
* See: http://phpldapadmin.sourceforge.net/wiki/index.php/Config.php
|
||||
*
|
||||
* This is where you can customise some of the phpLDAPadmin defaults
|
||||
* that are defined in config_default.php.
|
||||
@@ -13,11 +14,11 @@
|
||||
* To override a default, use the $config->custom variable to do so.
|
||||
* For example, the default for defining the language in config_default.php
|
||||
*
|
||||
* $this->default->appearance['lang'] = array(
|
||||
* $this->default->appearance['language'] = array(
|
||||
* 'desc'=>'Language',
|
||||
* 'default'=>'auto');
|
||||
*
|
||||
* to override this, use $config->custom->appearance['lang'] = 'en';
|
||||
* to override this, use $config->custom->appearance['language'] = 'en_EN';
|
||||
*
|
||||
* This file is also used to configure your LDAP server connections.
|
||||
*
|
||||
@@ -39,7 +40,7 @@
|
||||
/* Useful important configuration overrides */
|
||||
/*********************************************/
|
||||
|
||||
/* If you are asked to put pla in debug mode, this is how you do it: */
|
||||
/* If you are asked to put PLA in debug mode, this is how you do it: */
|
||||
# $config->custom->debug['level'] = 255;
|
||||
# $config->custom->debug['syslog'] = true;
|
||||
# $config->custom->debug['file'] = '/tmp/pla_debug.log';
|
||||
@@ -57,8 +58,8 @@
|
||||
|
||||
/* The temporary storage directory where we will put jpegPhoto data
|
||||
This directory must be readable and writable by your web server. */
|
||||
// $config->custom->jpeg['tmpdir'] = "/tmp"; // Example for Unix systems
|
||||
# $config->custom->jpeg['tmpdir'] = "c:\\temp"; // Example for Windows systems
|
||||
// $config->custom->jpeg['tmpdir'] = '/tmp'; // Example for Unix systems
|
||||
# $config->custom->jpeg['tmpdir'] = 'c:\\temp'; // Example for Windows systems
|
||||
|
||||
/* Set this to (bool)true if you do NOT want a random salt used when
|
||||
calling crypt(). Instead, use the first two letters of the user's
|
||||
@@ -72,6 +73,13 @@
|
||||
30 seconds or the setting of max_exection_time if this is null. */
|
||||
// $config->custom->session['timelimit'] = 30;
|
||||
|
||||
/* Our local timezone
|
||||
This is to make sure that when we ask the system for the current time, we
|
||||
get the right local time. If this is not set, all time() calculations will
|
||||
assume UTC if you have not set PHP date.timezone. */
|
||||
// $config->custom->appearance['timezone'] = null;
|
||||
# $config->custom->appearance['timezone'] = 'Australia/Melbourne';
|
||||
|
||||
/*********************************************/
|
||||
/* Commands */
|
||||
/*********************************************/
|
||||
@@ -79,37 +87,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,
|
||||
'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
|
||||
);
|
||||
*/
|
||||
|
||||
/*********************************************/
|
||||
@@ -118,21 +144,8 @@ $config->custom->commands['all'] = array(
|
||||
|
||||
/* If you want to choose the appearance of the tree, specify a class name which
|
||||
inherits from the Tree class. */
|
||||
// $config->custom->appearance['tree'] = "AJAXTree";
|
||||
# $config->custom->appearance['tree'] = "HTMLTree";
|
||||
|
||||
/* If you want to customise the entry view/edition, specify your factory name which
|
||||
inherits from the EntryFactory class.
|
||||
The 'DefaultEntryFactory' draws all the attributes of an entry according this
|
||||
config file and the ldap schema definition ; the 'TemplateEntryFactory' draws
|
||||
an entry according to the template whose regexp matches with the dn. */
|
||||
# $config->custom->appearance['entry_factory'] = "DefaultEntryFactory";
|
||||
// $config->custom->appearance['entry_factory'] = "TemplateEntryFactory";
|
||||
|
||||
/* If you want to customise an attribute view/edition, specify your factory name which
|
||||
inherits from the AttributeFactory class.
|
||||
An AttributeFactory defines which class to use to represent a given attribute */
|
||||
// $config->custom->appearance['attribute_factory'] = "AttributeFactory";
|
||||
// $config->custom->appearance['tree'] = 'AJAXTree';
|
||||
# $config->custom->appearance['tree'] = 'HTMLTree';
|
||||
|
||||
/* Just show your custom templates. */
|
||||
// $config->custom->appearance['custom_templates_only'] = false;
|
||||
@@ -140,6 +153,9 @@ $config->custom->commands['all'] = array(
|
||||
/* Disable the default template. */
|
||||
// $config->custom->appearance['disable_default_template'] = false;
|
||||
|
||||
/* Hide the warnings for invalid objectClasses/attributes in templates. */
|
||||
// $config->custom->appearance['hide_template_warning'] = false;
|
||||
|
||||
/* Configure what objects are shown in left hand tree */
|
||||
// $config->custom->appearance['tree_filter'] = '(objectclass=*)';
|
||||
|
||||
@@ -150,30 +166,121 @@ $config->custom->commands['all'] = array(
|
||||
// $config->custom->appearance['tree_width'] = null;
|
||||
# $config->custom->appearance['tree_width'] = 250;
|
||||
|
||||
/*********************************************/
|
||||
/* User-friendly attribute translation */
|
||||
/*********************************************/
|
||||
|
||||
/* Use this array to map attribute names to user friendly names. For example, if
|
||||
you don't want to see "facsimileTelephoneNumber" but rather "Fax". */
|
||||
// $config->custom->appearance['friendly_attrs'] = array();
|
||||
$config->custom->appearance['friendly_attrs'] = array(
|
||||
'facsimileTelephoneNumber' => 'Fax',
|
||||
'gid' => 'Group',
|
||||
'mail' => 'Email',
|
||||
'telephoneNumber' => 'Telephone',
|
||||
'uid' => 'User Name',
|
||||
'userPassword' => 'Password'
|
||||
);
|
||||
|
||||
/*********************************************/
|
||||
/* Hidden attributes */
|
||||
/*********************************************/
|
||||
|
||||
/* You may want to hide certain attributes from being edited. If you want to
|
||||
hide attributes from the user, you should use your LDAP servers ACLs.
|
||||
NOTE: The user must be able to read the hide_attrs_exempt entry to be
|
||||
excluded. */
|
||||
// $config->custom->appearance['hide_attrs'] = array();
|
||||
# $config->custom->appearance['hide_attrs'] = array('objectClass');
|
||||
|
||||
/* Members of this list will be exempt from the hidden attributes.*/
|
||||
// $config->custom->appearance['hide_attrs_exempt'] = null;
|
||||
# $config->custom->appearance['hide_attrs_exempt'] = 'cn=PLA UnHide,ou=Groups,c=AU';
|
||||
|
||||
/*********************************************/
|
||||
/* Read-only attributes */
|
||||
/*********************************************/
|
||||
|
||||
/* You may want to phpLDAPadmin to display certain attributes as read only,
|
||||
meaning that users will not be presented a form for modifying those
|
||||
attributes, and they will not be allowed to be modified on the "back-end"
|
||||
either. You may configure this list here:
|
||||
NOTE: The user must be able to read the readonly_attrs_exempt entry to be
|
||||
excluded. */
|
||||
// $config->custom->appearance['readonly_attrs'] = array();
|
||||
|
||||
/* Members of this list will be exempt from the readonly attributes.*/
|
||||
// $config->custom->appearance['readonly_attrs_exempt'] = null;
|
||||
# $config->custom->appearance['readonly_attrs_exempt'] = 'cn=PLA ReadWrite,ou=Groups,c=AU';
|
||||
|
||||
/*********************************************/
|
||||
/* Group attributes */
|
||||
/*********************************************/
|
||||
|
||||
/* Add "modify group members" link to the attribute. */
|
||||
// $config->custom->modify_member['groupattr'] = array('member','uniqueMember','memberUid');
|
||||
|
||||
/* Configure filter for member search. This only applies to "modify group members" feature */
|
||||
// $config->custom->modify_member['filter'] = '(objectclass=Person)';
|
||||
|
||||
/* Attribute that is added to the group member attribute. */
|
||||
// $config->custom->modify_member['attr'] = 'dn';
|
||||
|
||||
/* For Posix attributes */
|
||||
// $config->custom->modify_member['posixattr'] = 'uid';
|
||||
// $config->custom->modify_member['posixfilter'] = '(uid=*)';
|
||||
// $config->custom->modify_member['posixgroupattr'] = 'memberUid';
|
||||
|
||||
/*********************************************/
|
||||
/* Support for attrs display order */
|
||||
/*********************************************/
|
||||
|
||||
/* Use this array if you want to have your attributes displayed in a specific
|
||||
order. You can use default attribute names or their fridenly names.
|
||||
For example, "sn" will be displayed right after "givenName". All the other
|
||||
attributes that are not specified in this array will be displayed after in
|
||||
alphabetical order. */
|
||||
// $config->custom->appearance['attr_display_order'] = array();
|
||||
# $config->custom->appearance['attr_display_order'] = array(
|
||||
# 'givenName',
|
||||
# 'sn',
|
||||
# 'cn',
|
||||
# 'displayName',
|
||||
# 'uid',
|
||||
# 'uidNumber',
|
||||
# 'gidNumber',
|
||||
# 'homeDirectory',
|
||||
# 'mail',
|
||||
# 'userPassword'
|
||||
# );
|
||||
|
||||
/*********************************************/
|
||||
/* Define your LDAP servers in this section */
|
||||
/*********************************************/
|
||||
|
||||
$i=0;
|
||||
$ldapservers = new LDAPServers;
|
||||
$servers = new Datastore();
|
||||
|
||||
/* $servers->NewServer('ldap_pla') must be called before each new LDAP server
|
||||
declaration. */
|
||||
$servers->newServer('ldap_pla');
|
||||
|
||||
/* A convenient name that will appear in the tree viewer and throughout
|
||||
phpLDAPadmin to identify this LDAP server to users. */
|
||||
$ldapservers->SetValue($i,'server','name','My LDAP Server');
|
||||
$servers->setValue('server','name','My LDAP Server');
|
||||
|
||||
/* Examples:
|
||||
'ldap.example.com',
|
||||
'ldaps://ldap.example.com/',
|
||||
'ldapi://%2fusr%local%2fvar%2frun%2fldapi'
|
||||
(Unix socket at /usr/local/var/run/ldap) */
|
||||
// $ldapservers->SetValue($i,'server','host','127.0.0.1');
|
||||
// $servers->setValue('server','host','127.0.0.1');
|
||||
|
||||
/* The port your LDAP server listens on (no quotes). 389 is standard. */
|
||||
// $ldapservers->SetValue($i,'server','port','389');
|
||||
// $servers->setValue('server','port',389);
|
||||
|
||||
/* Array of base DNs of your LDAP server. Leave this blank to have phpLDAPadmin
|
||||
auto-detect it for you. */
|
||||
// $ldapservers->SetValue($i,'server','base',array(''));
|
||||
// $servers->setValue('server','base',array(''));
|
||||
|
||||
/* Four options for auth_type:
|
||||
1. 'cookie': you will login via a web form, and a client-side cookie will
|
||||
@@ -189,23 +296,23 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
|
||||
your situation. If you choose 'cookie', your cookie contents will be
|
||||
encrypted using blowfish and the secret your specify above as
|
||||
session['blowfish']. */
|
||||
// $ldapservers->SetValue($i,'server','auth_type','cookie');
|
||||
// $servers->setValue('login','auth_type','session');
|
||||
|
||||
/* The DN of the user for phpLDAPadmin to bind with. For anonymous binds or
|
||||
'cookie' or 'session' auth_types, LEAVE THE LOGIN_DN AND LOGIN_PASS BLANK. If
|
||||
you specify a login_attr in conjunction with a cookie or session auth_type,
|
||||
then you can also specify the login_dn/login_pass here for searching the
|
||||
then you can also specify the bind_id/bind_pass here for searching the
|
||||
directory for users (ie, if your LDAP server does not allow anonymous binds. */
|
||||
// $ldapservers->SetValue($i,'login','dn','');
|
||||
# $ldapservers->SetValue($i,'login','dn','cn=Manager,dc=example,dc=com');
|
||||
// $servers->setValue('login','bind_id','');
|
||||
# $servers->setValue('login','bind_id','cn=Manager,dc=example,dc=com');
|
||||
|
||||
/* Your LDAP password. If you specified an empty login_dn above, this MUST also
|
||||
/* Your LDAP password. If you specified an empty bind_id above, this MUST also
|
||||
be blank. */
|
||||
// $ldapservers->SetValue($i,'login','pass','');
|
||||
# $ldapservers->SetValue($i,'login','pass','secret');
|
||||
// $servers->setValue('login','bind_pass','');
|
||||
# $servers->setValue('login','bind_pass','secret');
|
||||
|
||||
/* Use TLS (Transport Layer Security) to connect to the LDAP server. */
|
||||
// $ldapservers->SetValue($i,'server','tls',false);
|
||||
// $servers->setValue('server','tls',false);
|
||||
|
||||
/************************************
|
||||
* SASL Authentication *
|
||||
@@ -214,19 +321,19 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
|
||||
/* Enable SASL authentication LDAP SASL authentication requires PHP 5.x
|
||||
configured with --with-ldap-sasl=DIR. If this option is disabled (ie, set to
|
||||
false), then all other sasl options are ignored. */
|
||||
// $ldapservers->SetValue($i,'server','sasl_auth',false);
|
||||
// $servers->setValue('server','sasl_auth',false);
|
||||
|
||||
/* SASL auth mechanism */
|
||||
// $ldapservers->SetValue($i,'server','sasl_mech','PLAIN');
|
||||
// $servers->setValue('server','sasl_mech','PLAIN');
|
||||
|
||||
/* SASL authentication realm name */
|
||||
// $ldapservers->SetValue($i,'server','sasl_realm','');
|
||||
# $ldapservers->SetValue($i,'server','sasl_realm',"example.com");
|
||||
// $servers->setValue('server','sasl_realm','');
|
||||
# $servers->setValue('server','sasl_realm','example.com');
|
||||
|
||||
/* SASL authorization ID name
|
||||
If this option is undefined, authorization id will be computed from bind DN,
|
||||
using sasl_authz_id_regex and sasl_authz_id_replacement. */
|
||||
// $ldapservers->SetValue($i,'server','sasl_authz_id', null);
|
||||
// $servers->setValue('server','sasl_authz_id', null);
|
||||
|
||||
/* SASL authorization id regex and replacement
|
||||
When sasl_authz_id property is not set (default), phpLDAPAdmin will try to
|
||||
@@ -241,24 +348,18 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
|
||||
For info about pcre regexes, see:
|
||||
- pcre(3), perlre(3)
|
||||
- http://www.php.net/preg_replace */
|
||||
// $ldapservers->SetValue($i,'server','sasl_authz_id_regex',null);
|
||||
// $ldapservers->SetValue($i,'server','sasl_authz_id_replacement',null);
|
||||
# $ldapservers->SetValue($i,'server','sasl_authz_id_regex','/^uid=([^,]+)(.+)/i');
|
||||
# $ldapservers->SetValue($i,'server','sasl_authz_id_replacement','$1');
|
||||
// $servers->setValue('server','sasl_authz_id_regex',null);
|
||||
// $servers->setValue('server','sasl_authz_id_replacement',null);
|
||||
# $servers->setValue('server','sasl_authz_id_regex','/^uid=([^,]+)(.+)/i');
|
||||
# $servers->setValue('server','sasl_authz_id_replacement','$1');
|
||||
|
||||
/* SASL auth security props.
|
||||
See http://beepcore-tcl.sourceforge.net/tclsasl.html#anchor5 for explanation.
|
||||
*/
|
||||
// $ldapservers->SetValue($i,'server','sasl_props',null);
|
||||
|
||||
/* If the link between your web server and this LDAP server is slow, it is
|
||||
recommended that you set 'low_bandwidth' to true. This will enable
|
||||
phpLDAPadmin to forego some "fancy" features to conserve bandwidth. */
|
||||
// $ldapservers->SetValue($i,'server','low_bandwidth',false);
|
||||
See http://beepcore-tcl.sourceforge.net/tclsasl.html#anchor5 for explanation. */
|
||||
// $servers->setValue('server','sasl_props',null);
|
||||
|
||||
/* Default password hashing algorithm. One of md5, ssha, sha, md5crpyt, smd5,
|
||||
blowfish, crypt or leave blank for now default algorithm. */
|
||||
// $ldapservers->SetValue($i,'appearance','password_hash','md5');
|
||||
// $servers->setValue('appearance','password_hash','md5');
|
||||
|
||||
/* If you specified 'cookie' or 'session' as the auth_type above, you can
|
||||
optionally specify here an attribute to use when logging in. If you enter
|
||||
@@ -266,10 +367,18 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
|
||||
and log in as that user.
|
||||
Leave blank or specify 'dn' to use full DN for logging in. Note also that if
|
||||
your LDAP server requires you to login to perform searches, you can enter the
|
||||
DN to use when searching in 'login_dn' and 'login_pass' above. You may also
|
||||
specify 'string', in which case you can provide a string to use for logging
|
||||
users in. See 'login_string' directly below. */
|
||||
// $ldapservers->SetValue($i,'login','attr','dn');
|
||||
DN to use when searching in 'bind_id' and 'bind_pass' above.
|
||||
// $servers->setValue('login','attr','dn');
|
||||
|
||||
/* Base DNs to used for logins. If this value is not set, then the LDAP server
|
||||
Base DNs are used. */
|
||||
// $servers->setValue('login','base',array());
|
||||
|
||||
/* If 'login,attr' is used above such that phpLDAPadmin will search for your DN
|
||||
at login, you may restrict the search to a specific objectClasses. EG, set this
|
||||
to array('posixAccount') or array('inetOrgPerson',..), depending upon your
|
||||
setup. */
|
||||
// $servers->setValue('login','class',array());
|
||||
|
||||
/* If you specified something different from 'dn', for example 'uid', as the
|
||||
login_attr above, you can optionally specify here to fall back to
|
||||
@@ -278,32 +387,19 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
|
||||
the ldap administrator wants to log in with his root-dn, that does not
|
||||
necessarily have the uid attribute.
|
||||
When using this feature, login_class is ignored. */
|
||||
// $ldapservers->SetValue($i,'login','fallback_dn',false);
|
||||
|
||||
/* If you specified 'cookie' or 'session' as the auth_type above, and you
|
||||
specified 'string' for 'login_attr' above, you must provide a string here for
|
||||
logging users in. If, for example, I have a lot of user entries with DNs like
|
||||
"uid=dsmith,ou=People,dc=example,dc=com", then I can specify a string
|
||||
"uid=<username>,ou=People,dc=example,dc=com" and my users can login with
|
||||
their user names alone, ie: "dsmith" in this case. */
|
||||
# $ldapservers->SetValue($i,'login','string','uid=<username>,ou=People,dc=example,dc=com');
|
||||
|
||||
/* If 'login_attr' is used above such that phpLDAPadmin will search for your DN
|
||||
at login, you may restrict the search to a specific objectClass. EG, set this
|
||||
to 'posixAccount' or 'inetOrgPerson', depending upon your setup. */
|
||||
// $ldapservers->SetValue($i,'login','class',null);
|
||||
// $servers->setValue('login','fallback_dn',false);
|
||||
|
||||
/* Specify true If you want phpLDAPadmin to not display or permit any
|
||||
modification to the LDAP server. */
|
||||
// $ldapservers->SetValue($i,'server','read_only',false);
|
||||
// $servers->setValue('server','read_only',false);
|
||||
|
||||
/* Specify false if you do not want phpLDAPadmin to draw the 'Create new' links
|
||||
in the tree viewer. */
|
||||
// $ldapservers->SetValue($i,'appearance','show_create',true);
|
||||
// $servers->setValue('appearance','show_create',true);
|
||||
|
||||
/* This feature allows phpLDAPadmin to automatically determine the next
|
||||
available uidNumber for a new entry. */
|
||||
// $ldapservers->SetValue($i,'auto_number','enable',true);
|
||||
// $servers->setValue('auto_number','enable',true);
|
||||
|
||||
/* The mechanism to use when finding the next available uidNumber. Two possible
|
||||
values: 'uidpool' or 'search'.
|
||||
@@ -311,75 +407,62 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
|
||||
blindly lookup the next available uidNumber. The 'search' mechanism searches
|
||||
for entries with a uidNumber value and finds the first available uidNumber
|
||||
(slower). */
|
||||
// $ldapservers->SetValue($i,'auto_number','mechanism','search');
|
||||
// $servers->setValue('auto_number','mechanism','search');
|
||||
|
||||
/* The DN of the search base when the 'search' mechanism is used above. */
|
||||
# $ldapservers->SetValue($i,'auto_number','search_base','ou=People,dc=example,dc=com');
|
||||
# $servers->setValue('auto_number','search_base','ou=People,dc=example,dc=com');
|
||||
|
||||
/* The minimum number to use when searching for the next available UID number
|
||||
(only when 'search' is used for auto_uid_number_mechanism' */
|
||||
// $ldapservers->SetValue($i,'auto_number','min','1000');
|
||||
|
||||
/* The DN of the uidPool entry when 'uidpool' mechanism is used above. */
|
||||
// $ldapservers->SetValue($i,'auto_number','uidpool_dn','cn=uidPool,dc=example,dc=com');
|
||||
/* The minimum number to use when searching for the next available number
|
||||
(only when 'search' is used for auto_number */
|
||||
// $servers->setValue('auto_number','min',array('uidNumber'=>1000,'gidNumber'=>500));
|
||||
|
||||
/* If you set this, then phpldapadmin will bind to LDAP with this user ID when
|
||||
searching for the uidnumber. The idea is, this user id would have full
|
||||
(readonly) access to uidnumber in your ldap directory (the logged in user
|
||||
may not), so that you can be guaranteed to get a unique uidnumber for your
|
||||
directory. */
|
||||
// $ldapservers->SetValue($i,'auto_number','dn',null);
|
||||
// $servers->setValue('auto_number','dn',null);
|
||||
|
||||
/* The password for the dn above. */
|
||||
// $ldapservers->SetValue($i,'auto_number','pass',null);
|
||||
// $servers->setValue('auto_number','pass',null);
|
||||
|
||||
/* Enable anonymous bind login. */
|
||||
// $ldapservers->SetValue($i,'login','anon_bind',true);
|
||||
// $servers->setValue('login','anon_bind',true);
|
||||
|
||||
/* Use customized page with prefix when available. */
|
||||
# $ldapservers->SetValue($i,'custom','pages_prefix','custom_');
|
||||
|
||||
/* If you set this, then phpldapadmin will bind to LDAP with this user when
|
||||
testing for unique attributes (as set in unique_attrs array). If you want to
|
||||
enforce unique attributes, than this id should have full (readonly) access
|
||||
to the attributes in question (the logged in user may not have enough access)
|
||||
*/
|
||||
// $ldapservers->SetValue($i,'unique_attrs','dn',null);
|
||||
|
||||
/* The password for the dn above */
|
||||
// $ldapservers->SetValue($i,'unique_attrs','pass',null);
|
||||
# $servers->setValue('custom','pages_prefix','custom_');
|
||||
|
||||
/* If you set this, then only these DNs are allowed to log in. This array can
|
||||
contain individual users, groups or ldap search filter(s). Keep in mind that
|
||||
the user has not authenticated yet, so this will be an anonymous search to
|
||||
the LDAP server, so make your ACLs allow these searches to return results! */
|
||||
# $ldapservers->SetValue($i,'login','allowed_dns',array(
|
||||
# $servers->setValue('login','allowed_dns',array(
|
||||
# 'uid=stran,ou=People,dc=example,dc=com',
|
||||
# '(&(gidNumber=811)(objectClass=groupOfNames))',
|
||||
# '(|(uidNumber=200)(uidNumber=201))',
|
||||
# 'cn=callcenter,ou=Group,dc=example,dc=com'));
|
||||
|
||||
/* Set this if you dont want this LDAP server to show in the tree */
|
||||
// $ldapservers->SetValue($i,'appearance','visible',true);
|
||||
// $servers->setValue('server','visible',true);
|
||||
|
||||
/* This is the time out value in minutes for the server. After as many minutes
|
||||
of inactivity you will be automatically logged out. If not set, the default
|
||||
value will be ( session_cache_expire()-1 ) */
|
||||
# $ldapservers->SetValue($i,'login','timeout',30);
|
||||
# $servers->setValue('login','timeout',30);
|
||||
|
||||
/* Set this if you want phpldapadmin to perform rename operation on entry which
|
||||
has children. Certain servers are known to allow it, certain are not */
|
||||
// $ldapservers->SetValue($i,'server','branch_rename',false);
|
||||
// $servers->setValue('server','branch_rename',false);
|
||||
|
||||
/* If you set this, then phpldapadmin will show these attributes as
|
||||
internal attributes, even if they are not defined in your schema. */
|
||||
// $ldapservers->SetValue($i,'server','custom_sys_attrs',array(''));
|
||||
# $ldapservers->SetValue($i,'server','custom_sys_attrs',array('passwordExpirationTime','passwordAllowChangeTime'));
|
||||
// $servers->setValue('server','custom_sys_attrs',array(''));
|
||||
# $servers->setValue('server','custom_sys_attrs',array('passwordExpirationTime','passwordAllowChangeTime'));
|
||||
|
||||
/* If you set this, then phpldapadmin will show these attributes on
|
||||
objects, even if they are not defined in your schema. */
|
||||
// $ldapservers->SetValue($i,'server','custom_attrs',array(''));
|
||||
# $ldapservers->SetValue($i,'server','custom_attrs',array('nsRoleDN','nsRole','nsAccountLock'));
|
||||
// $servers->setValue('server','custom_attrs',array(''));
|
||||
# $servers->setValue('server','custom_attrs',array('nsRoleDN','nsRole','nsAccountLock'));
|
||||
|
||||
/* These attributes will be forced to MAY attributes and become option in the
|
||||
templates. If they are not defined in the templates, then they wont appear
|
||||
@@ -387,8 +470,27 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
|
||||
server may automatically calculate a default value.
|
||||
In Fedora Directory Server using the DNA Plugin one could ignore uidNumber,
|
||||
gidNumber and sambaSID. */
|
||||
// $ldapservers->SetValue($i,'force_may','attrs',array(''));
|
||||
# $ldapservers->SetValue($i,'force_may','attrs',array('uidNumber','gidNumber','sambaSID'));
|
||||
// $servers->setValue('force_may','attrs',array(''));
|
||||
# $servers->setValue('force_may','attrs',array('uidNumber','gidNumber','sambaSID'));
|
||||
|
||||
/*********************************************/
|
||||
/* Unique attributes */
|
||||
/*********************************************/
|
||||
|
||||
/* You may want phpLDAPadmin to enforce some attributes to have unique values
|
||||
(ie: not belong to other entries in your tree. This (together with
|
||||
'unique','dn' and 'unique','pass' option will not let updates to
|
||||
occur with other attributes have the same value. */
|
||||
# $servers->setValue('unique','attrs',array('mail','uid','uidNumber'));
|
||||
|
||||
/* If you set this, then phpldapadmin will bind to LDAP with this user ID when
|
||||
searching for attribute uniqueness. The idea is, this user id would have full
|
||||
(readonly) access to your ldap directory (the logged in user may not), so
|
||||
that you can be guaranteed to get a unique uidnumber for your directory. */
|
||||
// $servers->setValue('unique','dn',null);
|
||||
|
||||
/* The password for the dn above. */
|
||||
// $servers->setValue('unique','pass',null);
|
||||
|
||||
/**************************************************************************
|
||||
* If you want to configure additional LDAP servers, do so below. *
|
||||
@@ -397,172 +499,50 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
$i++;
|
||||
$ldapservers->SetValue($i,'server','name','LDAP Server');
|
||||
$ldapservers->SetValue($i,'server','host','127.0.0.1');
|
||||
$ldapservers->SetValue($i,'server','port','389');
|
||||
$ldapservers->SetValue($i,'server','base',array(''));
|
||||
$ldapservers->SetValue($i,'server','auth_type','cookie');
|
||||
$ldapservers->SetValue($i,'login','dn','');
|
||||
$ldapservers->SetValue($i,'login','pass','');
|
||||
$ldapservers->SetValue($i,'server','tls',false);
|
||||
$ldapservers->SetValue($i,'server','low_bandwidth',false);
|
||||
$ldapservers->SetValue($i,'appearance','password_hash','md5');
|
||||
$ldapservers->SetValue($i,'login','attr','dn');
|
||||
$ldapservers->SetValue($i,'login','string',null);
|
||||
$ldapservers->SetValue($i,'login','class',null);
|
||||
$ldapservers->SetValue($i,'server','read_only',false);
|
||||
$ldapservers->SetValue($i,'appearance','show_create',true);
|
||||
$ldapservers->SetValue($i,'auto_number','enable',true);
|
||||
$ldapservers->SetValue($i,'auto_number','mechanism','search');
|
||||
$ldapservers->SetValue($i,'auto_number','search_base',null);
|
||||
$ldapservers->SetValue($i,'auto_number','min','1000');
|
||||
$ldapservers->SetValue($i,'auto_number','dn',null);
|
||||
$ldapservers->SetValue($i,'auto_number','pass',null);
|
||||
$ldapservers->SetValue($i,'login','anon_bind',true);
|
||||
$ldapservers->SetValue($i,'custom','pages_prefix','custom_');
|
||||
$ldapservers->SetValue($i,'unique_attrs','dn',null);
|
||||
$ldapservers->SetValue($i,'unique_attrs','pass',null);
|
||||
$servers->newServer('ldap_pla');
|
||||
$servers->setValue('server','name','LDAP Server');
|
||||
$servers->setValue('server','host','127.0.0.1');
|
||||
$servers->setValue('server','port',389);
|
||||
$servers->setValue('server','base',array(''));
|
||||
$servers->setValue('login','auth_type','cookie');
|
||||
$servers->setValue('login','bind_id','');
|
||||
$servers->setValue('login','bind_pass','');
|
||||
$servers->setValue('server','tls',false);
|
||||
|
||||
# SASL auth
|
||||
$ldapservers->SetValue($i,'server','sasl_auth',true);
|
||||
$ldapservers->SetValue($i,'server','sasl_mech','PLAIN');
|
||||
$ldapservers->SetValue($i,'server','sasl_realm','EXAMPLE.COM');
|
||||
$ldapservers->SetValue($i,'server','sasl_authz_id',null);
|
||||
$ldapservers->SetValue($i,'server','sasl_authz_id_regex','/^uid=([^,]+)(.+)/i');
|
||||
$ldapservers->SetValue($i,'server','sasl_authz_id_replacement','$1');
|
||||
$ldapservers->SetValue($i,'server','sasl_props',null);
|
||||
$servers->setValue('server','sasl_auth',true);
|
||||
$servers->setValue('server','sasl_mech','PLAIN');
|
||||
$servers->setValue('server','sasl_realm','EXAMPLE.COM');
|
||||
$servers->setValue('server','sasl_authz_id',null);
|
||||
$servers->setValue('server','sasl_authz_id_regex','/^uid=([^,]+)(.+)/i');
|
||||
$servers->setValue('server','sasl_authz_id_replacement','$1');
|
||||
$servers->setValue('server','sasl_props',null);
|
||||
|
||||
$servers->setValue('appearance','password_hash','md5');
|
||||
$servers->setValue('login','attr','dn');
|
||||
$servers->setValue('login','fallback_dn',false);
|
||||
$servers->setValue('login','class',null);
|
||||
$servers->setValue('server','read_only',false);
|
||||
$servers->setValue('appearance','show_create',true);
|
||||
|
||||
$servers->setValue('auto_number','enable',true);
|
||||
$servers->setValue('auto_number','mechanism','search');
|
||||
$servers->setValue('auto_number','search_base',null);
|
||||
$servers->setValue('auto_number','min',array('uidNumber'=>1000,'gidNumber'=>500));
|
||||
$servers->setValue('auto_number','dn',null);
|
||||
$servers->setValue('auto_number','pass',null);
|
||||
|
||||
$servers->setValue('login','anon_bind',true);
|
||||
$servers->setValue('custom','pages_prefix','custom_');
|
||||
$servers->setValue('unique','attrs',array('mail','uid','uidNumber'));
|
||||
$servers->setValue('unique','dn',null);
|
||||
$servers->setValue('unique','pass',null);
|
||||
|
||||
$servers->setValue('server','visible',true);
|
||||
$servers->setValue('login','timeout',30);
|
||||
$servers->setValue('server','branch_rename',false);
|
||||
$servers->setValue('server','custom_sys_attrs',array('passwordExpirationTime','passwordAllowChangeTime'));
|
||||
$servers->setValue('server','custom_attrs',array('nsRoleDN','nsRole','nsAccountLock'));
|
||||
$servers->setValue('force_may','attrs',array('uidNumber','gidNumber','sambaSID'));
|
||||
*/
|
||||
|
||||
/*********************************************/
|
||||
/* User-friendly attribute translation */
|
||||
/*********************************************/
|
||||
|
||||
/* Use this array to map attribute names to user friendly names. For example, if
|
||||
you don't want to see "facsimileTelephoneNumber" but rather "Fax". */
|
||||
$friendly_attrs = array();
|
||||
|
||||
$friendly_attrs['facsimileTelephoneNumber'] = 'Fax';
|
||||
$friendly_attrs['telephoneNumber'] = 'Phone';
|
||||
$friendly_attrs['uid'] = 'User Name';
|
||||
|
||||
/*********************************************/
|
||||
/* Support for attrs display order */
|
||||
/*********************************************/
|
||||
|
||||
/* Use this array if you want to have your attributes displayed in a specific
|
||||
order. You can use default attribute names or their fridenly names.
|
||||
For example, "sn" will be displayed right after "givenName". All the other
|
||||
attributes that are not specified in this array will be displayed after in
|
||||
alphabetical order. */
|
||||
# $attrs_display_order = array(
|
||||
# 'givenName',
|
||||
# 'sn',
|
||||
# 'cn',
|
||||
# 'displayName',
|
||||
# 'uid',
|
||||
# 'uidNumber',
|
||||
# 'gidNumber',
|
||||
# 'homeDirectory',
|
||||
# 'mail',
|
||||
# 'userPassword'
|
||||
# );
|
||||
|
||||
/*********************************************/
|
||||
/* Hidden attributes */
|
||||
/*********************************************/
|
||||
|
||||
/* You may want to hide certain attributes from being displayed in the editor
|
||||
screen. Do this by adding the desired attributes to this list (and uncomment
|
||||
it). This only affects the editor screen. Attributes will still be visible in
|
||||
the schema browser and elsewhere. An example is provided below:
|
||||
NOTE: The user must be able to read the hidden_except_dn entry to be
|
||||
excluded. */
|
||||
# $hidden_attrs = array( 'jpegPhoto', 'objectClass' );
|
||||
# $hidden_except_dn = "cn=PLA UnHide,ou=Groups,c=AU";
|
||||
|
||||
/* Hidden attributes in read-only mode. If undefined, it will be equal to
|
||||
$hidden_attrs. */
|
||||
# $hidden_attrs_ro = array(
|
||||
# 'objectClass','shadowWarning', 'shadowLastChange', 'shadowMax',
|
||||
# 'shadowFlag', 'shadowInactive', 'shadowMin', 'shadowExpire');
|
||||
|
||||
/** **/
|
||||
/** Read-only attributes **/
|
||||
/** **/
|
||||
|
||||
/* You may want to phpLDAPadmin to display certain attributes as read only,
|
||||
meaning that users will not be presented a form for modifying those
|
||||
attributes, and they will not be allowed to be modified on the "back-end"
|
||||
either. You may configure this list here:
|
||||
NOTE: The user must be able to read the read_only_except_dn entry to be
|
||||
excluded. */
|
||||
# $read_only_attrs = array( 'objectClass' );
|
||||
# $read_only_except_dn = "cn=PLA ReadWrite,ou=Groups,c=AU";
|
||||
|
||||
/* An example of how to specify multiple read-only attributes: */
|
||||
# $read_only_attrs = array( 'jpegPhoto', 'objectClass', 'someAttribute' );
|
||||
|
||||
/*********************************************/
|
||||
/* Unique attributes */
|
||||
/*********************************************/
|
||||
|
||||
/* You may want phpLDAPadmin to enforce some attributes to have unique values
|
||||
(ie: not belong to other entries in your tree. This (together with
|
||||
unique_attrs['dn'] and unique_attrs['pass'] option will not let updates to
|
||||
occur with other attributes have the same value.
|
||||
NOTE: Currently the unique_attrs is NOT enforced when copying a dn. (Need to
|
||||
present a user with the option of changing the unique attributes. */
|
||||
# $unique_attrs = array('uid','uidNumber','mail');
|
||||
|
||||
/*********************************************/
|
||||
/* Group attributes */
|
||||
/*********************************************/
|
||||
|
||||
/* Add "modify group members" link to the attribute. */
|
||||
// $config->custom->modify_member['groupattr'] = array('member','uniqueMember','memberUid');
|
||||
|
||||
/* Configure filter for member search. This only applies to "modify group members" feature */
|
||||
// $config->custom->modify_member['filter'] = '(objectclass=Person)';
|
||||
|
||||
/* Attribute that is added to the group member attribute. */
|
||||
// $config->custom->modify_member['attr'] = 'dn';
|
||||
|
||||
/*********************************************/
|
||||
/* Predefined Queries (canned views) */
|
||||
/*********************************************/
|
||||
|
||||
/* To make searching easier, you may setup predefined queries below: */
|
||||
$q=0;
|
||||
$queries = array();
|
||||
|
||||
/* The name that will appear in the simple search form */
|
||||
$queries[$q]['name'] = 'User List';
|
||||
|
||||
/* The base to search on */
|
||||
$queries[$q]['base'] = 'dc=example,dc=com';
|
||||
|
||||
/* The search scope (sub, base, one) */
|
||||
$queries[$q]['scope'] = 'sub';
|
||||
|
||||
/* The LDAP filter to use */
|
||||
$queries[$q]['filter'] = '(&(objectClass=posixAccount)(uid=*))';
|
||||
|
||||
/* The attributes to return */
|
||||
$queries[$q]['attributes'] = 'cn, uid, homeDirectory, telephonenumber, jpegphoto';
|
||||
|
||||
/* If you want to configure more pre-defined queries, copy and paste the above (including the "$q++;") */
|
||||
$q++;
|
||||
$queries[$q]['name'] = 'Samba Users';
|
||||
$queries[$q]['base'] = 'dc=example,dc=com';
|
||||
$queries[$q]['scope'] = 'sub';
|
||||
$queries[$q]['filter'] = '(&(|(objectClass=sambaAccount)(objectClass=sambaSamAccount))(objectClass=posixAccount)(!(uid=*$)))';
|
||||
$queries[$q]['attributes'] = 'uid, smbHome, uidNumber';
|
||||
|
||||
$q++;
|
||||
$queries[$q]['name'] = 'Samba Computers';
|
||||
$queries[$q]['base'] = 'dc=example,dc=com';
|
||||
$queries[$q]['scope'] = 'sub';
|
||||
$queries[$q]['filter'] = '(&(objectClass=sambaAccount)(uid=*$))';
|
||||
$queries[$q]['attributes'] = 'uid, homeDirectory';
|
||||
?>
|
||||
|
@@ -1,2 +1,2 @@
|
||||
Please see http://wiki.phpldapadmin.info/Translating now for information on
|
||||
Please see http://phpldapadmin.sourceforge.net/Translate now for information on
|
||||
translating PLA.
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
for i in $(grep directory phpldapadmin-demo.conf|awk '{print $2}'); do
|
||||
rm -f $i/*dbb $i/alock $i/log.*
|
||||
rm -f $i/*.dbb $i/*.bdb $i/__db.??? $i/alock $i/log.*
|
||||
done
|
||||
|
||||
slapadd -b "dc=example.com" -l ldif-example.com
|
||||
|
@@ -1,19 +1,29 @@
|
||||
include /etc/openldap/schema/uidpool.schema
|
||||
|
||||
TLSCACertificateFile /etc/openldap/pla/ca-bundle.crt
|
||||
TLSCertificateFile /etc/openldap/pla/slapd.crt
|
||||
TLSCertificateKeyFile /etc/openldap/pla/slapd.key
|
||||
|
||||
access to dn.regex="o=Simpsons$" attrs=userpassword
|
||||
by anonymous auth
|
||||
by self write
|
||||
by * none
|
||||
|
||||
access to dn.base="" by * read
|
||||
access to dn.regex="dc=example.com$"
|
||||
by * write
|
||||
access to dn.regex="dc=example,dc=com$"
|
||||
by * write
|
||||
access to dn.regex="o=Simpsons$"
|
||||
by self write
|
||||
by dn.regex="cn=.*,ou=People,o=Simpsons" write
|
||||
by dn.regex="cn=.*,ou=Pets,o=Simpsons" write
|
||||
by * read
|
||||
access to *
|
||||
by * read
|
||||
|
||||
database ldbm
|
||||
authz-policy any
|
||||
|
||||
database bdb
|
||||
suffix "dc=example.com"
|
||||
rootdn "cn=Manager,dc=example.com"
|
||||
rootpw NotAllowed
|
||||
@@ -28,7 +38,7 @@ index uidNumber,gidNumber,loginShell eq,pres
|
||||
index uid,memberUid eq,pres,sub
|
||||
index nisMapName,nisMapEntry eq,pres,sub
|
||||
|
||||
database ldbm
|
||||
database bdb
|
||||
suffix "dc=example,dc=com"
|
||||
rootdn "cn=Manager,dc=example,dc=com"
|
||||
rootpw NotAllowed
|
||||
@@ -43,7 +53,7 @@ index uidNumber,gidNumber,loginShell eq,pres
|
||||
index uid,memberUid eq,pres,sub
|
||||
index nisMapName,nisMapEntry eq,pres,sub
|
||||
|
||||
database ldbm
|
||||
database bdb
|
||||
suffix "o=Simpsons"
|
||||
rootdn "cn=Manager,o=Simpsons"
|
||||
rootpw NotAllowed
|
||||
@@ -57,3 +67,11 @@ index ou,cn,mail,surname,givenname eq,pres,sub
|
||||
index uidNumber,gidNumber,loginShell eq,pres
|
||||
index uid,memberUid eq,pres,sub
|
||||
index nisMapName,nisMapEntry eq,pres,sub
|
||||
|
||||
database monitor
|
||||
access to * by * read
|
||||
|
||||
database config
|
||||
access to * by * read
|
||||
rootdn cn=admin,cn=config
|
||||
rootpw password
|
||||
|
@@ -1,4 +1,3 @@
|
||||
# $Header: /cvsroot/phpldapadmin/phpldapadmin/doc/pla-test-i18n.ldif,v 1.4 2004/03/19 20:22:54 i18phpldapadmin Exp $
|
||||
# This is a Test-File for characters / encoding
|
||||
# 1. Change the
|
||||
# ,dc=example,dc=com
|
||||
|
402
hooks/functions/example.php
Normal file
@@ -0,0 +1,402 @@
|
||||
<?php
|
||||
/**
|
||||
* An example of a hooks implementation.
|
||||
*
|
||||
* Functions should return true on success and false on failure.
|
||||
* If a function returns false it will trigger the rollback to be executed.
|
||||
*
|
||||
* @author The phpLDAPadmin development team
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* This example hooks implementation will just show system_messages after each hooks is called.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Functions
|
||||
*/
|
||||
|
||||
# If you want to see this example in action, just comment out the return.
|
||||
return false;
|
||||
|
||||
/**
|
||||
* The post_session_init function is called after lib/common.php has completed its processing.
|
||||
* This can be used to further initialise the session.
|
||||
*
|
||||
* No arguments are passed to post_session_init.
|
||||
*/
|
||||
function example_post_session_init() {
|
||||
$args = func_get_args();
|
||||
|
||||
system_message(array(
|
||||
'title'=>sprintf('Hook called [%s]',__METHOD__),
|
||||
'body'=>sprintf('<i>Global Vars</i>: <small>%s</small>',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('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li></ul>',$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('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>User DN: <small>%s</small></li></ul>',$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('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attributes: <small>%s</small></li></ul>',$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('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attributes: <small>%s</small></li></ul>',$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('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li></ul>',$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('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li></ul>',$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('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>New RDN: <small>%s</small></li><li>New Container: <small>%s</small></li></ul>',$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('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>New RDN: <small>%s</small></li><li>New Container: <small>%s</small></li></ul>',$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('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attributes: <small>%s</small></li></ul>',$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('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attributes: <small>%s</small></li></ul>',$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('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>New Values: <small>%s</small></li></ul>',$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('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>New Values: <small>%s</small></li></ul>',$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('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>Old Values: <small>%s</small></li><li>New Values: <small>%s</small></li></ul>',$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('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>Old Values: <small>%s</small></li><li>New Values: <small>%s</small></li></ul>',$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('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>Old Values: <small>%s</small></li></ul>',$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('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>Old Values: <small>%s</small></li></ul>',$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');
|
||||
?>
|
@@ -1,167 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr.php,v 1.20.2.2 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* Adds an attribute/value pair to an object
|
||||
*
|
||||
* Variables that come in as POST vars:
|
||||
* - dn
|
||||
* - attr
|
||||
* - val
|
||||
* - binary
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @todo: For boolean attributes, convert the response to TRUE/FALSE.
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
|
||||
|
||||
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add'))
|
||||
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute')),'error','index.php');
|
||||
|
||||
$entry = array();
|
||||
$entry['val'] = get_request('val','POST');
|
||||
$entry['binary'] = get_request('binary','POST');
|
||||
|
||||
$entry['dn']['string'] = get_request('dn','POST');
|
||||
$entry['dn']['encode'] = rawurlencode($entry['dn']['string']);
|
||||
|
||||
$entry['attr']['string'] = get_request('attr','POST');
|
||||
$entry['attr']['encode'] = rawurlencode($entry['attr']['string']);
|
||||
|
||||
if ((strlen($entry['binary']) <= 0) && (strlen($entry['val']) <= 0))
|
||||
error(_('You left the attribute value blank. Please go back and try again.'),'error','index.php');
|
||||
|
||||
/*
|
||||
* Special case for binary attributes (like jpegPhoto and userCertificate):
|
||||
* we must go read the data from the file and override $val with the binary data
|
||||
* Secondly, we must check if the ";binary" option has to be appended to the name
|
||||
* of the attribute.
|
||||
*/
|
||||
|
||||
# Check to see if this is a unique Attribute
|
||||
if ($badattr = $ldapserver->checkUniqueAttr($entry['dn']['string'],$entry['attr']['string'],array($entry['val']))) {
|
||||
$href = htmlspecialchars(sprintf('cmd.php?cmd=search&search=true&form=advanced&server_id=%s&filter=%s=%s',
|
||||
$ldapserver->server_id,$entry['attr']['string'],$badattr));
|
||||
|
||||
error(sprintf(_('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$entry['attr']['string'],$badattr,$entry['dn']['string'],$href),'error','index.php');
|
||||
}
|
||||
|
||||
if (strlen($entry['binary']) > 0) {
|
||||
if ($_FILES['val']['size'] == 0)
|
||||
error(_('The file you chose is either empty or does not exist. Please go back and try again.'),'error','index.php');
|
||||
|
||||
if (! is_uploaded_file($_FILES['val']['tmp_name'])) {
|
||||
if (isset($_FILES['val']['error']))
|
||||
|
||||
switch($_FILES['val']['error']) {
|
||||
case 0: # No error; possible file attack!
|
||||
error(_('Security error: The file being uploaded may be malicious.'),'error','index.php');
|
||||
break;
|
||||
|
||||
case 1: # Uploaded file exceeds the upload_max_filesize directive in php.ini
|
||||
error(_('The file you uploaded is too large. Please check php.ini, upload_max_size setting'),'error','index.php');
|
||||
break;
|
||||
|
||||
case 2: # Uploaded file exceeds the MAX_FILE_SIZE directive specified in the html form
|
||||
error(_('The file you uploaded is too large. Please check php.ini, upload_max_size setting'),'error','index.php');
|
||||
break;
|
||||
|
||||
case 3: # Uploaded file was only partially uploaded
|
||||
error(_('The file you selected was only partially uploaded, likley due to a network error.'),'error','index.php');
|
||||
break;
|
||||
|
||||
case 4: # No file was uploaded
|
||||
error(_('You left the attribute value blank. Please go back and try again.'),'error','index.php');
|
||||
break;
|
||||
|
||||
default: # A default error, just in case! :)
|
||||
error(_('Security error: The file being uploaded may be malicious.'),'error','index.php');
|
||||
break;
|
||||
}
|
||||
|
||||
else
|
||||
error(_('Security error: The file being uploaded may be malicious.'),'error','index.php');
|
||||
}
|
||||
|
||||
$binaryfile['name'] = $_FILES['val']['tmp_name'];
|
||||
$binaryfile['handle'] = fopen($binaryfile['name'],'r');
|
||||
$binaryfile['data'] = fread($binaryfile['handle'],filesize($binaryfile['name']));
|
||||
fclose($binaryfile['handle']);
|
||||
|
||||
$entry['val'] = $binaryfile['data'];
|
||||
|
||||
if (is_binary_option_required($ldapserver,$entry['attr']['string']))
|
||||
$entry['attr']['string'] .= ';binary';
|
||||
}
|
||||
|
||||
/* Automagically hash new userPassword attributes according to the
|
||||
chosen in config.php. */
|
||||
if (strcasecmp($entry['attr']['string'],'userpassword') == 0) {
|
||||
if (trim($ldapserver->default_hash) != '' ) {
|
||||
$enc_type = $ldapserver->default_hash;
|
||||
$entry['val'] = password_hash($entry['val'],$enc_type);
|
||||
}
|
||||
|
||||
} elseif (strcasecmp($entry['attr']['string'],'sambaNTPassword') == 0) {
|
||||
$sambapassword = new smbHash;
|
||||
$entry['val'] = $sambapassword->nthash($entry['val']);
|
||||
|
||||
} elseif (strcasecmp($entry['attr']['string'],'sambaLMPassword') == 0) {
|
||||
$sambapassword = new smbHash;
|
||||
$entry['val'] = $sambapassword->lmhash($entry['val']);
|
||||
}
|
||||
|
||||
$new_entry = array($entry['attr']['string'] => $entry['val']);
|
||||
$result = $ldapserver->attrModify($entry['dn']['string'],$new_entry);
|
||||
|
||||
if ($result) {
|
||||
header(sprintf('Location: cmd.php?cmd=template_engine&server_id=%s&dn=%s&modified_attrs[]=%s',
|
||||
$ldapserver->server_id,$entry['dn']['encode'],$entry['attr']['encode']));
|
||||
die();
|
||||
|
||||
} else {
|
||||
system_message(array(
|
||||
'title'=>_('Failed to add the attribute.'),
|
||||
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
|
||||
'type'=>'error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we need to append the ;binary option to the name
|
||||
* of some binary attribute
|
||||
*
|
||||
* @param object $ldapserver Server Object that the attribute is in.
|
||||
* @param attr $attr Attribute to test to see if it requires ;binary added to it.
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
function is_binary_option_required($ldapserver,$attr) {
|
||||
# List of the binary attributes which need the ";binary" option
|
||||
$binary_attributes_with_options = array(
|
||||
# Superior: Ldapv3 Syntaxes (1.3.6.1.4.1.1466.115.121.1)
|
||||
'1.3.6.1.4.1.1466.115.121.1.8' => 'userCertificate',
|
||||
'1.3.6.1.4.1.1466.115.121.1.8' => 'caCertificate',
|
||||
'1.3.6.1.4.1.1466.115.121.1.10' => 'crossCertificatePair',
|
||||
'1.3.6.1.4.1.1466.115.121.1.9' => 'certificateRevocationList',
|
||||
'1.3.6.1.4.1.1466.115.121.1.9' => 'authorityRevocationList',
|
||||
# Superior: Netscape Ldap attributes types (2.16.840.1.113730.3.1)
|
||||
'2.16.840.1.113730.3.1.40' => 'userSMIMECertificate'
|
||||
);
|
||||
|
||||
$schema_attr = $ldapserver->getSchemaAttribute($attr);
|
||||
if (! $schema_attr)
|
||||
return false;
|
||||
|
||||
$syntax = $schema_attr->getSyntaxOID();
|
||||
if (isset($binary_attributes_with_options[$syntax]))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
?>
|
@@ -1,184 +1,181 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr_form.php,v 1.16.2.4 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* Displays a form for adding an attribute/value to an LDAP entry.
|
||||
*
|
||||
* Variables that come in as GET vars:
|
||||
* - dn (rawurlencoded)
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
|
||||
# The DN we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET');
|
||||
|
||||
$entry = array();
|
||||
$entry['dn']['string'] = get_request('dn','GET');
|
||||
$entry['rdn'] = get_rdn($entry['dn']['string']);
|
||||
# Check if the entry exists.
|
||||
if (! $request['dn'] || ! $app['server']->dnExists($request['dn']))
|
||||
error(sprintf(_('The entry (%s) does not exist.'),$request['dn']),'error','index.php');
|
||||
|
||||
printf('<h3 class="title">%s <b>%s</b></h3>',_('Add new attribute'),htmlspecialchars($entry['rdn']));
|
||||
printf('<h3 class="subtitle">%s: <b>%s</b> %s: <b>%s</b></h3>',
|
||||
_('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($entry['dn']['string']));
|
||||
$request['page'] = new TemplateRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->setDN($request['dn']);
|
||||
$request['page']->accept(true);
|
||||
$request['template'] = $request['page']->getTemplate();
|
||||
|
||||
$dn = array();
|
||||
$dn['attrs'] = $ldapserver->getDNAttrs($entry['dn']['string']);
|
||||
$dn['oclasses'] = $ldapserver->getDNAttr($entry['dn']['string'],'objectClass');
|
||||
# Render the form
|
||||
if (get_request('meth','REQUEST') != 'ajax') {
|
||||
$request['page']->drawTitle(sprintf('%s <b>%s</b>',_('Add new attribute'),get_rdn($request['dn'])));
|
||||
$request['page']->drawSubTitle();
|
||||
|
||||
if (! is_array($dn['oclasses']))
|
||||
$dn['oclasses'] = array($dn['oclasses']);
|
||||
echo '<center>';
|
||||
if (count($request['template']->getAvailAttrs())) {
|
||||
# If we have more than the configured entries, we'll separate our input to the old ways.
|
||||
if (count($request['template']->getAvailAttrs()) > $_SESSION[APPCONFIG]->getValue('appearance','max_add_attrs')) {
|
||||
$attr = array();
|
||||
$attr['avail'] = array();
|
||||
$attr['binary'] = array();
|
||||
|
||||
$ldap['attrs']['avail'] = array();
|
||||
foreach ($request['template']->getAvailAttrs() as $attribute)
|
||||
if ($app['server']->isAttrBinary($attribute->getName()))
|
||||
array_push($attr['binary'],$attribute);
|
||||
else
|
||||
array_push($attr['avail'],$attribute);
|
||||
|
||||
if (array_search('extensibleObject',$dn['oclasses']) !== false) {
|
||||
$ldap['attrs']['ldap'] = $ldapserver->SchemaAttributes();
|
||||
if (count($attr['avail']) > 0) {
|
||||
echo '<br />';
|
||||
echo _('Add new attribute');
|
||||
echo '<br />';
|
||||
echo '<br />';
|
||||
|
||||
foreach ($ldap['attrs']['ldap'] as $attr)
|
||||
$ldap['attrs']['avail'][] = $attr->getName();
|
||||
echo '<form action="cmd.php" method="post">';
|
||||
|
||||
} else {
|
||||
$ldap['oclasses'] = $ldapserver->SchemaObjectClasses($entry['dn']['string']);
|
||||
if ($_SESSION[APPCONFIG]->getValue('confirm','update'))
|
||||
echo '<input type="hidden" name="cmd" value="update_confirm" />';
|
||||
else
|
||||
echo '<input type="hidden" name="cmd" value="update" />';
|
||||
|
||||
foreach ($dn['oclasses'] as $oclass) {
|
||||
$ldap['oclass'] = $ldapserver->getSchemaObjectClass($oclass,$entry['dn']['string']);
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($request['dn']));
|
||||
|
||||
if ($ldap['oclass'] && strcasecmp('objectclass',get_class($ldap['oclass'])) == 0)
|
||||
$ldap['attrs']['avail'] = array_merge($ldap['oclass']->getMustAttrNames($ldap['oclasses']),
|
||||
$ldap['oclass']->getMayAttrNames($ldap['oclasses']),
|
||||
$ldap['attrs']['avail']);
|
||||
}
|
||||
}
|
||||
echo '<select name="single_item_attr">';
|
||||
|
||||
$ldap['attrs']['avail'] = array_unique($ldap['attrs']['avail']);
|
||||
$ldap['attrs']['avail'] = array_filter($ldap['attrs']['avail'],'not_an_attr');
|
||||
sort($ldap['attrs']['avail']);
|
||||
foreach ($attr['avail'] as $attribute) {
|
||||
# Is there a user-friendly translation available for this attribute?
|
||||
if ($attribute->haveFriendlyName())
|
||||
$attr_display = sprintf('%s (%s)',$attribute->getFriendlyName(),$attribute->getName(false));
|
||||
else
|
||||
$attr_display = $attribute->getName(false);
|
||||
|
||||
$ldap['binattrs']['avail'] = array();
|
||||
printf('<option value="%s">%s</option>',htmlspecialchars($attribute->getName()),$attr_display);
|
||||
}
|
||||
|
||||
foreach ($ldap['attrs']['avail'] as $i => $attr) {
|
||||
if ($ldapserver->isAttrBinary($attr)) {
|
||||
$ldap['binattrs']['avail'][] = $attr;
|
||||
unset($ldap['attrs']['avail'][$i]);
|
||||
}
|
||||
}
|
||||
echo '</select>';
|
||||
|
||||
echo '<center>';
|
||||
echo '<input type="text" name="single_item_value" size="20" />';
|
||||
printf('<input type="submit" name="submit" value="%s" class="update_dn" />',_('Add'));
|
||||
echo '</form>';
|
||||
|
||||
if (is_array($ldap['attrs']['avail']) && count($ldap['attrs']['avail']) > 0) {
|
||||
echo '<br />';
|
||||
echo _('Add new attribute');
|
||||
echo '<br />';
|
||||
echo '<br />';
|
||||
} else {
|
||||
echo '<br />';
|
||||
printf('<small>(%s)</small>',_('no new attributes available for this entry'));
|
||||
}
|
||||
|
||||
echo '<form action="cmd.php" method="post">';
|
||||
echo '<input type="hidden" name="cmd" value="add_attr" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($entry['dn']['string']));
|
||||
if (count($attr['binary']) > 0) {
|
||||
echo '<br />';
|
||||
echo _('Add new binary attribute');
|
||||
echo '<br />';
|
||||
echo '<br />';
|
||||
|
||||
echo '<select name="attr">';
|
||||
echo '<!-- Form to add a new BINARY attribute to this entry -->';
|
||||
echo '<form action="cmd.php" method="post" enctype="multipart/form-data">';
|
||||
|
||||
$attr_select_html = '';
|
||||
usort($ldap['attrs']['avail'],'sortAttrs');
|
||||
if ($_SESSION[APPCONFIG]->getValue('confirm','update'))
|
||||
echo '<input type="hidden" name="cmd" value="update_confirm" />';
|
||||
else
|
||||
echo '<input type="hidden" name="cmd" value="update" />';
|
||||
|
||||
foreach ($ldap['attrs']['avail'] as $a) {
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',$request['dn']);
|
||||
echo '<input type="hidden" name="binary" value="true" />';
|
||||
|
||||
# is there a user-friendly translation available for this attribute?
|
||||
if ($_SESSION[APPCONFIG]->haveFriendlyName($a)) {
|
||||
$attr_display = sprintf('%s (%s)',
|
||||
htmlspecialchars($_SESSION[APPCONFIG]->getFriendlyName($a)),
|
||||
htmlspecialchars($a));
|
||||
echo '<select name="single_item_attr">';
|
||||
|
||||
foreach ($attr['binary'] as $attribute) {
|
||||
# Is there a user-friendly translation available for this attribute?
|
||||
if ($attribute->haveFriendlyName())
|
||||
$attr_display = sprintf('%s (%s)',$attribute->getFriendlyName(),$attribute->getName(false));
|
||||
else
|
||||
$attr_display = $attribute->getName(false);
|
||||
|
||||
printf('<option value="%s">%s</option>',htmlspecialchars($attribute->getName()),$attr_display);
|
||||
}
|
||||
|
||||
echo '</select>';
|
||||
|
||||
echo '<input type="file" name="single_item_value" size="20" />';
|
||||
printf('<input type="submit" name="submit" value="%s" class="update_dn" />',_('Add'));
|
||||
|
||||
if (! ini_get('file_uploads'))
|
||||
printf('<br /><small><b>%s</b></small><br />',
|
||||
_('Your PHP configuration has disabled file uploads. Please check php.ini before proceeding.'));
|
||||
|
||||
else
|
||||
printf('<br /><small><b>%s: %s</b></small><br />',_('Maximum file size'),ini_get('upload_max_filesize'));
|
||||
|
||||
echo '</form>';
|
||||
|
||||
} else {
|
||||
echo '<br />';
|
||||
printf('<small>(%s)</small>',_('no new binary attributes available for this entry'));
|
||||
}
|
||||
|
||||
} else {
|
||||
$attr_display = htmlspecialchars($a);
|
||||
echo '<br />';
|
||||
|
||||
$request['page']->drawFormStart();
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($request['dn']));
|
||||
|
||||
echo '<table class="entry" cellspacing="0" align="center" border=0>';
|
||||
|
||||
foreach ($request['template']->getAvailAttrs() as $attribute)
|
||||
$request['page']->draw('Template',$attribute);
|
||||
|
||||
$request['page']->drawFormSubmitButton();
|
||||
echo '</table>';
|
||||
|
||||
$request['page']->drawFormEnd();
|
||||
}
|
||||
|
||||
printf('<option value="%s">%s</option>',htmlspecialchars($a),$attr_display);
|
||||
} else {
|
||||
printf('<small>(%s)</small>',_('no new attributes available for this entry'));
|
||||
}
|
||||
|
||||
echo '</center>';
|
||||
|
||||
# The ajax addition (it is going into an existing TemplateRendered page
|
||||
} else {
|
||||
# Put our DIV there for the callback
|
||||
echo '<fieldset>';
|
||||
printf('<legend>%s</legend>',_('Add Attribute'));
|
||||
echo '<div id="ajADDATTR">';
|
||||
echo '<table class="entry" cellspacing="0" align="center" border=0>';
|
||||
echo '<td valign="top" align="center">';
|
||||
|
||||
printf('<select name="attr" onChange="ajDISPLAY(\'%s\',\'cmd=add_value_form&server_id=%s&dn=%s&meth=ajax&attr=\'+this.value,\'%s\',\'append\');">',
|
||||
'ADDATTR',$app['server']->getIndex(),rawurlencode(get_request('dn','REQUEST')),_('Please Wait'));
|
||||
|
||||
printf('<option value="%s">%s</option>','','');
|
||||
foreach ($request['template']->getAvailAttrs() as $attribute)
|
||||
printf('<option value="%s">%s</option>',htmlspecialchars($attribute->getName()),$attribute->getFriendlyName());
|
||||
|
||||
echo '</select>';
|
||||
|
||||
echo '<input type="text" name="val" size="20" />';
|
||||
printf('<input type="submit" name="submit" value="%s" class="update_dn" />',_('Add'));
|
||||
echo '</form>';
|
||||
|
||||
} else {
|
||||
echo '<br />';
|
||||
printf('<small>(%s)</small>',_('no new attributes available for this entry'));
|
||||
}
|
||||
|
||||
if (count($ldap['binattrs']['avail']) > 0) {
|
||||
echo '<br />';
|
||||
echo _('Add new binary attribute');
|
||||
echo '<br />';
|
||||
echo '<br />';
|
||||
|
||||
echo '<!-- Form to add a new BINARY attribute to this entry -->';
|
||||
echo '<form action="cmd.php" method="post" enctype="multipart/form-data">';
|
||||
echo '<input type="hidden" name="cmd" value="add_attr" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
printf('<input type="hidden" name="dn" value="%s" />',$entry['dn']['string']);
|
||||
echo '<input type="hidden" name="binary" value="true" />';
|
||||
|
||||
echo '<select name="attr">';
|
||||
|
||||
$attr_select_html = '';
|
||||
usort($ldap['binattrs']['avail'],'sortAttrs');
|
||||
|
||||
foreach ($ldap['binattrs']['avail'] as $a) {
|
||||
|
||||
# is there a user-friendly translation available for this attribute?
|
||||
if ($_SESSION[APPCONFIG]->haveFriendlyName($a)) {
|
||||
$attr_display = sprintf('%s (%s)',
|
||||
htmlspecialchars($_SESSION[APPCONFIG]->getFriendlyName($a)),
|
||||
htmlspecialchars($a));
|
||||
|
||||
} else {
|
||||
$attr_display = htmlspecialchars($a);
|
||||
}
|
||||
|
||||
printf('<option value="%s">%s</option>',htmlspecialchars($a),$attr_display);
|
||||
}
|
||||
|
||||
echo '</select>';
|
||||
|
||||
echo '<input type="file" name="val" size="20" />';
|
||||
printf('<input type="submit" name="submit" value="%s" class="update_dn" />',_('Add'));
|
||||
|
||||
if (! ini_get('file_uploads'))
|
||||
printf('<br /><small><b>%s</b></small><br />',
|
||||
_('Your PHP configuration has disabled file uploads. Please check php.ini before proceeding.'));
|
||||
|
||||
else
|
||||
printf('<br /><small><b>%s: %s</b></small><br />',_('Maximum file size'),ini_get('upload_max_filesize'));
|
||||
|
||||
echo '</form>';
|
||||
|
||||
} else {
|
||||
echo '<br />';
|
||||
printf('<small>(%s)</small>',_('no new binary attributes available for this entry'));
|
||||
}
|
||||
|
||||
echo '</center>';
|
||||
|
||||
/**
|
||||
* Given an attribute $x, this returns true if it is NOT already specified
|
||||
* in the current entry, returns false otherwise.
|
||||
*
|
||||
* @param attr $x
|
||||
* @return bool
|
||||
* @ignore
|
||||
*/
|
||||
function not_an_attr($x) {
|
||||
global $dn;
|
||||
|
||||
foreach ($dn['attrs'] as $attr => $values)
|
||||
if (strcasecmp($attr,$x) == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
echo '</td>';
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
echo '</fieldset>';
|
||||
}
|
||||
?>
|
||||
|
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_oclass.php,v 1.19.2.1 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* Adds an objectClass to the specified dn.
|
||||
*
|
||||
* Note, this does not do any schema violation checking. That is
|
||||
* performed in add_oclass_form.php.
|
||||
*
|
||||
* Variables that come in as POST vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - new_oclass
|
||||
* - new_attrs (array, if any)
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
|
||||
|
||||
if ($ldapserver->isAttrReadOnly('objectClass'))
|
||||
error(_('ObjectClasses are flagged as read only in the phpLDAPadmin configuration.'),'error','index.php');
|
||||
|
||||
$entry = array();
|
||||
$entry['dn']['encode'] = get_request('dn');
|
||||
$entry['dn']['string'] = urldecode($entry['dn']['encode']);
|
||||
|
||||
$entry['new']['oclass'] = unserialize(rawurldecode(get_request('new_oclass')));
|
||||
$entry['new']['attrs'] = get_request('new_attrs');
|
||||
|
||||
$new_entry = array();
|
||||
$new_entry['objectClass'] = $entry['new']['oclass'];
|
||||
|
||||
if (is_array($entry['new']['attrs']) && count($entry['new']['attrs']) > 0)
|
||||
foreach ($entry['new']['attrs'] as $attr => $val) {
|
||||
|
||||
# Check to see if this is a unique Attribute
|
||||
if ($badattr = $ldapserver->checkUniqueAttr($entry['dn']['string'],$attr,array($val))) {
|
||||
$href['search'] = htmlspecialchars(sprintf('cmd.php?cmd=search&search=true&form=advanced&server_id=%s&filter=%s=%s',
|
||||
$ldapserver->server_id,$attr,$badattr));
|
||||
|
||||
error(sprintf(_('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$attr,$badattr,$entry['dn']['string'],$href['search']),'error','index.php');
|
||||
}
|
||||
|
||||
$new_entry[$attr] = $val;
|
||||
}
|
||||
|
||||
$result = $ldapserver->attrModify($entry['dn']['string'],$new_entry);
|
||||
|
||||
if (! $result)
|
||||
system_message(array(
|
||||
'title'=>_('Could not perform ldap_mod_add operation.'),
|
||||
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
|
||||
'type'=>'error'));
|
||||
|
||||
else {
|
||||
$modified_attrs = array_keys($entry['new']['attrs']);
|
||||
$modified_attrs[] = 'objectclass';
|
||||
|
||||
$href['complete'] = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s&modified_attrs=%s',
|
||||
$ldapserver->server_id,$entry['dn']['encode'],serialize($modified_attrs));
|
||||
|
||||
header(sprintf('Location: %s',$href['complete']));
|
||||
die();
|
||||
}
|
||||
?>
|
@@ -1,81 +1,66 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_oclass_form.php,v 1.25.2.2 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* This page may simply add the objectClass and take you back to the edit page,
|
||||
* but, in one condition it may prompt the user for input. That condition is this:
|
||||
*
|
||||
* If the user has requested to add an objectClass that requires a set of
|
||||
* attributes with 1 or more not defined by the object. In that case, we will
|
||||
* present a form for the user to add those attributes to the object.
|
||||
*
|
||||
* Variables that come in as REQUEST vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - new_oclass
|
||||
* This page will allow the adding of additional ObjectClasses to an item.
|
||||
* + If the ObjectClass to be added requires additional MUST attributes to be
|
||||
* defined, then they will be prompted for.
|
||||
* + If the ObjectClass doesnt need any additional MUST attributes, then it
|
||||
* will be silently added to the object.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @todo If an attribute expects a DN, show the dn browser.
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$entry = array();
|
||||
$entry['oclass']['new'] = get_request('new_oclass','REQUEST');
|
||||
$entry['dn']['string'] = get_request('dn','REQUEST');
|
||||
# The DN and OBJECTCLASS we are working with.
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','REQUEST',true);
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
|
||||
# Check if the entry exists.
|
||||
if (! $request['dn'] || ! $app['server']->dnExists($request['dn']))
|
||||
error(sprintf(_('The entry (%s) does not exist.'),$request['dn']),'error','index.php');
|
||||
|
||||
if (! $entry['oclass']['new'])
|
||||
error(_('You did not select any ObjectClasses for this object. Please go back and do so.'),'error','index.php');
|
||||
$request['page'] = new TemplateRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->setDN($request['dn']);
|
||||
$request['page']->accept(true);
|
||||
$request['template'] = $request['page']->getTemplate();
|
||||
|
||||
/* Ensure that the object has defined all MUST attrs for this objectClass.
|
||||
* If it hasn't, present a form to have the user enter values for all the
|
||||
* newly required attrs.
|
||||
*/
|
||||
|
||||
$entry['dn']['attrs'] = $ldapserver->getDNAttrs($entry['dn']['string'],true);
|
||||
|
||||
$entry['attrs']['current'] = array();
|
||||
foreach ($entry['dn']['attrs'] as $attr => $junk)
|
||||
$entry['attrs']['current'][] = strtolower($attr);
|
||||
$attribute_factory = new AttributeFactory();
|
||||
|
||||
# Grab the required attributes for the new objectClass
|
||||
$ldap['oclasses'] = $ldapserver->SchemaObjectClasses();
|
||||
$ldap = array();
|
||||
$ldap['attrs']['must'] = array();
|
||||
foreach ($entry['oclass']['new'] as $oclass_name) {
|
||||
$ldap['oclass'] = $ldapserver->getSchemaObjectClass($oclass_name);
|
||||
|
||||
if ($ldap['oclass'])
|
||||
$ldap['attrs']['must'] = array_merge($ldap['attrs']['must'],$ldap['oclass']->getMustAttrNames($ldap['oclasses']));
|
||||
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
|
||||
*/
|
||||
* but that the object does not currently contain */
|
||||
$ldap['attrs']['need'] = array();
|
||||
foreach ($ldap['attrs']['must'] as $attr) {
|
||||
$attr = $ldapserver->getSchemaAttribute($attr);
|
||||
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()));
|
||||
|
||||
# First, check if one of this attr's aliases is already an attribute of this entry
|
||||
foreach ($attr->getAliases() as $alias_attr_name)
|
||||
if (in_array(strtolower($alias_attr_name),$entry['attrs']['current']))
|
||||
continue;
|
||||
|
||||
if (in_array(strtolower($attr->getName()),$entry['attrs']['current']))
|
||||
continue;
|
||||
|
||||
/* We made it this far, so the attribute needs to be added to this entry in order
|
||||
* to add this objectClass */
|
||||
$ldap['attrs']['need'][] = $attr;
|
||||
}
|
||||
# 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) {
|
||||
printf('<h3 class="title">%s</h3>',_('New Required Attributes'));
|
||||
printf('<h3 class="subtitle">%s %s %s</h3>',_('This action requires you to add'),count($ldap['attrs']['need']),_('new attributes'));
|
||||
$request['page']->drawTitle(sprintf('%s <b>%s</b>',_('Add new objectClass to'),get_rdn($request['dn'])));
|
||||
$request['page']->drawSubTitle();
|
||||
|
||||
echo '<center>';
|
||||
printf('<small><b>%s: </b>%s <b>%s</b> %s %s</small>',
|
||||
_('Instructions'),
|
||||
_('In order to add these objectClass(es) to this entry, you must specify'),
|
||||
@@ -84,39 +69,44 @@ if (count($ldap['attrs']['need']) > 0) {
|
||||
|
||||
echo '<br /><br />';
|
||||
|
||||
echo '<form action="cmd.php" method="post">';
|
||||
echo '<input type="hidden" name="cmd" value="add_oclass" />';
|
||||
printf('<input type="hidden" name="new_oclass" value="%s" />',rawurlencode(serialize($entry['oclass']['new'])));
|
||||
printf('<input type="hidden" name="dn" value="%s" />',rawurlencode($entry['dn']['string']));
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
echo '<form action="cmd.php" method="post" name="entry_form">';
|
||||
|
||||
if ($_SESSION[APPCONFIG]->getValue('confirm','update'))
|
||||
echo '<input type="hidden" name="cmd" value="update_confirm" />';
|
||||
else
|
||||
echo '<input type="hidden" name="cmd" value="update" />';
|
||||
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($request['dn']));
|
||||
|
||||
echo '<table class="entry" cellspacing="0">';
|
||||
printf('<tr><th colspan="2">%s</th></tr>',_('New Required Attributes'));
|
||||
|
||||
foreach ($ldap['attrs']['need'] as $count => $attr) {
|
||||
printf('<tr><td class="title">%s</td></tr>',htmlspecialchars($attr->getName()));
|
||||
printf('<tr><td class="value"><input type="text" name="new_attrs[%s]" value="" size="40" /></td></tr>',htmlspecialchars($attr->getName()));
|
||||
$counter = 0;
|
||||
foreach ($request['template']->getAttribute('objectclass')->getValues() as $value) {
|
||||
echo '<tr><td colspan=2>';
|
||||
$request['page']->draw('HiddenValue',$request['template']->getAttribute('objectclass'),$counter++);
|
||||
echo '</td></tr>';
|
||||
}
|
||||
|
||||
foreach ($ldap['attrs']['need'] as $count => $attr)
|
||||
$request['page']->draw('Template',$attr);
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo '<br /><br />';
|
||||
echo '<br />';
|
||||
|
||||
printf('<center><input type="submit" value="%s" /></center>',_('Add ObjectClass and Attributes'));
|
||||
echo '</form>';
|
||||
echo '</center>';
|
||||
|
||||
# There are no other required attributes, so we just need to add the objectclass to the DN.
|
||||
} else {
|
||||
$result = $ldapserver->attrModify($entry['dn']['string'],array('objectClass'=>$entry['oclass']['new']));
|
||||
$result = $app['server']->modify($request['dn'],$request['template']->getLDAPmodify());
|
||||
|
||||
if (! $result)
|
||||
system_message(array(
|
||||
'title'=>_('Could not perform ldap_mod_add operation.'),
|
||||
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
|
||||
'type'=>'error'));
|
||||
|
||||
else {
|
||||
$href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s&modified_attrs[]=objectClass',
|
||||
$ldapserver->server_id,rawurlencode($entry['dn']['string']));
|
||||
if ($result) {
|
||||
$href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s&modified_attrs[]=objectclass',
|
||||
$app['server']->getIndex(),rawurlencode($request['dn']));
|
||||
|
||||
header(sprintf('Location: %s',$href));
|
||||
die();
|
||||
|
@@ -1,88 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value.php,v 1.21.2.2 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* Adds a value to an attribute for a given dn.
|
||||
*
|
||||
* Variables that come in as POST vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - attr (rawurlencoded) the attribute to which we are adding a value
|
||||
* - new_value (form element)
|
||||
* - binary
|
||||
*
|
||||
* On success, redirect to the edit_dn page. On failure, echo an error.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
|
||||
|
||||
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value'))
|
||||
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute value')),'error','index.php');
|
||||
|
||||
# The DN and ATTR we are working with.
|
||||
$entry = array();
|
||||
$entry['dn']['encode'] = get_request('dn','POST',true);
|
||||
$entry['dn']['string'] = rawurldecode($entry['dn']['encode']);
|
||||
$entry['attr']['encode'] = get_request('attr','POST',true);
|
||||
$entry['attr']['string'] = rawurldecode($entry['attr']['encode']);
|
||||
$entry['attr']['html'] = htmlspecialchars($entry['attr']['string']);
|
||||
|
||||
$entry['value']['string'] = get_request('new_value','POST',true);
|
||||
$entry['value']['bin'] = get_request('binary','POST') ? true : false;
|
||||
|
||||
if ($ldapserver->isAttrReadOnly($entry['attr']['string']))
|
||||
error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),$entry['attr']['html']),'error','index.php');
|
||||
|
||||
/*
|
||||
* Special case for binary attributes:
|
||||
* we must go read the data from the file.
|
||||
*/
|
||||
if ($entry['value']['bin']) {
|
||||
$binaryfile['name'] = $_FILES['new_value']['tmp_name'];
|
||||
$binaryfile['handle'] = fopen($binaryfile['name'],'r');
|
||||
$binaryfile['data'] = fread($binaryfile['handle'],filesize($binaryfile['name']));
|
||||
fclose($binaryfile['handle']);
|
||||
|
||||
$entry['value']['string'] = $binaryfile['data'];
|
||||
}
|
||||
|
||||
$new_entry = array($entry['attr']['string']=>$entry['value']['string']);
|
||||
|
||||
# Check to see if this is a unique Attribute
|
||||
if ($badattr = $ldapserver->checkUniqueAttr($entry['dn']['string'],$entry['attr']['string'],$new_entry)) {
|
||||
$href = htmlspecialchars(sprintf('cmd.php?cmd=search&search=true&form=advanced&server_id=%s&filter=%s=%s',
|
||||
$ldapserver->server_id,$entry['attr']['string'],$badattr));
|
||||
|
||||
error(sprintf(_('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$entry['attr']['string'],$badattr,$entry['dn']['string'],$href),'error','index.php');
|
||||
}
|
||||
|
||||
# Call the custom callback for each attribute modification and verify that it should be modified.
|
||||
if (run_hook('pre_attr_add',
|
||||
array('server_id'=>$ldapserver->server_id,'dn'=> $entry['dn']['string'],'attr_name'=>$entry['attr']['string'],'new_value'=>$new_entry))) {
|
||||
|
||||
if (run_hook('pre_attr_modify',
|
||||
array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn']['string'],'attr_name'=>$entry['attr']['string'],'new_value'=>$new_entry))) {
|
||||
|
||||
$add_result = $ldapserver->attrModify($entry['dn']['string'],$new_entry);
|
||||
|
||||
if (! $add_result) {
|
||||
system_message(array(
|
||||
'title'=>_('Could not perform ldap_mod_add operation.'),
|
||||
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
|
||||
'type'=>'error'));
|
||||
|
||||
} else {
|
||||
run_hook('post_attr_modify',
|
||||
array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn']['string'],'attr_name'=>$entry['attr']['string'],'new_value'=>$new_entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
header(sprintf('Location: cmd.php?cmd=template_engine&server_id=%s&dn=%s&modified_attrs[]=%s',
|
||||
$ldapserver->server_id,$entry['dn']['encode'],$entry['attr']['encode']));
|
||||
die();
|
||||
?>
|
@@ -1,327 +1,171 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value_form.php,v 1.39.2.6 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* Displays a form to allow the user to enter a new value to add
|
||||
* to the existing list of values for a multi-valued attribute.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
|
||||
|
||||
# The DN and ATTR we are working with.
|
||||
$entry = array();
|
||||
$entry['dn']['encode'] = get_request('dn','GET',true);
|
||||
$entry['dn']['string'] = urldecode($entry['dn']['encode']);
|
||||
$entry['dn']['html'] = htmlspecialchars($entry['dn']['string']);
|
||||
$entry['attr']['string'] = get_request('attr','GET',true);
|
||||
$entry['attr']['encode'] = rawurlencode($entry['attr']['string']);
|
||||
$entry['attr']['html'] = htmlspecialchars($entry['attr']['string']);
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET',true);
|
||||
$request['attr'] = get_request('attr','GET',true);
|
||||
|
||||
if (! is_null($entry['dn']['string']))
|
||||
$entry['rdn']['string'] = get_rdn($entry['dn']['string']);
|
||||
else
|
||||
$entry['rdn']['string'] = null;
|
||||
$entry['rdn']['html'] = htmlspecialchars($entry['rdn']['string']);
|
||||
# Check if the entry exists.
|
||||
if (! $request['dn'] || ! $app['server']->dnExists($request['dn']))
|
||||
error(sprintf(_('The entry (%s) does not exist.'),$request['dn']),'error','index.php');
|
||||
|
||||
/***************/
|
||||
/* get entry */
|
||||
/***************/
|
||||
|
||||
if (! $entry['dn']['string'] || ! $ldapserver->dnExists($entry['dn']['string']))
|
||||
error(sprintf(_('The entry (%s) does not exist.'),$entry['dn']['html']),'error','index.php');
|
||||
$request['page'] = new TemplateRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->setDN($request['dn']);
|
||||
$request['page']->accept(true);
|
||||
$request['template'] = $request['page']->getTemplate();
|
||||
|
||||
$tree = get_cached_item($ldapserver->server_id,'tree');
|
||||
$entry['ldap'] = null;
|
||||
if ($tree) {
|
||||
$entry['ldap'] = $tree->getEntry($entry['dn']['string']);
|
||||
/*
|
||||
if ($request['attribute']->isReadOnly())
|
||||
error(sprintf(_('The attribute (%s) is in readonly mode.'),$request['attr']),'error','index.php');
|
||||
*/
|
||||
|
||||
if (! $entry['ldap'])
|
||||
$tree->addEntry($entry['dn']['string']);
|
||||
# Render the form
|
||||
if (get_request('meth','REQUEST') != 'ajax') {
|
||||
# Render the form.
|
||||
$request['page']->drawTitle(sprintf('%s <b>%s</b> %s <b>%s</b>',_('Add new'),$request['attr'],_('value to'),get_rdn($request['dn'])));
|
||||
$request['page']->drawSubTitle();
|
||||
|
||||
$entry['ldap'] = $tree->getEntry($entry['dn']['string']);
|
||||
}
|
||||
if (! strcasecmp($request['attr'],'objectclass')) {
|
||||
echo '<form action="cmd.php" method="post" class="new_value" name="entry_form">';
|
||||
echo '<input type="hidden" name="cmd" value="add_oclass_form" />';
|
||||
|
||||
# Define the template of the entry if possible
|
||||
eval('$reader = new '.$_SESSION[APPCONFIG]->GetValue('appearance','entry_reader').'($ldapserver);');
|
||||
$reader->visit('Start', $entry['ldap']);
|
||||
|
||||
if (! $entry['ldap'] || $entry['ldap']->isReadOnly())
|
||||
error(sprintf(_('The entry (%s) is in readonly mode.'),$entry['dn']['html']),'error','index.php');
|
||||
|
||||
/*********************/
|
||||
/* attribute values */
|
||||
/*********************/
|
||||
|
||||
eval('$writer = new '.$_SESSION[APPCONFIG]->GetValue('appearance','entry_writer').'($ldapserver);');
|
||||
|
||||
$ldap['attr'] = $entry['ldap']->getAttribute($entry['attr']['string']);
|
||||
if (!$ldap['attr']) {
|
||||
# Define a new attribute for the entry
|
||||
$attributefactoryclass = $_SESSION[APPCONFIG]->GetValue('appearance','attribute_factory');
|
||||
eval('$attribute_factory = new '.$attributefactoryclass.'();');
|
||||
$ldap['attr'] = $attribute_factory->newAttribute($entry['attr']['string'], array());
|
||||
$ldap['attr']->setEntry($entry['ldap']);
|
||||
}
|
||||
$ldap['count'] = $ldap['attr']->getValueCount();
|
||||
|
||||
if ($ldap['attr']->isReadOnly())
|
||||
error(sprintf(_('The attribute (%s) is in readonly mode.'),$entry['attr']['html']),'error','index.php');
|
||||
|
||||
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value'))
|
||||
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute value')),'error','index.php');
|
||||
|
||||
if (($ldap['attr']->getValueCount() == 0) && ! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add'))
|
||||
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute')),'error','index.php');
|
||||
|
||||
$entry['attr']['oclass'] = (strcasecmp($entry['attr']['string'],'objectClass') == 0) ? true : false;
|
||||
|
||||
if ($entry['attr']['oclass']) {
|
||||
# Fetch all available objectClasses and remove those from the list that are already defined in the entry
|
||||
$ldap['oclasses'] = $ldapserver->SchemaObjectClasses();
|
||||
|
||||
foreach($ldap['attr']->getValues() as $oclass)
|
||||
unset($ldap['oclasses'][strtolower($oclass)]);
|
||||
} else {
|
||||
$ldap['schema'] = $ldapserver->getSchemaAttribute($entry['attr']['string']);
|
||||
}
|
||||
|
||||
printf('<h3 class="title">%s <b>%s</b> %s <b>%s</b></h3>',
|
||||
_('Add new'),$entry['attr']['html'],_('value to'),$entry['rdn']['html']);
|
||||
printf('<h3 class="subtitle">%s <b>%s</b> %s: <b>%s</b></h3>',
|
||||
_('Server'),$ldapserver->name,_('Distinguished Name'),$entry['dn']['html']);
|
||||
|
||||
if ($entry['attr']['oclass']) {
|
||||
echo '<form action="cmd.php" method="post" class="new_value" name="entry_form">';
|
||||
echo '<input type="hidden" name="cmd" value="add_oclass_form" />';
|
||||
} else {
|
||||
echo '<form action="cmd.php" method="post" class="new_value" name="entry_form" enctype="multipart/form-data" onSubmit="return submitForm(this)">';
|
||||
echo '<input type="hidden" name="cmd" value="update_confirm" />';
|
||||
}
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
printf('<input type="hidden" name="dn" value="%s" />',$entry['dn']['encode']);
|
||||
|
||||
echo '<center>';
|
||||
echo '<table class="forminput" border=0>';
|
||||
echo '<tr>';
|
||||
if ($ldap['count']) {
|
||||
printf('<td class="top">%s <b>%s</b> %s <b>%s</b>%s</td>',
|
||||
_('Current list of'),$ldap['count'],_('values for attribute'),$ldap['attr']->getFriendlyName(),_(':'));
|
||||
} else {
|
||||
printf('<td>%s <b>%s</b>.</td>',
|
||||
_('No current value for attribute'),$ldap['attr']->getFriendlyName());
|
||||
}
|
||||
|
||||
echo '<td>';
|
||||
if ($ldap['count']) {
|
||||
# Display current attribute values
|
||||
echo '<table border=0><tr><td>';
|
||||
for ($i = 0; $i < $ldap['count']; $i++) {
|
||||
$writer->draw('OldValue', $ldap['attr'], $i);
|
||||
$writer->draw('ReadOnlyValue', $ldap['attr'], $i);
|
||||
} else {
|
||||
echo '<form action="cmd.php" method="post" class="new_value" name="entry_form" enctype="multipart/form-data" onSubmit="return submitForm(this)">';
|
||||
if ($_SESSION[APPCONFIG]->getValue('confirm','update'))
|
||||
echo '<input type="hidden" name="cmd" value="update_confirm" />';
|
||||
else
|
||||
echo '<input type="hidden" name="cmd" value="update" />';
|
||||
}
|
||||
echo '</td></tr></table>';
|
||||
|
||||
} else {
|
||||
echo '<br /><br />';
|
||||
}
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($request['dn']));
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td class="top">%s</td>',_('Enter the value you would like to add:'));
|
||||
echo '<td>';
|
||||
echo '<center>';
|
||||
echo '<table class="forminput" border=0>';
|
||||
echo '<tr>';
|
||||
|
||||
if ($entry['attr']['oclass']) {
|
||||
# Draw objectClass selection
|
||||
echo '<table border=0><tr><td>';
|
||||
echo '<select name="new_oclass[]" multiple="true" size="15">';
|
||||
foreach ($ldap['oclasses'] as $name => $oclass) {
|
||||
# exclude any structural ones, as they'll only generate an LDAP_OBJECT_CLASS_VIOLATION
|
||||
if ($oclass->getType() == 'structural')
|
||||
continue;
|
||||
$request['attribute'] = $request['template']->getAttribute($request['attr']);
|
||||
$request['count'] = $request['attribute']->getValueCount();
|
||||
|
||||
printf('<option value="%s">%s</option>',$oclass->getName(),$oclass->getName());
|
||||
if ($request['count']) {
|
||||
printf('<td class="top">%s <b>%s</b> %s <b>%s</b>:</td>',
|
||||
_('Current list of'),$request['count'],_('values for attribute'),$request['attribute']->getFriendlyName());
|
||||
|
||||
echo '<td>';
|
||||
|
||||
# Display current attribute values
|
||||
echo '<table border=0><tr><td>';
|
||||
for ($i=0;$i<$request['count'];$i++) {
|
||||
if ($i > 0)
|
||||
echo '<br/>';
|
||||
$request['page']->draw('CurrentValue',$request['attribute'],$i);
|
||||
$request['page']->draw('HiddenValue',$request['attribute'],$i);
|
||||
}
|
||||
echo '</td></tr></table>';
|
||||
|
||||
echo '</td>';
|
||||
|
||||
} else {
|
||||
printf('<td>%s <b>%s</b>.</td>',
|
||||
_('No current value for attribute'),$request['attribute']->getFriendlyName());
|
||||
echo '<td><br /><br /></td>';
|
||||
}
|
||||
echo '</select>';
|
||||
echo '</td></tr><tr><td>';
|
||||
|
||||
echo '<br />';
|
||||
printf('<input id="save_button" type="submit" value="%s" />',_('Add new ObjectClass'));
|
||||
echo '</td></tr></table>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
if ($_SESSION[APPCONFIG]->GetValue('appearance','show_hints'))
|
||||
printf('<tr><td colspan=2><small><br /><img src="%s/light.png" alt="Hint" /><span class="hint">%s</span></small></td></tr>',
|
||||
IMGDIR,_('Note: You may be required to enter new attributes that these objectClass(es) require'));
|
||||
echo '</table>';
|
||||
echo '</center>';
|
||||
echo '</form>';
|
||||
echo '<tr>';
|
||||
printf('<td class="top">%s</td>',_('Enter the value(s) you would like to add:'));
|
||||
echo '<td>';
|
||||
|
||||
if (! strcasecmp($request['attr'],'objectclass')) {
|
||||
# If our attr is an objectClass, fetch all available objectClasses and remove those from the list that are already defined in the entry
|
||||
$socs = $app['server']->SchemaObjectClasses();
|
||||
|
||||
foreach ($request['attribute']->getValues() as $oclass)
|
||||
unset($socs[strtolower($oclass)]);
|
||||
|
||||
# Draw objectClass selection
|
||||
echo '<table border=0>';
|
||||
echo '<tr><td>';
|
||||
echo '<select name="new_values[objectclass][]" multiple="true" size="15">';
|
||||
foreach ($socs as $name => $oclass) {
|
||||
# Exclude any structural ones, that are not in the heirachy, as they'll only generate an LDAP_OBJECT_CLASS_VIOLATION
|
||||
if (($oclass->getType() == 'structural') && ! $oclass->isRelated($request['attribute']->getValues()))
|
||||
continue;
|
||||
|
||||
printf('<option value="%s">%s</option>',$oclass->getName(false),$oclass->getName(false));
|
||||
}
|
||||
echo '</select>';
|
||||
echo '</td></tr><tr><td>';
|
||||
|
||||
echo '<br />';
|
||||
printf('<input id="save_button" type="submit" value="%s" />',_('Add new ObjectClass'));
|
||||
echo '</td></tr></table>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
if ($_SESSION[APPCONFIG]->getValue('appearance','show_hints'))
|
||||
printf('<tr><td colspan=2><small><br /><img src="%s/light.png" alt="Hint" /><span class="hint">%s</span></small></td></tr>',
|
||||
IMGDIR,_('Note: You may be required to enter new attributes that these objectClass(es) require'));
|
||||
|
||||
echo '</table>';
|
||||
echo '</center>';
|
||||
echo '</form>';
|
||||
|
||||
} else {
|
||||
# Draw a blank field
|
||||
echo '<table border=0><tr><td>';
|
||||
$request['page']->draw('FormValue',$request['attribute'],$request['count']);
|
||||
echo '</td></tr><tr><td>';
|
||||
|
||||
$sattr = $app['server']->getSchemaAttribute($request['attr']);
|
||||
|
||||
if ($sattr->getDescription())
|
||||
printf('<small><b>%s:</b> %s</small><br />',_('Description'),$sattr->getDescription());
|
||||
|
||||
if ($sattr->getType())
|
||||
printf('<small><b>%s:</b> %s</small><br />',_('Syntax'),$sattr->getType());
|
||||
|
||||
if ($sattr->getMaxLength())
|
||||
printf('<small><b>%s:</b> %s %s</small><br />',
|
||||
_('Maximum Length'),number_format($sattr->getMaxLength()),_('characters'));
|
||||
|
||||
echo '<br />';
|
||||
printf('<input type="submit" id="save_button" name="submit" value="%s" />',_('Add New Value'));
|
||||
echo '</td></tr></table>';
|
||||
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
echo '</center>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
} else {
|
||||
# Draw a blank field
|
||||
echo '<table border=0><tr><td>';
|
||||
$writer->draw('BlankValue',$ldap['attr'],$ldap['count'],$reader);
|
||||
echo '</td></tr><tr><td>';
|
||||
if (is_null($attribute = $request['template']->getAttribute($request['attr']))) {
|
||||
$request['template']->addAttribute($request['attr'],array('values'=>array()));
|
||||
$attribute = $request['template']->getAttribute($request['attr']);
|
||||
$attribute->show();
|
||||
|
||||
if ($ldap['schema']->getDescription())
|
||||
printf('<small><b>%s:</b> %s</small><br />',_('Description'),$ldap['schema']->getDescription());
|
||||
echo '<table class="entry" cellspacing="0" align="center" border=0>';
|
||||
$request['page']->draw('Template',$attribute);
|
||||
$request['page']->draw('Javascript',$attribute);
|
||||
echo '</table>';
|
||||
|
||||
if ($ldap['schema']->getType())
|
||||
printf('<small><b>%s:</b> %s</small><br />',_('Syntax'),$ldap['schema']->getType());
|
||||
|
||||
if ($ldap['schema']->getMaxLength())
|
||||
printf('<small><b>%s:</b> %s %s</small><br />',
|
||||
_('Maximum Length'),number_format($ldap['schema']->getMaxLength()),_('characters'));
|
||||
|
||||
echo '<br />';
|
||||
printf('<input type="submit" id="save_button" name="submit" value="%s" />',_('Add New Value'));
|
||||
echo '</td></tr></table>';
|
||||
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
echo '</center>';
|
||||
echo '</form>';
|
||||
|
||||
# Javascript
|
||||
echo '<script type="text/javascript" language="javascript">
|
||||
function pla_getComponentById(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
function pla_getComponentsByName(name) {
|
||||
return document.getElementsByName(name);
|
||||
}
|
||||
|
||||
function pla_getComponentValue(component) {
|
||||
if (component.type == "checkbox") {
|
||||
if (component.checked) return component.value;
|
||||
} else if (component.type == "select-one") {
|
||||
if (component.selectedIndex >= 0) return component.options[component.selectedIndex].value;
|
||||
} else if (component.type == "select-multiple") {
|
||||
if (component.selectedIndex >= 0) return component.options[component.selectedIndex].value;
|
||||
} else if (component.type == undefined) { // option
|
||||
if (component.selected) return component.value;
|
||||
} else {
|
||||
return component.value;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function pla_setComponentValue(component, value) {
|
||||
if (component.type == "checkbox") {
|
||||
if (component.value == value) component.checked = true;
|
||||
else component.checked = false;
|
||||
} else if (component.type == "select-one") {
|
||||
for (var i = 0; i < component.options.length; i++) {
|
||||
if (component.options[i].value == value) component.options[i].selected = true;
|
||||
}
|
||||
} else if (component.type == "select-multiple") {
|
||||
for (var i = 0; i < component.options.length; i++) {
|
||||
if (component.options[i].value == value) component.options[i].selected = true;
|
||||
}
|
||||
} else if (component.type == undefined) { // option
|
||||
if (component.value == value) component.selected = true;
|
||||
else component.selected = false;
|
||||
} else { // text, textarea
|
||||
component.value = value;
|
||||
}
|
||||
}</script>';
|
||||
|
||||
echo '<script type="text/javascript" language="javascript">
|
||||
function getAttributeComponents(prefix, name) {
|
||||
var components = new Array();
|
||||
var i = 0;
|
||||
var j = 0;
|
||||
var c = pla_getComponentsByName(prefix + "_values[" + name + "][" + j + "]");
|
||||
while (c && (c.length > 0)) {
|
||||
for (var k = 0; k < c.length; k++) {
|
||||
components[i++] = c[k];
|
||||
}
|
||||
++j;
|
||||
c = pla_getComponentsByName(prefix + "_values[" + name + "][" + j + "]");
|
||||
}
|
||||
c = pla_getComponentsByName(prefix + "_values[" + name + "][]");
|
||||
if (c && (c.length > 0)) {
|
||||
for (var k = 0; k < c.length; k++) {
|
||||
components[i++] = c[k];
|
||||
}
|
||||
}
|
||||
return components;
|
||||
}
|
||||
function getAttributeValues(prefix, name) {
|
||||
var components = getAttributeComponents(prefix, name);
|
||||
var values = new Array();
|
||||
for (var k = 0; k < components.length; k++) {
|
||||
var val = pla_getComponentValue(components[k]);
|
||||
if (val) values[values.length] = val;
|
||||
}
|
||||
return values;
|
||||
}</script>';
|
||||
|
||||
echo '<script type="text/javascript" language="javascript">
|
||||
function validateForm(silence) {
|
||||
var i = 0;
|
||||
var valid = true;
|
||||
var components = null;
|
||||
components = getAttributeComponents("new", "'.$ldap['attr']->getName().'");
|
||||
for (i = 0; i < components.length; i++) {
|
||||
if (window.validate_'.$ldap['attr']->getName().') {
|
||||
valid = (!validate_'.$ldap['attr']->getName().'(components[i], silence) || !valid) ? false : true;
|
||||
}
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
</script>';
|
||||
|
||||
echo '<script type="text/javascript" language="javascript">
|
||||
function submitForm(form) {
|
||||
for (var i = 0; i < form.elements.length; i++) {
|
||||
form.elements[i].blur();
|
||||
}
|
||||
return validateForm(true);
|
||||
}
|
||||
function alertError(err, silence) {
|
||||
if (!silence) alert(err);
|
||||
}
|
||||
</script>';
|
||||
|
||||
echo '<script type="text/javascript" language="javascript">
|
||||
var attrTrace;
|
||||
function fill(id, value) {
|
||||
attrTrace = new Array();
|
||||
fillRec(id, value);
|
||||
}
|
||||
function fillRec(id, value) {
|
||||
if (attrTrace[id] == 1) {
|
||||
return;
|
||||
} else {
|
||||
var pre = "";
|
||||
var suf = "";
|
||||
var i;
|
||||
attrTrace[id] = 1;
|
||||
pla_setComponentValue(pla_getComponentById(id), value);
|
||||
// here comes template-specific implementation, generated by php
|
||||
if (false) {}';
|
||||
$attr = $ldap['attr']->getName();
|
||||
echo "\t\t\telse if ((i = id.indexOf('_".$attr."_')) >= 0) {\n";
|
||||
echo "\t\t\t\tpre = id.substring(0, i+1);\n";
|
||||
echo "\t\t\t\tsuf = id.substring(i + 1 + '$attr'.length, id.length);\n";
|
||||
$writer->draw('FillJavascript', $ldap['attr'], 'id', 'value');
|
||||
echo "\t\t\t}\n";
|
||||
echo '}}</script>';
|
||||
|
||||
$writer->draw('Javascript', $ldap['attr']);
|
||||
|
||||
echo '<script type="text/javascript" language="javascript">
|
||||
validateForm(true);
|
||||
</script>';
|
||||
} else {
|
||||
$request['count'] = $attribute->getValueCount();
|
||||
$request['page']->draw('FormReadWriteValue',$attribute,$request['count']);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -1,42 +1,74 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/cmd.php,v 1.3.2.3 2008/01/10 12:28:34 wurley Exp $
|
||||
/**
|
||||
* Main command page for phpLDAPadmin
|
||||
* All pages are rendered through this script.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
require_once './common.php';
|
||||
|
||||
$www = array();
|
||||
$www['cmd'] = get_request('cmd','REQUEST');
|
||||
$www['meth'] = get_request('meth','REQUEST');
|
||||
|
||||
ob_start();
|
||||
$file = '';
|
||||
|
||||
switch ($www['cmd']) {
|
||||
case '_debug' :
|
||||
case '_debug':
|
||||
debug_dump($_REQUEST,1);
|
||||
break;
|
||||
|
||||
default :
|
||||
default:
|
||||
if (defined('HOOKSDIR') && file_exists(HOOKSDIR.$www['cmd'].'.php'))
|
||||
$file = HOOKSDIR.$www['cmd'].'.php';
|
||||
$app['script_cmd'] = HOOKSDIR.$www['cmd'].'.php';
|
||||
|
||||
elseif (defined('HTDOCDIR') && file_exists(HTDOCDIR.$www['cmd'].'.php'))
|
||||
$file = HTDOCDIR.$www['cmd'].'.php';
|
||||
$app['script_cmd'] = HTDOCDIR.$www['cmd'].'.php';
|
||||
|
||||
elseif (file_exists('welcome.php'))
|
||||
$file = 'welcome.php';
|
||||
$app['script_cmd'] = 'welcome.php';
|
||||
|
||||
else
|
||||
$app['script_cmd'] = null;
|
||||
}
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Ready to render page for command [%s,%s].',128,__FILE__,__LINE__,__METHOD__,$www['cmd'],$file);
|
||||
debug_log('Ready to render page for command [%s,%s].',128,0,__FILE__,__LINE__,__METHOD__,$www['cmd'],$app['script_cmd']);
|
||||
|
||||
# Create page.
|
||||
$www['page'] = new page($ldapserver->server_id);
|
||||
# Set the index so that we render the right server tree.
|
||||
$www['page'] = new page($app['server']->getIndex());
|
||||
|
||||
if ($file)
|
||||
include $file;
|
||||
# See if we can render the command
|
||||
if (trim($www['cmd'])) {
|
||||
# If this is a READ-WRITE operation, the LDAP server must not be in READ-ONLY mode.
|
||||
if ($app['server']->isReadOnly() && ! in_array(get_request('cmd','REQUEST'),$app['readwrite_cmds']))
|
||||
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
|
||||
|
||||
# If this command has been disabled by the config.
|
||||
if (! $_SESSION[APPCONFIG]->isCommandAvailable('script',$www['cmd'])) {
|
||||
system_message(array('title'=>_('Command disabled by the server configuration'),
|
||||
_('Error'),'body'=>sprintf('%s: <b>%s</b>.',_('The command could not be run'),$www['cmd']),'type'=>'error'),'index.php');
|
||||
|
||||
$app['script_cmd'] = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($app['script_cmd'])
|
||||
include $app['script_cmd'];
|
||||
|
||||
# Refresh a frame - this is so that one frame can trigger another frame to be refreshed.
|
||||
if (isAjaxEnabled() && get_request('refresh','REQUEST') && get_request('refresh','REQUEST') != get_request('frame','REQUEST')) {
|
||||
echo '<script type="text/javascript" language="javascript">';
|
||||
printf("ajDISPLAY('%s','cmd=refresh&server_id=%s&meth=ajax&noheader=%s','%s');",
|
||||
get_request('refresh','REQUEST'),$app['server']->getIndex(),get_request('noheader','REQUEST',false,0),_('Auto refresh'));
|
||||
echo '</script>';
|
||||
}
|
||||
|
||||
# Capture the output and put into the body of the page.
|
||||
$www['body'] = new block();
|
||||
@@ -44,8 +76,8 @@ $www['body']->SetBody(ob_get_contents());
|
||||
$www['page']->block_add('body',$www['body']);
|
||||
ob_end_clean();
|
||||
|
||||
if ($www['meth'] == 'get_body')
|
||||
$www['page']->body(true);
|
||||
if ($www['meth'] == 'ajax')
|
||||
$www['page']->show(get_request('frame','REQUEST',false,'BODY'),true,get_request('raw','REQUEST',false,false));
|
||||
else
|
||||
$www['page']->display();
|
||||
?>
|
||||
|
@@ -1,26 +1,27 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/collapse.php,v 1.16 2007/12/15 07:50:30 wurley Exp $
|
||||
|
||||
/**
|
||||
* This script alters the session variable 'tree', collapsing it
|
||||
* at the dn specified in the query string.
|
||||
*
|
||||
* Note: this script is equal and opposite to expand.php
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Tree
|
||||
* @see expand.php
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$dn = get_request('dn','GET',true);
|
||||
$tree = get_cached_item($ldapserver->server_id,'tree');
|
||||
$tree = get_cached_item($app['server']->getIndex(),'tree');
|
||||
$entry = $tree->getEntry($dn);
|
||||
$entry->close();
|
||||
set_cached_item($ldapserver->server_id,'tree','null',$tree);
|
||||
set_cached_item($app['server']->getIndex(),'tree','null',$tree);
|
||||
|
||||
header(sprintf('Location:index.php?server_id=%s&junk=%s#%s%s',
|
||||
$ldapserver->server_id,random_junk(),htmlid($ldapserver->server_id,$dn),pla_session_param()));
|
||||
$app['server']->getIndex(),random_junk(),htmlid($app['server']->getIndex(),$dn),app_session_param()));
|
||||
die();
|
||||
?>
|
||||
|
@@ -1,11 +1,13 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/common.php,v 1.3.2.3 2007/12/26 08:21:10 wurley Exp $
|
||||
|
||||
/**
|
||||
* This script provides a convienent method to call the proper common.php
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
# This is just here to provide a convenient link back to the proper common.php
|
||||
/**
|
||||
*/
|
||||
|
||||
if (! defined('LIBDIR'))
|
||||
define('LIBDIR',sprintf('%s/',realpath('../lib/')));
|
||||
require_once LIBDIR.'common.php';
|
||||
|
@@ -1,520 +1,187 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/compare.php,v 1.16.2.7 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* Compare two DNs - the destination DN is editable.
|
||||
* Compares two DN entries side by side.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
require_once './common.php';
|
||||
/**
|
||||
*/
|
||||
|
||||
$dn_src = get_request('dn_src');
|
||||
$dn_dst = get_request('dn_dst');
|
||||
require './common.php';
|
||||
|
||||
$encoded_dn_src = rawurlencode($dn_src);
|
||||
$encoded_dn_dst = rawurlencode($dn_dst);
|
||||
# The DNs we are working with
|
||||
$request = array();
|
||||
$request['dnSRC'] = get_request('dn_src');
|
||||
$request['dnDST'] = get_request('dn_dst');
|
||||
|
||||
$server_id_src = get_request('server_id_src');
|
||||
$server_id_dst = get_request('server_id_dst');
|
||||
$ldap = array();
|
||||
$ldap['SRC'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_src'));
|
||||
$ldap['DST'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_dst'));
|
||||
|
||||
$ldapserver_src = $_SESSION[APPCONFIG]->ldapservers->Instance($server_id_src);
|
||||
if (! $ldapserver_src->haveAuthInfo())
|
||||
error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php');
|
||||
if (! $ldap['SRC']->dnExists($request['dnSRC']))
|
||||
error(sprintf('%s (%s)',_('No such entry.'),pretty_print_dn($request['dnSRC'])),'error','index.php');
|
||||
|
||||
$ldapserver_dst = $_SESSION[APPCONFIG]->ldapservers->Instance($server_id_dst);
|
||||
if (! $ldapserver_src->haveAuthInfo())
|
||||
error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php');
|
||||
if (! $ldap['DST']->dnExists($request['dnDST']))
|
||||
error(sprintf('%s (%s)',_('No such entry.'),pretty_print_dn($request['dnDST'])),'error','index.php');
|
||||
|
||||
if (! $ldapserver_src->dnExists($dn_src))
|
||||
error(sprintf('%s (%s)',_('No such entry.'),pretty_print_dn($dn_src)),'error','index.php');
|
||||
$request['pageSRC'] = new PageRender($ldap['SRC']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['pageSRC']->setDN($request['dnSRC']);
|
||||
$request['pageSRC']->accept();
|
||||
$request['templateSRC'] = $request['pageSRC']->getTemplate();
|
||||
|
||||
if (! $ldapserver_dst->dnExists($dn_dst))
|
||||
error(sprintf('%s (%s)',_('No such entry.'),pretty_print_dn($dn_dst)),'error','index.php');
|
||||
|
||||
$attrs_src = $ldapserver_src->getDNAttrs($dn_src,false,$_SESSION[APPCONFIG]->GetValue('deref','view'));
|
||||
$attrs_dst = $ldapserver_dst->getDNAttrs($dn_dst,false,$_SESSION[APPCONFIG]->GetValue('deref','view'));
|
||||
$request['pageDST'] = new PageRender($ldap['DST']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['pageDST']->setDN($request['dnDST']);
|
||||
$request['pageDST']->accept();
|
||||
$request['templateDST'] = $request['pageDST']->getTemplate();
|
||||
|
||||
# Get a list of all attributes.
|
||||
$attrs_all = array_keys($attrs_src);
|
||||
foreach ($attrs_dst as $key => $val)
|
||||
if (! in_array($key,$attrs_all))
|
||||
$attrs_all[] = $key;
|
||||
$attrs_all = array_unique(array_merge($request['templateSRC']->getAttributeNames(),$request['templateDST']->getAttributeNames()));
|
||||
|
||||
printf('<h3 class="title">%s</h3>',_('Comparing the following DNs'));
|
||||
$request['pageSRC']->drawTitle(_('Comparing the following DNs'));
|
||||
|
||||
echo '<table class="entry" width=100% border=0>';
|
||||
echo '<tr>';
|
||||
printf('<td colspan=2 width=20%%><h3 class="subtitle">%s<br /> </h3></td>',_('Attribute'));
|
||||
echo '<br/>';
|
||||
|
||||
printf('<td colspan=2 width=40%%><h3 class="subtitle">%s: <b>%s</b><br />%s: <b>%s</b></h3></td>',
|
||||
_('Server'),$ldapserver_src->name,_('Distinguished Name'),htmlspecialchars($dn_src));
|
||||
echo '<table class="entry" width=100% border=0>';
|
||||
echo '<tr class="heading">';
|
||||
|
||||
printf('<td colspan=2 width=40%%><h3 class="subtitle">%s: <b>%s</b><br />%s: <b>%s</b></h3></td>',
|
||||
_('Server'),$ldapserver_dst->name,_('Distinguished Name'),htmlspecialchars($dn_dst));
|
||||
$href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',
|
||||
$ldap['SRC']->getIndex(),rawurlencode($request['dnSRC']));
|
||||
printf('<td colspan=2 width=40%%>%s: <b>%s</b><br />%s: <b><a href="%s">%s</a></b></td>',
|
||||
_('Server'),$ldap['SRC']->getName(),_('Distinguished Name'),
|
||||
htmlspecialchars($href),$request['dnSRC']);
|
||||
|
||||
echo '</tr>';
|
||||
$href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',
|
||||
$ldap['DST']->getIndex(),rawurlencode($request['dnDST']));
|
||||
printf('<td colspan=2 width=40%%>%s: <b>%s</b><br />%s: <b><a href="%s">%s</a></b></td>',
|
||||
_('Server'),$ldap['DST']->getName(),_('Distinguished Name'),
|
||||
htmlspecialchars($href),$request['dnDST']);
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td colspan=6 align=right>';
|
||||
echo '<form action="cmd.php?cmd=compare" method="post" name="compare_form">';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
printf('<input type="hidden" name="server_id_src" value="%s" />',$ldapserver_dst->server_id);
|
||||
printf('<input type="hidden" name="server_id_dst" value="%s" />',$ldapserver_src->server_id);
|
||||
printf('<input type="hidden" name="dn_src" value="%s" />',htmlspecialchars($dn_dst));
|
||||
printf('<input type="hidden" name="dn_dst" value="%s" />',htmlspecialchars($dn_src));
|
||||
printf('<input type="submit" value="%s" />',_('Switch Entry'));
|
||||
echo '</form>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</tr>';
|
||||
|
||||
if (! $attrs_all || ! is_array($attrs_all)) {
|
||||
printf('<tr><td colspan="2">(%s)</td></tr>',_('This entry has no attributes'));
|
||||
echo '<tr>';
|
||||
echo '<td colspan=4 align=right>';
|
||||
echo '<form action="cmd.php?cmd=compare" method="post" name="compare_form">';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="server_id_src" value="%s" />',$ldap['DST']->getIndex());
|
||||
printf('<input type="hidden" name="server_id_dst" value="%s" />',$ldap['SRC']->getIndex());
|
||||
printf('<input type="hidden" name="dn_src" value="%s" />',htmlspecialchars($request['dnDST']));
|
||||
printf('<input type="hidden" name="dn_dst" value="%s" />',htmlspecialchars($request['dnSRC']));
|
||||
printf('<input type="submit" value="%s" />',_('Switch Entry'));
|
||||
echo '</form>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
if (! is_array($attrs_all) || ! count($attrs_all)) {
|
||||
printf('<tr><td colspan="4">(%s)</td></tr>',_('This entry has no attributes'));
|
||||
print '</table>';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sort($attrs_all);
|
||||
$formdisplayed = false;
|
||||
|
||||
# Work through each of the attributes.
|
||||
foreach ($attrs_all as $attr) {
|
||||
# If this is the DN, get the next attribute.
|
||||
if (! strcasecmp($attr,'dn'))
|
||||
continue;
|
||||
|
||||
# Has the config.php specified that this attribute is to be hidden or shown?
|
||||
if ($ldapserver_src->isAttrHidden($attr) || $ldapserver_dst->isAttrHidden($attr))
|
||||
if ($ldap['SRC']->isAttrHidden($attr) || $ldap['DST']->isAttrHidden($attr))
|
||||
continue;
|
||||
|
||||
$schema_attr_src = $ldapserver_src->getSchemaAttribute($attr,$dn_src);
|
||||
$schema_attr_dst = $ldapserver_dst->getSchemaAttribute($attr,$dn_dst);
|
||||
$attributeSRC = $request['templateSRC']->getAttribute($attr);
|
||||
$attributeDST = $request['templateDST']->getAttribute($attr);
|
||||
|
||||
# Get the values and see if they are the same.
|
||||
if (isset($attrs_src[$attr]) && isset($attrs_dst[$attr]) && $attrs_src[$attr] === $attrs_dst[$attr])
|
||||
if ($attributeSRC && $attributeDST && ($attributeSRC->getValues() == $attributeDST->getValues()))
|
||||
echo '<tr>';
|
||||
else
|
||||
echo '<tr class="updated">';
|
||||
echo '<tr>';
|
||||
|
||||
foreach (array('src','dst') as $side) {
|
||||
|
||||
# Setup the $attr_note, which will be displayed to the right of the attr name (if any)
|
||||
$attr_note = ' ';
|
||||
|
||||
# is there a user-friendly translation available for this attribute?
|
||||
if ($_SESSION[APPCONFIG]->haveFriendlyName($attr)) {
|
||||
$attr_display = $_SESSION[APPCONFIG]->getFriendlyName($attr);
|
||||
$attr_note = sprintf('<acronym title="%s: \'%s\' %s \'%s\'">%s</acronym>',_('Note'),$attr_display,_('is an alias for'),$attr,_('alias'));
|
||||
|
||||
} else {
|
||||
$attr_display = $attr;
|
||||
$attr_note = ' ';
|
||||
}
|
||||
|
||||
# is this attribute required by an objectClass?
|
||||
$required_by = '';
|
||||
# If we are on the source side, show the attribute name.
|
||||
switch ($side) {
|
||||
case 'src':
|
||||
$ldapserver = $ldapserver_src;
|
||||
if ($schema_attr_src)
|
||||
foreach ($schema_attr_src->getRequiredByObjectClasses() as $required)
|
||||
if (isset($attrs_src['objectClass']) && in_array(strtolower($required),arrayLower($attrs_src['objectClass'])))
|
||||
$required_by .= $required . ' ';
|
||||
if ($attributeSRC) {
|
||||
echo '<td class="title">';
|
||||
$request['pageSRC']->draw('Name',$attributeSRC);
|
||||
echo '</td>';
|
||||
|
||||
# It seems that some LDAP servers (Domino) returns attributes in lower case?
|
||||
elseif (isset($attrs_src['objectclass']) && in_array(strtolower($required),arrayLower($attrs_src['objectclass'])))
|
||||
$required_by .= $required . ' ';
|
||||
if ($request['pageSRC']->getServerID() == $request['pageDST']->getServerID())
|
||||
echo '<td class="title"> </td>';
|
||||
|
||||
else {
|
||||
echo '<td class="note" align="right">';
|
||||
$request['pageSRC']->draw('Notes',$attributeSRC);
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
} else {
|
||||
echo '<td colspan=2> </td>';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'dst':
|
||||
$ldapserver = $ldapserver_dst;
|
||||
if ($schema_attr_dst)
|
||||
foreach ($schema_attr_dst->getRequiredByObjectClasses() as $required)
|
||||
if (isset($attrs_dst['objectClass']) && in_array(strtolower($required),arrayLower($attrs_dst['objectClass'])))
|
||||
$required_by .= $required . ' ';
|
||||
if ($attributeDST) {
|
||||
if ($attributeSRC && ($request['pageSRC']->getServerID() == $request['pageDST']->getServerID()))
|
||||
echo '<td class="title"> </td>';
|
||||
|
||||
else {
|
||||
echo '<td class="title" >';
|
||||
$request['pageDST']->draw('Name',$attributeDST);
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
echo '<td class="note" align="right">';
|
||||
$request['pageDST']->draw('Notes',$attributeDST);
|
||||
echo '</td>';
|
||||
|
||||
} else {
|
||||
echo '<td colspan=2> </td>';
|
||||
}
|
||||
|
||||
# It seems that some LDAP servers (Domino) returns attributes in lower case?
|
||||
elseif (isset($attrs_dst['objectclass']) && in_array(strtolower($required),arrayLower($attrs_dst['objectclass'])))
|
||||
$required_by .= $required . ' ';
|
||||
break;
|
||||
}
|
||||
|
||||
# If we are on the source side, show the attr
|
||||
if ($side == 'src') {
|
||||
echo '<td class="title">';
|
||||
$schema_href = sprintf('cmd.php?cmd=schema&server_id=%s&view=attributes&viewvalue=%s',$server_id_src,real_attr_name($attr));
|
||||
printf('<a title="%s" href="%s">%s</a>',sprintf(_('Click to view the schema definition for attribute type \'%s\''),$attr),$schema_href,$attr_display);
|
||||
echo '</td>';
|
||||
|
||||
printf('<td class="note"><sup><small>%s</small></sup></td>',$attr_note);
|
||||
}
|
||||
|
||||
echo '<td colspan=2 class="note">';
|
||||
|
||||
# Create our form if the dst is editable.
|
||||
if ($side == 'dst' && ! $ldapserver_dst->isReadOnly() && ! $formdisplayed) {
|
||||
$formdisplayed = true;
|
||||
echo '<form action="cmd.php?cmd=update_confirm" method="post" name="edit_form">';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver_dst->server_id);
|
||||
printf('<input type="hidden" name="dn" value="%s" />',$dn_dst);
|
||||
}
|
||||
|
||||
if ($required_by)
|
||||
printf('<sup><small><acronym title="%s">%s</acronym></small></sup>',sprintf(_('Required attribute for objectClass(es) %s'),$required_by),_('required'));
|
||||
echo '</td>';
|
||||
|
||||
if ($ldapserver->isAttrReadOnly($attr))
|
||||
printf('<small>(<acronym title="%s">%s</acronym>)</small>',_('This attribute has been flagged as read only by the phpLDAPadmin administrator'),_('read only'));
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
echo "\n\n";
|
||||
|
||||
if (isset($attrs_src[$attr]) && isset($attrs_dst[$attr]) && $attrs_src[$attr] === $attrs_dst[$attr])
|
||||
echo '<tr>';
|
||||
# Get the values and see if they are the same.
|
||||
if ($attributeSRC && $attributeDST && ($attributeSRC->getValues() == $attributeDST->getValues()))
|
||||
echo '<tr style="background-color: #F0F0F0;">';
|
||||
else
|
||||
echo '<tr class="updated">';
|
||||
echo '<tr>';
|
||||
|
||||
foreach (array('src','dst') as $side) {
|
||||
$vals = null;
|
||||
|
||||
# If this attribute isnt set, then show a blank.
|
||||
$toJump = 0;
|
||||
switch ($side) {
|
||||
case 'src':
|
||||
print '<td colspan=2> </td><td class="value">';
|
||||
echo '<td class="value" colspan=2><table border=0>';
|
||||
|
||||
if (! isset($attrs_src[$attr])) {
|
||||
echo "<small><". _('No Value')."></small></td>";
|
||||
$toJump = 1;
|
||||
continue;
|
||||
} else
|
||||
$vals = $attrs_src[$attr];
|
||||
if ($attributeSRC && count($attributeSRC->getValues()))
|
||||
$request['pageSRC']->draw('CurrentValues',$attributeSRC);
|
||||
else
|
||||
echo '<tr><td> </td></tr>';
|
||||
|
||||
echo '</table></td>';
|
||||
|
||||
$ldapserver = $ldapserver_src;
|
||||
break;
|
||||
|
||||
case 'dst':
|
||||
print '<td colspan=2> </td><td class="value">';
|
||||
echo '<td class="value" colspan=2><table>';
|
||||
|
||||
if (! isset($attrs_dst[$attr])) {
|
||||
echo "<small><". _('No Value')."></small></td>";
|
||||
$toJump = 1;
|
||||
continue;
|
||||
} else
|
||||
$vals = $attrs_dst[$attr];
|
||||
if ($attributeDST && count($attributeDST->getValues()))
|
||||
$request['pageDST']->draw('CurrentValues',$attributeDST);
|
||||
else
|
||||
echo '<tr><td> </td></tr>';
|
||||
|
||||
echo '</table></td>';
|
||||
|
||||
$ldapserver = $ldapserver_dst;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($toJump)
|
||||
continue;
|
||||
|
||||
if (! is_array($vals))
|
||||
$vals = array($vals);
|
||||
|
||||
# Is this attribute a jpegPhoto?
|
||||
if ($ldapserver->isJpegPhoto($attr)) {
|
||||
|
||||
switch ($side) {
|
||||
case 'src':
|
||||
# Don't draw the delete buttons if there is more than one jpegPhoto (phpLDAPadmin can't handle this case yet)
|
||||
draw_jpeg_photos($ldapserver,$dn_src,$attr,false);
|
||||
break;
|
||||
|
||||
case 'dst':
|
||||
if ($ldapserver_dst->isReadOnly() || $ldapserver_dst->isAttrReadOnly($attr))
|
||||
draw_jpeg_photos($ldapserver,$dn_dst,$attr,false);
|
||||
else
|
||||
draw_jpeg_photos($ldapserver,$dn_dst,$attr,true);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
# proceed to the next attribute
|
||||
echo '</td>'."\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
# Is this attribute binary?
|
||||
if ($ldapserver->isAttrBinary($attr)) {
|
||||
switch ($side) {
|
||||
case 'src':
|
||||
$href = sprintf("download_binary_attr.php?server_id=%s&dn=%s&attr=%s",$ldapserver->server_id,$encoded_dn_src,$attr);
|
||||
break;
|
||||
|
||||
case 'dst':
|
||||
$href = sprintf("download_binary_attr.php?server_id=%s&dn=%s&attr=%s",$ldapserver->server_id,$encoded_dn_dst,$attr);
|
||||
break;
|
||||
}
|
||||
|
||||
echo '<small>';
|
||||
echo _('Binary value');
|
||||
echo '<br />';
|
||||
|
||||
if (count($vals) > 1)
|
||||
for ($i=1; $i<=count($vals); $i++)
|
||||
printf('<a href="%s&value_num=%s"><img src="%s/save.png" /> %s(%s)</a><br />',$href,$i,_('download value'),IMGDIR,$i);
|
||||
else
|
||||
printf('<a href="%s"><img src="%s/save.png" /> %s</a><br />',$href,IMGDIR,_('download value'));
|
||||
|
||||
if ($side == 'dst' && ! $ldapserver_dst->isReadOnly() && ! $ldapserver->isAttrReadOnly($attr))
|
||||
printf('<a href="javascript:deleteAttribute(\'%s\');" style="color:red;"><img src="%s/trash.png" /> %s</a>',$attr,IMGDIR,_('delete attribute'));
|
||||
|
||||
echo '</small>';
|
||||
echo '</td>';
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
# Note: at this point, the attribute must be text-based (not binary or jpeg)
|
||||
|
||||
/*
|
||||
* If this server is in read-only mode or this attribute is configured as read_only,
|
||||
* simply draw the attribute values and continue.
|
||||
*/
|
||||
|
||||
if ($side == 'dst' && ($ldapserver->isReadOnly() || $ldapserver->isAttrReadOnly($attr))) {
|
||||
if (is_array($vals)) {
|
||||
foreach ($vals as $i => $val) {
|
||||
if (trim($val) == '')
|
||||
printf('<span style="color:red">[%s]</span><br />',_('empty'));
|
||||
|
||||
elseif (strcasecmp($attr,'userPassword') == 0 && $_SESSION[APPCONFIG]->GetValue('appearance','obfuscate_password_display'))
|
||||
echo preg_replace('/./','*',$val).'<br />';
|
||||
|
||||
else
|
||||
echo htmlspecialchars($val).'<br />';
|
||||
}
|
||||
|
||||
# @todo: redundant - $vals is always an array.
|
||||
} else {
|
||||
if (strcasecmp($attr,'userPassword') == 0 && $_SESSION[APPCONFIG]->GetValue('appearance','obfuscate_password_display'))
|
||||
echo preg_replace('/./','*',$vals).'<br />';
|
||||
else
|
||||
echo $vals.'<br />';
|
||||
}
|
||||
echo '</td>';
|
||||
continue;
|
||||
}
|
||||
|
||||
# Is this a userPassword attribute?
|
||||
if (! strcasecmp($attr,'userpassword')) {
|
||||
$user_password = $vals[0];
|
||||
$enc_type = get_enc_type($user_password);
|
||||
|
||||
# Set the default hashing type if the password is blank (must be newly created)
|
||||
if ($user_password == '') {
|
||||
$enc_type = get_default_hash($server_id);
|
||||
}
|
||||
|
||||
if ($side == 'dst') {
|
||||
printf('<input type="hidden" name="old_values[userpassword]" value="%s" />',htmlspecialchars($user_password));
|
||||
echo '<!-- Special case of enc_type to detect changes when user changes enc_type but not the password value -->';
|
||||
printf('<input size="38" type="hidden" name="old_enc_type" value="%s" />',$enc_type == '' ? 'clear' : $enc_type);
|
||||
}
|
||||
|
||||
if (obfuscate_password_display($enc_type))
|
||||
echo htmlspecialchars(preg_replace('/./','*',$user_password));
|
||||
else
|
||||
echo htmlspecialchars($user_password);
|
||||
|
||||
echo '<br />';
|
||||
|
||||
if ($side == 'dst') {
|
||||
printf('<input style="width: 260px" type="password" name="new_values[userpassword]" value="%s" />',htmlspecialchars($user_password));
|
||||
echo enc_type_select_list($enc_type,'enc','userpassword',0);
|
||||
}
|
||||
|
||||
echo '<br />';
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
<!--
|
||||
function passwordComparePopup()
|
||||
{
|
||||
mywindow = open('password_checker.php','myname','resizable=no,width=450,height=200,scrollbars=1');
|
||||
mywindow.location.href = 'password_checker.php?hash=<?php echo base64_encode($user_password); ?>&base64=true';
|
||||
if (mywindow.opener == null)
|
||||
mywindow.opener = self;
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
<?php
|
||||
|
||||
printf('<small><a href="javascript:passwordComparePopup()">%s</a></small>',_('Check password'));
|
||||
|
||||
echo '</td>';
|
||||
continue;
|
||||
}
|
||||
|
||||
# Is this a boolean attribute?
|
||||
if ($ldapserver->isAttrBoolean($attr)) {
|
||||
$val = $vals[0];
|
||||
|
||||
if ($side = 'dst') {
|
||||
printf('<input type="hidden" name="old_values[%s]" value="%s" />',htmlspecialchars($attr),htmlspecialchars($val));
|
||||
|
||||
printf('<select name="new_values[%s]">',htmlspecialchars($attr));
|
||||
printf('<option value="TRUE"%s>%s</option>',$val == 'TRUE' ? ' selected' : '',_('true'));
|
||||
printf('<option value="FALSE"%s>%s</option>',$val == 'FALSE' ? ' selected' : '',_('false'));
|
||||
printf('<option value="">(%s)</option>',_('none, remove value'));
|
||||
echo '</select>';
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
continue;
|
||||
}
|
||||
|
||||
# End of special case attributes (non plain text).
|
||||
foreach ($vals as $i => $val) {
|
||||
|
||||
if ($side == 'dst') {
|
||||
$input_name = sprintf('new_values[%s][%s]',htmlspecialchars($attr),$i);
|
||||
|
||||
/* We smack an id="..." tag in here that doesn't have [][] in it to allow the
|
||||
* draw_chooser_link() to identify it after the user clicks.*/
|
||||
$input_id = sprintf('"new_values_%s_%s',htmlspecialchars($attr),$i);
|
||||
|
||||
echo '<!-- The old_values array will let update.php know if the entry contents changed
|
||||
between the time the user loaded this page and saved their changes. -->';
|
||||
printf('<input type="hidden" name="old_values[%s][%s]" value="%s" />',htmlspecialchars($attr),$i,htmlspecialchars($val));
|
||||
}
|
||||
|
||||
# Is this value is a structural objectClass, make it read-only
|
||||
if (0 == strcasecmp($attr,'objectClass')) {
|
||||
|
||||
printf('<a title="%s" href="cmd.php?cmd=schema&server_id=%s&view=objectClasses&viewvalue=%s"><img src="%s/info.png" /></a>',
|
||||
_('View the schema description for this objectClass'),$ldapserver->server_id,htmlspecialchars($val),IMGDIR);
|
||||
|
||||
$schema_object = $ldapserver->getSchemaObjectClass($val);
|
||||
|
||||
if ($schema_object->getType() == 'structural') {
|
||||
printf('%s <small>(<acronym title="%s">%s</acronym>)</small><br />',
|
||||
$val,_('This is a structural ObjectClass and cannot be removed.'),_('structural'));
|
||||
|
||||
if ($side == 'dst')
|
||||
printf('<input type="hidden" name="%s" id="%s" value="%s" />',$input_name,$input_id,htmlspecialchars($val));
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_dn_string($val) || $ldapserver->isDNAttr($attr))
|
||||
printf('<a title="%s" href="cmd.php?cmd=template_engine&server_id=%s&dn=%s"><img style="vertical-align: top" src="%s/go.png" /></a>',
|
||||
sprintf(_('Go to %s'),htmlspecialchars($val)),$ldapserver->server_id,rawurlencode($val),IMGDIR);
|
||||
|
||||
elseif (is_mail_string($val))
|
||||
printf('<a href="mailto:%s><img style="vertical-align: center" src="%s/mail.png" /></a>',htmlspecialchars($val),IMGDIR);
|
||||
|
||||
elseif (is_url_string($val))
|
||||
printf('<a href="%s" target="new"><img style="vertical-align: center" src="%s/dc.png" /></a>',htmlspecialchars($val),IMGDIR);
|
||||
|
||||
if ($ldapserver->isMultiLineAttr($attr,$val)) {
|
||||
if ($side == 'dst')
|
||||
printf('<textarea class="value" rows="3" cols="30" name="%s" id="%s">%s</textarea>',$input_name,$input_id,htmlspecialchars($val));
|
||||
else
|
||||
echo htmlspecialchars($val);
|
||||
|
||||
} else {
|
||||
if ($side == 'dst')
|
||||
printf('<input type="text" class="value" name="%s" id="%s" value="%s" />',$input_name,$input_id,htmlspecialchars($val));
|
||||
else
|
||||
echo htmlspecialchars($val);
|
||||
}
|
||||
|
||||
# draw a link for popping up the entry browser if this is the type of attribute that houses DNs.
|
||||
if ($ldapserver->isDNAttr($attr))
|
||||
draw_chooser_link("edit_form.$input_id",false);
|
||||
|
||||
echo '<br />';
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
} /* end foreach value */
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
|
||||
# Draw the "add value" link under the list of values for this attributes
|
||||
if (! $ldapserver_dst->isReadOnly()) {
|
||||
|
||||
# First check if the required objectClass is in this DN
|
||||
$isOK = 0;
|
||||
$src_oclass = array();
|
||||
$attr_object = $ldapserver_dst->getSchemaAttribute($attr,$dn_dst);
|
||||
foreach ($attr_object->used_in_object_classes as $oclass) {
|
||||
if (in_array(strtolower($oclass),arrayLower($attrs_dst['objectClass']))) {
|
||||
$isOK = 1;
|
||||
break;
|
||||
|
||||
} else {
|
||||
# Find oclass that the source has that provides this attribute.
|
||||
if (in_array($oclass,$attrs_src['objectClass']))
|
||||
$src_oclass[] = $oclass;
|
||||
}
|
||||
}
|
||||
|
||||
echo '<tr><td colspan=2></td><td colspan=2> </td><td> </td><td>';
|
||||
if (! $isOK) {
|
||||
|
||||
if (count($src_oclass) == 1)
|
||||
$add_href = sprintf('cmd.php?cmd=add_oclass_form&server_id=%s&dn=%s&new_oclass=%s',
|
||||
$ldapserver_dst->server_id,$encoded_dn_dst,$src_oclass[0]);
|
||||
else
|
||||
$add_href = sprintf('cmd.php?cmd=add_value_form&server_id=%s&dn=%s&attr=objectClass',
|
||||
$ldapserver_dst->server_id,$encoded_dn_dst);
|
||||
|
||||
if ($attr == 'objectClass')
|
||||
printf('<div class="add_value">(<a href="%s" title="%s">%s</a>)</div>',$add_href,_('Add ObjectClass and Attributes'),_('add value'));
|
||||
else
|
||||
printf('<div class="add_value">(<a href="%s" title="%s">%s</a>)</div>',
|
||||
$add_href,sprintf(_('You need one of the following ObjectClass(es) to add this attribute %s.'),implode(" ",$src_oclass)),
|
||||
_('Add new ObjectClass'));
|
||||
|
||||
} else {
|
||||
if (! $schema_attr_dst->getIsSingleValue() || (! isset($vals))) {
|
||||
|
||||
$add_href = sprintf('cmd.php?cmd=add_value_form&erver_id=%s&dn=%s&attr=%s',
|
||||
$ldapserver_dst->server_id,$encoded_dn_dst,rawurlencode($attr));
|
||||
|
||||
printf('<div class="add_value">(<a href="%s" title="%s">%s</a>)</div>',
|
||||
$add_href,sprintf(_('Add an additional value to attribute \'%s\''),$attr),_('add value'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '</td></tr>';
|
||||
|
||||
# Get the values and see if they are the same.
|
||||
if (isset($attrs_src[$attr]) && isset($attrs_dst[$attr]) && $attrs_src[$attr] === $attrs_dst[$attr])
|
||||
echo '<tr>';
|
||||
else
|
||||
echo '<tr class="updated"><td class="bottom" colspan="0"> </td></tr>';
|
||||
|
||||
} /* End foreach ($attrs as $attr => $vals) */
|
||||
|
||||
if (! $ldapserver_dst->isReadOnly())
|
||||
printf('<tr><td colspan=3> </td><td colspan=3><center><input type="submit" value="%s" /></center></form></td></tr>',_('Save Changes'));
|
||||
|
||||
echo '</table>';
|
||||
|
||||
# If this entry has a binary attribute,we need to provide a form for it to submit when deleting it. */
|
||||
?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
//<!--
|
||||
function deleteAttribute(attrName)
|
||||
{
|
||||
if (confirm("<?php echo _('Really delete attribute'); ?> '" + attrName + "'?")) {
|
||||
document.delete_attribute_form.attr.value = attrName;
|
||||
document.delete_attribute_form.submit();
|
||||
}
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
|
||||
<!-- This form is submitted by JavaScript when the user clicks "Delete attribute" on a binary attribute -->
|
||||
<form name="delete_attribute_form" action="cmd.php?cmd=delete_attr" method="post">
|
||||
<input type="hidden" name="server_id" value="<?php echo $ldapserver_dst->server_id; ?>" />
|
||||
<input type="hidden" name="dn" value="<?php echo $dn_dst; ?>" />
|
||||
<input type="hidden" name="attr" value="FILLED IN BY JAVASCRIPT" />
|
||||
</form>
|
||||
echo '</table>';
|
||||
?>
|
||||
|
@@ -1,56 +1,49 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/compare_form.php,v 1.5.2.1 2008/12/12 07:29:55 wurley Exp $
|
||||
|
||||
/**
|
||||
* Compares to DN entries side by side.
|
||||
*
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
* Compares two DN entries side by side.
|
||||
* This is the entry form to determine which DN to compare this DN with.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require_once './common.php';
|
||||
require './common.php';
|
||||
|
||||
$dn = get_request('dn','GET');
|
||||
$rdn = get_rdn($dn);
|
||||
$select_server_html = server_select_list($ldapserver->server_id,true,'server_id_dst');
|
||||
# The DN we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET');
|
||||
|
||||
printf('<h3 class="title">%s %s</h3>',_('Compare another DN with'),htmlspecialchars($rdn));
|
||||
printf('<h3 class="subtitle">%s: <b>%s</b>',_('Server'),$ldapserver->name);
|
||||
if ($dn)
|
||||
printf(' %s: <b>%s</b>',_('Distinguished Name'),htmlspecialchars($dn));
|
||||
echo '</h3>';
|
||||
echo "\n";
|
||||
# Check if the entry exists.
|
||||
if (! $request['dn'] || ! $app['server']->dnExists($request['dn']))
|
||||
error(sprintf(_('The entry (%s) does not exist.'),$request['dn']),'error','index.php');
|
||||
|
||||
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->setDN($request['dn']);
|
||||
$request['page']->accept();
|
||||
|
||||
# Render the form
|
||||
$request['page']->drawTitle(sprintf('%s <b>%s</b>',_('Compare another DN with'),get_rdn($request['dn'])));
|
||||
$request['page']->drawSubTitle();
|
||||
|
||||
printf('<script type="text/javascript" language="javascript" src="%sdnChooserPopup.js"></script>',JSDIR);
|
||||
echo '<center>';
|
||||
printf('%s <b>%s</b> %s<br />',_('Compare'),htmlspecialchars($rdn),_('with '));
|
||||
printf('%s <b>%s</b> %s<br />',_('Compare'),get_rdn($request['dn']),_('with '));
|
||||
|
||||
echo '<form action="cmd.php?cmd=compare" method="post" name="compare_form">';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
printf('<input type="hidden" name="server_id_src" value="%s" />',$ldapserver->server_id);
|
||||
echo '<form action="cmd.php" method="post" name="compare_form">';
|
||||
echo '<input type="hidden" name="cmd" value="compare" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="server_id_src" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn_src" value="%s" />',htmlspecialchars($request['dn']));
|
||||
echo "\n";
|
||||
|
||||
echo '<table style="border-spacing: 10px">';
|
||||
echo "\n";
|
||||
echo '<tr><td>';
|
||||
|
||||
if (! $dn) {
|
||||
printf('<acronym title="%s">%s</acronym>:',_('Compare this DN with another'),_('Source DN'));
|
||||
echo '</td><td>';
|
||||
printf('<input type="text" name="dn_src" size="45" value="%s" />',htmlspecialchars($dn));
|
||||
draw_chooser_link('compare_form.dn_src','true',$rdn);
|
||||
|
||||
} else
|
||||
printf('<input type="hidden" name="dn_src" value="%s" />',htmlspecialchars($dn));
|
||||
|
||||
echo '</td></tr>';
|
||||
echo "\n";
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym>:</td>',_('Compare this DN with another'),_('Destination DN'));
|
||||
printf('<td><acronym title="%s">%s</acronym>:</td>',
|
||||
_('Compare this DN with another'),_('Destination DN'));
|
||||
echo '<td>';
|
||||
echo '<input type="text" name="dn_dst" size="45" value="" />';
|
||||
draw_chooser_link('compare_form.dn_dst','true','');
|
||||
@@ -58,7 +51,7 @@ echo '</td>';
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
printf('<tr><td>%s:</td><td>%s</td></tr>',_('Destination Server'),$select_server_html);
|
||||
printf('<tr><td>%s:</td><td>%s</td></tr>',_('Destination Server'),server_select_list($app['server']->getIndex(),true,'server_id_dst'));
|
||||
echo "\n";
|
||||
|
||||
printf('<tr><td colspan="2" align="right"><input type="submit" value="%s" /></td></tr>',_('Compare'));
|
||||
|
221
htdocs/copy.php
@@ -1,89 +1,83 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy.php,v 1.44.2.3 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* Copies a given object to create a new one.
|
||||
*
|
||||
* Vars that come in as POST vars
|
||||
* - source_dn (rawurlencoded)
|
||||
* - new_dn (form element)
|
||||
* - server_id
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_move'))
|
||||
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('copy entry')),'error','index.php');
|
||||
# The DNs we are working with
|
||||
$request = array();
|
||||
$request['dnSRC'] = get_request('dn_src');
|
||||
$request['dnDST'] = get_request('dn_dst');
|
||||
|
||||
$entry = array();
|
||||
$entry['src']['id'] = get_request('server_id');
|
||||
$entry['dst']['id'] = get_request('dest_server_id');
|
||||
|
||||
$entry['src']['ldapserver'] = $_SESSION[APPCONFIG]->ldapservers->Instance($entry['src']['id']);
|
||||
$entry['dst']['ldapserver'] = $_SESSION[APPCONFIG]->ldapservers->Instance($entry['dst']['id']);
|
||||
|
||||
if ($entry['dst']['ldapserver']->isReadOnly())
|
||||
error(_('Destination server is currently READ-ONLY.'),'error','index.php');
|
||||
|
||||
if (! $entry['src']['ldapserver']->haveAuthInfo() || ! $entry['dst']['ldapserver']->haveAuthInfo())
|
||||
error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php');
|
||||
|
||||
$entry['src']['dn'] = get_request('old_dn');
|
||||
$entry['dst']['dn'] = get_request('new_dn');
|
||||
$entry['src']['recursive'] = (get_request('recursive') == 'on') ? true : false;
|
||||
$entry['src']['remove'] = (get_request('remove') == 'yes') ? true : false;
|
||||
$ldap = array();
|
||||
$ldap['SRC'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_src'));
|
||||
$ldap['DST'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_dst'));
|
||||
|
||||
# Error checking
|
||||
if (strlen(trim($entry['dst']['dn'])) == 0)
|
||||
if (! trim($request['dnDST']))
|
||||
error(_('You left the destination DN blank.'),'error','index.php');
|
||||
|
||||
if (pla_compare_dns($entry['src']['dn'],$entry['dst']['dn']) == 0 && $entry['src']['id'] == $entry['dst']['id'])
|
||||
if ($ldap['DST']->isReadOnly())
|
||||
error(_('Destination server is currently READ-ONLY.'),'error','index.php');
|
||||
|
||||
if ($ldap['DST']->dnExists($request['dnDST']))
|
||||
error(sprintf(_('The destination entry (%s) already exists.'),pretty_print_dn($request['dnDST'])),'error','index.php');
|
||||
|
||||
if (! $ldap['DST']->dnExists($ldap['DST']->getContainer($request['dnDST'])))
|
||||
error(sprintf(_('The destination container (%s) does not exist.'),
|
||||
pretty_print_dn($ldap['DST']->getContainer($request['dnDST']))),'error','index.php');
|
||||
|
||||
if (pla_compare_dns($request['dnSRC'],$request['dnDST']) == 0 && $ldap['SRC']->getIndex() == $ldap['DST']->getIndex())
|
||||
error(_('The source and destination DN are the same.'),'error','index.php');
|
||||
|
||||
if ($entry['dst']['ldapserver']->dnExists($entry['dst']['dn']))
|
||||
error(sprintf(_('The destination entry (%s) already exists.'),pretty_print_dn($entry['dst']['dn'])),'error','index.php');
|
||||
$request['recursive'] = (get_request('recursive') == 'on') ? true : false;
|
||||
$request['remove'] = (get_request('remove') == 'yes') ? true : false;
|
||||
|
||||
if (! $entry['dst']['ldapserver']->dnExists(get_container($entry['dst']['dn'])))
|
||||
error(sprintf(_('The destination container (%s) does not exist.'),pretty_print_dn(get_container($entry['dst']['dn']))),'error','index.php');
|
||||
|
||||
if ($entry['src']['recursive']) {
|
||||
if ($request['recursive']) {
|
||||
$filter = get_request('filter','POST',false,'(objectClass=*)');
|
||||
|
||||
# Build a tree similar to that of the tree browser to give to r_copy_dn
|
||||
$snapshot_tree = array();
|
||||
printf('<h3 class="title">%s%s</h3>',_('Copying '),htmlspecialchars($entry['src']['dn']));
|
||||
$ldap['tree'] = array();
|
||||
printf('<h3 class="title">%s%s</h3>',_('Copying '),$request['dnSRC']);
|
||||
printf('<h3 class="subtitle">%s</h3>',_('Recursive copy progress'));
|
||||
print '<br /><br />';
|
||||
print '<small>';
|
||||
print _('Building snapshot of tree to copy... ');
|
||||
|
||||
$snapshot_tree = build_tree($entry['src']['ldapserver'],$entry['src']['dn'],array(),$filter);
|
||||
print '<small>';
|
||||
printf ('%s...',_('Building snapshot of tree to copy'));
|
||||
|
||||
$ldap['tree'] = build_tree($ldap['SRC'],$request['dnSRC'],array(),$filter);
|
||||
printf('<span style="color:green">%s</span><br />',_('Success'));
|
||||
|
||||
# Prevent script from bailing early on a long delete
|
||||
@set_time_limit(0);
|
||||
|
||||
$copy_result = r_copy_dn($entry['src']['ldapserver'],$entry['dst']['ldapserver'],$snapshot_tree,$entry['src']['dn'],$entry['dst']['dn']);
|
||||
# @todo: This is not showing the complete results - only the children of the dst - need to look at.
|
||||
$copy_result = r_copy_dn($ldap['SRC'],$ldap['DST'],$ldap['tree'],$request['dnSRC'],$request['dnDST'],$request['remove']);
|
||||
$copy_message = $copy_result;
|
||||
print '</small>';
|
||||
|
||||
} else {
|
||||
$copy_result = copy_dn($entry['src']['ldapserver'],$entry['dst']['ldapserver'],$entry['src']['dn'],$entry['dst']['dn']);
|
||||
$copy_message = sprintf('%s DN%s <b>%s</b> %s',_('Copy successful!'),_(':'),htmlspecialchars($entry['dst']['dn']),_('has been created.'));
|
||||
$copy_result = copy_dn($ldap['SRC'],$ldap['DST'],$request['dnSRC'],$request['dnDST'],$request['remove']);
|
||||
|
||||
if ($copy_result)
|
||||
$copy_message = sprintf('%s %s: <b>%s</b> %s',
|
||||
$request['remove'] ? _('Move successful') : _('Copy successful'),
|
||||
_('DN'),$request['dnDST'],_('has been created.'));
|
||||
else
|
||||
$copy_message = sprintf('%s %s: <b>%s</b> %s',
|
||||
$request['remove'] ? _('Move NOT successful') : _('Copy NOT successful'),
|
||||
_('DN'),$request['dnDST'],_('has NOT been created.'));
|
||||
}
|
||||
|
||||
if ($copy_result) {
|
||||
$redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',$entry['dst']['id'],rawurlencode($entry['dst']['dn']));
|
||||
$new_rdn = get_rdn($entry['dst']['dn']);
|
||||
$container = get_container($entry['dst']['dn']);
|
||||
|
||||
if ($entry['src']['remove'])
|
||||
$redirect_url = sprintf('cmd.php?cmd=delete_form&server_id=%s&dn=%s',$entry['src']['id'],rawurlencode($entry['src']['dn']));
|
||||
$redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s&refresh=SID_%s_nodes&noheader=1',
|
||||
$ldap['DST']->getIndex(),rawurlencode($request['dnDST']),$ldap['DST']->getIndex());
|
||||
|
||||
system_message(array(
|
||||
'title'=>_('Copy Entry'),
|
||||
@@ -92,95 +86,96 @@ if ($copy_result) {
|
||||
$redirect_url);
|
||||
}
|
||||
|
||||
function r_copy_dn($ldapserver_src,$ldapserver_dst,$snapshottree,$root_dn,$dn_dst) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Entered with (%s,%s,%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__,
|
||||
$ldapserver_src->server_id,$ldapserver_dst->server_id,$snapshottree,$root_dn,$dn_dst);
|
||||
function r_copy_dn($serverSRC,$serverDST,$snapshottree,$dnSRC,$dnDST,$remove) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$copy_message = array();
|
||||
|
||||
$copy_result = copy_dn($ldapserver_src,$ldapserver_dst,$root_dn,$dn_dst);
|
||||
$children = isset($snapshottree[$dnSRC]) ? $snapshottree[$dnSRC] : null;
|
||||
|
||||
if (! $copy_result)
|
||||
return false;
|
||||
# If we have children, then we need to copy, then delete for a move
|
||||
if (is_array($children) && count($children)) {
|
||||
|
||||
$copy_message[] = sprintf('%s DN: <b>%s</b> %s',_('Copy successful!'),htmlspecialchars($dn_dst),_('has been created.'));
|
||||
$copy_result = copy_dn($serverSRC,$serverDST,$dnSRC,$dnDST,false);
|
||||
|
||||
$children = isset($snapshottree[$root_dn]) ? $snapshottree[$root_dn] : null;
|
||||
if (is_array($children) && count($children) > 0) {
|
||||
foreach($children as $child_dn) {
|
||||
$child_rdn = get_rdn($child_dn);
|
||||
$new_dest_dn = sprintf('%s,%s',$child_rdn,$dn_dst);
|
||||
$copy_result = r_copy_dn($ldapserver_src,$ldapserver_dst,$snapshottree,$child_dn,$new_dest_dn);
|
||||
$copy_message[] = array_shift($copy_result);
|
||||
if (! $copy_result)
|
||||
return false;
|
||||
|
||||
array_push($copy_message,sprintf('%s %s: <b>%s</b> %s',_('Copy successful'),_('DN'),$dnDST,_('has been created.')));
|
||||
|
||||
$hadError = false;
|
||||
foreach ($children as $child_dn) {
|
||||
$dnDST_new = sprintf('%s,%s',get_rdn($child_dn),$dnDST);
|
||||
$copy_result = r_copy_dn($serverSRC,$serverDST,$snapshottree,$child_dn,$dnDST_new,$remove);
|
||||
$copy_message = array_merge($copy_message,array_values($copy_result));
|
||||
|
||||
if (! $copy_result)
|
||||
$hadError = true;
|
||||
}
|
||||
|
||||
if (! $hadError && $remove) {
|
||||
$delete_result = $serverSRC->delete($dnSRC);
|
||||
|
||||
if ($delete_result)
|
||||
array_push($copy_message,sprintf('%s %s: <b>%s</b> %s',_('Delete successful'),_('DN'),$dnDST,_('has been deleted.')));
|
||||
}
|
||||
|
||||
} else {
|
||||
$copy_result = copy_dn($serverSRC,$serverDST,$dnSRC,$dnDST,$remove);
|
||||
|
||||
if ($copy_result)
|
||||
array_push($copy_message,sprintf('%s %s: <b>%s</b> %s',
|
||||
$remove ? _('Move successful') : _('Copy successful'),
|
||||
_('DN'),$dnDST,_('has been created.')));
|
||||
else
|
||||
array_push($copy_message,sprintf('%s %s: <b>%s</b> %s',
|
||||
$remove ? _('Move NOT successful') : _('Copy NOT successful'),
|
||||
_('DN'),$dnDST,_('has NOT been created.')));
|
||||
}
|
||||
|
||||
return $copy_message;
|
||||
}
|
||||
|
||||
function copy_dn($ldapserver_src,$ldapserver_dst,$dn_src,$dn_dst) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Entered with (%s,%s,%s,%s)',17,__FILE__,__LINE__,__METHOD__,
|
||||
$ldapserver_src->server_id,$ldapserver_dst->server_id,$dn_src,$dn_dst);
|
||||
function copy_dn($serverSRC,$serverDST,$dnSRC,$dnDST,$remove) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$new_entry = $ldapserver_src->getDNAttrs($dn_src);
|
||||
$request = array();
|
||||
$request['pageSRC'] = new PageRender($serverSRC->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['pageSRC']->setDN($dnSRC);
|
||||
$request['pageSRC']->accept();
|
||||
|
||||
# modify the prefix-value (ie "bob" in cn=bob) to match the destination DN's value.
|
||||
$rdn_attr = substr($dn_dst,0,strpos($dn_dst,'='));
|
||||
$rdn_value = get_rdn($dn_dst);
|
||||
$rdn_value = substr($rdn_value,strpos($rdn_value,'=') + 1);
|
||||
$new_entry[$rdn_attr] = $rdn_value;
|
||||
$request['pageDST'] = new PageRender($serverDST->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['pageDST']->setContainer($serverDST->getContainer($dnDST));
|
||||
$request['pageDST']->accept();
|
||||
|
||||
# don't need a dn attribute in the new entry
|
||||
unset($new_entry['dn']);
|
||||
$request['templateSRC'] = $request['pageSRC']->getTemplate();
|
||||
$request['templateDST'] = $request['pageDST']->getTemplate();
|
||||
$request['templateDST']->copy($request['pageSRC']->getTemplate(),get_rdn($dnDST,0));
|
||||
|
||||
# Check the user-defined custom call back first
|
||||
if (run_hook('pre_entry_create',
|
||||
array ('server_id'=>$ldapserver_dst->server_id,'dn'=>$dn_dst,'attrs'=>$new_entry))) {
|
||||
|
||||
$add_result = $ldapserver_dst->add($dn_dst,$new_entry);
|
||||
if (! $add_result) {
|
||||
echo '</small><br /><br />';
|
||||
system_message(array(
|
||||
'title'=>_('Failed to copy DN.').sprintf(' (%s)',$dn_dst),
|
||||
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
|
||||
'type'=>'error'));
|
||||
|
||||
} else {
|
||||
run_hook('post_entry_create',
|
||||
array('server_id'=>$ldapserver_dst->server_id,'dn'=>$dn_dst,'attrs'=>$new_entry));
|
||||
}
|
||||
|
||||
return $add_result;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
# Create of move the entry
|
||||
if ($remove)
|
||||
return $serverDST->rename($request['templateSRC']->getDN(),$request['templateDST']->getRDN(),$serverDST->getContainer($dnDST),true);
|
||||
else
|
||||
return $serverDST->add($request['templateDST']->getDN(),$request['templateDST']->getLDAPadd());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $ldapserver
|
||||
* @param dn $dn
|
||||
* @param array $tree
|
||||
* @param string $filter
|
||||
*/
|
||||
function build_tree($ldapserver,$dn,$buildtree) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Entered with (%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__,
|
||||
$ldapserver->server_id,$dn,$buildtree);
|
||||
function build_tree($server,$dn,$buildtree) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# we search all children, not only the visible children in the tree
|
||||
$children = $ldapserver->getContainerContents($dn,0);
|
||||
# We search all children, not only the visible children in the tree
|
||||
$children = $server->getContainerContents($dn,null,0);
|
||||
|
||||
if (is_array($children) && count($children) > 0) {
|
||||
if (count($children)) {
|
||||
$buildtree[$dn] = $children;
|
||||
foreach ($children as $child_dn)
|
||||
$buildtree = build_tree($ldapserver,$child_dn,$buildtree);
|
||||
$buildtree = build_tree($server,$child_dn,$buildtree);
|
||||
}
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Returning (%s)',1,__FILE__,__LINE__,__METHOD__,$buildtree);
|
||||
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$buildtree);
|
||||
|
||||
return $buildtree;
|
||||
}
|
||||
|
@@ -1,93 +1,82 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy_form.php,v 1.30.2.3 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* Copies a given object to create a new one.
|
||||
*
|
||||
* Variables that come in via GET variables
|
||||
* - dn (rawurlencoded)
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
|
||||
# The DN we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET');
|
||||
|
||||
$entry = array();
|
||||
$entry['dn'] = get_request('dn','GET');
|
||||
$entry['rdn'] = get_rdn($entry['dn']);
|
||||
# Check if the entry exists.
|
||||
if (! $request['dn'] || ! $app['server']->dnExists($request['dn']))
|
||||
error(sprintf(_('The entry (%s) does not exist.'),$request['dn']),'error','index.php');
|
||||
|
||||
# We search all children, not only the visible children in the tree
|
||||
$entry['children'] = $ldapserver->getContainerContents($entry['dn']);
|
||||
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->setDN($request['dn']);
|
||||
$request['page']->accept();
|
||||
|
||||
# Draw some javaScrpt to enable/disable the filter field if this may be a recursive copy
|
||||
if (is_array($entry['children']) && count($entry['children']) > 0) { ?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
function toggle_disable_filter_field(recursive_checkbox)
|
||||
{
|
||||
if (recursive_checkbox.checked) {
|
||||
recursive_checkbox.form.remove.disabled = false;
|
||||
recursive_checkbox.form.filter.disabled = false;
|
||||
} else {
|
||||
recursive_checkbox.form.remove.disabled = true;
|
||||
recursive_checkbox.form.remove.checked = false;
|
||||
recursive_checkbox.form.filter.disabled = true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php }
|
||||
|
||||
printf('<h3 class="title">%s %s</h3>',_('Copy'),htmlspecialchars($entry['rdn']));
|
||||
printf('<h3 class="subtitle">%s: <b>%s</b> %s: <b>%s</b></h3>',_('Server'),$ldapserver->name,
|
||||
_('Distinguished Name'),htmlspecialchars($entry['dn']));
|
||||
echo "\n";
|
||||
# Render the form
|
||||
$request['page']->drawTitle(sprintf('%s <b>%s</b>',_('Copy'),get_rdn($request['dn'])));
|
||||
$request['page']->drawSubTitle();
|
||||
|
||||
printf('<script type="text/javascript" language="javascript" src="%sdnChooserPopup.js"></script>',JSDIR);
|
||||
echo '<center>';
|
||||
printf('%s <b>%s</b> %s:<br /><br />',_('Copy'),htmlspecialchars($entry['rdn']),_('to a new object'));
|
||||
printf('%s <b>%s</b> %s:<br /><br />',_('Copy'),get_rdn($request['dn']),_('to a new object'));
|
||||
|
||||
echo '<form action="cmd.php" method="post" name="copy_form">';
|
||||
echo '<input type="hidden" name="cmd" value="copy" />';
|
||||
printf('<input type="hidden" name="old_dn" value="%s" />',htmlspecialchars($entry['dn']));
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="server_id_src" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn_src" value="%s" />',htmlspecialchars($request['dn']));
|
||||
echo "\n";
|
||||
|
||||
echo '<table style="border-spacing: 10px">';
|
||||
echo "\n";
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym>:</td>',
|
||||
_('The full DN of the new entry to be created when copying the source entry'),_('Destination DN'));
|
||||
printf('<td><input type="text" name="new_dn" size="45" value="%s" />',htmlspecialchars($entry['dn']));
|
||||
draw_chooser_link('copy_form.new_dn','true',htmlspecialchars($entry['rdn']));
|
||||
echo '</td></tr>';
|
||||
echo '<td>';
|
||||
printf('<input type="text" name="dn_dst" size="45" value="%s" />',htmlspecialchars($request['dn']));
|
||||
draw_chooser_link('copy_form.dn_dst','true',get_rdn($request['dn']));
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
printf('<tr><td>%s</td><td>%s</td></tr>',_('Destination Server'),server_select_list($ldapserver->server_id,true,'dest_server_id'));
|
||||
printf('<tr><td>%s:</td><td>%s</td></tr>',_('Destination Server'),server_select_list($app['server']->getIndex(),true,'server_id_dst'));
|
||||
echo "\n";
|
||||
|
||||
if (is_array($entry['children']) && count($entry['children']) > 0) {
|
||||
# We search all children, not only the visible children in the tree
|
||||
$request['children'] = $app['server']->getContainerContents($request['dn']);
|
||||
|
||||
if (count($request['children']) > 0) {
|
||||
echo '<tr>';
|
||||
printf('<td><label for="recursive">%s</label>:</td>',_('Recursive copy'));
|
||||
echo '<td><input type="checkbox" id="recursive" name="recursive" onClick="toggle_disable_filter_field(this)" />';
|
||||
echo '<td><input type="checkbox" id="recursive" name="recursive" onClick="copy_field_toggle(this)" />';
|
||||
printf('<small>(%s)</small></td>',_('Recursively copy all children of this object as well.'));
|
||||
echo '</tr>'."\n";
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym>:</td>',_('When performing a recursive copy, only copy those entries which match this filter'),_('Filter'));
|
||||
printf('<td><acronym title="%s">%s</acronym>:</td>',
|
||||
_('When performing a recursive copy, only copy those entries which match this filter'),_('Filter'));
|
||||
echo '<td><input type="text" name="filter" value="(objectClass=*)" size="45" disabled />';
|
||||
echo '</tr>'."\n";
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td>%s</td>',_('Delete after copy (move):'));
|
||||
echo '<td><input type="checkbox" name="remove" value="yes" disabled />';
|
||||
printf('<small>(%s)</small)</td>',_('Make sure your filter (above) will select all child records.'));
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
} else {
|
||||
printf('<tr><td>%s</td><td><input type="checkbox" name="remove" value="yes"/></td></tr>',_('Delete after copy (move):'));
|
||||
@@ -96,11 +85,17 @@ echo "\n";
|
||||
|
||||
printf('<tr><td colspan="2" align="right"><input type="submit" value="%s" /></td></tr>',_('Copy '));
|
||||
echo "\n";
|
||||
echo '</table></form>';
|
||||
echo "\n";
|
||||
|
||||
if ($_SESSION[APPCONFIG]->GetValue('appearance','show_hints'))
|
||||
printf('<small><img src="%s/light.png" alt="Light" /><span class="hint">%s</span></small>',IMGDIR,_('Hint: Copying between different servers only works if there are no schema violations'));
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
|
||||
if ($_SESSION[APPCONFIG]->getValue('appearance','show_hints'))
|
||||
printf('<small><img src="%s/light.png" alt="Light" /><span class="hint">%s</span></small>',
|
||||
IMGDIR,_('Hint: Copying between different servers only works if there are no schema violations'));
|
||||
|
||||
echo '</center>';
|
||||
|
||||
# Draw the javascrpt to enable/disable the filter field if this may be a recursive copy
|
||||
if (count($request['children']) > 0)
|
||||
printf('<script type="text/javascript" language="javascript" src="%sform_field_toggle_enable.js"></script>',JSDIR);
|
||||
?>
|
||||
|
@@ -1,138 +1,103 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/create.php,v 1.48.2.4 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* Creates a new object.
|
||||
*
|
||||
* Variables that come in as POST vars:
|
||||
* - new_dn
|
||||
* - required_attrs (an array with indices being the attributes,
|
||||
* and the values being their respective values)
|
||||
* - object_classes (rawurlencoded, and serialized array of objectClasses)
|
||||
* Creates a new object in LDAP.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
* @todo: posixgroup with empty memberlist generates an error.
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
|
||||
|
||||
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_create'))
|
||||
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('create entry')),'error','index.php');
|
||||
|
||||
$rdn_attr = get_request('rdn_attribute');
|
||||
|
||||
$entryfactoryclass = $_SESSION[APPCONFIG]->GetValue('appearance','entry_factory');
|
||||
eval('$entry_factory = new '.$entryfactoryclass.'();');
|
||||
$entry = $entry_factory->newCreatingEntry('');
|
||||
|
||||
eval('$reader = new '.$_SESSION[APPCONFIG]->GetValue('appearance', 'entry_reader').'($ldapserver);');
|
||||
$entry->accept($reader);
|
||||
|
||||
$container = $entry->getContainer();
|
||||
|
||||
if (!$container || !$ldapserver->dnExists($container))
|
||||
error(sprintf(_('The container you specified (%s) does not exist. Please try again.'),htmlspecialchars($container)),'error','index.php');
|
||||
|
||||
$tree = get_cached_item($ldapserver->server_id,'tree');
|
||||
if ($tree) {
|
||||
$container_entry = $tree->getEntry($container);
|
||||
if (!$container_entry)
|
||||
$tree->addEntry($container);
|
||||
|
||||
$container_entry = $tree->getEntry($container);
|
||||
if ($container_entry->isLeaf())
|
||||
error(sprintf(_('The container (%s) is a leaf.'), htmlspecialchars($container)),'error','index.php');
|
||||
# If cancel was selected, we'll redirect
|
||||
if (get_request('cancel','REQUEST')) {
|
||||
header('Location: index.php');
|
||||
die();
|
||||
}
|
||||
|
||||
$entry->setRdnAttributeName($rdn_attr);
|
||||
if (!$entry->getRdnAttribute())
|
||||
error(sprintf(_('The Rdn attribute (%s) does not exist.'), htmlspecialchars($rdn_attr)),'error','index.php');
|
||||
$request = array();
|
||||
$request['redirect'] = get_request('redirect','POST',false,false);
|
||||
|
||||
$new_dn = $entry->getDn();
|
||||
if (! $new_dn)
|
||||
error(_('You left the RDN field blank.'),'error','index.php');
|
||||
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->setContainer(get_request('container','REQUEST',true));
|
||||
$request['page']->accept();
|
||||
$request['template'] = $request['page']->getTemplate();
|
||||
|
||||
$redirect = get_request('redirect','POST',false,false);
|
||||
if (! $request['template']->getContainer() || ! $app['server']->dnExists($request['template']->getContainer()))
|
||||
error(sprintf(_('The container you specified (%s) does not exist. Please try again.'),$request['template']->getContainer()),'error','index.php');
|
||||
|
||||
$new_entry = array();
|
||||
$attrs = $entry->getAttributes();
|
||||
foreach ($attrs as $attr) {
|
||||
$vals = $attr->getValues();
|
||||
$new_vals = array();
|
||||
foreach ($vals as $val) {
|
||||
if (strlen($val) > 0)
|
||||
$new_vals[] = $val;
|
||||
}
|
||||
# Check if the container is a leaf - we shouldnt really return a hit here, the template engine shouldnt have allowed a user to attempt to create an entry...
|
||||
$tree = get_cached_item($app['server']->getIndex(),'tree');
|
||||
$request['container'] = $tree->getEntry($request['template']->getContainer());
|
||||
if (! $request['container'])
|
||||
$tree->addEntry($request['template']->getContainer());
|
||||
|
||||
if ($attr->isRequired() && !$new_vals && !$ldapserver->isIgnoredAttr($attr->getName()))
|
||||
error(sprintf(_('You left the value blank for required attribute (%s).'),htmlspecialchars($attr->getName())),'error','index.php');
|
||||
|
||||
$request['container'] = $tree->getEntry($request['template']->getContainer());
|
||||
|
||||
if ($new_vals)
|
||||
$new_entry[$attr->getName()] = $new_vals;
|
||||
# Check our RDN
|
||||
if (! count($request['template']->getRDNAttrs()))
|
||||
error(_('The were no attributes marked as an RDN attribute.'),'error','index.php');
|
||||
if (! $request['template']->getRDN())
|
||||
error(_('The RDN field is empty?'),'error','index.php');
|
||||
|
||||
# Some other attribute checking...
|
||||
foreach ($request['template']->getAttributes() as $attribute) {
|
||||
# Check that our Required Attributes have a value - we shouldnt really return a hit here, the template engine shouldnt have allowed this to slip through.
|
||||
# @todo this isIgnoredAttr() function is missing?
|
||||
if ($attribute->isRequired() && ! count($attribute->getValues()) && ! $app['server']->isIgnoredAttr($attr->getName()))
|
||||
error(sprintf(_('You left the value blank for required attribute (%s).'),
|
||||
$attribute->getName(false)),'error','index.php');
|
||||
}
|
||||
|
||||
if (! in_array('top', $new_entry['objectClass']))
|
||||
$new_entry['objectClass'][] = 'top';
|
||||
|
||||
foreach ($new_entry as $attr => $vals) {
|
||||
# Check to see if this is a unique Attribute
|
||||
if ($badattr = $ldapserver->checkUniqueAttr($new_dn,$attr,$vals)) {
|
||||
$search_href = sprintf('?cmd=search&search=true&form=advanced&server_id=%s&filter=%s=%s', $ldapserver->server_id,$attr,$badattr);
|
||||
error(sprintf(_('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$attr,$badattr,$new_dn,$search_href),'error','index.php');
|
||||
}
|
||||
}
|
||||
|
||||
# Check the user-defined custom call back first
|
||||
if (run_hook('pre_entry_create',array('server_id'=>$ldapserver->server_id,'dn'=>$new_dn,'attrs'=>$new_entry)))
|
||||
$add_result = $ldapserver->add($new_dn,$new_entry);
|
||||
# Create the entry
|
||||
$add_result = $app['server']->add($request['template']->getDN(),$request['template']->getLDAPadd());
|
||||
|
||||
if ($add_result) {
|
||||
run_hook('post_entry_create',array('server_id'=>$ldapserver->server_id,'dn'=>$new_dn,'attrs'=>$new_entry));
|
||||
$action_number = $_SESSION[APPCONFIG]->getValue('appearance','action_after_creation');
|
||||
$href = sprintf('cmd=template_engine&server_id=%s',$app['server']->getIndex());
|
||||
|
||||
$action_number = $_SESSION[APPCONFIG]->GetValue('appearance', 'action_after_creation');
|
||||
if ($request['redirect'])
|
||||
$redirect_url = $request['redirect'];
|
||||
|
||||
$container = get_container($new_dn,false);
|
||||
//$container_container = get_container($container);
|
||||
else if ($action_number == 2)
|
||||
$redirect_url = sprintf('cmd.php?%s&template=%s&container=%s',
|
||||
$href,$request['template']->getID(),rawurlencode($request['template']->getContainer()));
|
||||
|
||||
if ($redirect) {
|
||||
$redirect_url = $redirect;
|
||||
} else if ($action_number == 2) {
|
||||
$redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&container=%s', $ldapserver->server_id, rawurlencode($container));
|
||||
} else {
|
||||
$redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s', $ldapserver->server_id, rawurlencode($new_dn));
|
||||
}
|
||||
else
|
||||
$redirect_url = sprintf('cmd.php?%s&template=%s&dn=%s',
|
||||
$href,$request['template']->getID(),rawurlencode($request['template']->getDN()));
|
||||
|
||||
if ($action_number == 1 || $action_number == 2)
|
||||
printf('<meta http-equiv="refresh" content="0; url=%s" />',$redirect_url);
|
||||
|
||||
if ($action_number == 1 || $action_number == 2) {
|
||||
$create_message = sprintf('%s DN%s <b>%s</b> %s',_('Creation successful!'),_(':'),htmlspecialchars($new_dn),_('has been created.'));
|
||||
$create_message = sprintf('%s %s: <b>%s</b> %s',
|
||||
_('Creation successful!'),_('DN'),$request['template']->getDN(),_('has been created.'));
|
||||
|
||||
if (isAjaxEnabled())
|
||||
$redirect_url .= sprintf('&refresh=SID_%s_nodes&noheader=1',$app['server']->getIndex());
|
||||
|
||||
system_message(array(
|
||||
'title'=>_('Create Entry'),
|
||||
'body'=>$create_message,
|
||||
'type'=>'info'),
|
||||
$redirect_url);
|
||||
|
||||
} else {
|
||||
printf('<h3 class="title">%s</h3>',_('Entry created'));
|
||||
$request['page']->drawTitle(_('Entry created'));
|
||||
$request['page']->drawSubTitle(sprintf('%s: <b>%s</b> %s: <b>%s</b>',
|
||||
_('Server'),$app['server']->getName(),_('Distinguished Name'),$request['template']->getDN()));
|
||||
|
||||
echo '<br />';
|
||||
echo '<center>';
|
||||
printf('<a href="cmd.php?cmd=template_engine&server_id=%s&dn=%s">%s</a>.',$ldapserver->server_id,rawurlencode($new_dn),_('Display the new created entry'));
|
||||
printf('<a href="cmd.php?%s&dn=%s">%s</a>.',
|
||||
htmlspecialchars($href),rawurlencode($request['template']->getDN()),_('Display the new created entry'));
|
||||
echo '<br />';
|
||||
printf('<a href="cmd.php?cmd=template_engine&server_id=%s&container=%s">%s</a>.',$ldapserver->server_id,rawurlencode($container),_('Create another entry'));
|
||||
printf('<a href="cmd.php?%s&container=%s">%s</a>.',
|
||||
htmlspecialchars($href),rawurlencode($request['template']->getContainer()),_('Create another entry'));
|
||||
echo '</center>';
|
||||
}
|
||||
|
||||
} else {
|
||||
system_message(array(
|
||||
'title'=>_('Could not add the object to the LDAP server.'),
|
||||
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
|
||||
'type'=>'error'));
|
||||
}
|
||||
?>
|
||||
|
126
htdocs/create_confirm.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/**
|
||||
* Creates a new object in LDAP.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$request = array();
|
||||
$request['redirect'] = get_request('redirect','POST',false,false);
|
||||
|
||||
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->setContainer(get_request('container','REQUEST',true));
|
||||
$request['page']->accept();
|
||||
$request['template'] = $request['page']->getTemplate();
|
||||
|
||||
if (! $request['template']->getContainer() || ! $app['server']->dnExists($request['template']->getContainer()))
|
||||
error(sprintf(_('The container you specified (%s) does not exist. Please try again.'),$request['template']->getContainer()),'error','index.php');
|
||||
|
||||
# Check if the container is a leaf - we shouldnt really return a hit here, the template engine shouldnt have allowed a user to attempt to create an entry...
|
||||
$tree = get_cached_item($app['server']->getIndex(),'tree');
|
||||
$request['container'] = $tree->getEntry($request['template']->getContainer());
|
||||
if (! $request['container'])
|
||||
$tree->addEntry($request['template']->getContainer());
|
||||
|
||||
$request['container'] = $tree->getEntry($request['template']->getContainer());
|
||||
|
||||
# Check our RDN
|
||||
if (! count($request['template']->getRDNAttrs()))
|
||||
error(_('The were no attributes marked as an RDN attribute.'),'error','index.php');
|
||||
if (! $request['template']->getRDN())
|
||||
error(_('The RDN field is empty?'),'error','index.php');
|
||||
|
||||
# Some other attribute checking...
|
||||
foreach ($request['template']->getAttributes() as $attribute) {
|
||||
# Check that our Required Attributes have a value - we shouldnt really return a hit here, the template engine shouldnt have allowed this to slip through.
|
||||
# @todo this isIgnoredAttr() function is missing?
|
||||
if ($attribute->isRequired() && ! count($attribute->getValues()) && ! $app['server']->isIgnoredAttr($attr->getName()))
|
||||
error(sprintf(_('You left the value blank for required attribute (%s).'),
|
||||
$attribute->getName(false)),'error','index.php');
|
||||
}
|
||||
|
||||
# Check for unique attributes
|
||||
$app['server']->checkUniqueAttrs($request['template']->getDN(),$request['template']->getLDAPadd());
|
||||
|
||||
$request['page']->drawTitle(_('Create LDAP Entry'));
|
||||
$request['page']->drawSubTitle(sprintf('%s: <b>%s</b> %s: <b>%s</b>',
|
||||
_('Server'),$app['server']->getName(),_('Container'),$request['template']->getContainer()));
|
||||
|
||||
# Confirm the creation
|
||||
if (count($request['template']->getLDAPadd(true))) {
|
||||
echo '<center>';
|
||||
echo _('Do you want to create this entry?');
|
||||
echo '<br /><br />';
|
||||
|
||||
echo "\n\n";
|
||||
echo '<form action="cmd.php" method="post">';
|
||||
echo '<input type="hidden" name="cmd" value="create" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="container" value="%s" />',htmlspecialchars($request['template']->getContainer()));
|
||||
printf('<input type="hidden" name="template" value="%s" />',$request['template']->getID());
|
||||
foreach ($request['template']->getRDNAttrs() as $rdn)
|
||||
printf('<input type="hidden" name="rdn_attribute[]" value="%s" />',htmlspecialchars($rdn));
|
||||
echo "\n";
|
||||
|
||||
$request['page']->drawHiddenAttributes();
|
||||
|
||||
echo '<table class="result_table">';
|
||||
echo "\n";
|
||||
|
||||
printf('<tr class="heading"><td>%s</td><td>%s</td><td>%s</td></tr>',
|
||||
_('Attribute'),_('New Value'),_('Skip'));
|
||||
echo "\n\n";
|
||||
|
||||
$counter = 0;
|
||||
printf('<tr class="%s"><td colspan=3><center><b>%s</b></center></td><tr>',$counter%2 ? 'even' : 'odd',$request['template']->getDN());
|
||||
|
||||
foreach ($request['template']->getLDAPadd(true) as $attribute) {
|
||||
$counter++;
|
||||
|
||||
printf('<tr class="%s">',$counter%2 ? 'even' : 'odd');
|
||||
printf('<td><b>%s</b></td>',$attribute->getFriendlyName());
|
||||
|
||||
# Show NEW Values
|
||||
echo '<td><span style="white-space: nowrap;">';
|
||||
$request['page']->draw('CurrentValues',$attribute);
|
||||
echo '</span></td>';
|
||||
|
||||
# Show SKIP Option
|
||||
$input_disabled = '';
|
||||
$input_onclick = '';
|
||||
|
||||
if ($attribute->isRequired())
|
||||
$input_disabled = 'disabled="disabled"';
|
||||
|
||||
printf('<td><input name="skip_array[%s]" id="skip_array_%s" type="checkbox" %s %s/></td>',
|
||||
htmlspecialchars($attribute->getName()),htmlspecialchars($attribute->getName()),$input_disabled,$input_onclick);
|
||||
echo '</tr>';
|
||||
echo "\n\n";
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo '<br />';
|
||||
printf('<input type="submit" value="%s" />',_('Commit'));
|
||||
printf('<input type="submit" name="cancel" value="%s" />',_('Cancel'));
|
||||
echo '</form>';
|
||||
echo '<br />';
|
||||
|
||||
echo '</center>';
|
||||
|
||||
} else {
|
||||
echo '<center>';
|
||||
echo _('You made no changes');
|
||||
$href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',
|
||||
$app['server']->getIndex(),rawurlencode($request['dn']));
|
||||
|
||||
printf(' <a href="%s">%s</a>.',htmlspecialchars($href),_('Go back'));
|
||||
echo '</center>';
|
||||
}
|
||||
?>
|
@@ -1,13 +1,13 @@
|
||||
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/css/style.css,v 1.48.2.8 2008/12/19 00:38:31 wurley Exp $ */
|
||||
/* $Header$ */
|
||||
|
||||
/* Global Page */
|
||||
table.page {
|
||||
font-weight: normal;
|
||||
color: #000000;
|
||||
|
||||
font-family: bitstream vera sans,luxi sans,verdana,geneva,arial,helvetica,sans-serif;
|
||||
font-family: "bitstream vera sans","luxi sans",verdana,geneva,arial,helvetica,sans-serif;
|
||||
background-color: #FFFFFF;
|
||||
font-size: 11pt;
|
||||
font-size: 13px;
|
||||
empty-cells: hide;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ table.page tr.head {
|
||||
color: #FFFFFF;
|
||||
background-color: #001188;
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
font-size: 11px;
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,15 @@ table.page tr.head img.logo {
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
table.page tr.pagehead {
|
||||
}
|
||||
|
||||
table.page tr.pagehead td.imagetop {
|
||||
width: 100%;
|
||||
vertical-align: bottom;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Global Page - Control Line */
|
||||
table.page tr.control td {
|
||||
border-top: 1px solid #AAAACC;
|
||||
@@ -59,12 +68,13 @@ table.page table.control {
|
||||
table.page table.control td {
|
||||
border-top: 0px;
|
||||
border-bottom: 0px;
|
||||
width: 30px;
|
||||
padding: 0px;
|
||||
padding-top: 5px;
|
||||
text-align: center;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.page table.control img {
|
||||
@@ -187,7 +197,7 @@ table.page table.body td.foot {
|
||||
table.page tr.foot td {
|
||||
border-top: 1px solid #AAAACC;
|
||||
font-weight: bold;
|
||||
font-size: 10pt;
|
||||
font-size: 12px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
@@ -349,6 +359,94 @@ table.tree a:hover {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
table.tree span.dnicon img {
|
||||
width: 16px;
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
|
||||
/* Tree */
|
||||
table.tree .treemenudiv {
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
table.tree .phplmnormal {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmnormal:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:link {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:visited {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #841212;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:active {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #ff0000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:link {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #dd0000;
|
||||
background-color: #ffdd76;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:visited {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #dd0000;
|
||||
background-color: #ffdd76;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #841212;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:active {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #ff0000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Standard Form */
|
||||
table.forminput {
|
||||
background-color: #F9F9FA;
|
||||
@@ -415,7 +513,7 @@ table.menu td.icon {
|
||||
|
||||
/* Edit DN */
|
||||
div.add_value {
|
||||
font-size: 10pt;
|
||||
font-size: 12px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
@@ -548,59 +646,9 @@ span.hint {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
/* Edit DN - EntryWriter2 */
|
||||
table.entry tr.spacer {
|
||||
background-color: #D0D0D0;
|
||||
}
|
||||
|
||||
table.entry tr td.ew2_icon {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.entry tr td.ew2_attr {
|
||||
vertical-align: top;
|
||||
text-align: right;
|
||||
font-size: 75%;
|
||||
background-color: #fff;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.entry tr td.ew2_attr a {
|
||||
text-decoration: none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
table.entry tr td.ew2_attr a:hover {
|
||||
text-decoration: underline;
|
||||
color: #016;
|
||||
}
|
||||
|
||||
table.entry tr td.ew2_val {
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
padding-bottom: 10px;
|
||||
padding-left: 50px;
|
||||
}
|
||||
|
||||
table.entry tr.updated td.ew2_attr {
|
||||
text-align: right;
|
||||
font-size: 75%;
|
||||
border-top: 1px dashed green;
|
||||
border-left: 1px dashed green;
|
||||
border-bottom: 1px dashed green;
|
||||
background-color: #ded;
|
||||
}
|
||||
|
||||
table.entry tr.updated td.ew2_val {
|
||||
border-top: 1px dashed green;
|
||||
border-left: 1px dashed green;
|
||||
border-right: 1px dashed green;
|
||||
border-bottom: 1px dashed green;
|
||||
}
|
||||
|
||||
/* Login Box */
|
||||
#login {
|
||||
background: url('../images/uid.png') no-repeat 0 1px;
|
||||
background: url('../../images/default/ldap-uid.png') no-repeat 0 1px;
|
||||
background-color: #FAFAFF;
|
||||
color: #000000;
|
||||
padding-left: 17px;
|
||||
@@ -617,7 +665,7 @@ table.entry tr.updated td.ew2_val {
|
||||
}
|
||||
|
||||
#password {
|
||||
background: url('../images/key.png') no-repeat 0 1px;
|
||||
background: url('../../images/default/key.png') no-repeat 0 1px;
|
||||
background-color: #FAFAFF;
|
||||
color: #000000;
|
||||
padding-left: 17px;
|
||||
@@ -652,7 +700,7 @@ table.entry tr.updated td.ew2_val {
|
||||
div.execution_time {
|
||||
font-size: 75%;
|
||||
font-weight: normal;
|
||||
text-align: center;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table.result {
|
||||
@@ -697,6 +745,12 @@ table.result tr.list_item td.value {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
table.result_box {
|
||||
border: 1px solid #AAAACC;
|
||||
border-collapse: collapse;
|
||||
empty-cells: show;
|
||||
}
|
||||
|
||||
table.result_table {
|
||||
border: 1px solid #AAAACC;
|
||||
border-collapse: collapse;
|
||||
@@ -704,6 +758,7 @@ table.result_table {
|
||||
}
|
||||
|
||||
table.result_table td {
|
||||
font-size: 12px;
|
||||
vertical-align: top;
|
||||
border: 1px solid #AAAACC;
|
||||
padding: 4px;
|
||||
@@ -732,7 +787,7 @@ table.result_table tr.highlight td {
|
||||
table.result_table td.heading {
|
||||
color: #FFFFFF;
|
||||
background-color: #000088;
|
||||
font-size: 15px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
table.result_table td.value {
|
||||
@@ -743,12 +798,14 @@ table.result_table td.value {
|
||||
table.result_table tr.heading {
|
||||
color: #FFFFFF;
|
||||
background-color: #000088;
|
||||
font-size: 15px;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.result_table tr.heading a {
|
||||
color: #FFFFFF;
|
||||
font-size: 20px;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.result_table tr.heading td {
|
||||
@@ -825,7 +882,7 @@ table.error th {
|
||||
background-color: #AA0000;
|
||||
border: 0px;
|
||||
color: #FFFFFF;
|
||||
font-size: 12pt;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
952
htdocs/css/tango/style.css
Normal file
@@ -0,0 +1,952 @@
|
||||
/* $Header$ */
|
||||
|
||||
/* Global Page */
|
||||
table.page {
|
||||
font-weight: normal;
|
||||
color: #2E3436;
|
||||
|
||||
font-family: "bitstream vera sans","luxi sans",verdana,geneva,arial,helvetica,sans-serif;
|
||||
background-color: #FFFFFF;
|
||||
font-size: 13px;
|
||||
empty-cells: hide;
|
||||
}
|
||||
|
||||
/* Global Page - Defaults */
|
||||
/* A HREF Links */
|
||||
table.page a {
|
||||
color: #204A87;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.page a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.page a img {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
/* Global Page - Logo & Title */
|
||||
table.page tr.head {
|
||||
text-align: center;
|
||||
color: #FFFFFF;
|
||||
background-color: #3465A4;
|
||||
font-weight: bold;
|
||||
font-size: 11px;
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
table.page tr.head img.logo {
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
|
||||
width: 100px;
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
table.page tr.pagehead {
|
||||
}
|
||||
|
||||
table.page tr.pagehead td.imagetop {
|
||||
width: 100%;
|
||||
vertical-align: bottom;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Global Page - Control Line */
|
||||
table.page tr.control td {
|
||||
border-top: 1px solid #BABDB6;
|
||||
border-bottom: 1px solid #BABDB6;
|
||||
}
|
||||
|
||||
/* Global Page - Control Line Menu Items */
|
||||
table.page table.control {
|
||||
table-layout: fixed;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.page table.control td {
|
||||
border-top: 0px;
|
||||
border-bottom: 0px;
|
||||
padding: 0px;
|
||||
padding-top: 5px;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
table.page table.control img {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
table.page table.control a {
|
||||
color: #2E3436;
|
||||
}
|
||||
|
||||
table.page table.control a:hover {
|
||||
text-decoration: none;
|
||||
background-color: #EEEEEC;
|
||||
color: #CC0000;
|
||||
}
|
||||
|
||||
table.page table.control td.spacer {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
table.page table.control td.logo {
|
||||
text-align: right;
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
table.page table.control td.logo img.logo {
|
||||
vertical-align: middle;
|
||||
text-align: right;
|
||||
|
||||
width: 100px;
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
/* Global Page - LDAP Tree */
|
||||
table.page td.tree {
|
||||
border-right: 1px solid #BABDB6;
|
||||
vertical-align: top;
|
||||
background-color: #FFFFFF;
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
/* Global Page - Main Body */
|
||||
table.page td.body {
|
||||
vertical-align: top;
|
||||
width: 100%;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
/* Global Page - Main Body System Message */
|
||||
table.page table.sysmsg {
|
||||
border-bottom: 2px solid #BABDB6;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.page table.sysmsg td.head {
|
||||
font-size: small;
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.page table.sysmsg td.body {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
table.page table.sysmsg td.icon {
|
||||
text-align: center;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* Global Page - Main Body */
|
||||
table.page table.body {
|
||||
font-weight: normal;
|
||||
background-color: #FFFFFF;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.page table.body h3.title {
|
||||
text-align: center;
|
||||
margin: 0px;
|
||||
padding: 10px;
|
||||
color: #FFFFFF;
|
||||
background-color: #3465A4;
|
||||
border: 1px solid #EEEEEC;
|
||||
font-weight: normal;
|
||||
font-size: 150%;
|
||||
}
|
||||
|
||||
table.page table.body h3.subtitle {
|
||||
text-align: center;
|
||||
margin: 0px;
|
||||
margin-bottom: 15px;
|
||||
font-size: 75%;
|
||||
color: #FFFFFF;
|
||||
border-bottom: 1px solid #EEEEEC;
|
||||
border-left: 1px solid #EEEEEC;
|
||||
border-right: 1px solid #EEEEEC;
|
||||
background: #3465A4;
|
||||
padding: 4px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
table.page table.body td.spacer {
|
||||
border-top: 2px solid #BABDB6;
|
||||
padding: 0px;
|
||||
font-size: 5px;
|
||||
}
|
||||
|
||||
table.page table.body td.head {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.page table.body td.foot {
|
||||
font-size: small;
|
||||
border-top: 1px solid #BABDB6;
|
||||
border-bottom: 1px solid #BABDB6;
|
||||
}
|
||||
|
||||
/* Global Page Footer */
|
||||
table.page tr.foot td {
|
||||
border-top: 1px solid #BABDB6;
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Global Page - Other Layouts */
|
||||
/* Server Select */
|
||||
table.page table.server_select {
|
||||
font-weight: bold;
|
||||
font-size: 13px;
|
||||
color: #2E3436;
|
||||
}
|
||||
|
||||
/* Individual table layouts */
|
||||
/* LDAP Tree */
|
||||
table.tree {
|
||||
}
|
||||
|
||||
table.tree tr.server td.icon {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.tree tr.server td.name {
|
||||
padding-right: 10px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.tree tr.server td {
|
||||
padding-top: 5px;
|
||||
font-size: 18px;
|
||||
text-align: left;
|
||||
padding-right: 0px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.tree td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.tree td.server_links {
|
||||
vertical-align: top;
|
||||
text-align: center;
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
padding-left: 3px;
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
||||
table.tree td.server_links img {
|
||||
height: 22px;
|
||||
width: 22px;
|
||||
}
|
||||
|
||||
table.tree td.server_links a {
|
||||
color: #2E3436;
|
||||
text-decoration: none;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
table.tree td.server_links a:hover {
|
||||
text-decoration: none;
|
||||
background-color: #EEEEEC;
|
||||
color: #CC0000;
|
||||
}
|
||||
|
||||
table.tree tr.option td.expander {
|
||||
text-align: center;
|
||||
width: 22px;
|
||||
max-width: 22px;
|
||||
min-width: 22px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.tree tr.option td.icon {
|
||||
text-align: center;
|
||||
width: 22px;
|
||||
max-width: 22px;
|
||||
min-width: 22px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.tree td.rdn a {
|
||||
font-size: 13px;
|
||||
color: #2E3436;
|
||||
}
|
||||
|
||||
table.tree td.rdn a:hover {
|
||||
font-size: 13px;
|
||||
color: #CC0000;
|
||||
background-color: #EEEEEC;
|
||||
}
|
||||
|
||||
table.tree td.rdn span.count {
|
||||
font-size: 13px;
|
||||
color: #2E3436;
|
||||
}
|
||||
|
||||
table.tree td.links a {
|
||||
color: #204A87;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.tree td.link a {
|
||||
font-size: 13px;
|
||||
color: #2E3436;
|
||||
}
|
||||
|
||||
table.tree td.link a:hover {
|
||||
font-size: 13px;
|
||||
color: #CC0000;
|
||||
background-color: #EEEEEC;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree td.rdn a:hover {
|
||||
font-size: 13px;
|
||||
color: #CC0000;
|
||||
background-color: #EEEEEC;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree td.links a:hover {
|
||||
text-decoration: none;
|
||||
color: #204A87;
|
||||
}
|
||||
|
||||
table.tree td.links a img {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
table.tree td.blank {
|
||||
font-size: 1px;
|
||||
}
|
||||
|
||||
table.tree td.spacer {
|
||||
width: 22px;
|
||||
}
|
||||
|
||||
table.tree td.logged_in {
|
||||
font-size: 10px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.tree td.logged_in a {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
table.tree td.logged_in a:hover {
|
||||
color: #CC0000;
|
||||
background-color: #EEEEEC;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Tree Global Defaults */
|
||||
table.tree tr td {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
table.tree a {
|
||||
text-decoration: none;
|
||||
color: #2E3436;
|
||||
}
|
||||
|
||||
table.tree a:hover {
|
||||
text-decoration: underline;
|
||||
color: #204A87;
|
||||
}
|
||||
|
||||
/* Tree */
|
||||
table.tree .treemenudiv {
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
table.tree .phplmnormal {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmnormal:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:link {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:visited {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #841212;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:active {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #ff0000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:link {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #dd0000;
|
||||
background-color: #ffdd76;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:visited {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #dd0000;
|
||||
background-color: #ffdd76;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #841212;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:active {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #ff0000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Standard Form */
|
||||
table.forminput {
|
||||
background-color: #EEEEEC;
|
||||
padding: 10px;
|
||||
border: 1px solid #BABDB6;
|
||||
}
|
||||
|
||||
table.forminput td.title {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.forminput td.subtitle {
|
||||
text-align: center;
|
||||
font-weight: normal;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
table.forminput tr td.heading {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.forminput td.small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
table.forminput td.top {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.forminput input.val {
|
||||
width: 350px;
|
||||
border: 1px solid #BABDB6;
|
||||
}
|
||||
|
||||
table.forminput input.roval {
|
||||
width: 350px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
table.forminput td.icon {
|
||||
width: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.forminput td.icon img {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
table.forminput td.label {
|
||||
text-align: left;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* Menu on top of entry form */
|
||||
table.menu {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
table.menu td.icon {
|
||||
width: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Edit DN */
|
||||
div.add_value {
|
||||
font-size: 12px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
/* Edit Entry */
|
||||
table.entry {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0px;
|
||||
empty-cells: show;
|
||||
}
|
||||
|
||||
table.entry input {
|
||||
margin: 1px;
|
||||
}
|
||||
|
||||
table.entry input.value {
|
||||
font-size: 14px;
|
||||
width: 350px;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
table.entry div.helper {
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
background-color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
table.entry input.roval {
|
||||
font-size: 14px;
|
||||
width: 350px;
|
||||
background-color: #FFFFFF;
|
||||
border: none;
|
||||
}
|
||||
|
||||
table.entry textarea.value {
|
||||
font-size: 14px;
|
||||
width: 350px;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
table.entry textarea.roval {
|
||||
font-size: 14px;
|
||||
width: 350px;
|
||||
background-color: #FFFFFF;
|
||||
border: none;
|
||||
}
|
||||
|
||||
table.entry tr td {
|
||||
padding: 4px;
|
||||
padding-right: 0px;
|
||||
}
|
||||
|
||||
table.entry tr td.heading {
|
||||
border-top: 3px solid #D3D7CF;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.entry tr td.note {
|
||||
text-align: right;
|
||||
background-color: #EEEEEC;
|
||||
}
|
||||
|
||||
table.entry tr td.title {
|
||||
background-color: #EEEEEC;
|
||||
vertical-align: top;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.entry tr td.title a {
|
||||
text-decoration: none;
|
||||
color: #2E3436;
|
||||
}
|
||||
|
||||
table.entry tr td.title a:hover {
|
||||
text-decoration: underline;
|
||||
color: #204A87;
|
||||
}
|
||||
|
||||
table.entry tr td.value {
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
padding-bottom: 10px;
|
||||
padding-left: 50px;
|
||||
}
|
||||
|
||||
/** When an attr is updated, it is highlighted to indicate such */
|
||||
table.entry tr.updated td.title {
|
||||
border-top: 1px dashed #BABDB6;
|
||||
border-left: 1px dashed #BABDB6;
|
||||
background-color: #888A85;
|
||||
}
|
||||
|
||||
table.entry tr.updated td.note {
|
||||
border-top: 1px dashed #BABDB6;
|
||||
border-right: 1px dashed #BABDB6;
|
||||
background-color: #888A85;
|
||||
}
|
||||
|
||||
/** An extra row that sits at the bottom of recently modified attrs to encase them in dashes */
|
||||
table.entry tr.updated td.bottom {
|
||||
border-top: 1px dashed #BABDB6;
|
||||
}
|
||||
|
||||
/** Formatting for the value cell when it is the attribute that has been recently modified */
|
||||
table.entry tr.updated td.value {
|
||||
border-left: 1px dashed #BABDB6;
|
||||
border-right: 1px dashed #BABDB6;
|
||||
}
|
||||
|
||||
/* Need to prevent sub-tables (like the one in which jpegPhotos are displayed)
|
||||
* from drawing borders as well. */
|
||||
table.entry tr.updated td table td {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
table.entry tr.noinput {
|
||||
background: #EEEEEC;
|
||||
}
|
||||
|
||||
span.hint {
|
||||
font-size: small;
|
||||
font-weight: normal;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
/* Edit DN - EntryWriter2 */
|
||||
table.entry tr.spacer {
|
||||
background-color: #D3D7CF;
|
||||
}
|
||||
|
||||
table.entry tr td.ew2_icon {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.entry tr td.ew2_attr {
|
||||
vertical-align: top;
|
||||
text-align: right;
|
||||
font-size: 75%;
|
||||
background-color: #FFFFFF;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.entry tr td.ew2_attr a {
|
||||
text-decoration: none;
|
||||
color: #2E3436;
|
||||
}
|
||||
|
||||
table.entry tr td.ew2_attr a:hover {
|
||||
text-decoration: underline;
|
||||
color: #204A87;
|
||||
}
|
||||
|
||||
table.entry tr td.ew2_val {
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
padding-bottom: 10px;
|
||||
padding-left: 50px;
|
||||
}
|
||||
|
||||
table.entry tr.updated td.ew2_attr {
|
||||
text-align: right;
|
||||
font-size: 75%;
|
||||
border-top: 1px dashed green;
|
||||
border-left: 1px dashed green;
|
||||
border-bottom: 1px dashed green;
|
||||
background-color: #ded;
|
||||
}
|
||||
|
||||
table.entry tr.updated td.ew2_val {
|
||||
border-top: 1px dashed green;
|
||||
border-left: 1px dashed green;
|
||||
border-right: 1px dashed green;
|
||||
border-bottom: 1px dashed green;
|
||||
}
|
||||
|
||||
/* Login Box */
|
||||
#login {
|
||||
background: url('../../images/tango/ldap-uid.png') no-repeat 0 1px;
|
||||
background-color: #FFFFFF;
|
||||
padding-left: 17px;
|
||||
}
|
||||
|
||||
#login:focus {
|
||||
background-color: #EEEEEC;
|
||||
}
|
||||
|
||||
#login:disabled {
|
||||
background-color: #D3D7CF;
|
||||
}
|
||||
|
||||
#password {
|
||||
background: url('../../images/tango/key.png') no-repeat 0 1px;
|
||||
background-color: #FFFFFF;
|
||||
padding-left: 17px;
|
||||
}
|
||||
|
||||
#password:focus {
|
||||
background-color: #EEEEEC;
|
||||
}
|
||||
|
||||
#password:disabled {
|
||||
background-color: #D3D7CF;
|
||||
}
|
||||
|
||||
#generic {
|
||||
background-color: #FFFFFF;
|
||||
padding-left: 17px;
|
||||
}
|
||||
#generic:focus {
|
||||
background-color: #EEEEEC;
|
||||
}
|
||||
|
||||
#generic:disabled {
|
||||
background-color: #D3D7CF;
|
||||
}
|
||||
|
||||
/* After input results */
|
||||
div.execution_time {
|
||||
font-size: 75%;
|
||||
font-weight: normal;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.result {
|
||||
width: 100%;
|
||||
vertical-align: top;
|
||||
empty-cells: show;
|
||||
border: 1px solid #BABDB6;
|
||||
border-spacing: 0px;
|
||||
background-color: #EEEEEC;
|
||||
}
|
||||
|
||||
table.result tr.heading {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.result tr.list_title {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
table.result tr.list_title td.icon {
|
||||
text-align: center;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.result tr.list_item {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
table.result tr.list_item td.blank {
|
||||
width: 25px;
|
||||
}
|
||||
|
||||
table.result tr.list_item td.heading {
|
||||
vertical-align: top;
|
||||
color: gray;
|
||||
width: 10%;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
table.result tr.list_item td.value {
|
||||
color: #2E3436;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
table.result_table {
|
||||
border: 1px solid #BABDB6;
|
||||
border-collapse: collapse;
|
||||
empty-cells: show;
|
||||
}
|
||||
|
||||
table.result_table td {
|
||||
vertical-align: top;
|
||||
border: 1px solid #BABDB6;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
table.result_table th {
|
||||
border: 1px solid #BABDB6;
|
||||
padding: 10px;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
table.result_table tr.highlight {
|
||||
background-color: #FCE94F;
|
||||
}
|
||||
|
||||
table.result_table tr.highlight td {
|
||||
border: 1px solid #BABDB6;
|
||||
font-weight: bold;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
table.result_table td.heading {
|
||||
color: #FFFFFF;
|
||||
background-color: #3465A4;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
table.result_table td.value {
|
||||
color: #2E3436;
|
||||
background-color: #EEEEEC;
|
||||
}
|
||||
|
||||
table.result_table tr.heading {
|
||||
color: #FFFFFF;
|
||||
background-color: #3465A4;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
table.result_table tr.heading a {
|
||||
color: #FFFFFF;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
table.result_table tr.heading td {
|
||||
border: 1px solid #BABDB6;
|
||||
font-weight: normal;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
table.result_table tr.even {
|
||||
background-color: #EEEEEC;
|
||||
}
|
||||
|
||||
table.result_table tr.even td {
|
||||
border: 1px solid #BABDB6;
|
||||
font-weight: normal;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
table.result_table tr.even td.title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.result_table tr.odd {
|
||||
background-color: #EEEEEC;
|
||||
}
|
||||
|
||||
table.result_table tr.odd td {
|
||||
border: 1px solid #BABDB6;
|
||||
font-weight: normal;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
table.result_table tr.odd td.title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.result_table ul.list {
|
||||
margin: 5px;
|
||||
margin-left: 0px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
table.result_table ul.list li {
|
||||
margin-left: 0px;
|
||||
padding-left: 0px;
|
||||
}
|
||||
|
||||
table.result_table ul.list li small {
|
||||
font-size: 75%;
|
||||
color: #707070;
|
||||
}
|
||||
|
||||
table.result_table ul.list li small a {
|
||||
color: #7070C0;
|
||||
}
|
||||
|
||||
/* Error Dialog Box */
|
||||
table.error {
|
||||
width: 500px;
|
||||
border: 1px solid #AA0000;
|
||||
background-color: #FFF0F0;
|
||||
}
|
||||
|
||||
table.error th {
|
||||
background-color: #AA0000;
|
||||
border: 0px;
|
||||
color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.error th.img {
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.error td {
|
||||
border: 0px;
|
||||
background-color: #FFF0F0;
|
||||
padding: 2px;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* Popup Window */
|
||||
div.popup h3.subtitle {
|
||||
text-align: center;
|
||||
margin: 0px;
|
||||
margin-bottom: 15px;
|
||||
color: #FFFFFF;
|
||||
border-bottom: 1px solid #2E3436;
|
||||
border-left: 1px solid #2E3436;
|
||||
border-right: 1px solid #2E3436;
|
||||
background: #3465A4;
|
||||
padding: 4px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
span.good {
|
||||
color: green;
|
||||
}
|
||||
|
||||
span.bad {
|
||||
color: red;
|
||||
}
|
@@ -1,55 +1,35 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete.php,v 1.27.2.3 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* Deletes a DN and presents a "job's done" message.
|
||||
*
|
||||
* Variables that come in as POST vars:
|
||||
* - dn (rawurlencoded)
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
|
||||
# The DNs we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','REQUEST',true);
|
||||
|
||||
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete', 'simple_delete'))
|
||||
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete entry')),'error','index.php');
|
||||
if (! $app['server']->dnExists($request['dn']))
|
||||
error(sprintf('%s (%s)',_('No such entry.'),'<b>'.pretty_print_dn($request['dn']).'</b>'),'error','index.php');
|
||||
|
||||
$entry = array();
|
||||
$entry['dn'] = get_request('dn');
|
||||
|
||||
if (! $entry['dn'])
|
||||
error(_('You must specify a DN'),'error','index.php');
|
||||
|
||||
if (! $ldapserver->dnExists($entry['dn']))
|
||||
error(sprintf('%s (%s)',_('No such entry.'),'<b>'.pretty_print_dn($entry['dn']).'</b>'),'error','index.php');
|
||||
|
||||
# Check the user-defined custom callback first.
|
||||
if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn'])))
|
||||
$result = $ldapserver->delete($entry['dn']);
|
||||
else
|
||||
error(sprintf(_('Could not delete the entry: %s'),'<b>'.pretty_print_dn($entry['dn']).'</b>'),'error','index.php');
|
||||
|
||||
if ($result) {
|
||||
# Custom callback
|
||||
run_hook('post_entry_delete',
|
||||
array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn']));
|
||||
# Delete the entry.
|
||||
$result = $app['server']->delete($request['dn']);
|
||||
|
||||
if ($result)
|
||||
system_message(array(
|
||||
'title'=>_('Delete DN'),
|
||||
'body'=>_('Successfully deleted DN ').sprintf('<b>%s</b>',$entry['dn']),
|
||||
'body'=>_('Successfully deleted DN ').sprintf('<b>%s</b>',$request['dn']),
|
||||
'type'=>'info'),
|
||||
sprintf('index.php?server_id=%s',$ldapserver->server_id));
|
||||
|
||||
} else {
|
||||
sprintf('index.php?server_id=%s',$app['server']->getIndex()));
|
||||
else
|
||||
system_message(array(
|
||||
'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($entry['dn'])),
|
||||
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
|
||||
'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($request['dn'])),
|
||||
'body'=>ldap_error_msg($app['server']->getErrorMessage(null),$app['server']->getErrorNum(null)),
|
||||
'type'=>'error'));
|
||||
}
|
||||
?>
|
||||
|
@@ -1,56 +1,49 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_attr.php,v 1.16.2.2 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* Deletes an attribute from an entry with NO confirmation.
|
||||
*
|
||||
* On success, redirect to template_engine.php
|
||||
* On failure, echo an error.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','REQUEST',true);
|
||||
$request['attr'] = get_request('attr','REQUEST',true);
|
||||
$request['index'] = get_request('index','REQUEST',true);
|
||||
|
||||
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete'))
|
||||
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete attribute')),'error','index.php');
|
||||
|
||||
$entry = array();
|
||||
$entry['dn']['string'] = get_request('dn');
|
||||
$entry['dn']['encode'] = rawurlencode($entry['dn']['string']);
|
||||
$entry['attr'] = get_request('attr');
|
||||
|
||||
if (! $entry['dn']['string'])
|
||||
error(_('No DN specified'),'error','index.php');
|
||||
|
||||
if (! $entry['attr'])
|
||||
error(_('No attribute name specified.'),'error','index.php');
|
||||
|
||||
if ($ldapserver->isAttrReadOnly($entry['attr']))
|
||||
error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),htmlspecialchars($entry['attr'])),'error','index.php');
|
||||
if ($app['server']->isAttrReadOnly($request['attr']))
|
||||
error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),$request['attr']),'error','index.php');
|
||||
|
||||
$update_array = array();
|
||||
$update_array[$entry['attr']] = array();
|
||||
$update_array[$request['attr']] = $app['server']->getDNAttrValue($request['dn'],$request['attr']);
|
||||
|
||||
$result = $ldapserver->modify($entry['dn']['string'],$update_array);
|
||||
if ($result) {
|
||||
$redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',$ldapserver->server_id,$entry['dn']['encode']);
|
||||
$redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',
|
||||
$app['server']->getIndex(),rawurlencode($request['dn']));
|
||||
|
||||
foreach ($update_array as $attr => $junk)
|
||||
$redirect_url .= "&modified_attrs[]=$attr";
|
||||
|
||||
header("Location: $redirect_url");
|
||||
die();
|
||||
|
||||
} else {
|
||||
if (! isset($update_array[$request['attr']][$request['index']]))
|
||||
system_message(array(
|
||||
'title'=>_('Could not perform ldap_modify operation.'),
|
||||
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
|
||||
'type'=>'error'));
|
||||
'title'=>_('Could not delete attribute value.'),
|
||||
'body'=>sprintf('%s. %s/%s',_('The attribute value does not exist'),$request['attr'],$request['index']),
|
||||
'type'=>'warn'),$redirect_url);
|
||||
|
||||
else {
|
||||
unset($update_array[$request['attr']][$request['index']]);
|
||||
foreach ($update_array as $key => $values)
|
||||
$update_array[$key] = array_values($values);
|
||||
|
||||
$result = $app['server']->modify($request['dn'],$update_array);
|
||||
|
||||
if ($result) {
|
||||
foreach ($update_array as $attr => $junk)
|
||||
$redirect_url .= sprintf('&modified_attrs[]=%s',$attr);
|
||||
|
||||
header("Location: $redirect_url");
|
||||
die();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -1,50 +1,55 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_form.php,v 1.26.2.2 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* delete_form.php
|
||||
* Displays a last chance confirmation form to delete a dn.
|
||||
*
|
||||
* Variables that come in as GET vars:
|
||||
* - dn (rawurlencoded)
|
||||
* Displays a last chance confirmation form to delete a DN.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
|
||||
# The DN we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET');
|
||||
|
||||
$entry = array();
|
||||
$entry['dn']['string'] = get_request('dn','GET');
|
||||
$entry['dn']['html'] = htmlspecialchars($entry['dn']['string']);
|
||||
# Check if the entry exists.
|
||||
if (! $request['dn'] || ! $app['server']->dnExists($request['dn']))
|
||||
system_message(array(
|
||||
'title'=>_('Entry does not exist'),
|
||||
'body'=>sprintf('%s (%s)',_('The entry does not exist'),$request['dn']),
|
||||
'type'=>'error'),'index.php');
|
||||
|
||||
# We search all children, not only the visible children in the tree
|
||||
$entry['children'] = $ldapserver->getContainerContents($entry['dn']['string'],0,'(objectClass=*)',LDAP_DEREF_NEVER);
|
||||
$request['children'] = $app['server']->getContainerContents($request['dn'],null,0,'(objectClass=*)',LDAP_DEREF_NEVER);
|
||||
|
||||
printf('<h3 class="title">'._('Delete %s').'</h3>',htmlspecialchars(get_rdn($entry['dn']['string'])));
|
||||
printf('<h3 class="title">%s %s</h3>',_('Delete'),get_rdn($request['dn']));
|
||||
printf('<h3 class="subtitle">%s: <b>%s</b> %s: <b>%s</b></h3>',
|
||||
_('Server'),$ldapserver->name,_('Distinguished Name'),$entry['dn']['html']);
|
||||
_('Server'),$app['server']->getName(),_('Distinguished Name'),$request['dn']);
|
||||
echo "\n";
|
||||
|
||||
echo '<center>';
|
||||
|
||||
if (count($entry['children'])) {
|
||||
if (count($request['children'])) {
|
||||
printf('<b>%s</b><br /><br />',_('Permanently delete all children also?'));
|
||||
|
||||
# Get the total number of child objects (whole sub-tree)
|
||||
$search['entries'] = $ldapserver->search(null,dn_escape($entry['dn']['string']),'objectClass=*',array('dn'));
|
||||
$search['count'] = count($search['entries']);
|
||||
$search['href'] = htmlspecialchars(sprintf('cmd.php?cmd=search&search=true&;server_id=%s&filter=%s&base_dn=%s&form=advanced&scope=sub',
|
||||
$ldapserver->server_id,rawurlencode('objectClass=*'),rawurlencode($entry['dn']['string'])));
|
||||
$search['href'] = htmlspecialchars(sprintf('cmd.php?cmd=query_engine&server_id=%s&filter=%s&base=%s&scope=sub&query=none&format=list',
|
||||
$app['server']->getIndex(),rawurlencode('objectClass=*'),rawurlencode($request['dn'])));
|
||||
|
||||
$query = array();
|
||||
$query['base'] = $request['dn'];
|
||||
$query['scope'] = 'sub';
|
||||
$query['attrs'] = array('dn');
|
||||
$query['size_limit'] = 0;
|
||||
$query['deref'] = LDAP_DEREF_NEVER;
|
||||
$request['search'] = $app['server']->query($query,null);
|
||||
|
||||
echo '<table class="forminput" border=0>';
|
||||
echo '<tr>';
|
||||
echo '<td colspan=2>';
|
||||
printf(_('This entry is the root of a sub-tree containing %s entries.'),$search['count']);
|
||||
printf(_('This entry is the root of a sub-tree containing %s entries.'),count($request['search']));
|
||||
printf(' <small>(<a href="%s">%s</a>)</small>',
|
||||
$search['href'],_('view entries'));
|
||||
echo '</td></tr>';
|
||||
@@ -52,7 +57,7 @@ if (count($entry['children'])) {
|
||||
echo '<tr><td colspan=2> </td></tr>';
|
||||
|
||||
printf('<tr><td colspan=2>%s</td></tr>',
|
||||
sprintf(_('phpLDAPadmin can recursively delete this entry and all %s of its children. See below for a list of all the entries that this action will delete. Do you want to do this?'),$search['count']-1));
|
||||
sprintf(_('phpLDAPadmin can recursively delete this entry and all %s of its children. See below for a list of all the entries that this action will delete. Do you want to do this?'),count($request['search'])));
|
||||
|
||||
echo '<tr><td colspan=2> </td></tr>';
|
||||
|
||||
@@ -64,17 +69,17 @@ if (count($entry['children'])) {
|
||||
echo '<td width=50%><center>';
|
||||
echo '<form action="cmd.php" method="post">';
|
||||
echo '<input type="hidden" name="cmd" value="rdelete" />';
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($entry['dn']['string']));
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
printf('<input type="submit" value="%s" />',sprintf(_('Delete all %s objects'),$search['count']));
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($request['dn']));
|
||||
printf('<input type="submit" value="%s" />',sprintf(_('Delete all %s objects'),count($request['search'])));
|
||||
echo '</form>';
|
||||
echo '</center></td>';
|
||||
|
||||
echo '<td width=50%><center>';
|
||||
echo '<form action="cmd.php" method="get">';
|
||||
echo '<input type="hidden" name="cmd" value="template_engine" />';
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($entry['dn']['string']));
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($request['dn']));
|
||||
printf('<input type="submit" name="submit" value="%s" />',_('Cancel'));
|
||||
echo '</form>';
|
||||
echo '</center></td>';
|
||||
@@ -88,12 +93,10 @@ if (count($entry['children'])) {
|
||||
echo _('List of entries to be deleted:');
|
||||
echo '<br />';
|
||||
|
||||
printf('<select size="%s" multiple disabled style="background:white; color:black;width:500px" >',min(10,$search['count']));
|
||||
$i = 0;
|
||||
foreach ($search['entries'] as $dn => $junk) {
|
||||
$i++;
|
||||
printf('<option>%s. %s</option>',$i,htmlspecialchars(dn_unescape($dn)));
|
||||
}
|
||||
printf('<select size="%s" multiple disabled style="background:white; color:black;width:500px" >',min(10,count($request['search'])));
|
||||
foreach ($request['search'] as $key => $value)
|
||||
printf('<option>%s. %s</option>',++$i,dn_unescape($value['dn']));
|
||||
echo '</select>';
|
||||
echo "\n";
|
||||
|
||||
@@ -103,9 +106,9 @@ if (count($entry['children'])) {
|
||||
printf('<tr><td colspan=4>%s</td></tr>',_('Are you sure you want to permanently delete this object?'));
|
||||
echo '<tr><td colspan=4> </td></tr>';
|
||||
|
||||
printf('<tr><td width=10%%>%s:</td><td colspan=3 width=75%%><b>%s</b></td></tr>',_('Server'),htmlspecialchars($ldapserver->name));
|
||||
printf('<tr><td width=10%%>%s:</td><td colspan=3 width=75%%><b>%s</b></td></tr>',_('Server'),$app['server']->getName());
|
||||
printf('<tr><td width=10%%><acronym title="%s">%s</acronym></td><td colspan=3 width=75%%><b>%s</b></td></tr>',
|
||||
_('Distinguished Name'),_('DN'),$entry['dn']['string']);
|
||||
_('Distinguished Name'),_('DN'),$request['dn']);
|
||||
echo '<tr><td colspan=4> </td></tr>';
|
||||
echo "\n";
|
||||
|
||||
@@ -113,8 +116,8 @@ if (count($entry['children'])) {
|
||||
echo '<td colspan=2 width=50%><center>';
|
||||
echo '<form action="cmd.php" method="post">';
|
||||
echo '<input type="hidden" name="cmd" value="delete" />';
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($entry['dn']['string']));
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($request['dn']));
|
||||
printf('<input type="submit" name="submit" value="%s" />',_('Delete'));
|
||||
echo '</form>';
|
||||
|
||||
@@ -123,8 +126,8 @@ if (count($entry['children'])) {
|
||||
|
||||
echo '<form action="cmd.php" method="get">';
|
||||
echo '<input type="hidden" name="cmd" value="template_engine" />';
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($entry['dn']['string']));
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($request['dn']));
|
||||
printf('<input type="submit" name="submit" value="%s" />',_('Cancel'));
|
||||
echo '</form>';
|
||||
|
||||
|
@@ -1,45 +1,49 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/download_binary_attr.php,v 1.15.2.4 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* Download a binary value attribute to the user.
|
||||
* A server ID, DN and Attribute must be provided in the GET attributes.
|
||||
* Optionally an index, type and filename can be supplied.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* Variables that come in via common.php
|
||||
* - server_id
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET');
|
||||
$request['attr'] = strtolower(get_request('attr','GET',true));
|
||||
$request['index'] = get_request('index','GET',false,0);
|
||||
$request['type'] = get_request('type','GET',false,'octet-stream');
|
||||
$request['filename'] = get_request('filename','GET',false,sprintf('%s:%s.bin',get_rdn($request['dn'],true),$request['attr']));
|
||||
|
||||
if (! $ldapserver->haveAuthInfo())
|
||||
error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php');
|
||||
if (! $app['server']->dnExists($request['dn']))
|
||||
error(sprintf(_('The entry (%s) does not exist.'),$request['dn']),'error','index.php');
|
||||
|
||||
$dn = rawurldecode(get_request('dn','GET'));
|
||||
$attr = get_request('attr','GET');
|
||||
|
||||
# if there are multiple values in this attribute, which one do you want to see?
|
||||
$value_num = get_request('value_num','GET');
|
||||
|
||||
if (! $ldapserver->dnExists($dn))
|
||||
error(sprintf('%s (%s)',_('No such entry.'),pretty_print_dn($dn)),'error','index.php');
|
||||
|
||||
$search = $ldapserver->search(null,$dn,'(objectClass=*)',array($attr),'base',false,$_SESSION[APPCONFIG]->GetValue('deref','view'));
|
||||
$search = $app['server']->getDNAttrValues($request['dn'],null,LDAP_DEREF_NEVER,array($request['attr']));
|
||||
|
||||
# Dump the binary data to the browser
|
||||
$obStatus = ob_get_status();
|
||||
if (isset($obStatus['type']) && $obStatus['type'] && $obStatus['status'])
|
||||
ob_end_clean();
|
||||
|
||||
header('Content-type: octet-stream');
|
||||
header("Content-disposition: attachment; filename=$attr");
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
if (! isset($search[$request['attr']][$request['index']])) {
|
||||
# We cant display an error, but we can set a system message, which will be display on the next page render.
|
||||
system_message(array(
|
||||
'title'=>_('No binary data available'),
|
||||
'body'=>sprintf(_('Could not fetch binary data from LDAP server for attribute [%s].'),$request['attr']),
|
||||
'type'=>'warn'));
|
||||
|
||||
if ($value_num && is_array($search[$attr][$dn]))
|
||||
echo $search[$dn][$attr][$value_num];
|
||||
else
|
||||
echo $search[$dn][$attr];
|
||||
die();
|
||||
}
|
||||
|
||||
header(sprintf('Content-type: %s',$request['type']));
|
||||
header(sprintf('Content-disposition: attachment; filename="%s"',$request['filename']));
|
||||
header(sprintf('Expires: Mon, 26 Jul 1997 05:00:00 GMT',gmdate('r')));
|
||||
header(sprintf('Last-Modified: %s',gmdate('r')));
|
||||
echo $search[$request['attr']][$request['index']];
|
||||
die();
|
||||
?>
|
||||
|
@@ -1,42 +1,61 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/draw_tree_node.php,v 1.2.2.2 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* Draw a portion of the LDAP tree.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Tree
|
||||
*/
|
||||
|
||||
$entry = array();
|
||||
$entry['dn'] = get_request('dn','REQUEST');
|
||||
$entry['server_id'] = get_request('server_id','REQUEST');
|
||||
$entry['code'] = get_request('code','REQUEST');
|
||||
$entry['action'] = get_request('action','REQUEST');
|
||||
/**
|
||||
*/
|
||||
|
||||
$tree = Tree::getInstance($entry['server_id']);
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','REQUEST');
|
||||
$request['server_id'] = get_request('server_id','REQUEST');
|
||||
$request['code'] = get_request('code','REQUEST');
|
||||
$request['action'] = get_request('action','REQUEST');
|
||||
$request['noheader'] = get_request('noheader','REQUEST',false,0);
|
||||
|
||||
$tree = Tree::getInstance($request['server_id']);
|
||||
if (! $tree)
|
||||
die();
|
||||
|
||||
$dnentry = $tree->getEntry($entry['dn']);
|
||||
if (! $dnentry) {
|
||||
$tree->addEntry($entry['dn']);
|
||||
$dnentry = $this->getEntry($entry['dn']);
|
||||
}
|
||||
$treesave = false;
|
||||
|
||||
if (! $dnentry)
|
||||
die();
|
||||
if ($request['dn']) {
|
||||
$dnentry = $tree->getEntry($request['dn']);
|
||||
|
||||
if ($entry['action'] == 0) {
|
||||
$dnentry->close();
|
||||
if (! $dnentry) {
|
||||
$tree->addEntry($request['dn']);
|
||||
$dnentry = $tree->getEntry($request['dn']);
|
||||
$treesave = true;
|
||||
}
|
||||
|
||||
} elseif ($entry['action'] == 2) {
|
||||
$dnentry->open();
|
||||
switch ($request['action']) {
|
||||
case 0:
|
||||
$dnentry->close();
|
||||
|
||||
} else {
|
||||
$dnentry->open();
|
||||
if ($entry['dn']) {
|
||||
echo $tree->draw_children($dnentry,$entry['code']);
|
||||
} else {
|
||||
$tree->draw(true);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
default:
|
||||
if ($dnentry->isSizeLimited()) {
|
||||
$tree->readChildren($request['dn'],true);
|
||||
|
||||
$treesave = true;
|
||||
}
|
||||
|
||||
$dnentry->open();
|
||||
}
|
||||
}
|
||||
|
||||
if ($treesave)
|
||||
set_cached_item($app['server']->getIndex(),'tree','null',$tree);
|
||||
|
||||
if ($request['dn'])
|
||||
echo $tree->draw_children($dnentry,$request['code']);
|
||||
else
|
||||
$tree->draw($request['noheader']);
|
||||
|
||||
die();
|
||||
?>
|
||||
|
@@ -1,125 +1,121 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/entry_chooser.php,v 1.31.2.5 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* Display a selection (popup window) to pick a DN.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
include './common.php';
|
||||
include HTDOCDIR.'header.php';
|
||||
|
||||
$entry = array();
|
||||
$entry['container'] = get_request('container','GET');
|
||||
$entry['element'] = get_request('form_element','GET');
|
||||
$entry['rdn'] = get_request('rdn','GET');
|
||||
$www['page'] = new page();
|
||||
|
||||
$request = array();
|
||||
$request['container'] = get_request('container','GET');
|
||||
$request['element'] = get_request('form_element','GET');
|
||||
$request['rdn'] = get_request('rdn','GET');
|
||||
|
||||
echo '<body>';
|
||||
echo '<div class="popup">';
|
||||
printf('<h3 class="subtitle">%s</h3>',_('Entry Chooser'));
|
||||
?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
function returnDN(dn) {
|
||||
opener.document.<?php echo $entry['element']; ?>.value = dn;
|
||||
close();
|
||||
}
|
||||
</script>
|
||||
echo '<script type="text/javascript" language="javascript">';
|
||||
echo ' function returnDN(dn) {';
|
||||
printf(' opener.document.%s.value = dn;',$request['element']);
|
||||
echo ' close();';
|
||||
echo ' }';
|
||||
echo '</script>';
|
||||
|
||||
<?php
|
||||
echo '<table class="forminput" width=100% border=0>';
|
||||
if ($entry['container']) {
|
||||
printf('<tr><td class="heading" colspan=3>%s:</td><td>%s</td></tr>',_('Server'),htmlspecialchars($ldapserver->name));
|
||||
printf('<tr><td class="heading" colspan=3>%s:</td><td>%s</td></tr>',_('Looking in'),htmlspecialchars($entry['container']));
|
||||
if ($request['container']) {
|
||||
printf('<tr><td class="heading" colspan=3>%s:</td><td>%s</td></tr>',_('Server'),$app['server']->getName());
|
||||
printf('<tr><td class="heading" colspan=3>%s:</td><td>%s</td></tr>',_('Looking in'),$request['container']);
|
||||
echo '<tr><td class="blank" colspan=4> </td></tr>';
|
||||
}
|
||||
|
||||
/* Has the use already begun to descend into a specific server tree? */
|
||||
if (isset($ldapserver) && ! is_null($entry['container'])) {
|
||||
# Has the user already begun to descend into a specific server tree?
|
||||
if (isset($app['server']) && ! is_null($request['container'])) {
|
||||
|
||||
if (! $ldapserver->haveAuthInfo())
|
||||
error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php');
|
||||
$request['children'] = $app['server']->getContainerContents($request['container'],null,0,'(objectClass=*)',$_SESSION[APPCONFIG]->getValue('deref','tree'));
|
||||
sort($request['children']);
|
||||
|
||||
$entry['children'] = $ldapserver->getContainerContents($entry['container'],0,'(objectClass=*)',$_SESSION[APPCONFIG]->GetValue('deref','tree'));
|
||||
sort($entry['children']);
|
||||
|
||||
foreach ($ldapserver->getBaseDN() as $base_dn) {
|
||||
foreach ($app['server']->getBaseDN() as $base) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Comparing BaseDN [%s] with container [%s]',64,__FILE__,__LINE__,__METHOD__,$base_dn,$entry['container']);
|
||||
debug_log('Comparing BaseDN [%s] with container [%s]',64,0,__FILE__,__LINE__,__METHOD__,$base,$request['container']);
|
||||
|
||||
if (! pla_compare_dns($entry['container'],$base_dn)) {
|
||||
if (! pla_compare_dns($request['container'],$base)) {
|
||||
$parent_container = false;
|
||||
$href['up'] = htmlspecialchars(sprintf('entry_chooser.php?form_element=%s&rdn=%s',$entry['element'],$entry['rdn']));
|
||||
$href['up'] = sprintf('entry_chooser.php?form_element=%s&rdn=%s',$request['element'],rawurlencode($request['rdn']));
|
||||
break;
|
||||
|
||||
} else {
|
||||
$parent_container = get_container($entry['container']);
|
||||
$href['up'] = htmlspecialchars(sprintf('entry_chooser.php?form_element=%s&rdn=%s&server_id=%s&container=%s',
|
||||
$entry['element'],$entry['rdn'],$ldapserver->server_id,rawurlencode($parent_container)));
|
||||
$parent_container = $app['server']->getContainer($request['container']);
|
||||
$href['up'] = sprintf('entry_chooser.php?form_element=%s&rdn=%s&server_id=%s&container=%s',
|
||||
$request['element'],$request['rdn'],$app['server']->getIndex(),rawurlencode($parent_container));
|
||||
}
|
||||
}
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td class="blank"> </td>';
|
||||
printf('<td class="icon"><a href="%s"><img src="%s/up.png" alt="Up" /></a></td>',$href['up'],IMGDIR);
|
||||
printf('<td colspan=2><a href="%s">%s</a></td>',$href['up'],_('Back Up...'));
|
||||
printf('<td colspan=2><a href="%s">%s...</a></td>',$href['up'],_('Back Up'));
|
||||
echo '</tr>';
|
||||
|
||||
if (! count($entry['children']))
|
||||
if (! count($request['children']))
|
||||
printf('<td class="blank" colspan=2> </td><td colspan=2">(%s)</td>',_('no entries'));
|
||||
|
||||
else
|
||||
foreach ($entry['children'] as $dn) {
|
||||
$href['return'] = sprintf("javascript:returnDN('%s%s')",($entry['rdn'] ? sprintf('%s,',$entry['rdn']) : ''),rawurlencode($dn));
|
||||
$href['expand'] = htmlspecialchars(sprintf('entry_chooser.php?server_id=%s&form_element=%s&rdn=%s&container=%s',
|
||||
$ldapserver->server_id,$entry['element'],$entry['rdn'],rawurlencode($dn)));
|
||||
foreach ($request['children'] as $dn) {
|
||||
$href['return'] = sprintf("javascript:returnDN('%s%s')",($request['rdn'] ? sprintf('%s,',$request['rdn']) : ''),rawurlencode($dn));
|
||||
$href['expand'] = sprintf('entry_chooser.php?server_id=%s&form_element=%s&rdn=%s&container=%s',
|
||||
$app['server']->getIndex(),$request['element'],$request['rdn'],rawurlencode($dn));
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td class="blank"> </td>';
|
||||
printf('<td class="icon"><a href="%s"><img src="%s/plus.png" alt="Plus" /></a></td>',$href['expand'],IMGDIR);
|
||||
|
||||
printf('<td colspan=2><a href="%s">%s</a></td>',$href['return'],htmlspecialchars($dn));
|
||||
printf('<td colspan=2><a href="%s">%s</a></td>',$href['return'],$dn);
|
||||
echo '</tr>';
|
||||
echo "\n\n";
|
||||
}
|
||||
|
||||
/* draw the root of the selection tree (ie, list all the servers) */
|
||||
# Draw the root of the selection tree (ie, list all the servers)
|
||||
} else {
|
||||
foreach ($_SESSION[APPCONFIG]->ldapservers->GetServerList() as $id) {
|
||||
foreach ($_SESSION[APPCONFIG]->getServerList() as $index => $server) {
|
||||
if ($server->isLoggedIn(null)) {
|
||||
printf('<tr><td class="heading" colspan=3>%s:</td><td class="heading">%s</td></tr>',_('Server'),$server->getName());
|
||||
foreach ($server->getBaseDN() as $dn) {
|
||||
if (! $dn) {
|
||||
printf('<tr><td class="blank"> </td><td colspan=3>(%s)</td></tr>',_('Could not determine base DN'));
|
||||
|
||||
$ldapserver = $_SESSION[APPCONFIG]->ldapservers->Instance($id);
|
||||
} else {
|
||||
$href['return'] = sprintf("javascript:returnDN('%s%s')",($request['rdn'] ? sprintf('%s,',$request['rdn']) : ''),rawurlencode($dn));
|
||||
$href['expand'] = htmlspecialchars(sprintf('entry_chooser.php?server_id=%s&form_element=%s&rdn=%s&container=%s',
|
||||
$server->getIndex(),$request['element'],$request['rdn'],rawurlencode($dn)));
|
||||
|
||||
if ($ldapserver->isVisible()) {
|
||||
|
||||
if (! $ldapserver->haveAuthInfo())
|
||||
continue;
|
||||
|
||||
else {
|
||||
printf('<tr><td class="heading" colspan=3>%s:</td><td class="heading">%s</td></tr>',_('Server'),htmlspecialchars($ldapserver->name));
|
||||
foreach ($ldapserver->getBaseDN() as $dn) {
|
||||
if (! $dn) {
|
||||
printf('<tr><td class="blank"> </td><td colspan=3>(%s)</td></tr>',_('Could not determine base DN'));
|
||||
|
||||
} else {
|
||||
$href['return'] = sprintf("javascript:returnDN('%s%s')",($entry['rdn'] ? sprintf('%s,',$entry['rdn']) : ''),rawurlencode($dn));
|
||||
$href['expand'] = htmlspecialchars(sprintf('entry_chooser.php?server_id=%s&form_element=%s&rdn=%s&container=%s',
|
||||
$ldapserver->server_id,$entry['element'],$entry['rdn'],rawurlencode($dn)));
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td class="blank"> </td>';
|
||||
printf('<td colspan=2 class="icon"><a href="%s"><img src="%s/plus.png" alt="Plus" /></a></td>',$href['expand'],IMGDIR);
|
||||
printf('<td colspan=2><a href="%s">%s</a></td>',$href['return'],htmlspecialchars($dn));
|
||||
}
|
||||
echo '<tr>';
|
||||
echo '<td class="blank"> </td>';
|
||||
printf('<td colspan=2 class="icon"><a href="%s"><img src="%s/plus.png" alt="Plus" /></a></td>',$href['expand'],IMGDIR);
|
||||
printf('<td colspan=2><a href="%s">%s</a></td>',$href['return'],$dn);
|
||||
}
|
||||
|
||||
echo '<tr><td class="blank" colspan=4> </td></tr>';
|
||||
}
|
||||
|
||||
echo '<tr><td class="blank" colspan=4> </td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
echo '</body>';
|
||||
|
||||
# Capture the output and put into the body of the page.
|
||||
$www['body'] = new block();
|
||||
$www['body']->SetBody(ob_get_contents());
|
||||
$www['page']->block_add('body',$www['body']);
|
||||
ob_end_clean();
|
||||
|
||||
# Render the popup.
|
||||
$www['page']->display(array('CONTROL'=>false,'FOOT'=>false,'HEAD'=>false,'TREE'=>false));
|
||||
?>
|
||||
|
@@ -1,26 +1,27 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/expand.php,v 1.26 2007/12/15 07:50:30 wurley Exp $
|
||||
|
||||
/**
|
||||
* This script alters the session variable 'tree', expanding it
|
||||
* at the dn specified in the query string.
|
||||
*
|
||||
* Note: this script is equal and opposite to collapse.php
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Tree
|
||||
* @see collapse.php
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$dn = get_request('dn','GET',true);
|
||||
$tree = get_cached_item($ldapserver->server_id,'tree');
|
||||
$tree = get_cached_item($app['server']->getIndex(),'tree');
|
||||
$entry = $tree->getEntry($dn);
|
||||
$entry->open();
|
||||
set_cached_item($ldapserver->server_id,'tree','null',$tree);
|
||||
set_cached_item($app['server']->getIndex(),'tree','null',$tree);
|
||||
|
||||
header(sprintf('Location:index.php?server_id=%s&junk=%s#%s%s',
|
||||
$ldapserver->server_id,random_junk(),htmlid($ldapserver->server_id,$dn),pla_session_param()));
|
||||
$app['server']->getIndex(),random_junk(),htmlid($app['server']->getIndex(),$dn),app_session_param()));
|
||||
die();
|
||||
?>
|
||||
|
@@ -1,117 +1,40 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/export.php,v 1.18.2.4 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* Performs the export of data from the LDAP server
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# Fix a bug with IE:
|
||||
ini_set('session.cache_limiter','');
|
||||
|
||||
require LIBDIR.'export_functions.php';
|
||||
|
||||
if (! $_SESSION[APPCONFIG]->isCommandAvailable('export'))
|
||||
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('export')),'error','index.php');
|
||||
|
||||
$entry = array();
|
||||
$entry['base_dn'] = get_request('dn');
|
||||
$entry['format'] = get_request('format','POST',false,'unix');
|
||||
$entry['scope'] = get_request('scope','POST',false,'base');
|
||||
$entry['filter'] = get_request('filter','POST',false,'objectclass=*');
|
||||
$entry['attr'] = get_request('attributes');
|
||||
$entry['sys_attr'] = get_request('sys_attr');
|
||||
$entry['file'] = get_request('save_as_file') ? true : false;
|
||||
$entry['exporter_id'] = get_request('exporter_id');
|
||||
|
||||
if ($entry['filter']) {
|
||||
$entry['filter'] = preg_replace('/\s+/','',$entry['filter']);
|
||||
$attributes = split(',',preg_replace('/\s+/','',$entry['attr']));
|
||||
|
||||
} else {
|
||||
$attributes = array();
|
||||
}
|
||||
|
||||
# Add system attributes if needed
|
||||
if ($entry['sys_attr']) {
|
||||
array_push($attributes,'*');
|
||||
array_push($attributes,'+');
|
||||
}
|
||||
|
||||
(! is_null($entry['exporter_id'])) or error(_('You must choose an export format.'),'error','index.php');
|
||||
isset($exporters[$entry['exporter_id']]) or error(_('Invalid export format'),'error','index.php');
|
||||
|
||||
# Initialisation of other variables
|
||||
$friendly_rdn = get_rdn($entry['base_dn'],1);
|
||||
$extension = $exporters[$entry['exporter_id']]['extension'];
|
||||
|
||||
# default case not really needed
|
||||
switch ($entry['format']) {
|
||||
case 'win':
|
||||
$br = "\r\n";
|
||||
break;
|
||||
case 'mac':
|
||||
$br = "\r";
|
||||
break;
|
||||
case 'unix':
|
||||
default:
|
||||
$br = "\n";
|
||||
}
|
||||
|
||||
# get the decoree,ie the source
|
||||
$plaLdapExporter = new PlaLdapExporter($ldapserver->server_id,$entry['filter'],$entry['base_dn'],$entry['scope'],$attributes);
|
||||
|
||||
# the decorator do it that way for the moment
|
||||
$exporter = null;
|
||||
|
||||
switch ($entry['exporter_id']) {
|
||||
case 0:
|
||||
$exporter = new PlaLdifExporter($plaLdapExporter);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$exporter = new PlaDsmlExporter($plaLdapExporter);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$exporter = new PlaVcardExporter($plaLdapExporter);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$exporter = new PlaCSVExporter($plaLdapExporter);
|
||||
break;
|
||||
|
||||
default:
|
||||
# truly speaking,this default case will never be reached. See check at the bottom.
|
||||
error(_('No available exporter found.'),'error','index.php');
|
||||
}
|
||||
|
||||
# set the CLRN
|
||||
$exporter->setOutputFormat($br);
|
||||
|
||||
if (get_request('compress','REQUEST') == 'on')
|
||||
$exporter->compress(true);
|
||||
|
||||
# prevent script from bailing early for long search
|
||||
# Prevent script from bailing early for long search
|
||||
@set_time_limit(0);
|
||||
|
||||
$request = array();
|
||||
$request['file'] = get_request('save_as_file') ? true : false;
|
||||
$request['exporter'] = new Exporter($app['server']->getIndex(),get_request('exporter_id','REQUEST'));
|
||||
$request['export'] = $request['exporter']->getTemplate();
|
||||
$types = $request['export']->getType();
|
||||
|
||||
# send the header
|
||||
if ($entry['file']) {
|
||||
if ($request['file']) {
|
||||
$obStatus = ob_get_status();
|
||||
if (isset($obStatus['type']) && $obStatus['type'] && $obStatus['status'])
|
||||
ob_end_clean();
|
||||
|
||||
header('Content-type: application/download');
|
||||
header(sprintf('Content-Disposition: filename="%s.%s"',$friendly_rdn,$exporters[$entry['exporter_id']]['extension'].($exporter->isCompressed()?'.gz':'')));
|
||||
$exporter->export();
|
||||
header(sprintf('Content-Disposition: inline; filename="%s.%s"','export',$types['extension'].($request['export']->isCompressed() ? '.gz' : '')));
|
||||
$request['export']->export();
|
||||
die();
|
||||
|
||||
} else {
|
||||
print '<span style="font-size: 14px; font-family: courier;"><pre>';
|
||||
$exporter->export();
|
||||
$request['export']->export();
|
||||
print '</pre></span>';
|
||||
}
|
||||
?>
|
||||
|
@@ -1,44 +1,50 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/export_form.php,v 1.26.2.2 2008/12/12 12:20:22 wurley Exp $
|
||||
|
||||
/**
|
||||
* export_form.php
|
||||
* Html form to choose an export format(ldif,...)
|
||||
* Export entries from the LDAP server.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
require LIBDIR.'export_functions.php';
|
||||
|
||||
$entry = array();
|
||||
$entry['format'] = get_request('format','GET',false,get_line_end_format());
|
||||
$entry['scope'] = get_request('scope','GET',false,'base');
|
||||
$entry['id'] = get_request('exporter_id','GET',false,0);
|
||||
$entry['dn'] = get_request('dn','GET');
|
||||
$entry['filter'] = get_request('filter','GET',false,'(objectClass=*)');
|
||||
$entry['attr'] = get_request('attributes','GET',false,'*');
|
||||
$entry['sys_attr'] = get_request('sys_attr','GET') ? true: false;
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET');
|
||||
$request['format'] = get_request('format','GET',false,get_line_end_format());
|
||||
$request['scope'] = get_request('scope','GET',false,'base');
|
||||
$request['exporter_id'] = get_request('exporter_id','GET',false,'LDIF');
|
||||
$request['filter'] = get_request('filter','GET',false,'(objectClass=*)');
|
||||
$request['attr'] = get_request('attributes','GET',false,'*');
|
||||
$request['sys_attr'] = get_request('sys_attr','GET') ? true: false;
|
||||
|
||||
$available_formats = array (
|
||||
'unix' => 'UNIX (Linux, BSD)',
|
||||
$available_formats = array(
|
||||
'mac' => 'Macintosh',
|
||||
'unix' => 'UNIX (Linux, BSD)',
|
||||
'win' => 'Windows'
|
||||
);
|
||||
|
||||
$available_scopes = array (
|
||||
$available_scopes = array(
|
||||
'base' => _('Base (base dn only)'),
|
||||
'one' => _('One (one level beneath base)'),
|
||||
'sub' => _('Sub (entire subtree)')
|
||||
);
|
||||
|
||||
printf('<h3 class="title">%s</h3>',_('Export'));
|
||||
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->drawTitle(sprintf('<b>%s</b>',_('Export')));
|
||||
|
||||
printf('<script type="text/javascript" language="javascript" src="%sdnChooserPopup.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" language="javascript" src="%sform_field_toggle_enable.js"></script>',JSDIR);
|
||||
|
||||
echo '<br />';
|
||||
echo '<center>';
|
||||
echo '<form name="export_form" action="cmd.php" method="post">';
|
||||
echo '<input type="hidden" name="cmd" value="export" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
|
||||
echo '<table class="forminput">';
|
||||
echo '<tr>';
|
||||
echo '<td>';
|
||||
@@ -47,11 +53,12 @@ echo '<fieldset>';
|
||||
printf('<legend>%s</legend>',_('Export'));
|
||||
|
||||
echo '<table>';
|
||||
printf('<tr><td>%s</td><td>%s</td></tr>',_('Server'),server_select_list($ldapserver->server_id));
|
||||
printf('<tr><td>%s</td><td>%s</td></tr>',_('Server'),$app['server']->getName());
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td style="white-space:nowrap">%s</td>',_('Base DN'));
|
||||
printf('<td><span style="white-space: nowrap;"><input type="text" name="dn" id="dn" style="width:230px" value="%s" /> ',htmlspecialchars($entry['dn']));
|
||||
echo '<td><span style="white-space: nowrap;">';
|
||||
printf('<input type="text" name="dn" id="dn" style="width:230px" value="%s" /> ',htmlspecialchars($request['dn']));
|
||||
draw_chooser_link('export_form.dn');
|
||||
echo '</span></td>';
|
||||
echo '</tr>';
|
||||
@@ -63,22 +70,23 @@ echo '<td>';
|
||||
|
||||
foreach ($available_scopes as $id => $desc)
|
||||
printf('<input type="radio" name="scope" value="%s" id="%s"%s /><label for="%s">%s</label><br />',
|
||||
htmlspecialchars($id),htmlspecialchars($id),($id == $entry['scope']) ? 'checked="true"' : '',
|
||||
htmlspecialchars($id),htmlspecialchars($desc));
|
||||
htmlspecialchars($id),$id,($id == $request['scope']) ? 'checked="true"' : '',
|
||||
htmlspecialchars($id),$desc);
|
||||
|
||||
echo '</td>';
|
||||
|
||||
echo '</tr>';
|
||||
|
||||
printf('<tr><td>%s</td><td><input type="text" name="filter" style="width:300px" value="%s" /></td></tr>',
|
||||
_('Search Filter'),htmlspecialchars($entry['filter']));
|
||||
_('Search Filter'),htmlspecialchars($request['filter']));
|
||||
|
||||
printf('<tr><td>%s</td><td><input type="text" name="attributes" style="width:300px" value="%s" /></td></tr>',
|
||||
_('Show Attributtes'),htmlspecialchars($entry['attr']));
|
||||
_('Show Attributtes'),htmlspecialchars($request['attr']));
|
||||
|
||||
printf('<tr><td> </td><td><input type="checkbox" name="sys_attr" id="sys_attr" %s/> <label for="sys_attr">%s</label></td></tr>',
|
||||
$entry['sys_attr'] ? 'checked="true" ' : '',_('Include system attributes'));
|
||||
$request['sys_attr'] ? 'checked="true" ' : '',_('Include system attributes'));
|
||||
|
||||
printf('<tr><td> </td><td><input type="checkbox" id="save_as_file" name="save_as_file" onclick="toggle_disable_field_saveas(this)" /> <label for="save_as_file">%s</label></td></tr>',
|
||||
printf('<tr><td> </td><td><input type="checkbox" id="save_as_file" name="save_as_file" onclick="export_field_toggle(this)" /> <label for="save_as_file">%s</label></td></tr>',
|
||||
_('Save as file'));
|
||||
|
||||
printf('<tr><td> </td><td><input type="checkbox" id="compress" name="compress" disabled /> <label for="compress">%s</label></td></tr>',
|
||||
@@ -92,71 +100,114 @@ echo '<tr>';
|
||||
echo '<td>';
|
||||
|
||||
echo '<table style="width: 100%">';
|
||||
echo '<tr><td style="width: 50%">';
|
||||
echo '<tr>';
|
||||
|
||||
echo '<td style="width: 50%">';
|
||||
echo '<fieldset style="height: 100px">';
|
||||
|
||||
printf('<legend>%s</legend>',_('Export format'));
|
||||
|
||||
foreach ($exporters as $index => $exporter) {
|
||||
printf('<input type="radio" name="exporter_id" id="exporter_id_%s" value="%s"%s />',
|
||||
htmlspecialchars($index),htmlspecialchars($index),($index==$entry['id']) ? ' checked="true"' : '');
|
||||
foreach (Exporter::types() as $index => $exporter) {
|
||||
printf('<input type="radio" name="exporter_id" id="exporter_id_%s" value="%s"%s/>',
|
||||
htmlspecialchars($exporter['type']),htmlspecialchars($exporter['type']),($exporter['type'] === $request['exporter_id']) ? ' checked="true"' : '');
|
||||
|
||||
printf('<label for="%s">%s</label><br />',
|
||||
htmlspecialchars($index),htmlspecialchars($exporter['desc']));
|
||||
htmlspecialchars($exporter['type']),$exporter['type']);
|
||||
}
|
||||
|
||||
echo '</fieldset>';
|
||||
echo '</td>';
|
||||
|
||||
echo '<td style="width: 50%">';
|
||||
echo '<fieldset style="height: 100px">';
|
||||
|
||||
printf('<legend>%s</legend>',_('Line ends'));
|
||||
foreach ($available_formats as $id => $desc)
|
||||
printf('<input type="radio" name="format" value="%s" id="%s"%s /><label for="%s">%s</label><br />',
|
||||
htmlspecialchars($id),htmlspecialchars($id),($entry['format']==$id) ? ' checked="true"' : '',
|
||||
htmlspecialchars($id),htmlspecialchars($desc));
|
||||
htmlspecialchars($id),htmlspecialchars($id),($request['format']==$id) ? ' checked="true"' : '',
|
||||
htmlspecialchars($id),$desc);
|
||||
|
||||
echo '</fieldset>';
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
echo '</td>';
|
||||
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td colspan="2">';
|
||||
printf('<center><input type="submit" name="target" value="%s" /></center>',
|
||||
printf('<tr><td colspan="2"><center><input type="submit" name="target" value="%s" /></center></td></tr>',
|
||||
htmlspecialchars(_('Proceed >>')));
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo '</form>';
|
||||
echo '</center>';
|
||||
|
||||
/**
|
||||
* Helper functoin for fetching the line end format.
|
||||
* Helper function for fetching the line end format.
|
||||
*
|
||||
* @return String 'win', 'unix', or 'mac' based on the user's browser..
|
||||
*/
|
||||
function get_line_end_format() {
|
||||
if (is_browser_os_windows())
|
||||
if (is_browser('win'))
|
||||
return 'win';
|
||||
elseif (is_browser_os_unix())
|
||||
elseif (is_browser('unix'))
|
||||
return 'unix';
|
||||
elseif (is_browser_os_mac())
|
||||
elseif (is_browser('mac'))
|
||||
return 'mac';
|
||||
else
|
||||
return 'unix';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the USER_AGENT string from the $_SERVER array, all in lower case in
|
||||
* an E_NOTICE safe manner.
|
||||
*
|
||||
* @return string|false The user agent string as reported by the browser.
|
||||
*/
|
||||
function get_user_agent_string() {
|
||||
if (isset($_SERVER['HTTP_USER_AGENT']))
|
||||
return strtolower($_SERVER['HTTP_USER_AGENT']);
|
||||
else
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the OS for the browser
|
||||
*/
|
||||
function is_browser($type) {
|
||||
$agents = array();
|
||||
|
||||
$agents['unix'] = array(
|
||||
'sunos','sunos 4','sunos 5',
|
||||
'i86',
|
||||
'irix','irix 5','irix 6','irix6',
|
||||
'hp-ux','09.','10.',
|
||||
'aix','aix 1','aix 2','aix 3','aix 4',
|
||||
'inux',
|
||||
'sco',
|
||||
'unix_sv','unix_system_v','ncr','reliant','dec','osf1',
|
||||
'dec_alpha','alphaserver','ultrix','alphastation',
|
||||
'sinix',
|
||||
'freebsd','bsd',
|
||||
'x11','vax','openvms'
|
||||
);
|
||||
|
||||
$agents['win'] = array(
|
||||
'win','win95','windows 95',
|
||||
'win16','windows 3.1','windows 16-bit','windows','win31','win16','winme',
|
||||
'win2k','winxp',
|
||||
'win98','windows 98','win9x',
|
||||
'winnt','windows nt','win32',
|
||||
'32bit'
|
||||
);
|
||||
|
||||
$agents['mac'] = array(
|
||||
'mac','68000','ppc','powerpc'
|
||||
);
|
||||
|
||||
if (isset($agents[$type]))
|
||||
return in_array(get_user_agent_string(),$agents[$type]);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
<!--
|
||||
function toggle_disable_field_saveas(id) {
|
||||
if (id.checked) {
|
||||
id.form.compress.disabled = false;
|
||||
} else {
|
||||
id.form.compress.disabled = true;
|
||||
id.form.compress.checked = false;
|
||||
}
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
|
@@ -1,69 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/header.php,v 1.27.2.2 2008/01/27 11:57:38 wurley Exp $
|
||||
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
require_once LIBDIR.'./common.php';
|
||||
|
||||
/* We want to get $language into scope in case we were included
|
||||
from within a function */
|
||||
$language = isset($_SESSION[APPCONFIG]) ? $language = $_SESSION[APPCONFIG]->GetValue('appearance','language') : 'auto';
|
||||
|
||||
# text/xml won't work with MSIE, but is very useful for debugging xhtml code.
|
||||
# header('Content-type: text/xml; charset="UTF-8"');
|
||||
@header('Content-type: text/html; charset="UTF-8"');
|
||||
|
||||
# XML version and encoding for well-behaved browsers
|
||||
echo '<?xml version="1.0" encoding="utf-8"?>'."\n";
|
||||
|
||||
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'."\n";
|
||||
echo '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
|
||||
|
||||
printf('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="%s" lang="%s" dir="ltr">',$language,$language);
|
||||
echo "\n\n";
|
||||
|
||||
echo '<head>';
|
||||
|
||||
if (isset($_SESSION[APPCONFIG]) && $pagetitle = $_SESSION[APPCONFIG]->GetValue('appearance','page_title'))
|
||||
printf('<title>phpLDAPadmin - %s</title>',$pagetitle);
|
||||
else
|
||||
echo '<title>phpLDAPadmin</title>';
|
||||
|
||||
if (isset($_SESSION[APPCONFIG]))
|
||||
$css = $_SESSION[APPCONFIG]->GetValue('appearance','stylesheet');
|
||||
else
|
||||
$css = 'style.css';
|
||||
printf('<link type="text/css" rel="stylesheet" href="%s%s" media="screen" />',CSSDIR,$css);
|
||||
|
||||
if (isset($server_id)) {
|
||||
$custom_file = get_custom_file($server_id,'style.css',CSSDIR);
|
||||
|
||||
if (strcmp($custom_file,'style.css') != 0)
|
||||
printf('<link type="text/css" rel="stylesheet" href="%s" media="screen" />',$custom_file);
|
||||
}
|
||||
|
||||
printf('<script type="text/javascript" src="%sentry_chooser.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sie_png_work_around.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sgeneric_utils.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sto_ascii.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%smodify_member.js"></script>',JSDIR);
|
||||
printf('<link type="text/css" rel="stylesheet" media="all" href="%s/jscalendar/calendar-blue.css" title="blue" />',JSDIR);
|
||||
|
||||
echo "\n<!--\n";
|
||||
printf('<script type="text/javascript" src="%sjscalendar/calendar.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sjscalendar/lang/calendar-en.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sjscalendar/calendar-setup.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sdate_selector.js"></script>',JSDIR);
|
||||
echo "\n-->\n";
|
||||
|
||||
printf('<link type="text/css" rel="stylesheet" href="%s/phplayersmenu/layerstreemenu.css"></link>',JSDIR);
|
||||
|
||||
if (isset($meta_refresh_variable))
|
||||
printf('<meta http-equiv="refresh" content="%s" />',$meta_refresh_variable);
|
||||
|
||||
echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
|
||||
echo '</head>';
|
||||
echo "\n\n";
|
||||
?>
|
6
htdocs/images/INFO
Normal file
@@ -0,0 +1,6 @@
|
||||
PLA's icons come from http://jimmac.musichall.cz/ikony.php3, or the projects that
|
||||
he drew them for.
|
||||
|
||||
They are open source, either licensed under the GPL or a CC license.
|
||||
|
||||
They are great icons so be sure to let Jakub know :)
|
Before Width: | Height: | Size: 528 B After Width: | Height: | Size: 528 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 928 B After Width: | Height: | Size: 928 B |
Before Width: | Height: | Size: 278 B After Width: | Height: | Size: 278 B |
Before Width: | Height: | Size: 478 B After Width: | Height: | Size: 478 B |
BIN
htdocs/images/default/catalog.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 342 B |
Before Width: | Height: | Size: 662 B After Width: | Height: | Size: 662 B |
Before Width: | Height: | Size: 707 B After Width: | Height: | Size: 707 B |
Before Width: | Height: | Size: 700 B After Width: | Height: | Size: 700 B |
Before Width: | Height: | Size: 340 B After Width: | Height: | Size: 340 B |
Before Width: | Height: | Size: 661 B After Width: | Height: | Size: 661 B |
Before Width: | Height: | Size: 500 B After Width: | Height: | Size: 500 B |
Before Width: | Height: | Size: 692 B After Width: | Height: | Size: 692 B |
Before Width: | Height: | Size: 856 B After Width: | Height: | Size: 856 B |
Before Width: | Height: | Size: 364 B After Width: | Height: | Size: 364 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 796 B After Width: | Height: | Size: 796 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
htdocs/images/default/export.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 738 B After Width: | Height: | Size: 738 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
htdocs/images/default/help.png
Normal file
After Width: | Height: | Size: 738 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 844 B After Width: | Height: | Size: 844 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
@@ -3,12 +3,12 @@
|
||||
* This will show a nice table of all the icons used by phpLDAPadmin.
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="../style.css" media="screen" />
|
||||
</head>
|
||||
<body>
|
||||
<h3 class="title">phpLDAPadmin icons</h3>
|
Before Width: | Height: | Size: 966 B After Width: | Height: | Size: 966 B |
Before Width: | Height: | Size: 510 B After Width: | Height: | Size: 510 B |
BIN
htdocs/images/default/invalid.png
Normal file
After Width: | Height: | Size: 692 B |
Before Width: | Height: | Size: 519 B After Width: | Height: | Size: 519 B |
Before Width: | Height: | Size: 440 B After Width: | Height: | Size: 440 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 654 B After Width: | Height: | Size: 654 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 773 B After Width: | Height: | Size: 773 B |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 733 B After Width: | Height: | Size: 733 B |
Before Width: | Height: | Size: 751 B After Width: | Height: | Size: 751 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
BIN
htdocs/images/default/login.png
Normal file
After Width: | Height: | Size: 654 B |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 829 B After Width: | Height: | Size: 829 B |
Before Width: | Height: | Size: 899 B After Width: | Height: | Size: 899 B |
Before Width: | Height: | Size: 993 B After Width: | Height: | Size: 993 B |
Before Width: | Height: | Size: 938 B After Width: | Height: | Size: 938 B |
Before Width: | Height: | Size: 98 B After Width: | Height: | Size: 98 B |
BIN
htdocs/images/default/monitorserver-big.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 483 B After Width: | Height: | Size: 483 B |
Before Width: | Height: | Size: 408 B After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 243 B After Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 971 B After Width: | Height: | Size: 971 B |