removed old tree view

This commit is contained in:
Roland Gruber 2011-07-06 08:47:04 +00:00
parent c26bacec07
commit aae56a0d61
25 changed files with 8 additions and 4092 deletions

View File

@ -372,10 +372,14 @@ table.schema_oclasses td {
padding-left: 5px;
}
table.schema_attr {
border: 1px solid black;
}
table.schema_attr th {
background-color: #016;
background-color: #F3F3F3;
padding: 5px;
color: white;
color: black;
font-weight: bold;
font-size: 125%;
}
@ -419,14 +423,14 @@ ul.schema li small a {
}
h4.schema_oclass {
background: #016;
background: #F3F3F3;
padding: 5px;
margin: 0px;
margin-top: 8px;
font-weight: normal;
border: 1px solid black;
font-size: 140%;
color: white;
color: black;
}
h4.schema_oclass_sub {
@ -440,311 +444,3 @@ h4.schema_oclass_sub {
font-size: 80%;
}
table.tree tr.login td {
}
table.tree td.links {
padding: 0px;
font-size: 10px;
padding-left: 12px;
font-size: 10px;
}
table.tree td.links a {
font-size: 10px;
}
table.tree {
border: 0px;
}
table.tree img {
border: 0px;
}
table.tree td {
padding: 2px;
border: 0px solid black;
}
table.tree tr {
}
table.tree tr.server td.icon {
width: 14px;
}
table.tree tr.server td {
padding-top: 15px;
padding-bottom: 0px;
vertical-align: top;
font-size: 20px;
text-align: left;
}
table.tree td.icon {
text-align: center;
padding: 0px;
width: 14px;
font-size: 1px;
}
table.tree td.rdn {
width: 500px;
}
table.tree td.rdn a {
text-decoration: none;
color: black;
}
table.tree td.rdn a:hover {
text-decoration: none;
color: blue;
}
table.tree td.create {
}
table.tree td.create a {
text-decoration: none;
color: black;
}
table.tree td.create a:hover {
text-decoration: none;
color: blue;
}
table.tree td.spacer {
width: 22px;
}
table.tree td.expander {
text-align: center;
width: 22px;
max-width: 22px;
min-width: 22px;
}
table.tree td span.count {
color: gray;
font-size: 85%;
}
h3.tree_title {
text-align: center;
margin: 0px;
padding: 10px;
color: white;
background-color: #018;
border: 1px solid black;
font-weight: normal;
font-size: 150%;
}
h3.tree_subtitle {
text-align: center;
margin: 0px;
margin-bottom: 15px;
font-size: 75%;
color: white;
border-bottom: 1px solid black;
border-left: 1px solid black;
border-right: 1px solid black;
background: #018;
padding: 4px;
font-weight: normal;
}
table.tree_edit_dn {
border-collapse: collapse;
border-spacing: 0px;
empty-cells: show;
width: 500px;
}
table.tree_edit_dn input {
margin: 1px;
}
table.tree_edit_dn input.val {
font-size: 14px;
width: 350px;
font-family: arial, helvetica, sans-serif;
background-color: white;
}
table.tree_edit_dn textarea.val {
font-size: 14px;
width: 350px;
font-family: arial, helvetica, sans-serif;
background-color: white;
}
table.tree_edit_dn tr td {
padding: 4px;
padding-right: 0px;
}
table.tree_edit_dn tr td.attr {
background-color: #eee;
vertical-align: top;
}
table.tree_edit_dn tr td.heading {
border-top: 3px solid #ccc;
font-weight: bold;
}
table.tree_edit_dn tr td.attr_note {
text-align: right;
background-color: #eee;
}
table.tree_edit_dn tr td.attr a {
text-decoration: none;
color: black;
}
table.tree_edit_dn tr td.attr a:hover {
text-decoration: underline;
color: #016;
}
table.tree_edit_dn tr td.val {
text-align: left;
vertical-align: middle;
padding-bottom: 10px;
padding-left: 80px;
}
/** When an attr is updated, it is highlighted to indicate such */
table.tree_edit_dn tr.updated_attr td.attr {
border-top: 1px dashed green;
border-left: 1px dashed green;
background-color: #ded;
}
table.tree_edit_dn tr.updated_attr td.attr_note {
border-top: 1px dashed green;
border-right: 1px dashed green;
background-color: #ded;
}
/** An extra row that sits at the bottom of recently modified attrs to encase them in dashes */
table.tree_edit_dn tr.updated_attr td.bottom {
border-top: 1px dashed green;
}
/** Formatting for the value cell when it is the attribute that has been recently modified */
table.tree_edit_dn tr.updated_attr td.val {
border-left: 1px dashed green;
border-right: 1px dashed green;
}
/* Neede to prevent sub-tables (like the one in which jpegPhotos are displayed)
* from drawing borders as well. */
table.tree_edit_dn tr.updated_attr td table td {
border: 0px;
}
table.tree_edit_dn tr.updated_attr a {
}
table.tree_edit_dn tr.mod_dn {
background: #def;
}
table.tree_edit_dn tr.row1 {
background: #eee;
}
table.tree_edit_dn tr.row2 {
background: #ccc;
}
form.tree_edit_dn {
margin: 0px;
padding: 0px;
}
table.tree_edit_dn_menu {
font-size: 75%;
}
table.tree_edit_dn_menu td.icon {
width: 16px;
text-align: center;
}
span.tree_hint {
font-size: small;
font-weight: normal;
color: #888;
}
table.tree_confirm th {
background-color: #016;
padding: 5px;
color: white;
font-weight: normal;
}
table.tree_confirm tr td {
padding: 4px;
}
table.tree_confirm tr.spacer {
background-color: #ddd;
}
table.tree_confirm tr.even {
background-color: #ccc;
}
table.tree_confirm tr.odd {
background-color: #eee;
}
table.tree_confirm tr td.heading {
text-align: right;
font-size: 75%;
}
table.tree_confirm td.icon {
text-align: center;
}
table.tree_delete_confirm {
width: 76%;
background-color: #ddf;
padding: 20px;
text-align: left;
}
table.tree_create {
font-size: 75%;
}
table.tree_create td.heading {
vertical-align: top;
padding: 10px;
}
table.export_form {
font-size: 75%;
width: 400px;
border-spacing: 10px;
border-collapse: separate;
}
table.export_form tr td {
text-align: left;
vertical-align: top;
padding: 4px;
}

View File

@ -1,170 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Adds an attribute/value pair to an object
*
* Variables that come in as POST vars:
* - dn
* - attr
* - val
* - binary
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** status messages */
include_once('../../lib/status.inc');
/** common functions */
include_once('../../lib/account.inc');
// start session
startSecureSession();
// die if no write access
if (!checkIfWriteAccessIsAllowed()) die();
setlanguage();
$attr = $_POST['attr'];
$val = isset( $_POST['val'] ) ? $_POST['val'] : false;;
$dn = $_POST['dn'] ;
$encoded_dn = rawurlencode( $dn );
$encoded_attr = rawurlencode( $attr );
$is_binary_val = isset( $_POST['binary'] ) ? true : false;
if( ! $is_binary_val && $val == "" ) {
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head><body>\n";
StatusMessage("ERROR", _('You left the attribute value blank. Please go back and try again.'), '');
echo "</body></html>";
exit;
}
// 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.
if( $is_binary_val ) {
if (( 0 == $_FILES['val']['size'] ) || (! is_uploaded_file( $_FILES['val']['tmp_name'] ))) {
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head><body>\n";
StatusMessage("ERROR", _('File upload failed!'), '');
echo "</body></html>";
exit;
}
$file = $_FILES['val']['tmp_name'];
$f = fopen( $file, 'r' );
$binary_data = fread( $f, filesize( $file ) );
fclose( $f );
$val = $binary_data;
if( is_binary_option_required( $attr ) )
$attr .=";binary";
}
// Automagically hash new userPassword attributes according to the
// chosen in config.php.
if( 0 == strcasecmp( $attr, 'userpassword' ) ) {
$val = pwd_hash($val);
}
elseif(0 == strcasecmp( $attr , 'sambalmpassword') ) {
$val = lmPassword($val);
}
elseif (0 == strcasecmp( $attr , 'sambantpassword' )) {
$val = ntPassword($val);
}
$ds = $_SESSION['ldap']->server();
$new_entry = array( $attr => $val );
$result = @ldap_mod_add( $ds, $dn, $new_entry );
if( $result )
header( "Location: edit.php?dn=$encoded_dn&amp;modified_attrs[]=$encoded_attr" );
else {
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head><body>\n";
StatusMessage("ERROR", _('Failed to add the attribute.'), ldap_error($ds));
echo "</body></html>";
exit;
}
// check if we need to append the ;binary option to the name
// of some binary attribute
function is_binary_option_required( $attr ){
// list of the binary attributes which need the ";binary" option
$binary_attributes_with_options = array(
// Superior: Ldapv3 Syntaxes (1.3.6.1.4.1.1466.115.121.1)
'1.3.6.1.4.1.1466.115.121.1.8' => "userCertificate",
'1.3.6.1.4.1.1466.115.121.1.8' => "caCertificate",
'1.3.6.1.4.1.1466.115.121.1.10' => "crossCertificatePair",
'1.3.6.1.4.1.1466.115.121.1.9' => "certificateRevocationList",
'1.3.6.1.4.1.1466.115.121.1.9' => "authorityRevocationList",
// Superior: Netscape Ldap attributes types (2.16.840.1.113730.3.1)
'2.16.840.1.113730.3.1.40' => "userSMIMECertificate"
);
// 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 = get_schema_attribute( $attr );
if( ! $schema_attr )
return false;
$syntax = $schema_attr->getSyntaxOID();
if( isset( $binary_attributes_with_options[ $syntax ] ) )
return true;
return false;
}
?>

View File

@ -1,199 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Displays a form for adding an attribute/value to an LDAP entry.
*
* Variables that come in as GET vars:
* - dn (rawurlencoded)
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** status messages */
include_once('../../lib/status.inc');
// start session
startSecureSession();
setlanguage();
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head>\n";
$dn = $_GET['dn'];
$encoded_dn = rawurlencode( $dn );
$rdn = get_rdn( $dn );
?>
<body>
<h3 class="tree_title"><?php echo sprintf( _('Add new attribute'), htmlspecialchars( $rdn ) ); ?></b></h3>
<h3 class="tree_subtitle"><?php echo _('DN'); ?>: <b><?php echo htmlspecialchars( ( $dn ) ); ?></b></h3>
<?php
$attrs = get_object_attrs( $dn );
$oclasses = get_object_attr( $dn, 'objectClass' );
if( ! is_array( $oclasses ) )
$oclasses = array( $oclasses );
$avail_attrs = array();
$schema_oclasses = get_schema_objectclasses( $dn );
foreach( $oclasses as $oclass ) {
$schema_oclass = get_schema_objectclass( $oclass, $dn );
if( $schema_oclass && 0 == strcasecmp( 'objectclass', get_class( $schema_oclass ) ) )
$avail_attrs = array_merge( $schema_oclass->getMustAttrNames( $schema_oclasses ),
$schema_oclass->getMayAttrNames( $schema_oclasses ),
$avail_attrs );
}
$avail_attrs = array_unique( $avail_attrs );
$avail_attrs = array_filter( $avail_attrs, "not_an_attr" );
sort( $avail_attrs );
$avail_binary_attrs = array();
foreach( $avail_attrs as $i => $attr ) {
if( is_attr_binary( $attr ) ) {
$avail_binary_attrs[] = $attr;
unset( $avail_attrs[ $i ] );
}
}
?>
<br />
<center>
<?php echo _('Add new attribute'); ?>
<?php if( is_array( $avail_attrs ) && count( $avail_attrs ) > 0 ) { ?>
<br />
<br />
<form action="add_attr.php" method="post">
<input type="hidden" name="dn" value="<?php echo htmlspecialchars($dn); ?>" />
<select name="attr"><?php
$attr_select_html = '';
usort($avail_attrs,"sortAttrs");
foreach( $avail_attrs as $a ) {
$attr_display = htmlspecialchars( $a );
echo $attr_display;
$attr_select_html .= "<option>$attr_display</option>\n";
echo "<option value=\"" . htmlspecialchars($a) . "\">$attr_display</option>";
} ?>
</select>
<input type="text" name="val" size="20" />
<input type="submit" name="submit" value="<?php echo _('Add'); ?>"/>
</form>
<?php } else { ?>
<br />
<br />
<small><?php echo _('(no new attributes available for this entry)'); ?></small>
<br />
<br />
<?php } ?>
<?php echo _('Add new binary attribute'); ?>
<?php if( count( $avail_binary_attrs ) > 0 ) { ?>
<!-- Form to add a new BINARY attribute to this entry -->
<form action="add_attr.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
<input type="hidden" name="binary" value="true" />
<br />
<select name="attr">
<?php
$attr_select_html = '';
usort($avail_binary_attrs,"sortAttrs");
foreach( $avail_binary_attrs as $a ) {
$attr_display = htmlspecialchars( $a );
echo $attr_display;
$attr_select_html .= "<option>$attr_display</option>\n";
echo "<option value=\"" . htmlspecialchars($a) . "\">$attr_display</option>";
} ?>
</select>
<input type="file" name="val" size="20" />
<input type="submit" name="submit" value="<?php echo _('Add'); ?>"/>
<?php
if( ! ini_get( 'file_uploads' ) )
echo "<br><small><b>" . _('Your PHP configuration has disabled file uploads. Please check php.ini before proceeding.') . "</b></small><br>";
else
echo "<br><small><b>" . sprintf( _('Maximum file size: %s'), ini_get( 'upload_max_filesize' ) ) . "</b></small><br>";
?>
</form>
<?php } else { ?>
<br />
<br />
<small><?php echo _('(no new binary attributes available for this entry)'); ?></small>
<?php } ?>
</center>
</body>
</html>
<?php
/**
* Given an attribute $x, this returns true if it is NOT already specified
* in the current entry, returns false otherwise.
*/
function not_an_attr( $x )
{
global $attrs;
//return ! isset( $attrs[ strtolower( $x ) ] );
foreach( $attrs as $attr => $values )
if( 0 == strcasecmp( $attr, $x ) )
return false;
return true;
}
?>

View File

@ -1,101 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Adds an objectClass to the specified dn.
* Variables that come in as POST vars:
*
* Note, this does not do any schema violation checking. That is
* performed in add_oclass_form.php.
*
* Vars that come in as POST:
* - dn (rawurlencoded)
* - new_oclass
* - new_attrs (array, if any)
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** status messages */
include_once('../../lib/status.inc');
// start session
startSecureSession();
// die if no write access
if (!checkIfWriteAccessIsAllowed()) die();
setlanguage();
$dn = rawurldecode( $_POST['dn'] );
$encoded_dn = rawurlencode( $dn );
$new_oclass = unserialize( rawurldecode( $_POST['new_oclass'] ) );
$new_attrs = $_POST['new_attrs'];
$new_entry = array();
$new_entry['objectClass'] = $new_oclass;
$new_attrs_entry = array();
$new_oclass_entry = array( 'objectClass' => $new_oclass );
if( is_array( $new_attrs ) && count( $new_attrs ) > 0 )
foreach( $new_attrs as $attr => $val ) {
$new_entry[ $attr ] = $val;
}
$ds = $_SESSION['ldap']->server();
$add_res = @ldap_mod_add( $ds, $dn, $new_entry );
if( ! $add_res )
{
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head>\n";
StatusMessage('ERROR', _("Was unable to modify attributes from DN: %s."), ldap_error( $ds ), array($dn));
echo "</body></html>";
}
else
{
header( "Location: edit.php?dn=$encoded_dn&amp;modified_attrs[]=objectclass" );
}
?>

View File

@ -1,170 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* This page may simply add the objectClass and take you back to the edit page,
* but, in one condition it may prompt the user for input. That condition is this:
*
* If the user has requested to add an objectClass that requires a set of
* attributes with 1 or more not defined by the object. In that case, we will
* present a form for the user to add those attributes to the object.
*
* Variables that come in as POST vars:
* - dn (rawurlencoded)
* - new_oclass
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** status messages */
include_once('../../lib/status.inc');
// start session
startSecureSession();
// die if no write access
if (!checkIfWriteAccessIsAllowed()) die();
setlanguage();
$dn = rawurldecode( $_POST['dn'] );
$encoded_dn = rawurlencode( $dn );
$new_oclass = $_POST['new_oclass'];
/* Ensure that the object has defined all MUST attrs for this objectClass.
* If it hasn't, present a form to have the user enter values for all the
* newly required attrs. */
$entry = get_object_attrs( $dn, true );
$current_attrs = array();
foreach( $entry as $attr => $junk )
$current_attrs[] = strtolower($attr);
// grab the required attributes for the new objectClass
$schema_oclasses = get_schema_objectclasses();
$must_attrs = array();
foreach($new_oclass as $oclass_name) {
$oclass = get_schema_objectclass($oclass_name);
if($oclass)
$must_attrs = array_merge($must_attrs, $oclass->getMustAttrNames($schema_oclasses));
}
$must_attrs = array_unique( $must_attrs );
// We don't want any of the attr meta-data, just the string
//foreach( $must_attrs as $i => $attr )
//$must_attrs[$i] = $attr->getName();
// build a list of the attributes that this new objectClass requires,
// but that the object does not currently contain
$needed_attrs = array();
foreach( $must_attrs as $attr ) {
$attr = get_schema_attribute($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 )
if( in_array( strtolower( $alias_attr_name ), $current_attrs ) )
// Skip this attribute since it's already in the entry
continue;
if( in_array( strtolower($attr->getName()), $current_attrs ) )
continue;
// We made it this far, so the attribute needs to be added to this entry in order
// to add this objectClass
$needed_attrs[] = $attr;
}
if( count( $needed_attrs ) > 0 )
{
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head>\n";
?>
<body>
<h3 class="tree_title"><?php echo _('DN') . ": " . $dn; ?></h3>
<h3 class="tree_subtitle"><?php echo _('There are new required attributes which need to be set.'); ?></h3>
<br />
<form action="add_oclass.php" method="post">
<input type="hidden" name="new_oclass" value="<?php echo rawurlencode(serialize($new_oclass)); ?>" />
<input type="hidden" name="dn" value="<?php echo $encoded_dn; ?>" />
<table class="tree_edit_dn" cellspacing="0">
<tr><th colspan="2"><?php echo _('New required attributes:'); ?></th></tr>
<?php foreach( $needed_attrs as $count => $attr ) { ?>
<tr><td class="attr"><b><?php echo htmlspecialchars($attr->getName()); ?></b></td></tr>
<tr><td class="val"><input type="text" name="new_attrs[<?php echo htmlspecialchars($attr->getName()); ?>]" value="" size="40" /></tr>
<?php } ?>
</table>
<br />
<br />
<center><input type="submit" value="<?php echo _('Add'); ?>" /></center>
</form>
</body>
</html>
<?php
}
else
{
$ds = $_SESSION['ldap']->server();
$add_res = @ldap_mod_add( $ds, $dn, array( 'objectClass' => $new_oclass ) );
if( ! $add_res ) {
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head>\n";
StatusMessage('ERROR', _("Was unable to modify attributes from DN: %s."), ldap_error( $ds ), array($dn));
echo "</body></html>";
}
else
header( "Location: edit.php?dn=$encoded_dn&amp;modified_attrs[]=objectClass" );
}
?>

View File

@ -1,104 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Adds a value to an attribute for a given dn.
* Variables that come in as POST vars:
* - dn (rawurlencoded)
* - attr (rawurlencoded) the attribute to which we are adding a value
* - new_value (form element)
* - binary
*
* On success, redirect to the edit_dn page.
* On failure, echo an error.
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** status messages */
include_once('../../lib/status.inc');
// start session
startSecureSession();
// die if no write access
if (!checkIfWriteAccessIsAllowed()) die();
setlanguage();
$dn = rawurldecode( $_POST['dn'] );
$encoded_dn = rawurlencode( $dn );
$attr = $_POST['attr'];
$encoded_attr = rawurlencode( $attr );
$new_value = $_POST['new_value'];
$is_binary_val = isset( $_POST['binary'] ) ? true : false;
$ds = $_SESSION['ldap']->server();
// special case for binary attributes:
// we must go read the data from the file.
if( $is_binary_val )
{
$file = $_FILES['new_value']['tmp_name'];
$f = fopen( $file, 'r' );
$binary_value = fread( $f, filesize( $file ) );
fclose( $f );
$new_value = $binary_value;
}
$new_entry = array( $attr => $new_value );
$add_result = @ldap_mod_add( $ds, $dn, $new_entry );
if( ! $add_result ) {
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head><body>\n";
StatusMessage('ERROR', _('Adding attribute failed!'), ldap_error( $ds ));
echo "</body></html>";
exit;
}
header( "Location: edit.php?dn=$encoded_dn&amp;modified_attrs[]=$encoded_attr" );
?>

View File

@ -1,202 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* add_value_form.php
* 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.
* Variables that come in as GET vars:
* - dn (rawurlencoded)
* - attr (rawurlencoded) the attribute to which we are adding a value
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** status messages */
include_once('../../lib/status.inc');
// start session
startSecureSession();
setlanguage();
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head>\n";
$dn = isset( $_GET['dn'] ) ? $_GET['dn'] : null;
$encoded_dn = rawurlencode( $dn );
if( null != $dn ) {
$rdn = get_rdn( $dn );
} else {
$rdn = null;
}
$attr = $_GET['attr'];
$encoded_attr = rawurlencode( $attr );
$current_values = get_object_attr( $dn, $attr );
$num_current_values = ( is_array($current_values) ? count($current_values) : 1 );
$is_object_class = ( 0 == strcasecmp( $attr, 'objectClass' ) ) ? true : false;
$is_jpeg_photo = is_jpeg_photo( $attr ); //( 0 == strcasecmp( $attr, 'jpegPhoto' ) ) ? true : false;
if( $is_object_class ) {
// fetch all available objectClasses and remove those from the list that are already defined in the entry
$schema_oclasses = get_schema_objectclasses();
foreach( $current_values as $oclass )
unset( $schema_oclasses[ strtolower( $oclass ) ] );
} else {
$schema_attr = get_schema_attribute( $attr );
}
?>
<body>
<h3 class="tree_title">
<?php echo _('Add new attribute'); ?>:
<b><?php echo htmlspecialchars($attr); ?></b>
</h3>
<h3 class="tree_subtitle">
<?php echo _('DN'); ?>: <b><?php echo htmlspecialchars( $dn ); ?></b></h3>
<?php echo _('Current list of values for attribute:') . " <b>" . htmlspecialchars($attr); ?></b>
<?php if( is_attr_binary( $attr ) ) { ?>
<ul>
<?php if( is_array( $vals ) ) { for( $i=1; $i<=count($vals); $i++ ) {
$href = "download_binary_attr.php?dn=$encoded_dn&amp;attr=$attr&amp;value_num=" . ($i-1); ?>
<li><a href="<?php echo $href; ?>"><img src="../../graphics/save.png" /> <?php echo _('download value') . ' ' . $i; ?>)</a></li>
<?php } } else {
$href = "download_binary_attr.php?dn=$encoded_dn&amp;attr=$attr"; ?>
<li><a href="<?php echo $href; ?>"><img src="../../graphics/save.png" /> <?php echo _('download value'); ?></a></li>
<?php } ?>
</ul>
<!-- Temporary warning until we find a way to add jpegPhoto values without an INAPROPRIATE_MATCHING error -->
<p><small>
<?php echo _('Note: You will get an "inappropriate matching" error if you have not setup an EQUALITY rule on your LDAP server for this attribute.'); ?>
</small></p>
<!-- End of temporary warning -->
<?php } else { ?>
<ul class="current_values">
<?php if( is_array( $current_values ) ) /*$num_current_values > 1 )*/ {
foreach( $current_values as $val ) { ?>
<li><nobr><?php echo htmlspecialchars(($val)); ?></nobr></li>
<?php } ?>
<?php } else { ?>
<li><nobr><?php echo htmlspecialchars(($current_values)); ?></nobr></li>
<?php } ?>
</ul>
<?php } ?>
<?php echo _('Enter the value you would like to add:'); ?>
<br />
<br />
<?php if( $is_object_class ) { ?>
<form action="add_oclass_form.php" method="post" class="new_value">
<input type="hidden" name="dn" value="<?php echo $encoded_dn; ?>" />
<select name="new_oclass[]" multiple size="15">
<?php foreach( $schema_oclasses as $name => $oclass ) {
// exclude any structural ones, as they'll only generate an LDAP_OBJECT_CLASS_VIOLATION
if ($oclass->type == "structural") continue;
?>
<option value="<?php echo $oclass->getName(); ?>"><?php echo $oclass->getName(); ?></option>
<?php } ?>
</select><br /><br /><input type="submit" value="<?php echo _('Add'); ?>" />
<br />
<?php } else { ?>
<form action="add_value.php" method="post" class="new_value" name="new_value_form"<?php
if( is_attr_binary( $attr ) ) echo "enctype=\"multipart/form-data\""; ?>>
<input type="hidden" name="dn" value="<?php echo $encoded_dn; ?>" />
<input type="hidden" name="attr" value="<?php echo $encoded_attr; ?>" />
<?php if( is_attr_binary( $attr ) ) { ?>
<input type="file" name="new_value" />
<input type="hidden" name="binary" value="true" />
<?php } else { ?>
<?php if( is_multi_line_attr( $attr ) ) { ?>
<textarea name="new_value" rows="3" cols="30"></textarea>
<?php } else { ?>
<input type="text" <?php
if( $schema_attr->getMaxLength() )
echo "maxlength=\"" . $schema_attr->getMaxLength() . "\" ";
?>name="new_value" size="40" value="" />
<?php } ?>
<?php } ?>
<input type="submit" name="submit" value="<?php echo _('Add'); ?>" />
<br />
<?php if( $schema_attr->getDescription() ) { ?>
<small><b><?php echo _('Description'); ?>:</b> <?php echo $schema_attr->getDescription(); ?></small><br />
<?php } ?>
<?php if( $schema_attr->getType() ) { ?>
<small><b><?php echo _('Syntax'); ?>:</b> <?php echo $schema_attr->getType(); ?></small><br />
<?php } ?>
<?php if( $schema_attr->getMaxLength() ) { ?>
<small><b><?php echo _('Maximum length'); ?>:</b> <?php echo number_format( $schema_attr->getMaxLength() ); ?></small><br />
<?php } ?>
</form>
<?php } ?>
</body>
</html>

