RELEASE 1.1.0

This commit is contained in:
Deon George 2009-06-30 20:46:00 +10:00
parent a08bc4e9e1
commit dd581eb5c8
191 changed files with 25012 additions and 10177 deletions

View File

@ -5,7 +5,7 @@ For install instructions in non-English languages, see the wiki:
phpLDAPadmin requires the following: phpLDAPadmin requires the following:
a. A web server (Apache, IIS, etc). a. A web server (Apache, IIS, etc).
b. PHP 4.1.0 or newer (with LDAP support) b. PHP 5.0.0 or newer (with LDAP support)
* To install * To install

View File

@ -1 +1 @@
$Name: RELEASE-1_0_0 $ $Name: RELEASE-1_1_0 $

View File

@ -66,6 +66,67 @@ $config->custom->session['blowfish'] = '';
environments. */ environments. */
# $config->custom->password['no_random_crypt_salt'] = true; # $config->custom->password['no_random_crypt_salt'] = true;
/*********************************************/
/* Commands */
/*********************************************/
/* 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' => false,
'export' => true,
'search' => array('simple_search' => true,
'predefined_search' => false,
'advanced_search' => false),
'server_refresh' => false,
'server_info' => false,
'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);
*/
/*********************************************/
/* Appearance */
/*********************************************/
/* If you want to choose the appearance of the tree, specify a class name which
inherits from the Tree class. */
// $config->custom->appearance['tree'] = "HTMLTree";
# $config->custom->appearance['tree'] = "PLMTree";
/* 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";
/* Configure what objects are shown in left hand tree */ /* Configure what objects are shown in left hand tree */
// $config->custom->appearance['tree_filter'] = '(objectclass=*)'; // $config->custom->appearance['tree_filter'] = '(objectclass=*)';
@ -94,12 +155,14 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
auto-detect it for you. */ auto-detect it for you. */
// $ldapservers->SetValue($i,'server','base',array('')); // $ldapservers->SetValue($i,'server','base',array(''));
/* Three options for auth_type: /* Four options for auth_type:
1. 'cookie': you will login via a web form, and a client-side cookie will 1. 'cookie': you will login via a web form, and a client-side cookie will
store your login dn and password. store your login dn and password.
2. 'session': same as cookie but your login dn and password are stored on the 2. 'session': same as cookie but your login dn and password are stored on the
web server in a persistent session variable. web server in a persistent session variable.
3. 'config': specify your login dn and password here in this config file. No 3. 'http': same as session but your login dn and password are retrieved via
HTTP authentication.
4. 'config': specify your login dn and password here in this config file. No
login will be required to use phpLDAPadmin for this server. login will be required to use phpLDAPadmin for this server.
Choose wisely to protect your authentication information appropriately for Choose wisely to protect your authentication information appropriately for
@ -188,6 +251,14 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
users in. See 'login_string' directly below. */ users in. See 'login_string' directly below. */
// $ldapservers->SetValue($i,'login','attr','dn'); // $ldapservers->SetValue($i,'login','attr','dn');
/* If you specified something different from 'dn', for example 'uid', as the
login_attr above, you can optionally specify here to fall back to
authentication with dn.
This is useful, when users should be able to log in with their uid, but
the ldap administrator wants to log in with his root-dn, that does not
necessarily have the uid attribute. */
// $ldapservers->SetValue($i,'login','fallback_dn',false);
/* If you specified 'cookie' or 'session' as the auth_type above, and you /* 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 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 logging users in. If, for example, I have a lot of user entries with DNs like

4567
doc/certs/ca-bundle.crt Normal file

File diff suppressed because it is too large Load Diff

17
doc/certs/slapd.crt Normal file
View File

@ -0,0 +1,17 @@
-----BEGIN CERTIFICATE-----
MIICtTCCAh6gAwIBAgIBADANBgkqhkiG9w0BAQQFADBMMQswCQYDVQQGEwJHQjES
MBAGA1UECBMJQmVya3NoaXJlMRAwDgYDVQQHEwdOZXdidXJ5MRcwFQYDVQQKEw5N
eSBDb21wYW55IEx0ZDAeFw0wNTA5MTUwMjAyMTNaFw0yMTA3MjYxNjM2NTNaMEwx
CzAJBgNVBAYTAkdCMRIwEAYDVQQIEwlCZXJrc2hpcmUxEDAOBgNVBAcTB05ld2J1
cnkxFzAVBgNVBAoTDk15IENvbXBhbnkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GN
ADCBiQKBgQCr6PfdngYTUobwJDwIqY7ywDCWd/IJ+SL2hbe46558oVI7Vw2GbqWn
VZ1fJa0wV2pcy/e10HzZX+RpIwKOZUQvbH1jHJyZ/0bt7on8jmI5o+p+rLVspci5
yVNcgu1tQttpyKnTrDSDkLVbQ6VX8FKLnKnZ7+dk8SNibt0KbzKnOQIDAQABo4Gm
MIGjMB0GA1UdDgQWBBQ4xLvszjgfXgWht8V6s1eRAZS/OjB0BgNVHSMEbTBrgBQ4
xLvszjgfXgWht8V6s1eRAZS/OqFQpE4wTDELMAkGA1UEBhMCR0IxEjAQBgNVBAgT
CUJlcmtzaGlyZTEQMA4GA1UEBxMHTmV3YnVyeTEXMBUGA1UEChMOTXkgQ29tcGFu
eSBMdGSCAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQAgzaIKI03l
lZmX7IpLN3vqC/PL6QQTUQkdDRXJYGH+DdURx7v0nE/kkb3R3X92BpNxe5jywhHg
A5NaUhjAR76+F3Guk/4XFaWPctJ2PvfJWolS/VrY+KGc3N4zz9A2i8B6SHBzE6V8
EHkcGJtGXkFvCVp1ZbCyejJhw4PUEYawsQ==
-----END CERTIFICATE-----

15
doc/certs/slapd.key Normal file
View File

@ -0,0 +1,15 @@
-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgQCr6PfdngYTUobwJDwIqY7ywDCWd/IJ+SL2hbe46558oVI7Vw2G
bqWnVZ1fJa0wV2pcy/e10HzZX+RpIwKOZUQvbH1jHJyZ/0bt7on8jmI5o+p+rLVs
pci5yVNcgu1tQttpyKnTrDSDkLVbQ6VX8FKLnKnZ7+dk8SNibt0KbzKnOQIDAQAB
AoGAdfKYpag3WOiFhpwFyJe1aV5tt79CBI+36lZicHDQw4fXqLkYoYSnCYFXQSHT
ithfNJ4JLeiG0InXaD9KELLwLU2C7rr7mgOBczzmVBGCYUDNuV3bMcNDOQk/drum
GLGqHhxU6W0dlCUnoBZoEHK6dvtDZnxCa+cUBozvFbuLOTUCQQDZJf+Mz7vc78nn
Cc7nnHFfO+79NQi9h0ydW6kb2LLSGB/f3oqwary8eqCs7RVinG21PMWbjrh0lGOJ
DjYP6dLDAkEAyqrs8pgxcxSTcJiaU4/sxGCeaS4fvoeCbYvKLlS5k5Km6DmA3nY+
KwxQyLHg64g1ImDSuLy3P/E2lZGCPhZGUwJAMVUxpqL3Mi2D+CpBSFtBYnpyRDJN
Rwm6/TD6zWnAznxOmYSsi4HkWQmfAUpnhly1i+w/lKSrAUlJB7Uj0R+1EwJAOADv
pUIFOCXRcGXbD4hQBxwj6jDCuOW9VwQwBImJFoyJ7tYlFFRcbYzjrfHpk2x6MlvL
Hx2XDeZcDQy+juWc3QJAHOpmlHuWqS07i5UIXVl5ohhoWkFd9Qs7/TowyFQF3zpO
BqnwfHZRpySjSUlNE0QpoJRJQPq7p3BWtS3PWMj0/A==
-----END RSA PRIVATE KEY-----

13
doc/demo-reset.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
for i in $(grep directory phpldapadmin-demo.conf|awk '{print $2}'); do
rm -f $i/*dbb $i/alock $i/log.*
done
slapadd -b "dc=example.com" -l ldif-example.com
slapadd -b "dc=example,dc=com" -l ldif-example-com
slapadd -b "o=Simpsons" -l ldif-Simpsons
for i in $(grep directory phpldapadmin-demo.conf|awk '{print $2}'); do
chown -R ldap:ldap $i
done

461
doc/ldif-Simpsons Normal file
View File

@ -0,0 +1,461 @@
# extended LDIF
#
# LDAPv3
# base <o=Simpsons> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#
# Simpsons
dn: o=Simpsons
o: Simpsons
objectClass: organization
objectClass: top
# People, Simpsons
dn: ou=People,o=Simpsons
ou: People
objectClass: organizationalUnit
objectClass: top
# Pets, Simpsons
dn: ou=Pets,o=Simpsons
ou: Pets
objectClass: organizationalUnit
objectClass: top
# Santas Little Helper, Pets, Simpsons
dn: cn=Santas Little Helper,ou=Pets,o=Simpsons
givenName: Santas Little Helper
sn: Simpson
objectClass: inetOrgPerson
objectClass: top
jpegPhoto:: /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFh
EYIx8lJCIfIiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/2wBDAQoLCw4NDhwQEBw7KCI
oOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCABn
AEsDASIAAhEBAxEB/8QAGwABAAIDAQEAAAAAAAAAAAAAAAQGAgUHAwH/xAA8EAACAQMCAwYDAwkJA
AAAAAABAgMABBEFIQYSMRMiQVFhcTKBkRRCogcVI5KhsbLB0TM0U2JygoPw8f/EABoBAAIDAQEAAA
AAAAAAAAAAAAAEAwUGAgH/xAArEQACAgECAwcEAwAAAAAAAAABAgADEQQxEhMhBXGBkbHR8BQyQWF
R4fH/2gAMAwEAAhEDEQA/AOwXNzDZ273FxIsUSDLOxwBXPdS46vYb+WeC4SOJMGK0lQASKTyg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2qJxleNrOswaHbEssbfpMdOY9fo
Dj/c3lVzsbGKzsobdVGI1A6VCgzYz+Hln3xJXOEC+Pnj2kulKVNIopSlEIpSlEIpSlEJVOFtCktb2
6vb0rJcGRsMDnOT1q10pXgAAwJ6SScmf//Z
o: The Simpsons
cn: Santas Little Helper
# Bart Simpson, People, Simpsons
dn: cn=Bart Simpson,ou=People,o=Simpsons
cn: Bart Simpson
gidNumber: 1000
givenName: Bart
homeDirectory: /home/users/simpsons/bart
jpegPhoto:: /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw
8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRw
hMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAB1
AEEDASIAAhEBAxEB/8QAHAAAAgIDAQEAAAAAAAAAAAAAAAcFBgIDBAEI/8QARxAAAgEDAwIEAgQIC
A8AAAAAAQIDAAQRBRIhBjETQVFxImEUgYKRBxUzQlOhscIWUnKSk8HS4RcjJTI2Q1RVYnSistHw8f
/EABsBAAEFAQEAAAAAAAAAAAAAAAUAAgMEBgEH/8QAMBEAAQMCAwUHAwUAAAAAAAAAAQACAwQRBSE
xBhJBUXETYaGxwdHwFCKBMkJSkeH/2gAMAwEAAhEDEQA/AH/RRRSSRUFrWs3FnJPaW9rIZDbho51I
O12LAfCe4BUE+44qdqv9QIV1HT5/zSssPuTtYfqRqoYnNJBSPli1aL+/gpImhzwCow3GtM/iC+USQ
gJCTyko5JMijAycgcdtuRjJFcx06UxmI3szRA+JGHO5lm/SZz34yB6knz4kKK83fjFc/WQ/Le3nzK
JCCMcFG/iuVZTLHeOkpxLuC8fSP0xGeT5EeY47V36Ml3b63bwfTppLY+I4iY9vhGcn84ljn5ZrOtm
m/wCkNt/y8v7UohguIVUldHG+QkE5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EuSBkkkk5JJPJ
JJJJPJJoopOc5xu43SZGyMWYLDuXRRRRTU9f//Z
mail: bart.simpson@example.com
o: The Simpsons
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
roomNumber: 45
sn: Simpson
telephoneNumber: +15551234567
uid: bart
uidNumber: 1000
userPassword:: ZWF0bXlzaG9ydHM=
# Homer Simpson, People, Simpsons
dn: cn=Homer Simpson,ou=People,o=Simpsons
cn: Homer Simpson
gidNumber: 1000
givenName: Homer
homeDirectory: /home/users/simpsons/homer
jpegPhoto:: /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFh
EYIx8lJCIfIiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/2wBDAQoLCw4NDhwQEBw7KCI
oOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCABP
AHIDASIAAhEBAxEB/8QAGwAAAgIDAQAAAAAAAAAAAAAABAUDBgACBwH/xABHEAACAQIEBAEHBgoIB
wAAAAABAgMEEQAFEiEGEzFBIhQyNVFhcYEHFlWRk6EVI0JSU2JzdJKyJFSCosHR0uEXJTSkscLT/8
QAGgEAAwEBAQEAAAAAAAAAAAAAAgMEBQYBAP/EAC4RAAEEAQMCAwYHAAAAAAAAAAEAAgMRBBIhMQV
BE1FhInGhsdHwFBUygZHB4f/aAAwDAQACEQMRAD8AFyDIMnn4foJpsspZJHp0ZmaIEsSOpOGHzbyP
6Io/sVwLw/RyPw7lzCvqkvTIdKlLDbtdMMHo2jRnfM6tVUEsS0dgB1PmYQTvyqQNuEBX5RkNDBzDk
9EzNcKDEoGwJJJtsAASevsBJAwD+CqaNVkk4fotDMFGqlVASTYC+tmW52uV6kXtiw0fC8mZaKnMay
sEFrxU5ZVaxsbsQoIJsNhYjueoDZ+GcskjKMlSQbX/AKbNv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NrXBYkYzD1Kv/9
k=
mail: homer.simpson@example.com
o: The Simpsons
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
roomNumber: 45
sn: Simpson
telephoneNumber: +15551234567
uid: homer
uidNumber: 1001
userPassword:: ZWF0bXlzaG9ydHM=
# Lisa Simpson, People, Simpsons
dn: cn=Lisa Simpson,ou=People,o=Simpsons
cn: Lisa Simpson
gidNumber: 1000
givenName: Lisa
homeDirectory: /home/users/simpsons/lisa
jpegPhoto:: /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFh
EYIx8lJCIfIiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/2wBDAQoLCw4NDhwQEBw7KCI
oOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCACA
AEwDASIAAhEBAxEB/8QAHAAAAQUBAQEAAAAAAAAAAAAABgEDBAUHAAII/8QAORAAAgECBAQEAwYGA
QUAAAAAAQIDBBEABRIhBjFBURMUImEycYEHFTNCYqEjUnKCkbEkU4OSsvD/xAAaAQACAwEBAAAAAA
AAAAAAAAAEBQADBgIB/8QAMREAAQMCBAMFCAMBAAAAAAAAAQACAwQRBRIhMUFRYROB0eHwBhQicZG
hwfEVQrFS/9oADAMBAAIRAxEAPwDZcR66siy+gnrJgxjgjaRgouSAL2Hvh/FNxY1sheO/400MfzBk
W/7XxxI/Iwu5C69aLkBe4eKMokYJLVeUc7aapTFv2BawP0JwmdZ4tFGlPRlJayddUY5rGv8A1G9uw
/MduVyB07gg8jzHfDUNNT02rwIIodZu3hoF1HubYyp9oJDGRks7nw+iY+5jNvorPJ86ly+daXMKiS
amma0dRK12jcn4WP8AKxOx6E25FQCmSWOFC8rqijmzGwH1wDOiSxtHIodHBVlYXBB5gjDPkaTUGNN
E7DkzoGb/ACd8eUuOuji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UxjlMUkUxW4YANzBIIswxhEcSx3O7
M3xOeZxsv2cZSaDhOOWZPXXSGpseikAL/lVU/XBkE7pXEHZKMWwqGhga5pOYnbpx/HmizC47HYMWc
XYYraSKvopaScHw5VKkqbEdiD0IO4PQgYfx2Ios541q5RkS1VUwFZSrUZdUFRa7yRgowHQMUjI7a7
cwcZhAA7vL7lF9gDb/d/2xtnGuSHMaCVotvMIsE2xNrNqicgb2STn+l3PQYySm4dzxak5d9z1nm0d
lMYiJA3Njr+G36r298LaqE5s7RutV7PVMMWYSuA469P2VBlkVFF3RCxChnNgCep9uv0wzSKLuRq0p
6E121aee/vvv8sa/wAM/ZzTUeWVP3zpnq62FoWCHaBGG4U9W/V7C3UkeoPskzdaloqvMaRKYSMfGi
DNI4Jv8JACm3ube+OfdXhmm5R4x2mfVF7yQ1o0035+XyVRwfw2/E2crFIh8jTkPVN0I6R/Nv2Fz2v
t6gKoVQAALADpiHk+TUWRZbHQUEWiJNyTuzt1Zj1J/wDtsTcHQxCJtll8Rr3105kOg4DkF//Z
mail: lisa.simpson@example.com
o: The Simpsons
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
roomNumber: 45
sn: Simpson
telephoneNumber: +15551234567
uid: lisa
uidNumber: 1002
userPassword:: YnJhaW5z
# Maggie Simpson, People, Simpsons
dn: cn=Maggie Simpson,ou=People,o=Simpsons
cn: Maggie Simpson
gidNumber: 1000
givenName: Maggie
homeDirectory: /home/users/simpsons/maggie
jpegPhoto:: /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFh
EYIx8lJCIfIiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/2wBDAQoLCw4NDhwQEBw7KCI
oOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCABm
AE0DASIAAhEBAxEB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+qMH5fi/oE2w+DBJlb7UWljPDRwwiMMO4JJY889CPtVoUBV
CgYAGAKKKqexnO2O5oqorpGqxqf//Z
mail: maggie.simpson@example.com
o: The Simpsons
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
roomNumber: 45
sn: Simpson
telephoneNumber: +15551234567
uid: maggie
uidNumber: 1003
userPassword:: ZHVtbXk=
# Marge Simpson, People, Simpsons
dn: cn=Marge Simpson,ou=People,o=Simpsons
gidNumber: 1000
givenName: Marg
homeDirectory: /home/users/simpsons/marg
mail: marg.simpson@example.com
o: The Simpsons
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
roomNumber: 45
sn: Simpson
telephoneNumber: +15551234567
uid: marg
uidNumber: 1004
userPassword:: Ymx1ZWhhaXI=
cn: Marge Simpson
jpegPhoto:: R0lGODlhhABwAIcAAAAAAAICBQIEAgUFAQUFBAICCwYICw4EBAsJAgkJCAgJDQ4NCA
0NDQECEgEDGwsMEA4QDhMEAhILAhANARANBBYODhwCARoJARMQAhIQBBURARQRBBcVAhIQCBEQDRQ
SDhgSABkUARwTARwVAB0YARISERsbGwIEIgIEKgEENAAEPAQINAQIOiMBASwCAiIbATUDAz0CAicg
AiogASsjBCskAS0jAS0kAS4oBTEnATQqAjkuATswAz0xATwxBj80BCIiIikpKS8vLzQ0NDk5OT09P
QIFQwEGTAQJRAMITQEFUQEGWwMIUwMIWgIIYwIIbAAGcQAGfwEIdAEIfEICAksBAVIBAV8AAEAzAU
E1AUU2AUU3BEU4AUw8AVA+AWEBAWsCAnIBAXwBAU5ABFRDAlhGAVxHAltJAWFNAWBNBGJQBGVRAmp
UAW1YAW1YBHFZAHFaBHFcAnRaAnVdAXVeBHleAHdgAntiAURERElJSU1NTVJSUllZWV1dXWFhYWVl
ZWxsbHJycnV1dXt7ewAIg4QBAYwBAZIAAJsCAqICAqsCArQDA7sCAoFlAYRpAohqAIptAIxuAo1wA
pN0AZZ5Bph3AJp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search: 2
result: 0 Success
# numResponses: 10
# numEntries: 9

588
doc/ldif-example-com Normal file
View File

@ -0,0 +1,588 @@
# extended LDIF
#
# LDAPv3
# base <dc=example,dc=com> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#
# example.com
dn: dc=example,dc=com
dc: example
objectClass: dNSDomain
# AU, example.com
dn: c=AU,dc=example,dc=com
c: AU
objectClass: country
objectClass: top
description: Australia
# DE, example.com
dn: c=DE,dc=example,dc=com
c: DE
objectClass: country
objectClass: top
description: Germany
# GB, example.com
dn: c=GB,dc=example,dc=com
c: GB
objectClass: country
objectClass: top
description: Great Britain
# FR, example.com
dn: c=FR,dc=example,dc=com
c: FR
objectClass: country
objectClass: top
description: France
# NO, example.com
dn: c=NO,dc=example,dc=com
c: NO
description: Norway
objectClass: country
objectClass: top
# SE, example.com
dn: c=SE,dc=example,dc=com
c: SE
objectClass: country
objectClass: top
# US, example.com
dn: c=US,dc=example,dc=com
c: US
description: United States of America
objectClass: country
objectClass: top
# RU, example.com
dn: c=RU,dc=example,dc=com
c: RU
objectClass: country
objectClass: top
# \D0\A7\D0\B5\D0\BB\D0\BE\D0\B2\D0\B5\D0\BA\D0\B8, RU, example.com
dn:: Y2490KfQtdC70L7QstC10LrQuCxjPVJVLGRjPWV4YW1wbGUsZGM9Y29t
cn:: 0KfQtdC70L7QstC10LrQuA==
objectClass: inetOrgPerson
objectClass: top
sn:: 0KfQtdC70L7QstC10LrQuA==
# \D0\94\D0\B5\D0\B4 \D0\9B\D0\BE\D0\B3\D0\BE\D0\BF\D0\B5\D0\B4, \D0\A7\D0\B5
\D0\BB\D0\BE\D0\B2\D0\B5\D0\BA\D0\B8, RU, example.com
dn:: Y2490JTQtdC0INCb0L7Qs9C+0L/QtdC0LGNuPdCn0LXQu9C+0LLQtdC60LgsYz1SVSxkYz1le
GFtcGxlLGRjPWNvbQ==
cn:: 0JTQtdC0INCb0L7Qs9C+0L/QtdC0
givenName:: 0JTQtdC0
jpegPhoto:: /9j/4AAQ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objectClass: top
sn:: 0JvQvtCz0L7Qv9C10LQ=
# IT, example.com
dn: c=IT,dc=example,dc=com
c: IT
objectClass: country
objectClass: top
# ES, example.com
dn: c=ES,dc=example,dc=com
c: ES
objectClass: country
objectClass: top
# Simpsons, US, example.com
dn: o=Simpsons,c=US,dc=example,dc=com
o: Simpsons
objectClass: organization
objectClass: top
# People, Simpsons, US, example.com
dn: ou=People,o=Simpsons,c=US,dc=example,dc=com
objectClass: organizationalUnit
objectClass: top
ou: People
# Bart Simpson, People, Simpsons, US, example.com
dn: cn=Bart Simpson,ou=People,o=Simpsons,c=US,dc=example,dc=com
cn: Bart Simpson
gidNumber: 1000
givenName: Bart
homeDirectory: /home/users/simpsons/bart
jpegPhoto:: /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw
8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRw
hMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAB1
AEEDASIAAhEBAxEB/8QAHAAAAgIDAQEAAAAAAAAAAAAAAAcFBgIDBAEI/8QARxAAAgEDAwIEAgQIC
A8AAAAAAQIDAAQRBRIhBjETQVFxImEUgYKRBxUzQlOhscIWUnKSk8HS4RcjJTI2Q1RVYnSistHw8f
/EABsBAAEFAQEAAAAAAAAAAAAAAAUAAgMEBgEH/8QAMBEAAQMCAwUHAwUAAAAAAAAAAQACAwQRBSE
xBhJBUXETYaGxwdHwFCKBMkJSkeH/2gAMAwEAAhEDEQA/AH/RRRSSRUFrWs3FnJPaW9rIZDbho51I
O12LAfCe4BUE+44qdqv9QIV1HT5/zSssPuTtYfqRqoYnNJBSPli1aL+/gpImhzwCow3GtM/iC+USQ
gJCTyko5JMijAycgcdtuRjJFcx06UxmI3szRA+JGHO5lm/SZz34yB6knz4kKK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XBVgQwIYgg+vkcGlPrP4lsNdk0u40UNOnJns7l4EPtGd4H30UVM17m/pNkx8
bJBZ4B6rXpFjonUGsro8OmTW0uVk+lS3bSlQrBuEwq547nOPQ05bKyt9PtEtrWPZEuSBkkkk5JJPJ
JJJJPJJoopOc5xu43SZGyMWYLDuXRRRRTU9f//Z
mail: bart.simpson@example.com
o: The Simpsons
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
roomNumber: 45
sn: Simpson
telephoneNumber: +15551234567
uid: bart
uidNumber: 1000
userPassword:: ZWF0bXlzaG9ydHM=
# Homer Simpson, People, Simpsons, US, example.com
dn: cn=Homer Simpson,ou=People,o=Simpsons,c=US,dc=example,dc=com
cn: Homer Simpson
gidNumber: 1000
givenName: Homer
homeDirectory: /home/users/simpsons/homer
jpegPhoto:: /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFh
EYIx8lJCIfIiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/2wBDAQoLCw4NDhwQEBw7KCI
oOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCABP
AHIDASIAAhEBAxEB/8QAGwAAAgIDAQAAAAAAAAAAAAAABAUDBgACBwH/xABHEAACAQIEBAEHBgoIB
wAAAAABAgMEEQAFEiEGEzFBIhQyNVFhcYEHFlWRk6EVI0JSU2JzdJKyJFSCosHR0uEXJTSkscLT/8
QAGgEAAwEBAQEAAAAAAAAAAAAAAgMEBQYBAP/EAC4RAAEEAQMCAwYHAAAAAAAAAAEAAgMRBBIhMQV
BE1FhInGhsdHwFBUygZHB4f/aAAwDAQACEQMRAD8AFyDIMnn4foJpsspZJHp0ZmaIEsSOpOGHzbyP
6Io/sVwLw/RyPw7lzCvqkvTIdKlLDbtdMMHo2jRnfM6tVUEsS0dgB1PmYQT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axPbeu
484FzClaiqOKc0ejcjmQNASHAN7FjHrtcD8rHxaDuQvASFML9+vfHvfFYp+PMiECLUVzNKoszCF7M
Rtq6d+vxxJ8/eHP66/2D/5YVpKp1N81zDOvTlf+8yfzHGYjzOZKnNKueI3jlnd1NrXBYkYzD1Kv/9
k=
mail: homer.simpson@example.com
o: The Simpsons
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
roomNumber: 45
sn: Simpson
telephoneNumber: +15551234567
uid: homer
uidNumber: 1001
userPassword:: ZWF0bXlzaG9ydHM=
# Lisa Simpson, People, Simpsons, US, example.com
dn: cn=Lisa Simpson,ou=People,o=Simpsons,c=US,dc=example,dc=com
cn: Lisa Simpson
gidNumber: 1000
givenName: Lisa
homeDirectory: /home/users/simpsons/lisa
jpegPhoto:: /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFh
EYIx8lJCIfIiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/2wBDAQoLCw4NDhwQEBw7KCI
oOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCACA
AEwDASIAAhEBAxEB/8QAHAAAAQUBAQEAAAAAAAAAAAAABgEDBAUHAAII/8QAORAAAgECBAQEAwYGA
QUAAAAAAQIDBBEABRIhBjFBURMUImEycYEHFTNCYqEjUnKCkbEkU4OSsvD/xAAaAQACAwEBAAAAAA
AAAAAAAAAEBQADBgIB/8QAMREAAQMCBAMFCAMBAAAAAAAAAQACAwQRBRIhMUFRYROB0eHwBhQicZG
hwfEVQrFS/9oADAMBAAIRAxEAPwDZcR66siy+gnrJgxjgjaRgouSAL2Hvh/FNxY1sheO/400MfzBk
W/7XxxI/Iwu5C69aLkBe4eKMokYJLVeUc7aapTFv2BawP0JwmdZ4tFGlPRlJayddUY5rGv8A1G9uw
/Mdu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xpX2XVVBk/DuZ11ZmKQ05lR38ayCNivqHv6tSjuFHPG
cRwhGMjnXIRuxH7DsMNR1VUsUkKOpWclFBG6qGfVbsDq3PM8rgHc6GTI64VmK0E8zRZ2pN7cth4aa
961rMftdyell8Okoqur32awjDfIH1f5AwR8McUUvE+WNWwwyUxjlMUkUxW4YANzBIIswxhEcSx3O7
M3xOeZxsv2cZSaDhOOWZPXXSGpseikAL/lVU/XBkE7pXEHZKMWwqGhga5pOYnbpx/HmizC47HYMWc
XYYraSKvopaScHw5VKkqbEdiD0IO4PQgYfx2Ios541q5RkS1VUwFZSrUZdUFRa7yRgowHQMUjI7a7
cwcZhAA7vL7lF9gDb/d/2xtnGuSHMaCVotvMIsE2xNrNqicgb2STn+l3PQYySm4dzxak5d9z1nm0d
lMYiJA3Njr+G36r298LaqE5s7RutV7PVMMWYSuA469P2VBlkVFF3RCxChnNgCep9uv0wzSKLuRq0p
6E121aee/vvv8sa/wAM/ZzTUeWVP3zpnq62FoWCHaBGG4U9W/V7C3UkeoPskzdaloqvMaRKYSMfGi
DNI4Jv8JACm3ube+OfdXhmm5R4x2mfVF7yQ1o0035+XyVRwfw2/E2crFIh8jTkPVN0I6R/Nv2Fz2v
t6gKoVQAALADpiHk+TUWRZbHQUEWiJNyTuzt1Zj1J/wDtsTcHQxCJtll8Rr3105kOg4DkF//Z
mail: lisa.simpson@example.com
o: The Simpsons
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
roomNumber: 45
sn: Simpson
telephoneNumber: +15551234567
uid: lisa
uidNumber: 1002
userPassword:: YnJhaW5z
# Maggie Simpson, People, Simpsons, US, example.com
dn: cn=Maggie Simpson,ou=People,o=Simpsons,c=US,dc=example,dc=com
cn: Maggie Simpson
gidNumber: 1000
givenName: Maggie
homeDirectory: /home/users/simpsons/maggie
jpegPhoto:: /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFh
EYIx8lJ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mZX38UWEbsjx3G5Tg4RSM/4q3W2uW94GMEUmF67wF/8ARNFFEDa4HeA66ay+iJjceIbS0k8uaObd
jP0KCP3IqZot5/aG7NrpyYkAyTcHYAPtuz+1FFRe5whIMsqx62vCEdNyzJ4OuTGWk1VVk9Et/oHzl
sn7EfasP7H3v/Nbf/wm/wDrRRQ38Td+qMH5fi/oE2w+DBJlb7UWljPDRwwiMMO4JJY889CPtVoUBV
CgYAGAKKKqexnO2O5oqorpGqxqf//Z
mail: maggie.simpson@example.com
o: The Simpsons
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
roomNumber: 45
sn: Simpson
telephoneNumber: +15551234567
uid: maggie
uidNumber: 1003
userPassword:: ZHVtbXk=
# Marge Simpson, People, Simpsons, US, example.com
dn: cn=Marge Simpson,ou=People,o=Simpsons,c=US,dc=example,dc=com
cn: Marge Simpson
gidNumber: 1000
givenName: Marg
homeDirectory: /home/users/simpsons/marg
jpegPhoto:: R0lGODlhhABwAIcAAAAAAAICBQIEAgUFAQUFBAICCwYICw4EBAsJAgkJCAgJDQ4NCA
0NDQECEgEDGwsMEA4QDhMEAhILAhANARANBBYODhwCARoJARMQAhIQBBURARQRBBcVAhIQCBEQDRQ
SDhgSABkUARwTARwVAB0YARISERsbGwIEIgIEKgEENAAEPAQINAQIOiMBASwCAiIbATUDAz0CAicg
AiogASsjBCskAS0jAS0kAS4oBTEnATQqAjkuATswAz0xATwxBj80BCIiIikpKS8vLzQ0NDk5OT09P
QIFQwEGTAQJRAMITQEFUQEGWwMIUwMIWgIIYwIIbAAGcQAGfwEIdAEIfEICAksBAVIBAV8AAEAzAU
E1AUU2AUU3BEU4AUw8AVA+AWEBAWsCAnIBAXwBAU5ABFRDAlhGAVxHAltJAWFNAWBNBGJQBGVRAmp
UAW1YAW1YBHFZAHFaBHFcAnRaAnVdAXVeBHleAHdgAntiAURERElJSU1NTVJSUllZWV1dXWFhYWVl
ZWxsbHJycnV1dXt7ewAIg4QBAY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wjnbWBnUjDL7AASJy
eR55EUEQhi6JLiMACf0SCbsklBDxlFAZlVI5lVIZEAA7
mail: marg.simpson@example.com
o: The Simpsons
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
roomNumber: 45
sn: Simpson
telephoneNumber: +15551234567
uid: marg
uidNumber: 1004
userPassword:: Ymx1ZWhhaXI=
# Pets, Simpsons, US, example.com
dn: ou=Pets,o=Simpsons,c=US,dc=example,dc=com
objectClass: organizationalUnit
objectClass: top
ou: Pets
# Santas Little Helper, Pets, Simpsons, US, example.com
dn: cn=Santas Little Helper,ou=Pets,o=Simpsons,c=US,dc=example,dc=com
cn: Santas Little Helper
givenName: Santas Little Helper
jpegPhoto:: /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFh
EYIx8lJCIfIiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/2wBDAQoLCw4NDhwQEBw7KCI
oOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCABn
AEsDASIAAhEBAxEB/8QAGwABAAIDAQEAAAAAAAAAAAAAAAQGAgUHAwH/xAA8EAACAQMCAwYDAwkJA
AAAAAABAgMABBEFIQYSMRMiQVFhcTKBkRRCogcVI5KhsbLB0TM0U2JygoPw8f/EABoBAAIDAQEAAA
AAAAAAAAAAAAAEAwUGAgH/xAArEQACAgECAwcEAwAAAAAAAAABAgADEQQxEhMhBXGBkbHR8BQyQWF
R4fH/2gAMAwEAAhEDEQA/AOwXNzDZ273FxIsUSDLOxwBXPdS46vYb+WeC4SOJMGK0lQASKTygsSOY
EnyPd8tjm+6lp8Op2MlpcKGjfHUZwQcg+4IqkrwRpdlqsrzS3sskcSFRAOaR+duUkbE4XAzjpk52p
bUV2uBy2xj55Rih6kJ5i5+es834l1uWTtRfiLO4ijhQoP1gWP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6SScmf//Z
o: The Simpsons
objectClass: inetOrgPerson
objectClass: top
sn: Simpson
# simpsons, Simpsons, US, example.com
dn: cn=simpsons,o=Simpsons,c=US,dc=example,dc=com
cn: simpsons
objectClass: groupOfUniqueNames
objectClass: top
uniqueMember: cn=Bart Simpson,ou=People,o=Simpsons
uniqueMember: cn=Homer Simpson,ou=People,o=Simpsons
uniqueMember: cn=Lisa Simpson,ou=People,o=Simpsons
uniqueMember: cn=Maggie Simpson,ou=People,o=Simpsons
uniqueMember: cn=Marge Simpson,ou=People,o=Simpsons
# search result
search: 2
result: 0 Success
# numResponses: 24
# numEntries: 23

215
doc/ldif-example.com Normal file
View File

@ -0,0 +1,215 @@
# extended LDIF
#
# LDAPv3
# base <dc=example.com> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#
# example.com
dn: dc=example.com
dc: example.com
objectClass: dNSDomain
# Bad DNs, example.com
dn: ou=Bad DNs,dc=example.com
ou: Bad DNs
objectClass: organizationalUnit
# double plus \2B\2B, Bad DNs, example.com
dn: c=double plus \2B\2B,ou=Bad DNs,dc=example.com
c: double plus ++
objectClass: country
# end dollar$, Bad DNs, example.com
dn: c=end dollar$,ou=Bad DNs,dc=example.com
c: end dollar$
objectClass: country
# multi + value, Bad DNs, example.com
dn: uid=multi+uid=value,ou=Bad DNs,dc=example.com
cn: Test
sn: Test
uid: multi
uid: value
objectClass: inetOrgPerson
# quote\22double, Bad DNs, example.com
dn: uid=quote\22double,ou=Bad DNs,dc=example.com
cn: Test
sn: Test
uid: quote"double
objectClass: inetOrgPerson
# quote'single, Bad DNs, example.com
dn: uid=quote'single,ou=Bad DNs,dc=example.com
cn: Test
sn: Test
uid: quote'single
objectClass: inetOrgPerson
# angle\3Cleft, Bad DNs, example.com
dn: uid=angle\3Cleft,ou=Bad DNs,dc=example.com
cn: Test
sn: Test
uid: angle<left
objectClass: inetOrgPerson
# angle\3Eright, Bad DNs, example.com
dn: uid=angle\3Eright,ou=Bad DNs,dc=example.com
cn: Test
sn: Test
uid: angle>right
objectClass: inetOrgPerson
# sign@at, Bad DNs, example.com
dn: uid=sign@at,ou=Bad DNs,dc=example.com
cn: Test
sn: Test
uid: sign@at
objectClass: inetOrgPerson
# sign\3Bsemicolon@at, Bad DNs, example.com
dn: uid=sign\3Bsemicolon@at,ou=Bad DNs,dc=example.com
cn: Test
sn: Test
uid: sign;semicolon@at
objectClass: inetOrgPerson
# sign?question, Bad DNs, example.com
dn: uid=sign?question,ou=Bad DNs,dc=example.com
cn: Test
sn: Test
uid: sign?question
objectClass: inetOrgPerson
# sign\2Ccomma, Bad DNs, example.com
dn: uid=sign\2Ccomma,ou=Bad DNs,dc=example.com
cn: Test
sn: Test
uid: sign,comma
objectClass: inetOrgPerson
# brace(left, Bad DNs, example.com
dn: uid=brace(left,ou=Bad DNs,dc=example.com
cn: Test
sn: Test
uid: brace(left
objectClass: inetOrgPerson
# brace)right, Bad DNs, example.com
dn: uid=brace)right,ou=Bad DNs,dc=example.com
cn: Test
sn: Test
uid: brace)right
objectClass: inetOrgPerson
# sign%percent, Bad DNs, example.com
dn: uid=sign%percent,ou=Bad DNs,dc=example.com
cn: Test
sn: Test
uid: sign%percent
objectClass: inetOrgPerson
# sign\3Dequal, Bad DNs, example.com
dn: uid=sign\3Dequal,ou=Bad DNs,dc=example.com
uid: sign=equal
cn: Test
sn: Test
objectClass: inetOrgPerson
# sign\2Bplus, Bad DNs, example.com
dn: uid=sign\2Bplus,ou=Bad DNs,dc=example.com
cn: Test
sn: Test
uid: sign+plus
objectClass: inetOrgPerson
# colon\3Bsemi, Bad DNs, example.com
dn: uid=colon\3Bsemi,ou=Bad DNs,dc=example.com
cn: Test
sn: Test
uid: colon;semi
objectClass: inetOrgPerson
# colon:full, Bad DNs, example.com
dn: uid=colon:full,ou=Bad DNs,dc=example.com
cn: Test
sn: Test
uid: colon:full
objectClass: inetOrgPerson
# multi + sign@at, Bad DNs, example.com
dn: uid=multi+uid=sign@at,ou=Bad DNs,dc=example.com
cn: Test
sn: Test
uid: multi
uid: sign@at
objectClass: inetOrgPerson
# sign@at + multi-mixed, Bad DNs, example.com
dn: sn=sign@at+uid=multi-mixed,ou=Bad DNs,dc=example.com
cn: Test
uid: multi-mixed
sn: sign@at
objectClass: inetOrgPerson
# Non English Chars, example.com
dn: ou=Non English Chars,dc=example.com
ou: Non English Chars
objectClass: organizationalUnit
objectClass: top
# \D0\A7\D0\B5\D0\BB\D0\BE\D0\B2\D0\B5\D0\BA\D0\B8, Non English Chars, exampl
e.com
dn:: Y2490KfQtdC70L7QstC10LrQuCxvdT1Ob24gRW5nbGlzaCBDaGFycyxkYz1leGFtcGxlLmNvb
Q==
cn:: 0KfQtdC70L7QstC10LrQuA==
objectClass: inetOrgPerson
objectClass: top
sn:: 0KfQtdC70L7QstC10LrQuA==
# \D0\94\D0\B5\D0\B4 \D0\9B\D0\BE\D0\B3\D0\BE\D0\BF\D0\B5\D0\B4, \D0\A7\D0\B5
\D0\BB\D0\BE\D0\B2\D0\B5\D0\BA\D0\B8, Non English Chars, example.com
dn:: Y2490JTQtdC0INCb0L7Qs9C+0L/QtdC0LGNuPdCn0LXQu9C+0LLQtdC60Lgsb3U9Tm9uIEVuZ
2xpc2ggQ2hhcnMsZGM9ZXhhbXBsZS5jb20=
cn:: 0JTQtdC0INCb0L7Qs9C+0L/QtdC0
givenName:: 0JTQtdC0
jpegPhoto:: /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBw
YIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQs
NFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAAw
AEADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEA
wUFBAQAAAF9AQIDAAQRBRIhM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SEt8x9QAeK1PiQi614n1LUlbi4neXn3Ymud0m9l0G6jlVC6E5OOoPqKAIPFPhq88O+Mr7V9J1i
/trC4kMyWaiRHyf4Sn3BjpnJGKpT6yNe0lk1W0jN2DgTBAN49T716NqOrXXiC1807dm3rIcV5j4mb
7KrZYbsHkUAeW+JIEt7hIYwCqtvwPb/ACKwXBySec1v39nPc3DTshCNwmR1HrVGfT2jIJHFAH9Gkf
xQspdds7KKOWaGZtr3CITHEMcMzdAM4/OuR/aP1qLXPhtqOiaVdQzXV4hQ/PhQMcknFeXeAdRnSzR
xG88UxGx9mVJPTnHGcGuk1+4h1LSnijRHkYlVjk4kVvQHHrQB+f8A4m/Zy8Y380kOnapokEZGS91c
vk+wAQ1zq/svfEC5/cp4i0O2KHaR5UzsT/3yM19ea9aW8R3y3ElndKSWhdBtkB6HBxj6g1w+tarcx
RRXLxS3mmxuE3ohCA9SNwwwP1oA8Ksv2WvHGAl143s40xjba6cznn/eYVFrX7LRuYUjbxa817nkTW
B2MPqrEj9a9jXxZqt4DEkqoVb93DKN3b+8MEHjjI9Kq6j421mwSNL64ESSqytuYOj+gYdvqKAPAvF
/wOv9EtR5z2tyEG3fDuX9GUYryPXfB15axs62ryxhtu+Ebxn6rmvpXW9cilF00+piYDO17cOVK9Mc
9vqO1eQ+LNVSOd3g3NAvJMmUJ+vP9aAP/9k=
objectClass: inetOrgPerson
objectClass: top
sn:: 0JvQvtCz0L7Qv9C10LQ=
# search result
search: 2
result: 0 Success
# numResponses: 26
# numEntries: 25

View File

@ -0,0 +1,59 @@
TLSCACertificateFile /etc/openldap/pla/ca-bundle.crt
TLSCertificateFile /etc/openldap/pla/slapd.crt
TLSCertificateKeyFile /etc/openldap/pla/slapd.key
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 * read
access to *
by * read
database ldbm
suffix "dc=example.com"
rootdn "cn=Manager,dc=example.com"
rootpw NotAllowed
directory /var/lib/ldap/pla-1
dirtyread
cachesize 2000
checkpoint 32 1
# Indices to maintain for this database
index objectClass eq,pres
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 ldbm
suffix "dc=example,dc=com"
rootdn "cn=Manager,dc=example,dc=com"
rootpw NotAllowed
directory /var/lib/ldap/pla-2
dirtyread
cachesize 2000
checkpoint 32 1
# Indices to maintain for this database
index objectClass eq,pres
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 ldbm
suffix "o=Simpsons"
rootdn "cn=Manager,o=Simpsons"
rootpw NotAllowed
directory /var/lib/ldap/pla-3
dirtyread
cachesize 2000
checkpoint 32 1
# Indices to maintain for this database
index objectClass eq,pres
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

3
hooks/classes/README Normal file
View File

@ -0,0 +1,3 @@
Put your hook class files here.
A file wich contains "class MyClass" definition must be called "MyClass.php".

1
hooks/functions/README Normal file
View File

@ -0,0 +1 @@
Put your hook function files here.

View File

@ -1,11 +1,9 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr.php,v 1.19 2005/12/10 10:34:54 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr.php,v 1.20 2007/12/15 07:50:30 wurley Exp $
/** /**
* Adds an attribute/value pair to an object * Adds an attribute/value pair to an object
* *
* Variables that come in via common.php
* - server_id
* Variables that come in as POST vars: * Variables that come in as POST vars:
* - dn * - dn
* - attr * - attr
@ -20,111 +18,115 @@
require './common.php'; require './common.php';
if( $ldapserver->isReadOnly() ) if ($ldapserver->isReadOnly())
pla_error( _('You cannot perform updates while server is in read-only mode') ); pla_error(_('You cannot perform updates while server is in read-only mode'));
if( ! $ldapserver->haveAuthInfo())
pla_error( _('Not enough information to login to server. Please check your configuration.') );
$attr = $_POST['attr']; if (! $_SESSION['plaConfig']->isCommandAvailable('attribute_add'))
$val = isset( $_POST['val'] ) ? $_POST['val'] : false;; pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute')));
$dn = $_POST['dn'] ;
$is_binary_val = isset( $_POST['binary'] ) ? true : false;
$encoded_dn = rawurlencode( $dn ); $entry['val'] = get_request('val','POST');
$encoded_attr = rawurlencode( $attr ); $entry['binary'] = get_request('binary','POST');
if( ! $is_binary_val && $val == "" ) { $entry['dn']['string'] = get_request('dn','POST');
pla_error( _('You left the attribute value blank. Please go back and try again.') ); $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))
pla_error(_('You left the attribute value blank. Please go back and try again.'));
/*
* 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));
pla_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));
} }
// special case for binary attributes (like jpegPhoto and userCertificate): if (strlen($entry['binary']) > 0) {
// we must go read the data from the file and override $val with the binary data if ($_FILES['val']['size'] == 0)
// Secondly, we must check if the ";binary" option has to be appended to the name pla_error(_('The file you chose is either empty or does not exist. Please go back and try again.'));
// of the attribute.
// Check to see if this is a unique Attribute if (! is_uploaded_file($_FILES['val']['tmp_name'])) {
if ($badattr = $ldapserver->checkUniqueAttr($dn,$attr,array($val))) { if (isset($_FILES['val']['error']))
$search_href = sprintf('search.php?search=true&form=advanced&server_id=%s&filter=%s=%s',$ldapserver->server_id,$attr,$badattr);
pla_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,$dn,$search_href ) );
}
if( $is_binary_val ) {
if( 0 == $_FILES['val']['size'] )
pla_error( _('The file you chose is either empty or does not exist. Please go back and try again.') );
if( ! is_uploaded_file( $_FILES['val']['tmp_name'] ) ) {
if( isset( $_FILES['val']['error'] ) )
switch($_FILES['val']['error']) { switch($_FILES['val']['error']) {
case 0: //no error; possible file attack! case 0: # No error; possible file attack!
pla_error( _('Security error: The file being uploaded may be malicious.') ); pla_error(_('Security error: The file being uploaded may be malicious.'));
break; break;
case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini case 1: # Uploaded file exceeds the upload_max_filesize directive in php.ini
pla_error( _('The file you uploaded is too large. Please check php.ini, upload_max_size setting') ); pla_error(_('The file you uploaded is too large. Please check php.ini, upload_max_size setting'));
break; break;
case 2: //uploaded file exceeds the MAX_FILE_SIZE directive specified in the html form case 2: # Uploaded file exceeds the MAX_FILE_SIZE directive specified in the html form
pla_error( _('The file you uploaded is too large. Please check php.ini, upload_max_size setting') ); pla_error(_('The file you uploaded is too large. Please check php.ini, upload_max_size setting'));
break; break;
case 3: //uploaded file was only partially uploaded case 3: # Uploaded file was only partially uploaded
pla_error( _('The file you selected was only partially uploaded, likley due to a network error.') ); pla_error(_('The file you selected was only partially uploaded, likley due to a network error.'));
break; break;
case 4: //no file was uploaded case 4: # No file was uploaded
pla_error( _('You left the attribute value blank. Please go back and try again.') ); pla_error(_('You left the attribute value blank. Please go back and try again.'));
break; break;
default: //a default error, just in case! :) default: # A default error, just in case! :)
pla_error( _('Security error: The file being uploaded may be malicious.') ); pla_error(_('Security error: The file being uploaded may be malicious.'));
break; break;
} }
else else
pla_error( _('Security error: The file being uploaded may be malicious.') ); pla_error(_('Security error: The file being uploaded may be malicious.'));
} }
$file = $_FILES['val']['tmp_name']; $binaryfile['name'] = $_FILES['val']['tmp_name'];
$f = fopen( $file, 'r' ); $binaryfile['handle'] = fopen($binaryfile['name'],'r');
$binary_data = fread( $f, filesize( $file ) ); $binaryfile['data'] = fread($binaryfile['handle'],filesize($binaryfile['name']));
fclose( $f ); fclose($binaryfile['handle']);
$val = $binary_data; $entry['val'] = $binaryfile['data'];
if( is_binary_option_required( $ldapserver, $attr ) ) if (is_binary_option_required($ldapserver,$entry['attr']['string']))
$attr .= ";binary"; $entry['attr']['string'] .= ';binary';
} }
/* Automagically hash new userPassword attributes according to the /* Automagically hash new userPassword attributes according to the
chosen in config.php. */ chosen in config.php. */
if( 0 == strcasecmp( $attr, 'userpassword' ) ) { if (strcasecmp($entry['attr']['string'],'userpassword') == 0) {
if (trim($ldapserver->default_hash) != '' ) { if (trim($ldapserver->default_hash) != '' ) {
$enc_type = $ldapserver->default_hash; $enc_type = $ldapserver->default_hash;
$val = password_hash( $val, $enc_type ); $entry['val'] = password_hash($entry['val'],$enc_type);
} }
}
elseif (strcasecmp($attr,'sambaNTPassword') == 0) { } elseif (strcasecmp($entry['attr']['string'],'sambaNTPassword') == 0) {
$sambapassword = new smbHash; $sambapassword = new smbHash;
$val = $sambapassword->nthash($val); $entry['val'] = $sambapassword->nthash($entry['val']);
}
elseif (strcasecmp($attr,'sambaLMPassword') == 0) { } elseif (strcasecmp($entry['attr']['string'],'sambaLMPassword') == 0) {
$sambapassword = new smbHash; $sambapassword = new smbHash;
$val = $sambapassword->lmhash($val); $entry['val'] = $sambapassword->lmhash($entry['val']);
} }
$new_entry = array( $attr => $val ); $new_entry = array($entry['attr']['string'] => $entry['val']);
$result = $ldapserver->attrModify($dn,$new_entry); $result = $ldapserver->attrModify($entry['dn']['string'],$new_entry);
if ($result) if ($result) {
header(sprintf('Location: template_engine.php?server_id=%s&dn=%s&modified_attrs[]=%s', header(sprintf('Location: cmd.php?cmd=template_engine&server_id=%s&dn=%s&modified_attrs[]=%s',
$ldapserver->server_id,$encoded_dn,$encoded_attr)); $ldapserver->server_id,$entry['dn']['encode'],$entry['attr']['encode']));
die();
else } else {
pla_error( _('Failed to add the attribute.'),$ldapserver->error(),$ldapserver->errno() ); pla_error(_('Failed to add the attribute.'),$ldapserver->error(),$ldapserver->errno());
}
/** /**
* Check if we need to append the ;binary option to the name * Check if we need to append the ;binary option to the name
@ -135,31 +137,25 @@ else
* @return bool * @return bool
*/ */
function is_binary_option_required( $ldapserver, $attr ) { function is_binary_option_required($ldapserver,$attr) {
# List of the binary attributes which need the ";binary" option
// list of the binary attributes which need the ";binary" option
$binary_attributes_with_options = array( $binary_attributes_with_options = array(
// Superior: Ldapv3 Syntaxes (1.3.6.1.4.1.1466.115.121.1) # 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' => 'userCertificate',
'1.3.6.1.4.1.1466.115.121.1.8' => "caCertificate", '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.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' => 'certificateRevocationList',
'1.3.6.1.4.1.1466.115.121.1.9' => "authorityRevocationList", '1.3.6.1.4.1.1466.115.121.1.9' => 'authorityRevocationList',
// Superior: Netscape Ldap attributes types (2.16.840.1.113730.3.1) # Superior: Netscape Ldap attributes types (2.16.840.1.113730.3.1)
'2.16.840.1.113730.3.1.40' => "userSMIMECertificate" '2.16.840.1.113730.3.1.40' => 'userSMIMECertificate'
); );
// quick check by attr name (short circuits the schema check if possible)
//foreach( $binary_attributes_with_options as $oid => $name )
//if( 0 == strcasecmp( $attr, $name ) )
//return true;
$schema_attr = $ldapserver->getSchemaAttribute($attr); $schema_attr = $ldapserver->getSchemaAttribute($attr);
if( ! $schema_attr ) if (! $schema_attr)
return false; return false;
$syntax = $schema_attr->getSyntaxOID(); $syntax = $schema_attr->getSyntaxOID();
if( isset( $binary_attributes_with_options[ $syntax ] ) ) if (isset($binary_attributes_with_options[$syntax]))
return true; return true;
return false; return false;

View File

@ -1,11 +1,9 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr_form.php,v 1.15 2006/10/28 07:22:39 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr_form.php,v 1.16 2007/12/15 07:50:30 wurley Exp $
/** /**
* Displays a form for adding an attribute/value to an LDAP entry. * Displays a form for adding an attribute/value to an LDAP entry.
* *
* Variables that come in via common.php
* - server_id
* Variables that come in as GET vars: * Variables that come in as GET vars:
* - dn (rawurlencoded) * - dn (rawurlencoded)
* *
@ -18,87 +16,78 @@ require './common.php';
if ($ldapserver->isReadOnly()) if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode')); pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
$dn = $_GET['dn']; $entry['dn']['string'] = get_request('dn','GET');
$encoded_dn = rawurlencode($dn); $entry['rdn'] = get_rdn($entry['dn']['string']);
$rdn = get_rdn($dn);
$friendly_attrs = process_friendly_attr_table(); printf('<h3 class="title">%s <b>%s</b></h3>',_('Add new attribute'),htmlspecialchars($entry['rdn']));
include './header.php';
echo '<body>';
printf('<h3 class="title">%s <b>%s</b></h3>',_('Add new attribute'),htmlspecialchars($rdn));
printf('<h3 class="subtitle">%s: <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>', printf('<h3 class="subtitle">%s: <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>',
_('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($dn)); _('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($entry['dn']['string']));
$attrs = $ldapserver->getDNAttrs($dn); $dn['attrs'] = $ldapserver->getDNAttrs($entry['dn']['string']);
$dn['oclasses'] = $ldapserver->getDNAttr($entry['dn']['string'],'objectClass');
$oclasses = $ldapserver->getDNAttr($dn,'objectClass'); if (! is_array($dn['oclasses']))
if (! is_array($oclasses)) $dn['oclasses'] = array($dn['oclasses']);
$oclasses = array($oclasses);
$avail_attrs = array(); $ldap['attrs']['avail'] = array();
if (array_search('extensibleObject',$oclasses) !== FALSE) { if (array_search('extensibleObject',$dn['oclasses']) !== false) {
$schema_attrs = $ldapserver->SchemaAttributes(); $ldap['attrs']['ldap'] = $ldapserver->SchemaAttributes();
foreach ($schema_attrs as $attr) foreach ($ldap['attrs']['ldap'] as $attr)
$avail_attrs[]=$attr->getName(); $ldap['attrs']['avail'][] = $attr->getName();
} else { } else {
$schema_oclasses = $ldapserver->SchemaObjectClasses($dn); $ldap['oclasses'] = $ldapserver->SchemaObjectClasses($entry['dn']['string']);
foreach ($oclasses as $oclass) { foreach ($dn['oclasses'] as $oclass) {
$schema_oclass = $ldapserver->getSchemaObjectClass($oclass,$dn); $ldap['oclass'] = $ldapserver->getSchemaObjectClass($oclass,$entry['dn']['string']);
if ($schema_oclass && strcasecmp('objectclass',get_class($schema_oclass)) == 0) if ($ldap['oclass'] && strcasecmp('objectclass',get_class($ldap['oclass'])) == 0)
$avail_attrs = array_merge($schema_oclass->getMustAttrNames($schema_oclasses), $ldap['attrs']['avail'] = array_merge($ldap['oclass']->getMustAttrNames($ldap['oclasses']),
$schema_oclass->getMayAttrNames($schema_oclasses), $ldap['oclass']->getMayAttrNames($ldap['oclasses']),
$avail_attrs); $ldap['attrs']['avail']);
} }
} }
$avail_attrs = array_unique($avail_attrs); $ldap['attrs']['avail'] = array_unique($ldap['attrs']['avail']);
$avail_attrs = array_filter($avail_attrs,'not_an_attr'); $ldap['attrs']['avail'] = array_filter($ldap['attrs']['avail'],'not_an_attr');
sort($avail_attrs); sort($ldap['attrs']['avail']);
$avail_binary_attrs = array(); $ldap['binattrs']['avail'] = array();
foreach ($avail_attrs as $i => $attr) {
foreach ($ldap['attrs']['avail'] as $i => $attr) {
if ($ldapserver->isAttrBinary($attr)) { if ($ldapserver->isAttrBinary($attr)) {
$avail_binary_attrs[] = $attr; $ldap['binattrs']['avail'][] = $attr;
unset($avail_attrs[$i]); unset($ldap['attrs']['avail'][$i]);
} }
} }
echo '<center>'; echo '<center>';
if (is_array($avail_attrs) && count($avail_attrs) > 0) { if (is_array($ldap['attrs']['avail']) && count($ldap['attrs']['avail']) > 0) {
echo '<br />'; echo '<br />';
echo _('Add new attribute'); echo _('Add new attribute');
echo '<br />'; echo '<br />';
echo '<br />'; echo '<br />';
echo '<form action="add_attr.php" method="post">'; 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="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($dn)); printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($entry['dn']['string']));
echo '<select name="attr">'; echo '<select name="attr">';
$attr_select_html = ''; $attr_select_html = '';
usort($avail_attrs,'sortAttrs'); usort($ldap['attrs']['avail'],'sortAttrs');
foreach ($avail_attrs as $a) { foreach ($ldap['attrs']['avail'] as $a) {
# is there a user-friendly translation available for this attribute? # is there a user-friendly translation available for this attribute?
if (isset($friendly_attrs[strtolower($a)])) { if (isset($_SESSION['plaConfig']->friendly_attrs[strtolower($a)])) {
$attr_display = sprintf('%s (%s)', $attr_display = sprintf('%s (%s)',
htmlspecialchars($friendly_attrs[strtolower($a)]), htmlspecialchars($_SESSION['plaConfig']->friendly_attrs[strtolower($a)]),
htmlspecialchars($a)); htmlspecialchars($a));
} else { } else {
@ -119,29 +108,30 @@ if (is_array($avail_attrs) && count($avail_attrs) > 0) {
printf('<small>(%s)</small>',_('no new attributes available for this entry')); printf('<small>(%s)</small>',_('no new attributes available for this entry'));
} }
if (count($avail_binary_attrs) > 0) { if (count($ldap['binattrs']['avail']) > 0) {
echo '<br />'; echo '<br />';
echo _('Add new binary attribute'); echo _('Add new binary attribute');
echo '<br />'; echo '<br />';
echo '<br />'; echo '<br />';
echo '<!-- Form to add a new BINARY attribute to this entry -->'; echo '<!-- Form to add a new BINARY attribute to this entry -->';
echo '<form action="add_attr.php" method="post" enctype="multipart/form-data">'; 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="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="hidden" name="dn" value="%s" />',$dn); printf('<input type="hidden" name="dn" value="%s" />',$entry['dn']['string']);
echo '<input type="hidden" name="binary" value="true" />'; echo '<input type="hidden" name="binary" value="true" />';
echo '<select name="attr">'; echo '<select name="attr">';
$attr_select_html = ''; $attr_select_html = '';
usort($avail_binary_attrs,'sortAttrs'); usort($ldap['binattrs']['avail'],'sortAttrs');
foreach ($avail_binary_attrs as $a) { foreach ($ldap['binattrs']['avail'] as $a) {
# is there a user-friendly translation available for this attribute? # is there a user-friendly translation available for this attribute?
if (isset($friendly_attrs[strtolower($a)])) { if (isset($_SESSION['plaConfig']->friendly_attrs[strtolower($a)])) {
$attr_display = sprintf('%s (%s)', $attr_display = sprintf('%s (%s)',
htmlspecialchars($friendly_attrs[strtolower($a)]), htmlspecialchars($_SESSION['plaConfig']->friendly_attrs[strtolower($a)]),
htmlspecialchars($a)); htmlspecialchars($a));
} else { } else {
@ -171,8 +161,6 @@ if (count($avail_binary_attrs) > 0) {
} }
echo '</center>'; echo '</center>';
echo '</body>';
echo '</html>';
/** /**
* Given an attribute $x, this returns true if it is NOT already specified * Given an attribute $x, this returns true if it is NOT already specified
@ -183,9 +171,9 @@ echo '</html>';
* @ignore * @ignore
*/ */
function not_an_attr($x) { function not_an_attr($x) {
global $attrs; global $dn;
foreach($attrs as $attr => $values) foreach ($dn['attrs'] as $attr => $values)
if (strcasecmp($attr,$x) == 0) if (strcasecmp($attr,$x) == 0)
return false; return false;

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_oclass.php,v 1.18 2005/12/10 10:34:54 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_oclass.php,v 1.19 2007/12/15 07:50:30 wurley Exp $
/** /**
* Adds an objectClass to the specified dn. * Adds an objectClass to the specified dn.
@ -7,8 +7,6 @@
* Note, this does not do any schema violation checking. That is * Note, this does not do any schema violation checking. That is
* performed in add_oclass_form.php. * performed in add_oclass_form.php.
* *
* Variables that come in via common.php
* - server_id
* Variables that come in as POST vars: * Variables that come in as POST vars:
* - dn (rawurlencoded) * - dn (rawurlencoded)
* - new_oclass * - new_oclass
@ -21,44 +19,48 @@
require './common.php'; require './common.php';
if( $ldapserver->isReadOnly() ) if ($ldapserver->isReadOnly())
pla_error( _('You cannot perform updates while server is in read-only mode') ); pla_error(_('You cannot perform updates while server is in read-only mode'));
if( ! $ldapserver->haveAuthInfo())
pla_error( _('Not enough information to login to server. Please check your configuration.') );
$dn = rawurldecode( $_POST['dn'] );
$new_oclass = unserialize( rawurldecode( $_POST['new_oclass'] ) );
$new_attrs = $_POST['new_attrs'];
$encoded_dn = rawurlencode( $dn );
if ($ldapserver->isAttrReadOnly('objectClass')) if ($ldapserver->isAttrReadOnly('objectClass'))
pla_error( "ObjectClasses are flagged as read only in the phpLDAPadmin configuration." ); pla_error(_('ObjectClasses are flagged as read only in the phpLDAPadmin configuration.'));
$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 = array();
$new_entry['objectClass'] = $new_oclass; $new_entry['objectClass'] = $entry['new']['oclass'];
$new_attrs_entry = array(); if (is_array($entry['new']['attrs']) && count($entry['new']['attrs']) > 0)
$new_oclass_entry = array( 'objectClass' => $new_oclass ); foreach ($entry['new']['attrs'] as $attr => $val) {
if( is_array( $new_attrs ) && count( $new_attrs ) > 0 ) # Check to see if this is a unique Attribute
foreach( $new_attrs as $attr => $val ) { 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));
// Check to see if this is a unique Attribute pla_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']));
if ($badattr = $ldapserver->checkUniqueAttr($dn,$attr,array($val))) {
$search_href = sprintf('search.php?search=true&form=advanced&server_id=%s&filter=%s=%s',
$ldapserver->server_id,$attr,$badattr);
pla_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,$dn,$search_href ) );
} }
$new_entry[ $attr ] = $val; $new_entry[$attr] = $val;
} }
$add_res = $ldapserver->attrModify($dn,$new_entry); $result = $ldapserver->attrModify($entry['dn']['string'],$new_entry);
if (! $add_res) if (! $result)
pla_error(_('Could not perform ldap_mod_add operation.'),$ldapserver->error(),$ldapserver->errno()); pla_error(_('Could not perform ldap_mod_add operation.'),$ldapserver->error(),$ldapserver->errno());
else else {
header(sprintf('Location: template_engine.php?server_id=%s&dn=%s&modified_attrs[]=objectclass',$ldapserver->server_id,$encoded_dn)); $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();
}
?> ?>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_oclass_form.php,v 1.24 2005/12/10 10:34:54 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_oclass_form.php,v 1.25 2007/12/15 07:50:30 wurley Exp $
/** /**
* This page may simply add the objectClass and take you back to the edit page, * This page may simply add the objectClass and take you back to the edit page,
@ -9,8 +9,6 @@
* attributes with 1 or more not defined by the object. In that case, we will * 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. * present a form for the user to add those attributes to the object.
* *
* Variables that come in via common.php
* - server_id
* Variables that come in as REQUEST vars: * Variables that come in as REQUEST vars:
* - dn (rawurlencoded) * - dn (rawurlencoded)
* - new_oclass * - new_oclass
@ -22,116 +20,102 @@
*/ */
require './common.php'; require './common.php';
if( $ldapserver->isReadOnly() ) $entry['oclass']['new'] = get_request('new_oclass','REQUEST');
pla_error( _('You cannot perform updates while server is in read-only mode') ); $entry['dn']['string'] = get_request('dn','REQUEST');
if( ! $ldapserver->haveAuthInfo())
pla_error( _('Not enough information to login to server. Please check your configuration.') );
if (! isset($_REQUEST['new_oclass'])) if ($ldapserver->isReadOnly())
pla_error( _('You did not select any ObjectClasses for this object. Please go back and do so.')); pla_error(_('You cannot perform updates while server is in read-only mode'));
$new_oclass = $_REQUEST['new_oclass']; if (! $entry['oclass']['new'])
$dn = rawurldecode( $_REQUEST['dn'] ); pla_error(_('You did not select any ObjectClasses for this object. Please go back and do so.'));
$encoded_dn = rawurlencode( $dn );
/* Ensure that the object has defined all MUST attrs for this objectClass. /* 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 * If it hasn't, present a form to have the user enter values for all the
* newly required attrs. */ * newly required attrs.
*/
$entry = $ldapserver->getDNAttrs($dn,true); $entry['dn']['attrs'] = $ldapserver->getDNAttrs($entry['dn']['string'],true);
$current_attrs = array(); $entry['attrs']['current'] = array();
foreach( $entry as $attr => $junk ) foreach ($entry['dn']['attrs'] as $attr => $junk)
$current_attrs[] = strtolower($attr); $entry['attrs']['current'][] = strtolower($attr);
// grab the required attributes for the new objectClass # Grab the required attributes for the new objectClass
$schema_oclasses = $ldapserver->SchemaObjectClasses(); $ldap['oclasses'] = $ldapserver->SchemaObjectClasses();
$must_attrs = array(); $ldap['attrs']['must'] = array();
foreach( $new_oclass as $oclass_name ) { foreach ($entry['oclass']['new'] as $oclass_name) {
$oclass = $ldapserver->getSchemaObjectClass($oclass_name); $ldap['oclass'] = $ldapserver->getSchemaObjectClass($oclass_name);
if( $oclass )
$must_attrs = array_merge( $must_attrs, $oclass->getMustAttrNames( $schema_oclasses ) ); if ($ldap['oclass'])
$ldap['attrs']['must'] = array_merge($ldap['attrs']['must'],$ldap['oclass']->getMustAttrNames($ldap['oclasses']));
} }
$must_attrs = array_unique( $must_attrs ); $ldap['attrs']['must'] = array_unique($ldap['attrs']['must']);
// We don't want any of the attr meta-data, just the string /* Build a list of the attributes that this new objectClass requires,
//foreach( $must_attrs as $i => $attr ) * but that the object does not currently contain
//$must_attrs[$i] = $attr->getName(); */
$ldap['attrs']['need'] = array();
// build a list of the attributes that this new objectClass requires, foreach ($ldap['attrs']['must'] as $attr) {
// but that the object does not currently contain
$needed_attrs = array();
foreach( $must_attrs as $attr ) {
$attr = $ldapserver->getSchemaAttribute($attr); $attr = $ldapserver->getSchemaAttribute($attr);
//echo "<pre>"; var_dump( $attr ); echo "</pre>"; # First, check if one of this attr's aliases is already an attribute of this entry
foreach ($attr->getAliases() as $alias_attr_name)
// First, check if one of this attr's aliases is already an attribute of this entry if (in_array(strtolower($alias_attr_name),$entry['attrs']['current']))
foreach( $attr->getAliases() as $alias_attr_name )
if( in_array( strtolower( $alias_attr_name ), $current_attrs ) )
// Skip this attribute since it's already in the entry
continue; continue;
if( in_array( strtolower($attr->getName()), $current_attrs ) ) if (in_array(strtolower($attr->getName()),$entry['attrs']['current']))
continue; continue;
// We made it this far, so the attribute needs to be added to this entry in order /* We made it this far, so the attribute needs to be added to this entry in order
// to add this objectClass * to add this objectClass */
$needed_attrs[] = $attr; $ldap['attrs']['need'][] = $attr;
} }
if( count( $needed_attrs ) > 0 ) { if (count($ldap['attrs']['need']) > 0) {
include './header.php'; ?> printf('<h3 class="title">%s</h3>',_('New Required Attributes'));
<body> printf('<h3 class="subtitle">%s %s %s</h3>',_('This action requires you to add'),count($ldap['attrs']['need']),_('new attributes'));
<h3 class="title"><?php echo _('New Required Attributes'); ?></h3> printf('<small><b>%s: </b>%s <b>%s</b> %s %s</small>',
<h3 class="subtitle"><?php echo _('This action requires you to add') . ' ' . count($needed_attrs) . _('Instructions'),
' ' . _('new attributes'); ?></h3> _('In order to add these objectClass(es) to this entry, you must specify'),
count($ldap['attrs']['need']),_('new attributes'),
_('that this objectClass requires.'));
<small> echo '<br /><br />';
<?php echo _('Instructions: In order to add these objectClass(es) to this entry, you must specify'); echo '<form action="cmd.php" method="post">';
echo ' ' . count( $needed_attrs ) . ' ' . _('new attributes') . ' '; echo '<input type="hidden" name="cmd" value="add_oclass" />';
echo _('that this objectClass requires. You can do so in this form.'); ?> 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);
</small> echo '<table class="edit_dn" cellspacing="0">';
printf('<tr><th colspan="2">%s</th></tr>',_('New Required Attributes'));
<br /> foreach ($ldap['attrs']['need'] as $count => $attr) {
<br /> printf('<tr><td class="attr">%s</td></tr>',htmlspecialchars($attr->getName()));
printf('<tr><td class="val"><input type="text" name="new_attrs[%s]" value="" size="40" /></td></tr>',htmlspecialchars($attr->getName()));
}
<form action="add_oclass.php" method="post"> echo '</table>';
<input type="hidden" name="new_oclass" value="<?php echo rawurlencode( serialize( $new_oclass ) ); ?>" />
<input type="hidden" name="dn" value="<?php echo $encoded_dn; ?>" />
<input type="hidden" name="server_id" value="<?php echo $ldapserver->server_id; ?>" />
<table class="edit_dn" cellspacing="0"> echo '<br /><br />';
<tr><th colspan="2"><?php echo _('New Required Attributes'); ?></th></tr>
<?php foreach( $needed_attrs as $count => $attr ) { ?> printf('<center><input type="submit" value="%s" /></center>',_('Add ObjectClass and Attributes'));
echo '</form>';
<tr><td class="attr"><b><?php echo htmlspecialchars($attr->getName()); ?></b></td></tr> } else {
<tr><td class="val"><input type="text" name="new_attrs[<?php echo htmlspecialchars($attr->getName()); ?>]" value="" size="40" /></tr> $result = $ldapserver->attrModify($entry['dn']['string'],array('objectClass'=>$entry['oclass']['new']));
<?php } ?>
</table> if (! $result)
<br /> pla_error('Could not perform ldap_mod_add operation.',$ldapserver->error(),$ldapserver->errno());
<br />
<center><input type="submit" value="<?php echo _('Add ObjectClass and Attributes'); ?>" /></center>
</form>
</body> else {
</html> $href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s&modified_attrs[]=objectClass',
$ldapserver->server_id,rawurlencode($entry['dn']['string']));
<?php } else {
$add_res = $ldapserver->attrModify($dn,array('objectClass'=>$new_oclass));
if (! $add_res)
pla_error("Could not perform ldap_mod_add operation.",
$ldapserver->error(),$ldapserver->errno());
else
header(sprintf('Location: template_engine.php?server_id=%s&dn=%s&modified_attrs[]=objectClass',
$ldapserver->server_id,$encoded_dn));
header(sprintf('Location: %s',$href));
die();
}
} }
?> ?>

View File

@ -1,11 +1,9 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value.php,v 1.20 2005/12/10 10:34:54 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value.php,v 1.21 2007/12/15 07:50:30 wurley Exp $
/** /**
* Adds a value to an attribute for a given dn. * Adds a value to an attribute for a given dn.
* *
* Variables that come in via common.php
* - server_id
* Variables that come in as POST vars: * Variables that come in as POST vars:
* - dn (rawurlencoded) * - dn (rawurlencoded)
* - attr (rawurlencoded) the attribute to which we are adding a value * - attr (rawurlencoded) the attribute to which we are adding a value
@ -19,56 +17,68 @@
/** /**
*/ */
require './common.php'; if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
if( $ldapserver->isReadOnly() ) if (! $_SESSION['plaConfig']->isCommandAvailable('attribute_add_value'))
pla_error( _('You cannot perform updates while server is in read-only mode') ); pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute value')));
if( ! $ldapserver->haveAuthInfo())
pla_error( _('Not enough information to login to server. Please check your configuration.') );
$attr = $_POST['attr']; # The DN and ATTR we are working with.
$new_value = $_POST['new_value']; $entry['dn']['encode'] = get_request('dn','POST',true);
$dn = rawurldecode( $_POST['dn'] ); $entry['dn']['string'] = rawurldecode($entry['dn']['encode']);
$is_binary_val = isset( $_POST['binary'] ) ? true : false; $entry['attr']['encode'] = get_request('attr','POST',true);
$entry['attr']['string'] = rawurldecode($entry['attr']['encode']);
$entry['attr']['html'] = htmlspecialchars($entry['attr']['string']);
$encoded_dn = rawurlencode( $dn ); $entry['value']['string'] = get_request('new_value','POST',true);
$encoded_attr = rawurlencode( $attr ); $entry['value']['bin'] = get_request('binary','POST') ? true : false;
if ($ldapserver->isAttrReadOnly($attr)) if ($ldapserver->isAttrReadOnly($entry['attr']['string']))
pla_error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),htmlspecialchars( $attr ))); pla_error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),$entry['attr']['html']));
// special case for binary attributes: /*
// we must go read the data from the file. * Special case for binary attributes:
if( $is_binary_val ) { * we must go read the data from the file.
$file = $_FILES['new_value']['tmp_name']; */
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']);
$f = fopen( $file, 'r' ); $entry['value']['string'] = $binaryfile['data'];
$binary_value = fread( $f, filesize( $file ) );
fclose( $f );
$new_value = $binary_value;
} }
$new_entry = array( $attr => $new_value ); $new_entry = array($entry['attr']['string']=>$entry['value']['string']);
// Check to see if this is a unique Attribute # Check to see if this is a unique Attribute
if ($badattr = $ldapserver->checkUniqueAttr($dn,$attr,$new_entry)) { if ($badattr = $ldapserver->checkUniqueAttr($entry['dn']['string'],$entry['attr']['string'],$new_entry)) {
$search_href = sprintf('search.php?search=true&form=advanced&server_id=%s&filter=%s=%s',$ldapserver->server_id,$attr,$badattr); $href = htmlspecialchars(sprintf('cmd.php?cmd=search&search=true&form=advanced&server_id=%s&filter=%s=%s',
pla_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,$dn,$search_href ) ); $ldapserver->server_id,$entry['attr']['string'],$badattr));
pla_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));
} }
// Call the custom callback for each attribute modification # Call the custom callback for each attribute modification and verify that it should be modified.
// and verify that it should be modified. if (run_hook('pre_attr_add',
if( run_hook ( 'pre_attr_add', array ( 'server_id' => $ldapserver->server_id, 'dn' => $dn, 'attr_name' => $attr, array('server_id'=>$ldapserver->server_id,'dn'=> $entry['dn']['string'],'attr_name'=>$entry['attr']['string'],'new_value'=>$new_entry))) {
'new_value' => $new_entry ) ) ) {
$add_result = $ldapserver->attrModify($dn,$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))) {
if (! $add_result) $add_result = $ldapserver->attrModify($entry['dn']['string'],$new_entry);
pla_error(_('Could not perform ldap_mod_add operation.'),
$ldapserver->error(),$ldapserver->errno()); if (! $add_result) {
pla_error(_('Could not perform ldap_mod_add operation.'),
$ldapserver->error(),$ldapserver->errno());
} 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: template_engine.php?server_id=%s&dn=%s&modified_attrs[]=%s', header(sprintf('Location: cmd.php?cmd=template_engine&server_id=%s&dn=%s&modified_attrs[]=%s',
$ldapserver->server_id,$encoded_dn,$encoded_attr)); $ldapserver->server_id,$entry['dn']['encode'],$entry['attr']['encode']));
die();
?> ?>

View File

@ -1,16 +1,10 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value_form.php,v 1.38 2006/10/29 12:49:24 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value_form.php,v 1.39 2007/12/15 07:50:30 wurley Exp $
/** /**
* Displays a form to allow the user to enter a new value to add * 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. * to the existing list of values for a multi-valued attribute.
* *
* Variables that come in via common.php
* - server_id
* Variables that come in as GET vars:
* - dn (rawurlencoded)
* - attr (rawurlencoded) the attribute to which we are adding a value
*
* @package phpLDAPadmin * @package phpLDAPadmin
*/ */
/** /**
@ -20,87 +14,141 @@ require './common.php';
if ($ldapserver->isReadOnly()) if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode')); pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
$attr = $_GET['attr']; # The DN and ATTR we are working with.
$dn = isset($_GET['dn']) ? $_GET['dn'] : null; $entry['dn']['encode'] = get_request('dn','GET',true);
$encoded_dn = rawurlencode($dn); $entry['dn']['string'] = urldecode($entry['dn']['encode']);
$encoded_attr = rawurlencode($attr); $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']);
if (! is_null($dn)) if (! is_null($entry['dn']['string']))
$rdn = get_rdn($dn); $entry['rdn']['string'] = get_rdn($entry['dn']['string']);
else else
$rdn = null; $entry['rdn']['string'] = null;
$entry['rdn']['html'] = htmlspecialchars($entry['rdn']['string']);
$current_values = $ldapserver->getDNAttr($dn,$attr); /***************/
if ($current_values) { /* get entry */
if (! is_array($current_values)) /***************/
$current_values = array($current_values);
$num_current_values = count($current_values); if (! $entry['dn']['string'] || ! $ldapserver->dnExists($entry['dn']['string']))
pla_error(sprintf(_('The entry (%s) does not exist.'),$entry['dn']['html']),null,-1,true);
} else { $tree = get_cached_item($ldapserver->server_id,'tree');
$current_values = array(); $entry['ldap'] = null;
$num_current_values = 0; if ($tree) {
$entry['ldap'] = $tree->getEntry($entry['dn']['string']);
if (! $entry['ldap'])
$tree->addEntry($entry['dn']['string']);
$entry['ldap'] = $tree->getEntry($entry['dn']['string']);
} }
$is_object_class = (strcasecmp($attr, 'objectClass') == 0) ? true : false; // define the template of the entry if possible
eval('$reader = new '.$_SESSION['plaConfig']->GetValue('appearance','entry_reader').'($ldapserver);');
$reader->visit('Start', $entry['ldap']);
if ($is_object_class) { if (! $entry['ldap'] || $entry['ldap']->isReadOnly())
# fetch all available objectClasses and remove those from the list that are already defined in the entry pla_error(sprintf(_('The entry (%s) is in readonly mode.'),$entry['dn']['html']),null,-1,true);
$schema_oclasses = $ldapserver->SchemaObjectClasses();
foreach($current_values as $oclass) /*********************/
unset($schema_oclasses[strtolower($oclass)]); /* attribute values */
/*********************/
eval('$writer = new '.$_SESSION['plaConfig']->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['plaConfig']->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())
pla_error(sprintf(_('The attribute (%s) is in readonly mode.'),$entry['attr']['html']),null,-1,true);
if (! $_SESSION['plaConfig']->isCommandAvailable('attribute_add_value'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute value')));
if (($ldap['attr']->getValueCount() == 0) && ! $_SESSION['plaConfig']->isCommandAvailable('attribute_add'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute')));
/*
$ldap['attrs'] = $ldapserver->getDNAttr($entry['dn']['string'],$entry['attr']['string']);
$ldap['count'] = count($ldap['attrs']);
*/
$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 { } else {
$schema_attr = $ldapserver->getSchemaAttribute($attr); $ldap['schema'] = $ldapserver->getSchemaAttribute($entry['attr']['string']);
} }
include './header.php';
echo '<body>';
printf('<h3 class="title">%s <b>%s</b> %s <b>%s</b></h3>', printf('<h3 class="title">%s <b>%s</b> %s <b>%s</b></h3>',
_('Add new'),htmlspecialchars($attr),_('value to'),htmlspecialchars($rdn)); _('Add new'),$entry['attr']['html'],_('value to'),$entry['rdn']['html']);
printf('<h3 class="subtitle">%s <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>', printf('<h3 class="subtitle">%s <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>',
_('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($dn)); _('Server'),$ldapserver->name,_('Distinguished Name'),$entry['dn']['html']);
printf('%s <b>%s</b> %s <b>%s</b>:', if ($ldap['count']) {
_('Current list of'),$num_current_values,_('values for attribute'),htmlspecialchars($attr)); printf('%s <b>%s</b> %s <b>%s</b>%s',
_('Current list of'),$ldap['count'],_('values for attribute'),$ldap['attr']->getFriendlyName(),_(':'));
} else {
printf('%s <b>%s</b>.',
_('No current value for attribute'),$ldap['attr']->getFriendlyName());
}
if ($num_current_values) { if ($entry['attr']['oclass']) {
if ($ldapserver->isJpegPhoto($attr)) { 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" />';
echo '<table><tr><td>'; //printf('<input type="hidden" name="attr" value="%s" />',$entry['attr']['encode']);
draw_jpeg_photos($ldapserver, $dn, $attr, false);
}
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="hidden" name="dn" value="%s" />',$entry['dn']['encode']);
if ($ldap['count']) {
// display current attribute values
echo '<table class="edit_dn" cellspacing="0" cellpadding="0" align="center"><tr><td>';
for ($i = 0; $i < $ldap['count']; $i++) {
$writer->draw('OldValue', $ldap['attr'], $i);
$writer->draw('ReadOnlyValue', $ldap['attr'], $i);
}
echo '</td></tr></table>'; echo '</td></tr></table>';
/*
if ($ldapserver->isJpegPhoto($entry['attr']['string'])) {
printf('<table><tr><td>%s</td></tr></table>',
draw_jpeg_photos($ldapserver,$entry['dn']['string'],$entry['attr']['string'],false));
# <!-- Temporary warning until we find a way to add jpegPhoto values without an INAPROPRIATE_MATCHING error --> # <!-- Temporary warning until we find a way to add jpegPhoto values without an INAPROPRIATE_MATCHING error -->
printf('<p><small>%s</small></p>', printf('<p><small>%s</small></p>',
_('Note: You will get an "inappropriate matching" error if you have not setup an EQUALITY rule on your LDAP server for this attribute.')); _('Note: You will get an "inappropriate matching" error if you have not setup an EQUALITY rule on your LDAP server for this attribute.'));
# <!-- End of temporary warning --> # <!-- End of temporary warning -->
} elseif ($ldapserver->isAttrBinary($attr)) { } elseif ($ldapserver->isAttrBinary($entry['attr']['string'])) {
echo '<ul>'; echo '<ul>';
for ($i=1; $i<=count($vals); $i++) {
$href = sprintf('download_binary_attr.php?server_id=%s&amp;dn=%s&amp;attr=%s&amp;value_num=%s',
$ldapserver->server_id,$entry['dn']['encode'],$entry['attr']['string'],$i-1);
if (is_array($vals)) { printf('<li><a href="%s"><img src="images/save.png" alt="Save" />%s (%s)</a></li>',
for ($i=1; $i<=count($vals); $i++) { $href,_('download value'),$i);
$href = sprintf('download_binary_attr.php?server_id=%s&amp;dn=%s&amp;attr=%s&amp;value_num=%s',
$ldapserver->server_id,$encoded_dn,$attr,$i-1);
printf('<li><a href="%s"><img src="images/save.png" />%s (%s)</a></li>',
$href,_('download value'),$i);
}
} else {
$href = sprintf('download_binary_attr.php?server_id=%s&amp;dn=%s&amp;attr=%s',
$ldapserver->server_id,$encoded_dn,$attr);
printf('<li><a href="%s"><img src="images/save.png" />%s</a></li>',
$href,_('download value'));
} }
echo '</ul>'; echo '</ul>';
# <!-- Temporary warning until we find a way to add jpegPhoto values without an INAPROPRIATE_MATCHING error --> # <!-- Temporary warning until we find a way to add jpegPhoto values without an INAPROPRIATE_MATCHING error -->
printf('<p><small>%s</small></p>', printf('<p><small>%s</small></p>',
_('Note: You will get an "inappropriate matching" error if you have not setup an EQUALITY rule on your LDAP server for this attribute.')); _('Note: You will get an "inappropriate matching" error if you have not setup an EQUALITY rule on your LDAP server for this attribute.'));
@ -108,27 +156,21 @@ if ($num_current_values) {
} else { } else {
echo '<ul class="current_values">'; echo '<ul class="current_values">';
if (strcasecmp($entry['attr']['string'],'userPassword') == 0) {
if (is_array($current_values)) { foreach ($ldap['attrs'] as $key => $value) {
if (strcasecmp($attr,'userPassword') == 0) { if (obfuscate_password_display(get_enc_type($value)))
foreach ($current_values as $key => $value) { echo '<li><span style="white-space: nowrap;">'.preg_replace('/./','*',$value).'<br /></li>';
if (obfuscate_password_display(get_enc_type($value))) else
echo '<li><span style="white-space: nowrap;">'.preg_replace('/./','*',$value).'<br /></li>'; echo '<li><span style="white-space: nowrap;">'.htmlspecialchars($value).'<br /></li>';
else
echo '<li><span style="white-space: nowrap;">'.htmlspecialchars($value).'<br /></li>';
}
} else {
foreach ($current_values as $val)
printf('<li><span style="white-space: nowrap;">%s</span></li>',htmlspecialchars($val));
} }
} else { } else {
printf('<li><span style="white-space: nowrap;">%s</span></li>',htmlspecialchars($current_values)); foreach ($ldap['attrs'] as $val)
printf('<li><span style="white-space: nowrap;">%s</span></li>',htmlspecialchars($val));
} }
echo '</ul>'; echo '</ul>';
} }
*/
} else { } else {
echo '<br /><br />'; echo '<br /><br />';
} }
@ -136,13 +178,11 @@ if ($num_current_values) {
echo _('Enter the value you would like to add:'); echo _('Enter the value you would like to add:');
echo '<br /><br />'; echo '<br /><br />';
if ($is_object_class) { if ($entry['attr']['oclass']) {
echo '<form action="add_oclass_form.php" method="post" class="new_value">'; // draw objectClass selection
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id); echo '<table class="edit_dn" cellspacing="0" cellpadding="0" align="center"><tr><td>';
printf('<input type="hidden" name="dn" value="%s" />',$encoded_dn);
echo '<select name="new_oclass[]" multiple="true" size="15">'; echo '<select name="new_oclass[]" multiple="true" size="15">';
foreach ($schema_oclasses as $name => $oclass) { foreach ($ldap['oclasses'] as $name => $oclass) {
# exclude any structural ones, as they'll only generate an LDAP_OBJECT_CLASS_VIOLATION # exclude any structural ones, as they'll only generate an LDAP_OBJECT_CLASS_VIOLATION
if ($oclass->getType() == 'structural') if ($oclass->getType() == 'structural')
continue; continue;
@ -150,56 +190,190 @@ if ($is_object_class) {
printf('<option value="%s">%s</option>',$oclass->getName(),$oclass->getName()); printf('<option value="%s">%s</option>',$oclass->getName(),$oclass->getName());
} }
echo '</select>'; echo '</select>';
echo '</td></tr><tr><td>';
echo '<br />'; echo '<br />';
printf('<input type="submit" value="%s" />',_('Add new ObjectClass')); printf('<input id="save_button" type="submit" value="%s" />',_('Add new ObjectClass'));
echo '</td></tr></table>';
echo '<br />'; echo '<br />';
if ($config->GetValue('appearance','show_hints')) if ($_SESSION['plaConfig']->GetValue('appearance','show_hints'))
printf('<small><br /><img src="images/light.png" /><span class="hint">%s</span></small>', printf('<small><br /><img src="images/light.png" alt="Hint" /><span class="hint">%s</span></small>',
_('Note: You may be required to enter new attributes that these objectClass(es) require')); _('Note: You may be required to enter new attributes that these objectClass(es) require'));
echo '</form>';
} else { } else {
echo '<form action="add_value.php" method="post" class="new_value" name="new_value_form">'; // draw a blank field
echo '<table class="edit_dn" cellspacing="0" cellpadding="0" align="center"><tr><td>';
if ($ldapserver->isAttrBinary($attr)) $writer->draw('BlankValue', $ldap['attr'], $ldap['count']);
echo 'enctype="multipart/form-data"'; echo '</td></tr><tr><td>';
/*
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id); if ($ldapserver->isAttrBinary($entry['attr']['string'])) {
printf('<input type="hidden" name="dn" value="%s" />',$encoded_dn);
printf('<input type="hidden" name="attr" value="%s" />',$encoded_attr);
if ($ldapserver->isAttrBinary($attr)) {
echo '<input type="file" name="new_value" />'; echo '<input type="file" name="new_value" />';
echo '<input type="hidden" name="binary" value="true" />'; echo '<input type="hidden" name="binary" value="true" />';
} else { } else {
if ($ldapserver->isMultiLineAttr($attr)) { if ($ldapserver->isMultiLineAttr($entry['attr']['string'])) {
echo '<textarea name="new_value" rows="3" cols="30"></textarea>'; echo '<textarea name="new_value" rows="3" cols="30"></textarea>';
} else { } else {
printf('<input type="text"%s name="new_value" size="40" value="" />', printf('<input type="text"%s name="new_value" size="40" value="" />',
($schema_attr->getMaxLength() ? sprintf(' maxlength="%s"',$schema_attr->getMaxLength()) : '')); ($ldap['attr']->getMaxLength() ? sprintf(' maxlength="%s"',$ldap['attr']->getMaxLength()) : ''));
# draw the "browse" button next to this input box if this attr houses DNs: # Draw the "browse" button next to this input box if this attr houses DNs:
if ($ldapserver->isDNAttr($attr)) if ($ldapserver->isDNAttr($entry['attr']['string']))
draw_chooser_link("new_value_form.new_value", false); draw_chooser_link("new_value_form.new_value", false);
} }
} }
*/
printf('<input type="submit" name="submit" value="%s" />',_('Add New Value')); if ($ldap['schema']->getDescription())
echo '<br />'; printf('<small><b>%s:</b> %s</small><br />',_('Description'),$ldap['schema']->getDescription());
if ($schema_attr->getDescription()) if ($ldap['schema']->getType())
printf('<small><b>%s:</b> %s</small><br />',_('Description'),$schema_attr->getDescription()); printf('<small><b>%s:</b> %s</small><br />',_('Syntax'),$ldap['schema']->getType());
if ($schema_attr->getType()) if ($ldap['schema']->getMaxLength())
printf('<small><b>%s:</b> %s</small><br />',_('Syntax'),$schema_attr->getType());
if ($schema_attr->getMaxLength())
printf('<small><b>%s:</b> %s %s</small><br />', printf('<small><b>%s:</b> %s %s</small><br />',
_('Maximum Length'),number_format($schema_attr->getMaxLength()),_('characters')); _('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 '</form>'; 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>';
} }
echo '</body></html>';
?> ?>

52
htdocs/cmd.php Normal file
View File

@ -0,0 +1,52 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/cmd.php,v 1.3 2007/12/15 13:17:43 wurley Exp $
/**
*/
require_once './common.php';
$body = new block();
$file = '';
$cmd = get_request('cmd','REQUEST');
$meth = get_request('meth','REQUEST');
ob_start();
if (is_null($cmd)) {
$cmd = 'welcome';
}
switch ($cmd) {
case '_debug' :
debug_dump($_REQUEST,1);
$file = '';
break;
default :
if (file_exists(HOOKSDIR.$cmd.'.php'))
$file = HOOKSDIR.$cmd.'.php';
elseif (file_exists(HTDOCDIR.$cmd.'.php'))
$file = HTDOCDIR.$cmd.'.php';
else
$file = 'welcome.php';
}
if ($file) {
include $file;
}
$body->SetBody(ob_get_contents());
ob_end_clean();
if (DEBUG_ENABLED)
debug_log('Ready to render page for command [%s,%s].',128,__FILE__,__LINE__,__METHOD__,$cmd,$file);
$www = new page($ldapserver->server_id);
$www->block_add('body',$body);
if ($meth == 'get_body')
$www->body(true);
else
$www->display();
?>

View File

@ -1,33 +1,26 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/collapse.php,v 1.15 2006/10/28 11:42:10 wurley Exp $ // $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 * This script alters the session variable 'tree', collapsing it
* at the dn specified in the query string. * at the dn specified in the query string.
* *
* Variables that come in via common.php
* - server_id
* Variables that come in as GET vars:
* - dn (rawurlencoded)
*
* Note: this script is equal and opposite to expand.php * Note: this script is equal and opposite to expand.php
* @package phpLDAPadmin * @package phpLDAPadmin
* @see expand.php
*/ */
/** /**
*/ */
require './common.php'; require './common.php';
$dn = $_GET['dn']; $dn = get_request('dn','GET',true);
$tree = get_cached_item($ldapserver->server_id,'tree'); $tree = get_cached_item($ldapserver->server_id,'tree');
$tree['browser'][$dn]['open'] = false; $entry = $tree->getEntry($dn);
$entry->close();
set_cached_item($ldapserver->server_id,'tree','null',$tree); set_cached_item($ldapserver->server_id,'tree','null',$tree);
/* If cookies were disabled, build the url parameter for the session id. header(sprintf('Location:index.php?server_id=%s&junk=%s#%s%s',
It will be append to the url to be redirect */ $ldapserver->server_id,random_junk(),htmlid($ldapserver->server_id,$dn),pla_session_param()));
$id_session_param = ''; die();
if (SID != '')
$id_session_param = sprintf('&%s=%s',session_name(),session_id());
header(sprintf('Location:tree.php?foo=%s#%s_%s%s',random_junk(),$ldapserver->server_id,rawurlencode($dn),$id_session_param));
?> ?>

View File

@ -1,5 +1,5 @@
<?php <?php
# This is a temporary file # This is a temporary file
@define('LIBDIR',sprintf('%s/',realpath('../lib/'))); @define('LIBDIR',sprintf('%s/',realpath('../lib/')));
require LIBDIR.'common.php'; require_once LIBDIR.'common.php';
?> ?>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/compare.php,v 1.15 2006/09/17 06:35:11 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/compare.php,v 1.16 2007/12/15 07:50:30 wurley Exp $
/** /**
* Compare two DNs - the destination DN is editable. * Compare two DNs - the destination DN is editable.
@ -9,7 +9,7 @@
* @todo: Must fix dc/domainComponent evaluation. * @todo: Must fix dc/domainComponent evaluation.
*/ */
require './common.php'; require_once './common.php';
$dn_src = isset($_POST['dn_src']) ? $_POST['dn_src'] : null; $dn_src = isset($_POST['dn_src']) ? $_POST['dn_src'] : null;
$dn_dst = isset($_POST['dn_dst']) ? $_POST['dn_dst'] : null; $dn_dst = isset($_POST['dn_dst']) ? $_POST['dn_dst'] : null;
@ -20,11 +20,11 @@ $encoded_dn_dst = rawurlencode($dn_dst);
$server_id_src = (isset($_POST['server_id_src']) ? $_POST['server_id_src'] : ''); $server_id_src = (isset($_POST['server_id_src']) ? $_POST['server_id_src'] : '');
$server_id_dst = (isset($_POST['server_id_dst']) ? $_POST['server_id_dst'] : ''); $server_id_dst = (isset($_POST['server_id_dst']) ? $_POST['server_id_dst'] : '');
$ldapserver_src = $ldapservers->Instance($server_id_src); $ldapserver_src = $_SESSION['plaConfig']->ldapservers->Instance($server_id_src);
if (! $ldapserver_src->haveAuthInfo()) if (! $ldapserver_src->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.')); pla_error(_('Not enough information to login to server. Please check your configuration.'));
$ldapserver_dst = $ldapservers->Instance($server_id_dst); $ldapserver_dst = $_SESSION['plaConfig']->ldapservers->Instance($server_id_dst);
if (! $ldapserver_src->haveAuthInfo()) if (! $ldapserver_src->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.')); pla_error(_('Not enough information to login to server. Please check your configuration.'));
@ -33,22 +33,18 @@ if (! $ldapserver_src->dnExists($dn_src))
if (! $ldapserver_dst->dnExists($dn_dst)) if (! $ldapserver_dst->dnExists($dn_dst))
pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn_dst))); pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn_dst)));
$friendly_attrs = process_friendly_attr_table(); $_SESSION['plaConfig']->friendly_attrs = process_friendly_attr_table();
$attrs_src = $ldapserver_src->getDNAttrs($dn_src,false,$config->GetValue('deref','view')); $attrs_src = $ldapserver_src->getDNAttrs($dn_src,false,$_SESSION['plaConfig']->GetValue('deref','view'));
$attrs_dst = $ldapserver_dst->getDNAttrs($dn_dst,false,$config->GetValue('deref','view')); $attrs_dst = $ldapserver_dst->getDNAttrs($dn_dst,false,$_SESSION['plaConfig']->GetValue('deref','view'));
# Get a list of all attributes. # Get a list of all attributes.
$attrs_all = array_keys($attrs_src); $attrs_all = array_keys($attrs_src);
foreach ($attrs_dst as $key => $val) foreach ($attrs_dst as $key => $val)
if (! in_array($key,$attrs_all)) if (! in_array($key,$attrs_all))
$attrs_all[] = $key; $attrs_all[] = $key;
include './header.php';
?> ?>
<body>
<table class="comp_dn" border=0> <table class="comp_dn" border=0>
<tr><td colspan=6> <tr><td colspan=6>
<h3 class="title"><?php echo _('Comparing the following DNs'); ?></h3> <h3 class="title"><?php echo _('Comparing the following DNs'); ?></h3>
@ -67,7 +63,8 @@ include './header.php';
</tr> </tr>
<tr> <tr>
<td colspan=6 align=right> <td colspan=6 align=right>
<form action="compare.php" method="post" name="compare_form"> <form action="cmd.php?cmd=compare" method="post" name="compare_form">
<input type="hidden" name="server_id" value="<?php echo $ldapserver->server_id; ?>" />
<input type="hidden" name="server_id_src" value="<?php echo $ldapserver_dst->server_id; ?>" /> <input type="hidden" name="server_id_src" value="<?php echo $ldapserver_dst->server_id; ?>" />
<input type="hidden" name="server_id_dst" value="<?php echo $ldapserver_src->server_id; ?>" /> <input type="hidden" name="server_id_dst" value="<?php echo $ldapserver_src->server_id; ?>" />
<input type="hidden" name="dn_src" value="<?php echo htmlspecialchars($dn_dst); ?>" /> <input type="hidden" name="dn_src" value="<?php echo htmlspecialchars($dn_dst); ?>" />
@ -81,8 +78,7 @@ include './header.php';
if (! $attrs_all || ! is_array($attrs_all)) { if (! $attrs_all || ! is_array($attrs_all)) {
printf('<tr><td colspan="2">(%s)</td></tr>',_('This entry has no attributes')); printf('<tr><td colspan="2">(%s)</td></tr>',_('This entry has no attributes'));
print '</table>'; print '</table>';
print '</html>'; return;
die();
} }
sort($attrs_all); sort($attrs_all);
@ -108,7 +104,7 @@ foreach ($attrs_all as $attr) {
<?php <?php
if ($side == 'dst' && ! $ldapserver_dst->isReadOnly()) { ?> if ($side == 'dst' && ! $ldapserver_dst->isReadOnly()) { ?>
<form action="update_confirm.php" method="post" name="edit_form"> <form action="cmd.php?cmd=update_confirm" method="post" name="edit_form">
<input type="hidden" name="server_id" value="<?php echo $ldapserver_dst->server_id; ?>" /> <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="dn" value="<?php echo $dn_dst; ?>" />
@ -122,8 +118,8 @@ foreach ($attrs_all as $attr) {
$required_note = ''; $required_note = '';
# is there a user-friendly translation available for this attribute? # is there a user-friendly translation available for this attribute?
if (isset($friendly_attrs[strtolower($attr)])) { if (isset($_SESSION['plaConfig']->friendly_attrs[strtolower($attr)])) {
$attr_display = $friendly_attrs[strtolower($attr)]; $attr_display = $_SESSION['plaConfig']->friendly_attrs[strtolower($attr)];
$attr_note = sprintf('<acronym title="%s">alias</acronym>',sprintf(_('Note: \'%s\' is an alias for \'%s\''),$attr_display,$attr)); $attr_note = sprintf('<acronym title="%s">alias</acronym>',sprintf(_('Note: \'%s\' is an alias for \'%s\''),$attr_display,$attr));
} else { } else {
@ -162,8 +158,8 @@ foreach ($attrs_all as $attr) {
if ($side == 'src') { ?> if ($side == 'src') { ?>
<td class="attr"> <td class="attr">
<?php $schema_href="schema.php?server_id=$server_id_src&amp;view=attributes&amp;viewvalue=".real_attr_name($attr); ?> <?php $schema_href="cmd.php?cmd=schema&server_id=$server_id_src&amp;view=attributes&amp;viewvalue=".real_attr_name($attr); ?>
<b><a title="<?php echo sprintf(_('Click to view the schema definition for attribute type \'%s\''),$attr) ?>" href="<?php echo $schema_href; ?>"><?php echo $attr_display; ?></a></b> <a title="<?php echo sprintf(_('Click to view the schema definition for attribute type \'%s\''),$attr) ?>" href="<?php echo $schema_href; ?>"><?php echo $attr_display; ?></a>
</td> </td>
<td class="attr_note"> <td class="attr_note">
@ -204,7 +200,7 @@ foreach ($attrs_all as $attr) {
$toJump = 0; $toJump = 0;
switch ($side) { switch ($side) {
case 'src': case 'src':
print '<td colspan=2>&nbsp</td><td class="attr">'; print '<td colspan=2>&nbsp</td><td class="val">';
if (! isset($attrs_src[$attr])) { if (! isset($attrs_src[$attr])) {
echo "<small>&lt;". _('No Value')."&gt;</small></td>"; echo "<small>&lt;". _('No Value')."&gt;</small></td>";
@ -315,7 +311,7 @@ foreach ($attrs_all as $attr) {
if (trim($val) == "") if (trim($val) == "")
echo "<span style=\"color:red\">[" . _('empty') . "]</span><br />\n"; echo "<span style=\"color:red\">[" . _('empty') . "]</span><br />\n";
elseif (0 == strcasecmp($attr,'userPassword') && $config->GetValue('appearance','obfuscate_password_display')) elseif (0 == strcasecmp($attr,'userPassword') && $_SESSION['plaConfig']->GetValue('appearance','obfuscate_password_display'))
echo preg_replace('/./','*',$val) . "<br />"; echo preg_replace('/./','*',$val) . "<br />";
else else
@ -324,7 +320,7 @@ foreach ($attrs_all as $attr) {
// @todo: redundant - $vals is always an array. // @todo: redundant - $vals is always an array.
} else { } else {
if (0 == strcasecmp($attr,'userPassword') && $config->GetValue('appearance','obfuscate_password_display')) if (0 == strcasecmp($attr,'userPassword') && $_SESSION['plaConfig']->GetValue('appearance','obfuscate_password_display'))
echo preg_replace('/./','*',$vals) . "<br />"; echo preg_replace('/./','*',$vals) . "<br />";
else else
echo $vals . "<br />"; echo $vals . "<br />";
@ -434,7 +430,7 @@ foreach ($attrs_all as $attr) {
// Is this value is a structural objectClass, make it read-only // Is this value is a structural objectClass, make it read-only
if (0 == strcasecmp($attr,'objectClass')) { ?> if (0 == strcasecmp($attr,'objectClass')) { ?>
<a title="<?php echo _('View the schema description for this objectClass'); ?>" href="schema.php?server_id=<?php echo $ldapserver->server_id; ?>&amp;view=objectClasses&amp;viewvalue=<?php echo htmlspecialchars($val); ?>"><img src="images/info.png" /></a> <a title="<?php echo _('View the schema description for this objectClass'); ?>" href="cmd.php?cmd=schema&server_id=<?php echo $ldapserver->server_id; ?>&amp;view=objectClasses&amp;viewvalue=<?php echo htmlspecialchars($val); ?>"><img src="images/info.png" /></a>
<?php $schema_object = $ldapserver->getSchemaObjectClass($val); <?php $schema_object = $ldapserver->getSchemaObjectClass($val);
@ -452,7 +448,7 @@ foreach ($attrs_all as $attr) {
if (is_dn_string($val) || $ldapserver->isDNAttr($attr)) { ?> if (is_dn_string($val) || $ldapserver->isDNAttr($attr)) { ?>
<a title="<?php echo sprintf(_('Go to %s'),htmlspecialchars($val)); ?>" href="template_engine.php?server_id=<?php echo $ldapserver->server_id; ?>&amp;dn=<?php echo rawurlencode($val); ?>"><img style="vertical-align: top" src="images/go.png" /></a> <a title="<?php echo sprintf(_('Go to %s'),htmlspecialchars($val)); ?>" href="cmd.php?cmd=template_engine&server_id=<?php echo $ldapserver->server_id; ?>&amp;dn=<?php echo rawurlencode($val); ?>"><img style="vertical-align: top" src="images/go.png" /></a>
<?php } elseif (is_mail_string($val)) { ?> <?php } elseif (is_mail_string($val)) { ?>
@ -500,7 +496,6 @@ foreach ($attrs_all as $attr) {
<?php <?php
/* Draw the "add value" link under the list of values for this attributes */ /* Draw the "add value" link under the list of values for this attributes */
if (! $ldapserver_dst->isReadOnly()) { if (! $ldapserver_dst->isReadOnly()) {
// First check if the required objectClass is in this DN // First check if the required objectClass is in this DN
@ -522,10 +517,10 @@ foreach ($attrs_all as $attr) {
if (! $isOK) { if (! $isOK) {
if (count($src_oclass) == 1) { if (count($src_oclass) == 1) {
$add_href = sprintf('add_oclass_form.php?server_id=%s&dn=%s&new_oclass=%s', $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]); $ldapserver_dst->server_id,$encoded_dn_dst,$src_oclass[0]);
} else { } else {
$add_href = sprintf('add_value_form.php?server_id=%s&dn=%s&attr=objectClass', $add_href = sprintf('cmd.php?cmd=add_value_form&server_id=%s&dn=%s&attr=objectClass',
$ldapserver_dst->server_id,$encoded_dn_dst); $ldapserver_dst->server_id,$encoded_dn_dst);
} }
@ -537,7 +532,7 @@ foreach ($attrs_all as $attr) {
} else { } else {
if (! $schema_attr_dst->getIsSingleValue() || (! isset($vals))) { if (! $schema_attr_dst->getIsSingleValue() || (! isset($vals))) {
$add_href = sprintf('add_value_form.php?server_id=%s&dn=%s&attr=%s', $add_href = sprintf('cmd.php?cmd=add_value_form&server_id=%s&dn=%s&attr=%s',
$ldapserver_dst->server_id,$encoded_dn_dst,rawurlencode($attr)); $ldapserver_dst->server_id,$encoded_dn_dst,rawurlencode($attr));
printf('<div class="add_value">(<a href="%s" title="%s">%s</a>)</div>', printf('<div class="add_value">(<a href="%s" title="%s">%s</a>)</div>',
@ -550,8 +545,6 @@ foreach ($attrs_all as $attr) {
</td> </td>
<?php flush(); ?>
</tr> </tr>
<?php } /* End foreach ($attrs as $attr => $vals) */ <?php } /* End foreach ($attrs as $attr => $vals) */
@ -565,6 +558,7 @@ if (! $ldapserver_dst->isReadOnly()) { ?>
</table> </table>
<?php /* If this entry has a binary attribute,we need to provide a form for it to submit when deleting it. */ ?> <?php /* If this entry has a binary attribute,we need to provide a form for it to submit when deleting it. */ ?>
<script language="javascript"> <script language="javascript">
//<!-- //<!--
function deleteAttribute(attrName) function deleteAttribute(attrName)
@ -578,11 +572,8 @@ function deleteAttribute(attrName)
</script> </script>
<!-- This form is submitted by JavaScript when the user clicks "Delete attribute" on a binary attribute --> <!-- This form is submitted by JavaScript when the user clicks "Delete attribute" on a binary attribute -->
<form name="delete_attribute_form" action="delete_attr.php" method="post"> <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="server_id" value="<?php echo $ldapserver_dst->server_id; ?>" />
<input type="hidden" name="dn" value="<?php echo $dn_dst; ?>" /> <input type="hidden" name="dn" value="<?php echo $dn_dst; ?>" />
<input type="hidden" name="attr" value="FILLED IN BY JAVASCRIPT" /> <input type="hidden" name="attr" value="FILLED IN BY JAVASCRIPT" />
</form> </form>
</body>
</html>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/compare_form.php,v 1.4 2006/04/29 06:49:31 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/compare_form.php,v 1.5 2007/12/15 07:50:30 wurley Exp $
/** /**
* Compares to DN entries side by side. * Compares to DN entries side by side.
@ -12,19 +12,12 @@
/** /**
*/ */
require './common.php'; require_once './common.php';
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
$dn = (isset($_GET['dn']) ? $_GET['dn'] : ''); $dn = (isset($_GET['dn']) ? $_GET['dn'] : '');
$rdn = get_rdn($dn); $rdn = get_rdn($dn);
$select_server_html = server_select_list($ldapserver->server_id,true,'server_id_dst'); $select_server_html = server_select_list($ldapserver->server_id,true,'server_id_dst');
include './header.php';
echo '<body>';
printf('<h3 class="title">%s %s</h3>',_('Compare another DN with'),htmlspecialchars($rdn)); printf('<h3 class="title">%s %s</h3>',_('Compare another DN with'),htmlspecialchars($rdn));
printf('<h3 class="subtitle">%s: <b>%s</b>',_('Server'),$ldapserver->name); printf('<h3 class="subtitle">%s: <b>%s</b>',_('Server'),$ldapserver->name);
if ($dn) if ($dn)
@ -35,7 +28,8 @@ echo "\n";
echo '<center>'; echo '<center>';
printf('%s <b>%s</b> %s<br />',_('Compare'),htmlspecialchars($rdn),_('with ')); printf('%s <b>%s</b> %s<br />',_('Compare'),htmlspecialchars($rdn),_('with '));
echo '<form action="compare.php" method="post" name="compare_form">'; 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); printf('<input type="hidden" name="server_id_src" value="%s" />',$ldapserver->server_id);
echo "\n"; echo "\n";
@ -73,6 +67,4 @@ echo "\n";
echo '</table>'; echo '</table>';
echo '</form>'; echo '</form>';
echo '</center>'; echo '</center>';
echo '</body>';
echo '</html>';
?> ?>

View File

@ -1,13 +1,13 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy.php,v 1.43 2007/03/18 01:30:33 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy.php,v 1.44 2007/12/15 07:50:30 wurley Exp $
/** /**
* Copies a given object to create a new one. * Copies a given object to create a new one.
* *
* Vars that come in as POST vars * Vars that come in as POST vars
* - source_dn (rawurlencoded) * - source_dn (rawurlencoded)
* - new_dn (form element) * - new_dn (form element)
* - server_id * - server_id
* *
* @package phpLDAPadmin * @package phpLDAPadmin
*/ */
@ -16,118 +16,111 @@
require './common.php'; require './common.php';
$server_id_src = (isset($_POST['server_id']) ? $_POST['server_id'] : ''); if (! $_SESSION['plaConfig']->isCommandAvailable('entry_move'))
$server_id_dst = (isset($_POST['dest_server_id']) ? $_POST['dest_server_id'] : ''); pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('copy entry')));
$ldapserver_src = $ldapservers->Instance($server_id_src); $entry['src']['id'] = get_request('server_id');
$ldapserver_dst = $ldapservers->Instance($server_id_dst); $entry['dst']['id'] = get_request('dest_server_id');
if ($ldapserver_dst->isReadOnly()) $entry['src']['ldapserver'] = $_SESSION['plaConfig']->ldapservers->Instance($entry['src']['id']);
$entry['dst']['ldapserver'] = $_SESSION['plaConfig']->ldapservers->Instance($entry['dst']['id']);
if ($entry['dst']['ldapserver']->isReadOnly())
pla_error(_('Destination server is currently READ-ONLY.')); pla_error(_('Destination server is currently READ-ONLY.'));
if (! $ldapserver_src->haveAuthInfo() || ! $ldapserver_dst->haveAuthInfo()) if (! $entry['src']['ldapserver']->haveAuthInfo() || ! $entry['dst']['ldapserver']->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.')); pla_error(_('Not enough information to login to server. Please check your configuration.'));
$dn_src = $_POST['old_dn']; $entry['src']['dn'] = get_request('old_dn');
$dn_dst = $_POST['new_dn']; $entry['dst']['dn'] = get_request('new_dn');
$do_recursive = (isset($_POST['recursive']) && $_POST['recursive'] == 'on') ? true : false; $entry['src']['recursive'] = (get_request('recursive') == 'on') ? true : false;
$do_remove = (isset($_POST['remove']) && $_POST['remove'] == 'yes') ? true : false; $entry['src']['remove'] = (get_request('remove') == 'yes') ? true : false;
include './header.php';
# Error checking # Error checking
if (0 == strlen(trim($dn_dst))) if (strlen(trim($entry['dst']['dn'])) == 0)
pla_error(_('You left the destination DN blank.')); pla_error(_('You left the destination DN blank.'));
if (pla_compare_dns($dn_src,$dn_dst) == 0 && $server_id_src == $server_id_dst) if (pla_compare_dns($entry['src']['dn'],$entry['dst']['dn']) == 0 && $entry['src']['id'] == $entry['dst']['id'])
pla_error(_('The source and destination DN are the same.')); pla_error(_('The source and destination DN are the same.'));
if ($ldapserver_dst->dnExists($dn_dst)) if ($entry['dst']['ldapserver']->dnExists($entry['dst']['dn']))
pla_error(sprintf(_('The destination entry (%s) already exists.'),pretty_print_dn($dn_dst))); pla_error(sprintf(_('The destination entry (%s) already exists.'),pretty_print_dn($entry['dst']['dn'])));
if (! $ldapserver_dst->dnExists(get_container($dn_dst))) if (! $entry['dst']['ldapserver']->dnExists(get_container($entry['dst']['dn'])))
pla_error(sprintf(_('The destination container (%s) does not exist.'),pretty_print_dn(get_container($dn_dst)))); pla_error(sprintf(_('The destination container (%s) does not exist.'),pretty_print_dn(get_container($entry['dst']['dn']))));
if ($do_recursive) { if ($entry['src']['recursive']) {
$filter = isset($_POST['filter']) ? $_POST['filter'] : '(objectClass=*)'; $filter = isset($_POST['filter']) ? $_POST['filter'] : '(objectClass=*)';
# Build a tree similar to that of the tree browser to give to r_copy_dn # Build a tree similar to that of the tree browser to give to r_copy_dn
$snapshot_tree = array(); $snapshot_tree = array();
print '<body>'; printf('<h3 class="title">%s%s</h3>',_('Copying '),htmlspecialchars($entry['src']['dn']));
printf('<h3 class="title">%s%s</h3>',_('Copying '),htmlspecialchars($dn_src));
printf('<h3 class="subtitle">%s</h3>',_('Recursive copy progress')); printf('<h3 class="subtitle">%s</h3>',_('Recursive copy progress'));
print '<br /><br />'; print '<br /><br />';
print '<small>'; print '<small>';
print _('Building snapshot of tree to copy... '); print _('Building snapshot of tree to copy... ');
flush(); $snapshot_tree = build_tree($entry['src']['ldapserver'],$entry['src']['dn'],array(),$filter);
$snapshot_tree = build_tree($ldapserver_src,$dn_src,array(),$filter);
printf('<span style="color:green">%s</span><br />',_('Success')); printf('<span style="color:green">%s</span><br />',_('Success'));
flush();
# Prevent script from bailing early on a long delete # Prevent script from bailing early on a long delete
@set_time_limit(0); @set_time_limit(0);
$copy_result = r_copy_dn($ldapserver_src,$ldapserver_dst,$snapshot_tree,$dn_src,$dn_dst); $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_message = $copy_result;
print '</small>'; print '</small>';
} else { } else {
$copy_result = copy_dn($ldapserver_src,$ldapserver_dst,$dn_src,$dn_dst); $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.'));
} }
if ($copy_result) { if ($copy_result) {
$edit_url = sprintf('template_engine.php?server_id=%s&amp;dn=%s',$server_id_dst,rawurlencode($dn_dst)); $redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',$entry['dst']['id'],rawurlencode($entry['dst']['dn']));
$new_rdn = get_rdn($dn_dst); $new_rdn = get_rdn($entry['dst']['dn']);
$container = get_container($dn_dst); $container = get_container($entry['dst']['dn']);
printf('<center>%s<a href="%s">%s</a></center>',_('Copy successful! Would you like to '),$edit_url,_('view the new entry')); if ($entry['src']['remove'])
echo '<!-- refresh the tree view (with the new DN renamed) and redirect to the edit_dn page -->'; $redirect_url = sprintf('cmd.php?cmd=delete_form&server_id=%s&dn=%s',$entry['src']['id'],rawurlencode($entry['src']['dn']));
echo '<script type="text/javascript" language="javascript">parent.left_frame.location.reload();</script>';
echo '</body></html>';
if ($do_remove) { system_message(array(
sleep(2); 'title'=>_('Copy Entry'),
$delete_url = sprintf('delete_form.php?server_id=%s&dn=%s',$server_id_src,rawurlencode($dn_src)); 'body'=>$copy_message,
echo '<!-- redirect to the delete form -->'; 'type'=>'info'),
printf('<script type="text/javascript" language="javascript">parent.right_frame.location="%s" </script>',$delete_url); $redirect_url);
}
} }
function r_copy_dn($ldapserver_src,$ldapserver_dst,$snapshottree,$root_dn,$dn_dst) { function r_copy_dn($ldapserver_src,$ldapserver_dst,$snapshottree,$root_dn,$dn_dst) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('r_copy_dn: Entered with (%s,%s,%s,%s,%s)',1, 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); $ldapserver_src->server_id,$ldapserver_dst->server_id,$snapshottree,$root_dn,$dn_dst);
printf('<span style="white-space: nowrap;">%s %s...',_('Copying'),htmlspecialchars($root_dn)); $copy_message = array();
flush();
$copy_result = copy_dn($ldapserver_src,$ldapserver_dst,$root_dn,$dn_dst); $copy_result = copy_dn($ldapserver_src,$ldapserver_dst,$root_dn,$dn_dst);
if (! $copy_result) if (! $copy_result)
return false; return false;
printf('<span style="color:green">%s</span><br />',_('Success')); $copy_message[] = sprintf('%s DN: <b>%s</b> %s',_('Copy successful!'),htmlspecialchars($dn_dst),_('has been created.'));
flush();
$children = isset($snapshottree[$root_dn]) ? $snapshottree[$root_dn] : null; $children = isset($snapshottree[$root_dn]) ? $snapshottree[$root_dn] : null;
if (is_array($children) && count($children) > 0) { if (is_array($children) && count($children) > 0) {
foreach($children as $child_dn) { foreach($children as $child_dn) {
$child_rdn = get_rdn($child_dn); $child_rdn = get_rdn($child_dn);
$new_dest_dn = sprintf('%s,%s',$child_rdn,$dn_dst); $new_dest_dn = sprintf('%s,%s',$child_rdn,$dn_dst);
r_copy_dn($ldapserver_src,$ldapserver_dst,$snapshottree,$child_dn,$new_dest_dn); $copy_result = r_copy_dn($ldapserver_src,$ldapserver_dst,$snapshottree,$child_dn,$new_dest_dn);
$copy_message[] = array_shift($copy_result);
} }
} else {
return true;
} }
return true; return $copy_message;
} }
function copy_dn($ldapserver_src,$ldapserver_dst,$dn_src,$dn_dst) { function copy_dn($ldapserver_src,$ldapserver_dst,$dn_src,$dn_dst) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('copy_dn: Entered with (%s,%s,%s,%s)',17, debug_log('Entered with (%s,%s,%s,%s)',17,__FILE__,__LINE__,__METHOD__,
$ldapserver_src->server_id,$ldapserver_dst->server_id,$dn_src,$dn_dst); $ldapserver_src->server_id,$ldapserver_dst->server_id,$dn_src,$dn_dst);
$new_entry = $ldapserver_src->getDNAttrs($dn_src); $new_entry = $ldapserver_src->getDNAttrs($dn_src);
@ -147,11 +140,11 @@ function copy_dn($ldapserver_src,$ldapserver_dst,$dn_src,$dn_dst) {
$add_result = $ldapserver_dst->add($dn_dst,$new_entry); $add_result = $ldapserver_dst->add($dn_dst,$new_entry);
if (! $add_result) { if (! $add_result) {
run_hook('post_entry_create',
array('server_id'=>$ldapserver_dst->server_id,'dn'=>$dn_dst,'attrs'=>$new_entry));
echo '</small><br /><br />'; echo '</small><br /><br />';
pla_error(_('Failed to copy DN: ').$dn_dst,$ldapserver_dst->error(),$ldapserver_dst->errno()); pla_error(_('Failed to copy DN: ').$dn_dst,$ldapserver_dst->error(),$ldapserver_dst->errno());
} else {
run_hook('post_entry_create',
array('server_id'=>$ldapserver_dst->server_id,'dn'=>$dn_dst,'attrs'=>$new_entry));
} }
return $add_result; return $add_result;
@ -169,7 +162,7 @@ function copy_dn($ldapserver_src,$ldapserver_dst,$dn_src,$dn_dst) {
*/ */
function build_tree($ldapserver,$dn,$buildtree) { function build_tree($ldapserver,$dn,$buildtree) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('build_tree: Entered with (%s,%s,%s)',1, debug_log('Entered with (%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__,
$ldapserver->server_id,$dn,$buildtree); $ldapserver->server_id,$dn,$buildtree);
# we search all children, not only the visible children in the tree # we search all children, not only the visible children in the tree
@ -182,7 +175,7 @@ function build_tree($ldapserver,$dn,$buildtree) {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('build_tree: Returning (%s)',1,$buildtree); debug_log('Returning (%s)',1,__FILE__,__LINE__,__METHOD__,$buildtree);
return $buildtree; return $buildtree;
} }

View File

@ -1,11 +1,9 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy_form.php,v 1.29 2007/03/18 02:18:14 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy_form.php,v 1.30 2007/12/15 07:50:30 wurley Exp $
/** /**
* Copies a given object to create a new one. * Copies a given object to create a new one.
* *
* Variables that come in via common.php
* - server_id
* Variables that come in via GET variables * Variables that come in via GET variables
* - dn (rawurlencoded) * - dn (rawurlencoded)
* *
@ -18,22 +16,17 @@ require './common.php';
if ($ldapserver->isReadOnly()) if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode')); pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
$dn = $_GET['dn'] ; $entry['dn'] = get_request('dn','GET');
$rdn = get_rdn($dn); $entry['rdn'] = get_rdn($entry['dn']);
$attrs = $ldapserver->getDNAttrs($dn);
$select_server_html = server_select_list($ldapserver->server_id,true,'dest_server_id');
$children = $ldapserver->getContainerContents($dn);
include './header.php'; # We search all children, not only the visible children in the tree
$entry['children'] = $ldapserver->getContainerContents($entry['dn']);
# Draw some javaScrpt to enable/disable the filter field if this may be a recursive copy # Draw some javaScrpt to enable/disable the filter field if this may be a recursive copy
if (is_array($children) && count($children) > 0) { ?> if (is_array($entry['children']) && count($entry['children']) > 0) { ?>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
//<!--
function toggle_disable_filter_field(recursive_checkbox) function toggle_disable_filter_field(recursive_checkbox)
{ {
if (recursive_checkbox.checked) { if (recursive_checkbox.checked) {
@ -45,24 +38,21 @@ if (is_array($children) && count($children) > 0) { ?>
recursive_checkbox.form.filter.disabled = true; recursive_checkbox.form.filter.disabled = true;
} }
} }
//-->
</script> </script>
<?php <?php }
}
echo '<body>'; printf('<h3 class="title">%s %s</h3>',_('Copy'),htmlspecialchars($entry['rdn']));
printf('<h3 class="title">%s %s</h3>',_('Copy'),htmlspecialchars($rdn));
printf('<h3 class="subtitle">%s: <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>',_('Server'),$ldapserver->name, printf('<h3 class="subtitle">%s: <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>',_('Server'),$ldapserver->name,
_('Distinguished Name'),htmlspecialchars($dn)); _('Distinguished Name'),htmlspecialchars($entry['dn']));
echo "\n"; echo "\n";
echo '<center>'; echo '<center>';
printf('%s <b>%s</b> %s:<br /><br />',_('Copy'),htmlspecialchars($rdn),_('to a new object')); printf('%s <b>%s</b> %s:<br /><br />',_('Copy'),htmlspecialchars($entry['rdn']),_('to a new object'));
echo '<form action="copy.php" method="post" name="copy_form">'; echo '<form action="cmd.php" method="post" name="copy_form">';
printf('<input type="hidden" name="old_dn" value="%s" />',htmlspecialchars($dn)); 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" />',$ldapserver->server_id);
echo "\n"; echo "\n";
@ -72,15 +62,15 @@ echo "\n";
echo '<tr>'; echo '<tr>';
printf('<td><acronym title="%s">%s</acronym>:</td>', 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')); _('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($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($rdn)); draw_chooser_link('copy_form.new_dn','true',htmlspecialchars($entry['rdn']));
echo '</td></tr>'; echo '</td></tr>';
echo "\n"; 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($ldapserver->server_id,true,'dest_server_id'));
echo "\n"; echo "\n";
if (is_array($children) && count($children) > 0) { if (is_array($entry['children']) && count($entry['children']) > 0) {
echo '<tr>'; echo '<tr>';
printf('<td><label for="recursive">%s</label>:</td>',_('Recursive copy')); 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="toggle_disable_filter_field(this)" />';
@ -94,7 +84,7 @@ if (is_array($children) && count($children) > 0) {
echo '<tr>'; echo '<tr>';
printf('<td>%s</td>',_('Delete after copy (move):')); printf('<td>%s</td>',_('Delete after copy (move):'));
echo '<td><input type="checkbox" name="remove" value="yes"/ disabled>'; 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.')); printf('<small>(%s)</small)</td>',_('Make sure your filter (above) will select all child records.'));
echo '</tr>'; echo '</tr>';
@ -108,15 +98,8 @@ echo "\n";
echo '</table></form>'; echo '</table></form>';
echo "\n"; echo "\n";
echo '<script type="text/javascript" language="javascript">'; if ($_SESSION['plaConfig']->GetValue('appearance','show_hints'))
echo '<!--';
echo '/* If the user uses the back button, this way we draw the filter field properly. */';
echo 'toggle_disable_filter_field(document.copy_form.recursive);';
echo '//-->';
echo '</script>';
if ($config->GetValue('appearance','show_hints'))
printf('<small><img src="images/light.png" alt="Light" /><span class="hint">%s</span></small>',_('Hint: Copying between different servers only works if there are no schema violations')); printf('<small><img src="images/light.png" alt="Light" /><span class="hint">%s</span></small>',_('Hint: Copying between different servers only works if there are no schema violations'));
echo '</center></body></html>'; echo '</center>';
?> ?>

View File

@ -1,15 +1,11 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/create.php,v 1.47 2006/10/28 16:37:59 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/create.php,v 1.48 2007/12/15 07:50:30 wurley Exp $
/** /**
* Creates a new object. * Creates a new object.
* *
* Variables that come in via common.php
* - server_id
* Variables that come in as POST vars: * Variables that come in as POST vars:
* - new_dn * - new_dn
* - attrs (an array of attributes)
* - vals (an array of values for the above attrs)
* - required_attrs (an array with indices being the attributes, * - required_attrs (an array with indices being the attributes,
* and the values being their respective values) * and the values being their respective values)
* - object_classes (rawurlencoded, and serialized array of objectClasses) * - object_classes (rawurlencoded, and serialized array of objectClasses)
@ -23,107 +19,72 @@
require './common.php'; require './common.php';
if ($ldapserver->isReadOnly()) if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode')); pla_error(_('You cannot perform updates while server is in read-only mode'), null, -1, true);
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.')); if (! $_SESSION['plaConfig']->isCommandAvailable('entry_create'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('create entry')));
$rdn_attr = isset($_POST['rdn_attribute']) ? $_POST['rdn_attribute'] : null;
$entryfactoryclass = $_SESSION['plaConfig']->GetValue('appearance','entry_factory');
eval('$entry_factory = new '.$entryfactoryclass.'();');
$entry = $entry_factory->newCreatingEntry('');
eval('$reader = new '.$_SESSION['plaConfig']->GetValue('appearance', 'entry_reader').'($ldapserver);');
$entry->accept($reader);
$container = $entry->getContainer();
if (!$container || !$ldapserver->dnExists($container))
pla_error(sprintf(_('The container you specified (%s) does not exist. Please try again.'),htmlspecialchars($container)),null,-1,true);
$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())
pla_error(sprintf(_('The container (%s) is a leaf.'), htmlspecialchars($container)), null, -1, true);
}
$entry->setRdnAttributeName($rdn_attr);
if (!$entry->getRdnAttribute())
pla_error(sprintf(_('The Rdn attribute (%s) does not exist.'), htmlspecialchars($rdn_attr)), null, -1, true);
$new_dn = $entry->getDn();
if (! $new_dn)
pla_error(_('You left the RDN field blank.'));
$new_dn = isset($_POST['new_dn']) ? $_POST['new_dn'] : null;
$required_attrs = isset($_POST['required_attrs']) ? $_POST['required_attrs'] : false;
$object_classes = unserialize(rawurldecode($_POST['object_classes']));
$redirect = isset($_POST['redirect']) ? $_POST['redirect'] : false; $redirect = isset($_POST['redirect']) ? $_POST['redirect'] : false;
# See if there are any presubmit values to work out.
if (isset($_POST['presubmit']) && count($_POST['presubmit']) && isset($_POST['template'])) {
$templates = new Templates($ldapserver->server_id);
$template = $templates->getCreationTemplate($_POST['template']);
foreach ($_POST['presubmit'] as $attr) {
$_POST['attrs'][] = $attr;
$_POST['form'][$attr] = $templates->EvaluateDefault($ldapserver,$template['attribute'][$attr]['presubmit'],$_POST['container']);
$_POST['vals'][] = $_POST['form'][$attr];
}
# @todo: This section needs to be cleaned up, and will be when the old templates are removed. In the mean time...
# Rebuild the $_POST['attrs'] & $_POST['vals'], as they can be inconsistent.
unset($_POST['attrs']);
unset($_POST['vals']);
foreach ($_POST['form'] as $attr => $val) {
$_POST['attrs'][] = $attr;
$_POST['vals'][] = $val;
}
}
$vals = isset($_POST['vals']) ? $_POST['vals'] : array();
$attrs = isset($_POST['attrs']) ? $_POST['attrs'] : array();
# build the new entry
$new_entry = array(); $new_entry = array();
if (isset($required_attrs) && is_array($required_attrs)) { $attrs = $entry->getAttributes();
foreach ($required_attrs as $attr => $val) { foreach ($attrs as $attr) {
if ($val == '') $vals = $attr->getValues();
pla_error(sprintf(_('You left the value blank for required attribute (%s).'),htmlspecialchars($attr))); $new_vals = array();
foreach ($vals as $val) {
$new_entry[$attr][] = $val; if (strlen($val) > 0)
$new_vals[] = $val;
} }
if ($attr->isRequired() && !$new_vals)
pla_error(sprintf(_('You left the value blank for required attribute (%s).'), htmlspecialchars($attr->getName())));
if ($new_vals)
$new_entry[$attr->getName()] = $new_vals;
} }
if (isset($attrs) && is_array($attrs)) { if (! in_array('top', $new_entry['objectClass']))
foreach ($attrs as $i => $attr) {
if ($ldapserver->isAttrBinary($attr)) {
if (isset($_FILES['vals']['name'][$i]) && $_FILES['vals']['name'][$i] != '' ) {
# read in the data from the file
$file = $_FILES['vals']['tmp_name'][$i];
$f = fopen($file,'r');
$binary_data = fread($f,filesize($file));
fclose($f);
$val = $binary_data;
$new_entry[$attr][] = $val;
} elseif (isset($_SESSION['submitform'][$attr])) {
$new_entry[$attr][] = $_SESSION['submitform'][$attr];
unset($_SESSION['submitform'][$attr]);
}
} else {
if (is_array($vals[$i])) {
# If the array has blank entries, then ignore them.
foreach ($vals[$i] as $value) {
if (trim($value))
$new_entry[$attr][] = $value;
}
} else {
$val = isset($vals[$i]) ? $vals[$i] : '';
if ('' !== trim($val))
$new_entry[$attr][] = $val;
}
}
}
}
$new_entry['objectClass'] = $object_classes;
if (! in_array('top',$new_entry['objectClass']))
$new_entry['objectClass'][] = 'top'; $new_entry['objectClass'][] = 'top';
foreach ($new_entry as $attr => $vals) { foreach ($new_entry as $attr => $vals) {
# Check to see if this is a unique Attribute # Check to see if this is a unique Attribute
if ($badattr = $ldapserver->checkUniqueAttr($new_dn,$attr,$vals)) { if ($badattr = $ldapserver->checkUniqueAttr($new_dn,$attr,$vals)) {
$search_href = sprintf('search.php?search=true&amp;form=advanced&amp;server_id=%s&amp;filter=%s=%s', $search_href = sprintf('?cmd=search&amp;search=true&amp;form=advanced&amp;server_id=%s&amp;filter=%s=%s', $ldapserver->server_id,$attr,$badattr);
$ldapserver->server_id,$attr,$badattr);
pla_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)); pla_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));
} }
if (! $ldapserver->isAttrBinary($attr))
if (is_array($vals))
foreach ($vals as $i => $v)
$new_entry[$attr][$i] = $v;
else
$new_entry[$attr] = $vals;
} }
# Check the user-defined custom call back first # Check the user-defined custom call back first
@ -133,26 +94,39 @@ if (run_hook('pre_entry_create',array('server_id'=>$ldapserver->server_id,'dn'=>
if ($add_result) { if ($add_result) {
run_hook('post_entry_create',array('server_id'=>$ldapserver->server_id,'dn'=>$new_dn,'attrs'=>$new_entry)); run_hook('post_entry_create',array('server_id'=>$ldapserver->server_id,'dn'=>$new_dn,'attrs'=>$new_entry));
if ($redirect) $action_number = $_SESSION['plaConfig']->GetValue('appearance', 'action_after_creation');
$container = get_container($new_dn,false);
//$container_container = get_container($container);
if ($redirect) {
$redirect_url = $redirect; $redirect_url = $redirect;
else } else if ($action_number == 2) {
$redirect_url = sprintf('template_engine.php?server_id=%s&dn=%s',$ldapserver->server_id,rawurlencode($new_dn)); $redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&container=%s', $ldapserver->server_id, rawurlencode($container));
} else {
echo '<html><head>'; $redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s', $ldapserver->server_id, rawurlencode($new_dn));
$tree = get_cached_item($ldapserver->server_id,'tree');
$container = get_container($new_dn);
if ((isset($tree['browser'][$container]['open']) && $tree['browser'][$container]['open']) ||
in_array($new_dn,$ldapserver->getBaseDN())) {
echo '<!-- refresh the tree view (with the new DN renamed) and redirect to the edit_dn page -->';
printf('<script language="javascript">parent.left_frame.location.reload();location.href="%s"</script>',$redirect_url);
} }
printf('<meta http-equiv="refresh" content="0; url=%s" />',$redirect_url); if ($action_number == 1 || $action_number == 2)
echo '</head><body>'; printf('<meta http-equiv="refresh" content="0; url=%s" />',$redirect_url);
printf('%s <a href="%s">%s</a>.',_('Redirecting...'),$redirect_url,_('here'));
echo '</body></html>'; 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.'));
system_message(array(
'title'=>_('Create Entry'),
'body'=>$create_message,
'type'=>'info'),
$redirect_url);
} else {
printf('<h3 class="title">%s</h3>',_('Entry created'));
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'));
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'));
echo '</center>';
}
} else { } else {
pla_error(_('Could not add the object to the LDAP server.'),$ldapserver->error(),$ldapserver->errno()); pla_error(_('Could not add the object to the LDAP server.'),$ldapserver->error(),$ldapserver->errno());

View File

@ -1,134 +0,0 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/create_form.php,v 1.34 2006/10/28 16:37:59 wurley Exp $
/**
* The menu where the user chooses an RDN, Container, and Template for creating a new entry.
* After submitting this form, the user is taken to their chosen Template handler.
*
* Variables that come in via common.php
* - server_id
* Variables that come in as GET vars
* - container (rawurlencoded) (optional)
*
* @package phpLDAPadmin
*/
/**
*/
require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
$container = $_REQUEST['container'];
$server_menu_html = server_select_list($ldapserver->server_id,true);
include './header.php';
echo '<body>';
printf('<h3 class="title">%s</h3>',_('Create Object'));
printf('<h3 class="subtitle">%s</h3>',_('Choose a template'));
printf('<center><h3>%s</h3></center>',_('Select a template for the creation process'));
echo '<form action="template_engine.php" method="post">';
printf('<input type="hidden" name="container" value="%s" />',htmlspecialchars($container));
echo '<table class="create">';
printf('<tr><td class="heading">%s:</td><td>%s</td></tr>',_('Server'),$server_menu_html);
echo '<tr>';
printf('<td class="heading">%s:</td>',_('Template'));
echo '<td>';
echo '<table class="template_display">';
echo '<tr><td>';
echo '<table class="templates">';
$i = -1;
$template_xml = new Templates($ldapserver->server_id);
$templates = $template_xml->getCreationTemplates();
# Remove non-visable templates.
foreach ($templates as $index => $template)
if (isset($template['visible']) && (! $template['visible']))
unset ($templates[$index]);
$templates['custom']['title'] = 'Custom';
$templates['custom']['icon'] = 'images/object.png';
$count = count($templates);
foreach ($templates as $name => $template) {
$i++;
# If the template doesnt have a title, we'll use the desc field.
$template['desc'] = isset($template['title']) ? $template['title'] : $template['desc'];
# Balance the columns properly
if ((count($templates) % 2 == 0 && $i == intval($count / 2)) ||
(count($templates) % 2 == 1 && $i == intval($count / 2) + 1))
echo '</table></td><td><table class="templates">';
# Check and see if this template should be shown in the list
$isValid = false;
if (isset($template['regexp'])) {
if (@preg_match('/'.$template['regexp'].'/i',$container))
$isValid = true;
} else
$isValid = true;
if (isset($template['invalid']) && $template['invalid'])
$isValid = false;
echo '<tr>';
if (! $isValid || (isset($template['handler']) && ! file_exists(TMPLDIR.'creation/'.$template['handler'])))
echo '<td class="icon"><img src="images/error.png" /></td>';
else
printf('<td><input type="radio" name="template" value="%s" id="%s" %s /></td>',
htmlspecialchars($name),htmlspecialchars($name),
! $isValid ? 'disabled' : (strcasecmp('Custom',$name) ? '' : 'checked'));
printf('<td class="icon"><label for="%s"><img src="%s" /></label></td>',
htmlspecialchars($name),$template['icon']);
printf('<td class="name"><label for="%s">',
htmlspecialchars($name));
if (strcasecmp('Custom', $template['desc']) == 0)
echo '<b>';
if (! $isValid)
if (isset($template['invalid']) && $template['invalid'])
printf('<span style="color: gray"><acronym title="%s">',
isset($template['invalid_reason']) ? $template['invalid_reason'] :
_('This template has been disabled in the XML file.'));
else
printf('<span style="color: gray"><acronym title="%s">',
_('This template is not allowed in this container.'));
echo htmlspecialchars($template['desc']);
if (! $isValid) echo '</acronym></span>';
if (strcasecmp('Custom', $template['desc']) == 0)
echo '</b>';
echo '</label></td></tr>';
}
echo '</table>';
echo '</td></tr></table>';
echo '</td></tr>';
printf('<tr><td colspan="2"><center><input type="submit" name="submit" value="%s" /></center></td></tr>',
htmlspecialchars(_('Proceed >>')));
echo '</table>';
echo '</form></body></html>';
?>

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,9 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete.php,v 1.26 2005/12/17 00:00:11 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete.php,v 1.27 2007/12/15 07:50:30 wurley Exp $
/** /**
* Deletes a DN and presents a "job's done" message. * Deletes a DN and presents a "job's done" message.
* *
* Variables that come in via common.php
* - server_id
* Variables that come in as POST vars: * Variables that come in as POST vars:
* - dn (rawurlencoded) * - dn (rawurlencoded)
* *
@ -18,38 +16,37 @@ require './common.php';
if ($ldapserver->isReadOnly()) if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode')); pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
$dn = $_POST['dn']; if (! $_SESSION['plaConfig']->isCommandAvailable('entry_delete', 'simple_delete'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete entry')));
if (is_null($dn)) $entry['dn'] = get_request('dn');
if (! $entry['dn'])
pla_error(_('You must specify a DN')); pla_error(_('You must specify a DN'));
if (! $ldapserver->dnExists($dn)) if (! $ldapserver->dnExists($entry['dn']))
pla_error(sprintf(_('No such entry: %s'),'<b>'.pretty_print_dn($dn).'</b>')); pla_error(sprintf(_('No such entry: %s'),'<b>'.pretty_print_dn($entry['dn']).'</b>'));
# Check the user-defined custom callback first. # Check the user-defined custom callback first.
if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn))) if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn'])))
$del_result = $ldapserver->delete($dn); $result = $ldapserver->delete($entry['dn']);
else else
pla_error(sprintf(_('Could not delete the entry: %s'),'<b>'.pretty_print_dn($dn).'</b>')); pla_error(sprintf(_('Could not delete the entry: %s'),'<b>'.pretty_print_dn($entry['dn']).'</b>'));
if ($del_result) { if ($result) {
# Custom callback # Custom callback
run_hook('post_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn)); run_hook('post_entry_delete',
array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn']));
include './header.php'; system_message(array(
echo '<body>'; 'title'=>_('Delete DN'),
'body'=>_('Successfully deleted DN ').sprintf('<b>%s</b>',$entry['dn']),
echo '<script type="text/javascript" language="javascript">parent.left_frame.location.reload();</script>'; 'type'=>'info'),
echo '<br /><br />'; 'index.php');
printf('<center>'._('Entry %s deleted successfully.').'</center>','<b>'.pretty_print_dn($dn).'</b>');
echo '</body>';
} else { } else {
pla_error(sprintf(_('Could not delete the entry: %s'),'<b>'.pretty_print_dn($dn).'</b>'), pla_error(sprintf(_('Could not delete the entry: %s'),'<b>'.pretty_print_dn($entry['dn']).'</b>'),
$ldapserver->error(),$ldapserver->errno()); $ldapserver->error(),$ldapserver->errno());
} }
echo '</html>';
?> ?>

View File

@ -1,12 +1,9 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_attr.php,v 1.15 2005/12/10 10:34:54 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_attr.php,v 1.16 2007/12/15 07:50:30 wurley Exp $
/** /**
* Deletes an attribute from an entry with NO confirmation. * Deletes an attribute from an entry with NO confirmation.
* *
* Variables that come in via common.php
* - server_id
*
* On success, redirect to template_engine.php * On success, redirect to template_engine.php
* On failure, echo an error. * On failure, echo an error.
* *
@ -19,34 +16,35 @@ require './common.php';
if ($ldapserver->isReadOnly()) if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode')); pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
$dn = isset($_POST['dn']) ? $_POST['dn'] : null; if (! $_SESSION['plaConfig']->isCommandAvailable('attribute_delete'))
$attr = isset($_POST['attr']) ? $_POST['attr'] : null; pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete attribute')));
if (! $dn) $entry['dn']['string'] = get_request('dn');
$entry['dn']['encode'] = rawurlencode($entry['dn']['string']);
$entry['attr'] = get_request('attr');
if (! $entry['dn']['string'])
pla_error(_('No DN specified')); pla_error(_('No DN specified'));
if (! $attr) if (! $entry['attr'])
pla_error(_('No attribute name specified.')); pla_error(_('No attribute name specified.'));
$encoded_dn = rawurlencode($dn); if ($ldapserver->isAttrReadOnly($entry['attr']))
pla_error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),htmlspecialchars($entry['attr'])));
if ($ldapserver->isAttrReadOnly($attr))
pla_error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),htmlspecialchars($attr)));
$update_array = array(); $update_array = array();
$update_array[$attr] = array(); $update_array[$entry['attr']] = array();
$res = $ldapserver->modify($dn,$update_array); $result = $ldapserver->modify($entry['dn']['string'],$update_array);
if ($res) { if ($result) {
$redirect_url = sprintf('template_engine.php?server_id=%s&dn=%s',$ldapserver->server_id,$encoded_dn); $redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',$ldapserver->server_id,$entry['dn']['encode']);
foreach($update_array as $attr => $junk) foreach ($update_array as $attr => $junk)
$redirect_url .= "&modified_attrs[]=$attr"; $redirect_url .= "&modified_attrs[]=$attr";
header("Location: $redirect_url"); header("Location: $redirect_url");
die();
} else { } else {
pla_error(_('Could not perform ldap_modify operation.'),$ldapserver->error(),$ldapserver->errno()); pla_error(_('Could not perform ldap_modify operation.'),$ldapserver->error(),$ldapserver->errno());

View File

@ -1,12 +1,10 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_form.php,v 1.25 2007/03/18 02:14:16 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_form.php,v 1.26 2007/12/15 07:50:30 wurley Exp $
/** /**
* delete_form.php * delete_form.php
* Displays a last chance confirmation form to delete a dn. * Displays a last chance confirmation form to delete a dn.
* *
* Variables that come in via common.php
* - server_id
* Variables that come in as GET vars: * Variables that come in as GET vars:
* - dn (rawurlencoded) * - dn (rawurlencoded)
* *
@ -19,82 +17,79 @@ require './common.php';
if ($ldapserver->isReadOnly()) if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode')); pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
$dn = $_GET['dn']; $entry['dn']['string'] = get_request('dn','GET');
$children = $ldapserver->getContainerContents($dn,0,'(objectClass=*)',LDAP_DEREF_NEVER); $entry['dn']['html'] = htmlspecialchars($entry['dn']['string']);
$has_children = count($children) > 0 ? true : false;
include './header.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);
echo '<body>'; printf('<h3 class="title">'._('Delete %s').'</h3>',htmlspecialchars(get_rdn($entry['dn']['string'])));
printf('<h3 class="title">'._('Delete %s').'</h3>',htmlspecialchars(get_rdn($dn)));
printf('<h3 class="subtitle">%s: <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>', printf('<h3 class="subtitle">%s: <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>',
_('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($dn)); _('Server'),$ldapserver->name,_('Distinguished Name'),$entry['dn']['html']);
echo "\n"; echo "\n";
echo '<center>'; echo '<center>';
if ($has_children) { if (count($entry['children'])) {
printf('<b>%s</b><br /><br />',_('Permanently delete all children also?')); printf('<b>%s</b><br /><br />',_('Permanently delete all children also?'));
flush();
# get the total number of child objects (whole sub-tree) # Get the total number of child objects (whole sub-tree)
$s = $ldapserver->search(null,dn_escape($dn),'objectClass=*',array('dn')); $search['entries'] = $ldapserver->search(null,dn_escape($entry['dn']['string']),'objectClass=*',array('dn'));
$sub_tree_count = count($s); $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'])));
echo '<table class="delete_confirm">'; echo '<table class="delete" border=0>';
echo '<tr>'; echo '<tr>';
echo '<td><p>'; echo '<td colspan=2>';
printf(_('This entry is the root of a sub-tree containing %s entries.'),$sub_tree_count); printf(_('This entry is the root of a sub-tree containing %s entries.'),$search['count']);
printf('<small>(<a href="search.php?search=true&amp;server_id=%s&amp;filter=%s&amp;base_dn=%s&amp;form=advanced&amp;scope=sub">%s</a>)</small>', printf(' <small>(<a href="%s">%s</a>)</small>',
$ldapserver->server_id,rawurlencode('objectClass=*'),rawurlencode($dn),_('view entries')); $search['href'],_('view entries'));
echo '<br /><br />'; echo '</td></tr>';
printf(_('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?'),($sub_tree_count-1)); echo '<tr><td colspan=2>&nbsp;</td></tr>';
echo '<br /><br />';
printf('<small>%s</small>', 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));
echo '<tr><td colspan=2>&nbsp;</td></tr>';
printf('<tr><td colspan=2><small>%s</small></td></tr>',
_('Note: this is potentially very dangerous and you do this at your own risk. This operation cannot be undone. Take into consideration aliases, referrals, and other things that may cause problems.')); _('Note: this is potentially very dangerous and you do this at your own risk. This operation cannot be undone. Take into consideration aliases, referrals, and other things that may cause problems.'));
echo '<br /><br />';
echo "\n"; echo "\n";
echo '<table width="100%">';
echo '<tr>'; echo '<tr>';
echo '<td><center>'; echo '<td width=50%><center>';
echo '<form action="rdelete.php" method="post">'; echo '<form action="cmd.php" method="post">';
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($dn)); 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="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="submit" class="scary" value="%s" />',sprintf(_('Delete all %s objects'),$sub_tree_count)); printf('<input type="submit" class="scary" value="%s" />',sprintf(_('Delete all %s objects'),$search['count']));
echo '</form>'; echo '</form>';
echo '</center></td>'; echo '</center></td>';
echo '<td><center>'; echo '<td width=50%><center>';
echo '<form action="template_engine.php" method="get">'; echo '<form action="cmd.php" method="get">';
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($dn)); 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" />',$ldapserver->server_id);
printf('<input type="submit" name="submit" value="%s" class="cancel" />',_('Cancel')); printf('<input type="submit" name="submit" value="%s" class="cancel" />',_('Cancel'));
echo '</form>'; echo '</form>';
echo '</center></td>'; echo '</center></td>';
echo '</tr>'; echo '</tr>';
echo '</table>';
echo "\n"; echo "\n";
echo '</td>';
echo '</tr>';
echo '</table>'; echo '</table>';
echo "\n"; echo "\n";
flush();
echo '<br /><br />'; echo '<br /><br />';
echo _('List of entries to be deleted:'); echo _('List of entries to be deleted:');
echo '<br />'; echo '<br />';
printf('<select size="%s" multiple disabled style="background:white; color:black;width:500px" >',min(10,$sub_tree_count)); printf('<select size="%s" multiple disabled style="background:white; color:black;width:500px" >',min(10,$search['count']));
$i=0; $i = 0;
foreach ($s as $dn => $junk) { foreach ($search['entries'] as $dn => $junk) {
$i++; $i++;
printf('<option>%s. %s</option>',$i,htmlspecialchars(dn_unescape($dn))); printf('<option>%s. %s</option>',$i,htmlspecialchars(dn_unescape($dn)));
} }
@ -102,34 +97,32 @@ if ($has_children) {
echo "\n"; echo "\n";
} else { } else {
echo '<table class="delete_confirm">'; echo '<table class="delete" border=0>';
echo '<tr>';
echo '<td nowrap>'; printf('<tr><td colspan=4>%s</td></tr>',_('Are you sure you want to permanently delete this object?'));
echo _('Are you sure you want to permanently delete this object?'); echo '<tr><td colspan=4>&nbsp;</td></tr>';
echo '<br /><br />';
printf('<acronym title="%s">%s</acronym>: <b>%s</b>',_('Distinguished Name'),_('DN'),pretty_print_dn($dn)); printf('<tr><td width=10%%>%s:</td><td colspan=3 width=75%%><b>%s</b></td></tr>',_('Server'),htmlspecialchars($ldapserver->name));
echo '<br />'; printf('<tr><td width=10%%><acronym title="%s">%s</acronym></td><td colspan=3 width=75%%><b>%s</b></td></tr>',
printf('%s: <b>%s</b>',_('Server'),htmlspecialchars($ldapserver->name)); _('Distinguished Name'),_('DN'),$entry['dn']['string']);
echo '<br /><br />'; echo '<tr><td colspan=4>&nbsp;</td></tr>';
echo "\n"; echo "\n";
echo '<table width="100%">';
echo '<tr>'; echo '<tr>';
echo '<td colspan=2 width=50%><center>';
echo '<td><center>'; echo '<form action="cmd.php" method="post">';
echo '<form action="delete.php" method="post">'; echo '<input type="hidden" name="cmd" value="delete" />';
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($dn)); 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" />',$ldapserver->server_id);
printf('<input type="submit" name="submit" value="%s" class="scary" />',_('Delete')); printf('<input type="submit" name="submit" value="%s" class="scary" />',_('Delete'));
echo '</form>'; echo '</form>';
echo '</center></td>'; echo '</center></td>';
echo '<td colspan=2 width=50%><center>';
echo '<td><center>'; echo '<form action="cmd.php" method="get">';
echo '<form action="template_engine.php" method="get">'; echo '<input type="hidden" name="cmd" value="template_engine" />';
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($dn)); 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" />',$ldapserver->server_id);
printf('<input type="submit" name="submit" value="%s" class="cancel" />',_('Cancel')); printf('<input type="submit" name="submit" value="%s" class="cancel" />',_('Cancel'));
echo '</form>'; echo '</form>';
@ -138,16 +131,8 @@ if ($has_children) {
echo '</tr>'; echo '</tr>';
echo '</table>'; echo '</table>';
echo "\n"; echo "\n";
echo '</td>';
echo '</tr>';
echo '</table>';
echo "\n";
} }
echo '</center>'; echo '</center>';
echo '<br />'; echo '<br />';
echo '</body>';
echo '</html>';
?> ?>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/download_binary_attr.php,v 1.14 2005/12/10 10:34:54 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/download_binary_attr.php,v 1.15 2007/12/15 07:50:30 wurley Exp $
/** /**
* @package phpLDAPadmin * @package phpLDAPadmin
@ -25,9 +25,10 @@ $value_num = isset($_GET['value_num']) ? $_GET['value_num'] : null;
if (! $ldapserver->dnExists($dn)) if (! $ldapserver->dnExists($dn))
pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn))); pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn)));
$search = $ldapserver->search(null,$dn,'(objectClass=*)',array($attr),'base',false,$config->GetValue('deref','view')); $search = $ldapserver->search(null,$dn,'(objectClass=*)',array($attr),'base',false,$_SESSION['plaConfig']->GetValue('deref','view'));
# Dump the binary data to the browser # Dump the binary data to the browser
if (ob_get_level()) ob_end_clean();
header('Content-type: octet-stream'); header('Content-type: octet-stream');
header("Content-disposition: attachment; filename=$attr"); header("Content-disposition: attachment; filename=$attr");
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');

35
htdocs/draw_tree_node.php Normal file
View File

@ -0,0 +1,35 @@
<?php
$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']);
if (! $tree)
die();
$dnentry = $tree->getEntry($entry['dn']);
if (! $dnentry) {
$tree->addEntry($entry['dn']);
$dnentry = $this->getEntry($entry['dn']);
}
if (! $dnentry)
die();
if ($entry['action'] == 0) {
$dnentry->close();
} elseif ($entry['action'] == 2) {
$dnentry->open();
} else {
$dnentry->open();
if ($entry['dn']) {
echo $tree->draw_children($dnentry,$entry['code']);
} else {
$tree->draw(true);
}
}
die();
?>

View File

@ -1,89 +1,93 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/entry_chooser.php,v 1.30 2006/01/03 20:39:58 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/entry_chooser.php,v 1.31 2007/12/15 07:50:30 wurley Exp $
/** /**
* Display a selection (popup window) to pick a DN. * Display a selection (popup window) to pick a DN.
* *
* @package phpLDAPadmin * @package phpLDAPadmin
*/ */
/**
*/
require './common.php'; include './common.php';
include HTDOCDIR.'header.php';
$container = isset($_GET['container']) ? rawurldecode($_GET['container']) : false; $entry['container'] = get_request('container','GET');
$return_form_element = isset($_GET['form_element']) ? htmlspecialchars($_GET['form_element']) : null; $entry['element'] = get_request('form_element','GET');
$rdn = isset($_GET['rdn']) ? htmlspecialchars($_GET['rdn']) : null; $entry['rdn'] = get_request('rdn','GET');
include "./header.php"; echo '<body>';
echo '<div class="entry_chooser">';
printf('<h3 class="subtitle">%s</h3>',_('Entry Chooser')); printf('<h3>%s</h3>',_('Entry Chooser'));
flush();
?> ?>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
function returnDN(dn) { function returnDN(dn) {
opener.document.<?php echo $return_form_element; ?>.value = dn; opener.document.<?php echo $entry['element']; ?>.value = dn;
close(); close();
} }
</script> </script>
<?php <?php
if ($container) { echo '<table class="entry_chooser" border=0>';
printf('%s<b>%s</b>',_('Server: '),htmlspecialchars($ldapserver->name)); if ($entry['container']) {
echo '<br />'; printf('<tr><td class="head" colspan=3>%s:</td><td class="value">%s</td></tr>',_('Server'),htmlspecialchars($ldapserver->name));
printf('%s<b>%s</b>',_('Looking in: '),htmlspecialchars($container)); printf('<tr><td class="head" colspan=3>%s:</td><td class="value">%s</td></tr>',_('Looking in'),htmlspecialchars($entry['container']));
echo '<br />'; echo '<tr><td class="spacer" colspan=4>&nbsp;</td></tr>';
} }
/* Has the use already begun to descend into a specific server tree? */ /* Has the use already begun to descend into a specific server tree? */
if (isset($ldapserver) && $container !== false) { if (isset($ldapserver) && ! is_null($entry['container'])) {
if (! $ldapserver->haveAuthInfo()) if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.')); pla_error(_('Not enough information to login to server. Please check your configuration.'));
$dn_list = $ldapserver->getContainerContents($container,0,'(objectClass=*)',$config->GetValue('deref','tree')); $entry['children'] = $ldapserver->getContainerContents($entry['container'],0,'(objectClass=*)',$_SESSION['plaConfig']->GetValue('deref','tree'));
sort($dn_list); sort($entry['children']);
foreach ($ldapserver->getBaseDN() as $base_dn) { foreach ($ldapserver->getBaseDN() as $base_dn) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('entry_chooser.php: Comparing BaseDN [%s] with container [%s]',64,$base_dn,$container); debug_log('entry_chooser.php: Comparing BaseDN [%s] with container [%s]',64,$base_dn,$entry['container']);
if (! pla_compare_dns($container,$base_dn)) { if (! pla_compare_dns($entry['container'],$base_dn)) {
$parent_container = false; $parent_container = false;
$up_href = sprintf('entry_chooser.php?form_element=%s&amp;rdn=%s',$return_form_element,$rdn); $href['up'] = htmlspecialchars(sprintf('entry_chooser.php?form_element=%s&rdn=%s',$entry['element'],$entry['rdn']));
break; break;
} else { } else {
$parent_container = get_container($container); $parent_container = get_container($entry['container']);
$up_href = sprintf('entry_chooser.php?form_element=%s&amp;rdn=%s&amp;server_id=%s&amp;container=%s', $href['up'] = htmlspecialchars(sprintf('entry_chooser.php?form_element=%s&rdn=%s&server_id=%s&container=%s',
$return_form_element,$rdn,$ldapserver->server_id,rawurlencode($parent_container)); $entry['element'],$entry['rdn'],$ldapserver->server_id,rawurlencode($parent_container)));
} }
} }
echo '&nbsp;'; echo '<tr>';
printf('<a href="%s" style="text-decoration:none"><img src="images/up.png" /> %s</a>',$up_href,_('Back Up...')); echo '<td class="spacer">&nbsp;</td>';
echo '<br />'; printf('<td class="icon"><a href="%s"><img src="images/up.png" alt="Up" /></a></td>',$href['up']);
printf('<td class="value" colspan=2><a href="%s">%s</a></td>',$href['up'],_('Back Up...'));
echo '</tr>';
if (! count($dn_list)) if (! count($entry['children']))
printf('&nbsp;&nbsp;&nbsp;(%s)<br />',_('no entries')); printf('<td class="spacer" colspan=2>&nbsp;</td><td class="body" colspan=2">(%s)</td>',_('no entries'));
else else
foreach ($dn_list as $dn) { foreach ($entry['children'] as $dn) {
$href = sprintf("javascript:returnDN('%s%s')",($rdn ? "$rdn," : ''),$dn); $href['return'] = sprintf("javascript:returnDN('%s%s')",($entry['rdn'] ? sprintf('%s,',$entry['rdn']) : ''),rawurlencode($dn));
echo '&nbsp;&nbsp;&nbsp;'; $href['expand'] = htmlspecialchars(sprintf('entry_chooser.php?server_id=%s&form_element=%s&rdn=%s&container=%s',
printf('<a href="entry_chooser.php?server_id=%s&amp;form_element=%s&amp;rdn=%s&amp;container=%s"><img src="images/plus.png" /></a>', $ldapserver->server_id,$entry['element'],$entry['rdn'],rawurlencode($dn)));
$ldapserver->server_id,$return_form_element,$rdn,rawurlencode($dn));
printf('<a href="%s">%s</a>',$href,htmlspecialchars($dn)); echo '<tr>';
echo '<br />'; echo '<td class="spacer">&nbsp;</td>';
printf('<td class="icon"><a href="%s"><img src="images/plus.png" alt="Plus" /></a></td>',$href['expand']);
printf('<td colspan=2 class="body"><a href="%s">%s</a></td>',$href['return'],htmlspecialchars($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 { } else {
foreach ($ldapservers->GetServerList() as $id) { foreach ($_SESSION['plaConfig']->ldapservers->GetServerList() as $id) {
$ldapserver = $ldapservers->Instance($id); $ldapserver = $_SESSION['plaConfig']->ldapservers->Instance($id);
if ($ldapserver->isVisible()) { if ($ldapserver->isVisible()) {
@ -91,25 +95,30 @@ if (isset($ldapserver) && $container !== false) {
continue; continue;
else { else {
printf('<b>%s</b>',htmlspecialchars($ldapserver->name)); printf('<tr><td class="head" colspan=3>%s:</td><td class="value">%s</td></tr>',_('Server'),htmlspecialchars($ldapserver->name));
echo '<br />';
foreach ($ldapserver->getBaseDN() as $dn) { foreach ($ldapserver->getBaseDN() as $dn) {
if (! $dn) { if (! $dn) {
printf('<small>&nbsp;&nbsp;&nbsp;(%s)</small><br />',_('Could not determine base DN')); printf('<tr><td class="spacer">&nbsp;</td><td class="body" colspan=3>(%s)</td></tr>',_('Could not determine base DN'));
} else { } else {
$href = sprintf("javascript:returnDN('%s%s')",($rdn ? "$rdn," : ''),$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)));
echo '&nbsp;&nbsp;&nbsp;'; echo '<tr>';
printf('<a href="entry_chooser.php?server_id=%s&amp;form_element=%s&amp;rdn=%s&amp;container=%s"><img src="images/plus.png" /></a> ', echo '<td class="spacer">&nbsp;</td>';
$ldapserver->server_id,$return_form_element,$rdn,rawurlencode($dn)); printf('<td colspan=2 class="icon"><a href="%s"><img src="images/plus.png" alt="Plus" /></a></td>',$href['expand']);
printf('<td colspan=2 class="body"><a href="%s">%s</a></td>',$href['return'],htmlspecialchars($dn));
printf('<a href="%s">%s</a>',$href,htmlspecialchars($dn));
echo '<br />';
} }
} }
echo '<tr><td class="spacer" colspan=4>&nbsp;</td></tr>';
} }
} }
} }
} }
echo '</table>';
echo '</div>';
echo '</body></html>';
?> ?>

View File

@ -1,15 +1,10 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/expand.php,v 1.25 2006/10/28 11:42:10 wurley Exp $ // $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 * This script alters the session variable 'tree', expanding it
* at the dn specified in the query string. * at the dn specified in the query string.
* *
* Variables that come in via common.php
* - server_id
* Variables that come in as GET vars:
* - dn (rawurlencoded)
*
* Note: this script is equal and opposite to collapse.php * Note: this script is equal and opposite to collapse.php
* @package phpLDAPadmin * @package phpLDAPadmin
* @see collapse.php * @see collapse.php
@ -18,28 +13,14 @@
*/ */
require './common.php'; require './common.php';
no_expire_header();
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
# This allows us to display large sub-trees without running out of time.
@set_time_limit(0);
$dn = $_GET['dn'];
# We dont need this result, as we'll use the SESSION value when we call tree.php
$ldapserver->getContainerContents($dn,0,$config->GetValue('appearance','tree_filter'),$config->GetValue('deref','tree'));
$dn = get_request('dn','GET',true);
$tree = get_cached_item($ldapserver->server_id,'tree'); $tree = get_cached_item($ldapserver->server_id,'tree');
$tree['browser'][$dn]['open'] = true; $entry = $tree->getEntry($dn);
$entry->open();
set_cached_item($ldapserver->server_id,'tree','null',$tree); set_cached_item($ldapserver->server_id,'tree','null',$tree);
/* If cookies were disabled, build the url parameter for the session id. header(sprintf('Location:index.php?server_id=%s&junk=%s#%s%s',
It will be append to the url to be redirect */ $ldapserver->server_id,random_junk(),htmlid($ldapserver->server_id,$dn),pla_session_param()));
$id_session_param = ''; die();
if (SID != '')
$id_session_param = sprintf('&%s=%s',session_name(),session_id());
header(sprintf('Location:tree.php?foo=%s#%s_%s%s',random_junk(),$ldapserver->server_id,rawurlencode($dn),$id_session_param));
?> ?>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/export.php,v 1.17 2005/12/17 00:00:11 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/export.php,v 1.18 2007/12/15 07:50:30 wurley Exp $
/** /**
* @package phpLDAPadmin * @package phpLDAPadmin
@ -7,46 +7,48 @@
/** /**
*/ */
require './common.php';
# Fix a bug with IE: # Fix a bug with IE:
ini_set('session.cache_limiter',''); ini_set('session.cache_limiter','');
require './common.php';
require LIBDIR.'export_functions.php'; require LIBDIR.'export_functions.php';
if (! $ldapserver->haveAuthInfo()) if (! $_SESSION['plaConfig']->isCommandAvailable('export'))
pla_error(_('Not enough information to login to server. Please check your configuration.')); pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('export')));
$base_dn = isset($_POST['dn']) ? $_POST['dn']:NULL; $entry['base_dn'] = get_request('dn');
$format = isset($_POST['format']) ? $_POST['format'] : 'unix'; $entry['format'] = get_request('format','POST',false,'unix');
$scope = isset($_POST['scope']) ? $_POST['scope'] : 'base'; $entry['scope'] = get_request('scope','POST',false,'base');
$filter = isset($_POST['filter']) ? $_POST['filter'] : 'objectclass=*'; $entry['filter'] = get_request('filter','POST',false,'objectclass=*');
$target = isset($_POST['target']) ? $_POST['target'] : 'display'; $entry['attr'] = get_request('attributes');
$save_as_file = isset($_POST['save_as_file']) && $_POST['save_as_file'] == 'on'; $entry['sys_attr'] = get_request('sys_attr');
$entry['file'] = get_request('save_as_file') ? true : false;
$entry['exporter_id'] = get_request('exporter_id');
if (isset($_POST['filter'])) { if ($entry['filter']) {
preg_replace('/\s+/','',$_POST['filter']); $entry['filter'] = preg_replace('/\s+/','',$entry['filter']);
$attributes = split(',',preg_replace('/\s+/','',$_POST['attributes'])); $attributes = split(',',preg_replace('/\s+/','',$entry['attr']));
} else { } else {
$attributes = array(); $attributes = array();
} }
# add system attributes if needed # Add system attributes if needed
if (isset($_POST['sys_attr'])) { if ($entry['sys_attr']) {
array_push($attributes,'*'); array_push($attributes,'*');
array_push($attributes,'+'); array_push($attributes,'+');
} }
isset($_POST['exporter_id']) or pla_error(_('You must choose an export format.')); (! is_null($entry['exporter_id'])) or pla_error(_('You must choose an export format.'));
$exporter_id = $_POST['exporter_id']; isset($exporters[$entry['exporter_id']]) or pla_error(_('Invalid export format'));
isset($exporters[$exporter_id]) or pla_error(_('Invalid export format'));
# Initialisation of other variables # Initialisation of other variables
$friendly_rdn = get_rdn($base_dn,1); $friendly_rdn = get_rdn($entry['base_dn'],1);
$extension = $exporters[$exporter_id]['extension']; $extension = $exporters[$entry['exporter_id']]['extension'];
# default case not really needed # default case not really needed
switch ($format) { switch ($entry['format']) {
case 'win': case 'win':
$br = "\r\n"; $br = "\r\n";
break; break;
@ -59,12 +61,12 @@ switch ($format) {
} }
# get the decoree,ie the source # get the decoree,ie the source
$plaLdapExporter = new PlaLdapExporter($ldapserver->server_id,$filter,$base_dn,$scope,$attributes); $plaLdapExporter = new PlaLdapExporter($ldapserver->server_id,$entry['filter'],$entry['base_dn'],$entry['scope'],$attributes);
# the decorator do it that way for the moment # the decorator do it that way for the moment
$exporter = null; $exporter = null;
switch ($exporter_id) { switch ($entry['exporter_id']) {
case 0: case 0:
$exporter = new PlaLdifExporter($plaLdapExporter); $exporter = new PlaLdifExporter($plaLdapExporter);
break; break;
@ -96,16 +98,16 @@ if (isset($_REQUEST['compress']) && $_REQUEST['compress'] = 'on')
@set_time_limit(0); @set_time_limit(0);
# send the header # send the header
if ($save_as_file) if ($entry['file']) {
if (ob_get_level()) ob_end_clean();
header('Content-type: application/download'); header('Content-type: application/download');
else header(sprintf('Content-Disposition: filename="%s.%s"',$friendly_rdn,$exporters[$entry['exporter_id']]['extension'].($exporter->isCompressed()?'.gz':'')));
header('Content-type: text/plain'); $exporter->export();
die();
header(sprintf('Content-Disposition: filename="%s.%s"',$friendly_rdn,$exporters[$exporter_id]['extension'].($exporter->isCompressed()?'.gz':''))); } else {
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); print '<span style="font-size: 14px; font-family: courier;"><pre>';
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); $exporter->export();
header('Cache-Control: post-check=0, pre-check=0', false); print '</pre></span>';
}
# and export
$exporter->export();
?> ?>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/export_form.php,v 1.25 2006/10/29 12:49:24 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/export_form.php,v 1.26 2007/12/15 07:50:30 wurley Exp $
/** /**
* export_form.php * export_form.php
@ -10,15 +10,16 @@
*/ */
require './common.php'; require './common.php';
require LIBDIR.'export_functions.php'; require LIBDIR.'export_functions.php';
$format = isset($_GET['format']) ? $_GET['format'] : get_line_end_format(); $entry['format'] = get_request('format','GET',false,get_line_end_format());
$scope = isset($_GET['scope']) ? $_GET['scope'] : 'base' ; $entry['scope'] = get_request('scope','GET',false,'base');
$exporter_id = isset($_GET['exporter_id']) ? $_GET['exporter_id'] : 0 ; $entry['id'] = get_request('exporter_id','GET',false,0);
$dn = isset($_GET['dn']) ? $_GET['dn'] : null; $entry['dn'] = get_request('dn','GET');
$filter = isset($_GET['filter']) ? $_GET['filter'] : '(objectClass=*)'; $entry['filter'] = get_request('filter','GET',false,'(objectClass=*)');
$attributes = isset($_GET['attributes']) ? $_GET['attributes'] : '*'; $entry['attr'] = get_request('attributes','GET',false,'*');
$sys_attr = isset($_GET['sys_attr']) && $_GET['sys_attr'] == 'true' ? true : false; $entry['sys_attr'] = get_request('sys_attr','GET') ? true: false;
$available_formats = array ( $available_formats = array (
'unix' => 'UNIX (Linux, BSD)', 'unix' => 'UNIX (Linux, BSD)',
@ -32,15 +33,12 @@ $available_scopes = array (
'sub' => _('Sub (entire subtree)') 'sub' => _('Sub (entire subtree)')
); );
include './header.php';
echo '<body>';
printf('<h3 class="title">%s</h3>',_('Export')); printf('<h3 class="title">%s</h3>',_('Export'));
echo '<br />'; echo '<br />';
echo '<center>'; echo '<center>';
echo '<form name="export_form" action="export.php" method="post">'; echo '<form name="export_form" action="cmd.php" method="post">';
echo '<table class="export_form">'; echo '<input type="hidden" name="cmd" value="export" />';
echo '<table class="export">';
echo '<tr>'; echo '<tr>';
echo '<td>'; echo '<td>';
@ -48,11 +46,11 @@ echo '<fieldset>';
printf('<legend>%s</legend>',_('Export')); printf('<legend>%s</legend>',_('Export'));
echo '<table>'; echo '<table>';
printf('<tr><td>%s</td><td>%s</td></tr>',_('Server'),server_select_list()); printf('<tr><td>%s</td><td>%s</td></tr>',_('Server'),server_select_list($ldapserver->server_id));
echo '<tr>'; echo '<tr>';
printf('<td style="white-space:nowrap">%s</td>',_('Base DN')); 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" />&nbsp;',htmlspecialchars($dn)); printf('<td><span style="white-space: nowrap;"><input type="text" name="dn" id="dn" style="width:230px" value="%s" />&nbsp;',htmlspecialchars($entry['dn']));
draw_chooser_link('export_form.dn'); draw_chooser_link('export_form.dn');
echo '</span></td>'; echo '</span></td>';
echo '</tr>'; echo '</tr>';
@ -64,20 +62,20 @@ echo '<td>';
foreach ($available_scopes as $id => $desc) foreach ($available_scopes as $id => $desc)
printf('<input type="radio" name="scope" value="%s" id="%s"%s /><label for="%s">%s</label><br />', printf('<input type="radio" name="scope" value="%s" id="%s"%s /><label for="%s">%s</label><br />',
htmlspecialchars($id),htmlspecialchars($id),($id == $scope) ? 'checked="true"' : '', htmlspecialchars($id),htmlspecialchars($id),($id == $entry['scope']) ? 'checked="true"' : '',
htmlspecialchars($id),htmlspecialchars($desc)); htmlspecialchars($id),htmlspecialchars($desc));
echo '</td>'; echo '</td>';
echo '</tr>'; echo '</tr>';
printf('<tr><td>%s</td><td><input type="text" name="filter" style="width:300px" value="%s" /></td></tr>', printf('<tr><td>%s</td><td><input type="text" name="filter" style="width:300px" value="%s" /></td></tr>',
_('Search Filter'),htmlspecialchars($filter)); _('Search Filter'),htmlspecialchars($entry['filter']));
printf('<tr><td>%s</td><td><input type="text" name="attributes" style="width:300px" value="%s" /></td></tr>', printf('<tr><td>%s</td><td><input type="text" name="attributes" style="width:300px" value="%s" /></td></tr>',
_('Show Attributtes'),htmlspecialchars($attributes)); _('Show Attributtes'),htmlspecialchars($entry['attr']));
printf('<tr><td>&nbsp;</td><td><input type="checkbox" name="sys_attr" id="sys_attr" %s/> <label for="sys_attr">%s</label></td></tr>', printf('<tr><td>&nbsp;</td><td><input type="checkbox" name="sys_attr" id="sys_attr" %s/> <label for="sys_attr">%s</label></td></tr>',
$sys_attr ? 'checked="true" ' : '',_('Include system attributes')); $entry['sys_attr'] ? 'checked="true" ' : '',_('Include system attributes'));
printf('<tr><td>&nbsp;</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>&nbsp;</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>',
_('Save as file')); _('Save as file'));
@ -100,7 +98,7 @@ printf('<legend>%s</legend>',_('Export format'));
foreach ($exporters as $index => $exporter) { foreach ($exporters as $index => $exporter) {
printf('<input type="radio" name="exporter_id" id="exporter_id_%s" value="%s"%s />', printf('<input type="radio" name="exporter_id" id="exporter_id_%s" value="%s"%s />',
htmlspecialchars($index),htmlspecialchars($index),($index==$exporter_id) ? ' checked="true"' : ''); htmlspecialchars($index),htmlspecialchars($index),($index==$entry['id']) ? ' checked="true"' : '');
printf('<label for="%s">%s</label><br />', printf('<label for="%s">%s</label><br />',
htmlspecialchars($index),htmlspecialchars($exporter['desc'])); htmlspecialchars($index),htmlspecialchars($exporter['desc']));
} }
@ -113,7 +111,7 @@ echo '<fieldset style="height: 100px">';
printf('<legend>%s</legend>',_('Line ends')); printf('<legend>%s</legend>',_('Line ends'));
foreach ($available_formats as $id => $desc) foreach ($available_formats as $id => $desc)
printf('<input type="radio" name="format" value="%s" id="%s"%s /><label for="%s">%s</label><br />', printf('<input type="radio" name="format" value="%s" id="%s"%s /><label for="%s">%s</label><br />',
htmlspecialchars($id),htmlspecialchars($id),($format==$id) ? ' checked="true"' : '', htmlspecialchars($id),htmlspecialchars($id),($entry['format']==$id) ? ' checked="true"' : '',
htmlspecialchars($id),htmlspecialchars($desc)); htmlspecialchars($id),htmlspecialchars($desc));
echo '</fieldset>'; echo '</fieldset>';
@ -161,5 +159,3 @@ function get_line_end_format() {
} }
--> -->
</script> </script>
</body>
</html>

View File

@ -1,13 +1,15 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/header.php,v 1.26 2006/09/17 04:51:56 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/header.php,v 1.27 2007/12/15 07:50:30 wurley Exp $
/** /**
* @package phpLDAPadmin * @package phpLDAPadmin
*/ */
require_once LIBDIR.'./common.php';
/* We want to get $language into scope in case we were included /* We want to get $language into scope in case we were included
from within a function */ from within a function */
$language = isset($config) ? $language = $config->GetValue('appearance','language') : 'auto'; $language = isset($_SESSION['plaConfig']) ? $language = $_SESSION['plaConfig']->GetValue('appearance','language') : 'auto';
# text/xml won't work with MSIE, but is very useful for debugging xhtml code. # 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/xml; charset="UTF-8"');
@ -24,32 +26,39 @@ echo "\n\n";
echo '<head>'; echo '<head>';
if (isset($config) && $pagetitle = $config->GetValue('appearance','page_title')) if (isset($_SESSION['plaConfig']) && $pagetitle = $_SESSION['plaConfig']->GetValue('appearance','page_title'))
printf('<title>phpLDAPadmin - %s</title>',$pagetitle); printf('<title>phpLDAPadmin - %s</title>',$pagetitle);
else else
echo '<title>phpLDAPadmin</title>'; echo '<title>phpLDAPadmin</title>';
printf('<link type="text/css" rel="stylesheet" href="%sstyle.css" media="screen" />',CSSDIR); if (isset($_SESSION['plaConfig']))
$css = $_SESSION['plaConfig']->GetValue('appearance','stylesheet');
else
$css = 'style.css';
printf('<link type="text/css" rel="stylesheet" href="%s%s" media="screen" />','../htdocs/'.CSSDIR,$css);
if (isset($server_id)) { if (isset($server_id)) {
$custom_file = get_custom_file($server_id,'style.css',CSSDIR); $custom_file = get_custom_file($server_id,'style.css','../htdocs/'.CSSDIR);
if (strcmp($custom_file,'style.css') != 0) if (strcmp($custom_file,'style.css') != 0)
printf('<link type="text/css" rel="stylesheet" href="%s" media="screen" />',$custom_file); 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="%sentry_chooser.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%sie_png_work_around.js"></script>',JSDIR); printf('<script type="text/javascript" src="%sie_png_work_around.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%ssearch_util.js"></script>',JSDIR); printf('<script type="text/javascript" src="%sgeneric_utils.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%sgeneric_utils.js"></script>',JSDIR); printf('<script type="text/javascript" src="%sto_ascii.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%sto_ascii.js"></script>',JSDIR); printf('<script type="text/javascript" src="%smodify_member.js"></script>','../htdocs/'.JSDIR);
printf('<link type="text/css" rel="stylesheet" media="all" href="%s/jscalendar/calendar-blue.css" title="blue" />',JSDIR); printf('<link type="text/css" rel="stylesheet" media="all" href="%s/jscalendar/calendar-blue.css" title="blue" />','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%sjscalendar/calendar.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%sjscalendar/lang/calendar-en.js"></script>',JSDIR); echo "\n<!--\n";
printf('<script type="text/javascript" src="%sjscalendar/calendar-setup.js"></script>',JSDIR); printf('<script type="text/javascript" src="%sjscalendar/calendar.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%sdate_selector.js"></script>',JSDIR); printf('<script type="text/javascript" src="%sjscalendar/lang/calendar-en.js"></script>','../htdocs/'.JSDIR);
printf('<link type="text/css" rel="stylesheet" href="%s/phplayersmenu/layerstreemenu.css"></link>',JSDIR); printf('<script type="text/javascript" src="%sjscalendar/calendar-setup.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%smodify_member.js"></script>',JSDIR); printf('<script type="text/javascript" src="%sdate_selector.js"></script>','../htdocs/'.JSDIR);
echo "\n-->\n";
printf('<link type="text/css" rel="stylesheet" href="%s/phplayersmenu/layerstreemenu.css"></link>','../htdocs/'.JSDIR);
if (isset($meta_refresh_variable)) if (isset($meta_refresh_variable))
printf('<meta http-equiv="refresh" content="%s" />',$meta_refresh_variable); printf('<meta http-equiv="refresh" content="%s" />',$meta_refresh_variable);

View File

@ -1,28 +0,0 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/help.php,v 1.5 2005/02/26 12:35:05 wurley Exp $
/**
* @package phpLDAPadmin
*/
/**
*/
include './common.php';
include './header.php';
$forum_href = get_href( 'forum' );
?>
<body>
<h3 class="title">Help</h3>
<br />
<center>
<p>Do you have a problem or question?</p>
<p>Perhaps you are new to LDAP and need a little guidance?</p>
<p>Help is only one click away. Visit the online <a href="<?php echo $forum_href; ?>">phpLDAPadmin support forum</a>.</p>
<br />
</center>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
htdocs/images/bug-big.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

BIN
htdocs/images/export.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
htdocs/images/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 B

BIN
htdocs/images/help-big.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
htdocs/images/home-big.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
htdocs/images/import.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
htdocs/images/info-big.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 966 B

BIN
htdocs/images/light-big.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
htdocs/images/logout.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 829 B

BIN
htdocs/images/notice.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
htdocs/images/schema.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

BIN
htdocs/images/search.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
htdocs/images/smile-big.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
htdocs/images/trash-big.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/index.php,v 1.47 2006/04/29 06:49:31 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/index.php,v 1.49 2007/12/15 13:17:43 wurley Exp $
/** /**
* @package phpLDAPadmin * @package phpLDAPadmin
@ -14,35 +14,36 @@ PHP is not installed on your web server!!!
</pre> </pre>
*******************************************/ *******************************************/
/** /*
* We will perform some sanity checking here, since this file is normally loaded first when users * We will perform some sanity checking here, since this file is normally loaded first when users
* first setup PLA. * first setup PLA.
*/ */
define('LIBDIR','../lib/'); define('LIBDIR',sprintf('%s/',realpath('../lib/')));
ini_set('display_errors',1); ini_set('display_errors',1);
error_reporting(E_ALL); error_reporting(E_ALL);
# General functions needed to proceed. # General functions needed to proceed.
ob_start(); ob_start();
if (! file_exists(LIBDIR.'functions.php')) { if (! file_exists(LIBDIR.'functions.php')) {
ob_end_clean(); if (ob_get_level()) ob_end_clean();
die("Fatal error: Required file 'functions.php' does not exist."); die(sprintf("Fatal error: Required file '<b>%sfunctions.php</b>' does not exist.",LIBDIR));
} }
if (! is_readable(LIBDIR.'functions.php')) { if (! is_readable(LIBDIR.'functions.php')) {
ob_end_clean(); if (ob_get_level()) ob_end_clean();
die("Cannot read the file 'functions.php' its permissions are too strict."); die(sprintf("Cannot read the file '<b>%sfunctions.php</b>' its permissions may be too strict.",LIBDIR));
} }
if (ob_get_level()) ob_end_clean();
require LIBDIR.'functions.php'; require LIBDIR.'functions.php';
$config_file = CONFDIR.'config.php'; $config_file = CONFDIR.'config.php';
ob_end_clean();
# Make sure this PHP install has gettext, we use it for language translation # Make sure this PHP install has gettext, we use it for language translation
if (! extension_loaded('gettext')) if (! extension_loaded('gettext'))
die('Your install of PHP appears to be missing GETTEXT support. GETTEXT is used for language translation. Please install GETTEXT support before using phpLDAPadmin. (Dont forget to restart your web server afterwards)'); pla_error('<p>Your install of PHP appears to be missing GETTEXT support.</p><p>GETTEXT is used for language translation.</p><p>Please install GETTEXT support before using phpLDAPadmin.<br /><small>(Dont forget to restart your web server afterwards)</small></p>');
/* Helper functions. /*
* Helper functions.
* Our required helper functions are defined in functions.php * Our required helper functions are defined in functions.php
*/ */
foreach ($pla_function_files as $file_name ) { foreach ($pla_function_files as $file_name ) {
@ -50,11 +51,11 @@ foreach ($pla_function_files as $file_name ) {
pla_error(sprintf('Fatal error: Required file "%s" does not exist.',$file_name)); pla_error(sprintf('Fatal error: Required file "%s" does not exist.',$file_name));
if (! is_readable($file_name)) if (! is_readable($file_name))
pla_error(sprintf('Fatal error: Cannot read the file "%s", its permissions are too strict.',$file_name)); pla_error(sprintf('Fatal error: Cannot read the file "%s", its permissions may be too strict.',$file_name));
ob_start(); ob_start();
require $file_name; require $file_name;
ob_end_clean(); if (ob_get_level()) ob_end_clean();
} }
# Configuration File check # Configuration File check
@ -81,136 +82,18 @@ if (! file_exists($config_file)) {
die(); die();
} elseif (! is_readable($config_file)) { } elseif (! is_readable($config_file)) {
pla_error(sprintf('Fatal error: Cannot read your configuration file "%s", its permissions are too strict.',$config_file)); pla_error(sprintf('Fatal error: Cannot read your configuration file "%s", its permissions may be too strict.',$config_file));
} }
if (! check_config()) { # If our config file fails the sanity check, then stop now.
if (! check_config($config_file)) {
$www = new page();
$body = new block();
$www->block_add('body',$body);
$www->display();
exit; exit;
} }
echo '<?xml version="1.0" encoding="utf-8"?>'."\n"; include './cmd.php';
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"'."\n";
echo ' "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">'."\n";
echo "\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml" lang="no-NO">';
if ($pagetitle = $config->GetValue('appearance','page_title'))
printf('<head><title>phpLDAPadmin (%s) - %s</title></head>',pla_version(),$pagetitle);
else
printf('<head><title>phpLDAPadmin - %s</title></head>',pla_version());
printf('<frameset cols="%s,*">',$config->GetValue('appearance','tree_width'));
echo '<frame src="tree.php" name="left_frame" id="left_frame" />';
echo '<frame src="welcome.php" name="right_frame" id="right_frame" />';
echo '</frameset>';
echo '</html>';
/*
* Makes sure that the config file is properly setup and
* that your install of PHP can handle LDAP stuff.
*/
function check_config() {
global $config_file,$config;
/* Check for syntax errors in config.php
As of php 4.3.5, this NO longer catches fatal errors :( */
ob_start();
include $config_file;
$str = ob_get_contents();
ob_end_clean();
if ($str) {
$str = strip_tags($str);
$matches = array();
preg_match('/(.*):\s+(.*):.*\s+on line (\d+)/',$str,$matches);
$error_type = $matches[1];
$error = $matches[2];
$line_num = $matches[3];
$file = file($config_file);
echo '<?xml version="1.0" encoding="utf-8"?>'."\n";
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"'."\n";
echo ' "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">'."\n";
echo "\n";
echo '<html>';
echo '<head>';
echo '<title>phpLDAPadmin Config File Error</title>';
echo '<link type="text/css" rel="stylesheet" href="css/style.css" />';
echo '</head>';
echo '<body>';
echo '<h3 class="title">Config File ERROR</h3>';
printf('<h3 class="subtitle">%s (%s) on line %s</h3>',$error_type,$error,$line_num);
echo '<center>';
printf('Looks like your config file has an ERROR on line %s.<br />',$line_num);
echo 'Here is a snippet around that line <br />';
echo '<br />'."\n";
echo '<div style="text-align: left; font-family: monospace; margin-left: 80px; margin-right: 80px; border: 1px solid black; padding: 10px;">';
for ($i = $line_num-9; $i<$line_num+5; $i++) {
if ($i+1 == $line_num)
echo '<div style="color:red;background:#fdd">';
if ($i < 0)
continue;
printf('<b>%s</b>: %s<br />',$i+1,htmlspecialchars($file[$i]));
if ($i+1 == $line_num)
echo '</div>';
}
echo '</div>';
echo '<br />';
echo 'Hint: Sometimes these errors are caused by lines <b>preceding</b> the line reported.';
echo '</center>';
echo '</body>';
echo '</html>';
return false;
}
# Now read in config_default.php, which also reads in config.php
require LIBDIR.'config_default.php';
# Make sure their PHP version is current enough
if (strcmp(phpversion(),REQUIRED_PHP_VERSION) < 0) {
pla_error(sprintf('phpLDAPadmin requires PHP version %s or greater. You are using %s',
REQUIRED_PHP_VERSION,phpversion()));
}
# Make sure this PHP install has all our required extensions
if (! extension_loaded('ldap')) {
pla_error('Your install of PHP appears to be missing LDAP support. Please install LDAP support before using phpLDAPadmin. (Dont forget to restart your web server afterwards)');
return false;
}
# Make sure that we have php-xml loaded.
if (! function_exists('xml_parser_create')) {
pla_error('Your install of PHP appears to be missing XML support. Please install XML support before using phpLDAPadmin. (Dont forget to restart your web server afterwards)');
return false;
}
# Make sure their session save path is writable, if they are using a file system session module, that is.
if ( ! strcasecmp('Files',session_module_name() && ! is_writable(realpath(session_save_path())))) {
pla_error('Your PHP session configuration is incorrect. Please check the value of session.save_path
in your php.ini to ensure that the directory specified there exists and is writable.
The current setting of "'.session_save_path().'" is un-writable by the web server.');
return false;
}
if (! isset($ldapservers) || count($ldapservers->GetServerList()) == 0) {
pla_error('Your config.php is missing Server Definitions.
Please see the sample file config/config.php.example.',false);
return false;
}
return true;
}
?> ?>

View File

@ -1,15 +1,17 @@
function dateSelector(id) { function dateSelector(id) {
var el = document.getElementById('f_date_'+id); var el = document.getElementById('f_date_'+id);
var format = gettype(el.id); var format = gettype(el.id);
var epoch; var epoch;
var parse = false; var parse = false;
var cal = new Calendar(0, null, onSelect, onClose); var cal = new Calendar(0, null, onSelect, onClose);
if (defaults['f_time_'+id]) { if (defaults['f_time_'+id]) {
cal.showsTime = true; cal.showsTime = true;
} else { } else {
cal.showsTime = false; cal.showsTime = false;
} }
cal.weekNumbers = true; cal.weekNumbers = true;
cal.showsOtherMonths = true; cal.showsOtherMonths = true;
cal.create(); cal.create();

View File

@ -1,18 +1,18 @@
.treemenudiv { table.tree .treemenudiv {
display: block; display: block;
white-space: nowrap; white-space: nowrap;
padding-top: 1px; padding-top: 1px;
padding-bottom: 1px; padding-bottom: 1px;
} }
.phplmnormal { table.tree .phplmnormal {
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;
font-size: 13px; font-size: 13px;
color: #000000; color: #000000;
text-decoration: none; text-decoration: none;
} }
a.phplmnormal:hover { table.tree a.phplmnormal:hover {
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;
font-size: 13px; font-size: 13px;
color: #000000; color: #000000;
@ -20,21 +20,21 @@ a.phplmnormal:hover {
text-decoration: none; text-decoration: none;
} }
a.phplm:link { table.tree a.phplm:link {
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;
font-size: 13px; font-size: 13px;
color: #000000; color: #000000;
text-decoration: none; text-decoration: none;
} }
a.phplm:visited { table.tree a.phplm:visited {
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;
font-size: 13px; font-size: 13px;
color: #000000; color: #000000;
text-decoration: none; text-decoration: none;
} }
a.phplm:hover { table.tree a.phplm:hover {
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;
font-size: 13px; font-size: 13px;
color: #841212; color: #841212;
@ -42,14 +42,14 @@ a.phplm:hover {
text-decoration: none; text-decoration: none;
} }
a.phplm:active { table.tree a.phplm:active {
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;
font-size: 13px; font-size: 13px;
color: #ff0000; color: #ff0000;
text-decoration: none; text-decoration: none;
} }
a.phplmselected:link { table.tree a.phplmselected:link {
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;
font-size: 13px; font-size: 13px;
color: #dd0000; color: #dd0000;
@ -57,7 +57,7 @@ a.phplmselected:link {
text-decoration: none; text-decoration: none;
} }
a.phplmselected:visited { table.tree a.phplmselected:visited {
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;
font-size: 13px; font-size: 13px;
color: #dd0000; color: #dd0000;
@ -65,7 +65,7 @@ a.phplmselected:visited {
text-decoration: none; text-decoration: none;
} }
a.phplmselected:hover { table.tree a.phplmselected:hover {
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;
font-size: 13px; font-size: 13px;
color: #841212; color: #841212;
@ -73,7 +73,7 @@ a.phplmselected:hover {
text-decoration: none; text-decoration: none;
} }
a.phplmselected:active { table.tree a.phplmselected:active {
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;
font-size: 13px; font-size: 13px;
color: #ff0000; color: #ff0000;

View File

@ -315,7 +315,9 @@ function setLibjsdir($libjsdir)
if ($libjsdir != '' && substr($libjsdir, -1) != '/') { if ($libjsdir != '' && substr($libjsdir, -1) != '/') {
$libjsdir .= '/'; $libjsdir .= '/';
} }
if ($libjsdir == '' || substr($libjsdir, 0, 1) != '/') { if ($libjsdir == '' || (substr($libjsdir, 0, 1) != '/' && substr($libjsdir, 1, 1) != ':')) {
// libjsdir != /.../...
// and libjsdir != C:\...\...
$foobar = strpos($libjsdir, $this->dirroot); $foobar = strpos($libjsdir, $this->dirroot);
if ($foobar === false || $foobar != 0) { if ($foobar === false || $foobar != 0) {
$libjsdir = $this->dirroot . $libjsdir; $libjsdir = $this->dirroot . $libjsdir;
@ -339,7 +341,7 @@ function setImgdir($imgdir)
if ($imgdir != '' && substr($imgdir, -1) != '/') { if ($imgdir != '' && substr($imgdir, -1) != '/') {
$imgdir .= '/'; $imgdir .= '/';
} }
if ($imgdir == '' || substr($imgdir, 0, 1) != '/') { if ($imgdir == '' || (substr($imgdir, 0, 1) != '/' && substr($imgdir, 1, 1) != ':')) {
$foobar = strpos($imgdir, $this->dirroot); $foobar = strpos($imgdir, $this->dirroot);
if ($foobar === false || $foobar != 0) { if ($foobar === false || $foobar != 0) {
$imgdir = $this->dirroot . $imgdir; $imgdir = $this->dirroot . $imgdir;
@ -376,7 +378,7 @@ function setIcondir($icondir)
if ($icondir != '' && substr($icondir, -1) != '/') { if ($icondir != '' && substr($icondir, -1) != '/') {
$icondir .= '/'; $icondir .= '/';
} }
if ($icondir == '' || substr($icondir, 0, 1) != '/') { if ($icondir == '' || (substr($icondir, 0, 1) != '/' && substr($icondir, 1, 1) != ':')) {
$foobar = strpos($icondir, $this->dirroot); $foobar = strpos($icondir, $this->dirroot);
if ($foobar === false || $foobar != 0) { if ($foobar === false || $foobar != 0) {
$icondir = $this->dirroot . $icondir; $icondir = $this->dirroot . $icondir;
@ -437,7 +439,7 @@ function setTpldirCommon($tpldir)
if ($tpldir != '' && substr($tpldir, -1) != '/') { if ($tpldir != '' && substr($tpldir, -1) != '/') {
$tpldir .= '/'; $tpldir .= '/';
} }
if ($tpldir == '' || substr($tpldir, 0, 1) != '/') { if ($tpldir == '' || (substr($tpldir, 0, 1) != '/' && substr($tpldir, 1, 1) != ':')) {
$foobar = strpos($tpldir, $this->dirroot); $foobar = strpos($tpldir, $this->dirroot);
if ($foobar === false || $foobar != 0) { if ($foobar === false || $foobar != 0) {
$tpldir = $this->dirroot . $tpldir; $tpldir = $this->dirroot . $tpldir;

View File

@ -203,15 +203,25 @@ function newTreeMenu(
// corner at end of subtree or t-split // corner at end of subtree or t-split
if ($not_a_leaf) { if ($not_a_leaf) {
if ($cnt == $this->_firstItem[$menu_name]) { if ($cnt == $this->_firstItem[$menu_name]) {
$img = $img_collapse_corner_first; if ($this->tree[$cnt]['last_item'] && $this->tree[$cnt]['children']) {
$alt = $alt_collapse_corner_first; // Xavier Bruyet : 2006.09.28
$this->_treeMenu[$menu_name] .= '<a onmousedown="' . $toggle_function_name . "('" . $cnt . "')" . '"><img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>'; // Display for the first time the tree without the root node expanded
$img = $img_expand_corner_first;
$alt = $alt_expand_corner_first;
// @todo: nasty hack, should really do this better.
$parsed_href = preg_replace('/template_engine/','expand',$this->tree[$cnt]['parsed_href']);
$this->_treeMenu[$menu_name] .= '<a href="' . $parsed_href . '"><img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>';
} else {
$img = $img_collapse_corner_first;
$alt = $alt_collapse_corner_first;
$this->_treeMenu[$menu_name] .= '<a onmousedown="' . $toggle_function_name . "('" . $cnt . "')" . '"><img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>';
}
} else { } else {
if ($this->tree[$cnt]['last_item'] && $this->tree[$cnt]['children']) { if ($this->tree[$cnt]['last_item'] && $this->tree[$cnt]['children']) {
$img = $img_expand_corner; $img = $img_expand_corner;
$alt = $alt_expand_corner; $alt = $alt_expand_corner;
// @todo: nasty hack, should really do this better. // @todo: nasty hack, should really do this better.
$parsed_href = preg_replace('/template_engine.php/','expand.php',$this->tree[$cnt]['parsed_href']); $parsed_href = preg_replace('/template_engine/','expand',$this->tree[$cnt]['parsed_href']);
$this->_treeMenu[$menu_name] .= '<a href="' . $parsed_href . '"><img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>'; $this->_treeMenu[$menu_name] .= '<a href="' . $parsed_href . '"><img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>';
} else { } else {
$img = $img_collapse_corner; $img = $img_collapse_corner;
@ -235,7 +245,7 @@ function newTreeMenu(
$img = $img_expand; $img = $img_expand;
$alt = $alt_expand; $alt = $alt_expand;
// @todo: nasty hack, should really do this better. // @todo: nasty hack, should really do this better.
$parsed_href = preg_replace('/template_engine.php/','expand.php',$this->tree[$cnt]['parsed_href']); $parsed_href = preg_replace('/template_engine/','expand',$this->tree[$cnt]['parsed_href']);
$this->_treeMenu[$menu_name] .= '<a href="' . $parsed_href . '"><img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>'; $this->_treeMenu[$menu_name] .= '<a href="' . $parsed_href . '"><img align="top" border="0" class="imgs" id="jt' . $cnt . 'node" src="' . $img . '" alt="' . $alt . '" /></a>';
} else { } else {
@ -331,6 +341,11 @@ function newTreeMenu(
'img_folder_closed' => $img_folder_closed, 'img_folder_closed' => $img_folder_closed,
'img_folder_open' => $img_folder_open 'img_folder_open' => $img_folder_open
)); ));
$inc = '<!-- # PHP layers menu. -->
<script type="text/javascript" language="javascript" src="js/phplayersmenu/libjs/layersmenu-browser_detection.js"></script>
<script type="text/javascript" language="javascript" src="js/phplayersmenu/libjs/layerstreemenu-cookies.js"></script>';
$toggle_function = $t->parse('out', 'tplfile'); $toggle_function = $t->parse('out', 'tplfile');
$toggle_function = $toggle_function =
'<script language="JavaScript" type="text/javascript">' . "\n" . '<script language="JavaScript" type="text/javascript">' . "\n" .
@ -349,7 +364,7 @@ function newTreeMenu(
'// -->' . "\n" . '// -->' . "\n" .
'</script>' . "\n"; '</script>' . "\n";
$this->_treeMenu[$menu_name] = $toggle_function . "\n" . $this->_treeMenu[$menu_name] . "\n" . $toggle; $this->_treeMenu[$menu_name] = $inc . "\n" . $toggle_function . "\n" . $this->_treeMenu[$menu_name] . "\n" . $toggle;
return $this->_treeMenu[$menu_name]; return $this->_treeMenu[$menu_name];
} }

113
htdocs/js/pla_ajax.js Normal file
View File

@ -0,0 +1,113 @@
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/js/pla_ajax.js,v 1.2 2007/12/15 07:50:31 wurley Exp $
/**
* @package phpLDAPadmin
* @author The phpLDAPadmin development team
* @author Xavier Bruyet
*/
// current request
var http_request = null;
var http_request_success_callback = '';
var http_request_error_callback = '';
// include html into a component
function includeHTML(component, html) {
if (typeof(component) != 'object' || typeof(html) != 'string') return;
component.innerHTML = html;
var scripts = component.getElementsByTagName('script');
if (!scripts) return;
// load scripts
for (var i = 0; i < scripts.length; i++) {
var scriptclone = document.createElement('script');
if (scripts[i].attributes.length > 0) {
for (var j in scripts[i].attributes) {
if (typeof(scripts[i].attributes[j]) != 'undefined'
&& typeof(scripts[i].attributes[j].nodeName) != 'undefined'
&& scripts[i].attributes[j].nodeValue != null
&& scripts[i].attributes[j].nodeValue != '') {
scriptclone.setAttribute(scripts[i].attributes[j].nodeName, scripts[i].attributes[j].nodeValue);
}
}
}
scriptclone.text = scripts[i].text;
scripts[i].parentNode.replaceChild(scriptclone, scripts[i]);
eval(scripts[i].innerHTML);
}
}
// callback function
function alertHttpRequest() {
if (http_request && (http_request.readyState == 4)) {
if (http_request.status == 200) {
response = http_request.responseText;
http_request = null;
//alert(response);
if (http_request_success_callback) {
eval(http_request_success_callback + '(response)');
}
} else {
alert('There was a problem with the request.');
cancelHttpRequest();
}
}
}
function cancelHttpRequest() {
if (http_request) {
http_request = null;
if (http_request_error_callback) {
eval(http_request_error_callback + '()');
}
}
}
// resquest
function makeGETRequest(url, parameters, successCallbackFunctionName, errorCallbackFunctionName) {
makeHttpRequest(url, parameters, 'GET', successCallbackFunctionName, errorCallbackFunctionName);
}
function makePOSTRequest(url, parameters, successCallbackFunctionName, errorCallbackFunctionName) {
makeHttpRequest(url, parameters, 'POST', successCallbackFunctionName, errorCallbackFunctionName);
}
function makeHttpRequest(url, parameters, meth, successCallbackFunctionName, errorCallbackFunctionName) {
cancelHttpRequest();
http_request_success_callback = successCallbackFunctionName;
http_request_error_callback = errorCallbackFunctionName;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Cannot create XMLHTTP instance.');
return false;
}
http_request.onreadystatechange = window['alertHttpRequest'];
if (meth == 'GET') url = url + '?' + parameters;
http_request.open(meth, url, true);
http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http_request.setRequestHeader("Content-length", parameters.length);
http_request.setRequestHeader("Connection", "close");
if (meth == 'GET') parameters = null;
http_request.send(parameters);
}

27
htdocs/js/tree_hide.js Normal file
View File

@ -0,0 +1,27 @@
var current;
function tree_unhide(whichLayer,old) {
if (current == null) current = old;
var oldtree = document.getElementById('SID_'+current).style;
oldtree.display = 'none';
if (document.getElementById) {
// this is the way the standards work
var newtree = document.getElementById(whichLayer).value;
var newtree_div = document.getElementById('SID_'+newtree).style;
newtree_div.display = 'block';
/*
} else if (document.all) {
// this is the way old msie versions work
var style2 = document.all[whichLayer].style;
style2.display = style2.display ? '':'block';
} else if (document.layers) {
// this is the way nn4 works
var style2 = document.layers[whichLayer].style;
style2.display = style2.display ? '':'block';
*/
}
current = newtree;
}

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/ldif_import.php,v 1.34 2005/12/10 10:34:54 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/ldif_import.php,v 1.35 2007/12/15 07:50:30 wurley Exp $
/** /**
* Imports an LDIF file to the specified server_id. * Imports an LDIF file to the specified server_id.
@ -15,36 +15,43 @@
require './common.php'; require './common.php';
if (! $ldapserver->haveAuthInfo()) if (! $_SESSION['plaConfig']->isCommandAvailable('import'))
pla_error(_('Not enough information to login to server. Please check your configuration.')); pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('import')));
$continuous_mode = isset($_POST['continuous_mode']) ? 1 : 0; $entry['continuous_mode'] = get_request('continuous_mode') ? true : false;
$entry['ldif'] = get_request('ldif');
if (isset($_REQUEST['ldif']) && trim($_REQUEST['ldif'])) { if ($entry['ldif']) {
$textarealdif = $_REQUEST['ldif']; $entry['remote_file'] = 'STDIN';
$remote_file = 'STDIN'; $entry['size'] = strlen($entry['ldif']);
$file_len = strlen($textarealdif);
} elseif (isset($_FILES['ldif_file'])) { } elseif (isset($_FILES['ldif_file'])) {
$file = $_FILES['ldif_file']['tmp_name']; $file = $_FILES['ldif_file']['tmp_name'];
$remote_file = $_FILES['ldif_file']['name']; $entry['remote_file'] = $_FILES['ldif_file']['name'];
$file_len = $_FILES['ldif_file']['size']; $entry['size'] = $_FILES['ldif_file']['size'];
is_array($_FILES['ldif_file']) or pla_error(_('Missing uploaded file.')); if (! is_array($_FILES['ldif_file'])) {
file_exists($file) or pla_error(_('No LDIF file specified. Please try again.')); pla_error(_('Missing uploaded file.'),null,-1,false);
$file_len > 0 or pla_error(_('Uploaded LDIF file is empty.')); return;
}
if (! file_exists($file)) {
pla_error(_('No LDIF file specified. Please try again.'),null,-1,false);
return;
}
if ($entry['size'] <= 0) {
pla_error(_('Uploaded LDIF file is empty.'),null,-1,false);
return;
}
} else { } else {
pla_error(_('You must either upload a file or provide an LDIF in the text box.')); pla_error(_('You must either upload a file or provide an LDIF in the text box.'),null,-1,false);
return;
} }
include './header.php';
echo '<body>';
printf('<h3 class="title">%s</h3>',_('Import LDIF File')); printf('<h3 class="title">%s</h3>',_('Import LDIF File'));
printf('<h3 class="subtitle">%s: <b>%s</b> %s: <b>%s (%s %s)</b></h3>', printf('<h3 class="subtitle">%s: <b>%s</b> %s: <b>%s (%s %s)</b></h3>',
_('Server'),htmlspecialchars($ldapserver->name), _('Server'),htmlspecialchars($ldapserver->name),
_('File'),htmlspecialchars($remote_file),number_format($file_len),_('bytes')); _('File'),htmlspecialchars($entry['remote_file']),number_format($entry['size']),_('bytes'));
echo '<br /><br />'; echo '<br /><br />';
require LIBDIR.'ldif_functions.php'; require LIBDIR.'ldif_functions.php';
@ -67,10 +74,10 @@ $actionErrorMsg['moddn']= _('Could not rename object:');
$actionErrorMsg['modify']= _('Could not modify object:'); $actionErrorMsg['modify']= _('Could not modify object:');
# instantiate the reader # instantiate the reader
if (isset($textarealdif)) if (isset($entry['ldif']))
$ldifReader = new LdifReaderStdIn($textarealdif,$continuous_mode); $ldifReader = new LdifReaderStdIn($entry['ldif'],$entry['continuous_mode']);
else else
$ldifReader = new LdifReader($file,$continuous_mode); $ldifReader = new LdifReader($file,$entry['continuous_mode']);
# instantiate the writer # instantiate the writer
$ldapWriter = new LdapWriter($ldapserver); $ldapWriter = new LdapWriter($ldapserver);
@ -81,16 +88,16 @@ if (!$ldifReader->hasVersionNumber())
$i=0; $i=0;
# if .. else not mandatory but should be easier to maintain # if .. else not mandatory but should be easier to maintain
if ($continuous_mode) { if ($entry['continuous_mode']) {
while ($ldifReader->readEntry()) { while ($ldifReader->readEntry()) {
$i++; $i++;
# get the entry. # get the entry.
$currentEntry = $ldifReader->fetchEntryObject(); $currentEntry = $ldifReader->fetchEntryObject();
$edit_href = sprintf('template_engine.php?server_id=%s&amp;dn=%s',$ldapserver->server_id, $edit_href = sprintf('cmd.php?cmd=template_engine&amp;server_id=%s&amp;dn=%s',$ldapserver->server_id,
rawurlencode($currentEntry->dn)); rawurlencode($currentEntry->dn));
$changeType = $currentEntry->getChangeType(); $changeType = $currentEntry->getChangeType();
printf('<small>%s <a href="%s">%s</a>',$actionString[$changeType],$edit_href,$entry->dn); printf('<small>%s <a href="%s">%s</a>',$actionString[$changeType],$edit_href,$currentEntry->dn);
if ($ldifReader->hasRaisedException()) { if ($ldifReader->hasRaisedException()) {
printf(' <span style="color:red;">%s</span></small><br />',_('Failed')); printf(' <span style="color:red;">%s</span></small><br />',_('Failed'));
@ -113,9 +120,6 @@ if ($continuous_mode) {
_('Description'),$ldapserver->error()); _('Description'),$ldapserver->error());
} }
} }
if ($i % 5 == 0)
flush();
} # end while } # end while
} else { } else {
@ -123,7 +127,7 @@ if ($continuous_mode) {
while ($entry = $ldifReader->readEntry()) { while ($entry = $ldifReader->readEntry()) {
$i++; $i++;
$edit_href = sprintf('template_engine.php?server_id=%s&amp;dn=%s',$ldapserver->server_id, $edit_href = sprintf('cmd.php?cmd=template_engine&amp;server_id=%s&amp;dn=%s',$ldapserver->server_id,
rawurlencode($entry->dn)); rawurlencode($entry->dn));
$changeType = $entry->getChangeType(); $changeType = $entry->getChangeType();
printf('<small>%s <a href="%s">%s</a>',$actionString[$changeType],$edit_href,$entry->dn); printf('<small>%s <a href="%s">%s</a>',$actionString[$changeType],$edit_href,$entry->dn);
@ -131,14 +135,20 @@ if ($continuous_mode) {
if ($ldapWriter->ldapModify($entry)) { if ($ldapWriter->ldapModify($entry)) {
printf(' <span style="color:green;">%s</span></small><br />',_('Success')); printf(' <span style="color:green;">%s</span></small><br />',_('Success'));
if ($i % 5 == 0)
flush();
} else { } else {
printf(' <span style="color:red;">%s</span></small><br /><br />',_('Failed')); printf(' <span style="color:red;">%s</span></small><br /><br />',_('Failed'));
reload_left_frame(); $ldap_err_no = ('0x'.str_pad(dechex($ldapserver->errno()),2,0,STR_PAD_LEFT));
pla_error($actionErrorMsg[$changeType].' '.htmlspecialchars($entry->dn), $verbose_error = pla_verbose_error($ldap_err_no);
$ldapserver->error(),$ldapserver->errno());
$errormsg = sprintf('%s <b>%s</b>',$actionErrorMsg[$changeType],htmlspecialchars($entry->dn));
$errormsg .= sprintf('<br />%s: <b>%s</b>',_('LDAP said'),$verbose_error['title']);
$errormsg .= sprintf('<br />%s',$verbose_error['desc']);
system_message(array(
'title'=>_('LDIF text import'),
'body'=>$errormsg,
'type'=>'warn'));
break;
} }
} }
@ -161,21 +171,12 @@ if ($continuous_mode) {
# close the file # close the file
$ldifReader->done(); $ldifReader->done();
reload_left_frame();
function reload_left_frame(){
echo '<script type="text/javascript" language="javascript">parent.left_frame.location.reload();</script>';
}
function display_error_message($error_message){
printf('<div style="color:red;"><small>%s</small></div>',$error_message);
}
function display_warning($warning){ function display_warning($warning){
printf('<div style="color:orange"><small>%s</small></div>',$warning); printf('<div style="color:orange"><small>%s</small></div>',$warning);
} }
function display_pla_parse_error($exception,$faultyEntry){ function display_pla_parse_error($exception,$faultyEntry) {
global $actionErrorMsg; global $actionErrorMsg;
$errorMessage = $actionErrorMsg[$faultyEntry->getChangeType()]; $errorMessage = $actionErrorMsg[$faultyEntry->getChangeType()];
@ -197,6 +198,4 @@ function display_pla_parse_error($exception,$faultyEntry){
echo '</tr>'; echo '</tr>';
echo '<center>'; echo '<center>';
} }
echo '</body></html>';
?> ?>

View File

@ -1,13 +1,10 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/ldif_import_form.php,v 1.21 2005/12/10 10:34:54 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/ldif_import_form.php,v 1.22 2007/12/15 07:50:30 wurley Exp $
/** /**
* Displays a form to allow the user to upload and import * Displays a form to allow the user to upload and import
* an LDIF file. * an LDIF file.
* *
* Variables expected as GET vars:
* - server_id
*
* @package phpLDAPadmin * @package phpLDAPadmin
*/ */
/** /**
@ -20,12 +17,6 @@ if (! ini_get('file_uploads'))
if ($ldapserver->isReadOnly()) if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode')); pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
include './header.php';
echo '<body>';
printf('<h3 class="title">%s</h3>',_('Import LDIF File')); printf('<h3 class="title">%s</h3>',_('Import LDIF File'));
printf('<h3 class="subtitle">%s: <b>%s</b></h3>',_('Server'),htmlspecialchars($ldapserver->name)); printf('<h3 class="subtitle">%s: <b>%s</b></h3>',_('Server'),htmlspecialchars($ldapserver->name));
@ -34,21 +25,23 @@ echo '<br /><br />';
echo _('Select an LDIF file'); echo _('Select an LDIF file');
echo '<br /><br />'; echo '<br /><br />';
echo '<form action="ldif_import.php" method="post" class="new_value" enctype="multipart/form-data">'; echo '<form action="cmd.php" method="post" class="new_value" enctype="multipart/form-data">';
echo '<input type="hidden" name="cmd" value="ldif_import" />';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id); printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
echo '<input type="file" name="ldif_file" /> <br />'; echo '<input type="file" name="ldif_file" /> <br />';
printf('<div style="margin-top: 5px;"><input type="checkbox" name="continuous_mode" value="1" /><span style="font-size: 90%%;">%s</span></div>',_("Don't stop on errors")); printf('<div style="margin-top: 5px;"><input type="checkbox" name="continuous_mode" value="1" /><span style="font-size: 90%%;">%s</span></div>',
_("Don't stop on errors"));
printf('<div style="margin-top:10px;"><input type="submit" value="%s" /></div>',_('Proceed >>')); printf('<div style="margin-top:10px;"><input type="submit" value="%s" /></div>',_('Proceed >>'));
printf('<br /><small><b>%s %s</b></small><br />',_('Maximum file size'),ini_get('upload_max_filesize')); printf('<br /><small><b>%s %s</b></small><br />',_('Maximum file size'),ini_get('upload_max_filesize'));
echo '</form>'; echo '</form>';
echo '<br /><br />'; echo '<br /><br />';
echo _('Paste your LDIF here'); echo _('Paste your LDIF here');
echo '<form action="ldif_import.php" method="post" class="new_value" enctype="multipart/form-data">'; echo '<form action="cmd.php" method="post" class="new_value" enctype="multipart/form-data">';
echo '<input type="hidden" name="cmd" value="ldif_import" />';
echo '<textarea name="ldif" rows="10" cols="60"></textarea>'; echo '<textarea name="ldif" rows="10" cols="60"></textarea>';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id); printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<div style="margin-top: 5px;"><input type="checkbox" name="continuous_mode" value="1" /><span style="font-size: 90%%;">%s</span></div>',_("Don't stop on errors")); printf('<div style="margin-top: 5px;"><input type="checkbox" name="continuous_mode" value="1" /><span style="font-size: 90%%;">%s</span></div>',_("Don't stop on errors"));
printf('<div style="margin-top:10px;"><input type="submit" value="%s" /></div>',_('Proceed >>')); printf('<div style="margin-top:10px;"><input type="submit" value="%s" /></div>',_('Proceed >>'));
echo '</form>'; echo '</form>';
echo '</body></html>';
?> ?>

View File

@ -1,17 +1,11 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login.php,v 1.55 2006/09/12 13:09:08 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login.php,v 1.56 2007/12/15 07:50:30 wurley Exp $
/** /**
* For servers whose auth_type is set to 'cookie' or 'session'. Pass me the * For servers whose auth_type is set to 'cookie' or 'session'. Pass me the
* login info and I'll write two cookies, pla_login_dn_X and pla_pass_X where X * login info and I'll write two cookies, pla_login_dn_X and pla_pass_X where X
* is the server_id. The cookie_time comes from config.php * is the server_id. The cookie_time comes from config.php
* *
* Variables that come in via common.php
* - server_id
* Variables that come in as POST vars:
* - login_dn
* - login_pass
*
* @package phpLDAPadmin * @package phpLDAPadmin
*/ */
/** /**
@ -19,21 +13,21 @@
require './common.php'; require './common.php';
# Prevents users from coming here without going through the proper channels $dn = get_request('login_dn');
if (! isset($ldapserver)) $pass = get_request('login_pass');
header('Location: index.php'); $uid = get_request('uid');
$dn = isset($_POST['login_dn']) ? $_POST['login_dn'] : null;
$pass = isset($_POST['login_pass']) ? $_POST['login_pass'] : null;
$uid = isset($_POST['uid']) ? $_POST['uid'] : null;
if ($ldapserver->isAnonBindAllowed()) if ($ldapserver->isAnonBindAllowed())
$anon_bind = isset($_POST['anonymous_bind']) && $_POST['anonymous_bind'] == 'on' ? true : false; $anon_bind = get_request('anonymous_bind') == 'on' ? true : false;
else else
$anon_bind = false; $anon_bind = false;
if (! $anon_bind) if (! $anon_bind && ! strlen($pass))
strlen($pass) or pla_error(_('You left the password blank.')); system_message(array(
'title'=>_('Authenticate to server'),
'body'=>_('You left the password blank.'),
'type'=>'warn'),
'cmd.php?cmd=login_form');
$save_auth_type = $ldapserver->auth_type; $save_auth_type = $ldapserver->auth_type;
@ -63,14 +57,11 @@ if ($anon_bind) {
the DN to use when searching for the login_attr user. */ the DN to use when searching for the login_attr user. */
$ldapserver->auth_type = 'config'; $ldapserver->auth_type = 'config';
set_error_handler('temp_login_error_handler');
if ($ldapserver->login_dn) if ($ldapserver->login_dn)
$ldapserver->connect(true,'user'); $ldapserver->connect();
else else
$ldapserver->connect(true,'anonymous'); $ldapserver->connect(true,'anonymous');
restore_error_handler();
if (! empty($ldapserver->login_class)) if (! empty($ldapserver->login_class))
$filter = sprintf('(&(objectClass=%s)(%s=%s))',$ldapserver->login_class,$ldapserver->login_attr,$uid); $filter = sprintf('(&(objectClass=%s)(%s=%s))',$ldapserver->login_class,$ldapserver->login_attr,$uid);
else else
@ -92,12 +83,18 @@ if ($anon_bind) {
} }
} }
# If we got here then we werent able to find a DN for the login filter. # If we got here then we werent able to find a DN for the login filter.
if (! $dn) if (! $dn)
pla_error(_('Bad username or password. Please try again.')); if ($ldapserver->login_fallback_dn)
$dn = $uid;
else
system_message(array(
'title'=>_('Authenticate to server'),
'body'=>_('Bad username or password. Please try again.'),
'type'=>'error'),
'cmd.php?cmd=login_form');
# restore the original auth_type # Restore the original auth_type
$ldapserver->auth_type = $save_auth_type; $ldapserver->auth_type = $save_auth_type;
} }
} }
@ -113,25 +110,38 @@ $ldapserver->login_pass = $pass;
# Verify that dn is allowed to login # Verify that dn is allowed to login
if (! $ldapserver->userIsAllowedLogin($dn)) if (! $ldapserver->userIsAllowedLogin($dn))
pla_error(_('Sorry, you are not allowed to use phpLDAPadmin with this LDAP server.')); system_message(array(
'title'=>_('Authenticate to server'),
'body'=>_('Sorry, you are not allowed to use phpLDAPadmin with this LDAP server.'),
'type'=>'error'),
'cmd.php?cmd=login_form');
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('User is not prohibited from logging in - now bind with DN [%s]',64,$dn); debug_log('User is not prohibited from logging in - now bind with DN [%s]',64,$dn);
# verify that the login is good # Verify that the login is good
if (is_null($dn) && is_null($pass)) if (is_null($dn) && is_null($pass))
$ds = $ldapserver->connect(true,'anonymous',true); $ds = $ldapserver->connect(false,'anonymous',true);
else else
$ds = $ldapserver->connect(true,'user',true); $ds = $ldapserver->connect(false,'user',true);
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Connection returned [%s]',64,$ds); debug_log('Connection returned [%s]',64,$ds);
if (! is_resource($ds)) { if (! is_resource($ds)) {
if ($anon_bind) if ($anon_bind)
pla_error(_('Could not bind anonymously to server.'),null,null,true); system_message(array(
'title'=>_('Authenticate to server'),
'body'=>_('Could not bind anonymously to server.'),
'type'=>'error'),
'cmd.php?cmd=login_form');
else else
pla_error(_('Bad username or password. Please try again.'),null,null,true); system_message(array(
'title'=>_('Authenticate to server'),
'body'=>_('Bad username or password. Please try again.'),
'type'=>'error'),
'cmd.php?cmd=login_form');
syslog_notice("Authentification FAILED for $dn"); syslog_notice("Authentification FAILED for $dn");
} }
@ -144,34 +154,12 @@ if (! $anon_bind) {
syslog_notice("Authentification successful for $dn"); syslog_notice("Authentification successful for $dn");
} }
pla_session_close(); # Since we were successful, clear the cache so that it will be refreshed with the new creditentials.
del_cached_item($ldapserver->server_id,'tree','null');
include './header.php'; system_message(array(
echo '<body>'; 'title'=>_('Authenticate to server'),
'body'=>_('Successfully logged into server.').($anon_bind ? sprintf(' (%s)',_('Anonymous Bind')) : ''),
echo '<script type="text/javascript" language="javascript">'; 'type'=>'info'),
if ($anon_bind && $config->GetValue('appearance','anonymous_bind_redirect_no_tree')) 'index.php');
printf("parent.location.href='search.php?server_id=%s'",$ldapserver->server_id);
else
echo 'parent.left_frame.location.reload();';
echo '</script>';
echo '<center><br /><br /><br />';
printf(_('Successfully logged into server <b>%s</b>').'<br />',htmlspecialchars($ldapserver->name));
if ($anon_bind)
printf('(%s)',_('Anonymous Bind'));
echo '<br /></center>';
echo '</body></html>';
/**
* Only gets called when we fail to login.
*/
function temp_login_error_handler($errno,$errstr,$file,$lineno) {
if (ini_get('error_reporting') == 0 || error_reporting() == 0)
return;
pla_error(_('Could not connect to LDAP server.').'<br /><br />'.htmlspecialchars($errstr));
}
?> ?>

View File

@ -1,12 +1,9 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login_form.php,v 1.28 2006/10/29 11:44:36 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login_form.php,v 1.29 2007/12/15 07:50:30 wurley Exp $
/** /**
* Displays the login form for a server for users who specify 'cookie' or 'session' for their auth_type. * Displays the login form for a server for users who specify 'cookie' or 'session' for their auth_type.
* *
* Variables that come in via common.php
* - server_id
*
* @package phpLDAPadmin * @package phpLDAPadmin
* @author The phpLDAPadmin development team * @author The phpLDAPadmin development team
* @see login.php * @see login.php
@ -19,9 +16,6 @@ require './common.php';
if (! in_array($ldapserver->auth_type, array('cookie','session'))) if (! in_array($ldapserver->auth_type, array('cookie','session')))
pla_error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($ldapserver->auth_type))); pla_error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($ldapserver->auth_type)));
include './header.php';
echo '<body>';
printf('<h3 class="title">%s %s</h3>',_('Authenticate to server'),$ldapserver->name); printf('<h3 class="title">%s %s</h3>',_('Authenticate to server'),$ldapserver->name);
# Check for a secure connection # Check for a secure connection
@ -38,7 +32,8 @@ if (! isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') {
} }
# Login form. # Login form.
echo '<form action="login.php" method="post" name="login_form">'; echo '<form action="cmd.php" method="post" name="login_form">';
echo '<input type="hidden" name="cmd" value="login" />';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id); printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
if (isset($_GET['redirect'])) if (isset($_GET['redirect']))
@ -47,14 +42,14 @@ if (isset($_GET['redirect']))
echo '<center>'; echo '<center>';
echo '<table class="login">'; echo '<table class="login">';
printf('<tr><td><b>%s</b></td></tr>',$ldapserver->isLoginAttrEnabled() ? _('Login Name') : _('Login DN')); printf('<tr><td><b>%s:</b></td></tr>',$ldapserver->isLoginAttrEnabled() ? _('Login Name') : _('Login DN'));
printf('<tr><td><input type="text" id="pla_login" name="%s" size="40" value="%s" /></td></tr>', printf('<tr><td><input type="text" id="pla_login" name="%s" size="40" value="%s" /></td></tr>',
$ldapserver->isLoginAttrEnabled() ? 'uid' : 'login_dn', $ldapserver->isLoginAttrEnabled() ? 'uid' : 'login_dn',
$ldapserver->isLoginAttrEnabled() ? '' : $ldapserver->login_dn); $ldapserver->isLoginAttrEnabled() ? '' : $ldapserver->login_dn);
echo '<tr><td colspan=2>&nbsp;</td></tr>'; echo '<tr><td colspan=2>&nbsp;</td></tr>';
printf('<tr><td><b>%s</b></td></tr>',_('Password')); printf('<tr><td><b>%s:</b></td></tr>',_('Password'));
echo '<tr><td><input type="password" id="pla_pass" size="40" value="" name="login_pass" /></td></tr>'; echo '<tr><td><input type="password" id="pla_pass" size="40" value="" name="login_pass" /></td></tr>';
echo '<tr><td colspan=2>&nbsp;</td></tr>'; echo '<tr><td colspan=2>&nbsp;</td></tr>';
@ -70,6 +65,8 @@ echo '</table>';
echo '</center>'; echo '</center>';
echo '</form>'; echo '</form>';
echo '<script type="text/javascript" language="javascript">document.getElementById(\'pla_login\').focus()</script>';
if( $ldapserver->isAnonBindAllowed() ) { ?> if( $ldapserver->isAnonBindAllowed() ) { ?>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
<!-- <!--
@ -79,13 +76,10 @@ if( $ldapserver->isAnonBindAllowed() ) { ?>
anon_checkbox.form.login_pass.disabled = true; anon_checkbox.form.login_pass.disabled = true;
} else { } else {
anon_checkbox.form.<?php echo $ldapserver->isLoginAttrEnabled() ? 'uid' : 'login_dn'; ?>.disabled = false; anon_checkbox.form.<?php echo $ldapserver->isLoginAttrEnabled() ? 'uid' : 'login_dn'; ?>.disabled = false;
anon_checkbox.form.<?php echo $ldapserver->isLoginAttrEnabled() ? 'uid' : 'login_dn'; ?>.focus();
anon_checkbox.form.login_pass.disabled = false; anon_checkbox.form.login_pass.disabled = false;
} }
} }
--> -->
</script> </script>
<?php } <?php }
echo '</body>';
echo '</html>';
?>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/logout.php,v 1.19 2005/12/17 00:00:11 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/logout.php,v 1.20 2007/12/15 07:50:30 wurley Exp $
/** /**
* For servers whose auth_type is set to 'cookie' or 'session'. Pass me * For servers whose auth_type is set to 'cookie' or 'session'. Pass me
@ -18,32 +18,20 @@ require './common.php';
if (! $ldapserver->haveAuthInfo()) if (! $ldapserver->haveAuthInfo())
pla_error(_('No one is logged in to that server.')); pla_error(_('No one is logged in to that server.'));
if (in_array($ldapserver->auth_type, array('cookie','session'))) { if (in_array($ldapserver->auth_type, array('cookie','session','http'))) {
syslog_notice (sprintf('Logout for %s',$ldapserver->getLoggedInDN())); syslog_notice (sprintf('Logout for %s',$ldapserver->getLoggedInDN()));
$ldapserver->unsetLoginDN() or pla_error(_('Could not logout.')); if($ldapserver->auth_type!='http')
$ldapserver->unsetLoginDN() or pla_error(_('Could not logout.'));
unset_lastactivity($ldapserver); unset_lastactivity($ldapserver);
if (isset($_SESSION['cache'][$ldapserver->server_id]['tree'])) { @session_destroy();
unset($_SESSION['cache'][$ldapserver->server_id]['tree']);
}
pla_session_close();
} else } else
pla_error(sprintf(_('Unknown auth_type: %s'), htmlspecialchars($ldapserver->auth_type))); pla_error(sprintf(_('Unknown auth_type: %s'), htmlspecialchars($ldapserver->auth_type)));
include './header.php'; system_message(array(
'title'=>_('Logout'),
'body'=>('Logged out successfully from server.'),
'type'=>'info'),
'index.php');
?> ?>
<body>
<script type="text/javascript" language="javascript">
parent.left_frame.location.reload();
</script>
<center>
<br />
<br />
<?php echo sprintf(_('Logged out successfully from server <b>%s</b>'),htmlspecialchars($ldapserver->name)); ?><br />
</center>
</body>
</html>

View File

@ -1,17 +1,16 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/mass_delete.php,v 1.16 2005/12/17 00:00:11 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/mass_delete.php,v 1.17 2007/12/15 07:50:30 wurley Exp $
/** /**
* Enables user to mass delete multiple entries using checkboxes. * Enables user to mass delete multiple entries using checkboxes.
* *
* Variables that come in via common.php
* - server_id
* Variables that come in as GET vars: * Variables that come in as GET vars:
* - mass_delete - an array of DNs to delete in this form: * - mass_delete - an array of DNs to delete in this form:
* Array ( * Array (
* [o=myorg,dc=example,dc=com] => on * [o=myorg,dc=example,dc=com] => on
* [cn=bob,dc=example,dc=com] => on * [cn=bob,dc=example,dc=com] => on
* etc. * )
* etc.
* *
* @package phpLDAPadmin * @package phpLDAPadmin
*/ */
@ -22,8 +21,9 @@ require './common.php';
if( $ldapserver->isReadOnly() ) if( $ldapserver->isReadOnly() )
pla_error(_('Unable to delete, server is in READY-ONLY mode.')); pla_error(_('Unable to delete, server is in READY-ONLY mode.'));
if( ! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.')); if (! $_SESSION['plaConfig']->isCommandAvailable('entry_delete', 'mass_delete'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete mass entries')));
$confirmed = isset($_POST['confirmed']) ? true : false; $confirmed = isset($_POST['confirmed']) ? true : false;
isset($_POST['mass_delete']) or isset($_POST['mass_delete']) or
@ -37,9 +37,6 @@ is_array($mass_delete) or
$ldapserver->isMassDeleteEnabled() or $ldapserver->isMassDeleteEnabled() or
pla_error(_('Mass deletion is not enabled. Please enable it in config.php before proceeding.')); pla_error(_('Mass deletion is not enabled. Please enable it in config.php before proceeding.'));
require './header.php';
echo '<body>';
printf('<h3 class="title">%s</h3>',_('Mass Deleting')); printf('<h3 class="title">%s</h3>',_('Mass Deleting'));
if ($confirmed == true) { if ($confirmed == true) {
@ -56,19 +53,18 @@ if ($confirmed == true) {
if (count($mass_delete) == 0) { if (count($mass_delete) == 0) {
echo '<br />'; echo '<br />';
printf('<center>%s</center>',_('You did not select any entries to delete.')); printf('<center>%s</center>',_('You did not select any entries to delete.'));
die(); return;
} }
// @todo: Should sort these entries, so that they are deleted in order, if a user selects children. // @todo: Should sort these entries, so that they are deleted in order, if a user selects children.
foreach ($mass_delete as $dn => $junk) { foreach ($mass_delete as $dn => $junk) {
printf(_('Deleting %s'),htmlspecialchars($dn)); printf(_('Deleting %s'),htmlspecialchars($dn));
flush();
if(run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn))) { if(run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn))) {
$success = $ldapserver->delete($dn); $success = $ldapserver->delete($dn);
if ($success) { if ($success) {
run_hook('post_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn)); run_hook('post_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn));
printf(' <span style="color:green">%s</span>.<br />',_('Success')); printf(' <span style="color:green">%s</span>.<br />',_('Success'));
$successfully_delete_dns[] = $dn; $successfully_delete_dns[] = $dn;
@ -78,8 +74,6 @@ if ($confirmed == true) {
$failed_dns[] = $dn; $failed_dns[] = $dn;
} }
} }
flush();
} }
echo '<blockquote>'; echo '<blockquote>';
@ -93,8 +87,6 @@ if ($confirmed == true) {
else else
printf('<span style="color: green; font-weight: bold;">%s</span>',_('All entries deleted successfully.')); printf('<span style="color: green; font-weight: bold;">%s</span>',_('All entries deleted successfully.'));
echo '<script language="javascript">parent.left_frame.location.reload();</script>';
} else { } else {
$n = count($mass_delete); $n = count($mass_delete);
printf('<h3 class="subtitle">'._('Confirm mass delete of %s entries on server %s').'</h3>',$n,$ldapserver->name); printf('<h3 class="subtitle">'._('Confirm mass delete of %s entries on server %s').'</h3>',$n,$ldapserver->name);
@ -103,7 +95,7 @@ if ($confirmed == true) {
printf(_('Do you really want to delete %s %s %s'), printf(_('Do you really want to delete %s %s %s'),
($n == 1? _('this') : _('these')),$n,($n == 1 ? _('entry') : _('entries'))); ($n == 1? _('this') : _('these')),$n,($n == 1 ? _('entry') : _('entries')));
echo '<form action="mass_delete.php" method="post">'; echo '<form action="cmd.php?cmd=mass_delete" method="post">';
echo '<input type="hidden" name="confirmed" value="true" />'; echo '<input type="hidden" name="confirmed" value="true" />';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id); printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/modify_member_form.php,v 1.4 2006/10/29 01:47:08 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/modify_member_form.php,v 1.5 2007/12/15 07:50:30 wurley Exp $
/** /**
* Displays a form to allow the user to modify group members. * Displays a form to allow the user to modify group members.
@ -39,25 +39,21 @@ if ($current_members)
else else
$num_current_members = 0; $num_current_members = 0;
/*
* If there is only one member, convert scalar to array,
* arrays are required later when processing members
*/
if ($num_current_members == 1)
$current_members = array($current_members);
sort($current_members); sort($current_members);
# Loop through all base dn's and search possible member entries # Loop through all base dn's and search possible member entries
foreach ($ldapserver->getBaseDN() as $base_dn) { foreach ($ldapserver->getBaseDN() as $base_dn) {
# Get all entries that can be added to the group # Get all entries that can be added to the group
if (preg_match("/^$attr$/i",$config->GetValue('modify_member','posixgroupattr')))
if (preg_match("/^$attr$/i",$_SESSION['plaConfig']->GetValue('modify_member','posixgroupattr')))
$possible_values = array_merge($ldapserver->search(null,$base_dn, $possible_values = array_merge($ldapserver->search(null,$base_dn,
$config->GetValue('modify_member','posixfilter'),array($config->GetValue('modify_member','posixattr')))); $_SESSION['plaConfig']->GetValue('modify_member','posixfilter'),
array($_SESSION['plaConfig']->GetValue('modify_member','posixattr'))));
else else
$possible_values = array_merge($ldapserver->search(null,$base_dn, $possible_values = array_merge($ldapserver->search(null,$base_dn,
$config->GetValue('modify_member','filter'),array($config->GetValue('modify_member','attr')))); $_SESSION['plaConfig']->GetValue('modify_member','filter'),
array($_SESSION['plaConfig']->GetValue('modify_member','attr'))));
} }
if ($possible_values) if ($possible_values)
@ -79,10 +75,10 @@ printf('%s <b>%s</b> %s <b>%s</b>:',
_('There are'),$num_current_members,_('members in group'),htmlspecialchars($rdn)); _('There are'),$num_current_members,_('members in group'),htmlspecialchars($rdn));
for ($i=0; $i<count($possible_values); $i++) { for ($i=0; $i<count($possible_values); $i++) {
if (preg_match("/^$attr$/i",$config->GetValue('modify_member','posixgroupattr'))) if (preg_match("/^$attr$/i",$_SESSION['plaConfig']->GetValue('modify_member','posixgroupattr')))
$possible_members[$i] = $possible_values[$i][$config->GetValue('modify_member','posixattr')]; $possible_members[$i] = $possible_values[$i][$_SESSION['plaConfig']->GetValue('modify_member','posixattr')];
else else
$possible_members[$i] = $possible_values[$i][$config->GetValue('modify_member','attr')]; $possible_members[$i] = $possible_values[$i][$_SESSION['plaConfig']->GetValue('modify_member','attr')];
} }
sort($possible_members); sort($possible_members);
@ -108,7 +104,8 @@ foreach ($possible_members as $pkey => $possible) {
# Modifications will be sent to update_confirm which takes care of rest of the processing # Modifications will be sent to update_confirm which takes care of rest of the processing
echo '<br />'; echo '<br />';
echo '<br />'; echo '<br />';
echo '<form action="update_confirm.php" method="post" class="add_value" name="member">'; echo '<form action="cmd.php" method="post" class="add_value" name="member">';
echo '<input type="hidden" name="cmd" value="update_confirm" />';
echo '<table class="modify_members">'; echo '<table class="modify_members">';
@ -166,7 +163,6 @@ printf('<input type="hidden" name="attr" value="%s" />',$encoded_attr);
for ($i=0; $i<$num_current_members; $i++) for ($i=0; $i<$num_current_members; $i++)
printf('<input type="hidden" name="old_values[%s][%s]" value="%s" />', printf('<input type="hidden" name="old_values[%s][%s]" value="%s" />',
htmlspecialchars($attr),$i,htmlspecialchars($current_members[$i])); htmlspecialchars($attr),$i,htmlspecialchars($current_members[$i]));
/* /*
* Javascript generates array of input text boxes from new members. * Javascript generates array of input text boxes from new members.
* update_confirm.php will see this as new_values[member-attribute][item] * update_confirm.php will see this as new_values[member-attribute][item]

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/password_checker.php,v 1.9 2005/12/10 10:34:54 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/password_checker.php,v 1.10 2007/12/15 07:50:30 wurley Exp $
/** /**
* @package phpLDAPadmin * @package phpLDAPadmin
@ -10,44 +10,64 @@
require './common.php'; require './common.php';
include './header.php'; include './header.php';
$hash = isset( $_REQUEST['hash'] ) ? $_REQUEST['hash'] : null; $entry['hash'] = get_request('hash','REQUEST');
$check_password = isset( $_REQUEST['check_password'] ) ? $_REQUEST['check_password'] : null; $entry['password'] = get_request('check_password','REQUEST');
//print_r( $_REQUEST ); $entry['action'] = get_request('action','REQUEST');
//var_dump( $check_password );
if( isset( $_REQUEST['base64'] ) ) { if (get_request('base64','REQUEST')) {
$hash = base64_decode( $hash ); $entry['hash'] = base64_decode($entry['hash']);
$check_password = base64_decode( $check_password ); $entry['password'] = base64_decode($entry['password']);
} }
$enc_type = get_enc_type( $hash ); $entry['enc_type'] = get_enc_type($entry['hash']);
echo '<div class="password_checker">';
printf('<h3 class="subtitle">%s</h3>',_('Password Checker Tool'));
echo '<form action="password_checker.php" method="post">';
echo '<input type="hidden" name="action" value="compare" />';
echo '<table class="password_checker" border=0>';
echo '<tr>';
printf('<td class="head">%s</td>',_('Compare'));
printf('<td class="body"><input type="%s" name="hash" id="hash" value="%s" /></td>',
$entry['enc_type'] ? 'text' : 'password',htmlspecialchars($entry['hash']));
echo '</tr>';
echo '<tr>';
printf('<td class="head">%s</td>',_('To'));
printf('<td class="body"><input type="password" name="check_password" value="%s" /></td>',
htmlspecialchars($entry['password']));
echo '</tr>';
echo '<tr>';
echo '<td>&nbsp;</td>';
echo '<td><input type="submit" value="Compare" />';
if ($entry['action'] == 'compare') {
echo '&nbsp;&nbsp;&nbsp;&nbsp;<b>';
if (password_check($entry['hash'],$entry['password']))
printf('<span class="good">%s</span>',_('Passwords match!'));
else
printf('<span class="bad">%s</span>',_('Passwords do not match!'));
echo '</b>';
}
echo '</td>';
echo '</tr>';
echo '</table>';
echo '</form>';
echo '</div>';
if (isset($_REQUEST['componentid'])) {
echo '<script language="javascript">';
printf('var c = window.opener.document.getElementById(\'%s\');', $_REQUEST['componentid']);
printf('var h = document.getElementById(\'%s\');', 'hash');
echo 'if (c && h) { h.value = c.value; }';
echo '</script>';
}
?> ?>
<h3 class="subtitle"><?php echo _('Password Checker Tool'); ?></h3>
<form style="margin: 0" action="password_checker.php" method="post">
<input type="hidden" name="action" value="compare" />
<table style="border-spacing: 10px">
<tr>
<td><?php echo _('Compare'); ?></td>
<td><input type="<?php echo ( $enc_type ? 'text' : 'password' ); ?>" name="hash" style="width: 300px" value="<?php echo htmlspecialchars($hash); ?>" /></td>
</tr>
<tr>
<td><?php echo _('To'); ?></td>
<td><input type="password" style="width: 300px" name="check_password" value="<?php echo htmlspecialchars($check_password); ?>" /></td>
</tr>
<tr>
<td></td><td><input type="submit" value="Compare" />
<?php if( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'compare' ) {
echo "&nbsp;&nbsp;&nbsp;&nbsp;<b>";
if( password_check( $hash, $check_password) )
echo "<span style=\"color: green\">" . _('Passwords match!') . "</span>";
else
echo "<span style=\"color: red\">" . _('Passwords do not match!') . "</span>";
echo "</b>";
} ?>
</td>
</tr>
</table>
</form>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/purge_cache.php,v 1.8 2005/12/17 00:00:11 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/purge_cache.php,v 1.9 2007/12/15 07:50:30 wurley Exp $
/** /**
* @package phpLDAPadmin * @package phpLDAPadmin
@ -8,13 +8,12 @@
*/ */
require './common.php'; require './common.php';
include './header.php';
if (! $_SESSION['plaConfig']->isCommandAvailable('purge'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('purge')));
$purge_session_keys = array('cache'); $purge_session_keys = array('cache');
echo '<body>';
echo '<h3 class="title">Purging Caches</h3><br /><br /><br />';
$size = 0; $size = 0;
foreach ($purge_session_keys as $key) { foreach ($purge_session_keys as $key) {
if (isset($_SESSION[$key])) { if (isset($_SESSION[$key])) {
@ -22,17 +21,15 @@ foreach ($purge_session_keys as $key) {
unset($_SESSION[$key]); unset($_SESSION[$key]);
} }
} }
pla_session_close();
echo '<center>';
if (! $size) if (! $size)
echo _('No cache to purge.'); $body = _('No cache to purge.');
else else
printf(_('Purged %s bytes of cache.'),number_format($size)); $body = sprintf(_('Purged %s bytes of cache.'),number_format($size));
echo '</center>'; system_message(array(
'title'=>_('Purge cache'),
echo '<!-- refresh the tree view (with the new DN renamed)and redirect to the edit_dn page -->'; 'body'=>$body,
echo '<script type="text/javascript" language="javascript">parent.left_frame.location.reload();</script>'; 'type'=>'info'),
echo '</body></html>'; 'index.php');
?> ?>

View File

@ -1,11 +1,9 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rdelete.php,v 1.27 2007/03/18 03:14:52 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rdelete.php,v 1.28 2007/12/15 07:50:30 wurley Exp $
/** /**
* Recursively deletes the specified DN and all of its children * Recursively deletes the specified DN and all of its children
* *
* Variables that come in via common.php
* - server_id
* Variables that come in as POST vars: * Variables that come in as POST vars:
* - dn (rawurlencoded) * - dn (rawurlencoded)
* *
@ -18,74 +16,69 @@ require './common.php';
if ($ldapserver->isReadOnly()) if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode')); pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
$dn = $_POST['dn']; if (! $_SESSION['plaConfig']->isCommandAvailable('entry_delete', 'simple_delete'))
if (! $dn) pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete entry')));
$entry['dn'] = $_POST['dn'];
if (! $entry['dn'])
pla_error(_('You must specify a DN')); pla_error(_('You must specify a DN'));
if (! $ldapserver->dnExists($dn)) if (! $ldapserver->dnExists($entry['dn']))
pla_error(sprintf(_('No such entry: %s'),htmlspecialchars($dn))); pla_error(sprintf(_('No such entry: %s'),htmlspecialchars($entry['dn'])));
include './header.php'; printf('<h3 class="title">'._('Deleting %s').'</h3>',htmlspecialchars(get_rdn($entry['dn'])));
echo '<body>';
printf('<h3 class="title">'._('Deleting %s').'</h3>',htmlspecialchars(get_rdn($dn)));
printf('<h3 class="subtitle">%s</h3>',_('Recursive delete progress')); printf('<h3 class="subtitle">%s</h3>',_('Recursive delete progress'));
echo '<br /><br />'; echo '<br /><br />';
echo '<small>'; echo '<small>';
flush(); # Prevent script from bailing early on a long delete
# prevent script from bailing early on a long delete
@set_time_limit(0); @set_time_limit(0);
$del_result = pla_rdelete($ldapserver,$dn); $result = pla_rdelete($ldapserver,$entry['dn']);
echo '</small><br />'; echo '</small><br />';
if ($del_result) { if ($result) {
echo '<script language="javascript">parent.left_frame.location.reload();</script>'; printf(_('Entry %s and sub-tree deleted successfully.'),'<b>'.htmlspecialchars($entry['dn']).'</b>');
printf(_('Entry %s and sub-tree deleted successfully.'),'<b>'.htmlspecialchars($dn).'</b>');
} else { } else {
pla_error(sprintf(_('Could not delete the entry: %s'),htmlspecialchars($dn)), pla_error(sprintf(_('Could not delete the entry: %s'),htmlspecialchars($entry['dn'])),
$ldapserver->error(),$ldapserver->errno()); $ldapserver->error(),$ldapserver->errno());
} }
function pla_rdelete($ldapserver,$dn) { function pla_rdelete($ldapserver,$dn) {
# we delete all children, not only the visible children in the tree
$children = $ldapserver->getContainerContents($dn); $children = $ldapserver->getContainerContents($dn);
if (! is_array($children) || count($children) == 0) { if (! is_array($children) || count($children) == 0) {
printf('<span style="white-space: nowrap;">%s %s...',_('Deleting'),htmlspecialchars($dn)); printf('<span style="white-space: nowrap;">%s %s...',_('Deleting'),htmlspecialchars($dn));
flush();
if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn))) if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn)))
if ($ldapserver->delete($dn)) { if ($ldapserver->delete($dn)) {
run_hook('post_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn)); run_hook('post_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn));
printf(' <span style="color:green">%s</span></span><br />',_('Success')); printf(' <span style="color:green">%s</span></span><br />',_('Success'));
return true; return true;
} else { } else {
pla_error(sprintf(_('Failed to delete entry %s'),htmlspecialchars($dn)), pla_error(sprintf(_('Failed to delete entry %s'),htmlspecialchars($dn)),
$ldapserver->error(),$ldapserver->errno()); $ldapserver->error(),$ldapserver->errno());
} }
} else { } else {
foreach ($children as $child_dn) foreach ($children as $child_dn)
pla_rdelete($ldapserver,$child_dn); pla_rdelete($ldapserver,$child_dn);
printf('<span style="white-space: nowrap;">%s %s...',_('Deleting'),htmlspecialchars($dn)); printf('<span style="white-space: nowrap;">%s %s...',_('Deleting'),htmlspecialchars($dn));
flush();
if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn))) if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn)))
if ($ldapserver->delete($dn)) { if ($ldapserver->delete($dn)) {
run_hook('post_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn)); run_hook('post_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn));
printf(' <span style="color:green">%s</span></span><br />',_('Success')); printf(' <span style="color:green">%s</span></span><br />',_('Success'));
return true; return true;
} else { } else {
pla_error(sprintf(_('Failed to delete entry %s'),htmlspecialchars($dn)), pla_error(sprintf(_('Failed to delete entry %s'),htmlspecialchars($dn)),
$ldapserver->error(),$ldapserver->errno()); $ldapserver->error(),$ldapserver->errno());
} }
} }
} }

View File

@ -1,13 +1,10 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/refresh.php,v 1.17 2005/12/17 00:00:11 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/refresh.php,v 1.18 2007/12/15 07:50:30 wurley Exp $
/** /**
* This script alters the session variable 'tree', by re-querying * This script alters the session variable 'tree', by re-querying
* the LDAP server to grab the contents of every expanded container. * the LDAP server to grab the contents of every expanded container.
* *
* Variables that come in via common.php
* - server_id
*
* @package phpLDAPadmin * @package phpLDAPadmin
*/ */
/** /**
@ -16,11 +13,11 @@
require './common.php'; require './common.php';
if (! isset($ldapserver)) if (! $_SESSION['plaConfig']->isCommandAvailable('server_refresh'))
header('Location: tree.php'); pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('refresh server')));
unset($_SESSION['cache'][$ldapserver->server_id]['tree']); unset($_SESSION['cache'][$ldapserver->server_id]['tree']);
pla_session_close();
header(sprintf('Location: tree.php#%s',$ldapserver->server_id)); header(sprintf('Location: cmd.php?server_id=%s',$ldapserver->server_id));
die();
?> ?>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rename.php,v 1.32 2007/03/18 02:06:20 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rename.php,v 1.33 2007/12/15 07:50:30 wurley Exp $
/** /**
* Renames a DN to a different name. * Renames a DN to a different name.
@ -19,11 +19,13 @@ require './common.php';
if ($ldapserver->isReadOnly()) if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode')); pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.')); if (! $_SESSION['plaConfig']->isCommandAvailable('entry_rename'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('rename entry')));
$dn = ($_POST['dn']); $dn = ($_POST['dn']);
if (! $ldapserver->isBranchRenameEnabled()) { if (! $ldapserver->isBranchRenameEnabled()) {
# we search all children, not only the visible children in the tree
$children = $ldapserver->getContainerContents($dn); $children = $ldapserver->getContainerContents($dn);
if (count($children) > 0) if (count($children) > 0)
pla_error(_('You cannot rename an entry which has children entries (eg, the rename operation is not allowed on non-leaf entries)')); pla_error(_('You cannot rename an entry which has children entries (eg, the rename operation is not allowed on non-leaf entries)'));
@ -62,16 +64,13 @@ if ($success) {
if ($success) { if ($success) {
run_hook('post_rename_entry',array('server_id'=>$ldapserver->server_id,'old_dn'=>$dn,'new_dn'=>$new_dn_value)); run_hook('post_rename_entry',array('server_id'=>$ldapserver->server_id,'old_dn'=>$dn,'new_dn'=>$new_dn_value));
$edit_url = sprintf('template_engine.php?server_id=%s&dn=%s',$ldapserver->server_id,rawurlencode($new_dn)); $rename_message = sprintf('%s',_('Rename successful!'));
$redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',$ldapserver->server_id,rawurlencode($new_dn));
echo '<html><head>'; system_message(array(
echo '<!-- refresh the tree view (with the new DN renamed) and redirect to the edit_dn page -->'; 'title'=>_('Rename Entry'),
printf('<script language="javascript">parent.left_frame.location.reload();location.href="%s";</script>',$edit_url); 'body'=>$rename_message,
echo "<!-- If the JavaScript didn't work, here's a meta tag to do the job -->"; 'type'=>'info'),
printf('<meta http-equiv="refresh" content="0; url=%s" />',$edit_url); $redirect_url);
echo '</head><body>';
printf('%s <a href="%s">%s</a>',_('Redirecting...'),$edit_url,_('here'));
echo '</body></html>';
} }
?> ?>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rename_form.php,v 1.10 2006/04/29 06:49:31 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rename_form.php,v 1.11 2007/12/15 07:50:30 wurley Exp $
/** /**
* Displays a form for renaming an LDAP entry. * Displays a form for renaming an LDAP entry.
@ -24,18 +24,14 @@ if (! $ldapserver->haveAuthInfo())
$dn = $_GET['dn']; $dn = $_GET['dn'];
$rdn = get_rdn($dn); $rdn = get_rdn($dn);
include './header.php';
echo '<body>';
printf('<h3 class="title">%s <b>%s</b></h3>',_('Rename Entry'),htmlspecialchars($rdn)); printf('<h3 class="title">%s <b>%s</b></h3>',_('Rename Entry'),htmlspecialchars($rdn));
printf('<h3 class="subtitle">%s: <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>', printf('<h3 class="subtitle">%s: <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>',
_('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($dn)); _('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($dn));
echo '<br /><center><form action="rename.php" method="post" class="edit_dn" />'; echo '<br /><center><form action="cmd.php?cmd=rename" method="post" class="edit_dn" />';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id); printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($dn)); printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($dn));
printf('<input type="text" name="new_rdn" size="30" value="%s" />',htmlspecialchars($rdn)); printf('<input type="text" name="new_rdn" size="30" value="%s" />',htmlspecialchars($rdn));
printf('<input class="update_dn" type="submit" value="%s" />',_('Rename')); printf('<input class="update_dn" type="submit" value="%s" />',_('Rename'));
echo '</form></center>'; echo '</form></center>';
echo '</body></html>';
?> ?>

View File

@ -1,11 +1,9 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/schema.php,v 1.66 2007/03/21 23:33:58 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/schema.php,v 1.67 2007/12/15 07:50:30 wurley Exp $
/** /**
* Displays the schema for the specified server_id * Displays the schema for the specified server_id
* *
* Variables that come in via common.php
* - server_id
* Variables that come in as GET vars: * Variables that come in as GET vars:
* - view (optional: can be 'attr' or empty. If 'attr', show that attribute) * - view (optional: can be 'attr' or empty. If 'attr', show that attribute)
* - attr (optional) * - attr (optional)
@ -18,65 +16,57 @@
require './common.php'; require './common.php';
if( ! $ldapserver->haveAuthInfo()) if (! $_SESSION['plaConfig']->isCommandAvailable('schema'))
pla_error( _('Not enough information to login to server. Please check your configuration.') ); pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('view schema')));
$view = isset($_GET['view']) ? $_GET['view'] : 'objectClasses'; $entry['view'] = get_request('view','GET','false','objectClasses');
$viewvalue = isset($_GET['viewvalue']) ? $_GET['viewvalue'] : null; $entry['value'] = get_request('viewvalue','GET');
if (trim($viewvalue) == "") if (! is_null($entry['value'])) {
$viewvalue = null; $entry['viewed'] = false;
if (! is_null($viewvalue)) $entry['value'] = strtolower($entry['value']);
$viewed = false; }
include './header.php';
$schema_error_str = sprintf('%s <b>%s</b>.<br /><br /></center>%s<ul><li>%s</li><li>%s</li><li>%s</li><li>%s</li></ul>', $schema_error_str = sprintf('%s <b>%s</b>.<br /><br /></center>%s<ul><li>%s</li><li>%s</li><li>%s</li><li>%s</li></ul>',
_('Could not retrieve schema from'),htmlspecialchars($ldapserver->name), _('Could not retrieve schema from'),htmlspecialchars($ldapserver->name),
_('This could happen for several reasons, the most probable of which are:'),_('The server does not fully support the LDAP protocol.'), _('This could happen for several reasons, the most probable of which are:'),_('The server does not fully support the LDAP protocol.'),
_('Your version of PHP does not correctly perform the query.'),_('phpLDAPadmin doesn\'t know how to fetch the schema for your server.'), _('Your version of PHP does not correctly perform the query.'),_('phpLDAPadmin doesn\'t know how to fetch the schema for your server.'),
_('Or lastly, your LDAP server doesnt provide this information.')); _('Or lastly, your LDAP server doesnt provide this information.'));
?>
<body> printf('<h3 class="title">%s <b>%s</b></h3>',
_('Schema for server'),
htmlspecialchars($ldapserver->name));
<h3 class="title"><?php echo _('Schema for server'); ?> $entry['schema_types'] = array(
<b><?php echo htmlspecialchars($ldapserver->name); ?></b></h3> 'objectClasses'=>'ObjectClasses',
'attributes'=>'Attribute Types',
'syntaxes'=>'Syntaxes',
'matching_rules'=>'Matching Rules');
<br /> echo '<br />';
echo '<center>';
<center> $counter = 0;
<?php echo ( $view=='objectClasses' ? foreach ($entry['schema_types'] as $item => $value) {
_('ObjectClasses') : if ($counter++)
sprintf('<a href="?server_id=%s&amp;view=%s">%s</a>', echo ' | ';
$ldapserver->server_id,'objectClasses',_('ObjectClasses'))); ?>
|
<?php echo ( $view=='attributes' ?
_('Attribute Types'):
sprintf('<a href="?server_id=%s&amp;view=%s">%s</a>',
$ldapserver->server_id,'attributes',_('Attribute Types'))); ?>
|
<?php echo ( $view=='syntaxes' ?
_('Syntaxes') :
sprintf('<a href="?server_id=%s&amp;view=%s">%s</a>',
$ldapserver->server_id,'syntaxes',_('Syntaxes'))); ?>
|
<?php echo ( $view=='matching_rules' ?
_('Matching Rules') :
sprintf('<a href="?server_id=%s&amp;view=%s">%s</a>',
$ldapserver->server_id,'matching_rules',_('Matching Rules'))); ?>
</center>
<br />
<?php flush(); $entry['href'][$item] = sprintf('?cmd=schema&server_id=%s&view=%s&viewvalue=%%s',$ldapserver->server_id,$item);
switch($view) { $href = htmlspecialchars(sprintf($entry['href'][$item],''));
echo ($entry['view'] == $item ? _($value) : sprintf('<a href="%s">%s</a>',$href,_($value)));
}
echo '</center>';
echo '<br />';
switch($entry['view']) {
case 'syntaxes': case 'syntaxes':
$highlight_oid = isset($_GET['highlight_oid']) ? $_GET['highlight_oid'] : false; $highlight_oid = isset($_GET['highlight_oid']) ? $_GET['highlight_oid'] : false;
print '<table class="schema_attr" width="100%">'; print '<table class="schema" border=0>';
printf('<tr><th>%s</th><th>%s</th></tr>',_('Syntax OID'),_('Description')); printf('<tr class="name"><td>%s</td><td>%s</td></tr>',_('Syntax OID'),_('Description'));
$counter = 1; $counter = 1;
@ -95,13 +85,30 @@ switch($view) {
else else
printf('<tr class="%s">',$counter%2==0?'even':'odd'); printf('<tr class="%s">',$counter%2==0?'even':'odd');
printf('<td>%s</td><td>%s</td></tr>',$oid,$desc); printf('<td class="type">%s</td><td class="type">%s</td></tr>',$oid,$desc);
} }
print '</table>'; print '</table>';
break; break;
case 'attributes': case 'attributes':
$entry['attr_types'] = array(
'desc' => _('Description'),
'obsolete' => _('Obsolete'),
'inherits' => _('Inherits from'),
'equality' => _('Equality'),
'ordering' => _('Ordering'),
'substring_rule' => _('Substring Rule'),
'syntax' => _('Syntax'),
'single_valued' => _('Single Valued'),
'collective' => _('Collective'),
'user_modification' => _('User Modification'),
'usage' => _('Usage'),
'maximum_length' => _('Maximum Length'),
'aliases' => _('Aliases'),
'used_by_objectclasses' => _('Used by objectClasses')
);
$schema_attrs = $ldapserver->SchemaAttributes(); $schema_attrs = $ldapserver->SchemaAttributes();
$schema_object_classes = $ldapserver->SchemaObjectClasses(); $schema_object_classes = $ldapserver->SchemaObjectClasses();
@ -109,135 +116,125 @@ switch($view) {
pla_error($schema_error_str); pla_error($schema_error_str);
printf('<small>%s:</small>',_('Jump to an attribute type')); printf('<small>%s:</small>',_('Jump to an attribute type'));
echo '<form action="schema.php" method="get">'; echo '<form action="cmd.php" method="get">';
printf('<input type="hidden" name="view" value="%s" />',$view); echo '<input type="hidden" name="cmd" value="schema" />';
printf('<input type="hidden" name="view" value="%s" />',$entry['view']);
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id); printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
echo '<select name="viewvalue" onChange="submit()">'; echo '<select name="viewvalue" onChange="submit()">';
echo '<option value=""> - all -</option>'; echo '<option value=""> - all -</option>';
foreach ($schema_attrs as $name => $attr) foreach ($schema_attrs as $name => $attr)
printf('<option value="%s" %s>%s</option>', printf('<option value="%s" %s>%s</option>',
$name,$name == $viewvalue ? 'selected ': '',$attr->getName()); $name,$name == $entry['value'] ? 'selected ': '',$attr->getName());
echo '</select>'; echo '</select>';
printf('<input type="submit" value="%s" /></form>',_('Go')); printf('<input type="submit" value="%s" /></form>',_('Go'));
echo '<br />'; echo '<br />';
echo '<table class="schema_attr" width="100%">';
foreach ($schema_attrs as $attr) { foreach ($schema_attrs as $attr) {
if (is_null($viewvalue) || ! strcasecmp($viewvalue,$attr->getName())) { if (is_null($entry['value']) || ! strcasecmp($entry['value'],$attr->getName())) {
if (! is_null($viewvalue)) if (! is_null($entry['value']))
$viewed = true; $entry['viewed'] = true;
printf('<tr><th colspan="2"><a name="%s">%s</a></th></tr>', echo '<table class="schema" border=0>';
printf('<tr class="name"><td colspan=2><a name="%s">%s</a></td></tr>',
strtolower($attr->getName()),$attr->getName()); strtolower($attr->getName()),$attr->getName());
$counter = 0; $counter = 0;
foreach ( foreach ($entry['attr_types'] as $item => $value) {
array('desc','obsolete','inherits','equality','ordering','substring_rule','syntax',
'single_valued','collective','user_modification','usage','maximum_length',
'aliases','used_by_objectclasses'
) as $item) {
printf('<tr class="%s">',++$counter%2 ? 'odd' : 'even'); printf('<tr class="%s">',++$counter%2 ? 'odd' : 'even');
printf('<td class="type">%s</td>',$value);
switch ($item) { switch ($item) {
case 'desc': case 'desc':
printf('<td>%s</td>',_('Description'));
printf('<td>%s</td>', printf('<td>%s</td>',
is_null($attr->getDescription()) ? is_null($attr->getDescription()) ?
'('._('no description').')' : $attr->getDescription()); '('._('no description').')' : $attr->getDescription());
print '</tr>'; print '</tr>';
printf('<tr class="%s">',++$counter%2 ? 'odd' : 'even'); printf('<tr class="%s">',++$counter%2 ? 'odd' : 'even');
echo '<td><acronym title="Object Identier">OID</acronym></td>'; echo '<td class="type"><acronym title="Object Identier">OID</acronym></td>';
printf('<td>%s</td>',$attr->getOID()); printf('<td>%s</td>',$attr->getOID());
break; break;
case 'obsolete': case 'obsolete':
printf('<td>%s</td>',_('Obsolete'));
printf('<td>%s</td>',$attr->getIsObsolete() ? '<b>'._('Yes').'</b>' : _('No')); printf('<td>%s</td>',$attr->getIsObsolete() ? '<b>'._('Yes').'</b>' : _('No'));
break; break;
case 'inherits': case 'inherits':
printf('<td>%s</td>',_('Inherits from'));
print '<td>'; print '<td>';
if (is_null($attr->getSupAttribute())) if (is_null($attr->getSupAttribute()))
printf('(%s)',_('none')); printf('(%s)',_('none'));
else else {
printf('<a href="?server_id=%s&amp;view=%s&amp;viewvalue=%s">%s</a>', $href = htmlspecialchars(sprintf($entry['href']['attributes'],strtolower($attr->getSupAttribute())));
$ldapserver->server_id,$view, printf('<a href="%s">%s</a>',$href,$attr->getSupAttribute());
strtolower($attr->getSupAttribute()),$attr->getSupAttribute()); }
print '</td>'; print '</td>';
break; break;
case 'equality': case 'equality':
printf('<td>%s</td>',_('Equality')); print '<td>';
printf('<td>%s</td>',
is_null($attr->getEquality()) ? '('._('not specified').')' : if (is_null($attr->getEquality()))
sprintf('<a href="?server_id=%s&amp;view=matching_rules&amp;viewvalue=%s">%s</a>', printf('(%s)',_('not specified'));
$ldapserver->server_id,$attr->getEquality(),$attr->getEquality()));
else {
$href = htmlspecialchars(sprintf($entry['href']['matching_rules'],$attr->getEquality()));
printf('<a href="%s">%s</a>',$href,$attr->getEquality());
}
print '</td>';
break; break;
case 'ordering': case 'ordering':
printf('<td>%s</td>',_('Ordering'));
printf('<td>%s</td>', printf('<td>%s</td>',
is_null($attr->getOrdering()) ? '('._('not specified').')' : $attr->getOrdering()); is_null($attr->getOrdering()) ? '('._('not specified').')' : $attr->getOrdering());
break; break;
case 'substring_rule': case 'substring_rule':
printf('<td>%s</td>',_('Substring Rule'));
printf('<td>%s</td>', printf('<td>%s</td>',
is_null($attr->getSubstr()) ? '('._('not specified').')' : $attr->getSubstr()); is_null($attr->getSubstr()) ? '('._('not specified').')' : $attr->getSubstr());
break; break;
case 'syntax': case 'syntax':
printf('<td>%s</td>',_('Syntax'));
print '<td>'; print '<td>';
if (is_null($attr->getType())) { if (is_null($attr->getType())) {
echo $attr->getSyntaxOID(); echo $attr->getSyntaxOID();
} else { } else {
printf('<a href="?server_id=%s&amp;view=syntaxes&amp;highlight_oid=%s#%s">%s (%s)</a>', $href = htmlspecialchars(sprintf($entry['href']['syntaxes'].'&highlight_oid=%s#%s','',
$ldapserver->server_id, $attr->getSyntaxOID(),$attr->getSyntaxOID()));
$attr->getSyntaxOID(),$attr->getSyntaxOID(), printf('<a href="%s">%s (%s)</a>',$href,$attr->getType(),$attr->getSyntaxOID());
$attr->getType(),$attr->getSyntaxOID());
} }
print '</td>'; print '</td>';
break; break;
case 'single_valued': case 'single_valued':
printf('<td>%s</td>',_('Single Valued'));
printf('<td>%s</td>',$attr->getIsSingleValue() ? _('Yes') : _('No')); printf('<td>%s</td>',$attr->getIsSingleValue() ? _('Yes') : _('No'));
break; break;
case 'collective': case 'collective':
printf('<td>%s</td>',_('Collective'));
printf('<td>%s</td>',$attr->getIsCollective() ? _('Yes') : _('No')); printf('<td>%s</td>',$attr->getIsCollective() ? _('Yes') : _('No'));
break; break;
case 'user_modification': case 'user_modification':
printf('<td>%s</td>',_('User Modification'));
printf('<td>%s</td>',$attr->getIsNoUserModification() ? _('No') : _('Yes')); printf('<td>%s</td>',$attr->getIsNoUserModification() ? _('No') : _('Yes'));
break; break;
case 'usage': case 'usage':
printf('<td>%s</td>',_('Usage'));
printf('<td>%s</td>',$attr->getUsage() ? $attr->getUsage() : '('._('not specified').')'); printf('<td>%s</td>',$attr->getUsage() ? $attr->getUsage() : '('._('not specified').')');
break; break;
case 'maximum_length': case 'maximum_length':
printf('<td>%s</td>',_('Maximum Length'));
print '<td>'; print '<td>';
if ( is_null($attr->getMaxLength())) if ( is_null($attr->getMaxLength()))
@ -251,31 +248,31 @@ switch($view) {
break; break;
case 'aliases': case 'aliases':
printf('<td>%s</td>',_('Aliases'));
print '<td>'; print '<td>';
if (count($attr->getAliases()) == 0) if (count($attr->getAliases()) == 0)
echo '('._('none').')'; printf('(%s)',_('none'));
else else
foreach ($attr->getAliases() as $alias_attr_name) foreach ($attr->getAliases() as $alias_attr_name) {
printf('<a href="?server_id=%s&amp;view=attributes&amp;viewvalue=%s">%s</a>', $href = htmlspecialchars(sprintf($entry['href']['attributes'],strtolower($alias_attr_name)));
$ldapserver->server_id,strtolower($alias_attr_name),$alias_attr_name); printf('<a href="%s">%s</a>',$href,$alias_attr_name);
}
print '</td>'; print '</td>';
break; break;
case 'used_by_objectclasses': case 'used_by_objectclasses':
printf('<td>%s</td>',_('Used by objectClasses'));
print '<td>'; print '<td>';
if (count($attr->getUsedInObjectClasses()) == 0) if (count($attr->getUsedInObjectClasses()) == 0)
echo '('._('none').')'; printf('(%s)',_('none'));
else else
foreach ($attr->getUsedInObjectClasses() as $used_in_oclass) foreach ($attr->getUsedInObjectClasses() as $used_in_oclass) {
printf('<a href="?server_id=%s&amp;view=objectClasses&amp;viewvalue=%s">%s</a> ', $href = htmlspecialchars(sprintf($entry['href']['objectClasses'],strtolower($used_in_oclass)));
$ldapserver->server_id,strtolower($used_in_oclass),$used_in_oclass); printf('<a href="%s">%s</a> ',$href,$used_in_oclass);
}
print '</td>'; print '</td>';
break; break;
@ -283,12 +280,11 @@ switch($view) {
} }
print '</tr>'; print '</tr>';
} }
print '</table>';
flush(); echo '<br />';
} }
} }
print '</table>';
break; break;
case 'matching_rules': case 'matching_rules':
@ -298,26 +294,25 @@ switch($view) {
printf('<small>%s</small><br />',_('Jump to a matching rule')); printf('<small>%s</small><br />',_('Jump to a matching rule'));
print '<form action="schema.php" method="get">'; print '<form action="cmd.php" method="get">';
print '<input type="hidden" name="cmd" value="schema" />';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id); printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
print '<input type="hidden" name="view" value="matching_rules" />'; print '<input type="hidden" name="view" value="matching_rules" />';
print '<select name="viewvalue" onChange="submit()">'; print '<select name="viewvalue" onChange="submit()">';
print '<option value=""> - all -</option>'; print '<option value=""> - all -</option>';
foreach ($schema_matching_rules as $rule) foreach ($schema_matching_rules as $rule)
printf('<option value="%s" %s>%s</option>', printf('<option value="%s" %s>%s</option>',
$rule->getName(), $rule->getName(),
($rule->getName() == $viewvalue ? 'selected': ''), ($rule->getName() == $entry['value'] ? 'selected': ''),
$rule->getName()); $rule->getName());
print '</select>'; print '</select>';
printf('<input type="submit" value="%s" />',_('Go')); printf('<input type="submit" value="%s" />',_('Go'));
print '</form>'; print '</form>';
print '<table class="schema_attr" width="100%">'; print '<table class="schema" border=0>';
printf('<tr><th>%s</th><th>%s</th><th>%s</th></tr>', printf('<tr class="name"><td>%s</td><td>%s</td><td>%s</td></tr>',
_('Matching Rule OID'),_('Name'),_('Used by Attributes')); _('Matching Rule OID'),_('Name'),_('Used by Attributes'));
$counter = 1; $counter = 1;
@ -327,10 +322,10 @@ switch($view) {
$oid = htmlspecialchars($rule->getOID()); $oid = htmlspecialchars($rule->getOID());
$desc = htmlspecialchars($rule->getName()); $desc = htmlspecialchars($rule->getName());
if ( is_null($viewvalue) || $viewvalue == ($rule->getName())) { if ( is_null($entry['value']) || $entry['value'] == strtolower($rule->getName())) {
if (! is_null($viewvalue)) if (! is_null($entry['value']))
$viewed = true; $entry['viewed'] = true;
if (null != $rule->getDescription()) if (null != $rule->getDescription())
$desc .= sprintf(' (%s)',$rule->getDescription()); $desc .= sprintf(' (%s)',$rule->getDescription());
@ -339,25 +334,26 @@ switch($view) {
$desc .= sprintf(' <span style="color:red">%s</span>',_('Obsolete')); $desc .= sprintf(' <span style="color:red">%s</span>',_('Obsolete'));
printf('<tr class="%s">',$counter%2 ? 'odd' : 'even'); printf('<tr class="%s">',$counter%2 ? 'odd' : 'even');
printf('<td>%s</td>',$oid); printf('<td class="type">%s</td>',$oid);
printf('<td>%s</td>',$desc); printf('<td class="type">%s</td>',$desc);
print '<td>'; print '<td class="type">';
if (count($rule->getUsedByAttrs()) == 0) { if (count($rule->getUsedByAttrs()) == 0) {
printf('<center>(%s)</center><br /><br />',_('none')); printf('<center>(%s)</center><br /><br />',_('none'));
} else { } else {
print '<table><tr><td style="text-align: right">'; print '<table width=100% border=0><tr><td style="text-align: right">';
print '<form action="schema.php" method="get">'; print '<form action="cmd.php" method="get">';
print '<input type="hidden" name="cmd" value="schema" />';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id); printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
print '<input type="hidden" name="view" value="attributes" />'; print '<input type="hidden" name="view" value="attributes" />';
print '<select style="width: 150px; color:black; background-color: #eee" size="4" name="viewvalue">'; print '<select style="width: 150px; color:black; background-color: #eee" size="4" name="viewvalue">';
foreach ($rule->getUsedByAttrs() as $attr) foreach ($rule->getUsedByAttrs() as $attr)
printf('<option>%s</option>',$attr); printf('<option>%s</option>',$attr);
print '</select><br />'; print '</select><br />';
printf('<input type="submit" value="%s" />',_('Go')); printf('<input type="submit" value="%s" />',_('Go'));
print '</form>'; print '</form>';
print '</td></tr></table>'; print '</td></tr></table>';
@ -377,17 +373,16 @@ switch($view) {
printf('<small>%s:</small>',_('Jump to an objectClass')); printf('<small>%s:</small>',_('Jump to an objectClass'));
echo '<form action="schema.php" method="get">'; echo '<form action="cmd.php" method="get">';
printf('<input type="hidden" name="view" value="%s" />',$view); echo '<input type="hidden" name="cmd" value="schema" />';
printf('<input type="hidden" name="view" value="%s" />',$entry['view']);
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id); printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
echo '<select name="viewvalue" onChange="submit()">'; echo '<select name="viewvalue" onChange="submit()">';
echo '<option value=""> - all - </option>'; echo '<option value=""> - all - </option>';
foreach ($schema_oclasses as $name => $oclass) foreach ($schema_oclasses as $name => $oclass)
printf('<option value="%s" %s>%s</option>', printf('<option value="%s" %s>%s</option>',
$name,$name == $viewvalue ? 'selected ': '',$oclass->getName()); $name,$name == $entry['value'] ? 'selected ': '',$oclass->getName());
echo '</select>'; echo '</select>';
printf('<input type="submit" value="%s" />',_('Go')); printf('<input type="submit" value="%s" />',_('Go'));
@ -395,124 +390,117 @@ switch($view) {
echo '<br />'; echo '<br />';
flush();
foreach ($schema_oclasses as $name => $oclass) { foreach ($schema_oclasses as $name => $oclass) {
if (is_null($viewvalue) || ($viewvalue == $name)) { if (is_null($entry['value']) || ($entry['value'] == $name)) {
if (! is_null($viewvalue)) if (! is_null($entry['value']))
$viewed = true; $entry['viewed'] = true;
printf('<h4 class="oclass"><a name="%s">%s</a></h4>',$name,$oclass->getName()); echo '<table class="schema_oclass" border=0>';
printf('<h4 class="oclass_sub">%s: <b>%s</b></h4>',_('OID'),$oclass->getOID()); printf('<tr class="name"><td colspan=4><a name="%s">%s</a></td></tr>',$name,$oclass->getName());
printf('<tr class="detail"><td colspan=4>%s: <b>%s</b></td></tr>',_('OID'),$oclass->getOID());
if ($oclass->getDescription()) if ($oclass->getDescription())
printf('<h4 class="oclass_sub">%s: <b>%s</b></h4>',_('Description'),$oclass->getDescription()); printf('<tr class="detail"><td colspan=4>%s: <b>%s</b></td></tr>',_('Description'),$oclass->getDescription());
printf('<h4 class="oclass_sub">%s: <b>%s</b></h4>',_('Type'),$oclass->getType()); printf('<tr class="detail"><td colspan=4>%s: <b>%s</b></td></tr>',_('Type'),$oclass->getType());
if ($oclass->getIsObsolete()) if ($oclass->getIsObsolete())
printf('<h4 class="oclass_sub">%s</h4>',_('This objectClass is obsolete.')); printf('<tr class="detail"><td colspan=4>%s</td></tr>',_('This objectClass is obsolete.'));
printf('<h4 class="oclass_sub">%s: <b>',_('Inherits from')); printf('<tr class="detail"><td colspan=4>%s: <b>',_('Inherits from'));
if (count($oclass->getSupClasses()) == 0) if (count($oclass->getSupClasses()) == 0)
printf('(%s)',_('none')); printf('(%s)',_('none'));
else else
foreach ($oclass->getSupClasses() as $i => $object_class) { foreach ($oclass->getSupClasses() as $i => $object_class) {
printf('<a title="%s" href="?server_id=%s&amp;view=%s&amp;viewvalue=%s">%s</a>', $href = htmlspecialchars(sprintf($entry['href']['objectClasses'],strtolower($object_class)));
_('Jump to this objectClass definition'),
$ldapserver->server_id,$view,strtolower(htmlspecialchars($object_class)), printf('<a title="%s" href="%s">%s</a>',
htmlspecialchars($object_class)); _('Jump to this objectClass definition'),$href,$object_class);
if ($i < count($oclass->getSupClasses()) - 1) if ($i < count($oclass->getSupClasses()) - 1)
echo ', '; echo ', ';
} }
echo '</b></h4>'; echo '</b></td></tr>';
printf('<h4 class="oclass_sub">%s: <b>',_('Parent to')); printf('<tr class="detail"><td colspan=4>%s: <b>',_('Parent to'));
if (strcasecmp($oclass->getName(),'top') == 0) if (strcasecmp($oclass->getName(),'top') == 0) {
printf('(<a href="schema.php?view=objectClasses&amp;server_id=%s">all</a>)',$ldapserver->server_id); $href = htmlspecialchars(sprintf($entry['href']['objectClasses'],''));
printf('(<a href="%s">all</a>)',$href);
elseif (count($oclass->getChildObjectClasses()) == 0) } elseif (count($oclass->getChildObjectClasses()) == 0)
printf('(%s)',_('none')); printf('(%s)',_('none'));
else else
foreach ($oclass->getChildObjectClasses() as $i => $object_class) { foreach ($oclass->getChildObjectClasses() as $i => $object_class) {
printf('<a title="%s" href="?server_id=%s&amp;view=%s&amp;viewvalue=%s">%s</a>', $href = htmlspecialchars(sprintf($entry['href']['objectClasses'],strtolower($object_class)));
_('Jump to this objectClass definition'), printf('<a title="%s" href="%s">%s</a>',_('Jump to this objectClass definition'),$href,$object_class);
$ldapserver->server_id,$view,strtolower(htmlspecialchars($object_class)),
htmlspecialchars($object_class));
if ( $i < count($oclass->getChildObjectClasses()) - 1) if ( $i < count($oclass->getChildObjectClasses()) - 1)
echo ', '; echo ', ';
} }
echo '</b></h4>'; echo '</b></td></tr>';
echo '<table width="100%" class="schema_oclasses">'; printf('<tr class="attrshead"><td class="left">&nbsp;</td><td><b>%s</b></td><td><b>%s</b></td><td class="right">&nbsp;</td></tr>',
echo '<tr>'; _('Required Attributes'),_('Optional Attributes'));
printf('<th width="50%%"><b>%s</b></th>',_('Required Attributes'));
printf('<th width="50%%"><b>%s</b></th>',_('Optional Attributes'));
echo '</tr>';
echo '<tr>'; echo '<tr class="attrs">';
echo '<td class="left">&nbsp;</td>';
echo '<td>'; echo '<td>';
if (count($oclass->getMustAttrs($schema_oclasses)) > 0) {
echo '<ul class="schema">';
if (count($oclass->getMustAttrs($schema_oclasses)) > 0) {
echo '<ul class="schema">';
foreach ($oclass->getMustAttrs($schema_oclasses) as $attr) { foreach ($oclass->getMustAttrs($schema_oclasses) as $attr) {
echo '<li>'; echo '<li>';
printf('<a href="?server_id=%s&amp;view=attributes&amp;viewvalue=%s">%s</a>', $href = htmlspecialchars(sprintf($entry['href']['attributes'],strtolower($attr->getName())));
$ldapserver->server_id,rawurlencode(strtolower($attr->getName())),htmlspecialchars($attr->getName())); printf('<a href="%s">%s</a>',$href,$attr->getName());
if ($attr->getSource() != $oclass->getName()) { if ($attr->getSource() != $oclass->getName()) {
echo '<br />'; echo '<br />';
printf('<small>&nbsp;&nbsp;(%s <a href="?server_id=%s&amp;view=objectClasses&amp;viewvalue=%s">%s</a>)</small>', $href = htmlspecialchars(sprintf($entry['href']['objectClasses'],strtolower($attr->getSource())));
_('Inherited from'),$ldapserver->server_id,strtolower($attr->getSource()),$attr->getSource()); printf('<small>(%s <a href="%s">%s</a>)</small>',_('Inherited from'),$href,$attr->getSource());
} }
echo '</li>'; echo '</li>';
} }
echo '</ul>'; echo '</ul>';
} else } else
printf('<center>(%s)</center>',_('none')); printf('(%s)',_('none'));
echo '</td>'; echo '</td>';
echo '<td>';
echo '<td width="50%">';
if (count($oclass->getMayAttrs($schema_oclasses)) > 0) { if (count($oclass->getMayAttrs($schema_oclasses)) > 0) {
echo '<ul class="schema">';
echo '<ul class="schema">';
foreach ($oclass->getMayAttrs($schema_oclasses) as $attr) { foreach ($oclass->getMayAttrs($schema_oclasses) as $attr) {
echo '<li>'; echo '<li>';
printf('<a href="?server_id=%s&amp;view=attributes&amp;viewvalue=%s">%s</a>', $href = htmlspecialchars(sprintf($entry['href']['attributes'],strtolower($attr->getName())));
$ldapserver->server_id,rawurlencode(strtolower($attr->getName())),htmlspecialchars($attr->getName())); printf('<a href="%s">%s</a>',$href,$attr->getName());
if ($attr->getSource() != $oclass->getName()) { if ($attr->getSource() != $oclass->getName()) {
echo '<br />'; echo '<br />';
printf('<small>&nbsp;&nbsp; (%s <a href="?server_id=%s&amp;view=objectClasses&amp;viewvalue=%s">%s</a>)</small>', $href = htmlspecialchars(sprintf($entry['href']['objectClasses'],strtolower($attr->getSource())));
_('Inherited from'),$ldapserver->server_id,strtolower($attr->getSource()),$attr->getSource()); printf('<small>(%s <a href="%s">%s</a>)</small>',_('Inherited from'),$href,$attr->getSource());
} }
echo '</li>'; echo '</li>';
} }
echo '</ul>'; echo '</ul>';
} else } else
printf('<center>(%s)</center>',_('none')); printf('(%s)',_('none'));
echo '</td>'; echo '</td>';
echo '<td class="right">&nbsp;</td>';
echo '</tr>'; echo '</tr>';
echo '</table>'; echo '</table>';
echo '<br />';
} }
} /* End foreach objectClass */ } /* End foreach objectClass */
break; break;
} }
if (! is_null($viewvalue) && ! $viewed) if (! is_null($entry['value']) && ! $entry['viewed'])
pla_error(sprintf(_('No such schema item: "%s"'),htmlspecialchars($viewvalue))); pla_error(sprintf(_('No such schema item: "%s"'),htmlspecialchars($entry['value'])));
?>
echo '</body>';
echo '</html>';

View File

@ -1,11 +1,10 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/search.php,v 1.77 2007/03/18 01:42:05 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/search.php,v 1.78 2007/12/15 07:50:30 wurley Exp $
/** /**
* Perform LDAP searches and draw the advanced/simple search forms * Perform LDAP searches and draw the advanced/simple search forms
* *
* Variables that come in as GET vars: * Variables that come in as GET vars:
* - server_id (handled in common.php)
* - search (true if performing a search, empty to just draw form) * - search (true if performing a search, empty to just draw form)
* For simple searches: * For simple searches:
* - attribute, criterion, filter * - attribute, criterion, filter
@ -14,184 +13,220 @@
* *
* @package phpLDAPadmin * @package phpLDAPadmin
* @todo Search is probably broken, since base_dn is now an array * @todo Search is probably broken, since base_dn is now an array
* @todo Order doesnt Order properly - probably case related.
*/ */
/** /**
*/ */
define('SIZE_LIMIT_EXCEEDED',4); define('SIZE_LIMIT_EXCEEDED',4);
require './common.php';
if (isset($ldapserver) && ! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
# Output format, table or list? # Output format, table or list?
$result_formats = array('list','table'); $result_formats = array('list','table');
$format = isset($_GET['format']) ? $_GET['format'] : $config->GetValue('search','display');
if (! in_array($format,$result_formats)) # Our incoming variables
$format = 'list'; $entry['format'] = get_request('format','GET','false',$_SESSION['plaConfig']->GetValue('search','display'));
$entry['form'] = get_request('form','GET',false,get_request('form','SESSION'));
$entry['orderby']['raw'] = get_request('orderby','GET');
$entry['orderby']['string'] = rawurldecode($entry['orderby']['raw']);
$entry['orderby']['array'] = $entry['orderby']['raw'] ? explode(',',preg_replace('/\s+/','',$entry['orderby']['string'])) : true;
$entry['display']['raw'] = get_request('display_attrs','GET');
$entry['display']['string'] = rawurldecode($entry['display']['raw']);
$entry['display']['array'] = $entry['display']['raw'] ? explode(',',preg_replace('/\s+/','',$entry['display']['string'])) : array();
$entry['filter']['string'] = get_request('filter','GET');
$entry['filter']['clean'] = $entry['filter']['string'] ? clean_search_vals($entry['filter']['string']) : null;
$entry['attr'] = get_request('attribute','GET');
$entry['base_dn']['string'] = get_request('base_dn','GET');
$entry['criterion'] = get_request('criterion','GET');
$entry['scope'] = get_request('scope','GET','false','sub');
$entry['search'] = get_request('search','GET');
$entry['predefined'] = get_request('predefined','GET');
$entry['page'] = get_request('page','GET',false,0);
if (! in_array($entry['format'],$result_formats))
$entry['format'] = 'list';
$_SESSION['form'] = $entry['form'];
# build the server drop-down html and JavaScript array (for base_dns) # build the server drop-down html and JavaScript array (for base_dns)
$js_on_change_string = ''; $js_on_change_string = '';
if (isset($_GET['form']) && $_GET['form'] == 'advanced') if ($entry['form'] == 'advanced')
$js_on_change_string = $js_on_change_string = 'onChange="document.forms[0].base_dn.value=servers[document.forms[0].server_id.value].base_dn"';
'onChange="document.forms[0].base_dn.value=servers[document.forms[0].server_id.value].base_dn"';
if (isset($ldapserver)) { if (isset($ldapserver)) {
$server_menu_html = server_select_list($ldapserver->server_id,true,'server_id',$js_on_change_string); $server_menu_html = server_select_list($ldapserver->server_id,true,'server_id',$js_on_change_string);
$server_info_list = server_info_list(); $server_info_list = server_info_list();
} }
$filter = isset($_GET['filter']) ? clean_search_vals($_GET['filter']) : null;
$orderby = isset($_GET['orderby']) ? clean_search_vals($_GET['orderby']) : null;
$attr = isset($_GET['attribute']) ? $_GET['attribute'] : null;
# grab the base dn for the search # grab the base dn for the search
if (isset($_GET['base_dn']) && $_GET['base_dn']) { if ($entry['base_dn']['string']) {
$base_dn = $_GET['base_dn']; $entry['base_dn']['invalid'] = false;
$base_dn_is_invalid = false; $entry['base_dn']['exist'] = false;
$base_dn_does_not_exist = false;
if (trim($base_dn)) if (! is_dn_string($entry['base_dn']['string']))
if (! is_dn_string($base_dn)) $entry['base_dn']['invalid'] = true;
$base_dn_is_invalid = true;
elseif (! $ldapserver->dnExists($base_dn)) elseif (! $ldapserver->dnExists($entry['base_dn']['string']))
$base_dn_does_not_exist = true; $entry['base_dn']['exist'] = true;
$base_dns = array($base_dn); $base_dns = array($entry['base_dn']['string']);
} else } else
if (isset($ldapserver)) if (isset($ldapserver))
$base_dns = $ldapserver->getBaseDN(); $base_dns = $ldapserver->getBaseDN();
$criterion = isset($_GET['criterion']) ? $_GET['criterion'] : null; printf('<script type="text/javascript" src="%ssearch_util.js"></script>','../htdocs/'.JSDIR);
echo '<center>';
if (isset($_GET['form'])) $entry['command']['as'] = $_SESSION['plaConfig']->isCommandAvailable('search','advanced_search');
$_SESSION['form'] = $_GET['form']; $entry['command']['ps'] = $_SESSION['plaConfig']->isCommandAvailable('search','predefined_search');
$form = isset($_SESSION['form']) ? $_SESSION['form'] : null; $entry['command']['ss'] = $_SESSION['plaConfig']->isCommandAvailable('search','simple_search');
$scope = isset($_GET['scope']) ? $_GET['scope'] : 'sub';
include './header.php'; if ($entry['form'] == 'advanced') {
if ($entry['command']['as'])
require LIBDIR.'search_form_advanced.php';
echo '<body><center>'; } elseif ($entry['form'] == 'predefined') {
if ($entry['command']['ps'])
require LIBDIR.'search_form_predefined.php';
if ($form == 'advanced') } elseif ($entry['form'] == 'simple') {
# Draw simple search form
if ($entry['command']['ss'])
require LIBDIR.'search_form_simple.php';
} elseif ($entry['command']['as']) {
require LIBDIR.'search_form_advanced.php'; require LIBDIR.'search_form_advanced.php';
elseif ($form == 'predefined') } elseif ($entry['command']['ss']) {
require LIBDIR.'search_form_predefined.php';
# Draw simple search form
else
require LIBDIR.'search_form_simple.php'; require LIBDIR.'search_form_simple.php';
} elseif ($entry['command']['ps']) {
require LIBDIR.'search_form_predefined.php';
} else {
echo _('Searching is not permitted');
}
echo '</center>'; echo '</center>';
echo '<br />';
flush(); if ($entry['search']) {
if ($entry['form'] == 'advanced') {
if (! $_SESSION['plaConfig']->isCommandAvailable('search','advanced_search'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('advanced search')));
if (isset($_GET['search'])) { } elseif ($entry['form'] == 'predefined') {
if ($form == 'advanced') { if (! $_SESSION['plaConfig']->isCommandAvailable('search','predefined_search'))
if (isset($_GET['display_attrs'])) pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('predefined search')));
$search_result_attributes = explode(',',rawurldecode(preg_replace('/\s+/','',rawurldecode($_GET['display_attrs']))));
} elseif ($entry['form'] == 'simple') {
if (! $_SESSION['plaConfig']->isCommandAvailable('search','simple_search'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('simple search')));
}
if ($entry['form'] == 'advanced') {
if ($entry['display'])
$search_result_attributes = $entry['display']['array'];
else else
$search_result_attributes = $config->GetValue('search','result_attributes'); $search_result_attributes = $_SESSION['plaConfig']->GetValue('search','result_attributes');
} else { } else {
$search_result_attributes = $config->GetValue('search','result_attributes'); $search_result_attributes = $_SESSION['plaConfig']->GetValue('search','result_attributes');
} }
# do we have enough authentication information for the specified server_id # do we have enough authentication information for the specified server_id
# @todo: redirect isnt working
if (! $ldapserver->haveAuthInfo()) { if (! $ldapserver->haveAuthInfo()) {
$login_url = sprintf('login_form.php?server_id=%s&amp;redirect=%s', $login_url = sprintf('cmd.php?cmd=login_form&amp;server_id=%s&amp;redirect=%s',
$ldapserver->server_id,rawurlencode($_SERVER['REQUEST_URI'])); $ldapserver->server_id,rawurlencode($_SERVER['REQUEST_URI']));
printf('<center><br />%s <br /><a href="%s">%s</a>.</center>', system_message(array(
_('You have not logged into the selected server yet, so you cannot perform searches on it.'),$login_url,_('Click here to go to the login form')); 'title'=>_('Search'),
exit; 'body'=>_('You have not logged into the selected server yet, so you cannot perform searches on it.'),
'type'=>'warn'),
'cmd.php?cmd=login_form');
} }
if (isset($_GET['predefined'])) { if (is_numeric($entry['predefined'])) {
$predefined = $_GET['predefined']; $query = get_cleaned_up_predefined_search($entry['predefined']);
if (is_numeric($predefined)) { $search_result_attributes = explode(', ',$query['attributes']);
$query = get_cleaned_up_predefined_search($predefined); $search_attributes_display = $search_result_attributes;
$search_attributes = $search_result_attributes;
$search_result_attributes = explode(', ',$query['attributes']); $entry['filter']['clean'] = $query['filter'];
$search_attributes_display = $search_result_attributes; $entry['scope'] = $query['scope'];
$search_attributes = $search_result_attributes;
$filter = $query['filter']; if (! trim($query['base']))
$scope = $query['scope']; $query['base'] = $ldapserver->getBaseDN();
if (! trim($query['base'])) elseif (is_array($query['base']))
$query['base'] = $ldapserver->getBaseDN(); $base_dns = $query['base'];
elseif (is_array($query['base'])) else
$base_dns = $query['base']; $base_dns = array($query['base']);
else
$base_dns = array($query['base']);
}
} else { } else {
$predefined = ''; $entry['predefined'] = '';
} }
if ($filter) { if ($entry['filter']['clean']) {
# if they are using the simple search form, build an LDAP search filter from their input # if they are using the simple search form, build an LDAP search filter from their input
if ($form == 'simple' & ! is_numeric($predefined)) { if ($entry['form'] == 'simple' & ! is_numeric($entry['predefined'])) {
switch ($criterion) { switch ($entry['criterion']) {
case 'starts with': case 'starts with':
if ($filter == '*') if ($entry['filter']['clean'] == '*')
$filter = ''; $entry['filter']['clean'] = '';
$filter = "($attr=$filter*)"; $entry['filter']['clean'] = sprintf('(%s=%s*)',$entry['attr'],$entry['filter']['clean']);
break; break;
case 'contains': case 'contains':
if ($filter == '*') if ($entry['filter']['clean'] == '*')
$filter = "($attr=*)"; $entry['filter']['clean'] = sprintf('(%s=*)',$entry['attr']);
else else
$filter = "($attr=*$filter*)"; $entry['filter']['clean'] = sprintf('(%s=*%s*)',$entry['attr'],$entry['filter']['clean']);
break; break;
case 'ends with': case 'ends with':
if ($filter == '*') if ($entry['filter']['clean'] == '*')
$filter = ''; $entry['filter']['clean'] = '';
$filter = "($attr=*$filter)"; $entry['filter']['clean'] = sprintf('(%s=*%s)',$entry['attr'],$entry['filter']['clean']);
break; break;
case 'equals': case 'equals':
$filter = "($attr=$filter)"; $entry['filter']['clean'] = sprintf('(%s=%s)',$entry['attr'],$entry['filter']['clean']);
break; break;
case 'sounds like': case 'sounds like':
$filter = "($attr~=$filter)"; $entry['filter']['clean'] = sprintf('(%s~=%s)',$entry['attr'],$entry['filter']['clean']);
break; break;
default: default:
pla_error(_('Unrecognized criteria option: ').htmlspecialchars($criterion)._('If you want to add your own criteria to the list. Be sure to edit search.php to handle them. Quitting.')); system_message(array(
'title'=>_('Unrecognized criteria option: ').htmlspecialchars($entry['criterion']),
'body'=>_('If you want to add your own criteria to the list. Be sure to edit search.php to handle them. Quitting.'),
'type'=>'warn'),
'cmd.php?cmd=search');
} }
} }
printf('<center>%s</center>',_('Searching...'));
flush();
# prevent script from bailing early on a long delete # prevent script from bailing early on a long delete
@set_time_limit(0); @set_time_limit(0);
$size_limit = $config->GetValue('search','size_limit'); $size_limit = $_SESSION['plaConfig']->GetValue('search','size_limit');
# Sanity check # Sanity check
if ($size_limit < 1) if ($size_limit < 1)
$size_limit = 1; $size_limit = 1;
$page = isset($_GET['page']) ? $_GET['page'] : 0;
$time_start = utime(); $time_start = utime();
$time_elapsed = 0; $time_elapsed = 0;
@ -208,8 +243,8 @@ if (isset($_GET['search'])) {
debug_log('Search with base DN [%s]',64,$base_dn); debug_log('Search with base DN [%s]',64,$base_dn);
} }
$results = $ldapserver->search(null,dn_escape($base_dn),$filter, $results = $ldapserver->search(null,dn_escape($base_dn),$entry['filter']['clean'],$search_result_attributes,
$search_result_attributes,$scope,$orderby,$config->GetValue('deref','search')); $entry['scope'],$entry['orderby']['array'],$_SESSION['plaConfig']->GetValue('deref','search'));
if ((! $results) && $ldapserver->errno()) if ((! $results) && $ldapserver->errno())
pla_error(_('Encountered an error while performing search.'),$ldapserver->error(),$ldapserver->errno()); pla_error(_('Encountered an error while performing search.'),$ldapserver->error(),$ldapserver->errno());
@ -220,58 +255,57 @@ if (isset($_GET['search'])) {
$time_elapsed += round($time_end-$time_start,2); $time_elapsed += round($time_end-$time_start,2);
$count = count($results); $count = count($results);
$start_entry = $page * $size_limit; $start_entry = $entry['page'] * $size_limit;
$end_entry = min($start_entry+$size_limit+1,$count+1); $end_entry = min($start_entry+$size_limit+1,$count+1);
?>
<table class="search_header"> # Search Results Table
<tr> echo '<table class="search_result" border=0>';
<td style="vertical-align: top">
<nobr><?php echo _('Entries found: ') . ' &nbsp;<b>' . number_format($count) ?></b>&nbsp;</nobr>
<nobr><small>(<?php echo $time_elapsed; ?> <?php echo _('seconds'); ?>)</small></nobr>
</td>
<td style="text-align: right">
<nobr> echo '<tr class="header">';
<small> printf('<td>%s%s <b>%s</b> <small>(%s %s)</small></td>',_('Entries found'),_(':'),
<?php number_format($count),$time_elapsed,_('seconds'));
printf('[ <a href="export_form.php?server_id=%s&amp;scope=%s&amp;dn=%s&amp;filter=%s&amp;attributes=%s"><img src="images/save.png" alt="Save" /> %s</a> ]',
$ldapserver->server_id,htmlspecialchars($scope),urlencode($base_dn),urlencode($filter),
urlencode(join(', ',$search_result_attributes)),_('export results'));
printf('[ <img src="images/rename.png" /> %s:',_('Format')); if ($_SESSION['plaConfig']->isCommandAvailable('export')) {
$href = htmlspecialchars(sprintf('cmd.php?cmd=export_form&server_id=%s&scope=%s&dn=%s&filter=%s&attributes=%s',
$ldapserver->server_id,$entry['scope'],$base_dn,rawurlencode($entry['filter']['clean']),rawurlencode(join(', ',$search_result_attributes))));
printf('<td style="text-align: right"><small>[ <a href="%s"><img src="images/save.png" alt="Save" /> %s</a> ]',
$href,_('export results'));
}
printf('[ <img src="images/rename.png" alt="rename" /> %s%s',_('Format'),_(':'));
foreach ($result_formats as $f) { foreach ($result_formats as $f) {
echo '&nbsp;'; echo '&nbsp;';
if ($format == $f) { if ($entry['format'] == $f) {
printf('<b>%s</b>',_($f)); printf('<b>%s</b>',_($f));
} else { } else {
$query_string = array_to_query_string($_GET,array('format')); $query_string = array_to_query_string($_GET,array('format','cmd'));
$query_string .= "&amp;format=$f"; $query_string .= sprintf('&amp;format=%s',$f);
printf('<a href="search.php?%s">%s</a>',$query_string,_($f)); printf('<a href="cmd.php?cmd=search&amp;%s">%s</a>',$query_string,_($f));
} }
} }
?>
] echo ' ]</small>';
</small>
</nobr>
<?php if ($form == 'simple' || $form == 'predefined') { ?>
<br /><nobr><small><?php echo _('Base DN: '); ?>
<b><?php echo htmlspecialchars($base_dn); ?></b></small></nobr>
<br /><nobr><small><?php echo _('Filter performed: '); ?>
<b><?php echo htmlspecialchars($filter); ?></b></small></nobr>
<?php } ?>
</td> if ($_SESSION['plaConfig']->isCommandAvailable('schema')) {
</tr> echo '<br />';
</table> printf('<small>%s%s <b>%s</b></small>',_('Base DN'),_(':'),htmlspecialchars($base_dn));
<?php if ($entry['form'] == 'simple' || $entry['form'] == 'predefined') {
echo '<br />';
printf('<small>%s%s <b>%s</b></small>',_('Filter performed'),_(':'),htmlspecialchars($entry['filter']['clean']));
}
}
echo '</td>';
echo '</tr>';
echo '</table>';
# The LDAP error code for the size limit exceeded error. # The LDAP error code for the size limit exceeded error.
# @todo: test this with system_message
if ($errno && $errno == SIZE_LIMIT_EXCEEDED) if ($errno && $errno == SIZE_LIMIT_EXCEEDED)
printf('<br /><center><small style="color:red; white-space: nowrap">%s</small></center><br />',_('Notice, search size limit exceeded.')); printf('<br /><center><small style="color:red; white-space: nowrap">%s</small></center><br />',_('Notice, search size limit exceeded.'));
@ -284,48 +318,48 @@ if (isset($_GET['search'])) {
printf(_('Showing results %s through %s.').'<br />', printf(_('Showing results %s through %s.').'<br />',
'<b>'.number_format($start_entry+1).'</b>','<b>'.number_format($end_entry-1).'</b>'); '<b>'.number_format($start_entry+1).'</b>','<b>'.number_format($end_entry-1).'</b>');
if ($page != 0) { if ($entry['page'] != 0) {
$query_string = array_to_query_string($_GET,array('page')); $query_string = array_to_query_string($_GET,array('page','cmd'));
$query_string .= '&page=' . ($page-1); $query_string .= '&page=' . ($entry['page']-1);
$pager_html .= sprintf('<a title="'._('Page %d').'" href="search.php?%s">&lsaquo;&lsaquo;</a>',$page,$query_string); $pager_html .= sprintf('<a title="'._('Page %d').'" href="cmd.php?cmd=search&amp;%s">&lsaquo;&lsaquo;</a>',$entry['page'],$query_string);
} else { } else {
$pager_html .= "&lsaquo;&lsaquo;"; $pager_html .= '&lsaquo;&lsaquo;';
} }
$pager_html .= '&nbsp;&nbsp;'; $pager_html .= '&nbsp;&nbsp;';
// for large search results where we page beyone the first 20 pages, /* For large search results where we page beyond the first 20 pages,
// print elipsis instead of making the pager be super wide. * print elipsis instead of making the pager be super wide. */
$elipsis_printed = false; $elipsis_printed = false;
for ($i=0;$i<$count;$i+=$size_limit) { for ($i=0;$i<$count;$i+=$size_limit) {
$page_num = $i/$size_limit; $page_num = $i/$size_limit;
if ($count > $size_limit * 20 && abs($page_num-$page) > 10) { if ($count > $size_limit * 20 && abs($page_num-$entry['page']) > 10) {
if (! $elipsis_printed) { if (! $elipsis_printed) {
$pager_html .= '...&nbsp;&nbsp;'; $pager_html .= '...&nbsp;&nbsp;';
$elipsis_printed = true; $elipsis_printed = true;
} }
} elseif ($page == $page_num) { } elseif ($entry['page'] == $page_num) {
$pager_html .= '<b>' . ($page_num + 1) . '</b>'; $pager_html .= '<b>' . ($page_num + 1) . '</b>';
$pager_html .= '&nbsp;&nbsp;'; $pager_html .= '&nbsp;&nbsp;';
$elipsis_printed = false; $elipsis_printed = false;
} else { } else {
$query_string = array_to_query_string($_GET,array('page')); $query_string = array_to_query_string($_GET,array('page','cmd'));
$query_string .= '&page=' . $page_num; $query_string .= '&page=' . $page_num;
$pager_html .= "<a href=\"search.php?$query_string\">" . ($page_num+1) . "</a>"; $pager_html .= "<a href=\"cmd.php?cmd=search&amp;$query_string\">" . ($page_num+1) . "</a>";
$pager_html .= '&nbsp;&nbsp;'; $pager_html .= '&nbsp;&nbsp;';
$elipsis_printed = false; $elipsis_printed = false;
} }
} }
if ($page+1 < $total_pages) { if ($entry['page']+1 < $total_pages) {
$query_string = array_to_query_string($_GET,array('page')); $query_string = array_to_query_string($_GET,array('page','cmd'));
$query_string .= '&page=' . ($page+1); $query_string .= '&page=' . ($entry['page']+1);
$pager_html .= "<a title=\"" . sprintf(_('Page %d'),($page+2))."\" href=\"search.php?$query_string\">&rsaquo;&rsaquo;</a>"; $pager_html .= "<a title=\"" . sprintf(_('Page %d'),($entry['page']+2))."\" href=\"cmd.php?cmd=search&amp;$query_string\">&rsaquo;&rsaquo;</a>";
} else { } else {
$pager_html .= "&rsaquo;&rsaquo;"; $pager_html .= "&rsaquo;&rsaquo;";
@ -340,14 +374,13 @@ if (isset($_GET['search'])) {
if (trim($pager_html)) if (trim($pager_html))
printf('<center>%s</center>',$pager_html); printf('<center>%s</center>',$pager_html);
echo '<br />'; echo '<br />';
flush();
if ($format == 'list') if ($entry['format'] == 'list')
require LIBDIR.'search_results_list.php'; require LIBDIR.'search_results_list.php';
elseif ($format == 'table') elseif ($entry['format'] == 'table')
require LIBDIR.'search_results_table.php'; require LIBDIR.'search_results_table.php';
else else
pla_error(sprintf(_('Unrecognized search result format: %s'),htmlspecialchars($format))); pla_error(sprintf(_('Unrecognized search result format: %s'),htmlspecialchars($entry['format'])));
echo '<br />'; echo '<br />';
if (trim($pager_html)) if (trim($pager_html))
@ -360,5 +393,4 @@ if (isset($_GET['search'])) {
} }
} }
echo '</body></html>';
?> ?>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/server_info.php,v 1.26 2006/09/17 06:35:11 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/server_info.php,v 1.27 2007/12/15 07:50:30 wurley Exp $
/** /**
* Fetches and displays all information that it can from the specified server * Fetches and displays all information that it can from the specified server
@ -12,7 +12,8 @@
/** /**
*/ */
require './common.php'; if (! $_SESSION['plaConfig']->isCommandAvailable('server_info'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('view server informations')));
# The attributes we'll examine when searching the LDAP server's RootDSE # The attributes we'll examine when searching the LDAP server's RootDSE
$root_dse_attributes = array( $root_dse_attributes = array(
@ -46,9 +47,6 @@ $root_dse_attributes = array(
'*' '*'
); );
if (! $ldapserver->haveAuthInfo())
pla_error( _('Not enough information to login to server. Please check your configuration.') );
# Fetch basic RootDSE attributes using the + and *. # Fetch basic RootDSE attributes using the + and *.
$attrs = $ldapserver->search(null,'','objectClass=*',array('+','*'),'base'); $attrs = $ldapserver->search(null,'','objectClass=*',array('+','*'),'base');
$attrs = array_pop($attrs); $attrs = array_pop($attrs);
@ -65,16 +63,13 @@ if (is_array($attrs2))
if (! isset($attrs[$attr])) if (! isset($attrs[$attr]))
$attrs[$attr] = $attrs2[$attr]; $attrs[$attr] = $attrs2[$attr];
include './header.php';
echo '<body>';
printf('<h3 class="title">%s%s</h3>',_('Server info for: '),htmlspecialchars($ldapserver->name)); printf('<h3 class="title">%s%s</h3>',_('Server info for: '),htmlspecialchars($ldapserver->name));
printf('<h3 class="subtitle">%s</h3>',_('Server reports the following information about itself')); printf('<h3 class="subtitle">%s</h3>',_('Server reports the following information about itself'));
if (count($attrs) == 0) { if (count($attrs) == 0) {
echo '<br /><br />'; echo '<br /><br />';
printf('<center>%s</center>',_('This server has nothing to report.')); printf('<center>%s</center>',_('This server has nothing to report.'));
exit; return;
} }
echo '<table class="edit_dn">'; echo '<table class="edit_dn">';
@ -85,7 +80,7 @@ foreach ($attrs as $attr => $values) {
$schema_href = sprintf('schema.php?server_id=%s&amp;view=attributes&amp;viewvalue=%s',$ldapserver->server_id,$attr); $schema_href = sprintf('schema.php?server_id=%s&amp;view=attributes&amp;viewvalue=%s',$ldapserver->server_id,$attr);
echo '<tr><td class="attr">'; echo '<tr><td class="attr">';
printf('<b><a title="'._('Click to view the schema definition for attribute type \'%s\'').'" href="%s">%s</a></b>', printf('<a title="'._('Click to view the schema definition for attribute type \'%s\'').'" href="%s">%s</a>',
$attr,$schema_href,htmlspecialchars($attr)); $attr,$schema_href,htmlspecialchars($attr));
echo '</td></tr>'; echo '</td></tr>';
@ -99,8 +94,8 @@ foreach ($attrs as $attr => $values) {
print '<tr>'; print '<tr>';
if (preg_match('/^[0-9]+\.[0-9]+/',$value)) { if (preg_match('/^[0-9]+\.[0-9]+/',$value)) {
printf('<td width=5%%><acronym title="%s"><img src="images/rfc.png" /></acronym></td>', printf('<td width=5%%><img src="images/rfc.png" title="%s" alt="%s" /></td>',
htmlspecialchars($value)); htmlspecialchars($value), htmlspecialchars($value));
if ($oidtext = support_oid_to_text($value)) if ($oidtext = support_oid_to_text($value))
if (isset($oidtext['ref'])) if (isset($oidtext['ref']))
@ -109,7 +104,7 @@ foreach ($attrs as $attr => $values) {
printf('<td>%s</td>',$oidtext['title']); printf('<td>%s</td>',$oidtext['title']);
else else
if ($value) if (strlen($value) > 0)
printf('<td><small>%s</small></td>',$value); printf('<td><small>%s</small></td>',$value);
} else { } else {
@ -128,5 +123,5 @@ foreach ($attrs as $attr => $values) {
echo '</table>'; echo '</table>';
echo '</td></tr>'; echo '</td></tr>';
} }
echo '</table></body></html>'; echo '</table>';
?> ?>

90
htdocs/show_cache.php Normal file
View File

@ -0,0 +1,90 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/show_cache.php,v 1.3 2007/12/15 11:33:27 wurley Exp $
/**
* This script shows the contents of the cache for debugging purposes
*
* @package phpLDAPadmin
*/
/**
*/
require './common.php';
$entry['key'] = get_request('key','REQUEST');
$entry['index'] = get_request('index','REQUEST');
if (isset($entry['index']) && isset($entry['key'])) {
list($entry['server'],$entry['x']) = split(':',$entry['index']);
debug_dump($_SESSION[$entry['key']][$entry['server']][$entry['x']],1);
}
if ($entry['key'])
debug_dump($_SESSION[$entry['key']],1);
if (! $_SESSION['plaConfig']->GetValue('appearance','hide_debug_info')) {
echo '<div style="font-size: 11px"><ul>';
foreach (array_keys($_SESSION) as $key) {
if (($key == 'cache') && is_array($_SESSION[$key]))
foreach (array_keys($_SESSION['cache']) as $server) {
foreach (array_keys($_SESSION['cache'][$server]) as $x) {
$index = sprintf('%s:%s',$server,$x);
printf('<li><span id="%s"><a href="javascript:get(\'%s\',\'%s\');">%s</a></span><div id="%sloading" style="display: none" ></div></li>',
$key.$index,$key,$index,$key.'.'.$index,$key.$index,$key.$index);
}
}
else
printf('<li><span id="%s"><a href="javascript:get(\'%s\', \'\');">%s</a></span><div id="%sloading" style="display: none" ></div></li>',
$key,$key,$key,$key);
}
echo '</ul></div>';
}
?>
<script type="text/javascript" language="javascript">
var http_request = false;
var newtree_div;
var obj_key = '';
var obj_ind = '';
var obj = null;
function alertCacheContents(result) {
if (obj) {
obj.innerHTML = '<a href="javascript:close(\'' + obj_key + '\', \'' + obj_ind + '\')">' + obj_key + '.' + obj_ind + ' [close]<\/a>';
obj.innerHTML += result;
obj = null;
newtree_div.display = 'none';
}
}
function cancelCacheContents() {
if (obj) {
obj.innerHTML = '<a href="javascript:get(\'' + obj_key + '\', \'' + obj_ind + '\');">' + obj_key + '.' + obj_ind + '<\/a>';
newtree_div.display = 'none';
obj = null;
}
}
function get(key,xx) {
if (obj) cancelHttpRequest();
obj_key = key;
obj_ind = xx;
obj = document.getElementById(key + xx);
newtree_div = document.getElementById(key + xx + 'loading').style;
newtree_div.display = 'block';
var poststr = "cmd=show_cache&key=" + encodeURI(key);
if (xx) {
poststr += "&index=" + encodeURI(xx);
}
obj.innerHTML = '<img src="images/ajax-spinner.gif" /> Loading...';
makePOSTRequest('cmd.php',poststr,'alertCacheContents','cancelCacheContents');
}
function close(key,xx) {
document.getElementById(key + xx).innerHTML = '<a href="javascript:get(\'' + key + '\', \'' + xx + '\');">' + key + '.' + xx + '<\/a>';
}
</script>

File diff suppressed because it is too large Load Diff

View File

@ -13,8 +13,10 @@
require './common.php'; require './common.php';
if (! isset($ldapserver)) if (! isset($ldapserver)) {
header("Location: index.php"); header("Location: index.php");
die();
}
include './header.php'; include './header.php';
@ -30,7 +32,7 @@ $session_timeout = $ldapserver->session_timeout ? $ldapserver->session_timeout :
<br /> <br />
<br /> <br />
<?php echo _('To log back in please click on the following link:'); ?><br /> <?php echo _('To log back in please click on the following link:'); ?><br />
<a href="login_form.php?server_id=<?php echo $ldapserver->server_id; ?>"><?php echo _('Login...'); ?></a> <a href="cmd.php?cmd=login_form&server_id=<?php echo $ldapserver->server_id; ?>"><?php echo _('Login...'); ?></a>
</center> </center>
</body> </body>

View File

@ -1,125 +0,0 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/tree.php,v 1.92 2006/10/29 12:49:24 wurley Exp $
/**
* This script displays the LDAP tree for all the servers that you have
* in config.php.
*
* We read the session variable 'tree' to know which dns are expanded or collapsed.
* No query string parameters are expected, however, you can use a '#' offset to
* scroll to a given dn. The syntax is tree.php#<server_id>_<rawurlencoded dn>, so
* if I wanted to scroll to dc=example,dc=com for server 3, the URL would be:
*
* tree.php#3_dc%3Dexample%2Cdc%3Dcom
*
* @package phpLDAPadmin
* @author The phpLDAPadmin development team
*/
/**
*/
require './common.php';
no_expire_header();
# This allows us to display large sub-trees without running out of time.
@set_time_limit( 0 );
$recently_timed_out_servers = array();
if (isset($_SESSION['activity']['rightframe_server_id']))
$rightframe_server_id = $_SESSION['activity']['rightframe_server_id'];
$rightframerefresh = false;
foreach ($ldapservers->GetServerList() as $server_id) {
$ldapserver = $ldapservers->Instance($server_id);
# Test to see if we should log out the user due to the timeout.
if ($ldapserver->haveAuthInfo() && $ldapserver->auth_type != 'config') {
/* If time out value has been reached:
- log out user
- put $server_id in array of recently timed out servers */
if (session_timed_out($ldapserver)) {
array_push($recently_timed_out_servers, $server_id);
# If $ldapserver->server_id equal $rightframe_server_id load timeout page on right frame
if ($ldapserver->server_id == $rightframe_server_id)
$rightframerefresh = true;
/* Otherwise calculate a new refresh value. If the timeout value is less than the previous
$meta_refresh_variable value set $meta_refresh_variable to $ldapserver->session_timeout */
} else
$meta_refresh_variable = $ldapserver->session_timeout*60;
}
}
include './header.php';
echo '<body>';
if ($rightframerefresh) {
?>
<script type="text/javascript" language="javascript">
<!--
parent.right_frame.location.href = 'timeout.php?server_id=<?php echo $rightframe_server_id; ?>';
//-->
</script>
<?php
}
?>
<!-- # PHP layers menu. -->
<script type="text/javascript" language="javascript" src="js/phplayersmenu/libjs/layersmenu-browser_detection.js"></script>
<script type="text/javascript" language="javascript" src="js/phplayersmenu/libjs/layerstreemenu-cookies.js"></script>
<?php
printf('<h3 class="subtitle" style="margin:0px">phpLDAPadmin - %s</h3>',pla_version());
echo "\n\n";
echo '<!-- Links at the top of the tree viewer -->';
echo '<table class="edit_dn_menu" width=100%><tr>';
printf('<td><img src="images/home.png" alt="%s" /></td>',_('Home'));
printf('<td width=50%%><span style="white-space: nowrap;"><a href="welcome.php" target="right_frame">%s</a></span></td>',_('Home'));
printf('<td><img src="images/trash.png" alt="%s" /></td>',_('Purge caches'));
printf('<td width=50%%><span style="white-space: nowrap;"><a href="purge_cache.php" target="right_frame" title="%s">%s</a></span></td>',_('Purge all cached data in phpLDAPadmin, including server schemas.'),_('Purge caches'));
echo '</tr><tr>';
if (! $config->GetValue('appearance','hide_configuration_management')) {
printf('<td><img src="images/light.png" alt="%s" /></td>',_('light'));
printf('<td width=50%%><span style="white-space: nowrap;"><a href="%s" target="new">%s</a></span></td>',get_href('add_rfe'),_('Request feature'));
printf('<td><img src="images/bug.png" alt="%s" /></td>',_('bug'));
printf('<td width=50%%><span style="white-space: nowrap;"><a href="%s" target="new">%s</a></span></td>',get_href('add_bug'),_('Report a bug'));
echo '</tr><tr>';
printf('<td><img src="images/smile.png" alt="%s" /></td>',_('Donate'));
printf('<td width=50%%><span style="white-space: nowrap;"><a href="%s" target="right_frame">%s</a></span></td>',get_href('donate'),_('Donate'));
}
printf('<td><img src="images/help.png" alt="%s" /></td>',_('Help'));
printf('<td><span style="white-space: nowrap;"><a href="help.php" target="right_frame">%s</a></span></td>',_('Help'));
echo '</tr></table>';
echo "\n\n";
# We want the std tree function as a fallback
require LIBDIR.'tree_functions.php';
# Are we going to use the PLM tree?
if ($config->GetValue('appearance','tree_plm')) {
require JSDIR.'phplayersmenu/lib/PHPLIB.php';
require JSDIR.'phplayersmenu/lib/layersmenu-common.inc.php';
require JSDIR.'phplayersmenu/lib/treemenu.inc.php';
}
# For each of the configured servers
foreach( $ldapservers->GetServerList() as $server_id ) {
$ldapserver = $ldapservers->Instance($server_id);
if ($ldapserver->isVisible()) {
$filename = get_custom_file($server_id,'tree_functions.php',LIBDIR);
require_once($filename);
call_custom_function($server_id,'draw_server_tree');
}
}
echo '</body></html>';
?>

View File

@ -1,11 +1,9 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/update.php,v 1.28 2006/01/29 01:51:49 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/update.php,v 1.29 2007/12/15 07:50:30 wurley Exp $
/** /**
* Updates or deletes a value from a specified attribute for a specified dn. * Updates or deletes a value from a specified attribute for a specified dn.
* *
* Variables that come in via common.php
* - server_id
* Variables that come in on the query string: * Variables that come in on the query string:
* - dn (rawurlencoded) * - dn (rawurlencoded)
* - update_array (an array in the form expected by PHP's ldap_modify, except for deletions) * - update_array (an array in the form expected by PHP's ldap_modify, except for deletions)
@ -28,93 +26,120 @@
require './common.php'; require './common.php';
$dn = $_POST['dn']; $entry['dn']['string'] = get_request('dn');
$encoded_dn = rawurlencode($dn); $entry['dn']['encode'] = rawurlencode($entry['dn']['string']);
# If cancel was submited, got back to the edit display. # If cancel was submited, got back to the edit display.
if (isset($_REQUEST['cancel'])) { if (isset($_REQUEST['cancel'])) {
header(sprintf('Location: template_engine.php?server_id=%s&dn=%s',$ldapserver->server_id,$encoded_dn)); header(sprintf('Location: cmd.php?cmd=template_engine&server_id=%s&dn=%s',$ldapserver->server_id,$entry['dn']['encode']));
die(); die();
} }
if ($ldapserver->isReadOnly()) if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode')); pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
$update_array = isset($_POST['update_array']) ? $_POST['update_array'] : array(); $entry['update'] = get_request('update_array','POST',false,array());
$skip_array = isset($_POST['skip_array']) ? $_POST['skip_array'] : array(); $entry['skip'] = get_request('skip_array','POST',false,array());
$failed_attrs = array(); $failed_attrs = array();
if (! is_array($update_array)) if (! is_array($entry['update']))
pla_error(_('update_array is malformed. This might be a phpLDAPadmin bug. Please report it.')); pla_error(_('update_array is malformed. This might be a phpLDAPadmin bug. Please report it.'));
run_hook ('pre_update',array('server_id'=>$ldapserver->server_id,'dn'=>$dn,'update_array'=>$update_array)); run_hook ('pre_update',
array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn']['string'],'update_array'=>$entry['update']));
# Check for delete attributes (indicated by the attribute entry appearing like this: attr => '' # Check for delete attributes (indicated by the attribute entry appearing like this: attr => ''
foreach ($update_array as $attr => $val) foreach ($entry['update'] as $attr => $val) {
if (! is_array($val)) if (! is_array($val)) {
if (array_key_exists($attr,$skip_array)) if (array_key_exists($attr,$entry['skip'])) {
unset($update_array[$attr]); unset($entry['update'][$attr]);
elseif ($val == '') } elseif ($val == '') {
$update_array[$attr] = array(); $entry['update'][$attr] = array();
# Skip change if (! $_SESSION['plaConfig']->isCommandAvailable('attribute_delete'))
else pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete attribute')));
$update_array[$attr] = $val; } else { # Skip change
$entry['update'][$attr] = $val;
else if (! $_SESSION['plaConfig']->isCommandAvailable('attribute_add_value')
if (array_key_exists($attr,$skip_array)) && ! $_SESSION['plaConfig']->isCommandAvailable('attribute_delete_value'))
unset($update_array[$attr]); pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('modify attribute values')));
}
else } else {
if (array_key_exists($attr,$entry['skip'])) {
unset($entry['update'][$attr]);
} else {
foreach ($val as $i => $v) foreach ($val as $i => $v)
$update_array[$attr][$i] = $v; $entry['update'][$attr][$i] = $v;
/* Call the custom callback for each attribute modification if (! $_SESSION['plaConfig']->isCommandAvailable('attribute_add_value')
and verify that it should be modified.*/ && ! $_SESSION['plaConfig']->isCommandAvailable('attribute_delete_value'))
foreach ($update_array as $attr_name => $val) { pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('modify attribute values')));
}
}
}
# Call the custom callback for each attribute modification and verify that it should be modified.
foreach ($entry['update'] as $attr_name => $val) {
# Check to see if this is a unique Attribute # Check to see if this is a unique Attribute
if ($badattr = $ldapserver->checkUniqueAttr($dn,$attr_name,$val)) { if ($badattr = $ldapserver->checkUniqueAttr($entry['dn']['string'],$attr_name,$val)) {
$search_href = sprintf('search.php?search=true&form=advanced&server_id=%s&filter=%s=%s', $href['search'] = sprintf('cmd.php?cmd=search&search=true&form=advanced&server_id=%s&filter=%s=%s',
$ldapserver->server_id,$attr_name,$badattr); $ldapserver->server_id,$attr_name,$badattr);
pla_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.'), pla_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_name,$badattr,$dn,$search_href)); $attr_name,$badattr,$entry['dn']['string'],$href['search']));
} }
if (run_hook('pre_attr_modify', if (run_hook('pre_attr_modify',
array('server_id'=>$ldapserver->server_id,'dn'=>$dn,'attr_name'=>$attr_name,'new_value'=>$val)) !== true) { array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn']['string'],'attr_name'=>$attr_name,'new_value'=>$val)) !== true) {
unset($update_array[$attr_name]); unset($entry['update'][$attr_name]);
$failed_attrs[$attr_name] = $val; $failed_attrs[$attr_name] = $val;
} elseif ($ldapserver->isAttrReadOnly($attr)) } elseif ($ldapserver->isAttrReadOnly($attr)) {
pla_error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'), pla_error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),
htmlspecialchars($attr_name))); htmlspecialchars($attr_name)));
} else {
// binary values
if (isset($_SESSION['submitform'][$attr_name])) {
foreach ($val as $i => $v) {
if (isset($_SESSION['submitform'][$attr_name][$v])) {
foreach ($_SESSION['submitform'][$attr_name][$v] as $file) {
foreach ($file as $data) {
$entry['update'][$attr_name][$i] = $data;
}
}
}
}
}
}
} }
# Perform the modification # Perform the modification
$res = $ldapserver->modify($dn,$update_array); $result = $ldapserver->modify($entry['dn']['string'],$entry['update']);
if ($res) { if ($result) {
# Fire the post modification event to the user's custom callback function. # Fire the post modification event to the user's custom callback function.
$mustRelogin = false; $mustRelogin = false;
foreach ($update_array as $attr_name => $val) { foreach ($entry['update'] as $attr_name => $val) {
run_hook('post_attr_modify', run_hook('post_attr_modify',
array('server_id'=>$ldapserver->server_id,'dn'=>$dn,'attr_name'=>$attr_name,'new_value'=>$val)); array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn']['string'],'attr_name'=>$attr_name,'new_value'=>$val));
/* Was this a user's password modification who is currently /* Was this a user's password modification who is currently
logged in? If so, they need to logout and log back in * logged in? If so, they need to logout and log back in
with the new password. */ * with the new password.
*/
if (0 === strcasecmp($attr_name,'userPassword') && if (0 === strcasecmp($attr_name,'userPassword') &&
in_array($ldapserver->auth_type,array('cookie','session')) && in_array($ldapserver->auth_type,array('cookie','session')) &&
pla_compare_dns($ldapserver->getLoggedInDN(),$dn) === 0) pla_compare_dns($ldapserver->getLoggedInDN(),$entry['dn']['string']) === 0)
$mustRelogin = true; $mustRelogin = true;
} }
run_hook ('post_update',array ('server_id' => $ldapserver->server_id,'dn' => $dn,'update_array' => $update_array)); run_hook('post_update',
array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn']['string'],'update_array'=>$entry['update']));
# If the user password was changed, not tell the to relogin. # If the user password was changed, not tell the to relogin.
if ($mustRelogin) { if ($mustRelogin) {
@ -123,9 +148,6 @@ if ($res) {
include './header.php'; include './header.php';
echo '<body>'; echo '<body>';
echo '<script type="text/javascript" language="javascript">';
echo 'parent.left_frame.location.reload();';
echo '</script>'."\n\n";
echo '<br />'; echo '<br />';
echo '<center>'; echo '<center>';
@ -133,7 +155,7 @@ if ($res) {
echo '<br /><br />'; echo '<br /><br />';
echo _('Since you changed your password, you must now login again with your new password.'); echo _('Since you changed your password, you must now login again with your new password.');
echo '<br />'; echo '<br />';
printf('<a href="login_form.php?server_id=%s">%s...</a>',$ldapserver->server_id, _('Login')); printf('<a href="cmd.php?cmd=login_form&server_id=%s">%s...</a>',$ldapserver->server_id, _('Login'));
echo '</center>'; echo '</center>';
echo '</body>'; echo '</body>';
echo '</html>'; echo '</html>';
@ -141,15 +163,16 @@ if ($res) {
exit; exit;
} }
$redirect_url = sprintf('template_engine.php?server_id=%s&dn=%s',$ldapserver->server_id,$encoded_dn); $redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',$ldapserver->server_id,$entry['dn']['encode']);
foreach ($update_array as $attr => $junk) foreach ($entry['update'] as $attr => $junk)
$redirect_url .= "&modified_attrs[]=$attr"; $redirect_url .= "&modified_attrs[]=$attr";
foreach ($failed_attrs as $attr => $junk) foreach ($failed_attrs as $attr => $junk)
$redirect_url .= "&failed_attrs[]=$attr"; $redirect_url .= "&failed_attrs[]=$attr";
header("Location: $redirect_url"); header("Location: $redirect_url");
die();
} else { } else {
pla_error(_('Could not perform ldap_modify operation.'),$ldapserver->error(),$ldapserver->errno()); pla_error(_('Could not perform ldap_modify operation.'),$ldapserver->error(),$ldapserver->errno());

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/update_confirm.php,v 1.48 2006/10/29 12:49:24 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/update_confirm.php,v 1.49 2007/12/15 07:50:30 wurley Exp $
/** /**
* Takes the results of clicking "Save" in template_engine.php and determines which * Takes the results of clicking "Save" in template_engine.php and determines which
@ -14,107 +14,177 @@
*/ */
require './common.php'; require './common.php';
include './header.php';
if ($ldapserver->isReadOnly()) if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode')); pla_error(_('You cannot perform updates while server is in read-only mode'));
$dn = $_POST['dn']; /***************/
$old_values = $_POST['old_values']; /* get entry */
$new_values = $_POST['new_values']; /***************/
$encoded_dn = rawurlencode($dn);
$rdn = get_rdn($dn);
echo '<body>'; $entry['dn']['string'] = get_request('dn');
printf('<h3 class="title">%s</h3>',htmlspecialchars($rdn)); $entry['dn']['encode'] = rawurlencode($entry['dn']['string']);
printf('<h3 class="subtitle">%s: <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>',
_('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($dn));
echo "\n\n";
run_hook('pre_update_array_processing',array('server_id'=>$ldapserver->server_id, if (! $entry['dn']['string'] || ! $ldapserver->dnExists($entry['dn']['string']))
'dn'=>$dn,'old_values'=>$old_values,'new_values'=>$new_values)); pla_error(sprintf(_('The entry (%s) does not exist.'),htmlspecialchars($entry['dn']['string'])),null,-1,true);
$update_array = array(); $tree = get_cached_item($ldapserver->server_id,'tree');
foreach ($old_values as $attr => $old_val) { $entry['ldap'] = null;
# Did the user delete the field? if ($tree) {
if (! isset($new_values[$attr])) $entry['ldap'] = $tree->getEntry($entry['dn']['string']);
$update_array[$attr] = '';
# Did the user change the field? if (! $entry['ldap'])
elseif ($old_val !== $new_values[$attr]) { $tree->addEntry($entry['dn']['string']);
$new_val = $new_values[$attr];
# Special case for userPassword attributes $entry['ldap'] = $tree->getEntry($entry['dn']['string']);
if (strcasecmp($attr,'userPassword') == 0) { }
foreach ($new_val as $key => $userpassword) {
if (trim($userpassword)) if (! $entry['ldap'] || $entry['ldap']->isReadOnly())
$new_val[$key] = password_hash($userpassword,$_POST['enc_type'][$key]); pla_error(sprintf(_('The entry (%s) is in readonly mode.'),htmlspecialchars($entry['dn']['string'])),null,-1,true);
else
unset($new_val[$key]); /***************/
/* old values */
/***************/
$entry['values']['old'] = array();
foreach ($entry['ldap']->getAttributes() as $old_attr) {
$name = $old_attr->getName();
$entry['values']['old'][$name] = array();
foreach ($old_attr->getValues() as $old_val) {
if (strlen($old_val) > 0)
$entry['values']['old'][$name][] = $old_val;
}
}
/***************/
/* new values */
/***************/
eval('$reader = new '.$_SESSION['plaConfig']->GetValue('appearance','entry_reader').'($ldapserver);');
$entry['ldap']->accept($reader);
$entry['values']['new'] = array();
foreach ($entry['ldap']->getAttributes() as $new_attr) {
if ($new_attr->hasBeenModified()) {
$name = $new_attr->getName();
if (!isset($entry['values']['old'][$name]))
$entry['values']['old'][$name] = array();
$entry['values']['new'][$name] = array();
foreach ($new_attr->getValues() as $i => $new_val) {
if ($new_attr instanceof BinaryAttribute) {
$n = $new_attr->getFileName($i);
$p = $new_attr->getFilePath($i);
$new_val = md5("$n|$p");
} }
$password_already_hashed = true; if (strlen($new_val) > 0)
$entry['values']['new'][$name][] = $new_val;
# Special case for samba password
} elseif (strcasecmp($attr,'sambaNTPassword') == 0 && trim($new_val[0])) {
$sambapassword = new smbHash;
$new_val[0] = $sambapassword->nthash($new_val[0]);
# Special case for samba password
} elseif (strcasecmp($attr,'sambaLMPassword') == 0 && trim($new_val[0])) {
$sambapassword = new smbHash;
$new_val[0] = $sambapassword->lmhash($new_val[0]);
}
# Retest in case our now encoded password is the same.
if ($new_val === $old_val)
continue;
if ($new_val)
$update_array[$attr] = $new_val;
}
}
# Check user password with new encoding.
if (isset($new_values['userpassword']) && is_array($new_values['userpassword'])) {
foreach ($new_values['userpassword'] as $key => $userpassword) {
if ($userpassword) {
if ($old_values['userpassword'][$key] == $new_values['userpassword'][$key] &&
get_enc_type($old_values['userpassword'][$key]) == $_POST['enc_type'][$key])
continue;
$new_values['userpassword'][$key] = password_hash($userpassword,$_POST['enc_type'][$key]);
} }
} }
if ($old_values['userpassword'] != $new_values['userpassword'])
$update_array['userpassword'] = $new_values['userpassword'];
} }
# strip empty vals from update_array and ensure consecutive indices for each attribute /************************/
foreach ($update_array as $attr => $val) { /* objectClass deletion */
if (is_array($val)) { /************************/
foreach($val as $i => $v)
if (null == $v || 0 == strlen($v))
unset($update_array[$attr][$i]);
$update_array[$attr] = array_values($update_array[$attr]); $oc_to_delete = array();
$attr_to_delete = array();
// if objectClass attribute is modified
if (isset($entry['values']['new']['objectClass'])) {
if (!isset($entry['values']['old']['objectClass'])) {
pla_error(_('An entry should have one structural objectClass.'));
}
// deleted objectClasses
foreach ($entry['values']['old']['objectClass'] as $oldOC) {
if (!in_array($oldOC, $entry['values']['new']['objectClass'])) {
$oc_to_delete[] = $oldOC;
}
}
// search the attributes used by each deleted objecClass
// we must maybe delete these attributes
foreach ($oc_to_delete as $oc) {
$soc = $ldapserver->getSchemaObjectClass($oc);
if ($soc) {
$ocs = $ldapserver->SchemaObjectClasses();
$ma = $soc->getMustAttrs($ocs);
foreach ($ma as $a) {
if (!isset($attr_to_delete[$a->getName()])) {
$attr_to_delete[$a->getName()] = $a;
}
}
$ma = $soc->getMayAttrs($ocs);
foreach ($ma as $a) {
if (!isset($attr_to_delete[$a->getName()])) {
$attr_to_delete[$a->getName()] = $a;
}
}
}
}
// if an attribute is still used by an objectClass we don't delete,
// we don't delete this attribute
foreach ($attr_to_delete as $name => $ad) {
$found = false;
$at = $ldapserver->getSchemaAttribute($name);
foreach ($at->getUsedInObjectClasses() as $oc) {
if (in_array($oc, $entry['values']['new']['objectClass'])) {
$found = true;
break;
}
}
if (!$found) {
foreach ($at->getRequiredByObjectClasses() as $oc) {
if (in_array($oc, $entry['values']['new']['objectClass'])) {
$found = true;
break;
}
}
}
if ($found) {
unset($attr_to_delete[$name]);
} else {
if (isset($entry['values']['old'][$name]) && (count($entry['values']['old'][$name]) > 0)) {
$found = true;
} else {
foreach ($entry['values']['new'] as $attr_name => $attr_values) {
if ($name == $attr_name) {
$found = true;
break;
}
}
}
if (!$found) {
unset($attr_to_delete[$name]);
} else {
$entry['values']['new'][$name] = array();
$attr_to_delete[$name] = $name;
}
}
} }
} }
/* At this point, the update_array should look like this (example): /****************/
Array( /* update array */
cn => Array( /****************/
[0] => 'Dave',
[1] => 'Bob')
sn => 'Smith',
telephoneNumber => '555-1234')
This array should be ready to be passed to ldap_modify() */
run_hook('post_update_array_processing',array('server_id'=>$ldapserver->server_id, eval('$writer = new '.$_SESSION['plaConfig']->GetValue('appearance','entry_writer').'($ldapserver);');
'dn'=>$dn,'update_array'=>$update_array)); $writer->draw('Title',$entry['ldap']);
$writer->draw('Subtitle',$entry['ldap']);
if (count($update_array) > 0) { echo "\n\n";
run_hook('pre_update_array_processing',
array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn']['string'],'old_values'=>$entry['values']['old'],'new_values'=>$entry['values']['new']));
/***************/
/* confirm */
/***************/
if (count($entry['values']['new']) > 0) {
echo '<br />'; echo '<br />';
echo '<center>'; echo '<center>';
echo _('Do you want to make these changes?'); echo _('Do you want to make these changes?');
@ -122,44 +192,47 @@ if (count($update_array) > 0) {
# <!-- Commit button and acompanying form --> # <!-- Commit button and acompanying form -->
echo "\n\n"; echo "\n\n";
echo '<form action="update.php" method="post">'; echo '<form action="cmd.php" method="post">';
echo '<input type="hidden" name="cmd" value="update" />';
echo "\n"; echo "\n";
echo '<table class="confirm">'; echo '<table class="confirm">';
echo "\n"; echo "\n";
printf('<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>', printf('<tr class="heading"><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>',
_('Attribute'),_('Old Value'),_('New Value'),_('Skip')); _('Attribute'),_('Old Value'),_('New Value'),_('Skip'));
echo "\n\n"; echo "\n\n";
$counter = 0; $counter = 0;
run_hook('pre_display_update_array',array('server_id'=>$ldapserver->server_id,'dn'=>$dn, $friendly_attrs = $_SESSION['plaConfig']->friendly_attrs;
'update_array'=>$update_array)); foreach ($entry['values']['new'] as $attr => $new_val) {
foreach ($update_array as $attr => $new_val) {
$counter++; $counter++;
if (! array_key_exists($attr,$old_values) or ! array_key_exists($attr,$new_values))
continue;
printf('<tr class="%s">',$counter%2 ? 'even' : 'odd'); printf('<tr class="%s">',$counter%2 ? 'even' : 'odd');
printf('<td><b>%s</b></td>',htmlspecialchars($attr)); echo '<td><b>';
$attr_display = isset($friendly_attrs[strtolower($attr)]) ? $friendly_attrs[strtolower($attr)] : $attr;
if (strcmp($attr,$attr_display) && $_SESSION['plaConfig']->isCommandAvailable('schema')) {
printf('<acronym title="Alias for %s">%s</acronym>',$attr,htmlspecialchars($attr_display));
} else {
echo htmlspecialchars($attr_display);
}
echo '</b></td>';
echo '<td><span style="white-space: nowrap;">'; echo '<td><span style="white-space: nowrap;">';
if (strcasecmp($attr,'userPassword') == 0) { if (strcasecmp($attr,'userPassword') == 0) {
foreach ($old_values[$attr] as $key => $value) { foreach ($entry['values']['old'][$attr] as $key => $value) {
if (obfuscate_password_display(get_enc_type($old_values[$attr][$key]))) if (obfuscate_password_display(get_enc_type($entry['values']['old'][$attr][$key])))
echo preg_replace('/./','*',$old_values[$attr][$key]).'<br />'; echo preg_replace('/./','*',$entry['values']['old'][$attr][$key]).'<br />';
else else
echo nl2br(htmlspecialchars($old_values[$attr][$key])).'<br />'; echo nl2br(htmlspecialchars($entry['values']['old'][$attr][$key])).'<br />';
} }
} elseif (is_array($old_values[$attr])) } elseif (is_array($entry['values']['old'][$attr]))
foreach ($old_values[$attr] as $v) foreach ($entry['values']['old'][$attr] as $v)
echo nl2br(htmlspecialchars($v)).'<br />'; echo nl2br(htmlspecialchars($v)).'<br />';
else else
echo nl2br(htmlspecialchars($old_values[$attr])).'<br />'; echo nl2br(htmlspecialchars($entry['values']['old'][$attr])).'<br />';
echo '</span></td>'; echo '</span></td>';
echo '<td><span style="white-space: nowrap;">'; echo '<td><span style="white-space: nowrap;">';
@ -167,7 +240,7 @@ if (count($update_array) > 0) {
# Is this a multi-valued attribute? # Is this a multi-valued attribute?
if (is_array($new_val)) { if (is_array($new_val)) {
if (strcasecmp($attr,'userPassword') == 0) { if (strcasecmp($attr,'userPassword') == 0) {
foreach ($new_values[$attr] as $key => $value) { foreach ($entry['values']['new'][$attr] as $key => $value) {
if (isset($new_val[$key])) { if (isset($new_val[$key])) {
if (obfuscate_password_display(get_enc_type($new_val[$key]))) if (obfuscate_password_display(get_enc_type($new_val[$key])))
echo preg_replace('/./','*',$new_val[$key]).'<br />'; echo preg_replace('/./','*',$new_val[$key]).'<br />';
@ -179,51 +252,59 @@ if (count($update_array) > 0) {
} else { } else {
foreach ($new_val as $i => $v) { foreach ($new_val as $i => $v) {
if ($v == '') {
# Remove it from the update array if it's empty
unset($update_array[$attr][$i]);
$update_array[$attr] = array_values($update_array[$attr]);
} else {
echo nl2br(htmlspecialchars($v)).'<br />'; echo nl2br(htmlspecialchars($v)).'<br />';
}
} }
} }
/* was this a multi-valued attribute deletion? If so, if (! $new_val) {
fix the $update_array to reflect that per update_confirm.php's
expectations */
if ($update_array[$attr] == array(0=>'') || $update_array[$attr] == array()) {
$update_array[$attr] = '';
printf('<span style="color: red">%s</span>',_('[attribute deleted]')); printf('<span style="color: red">%s</span>',_('[attribute deleted]'));
} }
} elseif ($new_val != '') } elseif ($new_val == '')
printf('<span style="color: red">%s</span>',_('[attribute deleted]')); printf('<span style="color: red">%s</span>',_('[attribute deleted]'));
echo '</span></td>'; echo '</span></td>';
printf('<td><input name="skip_array[%s]" type="checkbox" /></td>',htmlspecialchars($attr)); $input_disabled = '';
if (in_array($attr, $attr_to_delete)) $input_disabled = 'disabled="disabled"';
$input_onclick = '';
if ($attr == 'objectClass' && (count($attr_to_delete) > 0)) {
$input_onclick = 'onclick="if (this.checked) {';
foreach ($attr_to_delete as $ad_name) {
$input_onclick .= "document.forms[0].elements['skip_array[$ad_name]'].disabled = false;";
$input_onclick .= "document.forms[0].elements['skip_array[$ad_name]'].checked = true;";
}
$input_onclick .= '} else {';
foreach ($attr_to_delete as $ad_name) {
$input_onclick .= "document.forms[0].elements['skip_array[$ad_name]'].checked = false;";
$input_onclick .= "document.forms[0].elements['skip_array[$ad_name]'].disabled = true;";
}
$input_onclick .= '}"';
}
printf('<td><input name="skip_array[%s]" type="checkbox" %s %s/></td>',htmlspecialchars($attr),$input_disabled,$input_onclick);
echo '</tr>'."\n\n"; echo '</tr>'."\n\n";
} }
run_hook('post_display_update_array',array('server_id'=>$ldapserver->server_id,'dn'=>$dn,
'update_array'=>$update_array,'index'=>$counter));
echo '</table><table class="form">'; echo '</table><table class="form">';
echo '<tr>'; echo '<tr>';
echo '<td>'; echo '<td>';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id); printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="hidden" name="dn" value="%s" />',$dn); printf('<input type="hidden" name="dn" value="%s" />',$entry['dn']['string']);
foreach ($update_array as $attr => $val) { foreach ($entry['values']['new'] as $attr => $val) {
if (is_array($val)) if (count($val) > 0) {
foreach($val as $i => $v) if (is_array($val)) {
printf('<input type="hidden" name="update_array[%s][%s]" value="%s" />', foreach($val as $i => $v)
htmlspecialchars($attr),$i,htmlspecialchars($v)); printf('<input type="hidden" name="update_array[%s][%s]" value="%s" />',
else htmlspecialchars($attr),$i,htmlspecialchars($v));
printf('<input type="hidden" name="update_array[%s]" value="%s" />', } else {
htmlspecialchars($attr),htmlspecialchars($val)); printf('<input type="hidden" name="update_array[%s]" value="%s" />',
htmlspecialchars($attr),htmlspecialchars($val));
}
} else {
printf('<input type="hidden" name="update_array[%s]" value="" />',
htmlspecialchars($attr));
}
} }
printf('<input type="submit" value="%s" class="happy" />',_('Commit')); printf('<input type="submit" value="%s" class="happy" />',_('Commit'));
@ -234,15 +315,39 @@ if (count($update_array) > 0) {
echo '</tr>'; echo '</tr>';
echo '</table>'; echo '</table>';
echo '</form>'; echo '</form>';
if (count($attr_to_delete) > 0) {
echo '<table class="form"><tr><td><br/>';
echo _('The deletion of objectClass(es)');
echo _(':');
echo ' <b>';
echo implode('</b>, <b>', $oc_to_delete);
echo '</b><br/>';
echo _('will delete the attribute(s)');
echo _(':');
echo ' <b>';
$i = 0;
foreach ($attr_to_delete as $attr) {
if ($i++ != 0) echo '</b>, <b>';
$attr_display = isset($friendly_attrs[strtolower($attr)]) ? $friendly_attrs[strtolower($attr)] : $attr;
if (strcmp($attr,$attr_display) && $_SESSION['plaConfig']->isCommandAvailable('schema')) {
printf('<acronym title="Alias for %s">%s</acronym>',$attr,htmlspecialchars($attr_display));
} else {
echo htmlspecialchars($attr_display);
}
}
echo '</b></td></tr></table>';
}
echo '</center>'; echo '</center>';
} else { } else {
echo '<center>'; echo '<center>';
echo _('You made no changes'); echo _('You made no changes');
printf(' <a href="template_engine.php?server_id=%s&amp;dn=%s">%s</a>.', $href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',
$ldapserver->server_id,$encoded_dn,_('Go back')); $ldapserver->server_id,$entry['dn']['encode']);
printf(' <a href="%s">%s</a>.',htmlspecialchars($href),_('Go back'));
echo '</center>'; echo '</center>';
} }
echo '</body>';
?> ?>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/view_jpeg_photo.php,v 1.10 2005/12/10 10:34:54 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/view_jpeg_photo.php,v 1.11 2007/12/15 07:50:30 wurley Exp $
/** /**
* @package phpLDAPadmin * @package phpLDAPadmin
@ -9,25 +9,29 @@
require './common.php'; require './common.php';
$file = $_GET['file']; $file['name'] = get_request('file','GET');
/* Security check (we don't want anyone tryting to get at /etc/passwd or something) /* Security check (we don't want anyone tryting to get at /etc/passwd or something)
Slashes and dots are not permitted in these names.*/ * Slashes and dots are not permitted in these names.
if (! preg_match('/^pla/',$file) || preg_match('/[\.\/\\\\]/',$file)) */
pla_error(sprintf('%s %s',_('Unsafe file name: '),htmlspecialchars($file))); if (! preg_match('/^pla/',$file['name']) || preg_match('/[\.\/\\\\]/',$file['name']))
pla_error(sprintf('%s: %s',_('Unsafe file name'),htmlspecialchars($file['name'])));
/* Little security measure here (prevents users from accessing /* Little security measure here (prevents users from accessing
files, like /etc/passwd for example).*/ files, like /etc/passwd for example).*/
$file = basename(addcslashes($file,'/\\')); $file['name'] = basename(addcslashes($file['name'],'/\\'));
$file = sprintf('%s/%s',$config->GetValue('jpeg','tmpdir'),$file); $file['name'] = sprintf('%s/%s',$_SESSION['plaConfig']->GetValue('jpeg','tmpdir'),$file['name']);
if (! file_exists($file)) if (! file_exists($file['name']))
pla_error(sprintf('%s %s',_('No such file: '),htmlspecialchars($_GET['file']))); pla_error(sprintf('%s%s %s',_('No such file'),_(':'),htmlspecialchars($file['name'])));
$f = fopen($file,'r'); $file['handle'] = fopen($file['name'],'r');
$jpeg = fread($f,filesize($file)); $file['data'] = fread($file['handle'],filesize($file['name']));
fclose($f); fclose($file['handle']);
if (ob_get_level())
ob_clean();
Header('Content-type: image/jpeg'); Header('Content-type: image/jpeg');
Header('Content-disposition: inline; filename=jpeg_photo.jpg'); Header('Content-disposition: inline; filename=jpeg_photo.jpg');
echo $jpeg; echo $file['data'];
?> ?>

View File

@ -1,38 +1,47 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/welcome.php,v 1.25 2005/12/10 10:34:54 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/welcome.php,v 1.26 2007/12/15 07:50:30 wurley Exp $
/** /**
* @package phpLDAPadmin * @package phpLDAPadmin
*/ */
/** /**
*/ */
require './common.php'; require './common.php';
include './header.php';
# Close the session for faster page loading echo '<center>';
pla_session_close(); echo '<br /><br />';
printf('<img src="images/logo.jpg" title="%s" alt="%s" />',
_('phpLDAPadmin logo'),
_('phpLDAPadmin logo'));
echo '<br /><br />';
echo _('Use the menu to the left to navigate');
echo '<br /><br />';
$links = '';
if ($_SESSION['plaConfig']->isCommandAvailable('external_links')) {
if ($_SESSION['plaConfig']->isCommandAvailable('external_links', 'credits')) {
$links .= sprintf('<a href="%s" target="new">%s</a>',get_href('credits'),_('Credits'));
}
if ($_SESSION['plaConfig']->isCommandAvailable('external_links', 'help')) {
if ($links) $links .= ' | ';
$links .= sprintf('<a href="%s" target="new">%s</a>',get_href('documentation'),_('Documentation'));
}
if ($_SESSION['plaConfig']->isCommandAvailable('external_links', 'donation')) {
if ($links) $links .= ' | ';
$links .= sprintf('<a href="%s" target="new">%s</a>',get_href('donate'),_('Donate'));
}
}
if ($links) {
echo $links;
echo '<br /><br />';
}
echo '</center>';
?> ?>
<body>
<center>
<br />
<br />
<br />
<img src="images/logo.jpg" title="<?php echo _('phpLDAPadmin logo'); ?>" alt="<?php echo _('phpLDAPadmin logo'); ?>" />
<br />
<br />
<?php echo _('Use the menu to the left to navigate'); ?>
<br />
<br />
<br />
<br />
<?php if (! $config->GetValue('appearance','hide_configuration_management')) { ?>
<a href="<?php echo get_href('credits'); ?>"><?php echo _('Credits'); ?></a> |
<a href="<?php echo get_href('documentation'); ?>"><?php echo _('Documentation'); ?></a> |
<a href="<?php echo get_href('donate'); ?>"><?php echo _('Donate'); ?></a>
<?php } ?>
</center>
</body>
</html>

View File

@ -1,4 +1,5 @@
<?php <?php
# You should secure your PLA by making the htdocs/ your docroot. # You should secure your PLA by making the htdocs/ your docroot.
header('Location: htdocs/index.php'); header('Location: htdocs/index.php');
die();
?> ?>

375
lib/AJAXTree.php Normal file
View File

@ -0,0 +1,375 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/AJAXTree.php,v 1.2 2007/12/15 07:50:31 wurley Exp $
/**
* @package phpLDAPadmin
* @author The phpLDAPadmin development team
* @author Xavier Bruyet
*/
class AJAXTree extends PLMTree {
/**
* draw a node of the tree
* @param $level a string of 0 and 1 ; $level == "000101" will draw " | |<node>"
* @param $first_child is this the first child ?
* @param $last_child is this the last child ?
*/
protected function draw_dn($dn,$level=0,$first_child=true,$last_child=true) {
if (DEBUG_ENABLED)
debug_log('Entered with (%s,%s)',33,__FILE__,__LINE__,__METHOD__,$dn,$level);
$ldapserver = $this->getLdapServer();
# level pre-treatment
$code = '';
if (is_string($level)) {
for ($i=0; $i<strlen($level); $i++) {
if ($level[$i] == '0') {
$code .= '0';
} elseif ($level[$i] == '1') {
$code .= '1';
}
}
} elseif ($level > 0) {
$code = '0' * $level;
}
$level = strlen($code);
# get entry to display as node
$entry = $this->getEntry($dn);
if (! $entry) {
$this->addEntry($dn);
$entry = $this->getEntry($dn);
}
if (! $entry)
return '';
# some informations
$rdn = $entry->getRdn();
$encoded_dn = rawurlencode($dn);
$formatted_dn = $this->get_formatted_dn($entry,$level-1);
$child_count = $this->get_children_number($entry);
$nb = 0;
if ($first_child) $nb += 1;
if ($last_child) $nb += 2;
# informations array[$nb]
# nb == 1 => the node is the first child
# nb == 2 => the node is the last child
# nb == 3 => the node is the unique child
# nb == 0 => the node is a child
$expand_imgs = array('js/phplayersmenu/menuimages/tree_expand.png', 'js/phplayersmenu/menuimages/tree_expand.png', 'js/phplayersmenu/menuimages/tree_expand_corner.png', ($level > 0) ? 'js/phplayersmenu/menuimages/tree_expand_corner.png' : 'js/phplayersmenu/menuimages/tree_expand_corner_first.png');
$collapse_imgs = array('js/phplayersmenu/menuimages/tree_collapse.png', 'js/phplayersmenu/menuimages/tree_collapse.png', 'js/phplayersmenu/menuimages/tree_collapse_corner.png', ($level > 0) ? 'js/phplayersmenu/menuimages/tree_collapse_corner.png' : 'js/phplayersmenu/menuimages/tree_collapse_corner_first.png');
$tree_imgs = array('js/phplayersmenu/menuimages/tree_split.png', 'js/phplayersmenu/menuimages/tree_split.png', 'js/phplayersmenu/menuimages/tree_corner.png', 'js/phplayersmenu/menuimages/tree_corner.png');
$new_code = array('1', '1', '0', '0');
# links
$edit_href_params = htmlspecialchars(sprintf('cmd=template_engine&server_id=%s&dn=%s',$this->server_id,$encoded_dn));
$edit_href = "cmd.php?$edit_href_params";
$openclose_params = htmlspecialchars(sprintf('server_id=%s&dn=%s&code=%s',$this->server_id,$encoded_dn,$code.$new_code[$nb]));
# each node has a unique id based on dn
$node_id = 'node'.base64_encode($ldapserver->server_id.'-'.$dn);
$node_id = str_replace('=','_',$node_id);
if ($level == 0)
printf('<tr><td class="spacer"></td><td colspan="%s">',$this->getDepth()+3-1);
printf('<div id="jt%s" class="treemenudiv">',$node_id);
echo $this->get_indentation($code);
if ($entry->isOpened()) {
if (! $child_count) {
echo '<img align="top" border="0" class="imgs" id="jt'.$node_id.'node" src="'.$tree_imgs[$nb].'" alt="--" />';
} else {
echo '<a href="#" onclick="return opencloseTreeNode(\''.$node_id.'\',\''.$openclose_params.'\');">';
echo '<img align="top" border="0" class="imgs" id="jt'.$node_id.'node" src="'.$collapse_imgs[$nb].'" alt="+-" />';
echo '</a>';
}
} else {
if (($child_count !== false) && (!$child_count)/* && (!$ldapserver->isShowCreateEnabled())*/) {
echo '<img align="top" border="0" class="imgs" id="jt'.$node_id.'node" src="'.$tree_imgs[$nb].'" alt="--" />';
} else {
echo '<a href="#" onclick="return opencloseTreeNode(\''.$node_id.'\',\''.$openclose_params.'\');">';
echo '<img align="top" border="0" class="imgs" id="jt'.$node_id.'node" src="'.$expand_imgs[$nb].'" alt="+-" />';
echo '</a>';
}
}
echo '<a href="'.$edit_href.'" onclick="return displayMainPage(\''.$edit_href_params.'\');" title="'.$dn.'" >';
echo '<img align="top" border="0" class="imgs" id="jt'.$node_id.'folder" src="images/'.$entry->getIcon($ldapserver).'" alt="->" />';
echo '</a>';
echo '&nbsp;';
echo '<a href="'.$edit_href.'" onclick="return displayMainPage(\''.$edit_href_params.'\');" title="'.$dn.'" class="phplm">';
echo $formatted_dn;
echo ($child_count ? ' ('.$child_count.')' : '');
echo '</a>';
echo '</div>';
echo '<div id="jt'.$node_id.'son" style="display: '.($entry->isOpened() ? 'block' : 'none').'" class="treemenudiv">';
if ($entry->isOpened()) {
$this->draw_children($entry,$code.$new_code[$nb]);
}
echo '</div>';
if ($level == 0) {
echo '</td></tr>';
}
}
public function draw_children($parent_entry,$code) {
if (DEBUG_ENABLED)
debug_log('Entered with (%s,%s)',33,__FILE__,__LINE__,__METHOD__,$parent_entry,$code);
$children = array();
foreach($parent_entry->getChildren() as $childDn)
$children[] = $this->getEntry($childDn);
$first_child = $this->get_plm_before_first_child($parent_entry,$code);
$last_child = $this->get_plm_after_last_child($parent_entry,$code);
echo $first_child;
for ($i=0; $i<count($children); $i++) {
$first = ($i == 0) && (! $first_child);
$last = ($i == (count($children)-1)) && (! $last_child);
$this->draw_dn($children[$i]->getDn(),$code,$first,$last);
}
echo $last_child;
}
/**
* return the indentation bafore a node
* @param $code a string of 0 and 1 ; $code == "000101" will return " | |"
*/
protected function get_indentation($code) {
$indent = '';
for ($i=0; $i<strlen($code); $i++) {
if ($code[$i] == '0') {
$indent .= '<img align="top" border="0" class="imgs" src="js/phplayersmenu/menuimages/tree_space.png" alt=" " />';
} elseif ($code[$i] == '1') {
$indent .= '<img align="top" border="0" class="imgs" src="js/phplayersmenu/menuimages/tree_vertline.png" alt="| " />';
}
}
return $indent;
}
protected function draw_javascript() {
echo '
<script type="text/javascript" language="javascript" src="js/phplayersmenu/libjs/layersmenu-browser_detection.js"></script>
<script type="text/javascript" language="javaScript">
<!--
var collapsedNodes = new Array();
var nodeLayer = null;
var sonLayer = null;
var oldstyle = \'\';
var newstyle = \'\';
var oldimg = \'\';
var newimg = \'\';
function readCollapsedNodes() {
collapsedNodes = new Array();
cn = document.cookie.split(\'collapsedNodes=\');
if (cn.length < 2) return;
vl = cn[1];
if (vl.indexOf(\';\') != -1) {
vl = vl.split(\';\');
vl = vl[0];
}
if (vl) {
collapsed = vl.split(\'|\');
for (i = 0; i < collapsed.length; i++) {
collapsedNodes[i] = collapsed[i];
}
}
}
function writeCollapsedNodes() {
document.cookie = \'collapsedNodes=\' + collapsedNodes.join(\'|\') + \';path=/\';
}
function addCollapsedNode(nodeId) {
for (i = 0; i < collapsedNodes.length; i++) {
if (collapsedNodes[i] == nodeId) return;
}
collapsedNodes[collapsedNodes.length] = nodeId;
writeCollapsedNodes();
}
function delCollapsedNode(nodeId) {
newCollapsedNodes = new Array();
j = 0;
for (i = 0; i < collapsedNodes.length; i++) {
if (collapsedNodes[i] != nodeId) {
newCollapsedNodes[j++] = collapsedNodes[i];
}
}
collapsedNodes = newCollapsedNodes;
writeCollapsedNodes();
}
function updateNewStyle() {
nodeLayer.src = newimg;
sonLayer.style.display = newstyle;
}
function cancelNewStyle() {
nodeLayer.src = oldimg;
sonLayer.style.display = oldstyle;
}
function alertTreeNodeContents(html) {
//alert(html);
if (html.replace(/(^\s*)|(\s*$)/g, \'\')) {
includeHTML(sonLayer, html);
}
updateNewStyle();
}
function opencloseTreeNode(nodeid, params) {
cancelHttpRequest(); // cancel last request
// get the node element
if ((!DOM || Opera56 || Konqueror22) && !IE4) return;
if (!IE4) {
sonLayer = document.getElementById(\'jt\' + nodeid + \'son\');
nodeLayer = document.getElementById(\'jt\' + nodeid + \'node\');
//folderLayer = document.getElementById(\'jt\' + nodeid + \'folder\');
} else {
sonLayer = document.all(\'jt\' + nodeid + \'son\');
nodeLayer = document.all(\'jt\' + nodeid + \'node\');
//folderLayer = document.all(\'jt\' + nodeid + \'folder\');
}
if (!sonLayer || !nodeLayer) return false;
// update global variables
oldstyle = sonLayer.style.display;
oldimg = nodeLayer.src;
var action = 0; // (action = 1) => expand ; (action = 2) => collapse
if (oldimg.indexOf(\'js/phplayersmenu/menuimages/tree_expand.png\') > -1) {
newimg = \'js/phplayersmenu/menuimages/tree_collapse.png\';
action = 1;
} else if (oldimg.indexOf(\'js/phplayersmenu/menuimages/tree_expand_first.png\') > -1) {
newimg = \'js/phplayersmenu/menuimages/tree_collapse_first.png\';
action = 1;
} else if (oldimg.indexOf(\'js/phplayersmenu/menuimages/tree_expand_corner.png\') > -1) {
newimg = \'js/phplayersmenu/menuimages/tree_collapse_corner.png\';
action = 1;
} else if (oldimg.indexOf(\'js/phplayersmenu/menuimages/tree_expand_corner_first.png\') > -1) {
newimg = \'js/phplayersmenu/menuimages/tree_collapse_corner_first.png\';
action = 1;
} else if (oldimg.indexOf(\'js/phplayersmenu/menuimages/tree_collapse.png\') > -1) {
newimg = \'js/phplayersmenu/menuimages/tree_expand.png\';
action = 2;
} else if (oldimg.indexOf(\'js/phplayersmenu/menuimages/tree_collapse_first.png\') > -1) {
newimg = \'js/phplayersmenu/menuimages/tree_expand_first.png\';
action = 2;
} else if (oldimg.indexOf(\'js/phplayersmenu/menuimages/tree_collapse_corner.png\') > -1) {
newimg = \'js/phplayersmenu/menuimages/tree_expand_corner.png\';
action = 2;
} else if (oldimg.indexOf(\'js/phplayersmenu/menuimages/tree_collapse_corner_first.png\') > -1) {
newimg = \'js/phplayersmenu/menuimages/tree_expand_corner_first.png\';
action = 2;
}
//folderLayer.src = \'js/phplayersmenu/menuimages/tree_folder_open.png\';
//folderLayer.src = \'js/phplayersmenu/menuimages/tree_folder_closed.png\';
nodeLayer.src = \'images/ajax-spinner.gif\';
// perform action
if (action == 2) {
newstyle = \'none\';
//makeGETRequest(\'cmd.php\', params+\'&cmd=draw_tree_node&action=0\', \'alertTreeNodeContents\', \'cancelNewStyle\');
updateNewStyle();
addCollapsedNode(nodeid);
} else if (action == 1) {
newstyle = \'block\';
if (sonLayer.innerHTML == \'\') {
makeGETRequest(\'cmd.php\', params+\'&cmd=draw_tree_node&action=1\', \'alertTreeNodeContents\', \'cancelNewStyle\');
} else {
//makeGETRequest(\'cmd.php\', params+\'&cmd=draw_tree_node&action=2\', \'alertTreeNodeContents\', \'cancelNewStyle\');
updateNewStyle();
}
delCollapsedNode(nodeid);
}
return false;
}
function getMainPageDiv() {
if (!IE4) {
return document.getElementById(\'main_page\');
} else {
return document.all(\'main_page\');
}
}
function alertMainPage(html) {
//alert(html);
var mainPageDiv = getMainPageDiv();
if (mainPageDiv) includeHTML(mainPageDiv, html);
}
function cancelMainPage() {
var mainPageDiv = getMainPageDiv();
if (mainPageDiv) includeHTML(mainPageDiv, \'\');
}
function displayMainPage(urlParameters) {
var mainPageDiv = getMainPageDiv();
if (mainPageDiv) includeHTML(mainPageDiv, \'<img src="images/ajax-progress.gif"><br><small>'._('Retrieving DN').'...<\/small>\');
makeGETRequest(\'cmd.php\', urlParameters+\'&meth=get_body\', \'alertMainPage\', \'cancelMainPage\');
return false;
}
// close initial collapsed nodes
readCollapsedNodes();
for (k = 0; k < collapsedNodes.length; k++) {
opencloseTreeNode(collapsedNodes[k], \'#\');
}
// -->
</script>';
}
protected function get_plm_before_first_child($entry,$level) {
if (strlen($level) == 0) return '';
$ldapserver = $this->getLdapServer();
$output = '';
if (!$ldapserver->isReadOnly() && ($entry->getChildrenNumber() > 10) && ($ldapserver->isShowCreateEnabled())) {
$encoded_dn = rawurlencode($entry->getDn());
$href = sprintf('cmd.php?cmd=template_engine&server_id=%s&container=%s',$ldapserver->server_id,$encoded_dn);
$output .= $this->get_indentation($level);
$output .= '<img align="top" border="0" class="imgs" src="js/phplayersmenu/menuimages/tree_split.png" alt="--" />';
$output .= '<a href="'.htmlspecialchars($href).'" title="'.$entry->getDn().'">';
$output .= '<img align="top" border="0" class="imgs" src="images/star.png" alt="->" />';
$output .= '</a>';
$output .= '&nbsp;';
$output .= '<a href="'.htmlspecialchars($href).'" title="'._('Create new entry here').'" class="phplm">';
$output .= _('Create new entry here');
$output .= '</a>';
}
return $output;
}
protected function get_plm_after_last_child($entry,$level) {
if (strlen($level) == 0) return '';
$ldapserver = $this->getLdapServer();
$output = '';
if (!$ldapserver->isReadOnly() && !$entry->isLeaf() && $ldapserver->isShowCreateEnabled()) {
$encoded_dn = rawurlencode($entry->getDn());
$href = sprintf('cmd.php?cmd=template_engine&server_id=%s&container=%s',$ldapserver->server_id,$encoded_dn);
$output .= $this->get_indentation($level);
$output .= '<img align="top" border="0" class="imgs" src="js/phplayersmenu/menuimages/tree_corner.png" alt="--" />';
$output .= '<a href="'.htmlspecialchars($href).'" title="'.$entry->getDn().'">';
$output .= '<img align="top" border="0" class="imgs" src="images/star.png" alt="->" />';
$output .= '</a>';
$output .= '&nbsp;';
$output .= '<a href="'.htmlspecialchars($href).'" title="'._('Create new entry here').'" class="phplm">';
$output .= _('Create new entry here');
$output .= '</a>';
}
return $output;
}
}
?>

280
lib/Attribute.php Normal file
View File

@ -0,0 +1,280 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/Attribute.php,v 1.2 2007/12/15 07:50:31 wurley Exp $
/**
* @package phpLDAPadmin
* @author Xavier Bruyet
*
* Represents an attribute of a entry
*/
class Attribute {
private $name;
private $values;
# min/max number of values
protected $min_value_count;
protected $max_value_count;
# The entry in which the attribute is
protected $entry;
# Is the attribute internal
protected $internal;
# Has the attribute been modified
protected $modified;
# Is the attribute visible
protected $visible;
# Is the attribute modifiable
protected $readonly;
# Display parameters
protected $friendly_name;
protected $description;
protected $icon;
protected $hint;
protected $size; # Component size
protected $maxlength; # Value max length
protected $properties;
public function __construct($name, $values) {
$this->name = $name;
if (is_string($values) && (strlen($values) > 0)) $this->values = array($values);
elseif (is_array($values)) $this->values = $values;
else $this->values = array();
$this->min_value_count = -1;
$this->max_value_count = -1;
$this->entry = null;
$this->internal = false;
$this->modified = false;
$this->visible = true;
$this->readonly = false;
$this->friendly_name = '';
$this->description = '';
$this->icon = '';
$this->hint = '';
$this->size = 0;
$this->maxlength = 0;
$this->properties = array();
}
public function getName() {
return $this->name;
}
public function getValues() {
return $this->values;
}
public function getValueCount() {
return count($this->values);
}
public function addValue($new_val, $i = -1) {
if ($i < 0) $i = $this->getValueCount();
$old_val = $this->getValue($i);
if (is_null($old_val) || ($old_val != $new_val)) $this->justModified();
$this->values[$i] = $new_val;
}
public function getValue($i) {
if (isset($this->values[$i])) return ''.$this->values[$i];
else return null;
}
public function getMinValueCount() {
return $this->min_value_count;
}
public function setMinValueCount($min) {
$this->min_value_count = $min;
}
public function getMaxValueCount() {
return $this->max_value_count;
}
public function setMaxValueCount($max) {
$this->max_value_count = $max;
}
public function getEntry() {
return $this->entry;
}
public function setEntry($entry) {
$this->entry = $entry;
global $ldapserver;
$schema_attr = null;
if ($entry) {
$schema_attr = $ldapserver->getSchemaAttribute($this->getName(), $entry->getDn());
}
if ($schema_attr && $schema_attr->getIsSingleValue()) {
$this->setMaxValueCount(1);
}
}
public function justModified() {
$this->modified = true;
}
public function hasBeenModified() {
return $this->modified;
}
public function isInternal() {
return $this->internal;
}
public function setInternal() {
$this->internal = true;
}
public function isRequired() {
if ($this->getMinValueCount() > 0) {
return true;
} elseif ($this->isRdn()) {
return true;
} else {
return false;
}
}
public function setRequired() {
if ($this->getMinValueCount() <= 0) {
$this->setMinValueCount(1);
}
}
public function setOptional() {
$this->setMinValueCount(0);
}
public function isReadOnly() {
return $this->readonly;
}
public function setReadOnly() {
$this->readonly = true;
}
public function isVisible() {
return $this->visible;
}
public function hide() {
$this->visible = false;
}
public function show() {
$this->visible = true;
}
public function setFriendlyName($name) {
if ($name != $this->name) {
$this->friendly_name = $name;
}
}
public function getFriendlyName() {
$friendly_attrs = $_SESSION['plaConfig']->friendly_attrs;
$name = real_attr_name($this->name);
if ($this->friendly_name) {
return $this->friendly_name;
} elseif (isset($friendly_attrs[$name])) {
return $friendly_attrs[$name];
} elseif (isset($friendly_attrs[strtolower($name)])) {
return $friendly_attrs[strtolower($name)];
} else {
return $name;
}
}
public function setDescription($description) {
$this->description = $description;
}
public function getDescription() {
return $this->description;
}
public function setIcon($icon) {
$this->icon = $icon;
}
public function getIcon() {
return $this->icon;
}
public function getHint() {
return $this->hint;
}
public function setHint($hint) {
$this->hint = $hint;
}
public function getMaxLength() {
return $this->maxlength;
}
public function setMaxLength($maxlength) {
$this->maxlength = $maxlength;
}
public function getSize() {
return $this->size;
}
public function setSize($size) {
$this->size = $size;
}
public function setProperty($name, $value) {
$this->properties[$name] = $value;
}
public function delProperty($name) {
if ($this->hasProperty($name)) unset($this->properties[$name]);
}
public function hasProperty($name) {
return isset($this->properties[$name]);
}
public function getProperty($name) {
if ($this->hasProperty($name)) return $this->properties[$name];
else return null;
}
public function isRdn() {
if ($this->entry) {
//$rdn = get_rdn($this->entry->getDn());
//$attr = $this->name;
//return preg_match("/^${attr}=/", $rdn);
return ($this->name == $this->entry->getRdnAttributeName());
} else {
return false;
}
}
/**
* Visit the attribute
*/
public function accept($visitor) {
$visitor->visit('', $this);
}
}
?>

104
lib/AttributeFactory.php Normal file
View File

@ -0,0 +1,104 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/AttributeFactory.php,v 1.2 2007/12/15 07:50:32 wurley Exp $
/**
* @package phpLDAPadmin
* @author Xavier Bruyet
*
* Allows to create new attributes
*/
class AttributeFactory {
public function newAttribute($name,$values) {
global $ldapserver;
if (! strcasecmp($name,'objectClass')) {
return $this->newObjectClassAttribute($name,$values);
} elseif ($ldapserver->isJpegPhoto($name)) {
return $this->newJpegAttribute($name,$values);
} else if ($ldapserver->isAttrBinary($name)) {
return $this->newBinaryAttribute($name,$values);
} else if (! strcasecmp($name,'userPassword')) {
return $this->newPasswordAttribute($name,$values);
} else if (! strcasecmp($name,'sambaLMPassword') || ! strcasecmp($name,'sambaNTPassword')) {
return $this->newSambaPasswordAttribute($name,$values);
} elseif (in_array_ignore_case($name,array_keys($_SESSION['plaConfig']->GetValue('appearance','date_attrs')))) {
return $this->newDateAttribute($name,$values);
} elseif (in_array(strtolower($name),array('shadowlastchange','shadowmin',
'shadowmax','shadowexpire','shadowwarning','shadowinactive'))) {
return $this->newShadowAttribute($name,$values);
} elseif ($ldapserver->isAttrBoolean($name)) {
$attribute = $this->newSelectionAttribute($name,$values);
$attribute->addOption('TRUE',_('true'));
$attribute->addOption('FALSE',_('false'));
return $attribute;
} elseif ($ldapserver->isDNAttr($name)) {
return $this->newDnAttribute($name,$values);
} elseif ($ldapserver->isMultiLineAttr($name)) {
return $this->newMultiLineAttribute($name,$values);
} elseif (! strcasecmp($name,'gidNumber')) {
return $this->newGidAttribute($name,$values);
} else {
return new Attribute($name,$values);
}
}
public function newJpegAttribute($name,$values) {
return new JpegAttribute($name,$values);
}
public function newBinaryAttribute($name,$values) {
return new BinaryAttribute($name,$values);
}
public function newPasswordAttribute($name,$values) {
return new PasswordAttribute($name,$values);
}
public function newSambaPasswordAttribute($name,$values) {
return new SambaPasswordAttribute($name,$values);
}
public function newRandomPasswordAttribute($name,$values) {
return new RandomPasswordAttribute($name,$values);
}
public function newShadowAttribute($name,$values) {
return new ShadowAttribute($name,$values);
}
public function newSelectionAttribute($name,$values) {
return new SelectionAttribute($name,$values);
}
public function newMultiLineAttribute($name,$values) {
return new MultiLineAttribute($name,$values);
}
public function newDateAttribute($name,$values) {
return new DateAttribute($name,$values);
}
public function newObjectClassAttribute($name,$values) {
return new ObjectClassAttribute($name,$values);
}
public function newDnAttribute($name,$values) {
return new DnAttribute($name,$values);
}
public function newGidAttribute($name,$values) {
return new GidAttribute($name,$values);
}
}
?>

55
lib/BinaryAttribute.php Normal file
View File

@ -0,0 +1,55 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/BinaryAttribute.php,v 1.2 2007/12/15 07:50:32 wurley Exp $
/**
* @package phpLDAPadmin
* @author Xavier Bruyet
*
* Represents an attribute whose values are binaries
*/
class BinaryAttribute extends Attribute {
protected $filepaths;
protected $filenames;
public function __construct($name, $values) {
parent::__construct($name, $values);
$this->filepaths = array();
$this->filenames = array();
}
public function getFileNames() {
return $this->filenames;
}
public function getFileName($i) {
if (isset($this->filenames[$i])) return $this->filenames[$i];
else return null;
}
public function addFileName($name, $i = -1) {
if ($i < 0) {
$this->filenames[] = $name;
} else {
$this->filenames[$i] = $name;
}
}
public function getFilePaths() {
return $this->filepaths;
}
public function getFilePath($i) {
if (isset($this->filepaths[$i])) return $this->filepaths[$i];
else return null;
}
public function addFilePath($path, $i = -1) {
if ($i < 0) {
$this->filepaths[] = $path;
} else {
$this->filepaths[$i] = $path;
}
}
}
?>

12
lib/DateAttribute.php Normal file
View File

@ -0,0 +1,12 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/DateAttribute.php,v 1.2 2007/12/15 07:50:32 wurley Exp $
/**
* @package phpLDAPadmin
* @author Xavier Bruyet
*
* Represents an attribute whose values are dates
*/
class DateAttribute extends Attribute {
}
?>

View File

@ -0,0 +1,210 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/DefaultCreatingEntry.php,v 1.2 2007/12/15 07:50:32 wurley Exp $
/**
* @package phpLDAPadmin
* @author The phpLDAPadmin development team
* @author Xavier Bruyet
*
* Represent a tree node
*/
class DefaultCreatingEntry extends Entry {
protected $objectClasses;
protected $mustattrs;
protected $mayattrs;
private $container;
private $rdn;
public function __construct() {
parent::__construct('');
$this->objectClasses = array();
$this->mustattrs = array();
$this->mayattrs = array();
$this->container = '';
$this->rdn = null;
}
public function addObjectClass($objectClass) {
global $ldapserver;
if (!$objectClass || in_array($objectClass,$this->objectClasses)) return;
$this->objectClasses[] = $objectClass;
/* add the required and optional attributes of the objectclass */
$schema_oclass = $ldapserver->getSchemaObjectClass($objectClass);
assert($schema_oclass);
// get the required attributes
$schema_oclasses = $ldapserver->SchemaObjectClasses();
$schema_attrs = $schema_oclass->getMustAttrs($schema_oclasses);
if (!$schema_attrs) $schema_attrs = array();
elseif (!is_array($schema_attrs)) $schema_attrs = array($schema_attrs);
// for each required attribute
foreach ($schema_attrs as $schema_attr) {
$attr_name = $schema_attr->getName();
if (isset($this->mustattrs[$attr_name])) {
$this->mustattrs[$attr_name][] = $objectClass;
continue;
}
if (isset($this->mayattrs[$attr_name])) {
unset($this->mayattrs[$attr_name]);
$this->mustattrs[$attr_name] = array($objectClass);
continue;
}
// get attribute aliases
$aliases = ($schema_attr = $ldapserver->getSchemaAttribute($attr_name)) ? $schema_attr->aliases : null;
if (!$aliases) $aliases = array();
if (!is_array($aliases)) $aliases = array($aliases);
// check if we doesn't already add the alias
$found = false;
foreach ($aliases as $alias) {
if (isset($this->mustattrs[$alias])) {
$this->mustattrs[$alias][] = $objectClass;
$found = true;
break;
} elseif (isset($this->mayattrs[$alias])) {
unset($this->mayattrs[$alias]);
$this->mustattrs[$alias] = array($objectClass);
$found = true;
break;
}
}
if ($found) continue;
$this->mustattrs[$attr_name] = array($objectClass);
}
// get the optional attributes
$schema_attrs = $schema_oclass->getMayAttrs($schema_oclasses);
if (!$schema_attrs) $schema_attrs = array();
elseif (!is_array($schema_attrs)) $schema_attrs = array($schema_attrs);
// for each optional attribute
foreach ($schema_attrs as $schema_attr) {
$attr_name = $schema_attr->getName();
if (isset($this->mustattrs[$attr_name])) {
continue;
}
if (isset($this->mayattrs[$attr_name])) {
$this->mayattrs[$attr_name][] = $objectClass;
continue;
}
// get attribute aliases
$aliases = ($schema_attr = $ldapserver->getSchemaAttribute($attr_name)) ? $schema_attr->aliases : null;
if (!$aliases) $aliases = array();
if (!is_array($aliases)) $aliases = array($aliases);
// check if we doesn't already add the alias
$found = false;
foreach ($aliases as $alias) {
if (isset($this->mustattrs[$alias])) {
$found = true;
break;
} elseif (isset($this->mayattrs[$alias])) {
$this->mayattrs[$alias][] = $objectClass;
$found = true;
break;
}
}
if ($found) continue;
$this->mayattrs[$attr_name] = array($objectClass);
}
}
public function setContainer($dn) {
$this->container = $dn;
}
public function getContainer() {
return $this->container;
}
public function setRdnAttributeName($attribute_name) {
$this->rdn = null;
if (!$attribute_name) return;
$attrs = $this->getAttributes();
foreach ($attrs as $attr) {
if ($attr->getName() == $attribute_name) {
$this->rdn = $attr;
return;
}
}
}
public function getRdnAttributeName() {
$attr = $this->getRdnAttribute();
if ($attr) return $attr->getName();
else return '';
}
public function getRdnAttribute() {
return $this->rdn;
}
public function getDn() {
if (!$this->container || !$this->rdn) return '';
$vals = $this->rdn->getValues();
$val = ($vals && $vals[0]) ? $vals[0] : '';
if (strlen($val) <= 0) return '';
return $this->rdn->getName()."=$val,".$this->container;
}
public function getAttributes() {
global $ldapserver;
# we can use a static variable if there is only one instance of this class
static $attrs = null;
if (DEBUG_ENABLED) debug_log('%s[%s]::getAttributes()',1,get_class($this),$this->getDn());
if (! $attrs) {
$attrs = array();
$attributefactoryclass = $_SESSION['plaConfig']->GetValue('appearance','attribute_factory');
eval('$attribute_factory = new '.$attributefactoryclass.'();');
if ($this->objectClasses) {
$attribute = $attribute_factory->newAttribute('objectClass',$this->objectClasses);
$attribute->setEntry($this);
$attribute->setRequired();
$attribute->hide();
$attrs[] = $attribute;
}
foreach ($this->mustattrs as $attr_name => $objectclasses) {
if ($attr_name == 'objectClass') continue;
$attribute = $attribute_factory->newAttribute($attr_name,null);
$attribute->setEntry($this);
$attribute->setRequired();
$attrs[] = $attribute;
}
foreach ($this->mayattrs as $attr_name => $objectclasses) {
if ($attr_name == 'objectClass') continue;
$attribute = $attribute_factory->newAttribute($attr_name,null);
$attribute->setEntry($this);
$attrs[] = $attribute;
}
usort($attrs,'attrcmp'); # Sort optional attributes
}
return $attrs;
}
}
?>

View File

@ -0,0 +1,90 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/DefaultEditingEntry.php,v 1.2 2007/12/15 07:50:32 wurley Exp $
/**
* @package phpLDAPadmin
* @author The phpLDAPadmin development team
* @author Xavier Bruyet
*
* Represent a tree node
*/
class DefaultEditingEntry extends Entry {
public function __construct($dn) {
parent::__construct($dn);
}
public function getAttributes() {
global $ldapserver;
static $attrs = array();
$dn = $this->getDn();
if (DEBUG_ENABLED) debug_log('%s[%s]::getAttributes()',1,get_class($this),$dn);
if (! isset($attrs[$dn])) {
$attrs[$dn] = array();
$attributefactoryclass = $_SESSION['plaConfig']->GetValue('appearance','attribute_factory');
eval('$attribute_factory = new '.$attributefactoryclass.'();');
$int_attrs_vals = $ldapserver->getDNSysAttrs($this->getDn());
if (!$int_attrs_vals) $int_attrs_vals = array();
elseif (!is_array($int_attrs_vals)) $int_attrs_vals = array($int_attrs_vals);
$attrs_vals = $ldapserver->getDNAttrs($this->getDn(),false,$_SESSION['plaConfig']->GetValue('deref','view'));
if (! $attrs_vals) $attrs_vals = array();
elseif (! is_array($attrs_vals)) $attrs_vals = array($attrs_vals);
$attrs_vals = array_merge($attrs_vals, $int_attrs_vals);
uksort($attrs_vals,'sortAttrs'); # Sort these entries
$objectclasses = null;
foreach ($attrs_vals as $attr => $vals) {
$attribute = $attribute_factory->newAttribute($attr,$vals);
$attribute->setEntry($this);
if (isset($int_attrs_vals[$attr])) {
$attribute->setInternal();
$attribute->setReadOnly();
}
if ($attr == 'objectClass') $objectclasses = $attribute->getValues();
if ($this->isReadOnly() || $ldapserver->isAttrReadOnly($attr)) {
$attribute->setReadOnly();
}
if ($ldapserver->isAttrHidden($attr)/* || ! strcasecmp($attr,'dn')*/) {
$attribute->hide();
}
$attrs[$dn][] = $attribute;
}
if ($objectclasses) {
$schema_oclasses = $ldapserver->SchemaObjectClasses();
foreach ($objectclasses as $oclass) {
$schema_oclass = $ldapserver->getSchemaObjectClass($oclass);
assert($schema_oclass);
$mustattrs = $schema_oclass->getMustAttrs($schema_oclasses);
if (!$mustattrs) $mustattrs = array();
if (!is_array($mustattrs)) $mustattrs = array($mustattrs);
foreach ($mustattrs as $mustattr) {
foreach ($attrs[$dn] as $attr) {
if ($attr->getName() == $mustattr->getName()) {
$attr->setRequired();
break;
}
}
}
}
}
}
return $attrs[$dn];
}
}
?>

View File

@ -0,0 +1,19 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/DefaultEntryFactory.php,v 1.2 2007/12/15 07:50:32 wurley Exp $
/**
* @package phpLDAPadmin
* @author Xavier Bruyet
*
* Allows to create new entries
*/
class DefaultEntryFactory extends EntryFactory {
public function newEditingEntry($dn) {
return new DefaultEditingEntry($dn);
}
public function newCreatingEntry($dn) {
return new DefaultCreatingEntry();
}
}
?>

12
lib/DnAttribute.php Normal file
View File

@ -0,0 +1,12 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/DnAttribute.php,v 1.2 2007/12/15 07:50:32 wurley Exp $
/**
* @package phpLDAPadmin
* @author Xavier Bruyet
*
* Represents an attribute whose values are dn
*/
class DnAttribute extends Attribute {
}
?>

Some files were not shown because too many files have changed in this diff Show More