View File

@ -1,70 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* This script alters the session variable 'tree', collapsing it
* at the dn specified in the query string.
*
* Variables that come in as GET vars:
* - dn (rawurlencoded)
* - server_id
*
* Note: this script is equal and opposite to expand.php
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
// start session
startSecureSession();
setlanguage();
$dn = $_GET['dn'];
$encoded_dn = rawurlencode( $dn );
initialize_session_tree();
if( array_key_exists( $dn, $_SESSION['tree'] ) )
unset( $_SESSION['tree'][$dn] );
header( "Location:tree.php" );
?>

View File

@ -1,189 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Creates a new object.
*
* Variables that come in as POST vars:
* - 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,
* and the values being their respective values)
* - object_classes (rawurlencoded, and serialized array of objectClasses)
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** status messages */
include_once('../../lib/status.inc');
// start session
startSecureSession();
// die if no write access
if (!checkIfWriteAccessIsAllowed()) die();
setlanguage();
$new_dn = isset( $_POST['new_dn'] ) ? $_POST['new_dn'] : null;
$encoded_dn = rawurlencode( $new_dn );
$vals = isset( $_POST['vals'] ) ? $_POST['vals'] : array();
$attrs = isset( $_POST['attrs'] ) ? $_POST['attrs'] : array();
$required_attrs = isset( $_POST['required_attrs'] ) ? $_POST['required_attrs'] : false;
$object_classes = unserialize( rawurldecode( $_POST['object_classes'] ) );
$container = get_container( $new_dn );
// build the new entry
$new_entry = array();
if( isset( $required_attrs ) && is_array( $required_attrs ) ) {
foreach( $required_attrs as $attr => $val ) {
if( $val == '' ) {
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head><body>\n";
StatusMessage("ERROR", _('You left the value blank for required attribute: %s.'), '', array(htmlspecialchars($attr)));
echo "</body></html>";
exit;
}
$new_entry[ $attr ][] = $val;
}
}
if( isset( $attrs ) && is_array( $attrs ) ) {
foreach( $attrs as $i => $attr ) {
if( is_attr_binary( $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;
}
} 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';
foreach( $new_entry as $attr => $vals ) {
if( ! is_attr_binary( $attr ) )
if( is_array( $vals ) ) {
foreach( $vals as $i => $v ) {
$new_entry[ $attr ][ $i ] = $v;
}
}
else {
$new_entry[ $attr ] = $vals;
}
}
//echo "<pre>"; var_dump( $new_dn );print_r( $new_entry ); echo "</pre>";
$ds = $_SESSION['ldap']->server();
// Check the user-defined custom call back first
$add_result = @ldap_add( $ds, $new_dn, $new_entry );
if( $add_result )
{
$redirect_url = "edit.php?dn=" . rawurlencode( $new_dn );
if( array_key_exists( 'tree', $_SESSION ) )
{
$tree = $_SESSION['tree'];
$tree_icons = $_SESSION['tree_icons'];
if( isset( $tree[$container] ) ) {
$tree[$container][] = $new_dn;
sort( $tree[$container] );
$tree_icons[$new_dn] = get_icon( $new_dn );
}
$_SESSION['tree'] = $tree;
$_SESSION['tree_icons'] = $tree_icons;
session_write_close();
}
?>
<?php
if( isset( $tree[$container])) {
echo $_SESSION['header'];
echo "<meta http-equiv=\"refresh\" content=\"0; URL=" . $redirect_url . "\">\n";
echo "<title></title>\n";
echo "</head>\n";
echo "<body>\n";
echo "<script language=\"javascript\">";
echo "parent.left_frame.location.reload();";
echo "</script>";
// print link if refresh does not work
echo "<p>\n";
echo "<a href=\"" . $redirect_url . "\">" . _("Click here if you are not directed to the next page.") . "</a>\n";
echo "</p>\n";
echo "</body>\n";
echo "</html>\n";
}
?>
<?PHP
}
else {
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head><body>\n";
StatusMessage("ERROR", _("LAM was unable to create account %s! An LDAP error occured."), ldap_error($ds), array($new_dn));
echo "</body></html>\n";
}
?>

View File

@ -1,146 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* 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 as GET vars
* - container (rawurlencoded) (optional)
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** status messages */
include_once('../../lib/status.inc');
/** template configuration */
include_once('templates/templates.inc');
// start session
startSecureSession();
setlanguage();
$step = isset( $_REQUEST['step'] ) ? $_REQUEST['step'] : 1; // defaults to 1
$container = $_REQUEST['container'];
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head>\n";
?>
<body>
<h3 class="tree_title"><?php echo _('Create Object')?></h3>
<h3 class="tree_subtitle"><?php echo _('Choose a template')?></h3>
<center><h3><?php echo _('Select a template for the creation process')?></h3></center>
<form action="creation_template.php" method="post">
<input type="hidden" name="container" value="<?php echo htmlspecialchars( $container ); ?>" />
<table class="tree_create">
<tr>
<td class="heading">
<?php echo _('Template'); ?>:
</td>
<td>
<table class="template_display">
<tr>
<td>
<table class="templates">
<?php
$count = count( $templates );
$i = -1;
foreach( $templates as $name => $template ) {
$i++;
// 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;
}
?>
<tr>
<td><input type="radio" name="template" value="<?php echo htmlspecialchars($name);?>"
id="<?php echo htmlspecialchars($name); ?>"
<?php if( 0 == strcasecmp( 'custom.php', $template['handler'] ) ) echo ' checked';
if( ! $isValid ) echo ' disabled'; ?> />
</td>
<td class="icon"><label for="<?php echo htmlspecialchars($name);?>"><img src="<?php echo $template['icon']; ?>" /></label></td>
<td>
<label for="<?php echo htmlspecialchars($name);?>">
<?php if( 0 == strcasecmp( 'Custom', $template['desc'] ) ) echo '<b>';
if( ! $isValid ) echo "<span style=\"color: gray\"><acronym title=\"This template is not allowed in this container\">";
echo htmlspecialchars( $template['desc'] );
if( ! $isValid ) echo "</acronym></span>";
if( 0 == strcasecmp( 'Custom', $template['desc'] ) ) echo '</b>'; ?>
</label></td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2"><center><input type="submit" name="submit" value="<?php echo _('Next')?>" /></center></td>
</tr>
</table>
</form>
</body>
</html>

View File

@ -1,97 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* This file simply acts as a plugin grabber for the creator templates in
* the directory templates/creation/
*
* Expected POST vars:
* template
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** status messages */
include_once('../../lib/status.inc');
/** template configuration */
include_once('templates/templates.inc');
// start session
startSecureSession();
setlanguage();
$template = $_POST['template'];
if( $template == 'custom' ) {
foreach( $templates as $id => $template ) {
if( $template['handler'] == 'custom.php' ) {
$template = $id;
break;
}
}
}
$template_id = $template;
$template = isset( $templates[$template] ) ? $templates[$template_id] : null;
$ds = $_SESSION['ldap']->server();
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head>\n";
?>
<body>
<h3 class="tree_title"><?php echo _('Create Object')?></h3>
<h3 class="tree_subtitle"><?php echo _('Using template:')?> '<?php echo htmlspecialchars( $template['desc'] ); ?>'</h3>
<?php
$handler = 'templates/creation/' . $template['handler'];
$handler = realpath( $handler );
include $handler;
echo "</body>\n</html>";
?>

View File

@ -1,116 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Deletes a DN and presents a "job's done" message.
*
* Variables that come in as POST vars:
* - dn (rawurlencoded)
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** status messages */
include_once('../../lib/status.inc');
// start session
startSecureSession();
// die if no write access
if (!checkIfWriteAccessIsAllowed()) die();
setlanguage();
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head>\n";
echo "<body>";
$dn = $_POST['dn'];
$encoded_dn = rawurlencode( $dn );
$ds = $_SESSION['ldap']->server();
$del_result = @ldap_delete( $ds, $dn );
if( $del_result )
{
// kill the DN from the tree browser session variable and
// refresh the tree viewer frame (left_frame)
if( array_key_exists( 'tree', $_SESSION ) )
{
$tree = $_SESSION['tree'];
if( isset( $tree ) && is_array( $tree ) ) {
// does it have children? (it shouldn't, but hey, you never know)
if( isset( $tree[$dn] ) )
unset( $tree[$dn] );
// search and destroy
foreach( $tree as $tree_dn => $subtree )
foreach( $subtree as $key => $sub_tree_dn )
if( 0 == strcasecmp( $sub_tree_dn, $dn ) )
unset( $tree[$tree_dn][$key] );
$_SESSION['tree'] = $tree;
}
}
?>
<script language="javascript">
parent.left_frame.location.reload();
</script>
<br />
<br />
<center><?php echo sprintf( _('Entry %s deleted successfully.'), $dn ); ?></center>
<?php
} else {
StatusMessage("ERROR", _("Was unable to delete DN: %s."), '', array($dn));
}
echo "</body></html>";

View File

@ -1,87 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Deletes an attribute from an entry with NO confirmation.
*
* On success, redirect to edit.php
* On failure, echo an error.
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** status messages */
include_once('../../lib/status.inc');
// start session
startSecureSession();
// die if no write access
if (!checkIfWriteAccessIsAllowed()) die();
setlanguage();
$dn = $_POST['dn'] ;
$encoded_dn = rawurlencode( $dn );
$attr = $_POST['attr'];
$update_array = array();
$update_array[$attr] = array();
$ds = $_SESSION['ldap']->server();
$res = @ldap_modify( $ds, $dn, $update_array );
if( $res ) {
$redirect_url = "edit.php?dn=$encoded_dn";
foreach( $update_array as $attr => $junk ) {
$redirect_url .= "&modified_attrs[]=$attr";
}
header( "Location: $redirect_url" );
}
else {
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head><body>\n";
StatusMessage("ERROR", _('Could not perform ldap_modify operation.'), ldap_error($ds));
echo "</body></html>";
exit;
}
?>

View File

@ -1,184 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Displays a last chance confirmation form to delete a dn.
*
* Variables that come in as GET vars:
* - dn (rawurlencoded)
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** status messages */
include_once('../../lib/status.inc');
// start session
startSecureSession();
setlanguage();
$dn = $_GET['dn'];
$encoded_dn = rawurlencode( $dn );
$rdn = pla_explode_dn( $dn );
$rdn = $rdn[0];
$children = get_container_contents( $dn,0,'(objectClass=*)',LDAP_DEREF_NEVER );
$has_children = count($children)>0 ? true : false;
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head>\n";
?>
<body>
<h3 class="tree_title"><?php echo sprintf( _('Delete %s'), htmlspecialchars( $rdn ) ); ?></b></h3>
<h3 class="tree_subtitle"><?php echo _('DN'); ?>: <b><?php echo htmlspecialchars( ( $dn ) ); ?></b></h3>
<?php if( $has_children ) { ?>
<center><b><?php echo _('Permanently delete all children, too?'); ?></b><br /><br />
<?php
flush(); // so the user can get something on their screen while we figure out how many children this object has
if( $has_children ) {
// get the total number of child objects (whole sub-tree)
$s = pla_ldap_search( 'objectClass=*', $dn, array('dn'), 'sub' );
$sub_tree_count = count( $s );
}
?>
<table class="tree_delete_confirm">
<td>
<p>
<?php echo sprintf( _('This entry is the root of a sub-tree containing %s entries.'), $sub_tree_count ); ?>
<br />
<br />
<?php echo sprintf( _('LAM can recursively delete this entry and all 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) ); ?><br />
<br />
<br />
<br />
<table width="100%">
<tr>
<td>
<center>
<form action="rdelete.php" method="post">
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
<input type="submit" value="<?php echo sprintf( _('Delete all %s objects'), $sub_tree_count ); ?>" />
</form>
</td>
<td>
<center>
<form action="edit.php" method="get">
<input type="hidden" name="dn" value="<?php echo htmlspecialchars($dn); ?>" />
<input type="submit" name="submit" value="<?php echo _('Cancel'); ?>"/>
</form>
</center>
</td>
</tr>
</table>
</td>
</table>
<?php flush(); ?>
<br />
<br />
<?php echo _('List of entries to be deleted:'); ?><br />
<select size="<?php echo min( 10, $sub_tree_count );?>" multiple disabled style="background:white; color:black;width:500px" >
<?php $i=0; ?>
<?php foreach( $s as $dn => $junk ) { ?>
<?php $i++; ?>
<option><?php echo $i; ?>. <?php echo htmlspecialchars( ( $dn ) ); ?></option>
<?php } ?>
</select>
<br />
<?php } else { ?>
<center>
<table class="tree_delete_confirm">
<td>
<?php echo _('Are you sure you want to permanently delete this object?'); ?><br />
<br />
<nobr><acronym><?php echo _('DN'); ?></acronym>: <b><?php echo pretty_print_dn( $dn ); ?></b><nobr><br />
<br />
<table width="100%">
<tr>
<td>
<center>
<form action="delete.php" method="post">
<input type="hidden" name="dn" value="<?php echo htmlspecialchars($dn); ?>" />
<input type="submit" name="submit" value="<?php echo _('Delete'); ?>"/>
</center>
</form>
</td>
<td>
<center>
<form action="edit.php" method="get">
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
<input type="submit" name="submit" value="<?php echo _('Cancel'); ?>"/>
</form>
</center>
</td>
</tr>
</table>
</td>
</table>
</center>
<?php } ?>
</body>
</html>

View File

@ -1,88 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Used to send binary values to user.
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** status messages */
include_once('../../lib/status.inc');
// start session
startSecureSession();
setlanguage();
$dn = rawurldecode( $_GET['dn'] );
$dn = rawurldecode( $_GET['dn'] );
$attr = $_GET['attr'];
// if there are multiple values in this attribute, which one do you want to see?
$value_num = isset( $_GET['value_num'] ) ? $_GET['value_num'] : 0;
$ds = $_SESSION['ldap']->server();
$search = @ldap_read( $ds, $dn, "(objectClass=*)", array($attr));
if( ! $search ) {
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head><body>\n";
StatusMessage("ERROR", _('Encountered an error while performing search.'), ldap_error($ds));
echo "</body></html>";
exit;
}
$entry = ldap_first_entry( $ds, $search );
$attrs = ldap_get_attributes( $ds, $entry );
$attr = ldap_first_attribute( $ds, $entry );
$values = ldap_get_values_len( $ds, $entry, $attr );
$count = $values['count'];
// Dump the binary data to the browser
header( "Content-type: octet-stream" );
header( "Content-disposition: attachment; filename=$attr" );
header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
echo $values[$value_num];
?>

View File

@ -1,544 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Displays the specified dn from the specified server for editing
*
* Variables that come in as GET vars:
* - dn (rawurlencoded)
* - modified_attrs (optional) an array of attributes to highlight as
* they were changed by the last operation
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** status messages */
include_once('../../lib/status.inc');
// start session
startSecureSession();
setlanguage();
/** If an entry has more children than this, stop searching and display this amount with a '+' */
$max_children = 100;
$dn = $_GET['dn'];
$encoded_dn = rawurlencode( $dn );
$modified_attrs = isset( $_GET['modified_attrs'] ) ? $_GET['modified_attrs'] : false;
$show_internal_attrs = isset( $_GET['show_internal_attrs'] ) ? true : false;
if( null != $dn ) {
$rdn = pla_explode_dn( $dn );
if( isset( $rdn[0] ) )
$rdn = $rdn[0];
else
$rdn = null;
} else {
$rdn = null;
}
$attrs = get_object_attrs( $dn, false );
$system_attrs = get_entry_system_attrs( $dn );
dn_exists( $dn ) or StatusMessage('ERROR', _('No such entry!'), $dn);
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head>\n";
?>
<body>
<h3 class="tree_title"><?php echo htmlspecialchars( ( $rdn ) ); ?></h3>
<h3 class="tree_subtitle"></b><?php echo _('DN');?>: <b><?php echo htmlspecialchars( ( $dn ) ); ?></b></h3>
<table class="tree_edit_dn_menu">
<tr>
<td class="icon"><img src="../../graphics/refresh.png" /></td>
<td><a href="edit.php?dn=<?php echo $encoded_dn; ?>" title="<?php echo _('Refresh'); ?>"><?php echo _('Refresh'); ?></a></td>
<?php if( $show_internal_attrs ) { ?>
<td class="icon"><img src="../../graphics/tools-no.png" /></td>
<td><a href="edit.php?dn=<?php echo $encoded_dn; ?>"><?php echo _('Hide internal attributes'); ?></a></td>
<?php } else { ?>
<td class="icon"><img src="../../graphics/tools.png" /></td>
<td><a href="edit.php?dn=<?php echo $encoded_dn; ?>&amp;show_internal_attrs=true"><?php echo _('Show internal attributes'); ?></a></td>
<?php } ?>
</tr>
<tr>
<?php if (checkIfWriteAccessIsAllowed()) { ?>
<td class="icon"><img src="../../graphics/delete.gif" /></td>
<td><a style="color: red" href="delete_form.php?dn=<?php echo $encoded_dn; ?>">
<?php echo _('Delete'); ?></a></td>
<?php } ?>
<td class="icon"><img src="../../graphics/save.png" /></td>
<td><a href="export_form.php?dn=<?php echo $encoded_dn; ?>">
<?php echo _('Export'); ?></a></td>
</tr>
<?php if (checkIfWriteAccessIsAllowed()) { ?>
<tr>
<td class="icon"><img src="../../graphics/light.png" /></td>
<td colspan="3"><span class="tree_hint"><?php echo _('Hint: To delete an attribute, empty the text field and click save.'); ?></span></td>
</tr>
<tr>
<td class="icon"><img src="../../graphics/star.png" /></td>
<td><a href="<?php echo "create_form.php?container=$encoded_dn"; ?>"><?php echo _('Create new entry'); ?></a></td>
<td class="icon"><img src="../../graphics/add.png" /></td>
<td><a href="<?php echo "add_attr_form.php?dn=$encoded_dn"; ?>"><?php echo _('Add new attribute'); ?></a></td>
</tr>
<?php } ?>
<?php flush(); ?>
<?php if( $modified_attrs ) { ?>
<tr>
<td class="icon"><img src="../../graphics/light.png" /></td>
<?php if( count( $modified_attrs ) > 1 ) { ?>
<td colspan="3"><?php echo sprintf( _('Some attributes (%s) were modified and are highlighted below.'), implode( ', ', $modified_attrs ) ); ?></td>
<?php } else { ?>
<td colspan="3"><?php echo sprintf( _('An attribute (%s) was modified and is highlighted below.'), implode( '', $modified_attrs ) ); ?></td>
<?php } ?>
</tr>
<?php
// lower-case all the modified attrs to remove ambiguity when searching the array later
foreach( $modified_attrs as $i => $attr ) {
$modified_attrs[$i] = strtolower( $attr );
}
}
?>
</table>
<?php flush(); ?>
<br />
<table class="tree_edit_dn">
<?php
if( $show_internal_attrs ) {
$counter = 0;
foreach( get_entry_system_attrs( $dn ) as $attr => $vals ) {
$counter++;
$schema_href = "../schema/schema.php?view=attributes&amp;viewvalue=" . real_attr_name($attr);
?>
<tr>
<td class="attr">
<b><?php echo htmlspecialchars($attr); ?></b>
</td>
<td>
<?php
if( is_attr_binary( $attr ) ) {
$href = "download_binary_attr.php?dn=$encoded_dn&amp;attr=$attr";
?>
<small>
<?php echo _('Binary value'); ?><br />
<?php if( count( $vals ) > 1 ) { for( $i=1; $i<=count($vals); $i++ ) { ?>
<a href="<?php echo $href . "&amp;value_num=$i"; ?>"><img
src="../../graphics/save.png" /> <?php echo _('download value'); ?>(<?php echo $i; ?>)</a><br />
<?php } } else { ?>
<a href="<?php echo $href; ?>"><img src="../../graphics/save.png" /> <?php echo _('download value'); ?></a><br />
<?php }
} else {
foreach( $vals as $v ) {
echo htmlspecialchars( $v );
echo "<br />\n";
}
} ?>
</td>
</tr>
<?php }
if( $counter == 0 )
echo "<tr><td colspan=\"2\">(" . _('No internal attributes') . ")</td></tr>\n";
}
?>
<?php flush(); ?>
<!-- Table of attributes/values to edit -->
<form action="update_confirm.php" method="post" name="edit_form">
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
<?php $counter=0; ?>
<?php
if( ! $attrs || ! is_array( $attrs ) ) {
echo "<tr><td colspan=\"2\">(" . _('This entry has no attributes') . ")</td></tr>\n";
echo "</table>";
echo "</html>";
die();
}
uksort( $attrs, 'sortAttrs' );
foreach( $attrs as $attr => $vals ) {
flush();
$schema_attr = get_schema_attribute( $attr, $dn );
if( $schema_attr )
$attr_syntax = $schema_attr->getSyntaxOID();
else
$attr_syntax = null;
if( 0 == strcasecmp( $attr, 'dn' ) )
continue;
// Setup the $attr_note, which will be displayed to the right of the attr name (if any)
$attr_note = '';
$attr_note = "";
$attr_display = $attr;
// is this attribute required by an objectClass?
$required_by = '';
if( $schema_attr )
foreach( $schema_attr->getRequiredByObjectClasses() as $required )
if( in_array( strtolower( $required ), arrayLower( $attrs['objectClass'] ) ) ) {
$required_by .= $required . ' ';
}
if( $required_by ) {
if( trim( $attr_note ) )
$attr_note .= ', ';
$attr_note .= "<acronym title=\"" . sprintf( _('Required attribute for objectClass(es) %s'), $required_by ) . "\">" . _('required') . "</acronym>&nbsp;";
}
?>
<?php
if( is_array( $modified_attrs ) && in_array( strtolower($attr), $modified_attrs ) )
$is_modified_attr = true;
else
$is_modified_attr = false;
?>
<?php if( $is_modified_attr ) { ?>
<tr class="updated_attr">
<?php } else { ?>
<tr>
<?php } ?>
<td class="attr">
<?php $schema_href="../schema/schema.php?view=attributes&amp;viewvalue=" . real_attr_name($attr); ?>
<b>
<a href="<?php echo $schema_href; ?>"><?php echo $attr_display; ?></a></b>
</td>
<td class="attr_note">
<sup><small><?php echo $attr_note; ?></small></sup>
</td>
</tr>
<?php if( $is_modified_attr ) { ?>
<tr class="updated_attr">
<?php } else { ?>
<tr>
<?php } ?>
<td class="val" colspan="2">
<?php
/*
* Is this attribute a jpegPhoto?
*/
if( is_jpeg_photo( $attr ) ) {
draw_jpeg_photos( $dn, $attr, true );
// proceed to the next attribute
echo "</td></tr>\n";
if( $is_modified_attr )
echo '<tr class="updated_attr"><td class="bottom" colspan="2"></td></tr>';
continue;
}
/*
* Is this attribute binary?
*/
if( is_attr_binary( $attr ) ) {
$href = "download_binary_attr.php?dn=$encoded_dn&amp;attr=$attr";
?>
<small>
<?php echo _('Binary value'); ?><br />
<?php if( count( $vals ) > 1 ) { for( $i=1; $i<=count($vals); $i++ ) { ?>
<a href="<?php echo $href . "&amp;value_num=$i"; ?>"><img
src="../../graphics/save.png" /> <?php echo _('download value'); ?>(<?php echo $i; ?>)</a><br />
<?php } } else { ?>
<a href="<?php echo $href; ?>"><img src="../../graphics/save.png" /> <?php echo _('download value'); ?></a><br />
<?php } ?>
<a href="javascript:deleteAttribute( '<?php echo $attr; ?>' );"
style="color:red;"><img src="../../graphics/delete.gif" /> <?php echo _('delete attribute'); ?></a>
</small>
</td>
</tr>
<?php
if( $is_modified_attr )
echo '<tr class="updated_attr"><td class="bottom" colspan="2"></td></tr>';
continue;
}
/*
* Note: at this point, the attribute must be text-based (not binary or jpeg)
*/
/*
* Is this a userPassword attribute?
*/
if( 0 == strcasecmp( $attr, 'userpassword' ) ) {
$user_password = $vals[0];
$enc_type = get_enc_type( $user_password );
?>
<input type="hidden"
name="old_values[userpassword]"
value="<?php echo htmlspecialchars($user_password); ?>" />
<!-- Special case of enc_type to detect changes when user changes enc_type but not the password value -->
<input size="38"
type="hidden"
name="old_enc_type"
value="<?php echo ($enc_type==''?'PLAIN':$enc_type); ?>" />
<br />
<input style="width: 260px"
type="password"
name="new_values[userpassword]"
value="<?php echo htmlspecialchars( $user_password ); ?>" />
<select name="enc_type">
<option>PLAIN</option>
<option<?php echo $enc_type=='CRYPT'?' selected="true"':''; ?>>CRYPT</option>
<option<?php echo $enc_type=='MD5'?' selected="true"':''; ?>>MD5</option>
<option<?php echo $enc_type=='SMD5'?' selected="true"':''; ?>>SMD5</option>
<option<?php echo $enc_type=='SHA'?' selected="true"':''; ?>>SHA</option>
<option<?php echo $enc_type=='SSHA'?' selected="true"':''; ?>>SSHA</option>
</select>
<br />
</td></tr>
<?php
if( $is_modified_attr )
echo '<tr class="updated_attr"><td class="bottom" colspan="2"></td></tr>';
continue;
}
/*
* Is this a boolean attribute?
*/
if( is_attr_boolean( $attr) ) {
$val = $vals[0];
?>
<input type="hidden"
name="old_values[<?php echo htmlspecialchars( $attr ); ?>]"
value="<?php echo htmlspecialchars($val); ?>" />
<select name="new_values[<?php echo htmlspecialchars( $attr ); ?>]">
<option value="TRUE"<?php echo ($val=='TRUE' ? ' selected' : ''); ?>>
<?php echo _('true'); ?></option>
<option value="FALSE"<?php echo ($val=='FALSE' ? ' selected' : ''); ?>>
<?php echo _('false'); ?></option>
<option value="">(<?php echo _('none, remove value'); ?>)</option>
</select>
</td>
</tr>
<?php
if( $is_modified_attr )
echo '<tr class="updated_attr"><td class="bottom" colspan="2"></td></tr>';
continue;
}
/*
* End of special case attributes (non plain text).
*/
/*
* This is a plain text attribute, to be displayed and edited in plain text.
*/
foreach( $vals as $i => $val ) {
$input_name = "new_values[" . htmlspecialchars( $attr ) . "][$i]";
// We smack an id="..." tag in here that doesn't have [][] in it to allow the
// draw_chooser_link() to identify it after the user clicks.
$input_id = "new_values_" . htmlspecialchars($attr) . "_" . $i;
?>
<!-- The old_values array will let update.php know if the entry contents changed
between the time the user loaded this page and saved their changes. -->
<input type="hidden"
name="old_values[<?php echo htmlspecialchars( $attr ); ?>][<?php echo $i; ?>]"
value="<?php echo htmlspecialchars($val); ?>" />
<?php
// Is this value is a structural objectClass, make it read-only
if( 0 == strcasecmp( $attr, 'objectClass' ) ) {
?>
<a
href="../schema/schema.php?view=objectClasses&amp;viewvalue=<?php echo htmlspecialchars( $val ); ?>"><img
src="../../graphics/tree_info.png" /></a>
<?php
$schema_object = get_schema_objectclass( $val);
if (is_object($schema_object) && $schema_object->type == 'structural') {
echo "$val <small>(<acronym>" .
_('structural') . "</acronym>)</small><br />";
?>
<input type="hidden"
name="<?php echo $input_name; ?>"
id="<?php echo $input_id; ?>"
value="<?php echo htmlspecialchars($val); ?>" />
<?php
continue;
}
}
?>
<?php if( is_mail_string( $val ) ) { ?>
<a
href="mailto:<?php echo htmlspecialchars($val); ?>"><img
style="vertical-align: center" src="../../graphics/mail.png" /></a>
<?php } elseif( is_url_string( $val ) ) { ?>
<a
href="<?php echo htmlspecialchars($val); ?>"
target="new"><img
style="vertical-align: center" src="../../graphics/dc.png" /></a>
<?php } ?>
<?php if( is_multi_line_attr( $attr, $val ) ) { ?>
<textarea
class="val"
rows="3"
cols="50"
name="<?php echo $input_name; ?>"
id="<?php echo $input_id; ?>"><?php echo htmlspecialchars($val); ?></textarea>
<?php } else { ?>
<input type="text"
class="val"
name="<?php echo $input_name; ?>"
id="<?php echo $input_id; ?>"
value="<?php echo htmlspecialchars($val); ?>" />
<?php } ?>
<?php
?>
<br />
<?php } /* end foreach value */ ?>
<?php
/* Draw the "add value" link under the list of values for this attributes */
if( ( $schema_attr = get_schema_attribute( $attr, $dn ) ) &&
! $schema_attr->getIsSingleValue() && checkIfWriteAccessIsAllowed() )
{
$add_href = "add_value_form.php?dn=$encoded_dn&amp;attr=" . rawurlencode( $attr );
echo "<div class=\"add_value\">(<a href=\"$add_href\">" .
_('add value') . "</a>)</div>\n";
}
?>
</td>
</tr>
<?php if( $is_modified_attr ) { ?>
<tr class="updated_attr"><td class="bottom" colspan="2"></td></tr>
<?php } ?>
<?php
flush();
} /* End foreach( $attrs as $attr => $vals ) */ ?>
<?php if (checkIfWriteAccessIsAllowed()) { ?>
<tr><td colspan="2"><center><input type="submit" value="<?php echo _('Save'); ?>" /></center></td></tr>
<?php } ?>
</form>
<?php
?>
</table>
<?php /* If this entry has a binary attribute, we need to provide a form for it to submit when deleting it. */ ?>
<script language="javascript">
//<!--
function deleteAttribute( attrName )
{
if( confirm( "<?php echo _('Really delete attribute?'); ?> '" + attrName + "'" ) ) {
document.delete_attribute_form.attr.value = attrName;
document.delete_attribute_form.submit();
}
}
//-->
</script>
<!-- This form is submitted by JavaScript when the user clicks "Delete attribute" on a binary attribute -->
<form name="delete_attribute_form" action="delete_attr.php" method="post">
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
<input type="hidden" name="attr" value="FILLED IN BY JAVASCRIPT" />
</form>
<?php
echo "</body>\n</html>";
?>

View File

@ -1,83 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* This script alters the session variable 'tree', expanding it
* at the dn specified in the query string.
*
* Variables that come in as GET vars:
* - dn (rawurlencoded)
*
* Note: this script is equal and opposite to collapse.php
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
// start session
startSecureSession();
setlanguage();
// This allows us to display large sub-trees without running out of time.
@set_time_limit( 0 );
$dn = $_GET['dn'];
$encoded_dn = rawurlencode( $dn );
initialize_session_tree();
$tree = $_SESSION['tree'];
$tree_icons = $_SESSION['tree_icons'];
$contents = get_container_contents($dn, 0, '(objectClass=*)');
usort( $contents, 'pla_compare_dns' );
$tree[$dn] = $contents;
foreach( $contents as $dn )
$tree_icons[$dn] = get_icon( $dn );
$_SESSION['tree'] = $tree;
$_SESSION['tree_icons'] = $tree_icons;
header( "Location:tree.php" );
?>

View File

@ -1,133 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* @package lists
* @subpackage tree
* @author The phpLDAPadmin development team
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** export functions */
require '../../lib/export.inc';
/** common functions */
require '../../lib/tree.inc';
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** status messages */
include_once('../../lib/status.inc');
// start session
startSecureSession();
setlanguage();
$base_dn = isset($_POST['dn']) ? $_POST['dn']:NULL;
$format = isset( $_POST['format'] ) ? $_POST['format'] : "unix";
$scope = isset($_POST['scope']) ? $_POST['scope'] : 'base';
$filter = isset($_POST['filter']) ? $_POST['filter'] : 'objectclass=*';
$target = isset($_POST['target']) ? $_POST['target'] : 'display';
$save_as_file = isset( $_POST['save_as_file'] ) && $_POST['save_as_file'] == 'on';
// add system attributes if needed
$attributes = array();
if( isset( $_POST['sys_attr'] ) ){
array_push($attributes,'*');
array_push($attributes,'+');
}
$exporter_id = $_POST['exporter_id'];
// Initialisation of other variables
$rdn = get_rdn( $base_dn );
$friendly_rdn = get_rdn( $base_dn, 1 );
$extension = $exporters[$exporter_id]['extension'];
//set the default CRLN to Unix format
$br = "\n";
// default case not really needed
switch( $format ) {
case 'win':
$br = "\r\n";
break;
case 'mac':
$br = "\r";
break;
case 'unix':
default:
$br = "\n";
}
// get the decoree,ie the source
$plaLdapExporter = new PlaLdapExporter($filter,$base_dn,$scope,$attributes);
// the decorator
// do it that way for the moment
$exporter = NULL;
switch($exporter_id){
case 0:
$exporter = new PlaLdifExporter($plaLdapExporter);
break;
case 1:
$exporter = new PlaDsmlExporter($plaLdapExporter);
break;
case 2:
$exporter = new PlaVcardExporter($plaLdapExporter);
break;
case 3:
$exporter = new PlaCSVExporter($plaLdapExporter);
break;
}
// set the CLRN
$exporter->setOutputFormat($br);
// prevent script from bailing early for long search
@set_time_limit( 0 );
// send the header
if( $save_as_file )
header( "Content-type: application/download" );
else
header( "Content-type: text/plain" );
header( "Content-Disposition: filename=$friendly_rdn.".$exporters[$exporter_id]['extension'] );
header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: post-check=0, pre-check=0", false );
// and export
$exporter->export();
?>

View File

@ -1,191 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* export_form.php
* --------------------
*
* Html form to choose an export format(ldif,...)
*
* @package lists
* @subpackage tree
* @author The phpLDAPadmin development team
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** export functions */
require '../../lib/export.inc';
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** status messages */
include_once('../../lib/status.inc');
// start session
startSecureSession();
setlanguage();
$format = isset( $_GET['format'] ) ? $_GET['format'] : get_line_end_format();
$scope = isset( $_GET['scope'] ) ? $_GET['scope'] : 'base' ;
$exporter_id = isset( $_GET['exporter_id'] ) ? $_GET['exporter_id'] : 0 ;
$dn = isset( $_GET['dn'] ) ? $_GET['dn'] : null;
$filter = isset( $_GET['filter'] ) ? $_GET['filter'] : '(objectClass=*)';
$attributes = isset( $_GET['attributes'] ) ? $_GET['attributes'] : '*';
$sys_attr = isset( $_GET['sys_attr'] ) && $_GET['sys_attr'] == 'true' ? true : false;
$available_formats = array(
'unix' => 'UNIX (Linux, BSD)',
'mac' => 'Macintosh',
'win' => 'Windows'
);
$available_scopes = array(
'base' => _('Base (base DN only)'),
'one' => _('One (one level beneath base)'),
'sub' => _('Sub (entire subtree)')
);
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head>\n";
?>
<body>
<h3 class="tree_title"><?php echo _('Export'); ?></h3>
<br />
<center>
<form name="export_form" action="export.php" method="POST">
<table class="export_form">
<tr>
<td>
<fieldset>
<legend><?php echo _('Export'); ?></legend>
<table>
<tr>
<td style="white-space:nowrap"><?php echo _('Base DN'); ?></td>
<td><nobr><input type="text" name="dn" id="dn" style="width:230px" value="<?php echo htmlspecialchars( $dn ); ?>" /></nobr></td>
</tr>
<tr>
<td><span style="white-space: nowrap"><?php echo _('Search scope'); ?></span></td>
<td>
<?php foreach( $available_scopes as $id => $desc ) {
$id = htmlspecialchars( $id );
$desc = htmlspecialchars( $desc ); ?>
<input type="radio" name="scope" value="<?php echo $id; ?>" id="<?php echo $id; ?>"<?php if($id==$scope) echo ' checked="true"';?> /><label for="<?php echo $id; ?>"><?php echo $desc; ?></label><br />
<?php } ?>
</td>
</tr>
<tr>
<td><?php echo _('Search filter'); ?></td>
<td><input type="text" name="filter" style="width:300px" value="<?php echo htmlspecialchars($filter); ?>" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="checkbox" name="sys_attr" id="sys_attr" <?php if( $sys_attr ) echo 'checked="true" '; ?>/> <label for="sys_attr"><?php echo _('Include system attributes'); ?></label></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="checkbox" id="save_as_file" name="save_as_file" /><label for="save_as_file"><?php echo _('Save as file'); ?></label></td>
</tr>
</table>
</fieldset>
</td>
</tr>
<tr>
<td>
<table style="width: 100%">
<tr><td style="width: 50%">
<fieldset style="height: 100px">
<legend><?php echo _('Export format'); ?></legend>
<?php foreach($exporters as $index => $exporter){?>
<input type="radio" name="exporter_id" value="<?php echo htmlspecialchars($index); ?>" id="<?php echo htmlspecialchars($index); ?>" <?php if($index==$exporter_id) echo ' checked="true"'; ?> />
<label for="<?php echo htmlspecialchars( $index ); ?>"><?php echo htmlspecialchars( $exporter['desc'] ); ?></label><br />
<?php } ?>
</fieldset>
</td>
<td style="width: 50%">
<fieldset style="height: 100px">
<legend><?php echo _('Line ends'); ?></legend>
<?php foreach( $available_formats as $id => $desc ) {
$id = htmlspecialchars( $id );
$desc = htmlspecialchars( $desc );
?>
<input type="radio" name="format" value="<?php echo $id; ?>" id="<?php echo $id; ?>"<?php if($format==$id) echo ' checked="true"'; ?> /><label for="<?php echo $id; ?>"><?php echo $desc; ?></label><br />
<?php } ?>
</fieldset>
</td></tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<center>
<input type="submit" name="target" value="<?php echo _('Ok'); ?>" />
</center>
</td>
</tr>
</table>
</form>
</center>
</body>
</html>
<?php
/**
* Helper functoin for fetching the line end format.
* @return String 'win', 'unix', or 'mac' based on the user's browser..
*/
function get_line_end_format()
{
if( is_browser_os_windows() )
return 'win';
elseif( is_browser_os_unix() )
return 'unix';
elseif( is_browser_os_mac() )
return 'mac';
else
return 'unix';
}

View File

@ -1,158 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Recursively deletes the specified DN and all of its children
* Variables that come in as POST vars:
* - dn (rawurlencoded)
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** status messages */
include_once('../../lib/status.inc');
// start session
startSecureSession();
// die if no write access
if (!checkIfWriteAccessIsAllowed()) die();
setlanguage();
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head>\n";
$dn = $_POST['dn'];
$encoded_dn = rawurlencode( $dn );
$rdn = get_rdn( $dn );
$ds = $_SESSION['ldap']->server();
echo "<body>\n";
echo "<h3 class=\"tree_title\">" . sprintf( _('Deleting %s'), htmlspecialchars($rdn) ) . "</h3>\n";
echo "<h3 class=\"tree_subtitle\">" . _('Recursive delete progress') . "</h3>";
echo "<br /><br />";
echo "<small>\n";
flush();
// prevent script from bailing early on a long delete
@set_time_limit( 0 );
$del_result = pla_rdelete( $dn );
echo "</small><br />\n";
if( $del_result )
{
// kill the DN from the tree browser session variable and
// refresh the tree viewer frame (left_frame)
if( array_key_exists( 'tree', $_SESSION ) )
{
$tree = $_SESSION['tree'];
// does it have children? (it shouldn't, but hey, you never know)
if( isset( $tree[$dn] ) )
unset( $tree[$dn] );
// Get a tree in the session if not already gotten
initialize_session_tree();
// search and destroy from the tree sesssion
foreach( $tree as $tree_dn => $subtree )
foreach( $subtree as $key => $sub_tree_dn )
if( 0 == strcasecmp( $sub_tree_dn, $dn ) )
unset( $tree[$tree_dn][$key] );
}
$_SESSION['tree'] = $tree;
?>
<script language="javascript">
parent.left_frame.location.reload();
</script>
<?php
echo sprintf( _('Entry %s and sub-tree deleted successfully.'), '<b>' . htmlspecialchars( $dn ) . '</b>' );
} else {
StatusMessage("ERROR", _('Failed to delete entry %s'), '', array(htmlspecialchars($dn)));
}
echo "</body></html>";
exit;
function pla_rdelete( $dn )
{
$children = get_container_contents( $dn );
global $ds;
$ds = $_SESSION['ldap']->server();
if( ! is_array( $children ) || count( $children ) == 0 ) {
echo "<nobr>" . sprintf( _('Deleting %s'), htmlspecialchars( $dn ) ) . "...";
flush();
if( @ldap_delete( $ds, $dn ) ) {
echo " <span style=\"color:green\">" . _('Success') . "</span></nobr><br />\n";
return true;
} else {
StatusMessage("ERROR", _('Failed to delete entry %s'), '', array(htmlspecialchars($dn)));
}
} else {
foreach( $children as $child_dn ) {
pla_rdelete( $child_dn );
}
echo "<nobr>" . sprintf( _('Deleting %s'), htmlspecialchars( $dn ) ) . "...";
flush();
if( @ldap_delete( $ds, $dn ) ) {
echo " <span style=\"color:green\">" . _('Success') . "</span></nobr><br />\n";
return true;
} else {
StatusMessage("ERROR", _('Failed to delete entry %s'), '', array(htmlspecialchars($dn)));
}
}
return false;
}

View File

@ -1,90 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* This script alters the session variable 'tree', by re-querying
* the LDAP server to grab the contents of every expanded container.
*
* Variables that come in as GET vars:
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
// start session
startSecureSession();
if( ! array_key_exists( 'tree', $_SESSION ) )
header( "Location: tree.php" );
$tree = $_SESSION['tree'];
$tree_icons = $_SESSION['tree_icons'];
// Get the icon for the base object for this server
$base_dn = $_SESSION['config']->get_Suffix('tree');
$tree_icons[ $base_dn ] = get_icon( $base_dn );
// get all the icons and container contents for all expanded entries
if( isset($tree) && is_array( $tree ) )
{
foreach( $tree as $dn => $children )
{
$tree[$dn] = get_container_contents( $dn, 0, '(objectClass=*)' );
if( is_array( $tree[$dn] ) ) {
foreach( $tree[$dn] as $child_dn )
$tree_icons[$child_dn] = get_icon( $child_dn );
sort( $tree[ $dn ] );
}
}
}
else
{
header( "Location: tree.php" );
}
$_SESSION['tree'] = $tree;
$_SESSION['tree_icons'] = $tree_icons;
session_write_close();
header( "Location: tree.php" );
?>

View File

@ -1,197 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* 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#<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 lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
// start session
startSecureSession();
setlanguage();
// This allows us to display large sub-trees without running out of time.
@set_time_limit( 0 );
// do we not have a tree and tree icons yet? Build a new one.
initialize_session_tree();
// get the tree and tree icons.
$tree = $_SESSION['tree'];
$tree_icons = $_SESSION['tree_icons'];
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head>\n";
?>
<body>
<table class="tree" cellspacing="0">
<?php
draw_server_tree();
?>
</table>
<?php
// echo "<pre>"; print_r( $tree );
?>
</body>
</html>
<?php
exit;
/**
* Recursively descend on the given dn and draw the tree in html
*/
function draw_tree_html( $dn, $level = 0 )
{
global $tree, $tree_icons, $search_result_size_limit;
$encoded_dn = rawurlencode( $dn );
$expand_href = "expand.php?dn=$encoded_dn";
$collapse_href = "collapse.php?dn=$encoded_dn";
$edit_href = "edit.php?dn=$encoded_dn";
// should never happen, but just in case
if( ! isset( $tree_icons[ $dn ] ) )
$tree_icons[ $dn ] = get_icon( $dn );
$img_src = '../../graphics/' . $tree_icons[ $dn ];
$rdn = get_rdn( $dn );
echo '<tr>';
for( $i=0; $i<=$level; $i++ ) {
echo '<td class="spacer"></td>' . "\n";
}
// is this node expanded? (deciding whether to draw "+" or "-")
if( isset( $tree[$dn] ) ) { ?>
<td class="expander">
<nobr>
<a href="<?php echo $collapse_href; ?>"><img src="../../graphics/minus.png" alt="-" /></a>
</nobr>
</td>
<?php $child_count = number_format( count( $tree[$dn] ) );
} else { ?>
<td class="expander">
<nobr>
<a href="<?php echo $expand_href; ?>"><img src="../../graphics/plus.png" alt="+" /></a>
</nobr>
</td>
<?php $limit = isset( $search_result_size_limit ) ? $search_result_size_limit : 50;
$child_count = count( get_container_contents( $dn, $limit+1,
'(objectClass=*)') );
if( $child_count > $limit )
$child_count = $limit . '+';
} ?>
<td class="icon">
<a href="<?php echo $edit_href; ?>"
target="right_frame"
name="<?php echo $encoded_dn; ?>"><img src="<?php echo $img_src; ?>" alt="img" /></a>
</td>
<td class="rdn" colspan="<?php echo (97-$level); ?>">
<nobr>
<a href="<?php echo $edit_href; ?>"
target="right_frame"><?php echo ( draw_formatted_dn( $dn ) ); /*pretty_print_dn( $rdn ) );*/ ?></a>
<?php if( $child_count ) { ?>
<span class="count">(<?php echo $child_count; ?>)</span>
<?php } ?>
</nobr>
</td>
</tr>
<?php
if( isset( $tree[$dn] ) && is_array( $tree[$dn] ) ) {
// Draw the "create new" link at the top of the tree list if there are more than 10
// entries in the listing for this node.
if( count( $tree[$dn] ) > 10 )
draw_create_link( $rdn, $level, $encoded_dn );
foreach( $tree[$dn] as $dn )
draw_tree_html( $dn, $level+1 );
// Always draw the "create new" link at the bottom of the listing
draw_create_link( $rdn, $level, $encoded_dn );
}
}
function draw_create_link( $rdn, $level, $encoded_dn )
{
if (!checkIfWriteAccessIsAllowed()) {
return;
}
// print the "Create New object" link.
$create_html = "";
$create_href = "create_form.php?container=$encoded_dn";
$create_html .= '<tr>';
for( $i=0; $i<=$level; $i++ ) {
$create_html .= '<td class="spacer"></td>';
}
$create_html .= '<td class="spacer"></td>';
$create_html .= '<td class="icon"><a href="' . $create_href .
'" target="right_frame"><img src="../../graphics/star.png" alt="' . _('Create new entry') . '" /></a></td>';
$create_html .= '<td class="create" colspan="' . (97-$level) . '"><a href="' . $create_href .
'" target="right_frame" title="' . _('Create new entry') . ' ' . $rdn.'">' .
_('Create new entry') . '</a></td>';
$create_html .= '</tr>';
echo $create_html;
}
?>

View File

@ -1,85 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* This file includes the main frame of the LDAP browser.
*
* @package lists
* @subpackage tree
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
// start session
startSecureSession();
// get encoding
$lang = explode(":",$_SESSION['language']);
$lang = $lang[1];
$dn = $_SESSION['config']->get_Suffix('tree');
// init tree
if (! isset($_SESSION['tree'])) {
initialize_session_tree();
$tree = $_SESSION['tree'];
$tree_icons = $_SESSION['tree_icons'];
$contents = get_container_contents($dn, 0, '(objectClass=*)');
usort( $contents, 'pla_compare_dns' );
$tree[$dn] = $contents;
foreach( $contents as $c )
$tree_icons[$c] = get_icon( $c );
$_SESSION['tree'] = $tree;
$_SESSION['tree_icons'] = $tree_icons;
}
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">";
echo "<html>";
echo "<head>";
echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=$lang\">";
echo "<meta http-equiv=\"pragma\" content=\"no-cache\">";
echo "<meta http-equiv=\"cache-control\" content=\"no-cache\">";
echo "<title>LDAP Account Manager</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\"></head>";
echo "<frameset cols=\"320,*\" style=\"border-width: 0;\">";
echo "<frame src=\"./tree.php\" name=\"left_frame\" frameborder=\"0\" scrolling=\"yes\" noresize>";
echo "<frame src=\"./edit.php?dn=$dn\" name=\"right_frame\" frameborder=\"0\" scrolling=\"yes\">";
echo "<noframes>";
echo "This page requires a browser that can show frames!";
echo "</noframes>";
echo "</frameset>";
echo "</html>";
?>

View File

@ -1,113 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Updates or deletes a value from a specified
* attribute for a specified dn.
* Variables that come in on the query string:
* - dn (rawurlencoded)
* - update_array (an array in the form expected by PHP's ldap_modify, except for deletions)
* (will never be empty: update_confirm.php ensures that)
*
* Attribute deletions:
* To specify that an attribute is to be deleted (whether multi- or single-valued),
* enter that attribute in the update array like this: attr => ''. For example, to
* delete the 'sn' attribute from an entry, the update array would look like this:
* Array (
* sn => ''
* )
*
* On success, redirect to edit.php
* On failure, echo an error.
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
// start session
startSecureSession();
// die if no write access
if (!checkIfWriteAccessIsAllowed()) die();
setlanguage();
$dn = $_POST['dn'];
$encoded_dn = rawurlencode( $dn );
$update_array = $_POST['update_array'];
// check for delete attributes (indicated by the attribute entry appearing like this: attr => ''
foreach( $update_array as $attr => $val )
if( ! is_array( $val ) )
if( $val == '' ) {
$update_array[ $attr ] = array();
}
else {
$update_array[ $attr ] = $val;
}
else {
foreach( $val as $i => $v ) {
$update_array[ $attr ][ $i ] = $v;
}
}
$ds = $_SESSION['ldap']->server();
$res = @ldap_modify( $ds, $dn, $update_array );
if( $res )
{
$redirect_url = "edit.php?dn=$encoded_dn";
foreach( $update_array as $attr => $junk )
$redirect_url .= "&modified_attrs[]=$attr";
header( "Location: $redirect_url" );
}
else
{
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head>\n";
echo "<body>";
StatusMessage('ERROR', _("Was unable to modify attributes from DN: %s."), ldap_error( $ds ), array($dn));
echo "</body></html>";
}
?>

View File

@ -1,263 +0,0 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
This code is based on phpLDAPadmin.
Copyright (C) 2004 David Smith and phpLDAPadmin developers
The original code was modified to fit for LDAP Account Manager by Roland Gruber.
Copyright (C) 2005 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Takes the results of clicking "Save" in edit.php and determines which
* attributes need to be updated (ie, which ones actually changed). Then,
* we present a confirmation table to the user outlining the changes they
* are about to make. That form submits directly to update.php, which
* makes the change.
*
* @package lists
* @subpackage tree
* @author David Smith
* @author Roland Gruber
*/
/** security functions */
include_once('../../lib/security.inc');
/** tree functions */
include_once('../../lib/tree.inc');
/** access to configuration */
include_once('../../lib/config.inc');
/** LDAP functions */
include_once('../../lib/ldap.inc');
/** common functions */
include_once('../../lib/account.inc');
// start session
startSecureSession();
// die if no write access
if (!checkIfWriteAccessIsAllowed()) die();
setlanguage();
$dn = $_POST['dn'];
$encoded_dn = rawurlencode( $dn );
$rdn = get_rdn( $dn );
$old_values = $_POST['old_values'];
$new_values = $_POST['new_values'];
$mkntPassword = NULL;
$samba_password_step = 0;
echo $_SESSION['header'];
echo "<title>LDAP Account Manager</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head>\n";
?>
<body>
<h3 class="tree_title"><?php echo htmlspecialchars( ( $rdn ) ); ?></h3>
<h3 class="tree_subtitle"><?php echo _('DN'); ?>: <b><?php echo htmlspecialchars( ( $dn ) ); ?></b></h3>
<?php
$update_array = array();
foreach( $old_values as $attr => $old_val )
{
// Did the user delete the field?
if( ! isset( $new_values[ $attr ] ) ) {
$update_array[ $attr ] = '';
}
// did the user change the field?
elseif( $old_val != $new_values[ $attr ] ) {
$new_val = $new_values[ $attr ];
// special case for userPassword attributes
if( 0 == strcasecmp( $attr, 'userPassword' ) && $new_val != '' ) {
$new_val = pwd_hash($new_val, true, $_POST['enc_type'] );
$password_already_hashed = true;
}
// special case for samba password
else if (( 0 == strcasecmp($attr,'sambaNTPassword') || 0 == strcasecmp($attr,'sambaLMPassword')) && trim($new_val[0]) != '' ){
if ( 0 == strcasecmp($attr,'sambaNTPassword')) {
$new_val = ntPassword($new_val[0]);
}
else {
$new_val = lmPassword($new_val[0]);
}
}
$update_array[ $attr ] = $new_val;
}
}
// special case check for a new enc_type for userPassword (not otherwise detected)
if( isset( $_POST['enc_type'] ) &&
! isset( $password_already_hashed ) &&
$_POST['enc_type'] != $_POST['old_enc_type'] &&
$_POST['enc_type'] != 'clear' &&
$_POST['new_values']['userpassword'] != '' ) {
$new_password = pwd_hash( $_POST['new_values']['userpassword'], true, $_POST['enc_type'] );
$update_array[ 'userpassword' ] = $new_password;
}
// strip empty vals from update_array and ensure consecutive indices for each attribute
foreach( $update_array as $attr => $val ) {
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] );
}
}
// at this point, the update_array should look like this (example):
// Array (
// cn => Array(
// [0] => 'Dave',
// [1] => 'Bob' )
// sn => 'Smith',
// telephoneNumber => '555-1234' )
// This array should be ready to be passed to ldap_modify()
?>
<?php if( count( $update_array ) > 0 ) { ?>
<br />
<center>
<?php echo _('Do you want to make these changes?'); ?>
<br />
<br />
<table class="tree_confirm">
<tr>
<th><?php echo _('Attribute'); ?></th>
<th><?php echo _('Old value'); ?></th>
<th><?php echo _('New value'); ?></th>
</tr>
<?php $counter=0; foreach( $update_array as $attr => $new_val ) { $counter++ ?>
<tr class="<?php echo $counter%2 ? 'even' : 'odd'; ?>">
<td><b><?php echo htmlspecialchars( $attr ); ?></b></td>
<td><nobr>
<?php
if( is_array( $old_values[ $attr ] ) )
foreach( $old_values[ $attr ] as $v )
echo nl2br( htmlspecialchars( $v ) ) . "<br />";
else
if( 0 == strcasecmp( $attr, 'userPassword' ) && ( is_null( get_enc_type( $old_values[ $attr ] ) ) ) ) {
echo preg_replace( '/./', '*', $old_values[ $attr ] ) . "<br />";
}
else {
echo nl2br( htmlspecialchars( $old_values[ $attr ] ) ) . "<br />";
}
echo "</nobr></td><td><nobr>";
// is this a multi-valued attribute?
if( is_array( $new_val ) ) {
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 />";
}
}
// was this a multi-valued attribute deletion? If so,
// 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 ] = '';
echo '<span style="color: red">' . _('[attribute deleted]') . '</span>';
}
}
else
if( $new_val != '' )
if( 0 == strcasecmp( $attr, 'userPassword' ) && ( is_null( get_enc_type( $new_values[ $attr ] ) ) ) ) {
echo preg_replace( '/./', '*', $new_val ) . "<br />";
}
else {
echo htmlspecialchars( $new_val ) . "<br />";
}
else
echo '<span style="color: red">' . _('[attribute deleted]') . '</span>';
echo "</nobr></td></tr>\n\n";
}
?>
</table>
<br />
<table>
<tr>
<td>
<!-- Commit button and acompanying form -->
<form action="update.php" method="post">
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
<?php foreach( $update_array as $attr => $val ) { ?>
<?php if( is_array( $val ) ) { ?>
<?php foreach( $val as $i => $v ) { ?>
<input type="hidden"
name="update_array[<?php echo htmlspecialchars( $attr ); ?>][<?php echo $i; ?>]"
value="<?php echo htmlspecialchars( $v ); ?>" />
<?php } ?>
<?php } else { ?>
<input type="hidden"
name="update_array[<?php echo htmlspecialchars( $attr ); ?>]"
value="<?php echo htmlspecialchars( $val ); ?>" />
<?php } ?>
<?php } ?>
<input type="submit" value="<?php echo _('Commit'); ?>"/>
</form>
</td>
<td>
<!-- Cancel button -->
<form action="edit.php" method="get">
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
<input type="submit" value="<?php echo _('Cancel'); ?>"/>
</form>
</td>
</tr>
</table>
</center>
</body>
<?php
} else { ?>
<center>
<?php echo _('You made no changes.'); ?>
<br><br><a href="edit.php?dn=<?php echo $encoded_dn; ?>"><?php echo _('Back'); ?></a>
</center>
<?php } ?>
</form>