RELEASE 1.1.0.2

This commit is contained in:
Deon George 2009-06-30 21:46:44 +10:00
parent f990f72eb5
commit 5c88e0a098
67 changed files with 1485 additions and 1484 deletions

View File

@ -1 +1 @@
$Name: RELEASE-1_1_0_1 $
$Name: RELEASE-1_1_0_2 $

View File

@ -111,8 +111,8 @@ $config->custom->commands['all'] = array(
/* If you want to choose the appearance of the tree, specify a class name which
inherits from the Tree class. */
// $config->custom->appearance['tree'] = "HTMLTree";
# $config->custom->appearance['tree'] = "PLMTree";
// $config->custom->appearance['tree'] = "AJAXTree";
# $config->custom->appearance['tree'] = "HTMLTree";
/* If you want to customise the entry view/edition, specify your factory name which
inherits from the EntryFactory class.
@ -404,6 +404,7 @@ $friendly_attrs = array();
$friendly_attrs['facsimileTelephoneNumber'] = 'Fax';
$friendly_attrs['telephoneNumber'] = 'Phone';
$friendly_attrs['uid'] = 'User Name';
/*********************************************/
/* Support for attrs display order */

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr.php,v 1.20 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr.php,v 1.20.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* Adds an attribute/value pair to an object
@ -21,7 +21,7 @@ require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $_SESSION['plaConfig']->isCommandAvailable('attribute_add'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute')));
$entry['val'] = get_request('val','POST');

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr_form.php,v 1.16 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr_form.php,v 1.16.2.2 2007/12/26 09:26:32 wurley Exp $
/**
* Displays a form for adding an attribute/value to an LDAP entry.
@ -85,9 +85,9 @@ if (is_array($ldap['attrs']['avail']) && count($ldap['attrs']['avail']) > 0) {
foreach ($ldap['attrs']['avail'] as $a) {
# is there a user-friendly translation available for this attribute?
if (isset($_SESSION['plaConfig']->friendly_attrs[strtolower($a)])) {
if ($_SESSION[APPCONFIG]->haveFriendlyName($a)) {
$attr_display = sprintf('%s (%s)',
htmlspecialchars($_SESSION['plaConfig']->friendly_attrs[strtolower($a)]),
htmlspecialchars($_SESSION[APPCONFIG]->getFriendlyName($a)),
htmlspecialchars($a));
} else {
@ -129,9 +129,9 @@ if (count($ldap['binattrs']['avail']) > 0) {
foreach ($ldap['binattrs']['avail'] as $a) {
# is there a user-friendly translation available for this attribute?
if (isset($_SESSION['plaConfig']->friendly_attrs[strtolower($a)])) {
if ($_SESSION[APPCONFIG]->haveFriendlyName($a)) {
$attr_display = sprintf('%s (%s)',
htmlspecialchars($_SESSION['plaConfig']->friendly_attrs[strtolower($a)]),
htmlspecialchars($_SESSION[APPCONFIG]->getFriendlyName($a)),
htmlspecialchars($a));
} else {

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value.php,v 1.21 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value.php,v 1.21.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* Adds a value to an attribute for a given dn.
@ -20,7 +20,7 @@
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $_SESSION['plaConfig']->isCommandAvailable('attribute_add_value'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute value')));
# The DN and ATTR we are working with.

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value_form.php,v 1.39 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value_form.php,v 1.39.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* Displays a form to allow the user to enter a new value to add
@ -48,7 +48,7 @@ if ($tree) {
}
// define the template of the entry if possible
eval('$reader = new '.$_SESSION['plaConfig']->GetValue('appearance','entry_reader').'($ldapserver);');
eval('$reader = new '.$_SESSION[APPCONFIG]->GetValue('appearance','entry_reader').'($ldapserver);');
$reader->visit('Start', $entry['ldap']);
if (! $entry['ldap'] || $entry['ldap']->isReadOnly())
@ -58,12 +58,12 @@ if (! $entry['ldap'] || $entry['ldap']->isReadOnly())
/* attribute values */
/*********************/
eval('$writer = new '.$_SESSION['plaConfig']->GetValue('appearance','entry_writer').'($ldapserver);');
eval('$writer = new '.$_SESSION[APPCONFIG]->GetValue('appearance','entry_writer').'($ldapserver);');
$ldap['attr'] = $entry['ldap']->getAttribute($entry['attr']['string']);
if (!$ldap['attr']) {
// define a new attribute for the entry
$attributefactoryclass = $_SESSION['plaConfig']->GetValue('appearance','attribute_factory');
$attributefactoryclass = $_SESSION[APPCONFIG]->GetValue('appearance','attribute_factory');
eval('$attribute_factory = new '.$attributefactoryclass.'();');
$ldap['attr'] = $attribute_factory->newAttribute($entry['attr']['string'], array());
$ldap['attr']->setEntry($entry['ldap']);
@ -72,9 +72,9 @@ $ldap['count'] = $ldap['attr']->getValueCount();
if ($ldap['attr']->isReadOnly())
pla_error(sprintf(_('The attribute (%s) is in readonly mode.'),$entry['attr']['html']),null,-1,true);
if (! $_SESSION['plaConfig']->isCommandAvailable('attribute_add_value'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute value')));
if (($ldap['attr']->getValueCount() == 0) && ! $_SESSION['plaConfig']->isCommandAvailable('attribute_add'))
if (($ldap['attr']->getValueCount() == 0) && ! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute')));
/*
@ -197,7 +197,7 @@ if ($entry['attr']['oclass']) {
echo '</td></tr></table>';
echo '<br />';
if ($_SESSION['plaConfig']->GetValue('appearance','show_hints'))
if ($_SESSION[APPCONFIG]->GetValue('appearance','show_hints'))
printf('<small><br /><img src="images/light.png" alt="Hint" /><span class="hint">%s</span></small>',
_('Note: You may be required to enter new attributes that these objectClass(es) require'));
echo '</form>';

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/cmd.php,v 1.3.2.1 2007/12/21 12:11:55 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/cmd.php,v 1.3.2.2 2007/12/24 10:45:57 wurley Exp $
/**
* @package phpLDAPadmin
@ -7,47 +7,48 @@
require_once './common.php';
$body = new block();
$file = '';
$cmd = get_request('cmd','REQUEST');
$meth = get_request('meth','REQUEST');
$www['cmd'] = get_request('cmd','REQUEST');
$www['meth'] = get_request('meth','REQUEST');
ob_start();
if (is_null($cmd)) {
$cmd = 'welcome';
}
if (is_null($www['cmd']))
$www['cmd'] = 'welcome';
switch ($cmd) {
switch ($www['cmd']) {
case '_debug' :
debug_dump($_REQUEST,1);
$file = '';
break;
default :
if (file_exists(HOOKSDIR.$cmd.'.php'))
$file = HOOKSDIR.$cmd.'.php';
elseif (file_exists(HTDOCDIR.$cmd.'.php'))
$file = HTDOCDIR.$cmd.'.php';
if (defined('HOOKSDIR') && file_exists(HOOKSDIR.$www['cmd'].'.php'))
$file = HOOKSDIR.$www['cmd'].'.php';
elseif (defined('HTDOCDIR') && file_exists(HTDOCDIR.$www['cmd'].'.php'))
$file = HTDOCDIR.$www['cmd'].'.php';
else
$file = 'welcome.php';
}
if ($file) {
include $file;
}
if (DEBUG_ENABLED)
debug_log('Ready to render page for command [%s,%s].',128,__FILE__,__LINE__,__METHOD__,$www['cmd'],$file);
$body->SetBody(ob_get_contents());
# Create page.
$www['page'] = new page($ldapserver->server_id);
if ($file)
include $file;
# Capture the output and put into the body of the page.
$www['body'] = new block();
$www['body']->SetBody(ob_get_contents());
$www['page']->block_add('body',$www['body']);
ob_end_clean();
if (DEBUG_ENABLED)
debug_log('Ready to render page for command [%s,%s].',128,__FILE__,__LINE__,__METHOD__,$cmd,$file);
$www = new page($ldapserver->server_id);
$www->block_add('body',$body);
if ($meth == 'get_body')
$www->body(true);
if ($www['meth'] == 'get_body')
$www['page']->body(true);
else
$www->display();
$www['page']->display();
?>

View File

@ -1,10 +1,12 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/common.php,v 1.3.2.1 2007/12/21 12:11:55 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/common.php,v 1.3.2.3 2007/12/26 08:21:10 wurley Exp $
/**
* @package phpLDAPadmin
*/
@define('LIBDIR',sprintf('%s/',realpath('../lib/')));
# This is just here to provide a convenient link back to the proper common.php
if (! defined('LIBDIR'))
define('LIBDIR',sprintf('%s/',realpath('../lib/')));
require_once LIBDIR.'common.php';
?>

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/compare.php,v 1.16 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/compare.php,v 1.16.2.2 2007/12/26 09:26:32 wurley Exp $
/**
* Compare two DNs - the destination DN is editable.
@ -20,11 +20,11 @@ $encoded_dn_dst = rawurlencode($dn_dst);
$server_id_src = (isset($_POST['server_id_src']) ? $_POST['server_id_src'] : '');
$server_id_dst = (isset($_POST['server_id_dst']) ? $_POST['server_id_dst'] : '');
$ldapserver_src = $_SESSION['plaConfig']->ldapservers->Instance($server_id_src);
$ldapserver_src = $_SESSION[APPCONFIG]->ldapservers->Instance($server_id_src);
if (! $ldapserver_src->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
$ldapserver_dst = $_SESSION['plaConfig']->ldapservers->Instance($server_id_dst);
$ldapserver_dst = $_SESSION[APPCONFIG]->ldapservers->Instance($server_id_dst);
if (! $ldapserver_src->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
@ -33,10 +33,8 @@ if (! $ldapserver_src->dnExists($dn_src))
if (! $ldapserver_dst->dnExists($dn_dst))
pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn_dst)));
$_SESSION['plaConfig']->friendly_attrs = process_friendly_attr_table();
$attrs_src = $ldapserver_src->getDNAttrs($dn_src,false,$_SESSION['plaConfig']->GetValue('deref','view'));
$attrs_dst = $ldapserver_dst->getDNAttrs($dn_dst,false,$_SESSION['plaConfig']->GetValue('deref','view'));
$attrs_src = $ldapserver_src->getDNAttrs($dn_src,false,$_SESSION[APPCONFIG]->GetValue('deref','view'));
$attrs_dst = $ldapserver_dst->getDNAttrs($dn_dst,false,$_SESSION[APPCONFIG]->GetValue('deref','view'));
# Get a list of all attributes.
$attrs_all = array_keys($attrs_src);
@ -118,13 +116,13 @@ foreach ($attrs_all as $attr) {
$required_note = '';
# is there a user-friendly translation available for this attribute?
if (isset($_SESSION['plaConfig']->friendly_attrs[strtolower($attr)])) {
$attr_display = $_SESSION['plaConfig']->friendly_attrs[strtolower($attr)];
$attr_note = sprintf('<acronym title="%s">alias</acronym>',sprintf(_('Note: \'%s\' is an alias for \'%s\''),$attr_display,$attr));
if ($_SESSION[APPCONFIG]->haveFriendlyName($attr)) {
$attr_display = $_SESSION[APPCONFIG]->getFriendlyName($attr);
$attr_note = sprintf('<acronym title="%s: \'%s\' %s \'%s\'">%s</acronym>',_('Note'),$attr_display,_('is an alias for'),$attr,_('alias'));
} else {
$attr_note = '';
$attr_display = $attr;
$attr_note = '';
}
# is this attribute required by an objectClass?
@ -311,7 +309,7 @@ foreach ($attrs_all as $attr) {
if (trim($val) == "")
echo "<span style=\"color:red\">[" . _('empty') . "]</span><br />\n";
elseif (0 == strcasecmp($attr,'userPassword') && $_SESSION['plaConfig']->GetValue('appearance','obfuscate_password_display'))
elseif (0 == strcasecmp($attr,'userPassword') && $_SESSION[APPCONFIG]->GetValue('appearance','obfuscate_password_display'))
echo preg_replace('/./','*',$val) . "<br />";
else
@ -320,7 +318,7 @@ foreach ($attrs_all as $attr) {
// @todo: redundant - $vals is always an array.
} else {
if (0 == strcasecmp($attr,'userPassword') && $_SESSION['plaConfig']->GetValue('appearance','obfuscate_password_display'))
if (0 == strcasecmp($attr,'userPassword') && $_SESSION[APPCONFIG]->GetValue('appearance','obfuscate_password_display'))
echo preg_replace('/./','*',$vals) . "<br />";
else
echo $vals . "<br />";

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy.php,v 1.44 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy.php,v 1.44.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* Copies a given object to create a new one.
@ -16,14 +16,14 @@
require './common.php';
if (! $_SESSION['plaConfig']->isCommandAvailable('entry_move'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_move'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('copy entry')));
$entry['src']['id'] = get_request('server_id');
$entry['dst']['id'] = get_request('dest_server_id');
$entry['src']['ldapserver'] = $_SESSION['plaConfig']->ldapservers->Instance($entry['src']['id']);
$entry['dst']['ldapserver'] = $_SESSION['plaConfig']->ldapservers->Instance($entry['dst']['id']);
$entry['src']['ldapserver'] = $_SESSION[APPCONFIG]->ldapservers->Instance($entry['src']['id']);
$entry['dst']['ldapserver'] = $_SESSION[APPCONFIG]->ldapservers->Instance($entry['dst']['id']);
if ($entry['dst']['ldapserver']->isReadOnly())
pla_error(_('Destination server is currently READ-ONLY.'));

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy_form.php,v 1.30 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy_form.php,v 1.30.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* Copies a given object to create a new one.
@ -98,7 +98,7 @@ echo "\n";
echo '</table></form>';
echo "\n";
if ($_SESSION['plaConfig']->GetValue('appearance','show_hints'))
if ($_SESSION[APPCONFIG]->GetValue('appearance','show_hints'))
printf('<small><img src="images/light.png" alt="Light" /><span class="hint">%s</span></small>',_('Hint: Copying between different servers only works if there are no schema violations'));
echo '</center>';

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/create.php,v 1.48 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/create.php,v 1.48.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* Creates a new object.
@ -21,16 +21,16 @@ require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'), null, -1, true);
if (! $_SESSION['plaConfig']->isCommandAvailable('entry_create'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_create'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('create entry')));
$rdn_attr = isset($_POST['rdn_attribute']) ? $_POST['rdn_attribute'] : null;
$entryfactoryclass = $_SESSION['plaConfig']->GetValue('appearance','entry_factory');
$entryfactoryclass = $_SESSION[APPCONFIG]->GetValue('appearance','entry_factory');
eval('$entry_factory = new '.$entryfactoryclass.'();');
$entry = $entry_factory->newCreatingEntry('');
eval('$reader = new '.$_SESSION['plaConfig']->GetValue('appearance', 'entry_reader').'($ldapserver);');
eval('$reader = new '.$_SESSION[APPCONFIG]->GetValue('appearance', 'entry_reader').'($ldapserver);');
$entry->accept($reader);
$container = $entry->getContainer();
@ -94,7 +94,7 @@ if (run_hook('pre_entry_create',array('server_id'=>$ldapserver->server_id,'dn'=>
if ($add_result) {
run_hook('post_entry_create',array('server_id'=>$ldapserver->server_id,'dn'=>$new_dn,'attrs'=>$new_entry));
$action_number = $_SESSION['plaConfig']->GetValue('appearance', 'action_after_creation');
$action_number = $_SESSION[APPCONFIG]->GetValue('appearance', 'action_after_creation');
$container = get_container($new_dn,false);
//$container_container = get_container($container);

View File

@ -1,4 +1,4 @@
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/css/style.css,v 1.48 2007/12/15 07:50:30 wurley Exp $ */
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/css/style.css,v 1.48.2.1 2007/12/24 06:41:51 wurley Exp $ */
/* Global Page */
table.page {
@ -82,9 +82,13 @@ table.page table.control a:hover {
text-decoration: none;
}
table.page table.control tr td.spacer {
width: 20%;
}
table.page table.control tr td.logo {
text-align: right;
width: 20%;
width: 10%;
}
table.control td.logo img.logo {
@ -706,6 +710,19 @@ table.login {
background-color: #ddddff;
}
#generic {
background-color: #fafaff;
padding-left: 17px;
}
#generic:focus {
background-color: #ffffba;
}
#generic:disabled {
background-color: #ddddff;
}
/* Search Box */
table.search {
background-color: #eeeeff;

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete.php,v 1.27 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete.php,v 1.27.2.2 2007/12/26 09:26:32 wurley Exp $
/**
* Deletes a DN and presents a "job's done" message.
@ -17,7 +17,7 @@ require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $_SESSION['plaConfig']->isCommandAvailable('entry_delete', 'simple_delete'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete', 'simple_delete'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete entry')));
$entry['dn'] = get_request('dn');
@ -43,7 +43,7 @@ if ($result) {
'title'=>_('Delete DN'),
'body'=>_('Successfully deleted DN ').sprintf('<b>%s</b>',$entry['dn']),
'type'=>'info'),
'index.php');
sprintf('index.php?server_id=%s',$ldapserver->server_id));
} else {
pla_error(sprintf(_('Could not delete the entry: %s'),'<b>'.pretty_print_dn($entry['dn']).'</b>'),

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_attr.php,v 1.16 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_attr.php,v 1.16.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* Deletes an attribute from an entry with NO confirmation.
@ -17,7 +17,7 @@ require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $_SESSION['plaConfig']->isCommandAvailable('attribute_delete'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete attribute')));
$entry['dn']['string'] = get_request('dn');

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/download_binary_attr.php,v 1.15 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/download_binary_attr.php,v 1.15.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* @package phpLDAPadmin
@ -25,7 +25,7 @@ $value_num = isset($_GET['value_num']) ? $_GET['value_num'] : null;
if (! $ldapserver->dnExists($dn))
pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn)));
$search = $ldapserver->search(null,$dn,'(objectClass=*)',array($attr),'base',false,$_SESSION['plaConfig']->GetValue('deref','view'));
$search = $ldapserver->search(null,$dn,'(objectClass=*)',array($attr),'base',false,$_SESSION[APPCONFIG]->GetValue('deref','view'));
# Dump the binary data to the browser
if (ob_get_level()) ob_end_clean();

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/entry_chooser.php,v 1.31 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/entry_chooser.php,v 1.31.2.2 2007/12/29 08:24:10 wurley Exp $
/**
* Display a selection (popup window) to pick a DN.
@ -40,12 +40,12 @@ if (isset($ldapserver) && ! is_null($entry['container'])) {
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
$entry['children'] = $ldapserver->getContainerContents($entry['container'],0,'(objectClass=*)',$_SESSION['plaConfig']->GetValue('deref','tree'));
$entry['children'] = $ldapserver->getContainerContents($entry['container'],0,'(objectClass=*)',$_SESSION[APPCONFIG]->GetValue('deref','tree'));
sort($entry['children']);
foreach ($ldapserver->getBaseDN() as $base_dn) {
if (DEBUG_ENABLED)
debug_log('entry_chooser.php: Comparing BaseDN [%s] with container [%s]',64,$base_dn,$entry['container']);
debug_log('Comparing BaseDN [%s] with container [%s]',64,__FILE__,__LINE__,__METHOD__,$base_dn,$entry['container']);
if (! pla_compare_dns($entry['container'],$base_dn)) {
$parent_container = false;
@ -85,9 +85,9 @@ if (isset($ldapserver) && ! is_null($entry['container'])) {
/* draw the root of the selection tree (ie, list all the servers) */
} else {
foreach ($_SESSION['plaConfig']->ldapservers->GetServerList() as $id) {
foreach ($_SESSION[APPCONFIG]->ldapservers->GetServerList() as $id) {
$ldapserver = $_SESSION['plaConfig']->ldapservers->Instance($id);
$ldapserver = $_SESSION[APPCONFIG]->ldapservers->Instance($id);
if ($ldapserver->isVisible()) {

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/export.php,v 1.18 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/export.php,v 1.18.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* @package phpLDAPadmin
@ -14,7 +14,7 @@ ini_set('session.cache_limiter','');
require LIBDIR.'export_functions.php';
if (! $_SESSION['plaConfig']->isCommandAvailable('export'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('export'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('export')));
$entry['base_dn'] = get_request('dn');

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/header.php,v 1.27 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/header.php,v 1.27.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* @package phpLDAPadmin
@ -9,7 +9,7 @@ require_once LIBDIR.'./common.php';
/* We want to get $language into scope in case we were included
from within a function */
$language = isset($_SESSION['plaConfig']) ? $language = $_SESSION['plaConfig']->GetValue('appearance','language') : 'auto';
$language = isset($_SESSION[APPCONFIG]) ? $language = $_SESSION[APPCONFIG]->GetValue('appearance','language') : 'auto';
# text/xml won't work with MSIE, but is very useful for debugging xhtml code.
# header('Content-type: text/xml; charset="UTF-8"');
@ -26,13 +26,13 @@ echo "\n\n";
echo '<head>';
if (isset($_SESSION['plaConfig']) && $pagetitle = $_SESSION['plaConfig']->GetValue('appearance','page_title'))
if (isset($_SESSION[APPCONFIG]) && $pagetitle = $_SESSION[APPCONFIG]->GetValue('appearance','page_title'))
printf('<title>phpLDAPadmin - %s</title>',$pagetitle);
else
echo '<title>phpLDAPadmin</title>';
if (isset($_SESSION['plaConfig']))
$css = $_SESSION['plaConfig']->GetValue('appearance','stylesheet');
if (isset($_SESSION[APPCONFIG]))
$css = $_SESSION[APPCONFIG]->GetValue('appearance','stylesheet');
else
$css = 'style.css';
printf('<link type="text/css" rel="stylesheet" href="%s%s" media="screen" />','../htdocs/'.CSSDIR,$css);

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/index.php,v 1.49 2007/12/15 13:17:43 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/index.php,v 1.49.2.3 2007/12/30 02:06:15 wurley Exp $
/**
* @package phpLDAPadmin
@ -14,9 +14,9 @@ PHP is not installed on your web server!!!
</pre>
*******************************************/
/*
/**
* We will perform some sanity checking here, since this file is normally loaded first when users
* first setup PLA.
* first access the application.
*/
define('LIBDIR',sprintf('%s/',realpath('../lib/')));
ini_set('display_errors',1);
@ -33,20 +33,28 @@ if (! is_readable(LIBDIR.'functions.php')) {
if (ob_get_level()) ob_end_clean();
die(sprintf("Cannot read the file '<b>%sfunctions.php</b>' its permissions may be too strict.",LIBDIR));
}
if (ob_get_level()) ob_end_clean();
if (ob_get_level())
ob_end_clean();
require LIBDIR.'functions.php';
$config_file = CONFDIR.'config.php';
# Define the path to our configuration file.
if (defined('CONFDIR'))
$app['config_file'] = CONFDIR.'config.php';
else
$app['config_file'] = 'config.php';
# Make sure this PHP install has gettext, we use it for language translation
if (! extension_loaded('gettext'))
pla_error('<p>Your install of PHP appears to be missing GETTEXT support.</p><p>GETTEXT is used for language translation.</p><p>Please install GETTEXT support before using phpLDAPadmin.<br /><small>(Dont forget to restart your web server afterwards)</small></p>');
/*
/**
* Helper functions.
* Our required helper functions are defined in functions.php
*/
foreach ($pla_function_files as $file_name ) {
if (isset($app['function_files']) && is_array($app['function_files']))
foreach ($app['function_files'] as $file_name ) {
if (! file_exists($file_name))
pla_error(sprintf('Fatal error: Required file "%s" does not exist.',$file_name));
@ -59,38 +67,38 @@ foreach ($pla_function_files as $file_name ) {
}
# Configuration File check
if (! file_exists($config_file)) {
if (! file_exists($app['config_file'])) {
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"';
echo '"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">';
echo '<html>';
echo '<head>';
printf('<title>phpLDAPadmin - %s</title>',pla_version());
printf('<title>%s - %s</title>','phpLDAPadmin',pla_version());
echo '<link type="text/css" rel="stylesheet" href="css/style.css" />';
echo '</head>';
echo '<body>';
echo '<h3 class="title">Configure phpLDAPadmin</h3>';
printf('<h3 class="title">Configure %s</h3>','phpLDAPadmin');
echo '<br /><br />';
echo '<center>';
printf(_('You need to configure phpLDAPadmin. Edit the file "%s" to do so. An example config file is provided in "%s.example".'),$config_file,$config_file);
printf(_('You need to configure %s. Edit the file "%s" to do so. An example config file is provided in "%s.example".'),'phpLDAPadmin',$app['config_file'],$app['config_file']);
echo '</center>';
echo '</body>';
echo '</html>';
die();
} elseif (! is_readable($config_file)) {
pla_error(sprintf('Fatal error: Cannot read your configuration file "%s", its permissions may be too strict.',$config_file));
} elseif (! is_readable($app['config_file'])) {
pla_error(sprintf('Fatal error: Cannot read your configuration file "%s", its permissions may be too strict.',$app['config_file']));
}
# If our config file fails the sanity check, then stop now.
if (! check_config($config_file)) {
$www = new page();
$body = new block();
$www->block_add('body',$body);
$www->display();
if (! check_config($app['config_file'])) {
$www['page'] = new page();
$www['body'] = new block();
$www['page']->block_add('body',$www['body']);
$www['page']->display();
exit;
}

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/ldif_import.php,v 1.35 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/ldif_import.php,v 1.35.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* Imports an LDIF file to the specified server_id.
@ -15,7 +15,7 @@
require './common.php';
if (! $_SESSION['plaConfig']->isCommandAvailable('import'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('import'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('import')));
$entry['continuous_mode'] = get_request('continuous_mode') ? true : false;

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login.php,v 1.56 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login.php,v 1.56.2.2 2007/12/29 08:24:10 wurley Exp $
/**
* For servers whose auth_type is set to 'cookie' or 'session'. Pass me the
@ -13,30 +13,29 @@
require './common.php';
$dn = get_request('login_dn');
$pass = get_request('login_pass');
$uid = get_request('uid');
$login['val'] = get_request($ldapserver->getLoginAttr());
$login['pass'] = get_request('login_pass');
if ($ldapserver->isAnonBindAllowed())
$anon_bind = get_request('anonymous_bind') == 'on' ? true : false;
else
$anon_bind = false;
if (! $anon_bind && ! strlen($pass))
if (! $anon_bind && ! strlen($login['pass']))
system_message(array(
'title'=>_('Authenticate to server'),
'body'=>_('You left the password blank.'),
'type'=>'warn'),
'cmd.php?cmd=login_form');
sprintf('cmd.php?cmd=login_form&server_id=%s',$ldapserver->server_id));
$save_auth_type = $ldapserver->auth_type;
if ($anon_bind) {
if (DEBUG_ENABLED)
debug_log('Anonymous Login was posted [%s].',64,$anon_bind);
debug_log('Anonymous Login was posted [%s].',64,__FILE__,__LINE__,__METHOD__,$anon_bind);
$dn = null;
$pass = null;
$login['dn'] = null;
$login['pass'] = null;
/* Checks if the login_attr option is enabled for this host,
which allows users to login with a simple username like 'jdoe' rather
@ -45,10 +44,10 @@ if ($anon_bind) {
# Is this a login string (printf-style)
if ($ldapserver->isLoginStringEnabled()) {
$dn = str_replace('<username>',$uid,$ldapserver->getLoginString());
$login['dn'] = str_replace('<username>',$ldapserver->getLoginAttr(),$ldapserver->getLoginString());
if (DEBUG_ENABLED)
debug_log('LoginStringDN: [%s]',64,$dn);
debug_log('LoginStringDN: [%s]',64,__FILE__,__LINE__,__METHOD__,$login['dn']);
} else {
# This is a standard login_attr
@ -63,36 +62,36 @@ if ($anon_bind) {
$ldapserver->connect(true,'anonymous');
if (! empty($ldapserver->login_class))
$filter = sprintf('(&(objectClass=%s)(%s=%s))',$ldapserver->login_class,$ldapserver->login_attr,$uid);
$filter = sprintf('(&(objectClass=%s)(%s=%s))',$ldapserver->login_class,$ldapserver->getLoginAttr(),$login['val']);
else
$filter = sprintf('%s=%s',$ldapserver->login_attr,$uid);
$filter = sprintf('%s=%s',$ldapserver->getLoginAttr(),$login['val']);
# Got through each of the BASE DNs and test the login.
foreach ($ldapserver->getBaseDN() as $base_dn) {
if (DEBUG_ENABLED)
debug_log('Searching LDAP with base [%s]',64,$base_dn);
debug_log('Searching LDAP with base [%s]',64,__FILE__,__LINE__,__METHOD__,$base_dn);
$result = $ldapserver->search(null,$base_dn,$filter,array('dn'));
$result = array_pop($result);
$dn = $result['dn'];
$login['dn'] = $result['dn'];
if ($dn) {
if ($login['dn']) {
if (DEBUG_ENABLED)
debug_log('Got DN [%s] for user ID [%s]',64,$dn,$uid);
debug_log('Got DN [%s] for user ID [%s]',64,__FILE__,__LINE__,__METHOD__,$login['dn'],$login['val']);
break;
}
}
# If we got here then we werent able to find a DN for the login filter.
if (! $dn)
if (! $login['dn'])
if ($ldapserver->login_fallback_dn)
$dn = $uid;
$login['dn'] = $login['val'];
else
system_message(array(
'title'=>_('Authenticate to server'),
'body'=>_('Bad username or password. Please try again.'),
'type'=>'error'),
'cmd.php?cmd=login_form');
sprintf('cmd.php?cmd=login_form&server_id=%s',$ldapserver->server_id));
# Restore the original auth_type
$ldapserver->auth_type = $save_auth_type;
@ -101,32 +100,32 @@ if ($anon_bind) {
# We fake a 'config' server auth_type to omit duplicated code
if (DEBUG_ENABLED)
debug_log('Setting login type to CONFIG with DN [%s]',64,$dn);
debug_log('Setting login type to CONFIG with DN [%s]',64,__FILE__,__LINE__,__METHOD__,$login['dn']);
$save_auth_type = $ldapserver->auth_type;
$ldapserver->auth_type = 'config';
$ldapserver->login_dn = $dn;
$ldapserver->login_pass = $pass;
$ldapserver->login_dn = $login['dn'];
$ldapserver->login_pass = $login['pass'];
# Verify that dn is allowed to login
if (! $ldapserver->userIsAllowedLogin($dn))
if (! $ldapserver->userIsAllowedLogin($login['dn']))
system_message(array(
'title'=>_('Authenticate to server'),
'body'=>_('Sorry, you are not allowed to use phpLDAPadmin with this LDAP server.'),
'type'=>'error'),
'cmd.php?cmd=login_form');
sprintf('cmd.php?cmd=login_form&server_id=%s',$ldapserver->server_id));
if (DEBUG_ENABLED)
debug_log('User is not prohibited from logging in - now bind with DN [%s]',64,$dn);
debug_log('User is not prohibited from logging in - now bind with DN [%s]',64,__FILE__,__LINE__,__METHOD__,$login['dn']);
# Verify that the login is good
if (is_null($dn) && is_null($pass))
if (is_null($login['dn']) && is_null($login['pass']))
$ds = $ldapserver->connect(false,'anonymous',true);
else
$ds = $ldapserver->connect(false,'user',true);
if (DEBUG_ENABLED)
debug_log('Connection returned [%s]',64,$ds);
debug_log('Connection returned [%s]',64,__FILE__,__LINE__,__METHOD__,$ds);
if (! is_resource($ds)) {
if ($anon_bind)
@ -134,24 +133,24 @@ if (! is_resource($ds)) {
'title'=>_('Authenticate to server'),
'body'=>_('Could not bind anonymously to server.'),
'type'=>'error'),
'cmd.php?cmd=login_form');
sprintf('cmd.php?cmd=login_form&server_id=%s',$ldapserver->server_id));
else
system_message(array(
'title'=>_('Authenticate to server'),
'body'=>_('Bad username or password. Please try again.'),
'type'=>'error'),
'cmd.php?cmd=login_form');
sprintf('cmd.php?cmd=login_form&server_id=%s',$ldapserver->server_id));
syslog_notice("Authentification FAILED for $dn");
syslog_notice(sprintf('Authentification FAILED for %s',$login['dn']));
}
$ldapserver->auth_type = $save_auth_type;
$ldapserver->setLoginDN($dn,$pass,$anon_bind) or pla_error(_('Could not set cookie.'));
$ldapserver->setLoginDN($login['dn'],$login['pass'],$anon_bind) or pla_error(_('Could not set cookie.'));
set_lastactivity($ldapserver);
if (! $anon_bind) {
syslog_notice("Authentification successful for $dn");
syslog_notice(sprintf('Authentification successful for %s',$login['dn']));
}
# Since we were successful, clear the cache so that it will be refreshed with the new creditentials.
@ -161,5 +160,5 @@ system_message(array(
'title'=>_('Authenticate to server'),
'body'=>_('Successfully logged into server.').($anon_bind ? sprintf(' (%s)',_('Anonymous Bind')) : ''),
'type'=>'info'),
'index.php');
sprintf('index.php?server_id=%s',$ldapserver->server_id));
?>

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login_form.php,v 1.29 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login_form.php,v 1.29.2.2 2007/12/26 09:26:32 wurley Exp $
/**
* Displays the login form for a server for users who specify 'cookie' or 'session' for their auth_type.
@ -42,11 +42,12 @@ if (isset($_GET['redirect']))
echo '<center>';
echo '<table class="login">';
printf('<tr><td><b>%s:</b></td></tr>',$ldapserver->isLoginAttrEnabled() ? _('Login Name') : _('Login DN'));
printf('<tr><td><b>%s:</b></td></tr>',
$ldapserver->login_attr == 'dn' ? _('Login DN') : $_SESSION[APPCONFIG]->getFriendlyName($ldapserver->login_attr));
printf('<tr><td><input type="text" id="pla_login" name="%s" size="40" value="%s" /></td></tr>',
$ldapserver->isLoginAttrEnabled() ? 'uid' : 'login_dn',
$ldapserver->isLoginAttrEnabled() ? '' : $ldapserver->login_dn);
$ldapserver->login_attr,
$ldapserver->login_attr == 'dn' ? $ldapserver->login_dn : '');
echo '<tr><td colspan=2>&nbsp;</td></tr>';
printf('<tr><td><b>%s:</b></td></tr>',_('Password'));

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/logout.php,v 1.20 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/logout.php,v 1.20.2.1 2007/12/26 03:25:38 wurley Exp $
/**
* For servers whose auth_type is set to 'cookie' or 'session'. Pass me
@ -33,5 +33,5 @@ system_message(array(
'title'=>_('Logout'),
'body'=>('Logged out successfully from server.'),
'type'=>'info'),
'index.php');
sprintf('index.php?server_id=%s',$ldapserver->server_id));
?>

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/mass_delete.php,v 1.17 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/mass_delete.php,v 1.17.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* Enables user to mass delete multiple entries using checkboxes.
@ -22,7 +22,7 @@ require './common.php';
if( $ldapserver->isReadOnly() )
pla_error(_('Unable to delete, server is in READY-ONLY mode.'));
if (! $_SESSION['plaConfig']->isCommandAvailable('entry_delete', 'mass_delete'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete', 'mass_delete'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete mass entries')));
$confirmed = isset($_POST['confirmed']) ? true : false;

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/modify_member_form.php,v 1.5 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/modify_member_form.php,v 1.5.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* Displays a form to allow the user to modify group members.
@ -46,14 +46,14 @@ foreach ($ldapserver->getBaseDN() as $base_dn) {
# Get all entries that can be added to the group
if (preg_match("/^$attr$/i",$_SESSION['plaConfig']->GetValue('modify_member','posixgroupattr')))
if (preg_match("/^$attr$/i",$_SESSION[APPCONFIG]->GetValue('modify_member','posixgroupattr')))
$possible_values = array_merge($ldapserver->search(null,$base_dn,
$_SESSION['plaConfig']->GetValue('modify_member','posixfilter'),
array($_SESSION['plaConfig']->GetValue('modify_member','posixattr'))));
$_SESSION[APPCONFIG]->GetValue('modify_member','posixfilter'),
array($_SESSION[APPCONFIG]->GetValue('modify_member','posixattr'))));
else
$possible_values = array_merge($ldapserver->search(null,$base_dn,
$_SESSION['plaConfig']->GetValue('modify_member','filter'),
array($_SESSION['plaConfig']->GetValue('modify_member','attr'))));
$_SESSION[APPCONFIG]->GetValue('modify_member','filter'),
array($_SESSION[APPCONFIG]->GetValue('modify_member','attr'))));
}
if ($possible_values)
@ -75,10 +75,10 @@ printf('%s <b>%s</b> %s <b>%s</b>:',
_('There are'),$num_current_members,_('members in group'),htmlspecialchars($rdn));
for ($i=0; $i<count($possible_values); $i++) {
if (preg_match("/^$attr$/i",$_SESSION['plaConfig']->GetValue('modify_member','posixgroupattr')))
$possible_members[$i] = $possible_values[$i][$_SESSION['plaConfig']->GetValue('modify_member','posixattr')];
if (preg_match("/^$attr$/i",$_SESSION[APPCONFIG]->GetValue('modify_member','posixgroupattr')))
$possible_members[$i] = $possible_values[$i][$_SESSION[APPCONFIG]->GetValue('modify_member','posixattr')];
else
$possible_members[$i] = $possible_values[$i][$_SESSION['plaConfig']->GetValue('modify_member','attr')];
$possible_members[$i] = $possible_values[$i][$_SESSION[APPCONFIG]->GetValue('modify_member','attr')];
}
sort($possible_members);

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/purge_cache.php,v 1.9 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/purge_cache.php,v 1.9.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* @package phpLDAPadmin
@ -9,7 +9,7 @@
require './common.php';
if (! $_SESSION['plaConfig']->isCommandAvailable('purge'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('purge'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('purge')));
$purge_session_keys = array('cache');

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rdelete.php,v 1.28 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rdelete.php,v 1.28.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* Recursively deletes the specified DN and all of its children
@ -17,7 +17,7 @@ require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $_SESSION['plaConfig']->isCommandAvailable('entry_delete', 'simple_delete'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete', 'simple_delete'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete entry')));
$entry['dn'] = $_POST['dn'];

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/refresh.php,v 1.18 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/refresh.php,v 1.18.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* This script alters the session variable 'tree', by re-querying
@ -13,7 +13,7 @@
require './common.php';
if (! $_SESSION['plaConfig']->isCommandAvailable('server_refresh'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('server_refresh'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('refresh server')));
unset($_SESSION['cache'][$ldapserver->server_id]['tree']);

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rename.php,v 1.33 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rename.php,v 1.33.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* Renames a DN to a different name.
@ -20,7 +20,7 @@ require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $_SESSION['plaConfig']->isCommandAvailable('entry_rename'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_rename'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('rename entry')));
$dn = ($_POST['dn']);

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/schema.php,v 1.67 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/schema.php,v 1.67.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* Displays the schema for the specified server_id
@ -16,7 +16,7 @@
require './common.php';
if (! $_SESSION['plaConfig']->isCommandAvailable('schema'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('schema'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('view schema')));
$entry['view'] = get_request('view','GET','false','objectClasses');

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/search.php,v 1.78 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/search.php,v 1.78.2.4 2007/12/29 08:24:10 wurley Exp $
/**
* Perform LDAP searches and draw the advanced/simple search forms
@ -24,7 +24,7 @@ define('SIZE_LIMIT_EXCEEDED',4);
$result_formats = array('list','table');
# Our incoming variables
$entry['format'] = get_request('format','GET','false',$_SESSION['plaConfig']->GetValue('search','display'));
$entry['format'] = get_request('format','GET','false',$_SESSION[APPCONFIG]->GetValue('search','display'));
$entry['form'] = get_request('form','GET',false,get_request('form','SESSION'));
$entry['orderby']['raw'] = get_request('orderby','GET');
@ -81,9 +81,9 @@ if ($entry['base_dn']['string']) {
printf('<script type="text/javascript" src="%ssearch_util.js"></script>','../htdocs/'.JSDIR);
echo '<center>';
$entry['command']['as'] = $_SESSION['plaConfig']->isCommandAvailable('search','advanced_search');
$entry['command']['ps'] = $_SESSION['plaConfig']->isCommandAvailable('search','predefined_search');
$entry['command']['ss'] = $_SESSION['plaConfig']->isCommandAvailable('search','simple_search');
$entry['command']['as'] = $_SESSION[APPCONFIG]->isCommandAvailable('search','advanced_search');
$entry['command']['ps'] = $_SESSION[APPCONFIG]->isCommandAvailable('search','predefined_search');
$entry['command']['ss'] = $_SESSION[APPCONFIG]->isCommandAvailable('search','simple_search');
if ($entry['form'] == 'advanced') {
if ($entry['command']['as'])
@ -116,15 +116,15 @@ echo '<br />';
if ($entry['search']) {
if ($entry['form'] == 'advanced') {
if (! $_SESSION['plaConfig']->isCommandAvailable('search','advanced_search'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('search','advanced_search'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('advanced search')));
} elseif ($entry['form'] == 'predefined') {
if (! $_SESSION['plaConfig']->isCommandAvailable('search','predefined_search'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('search','predefined_search'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('predefined search')));
} elseif ($entry['form'] == 'simple') {
if (! $_SESSION['plaConfig']->isCommandAvailable('search','simple_search'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('search','simple_search'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('simple search')));
}
@ -132,10 +132,10 @@ if ($entry['search']) {
if ($entry['display'])
$search_result_attributes = $entry['display']['array'];
else
$search_result_attributes = $_SESSION['plaConfig']->GetValue('search','result_attributes');
$search_result_attributes = $_SESSION[APPCONFIG]->GetValue('search','result_attributes');
} else {
$search_result_attributes = $_SESSION['plaConfig']->GetValue('search','result_attributes');
$search_result_attributes = $_SESSION[APPCONFIG]->GetValue('search','result_attributes');
}
# do we have enough authentication information for the specified server_id
@ -148,7 +148,7 @@ if ($entry['search']) {
'title'=>_('Search'),
'body'=>_('You have not logged into the selected server yet, so you cannot perform searches on it.'),
'type'=>'warn'),
'cmd.php?cmd=login_form');
$login_url);
}
if (is_numeric($entry['predefined'])) {
@ -214,14 +214,14 @@ if ($entry['search']) {
'title'=>_('Unrecognized criteria option: ').htmlspecialchars($entry['criterion']),
'body'=>_('If you want to add your own criteria to the list. Be sure to edit search.php to handle them. Quitting.'),
'type'=>'warn'),
'cmd.php?cmd=search');
sprintf('cmd.php?cmd=search&server_id=%s',$ldapserver->server_id));
}
}
# prevent script from bailing early on a long delete
@set_time_limit(0);
$size_limit = $_SESSION['plaConfig']->GetValue('search','size_limit');
$size_limit = $_SESSION[APPCONFIG]->GetValue('search','size_limit');
# Sanity check
if ($size_limit < 1)
@ -233,18 +233,18 @@ if ($entry['search']) {
foreach ($base_dns as $base_dn) {
if (! $ldapserver->dnExists($base_dn)) {
if (DEBUG_ENABLED)
debug_log('BaseDN [%s] skipped as it doesnt exist in [%s].',64,
debug_log('BaseDN [%s] skipped as it doesnt exist in [%s].',64,__FILE__,__LINE__,__METHOD__,
$base_dn,$ldapserver->server_id);
continue;
} else {
if (DEBUG_ENABLED)
debug_log('Search with base DN [%s]',64,$base_dn);
debug_log('Search with base DN [%s]',64,__FILE__,__LINE__,__METHOD__,$base_dn);
}
$results = $ldapserver->search(null,dn_escape($base_dn),$entry['filter']['clean'],$search_result_attributes,
$entry['scope'],$entry['orderby']['array'],$_SESSION['plaConfig']->GetValue('deref','search'));
$entry['scope'],$entry['orderby']['array'],$_SESSION[APPCONFIG]->GetValue('deref','search'));
if ((! $results) && $ldapserver->errno())
pla_error(_('Encountered an error while performing search.'),$ldapserver->error(),$ldapserver->errno());
@ -265,7 +265,7 @@ if ($entry['search']) {
printf('<td>%s%s <b>%s</b> <small>(%s %s)</small></td>',_('Entries found'),_(':'),
number_format($count),$time_elapsed,_('seconds'));
if ($_SESSION['plaConfig']->isCommandAvailable('export')) {
if ($_SESSION[APPCONFIG]->isCommandAvailable('export')) {
$href = htmlspecialchars(sprintf('cmd.php?cmd=export_form&server_id=%s&scope=%s&dn=%s&filter=%s&attributes=%s',
$ldapserver->server_id,$entry['scope'],$base_dn,rawurlencode($entry['filter']['clean']),rawurlencode(join(', ',$search_result_attributes))));
@ -290,7 +290,7 @@ if ($entry['search']) {
echo ' ]</small>';
if ($_SESSION['plaConfig']->isCommandAvailable('schema')) {
if ($_SESSION[APPCONFIG]->isCommandAvailable('schema')) {
echo '<br />';
printf('<small>%s%s <b>%s</b></small>',_('Base DN'),_(':'),htmlspecialchars($base_dn));

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/server_info.php,v 1.27 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/server_info.php,v 1.27.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* Fetches and displays all information that it can from the specified server
@ -12,7 +12,7 @@
/**
*/
if (! $_SESSION['plaConfig']->isCommandAvailable('server_info'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('server_info'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('view server informations')));
# The attributes we'll examine when searching the LDAP server's RootDSE

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/show_cache.php,v 1.3 2007/12/15 11:33:27 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/show_cache.php,v 1.3.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* This script shows the contents of the cache for debugging purposes
@ -21,7 +21,7 @@ if (isset($entry['index']) && isset($entry['key'])) {
if ($entry['key'])
debug_dump($_SESSION[$entry['key']],1);
if (! $_SESSION['plaConfig']->GetValue('appearance','hide_debug_info')) {
if (! $_SESSION[APPCONFIG]->GetValue('appearance','hide_debug_info')) {
echo '<div style="font-size: 11px"><ul>';
foreach (array_keys($_SESSION) as $key) {
if (($key == 'cache') && is_array($_SESSION[$key]))

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/template_engine.php,v 1.45 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/template_engine.php,v 1.45.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* Template render engine.
@ -41,10 +41,10 @@ if ($entry['dn']['string']) {
}
if ($entry['dn']['tree']) {
eval('$reader = new '.$_SESSION['plaConfig']->GetValue('appearance', 'entry_reader').'($ldapserver);');
eval('$reader = new '.$_SESSION[APPCONFIG]->GetValue('appearance', 'entry_reader').'($ldapserver);');
$entry['dn']['tree']->accept($reader);
eval('$writer = new '.$_SESSION['plaConfig']->GetValue('appearance', 'entry_writer').'($ldapserver);');
eval('$writer = new '.$_SESSION[APPCONFIG]->GetValue('appearance', 'entry_writer').'($ldapserver);');
$entry['dn']['tree']->accept($writer);
}
}
@ -54,16 +54,16 @@ if ($entry['dn']['string']) {
pla_error(_('You cannot perform updates while server is in read-only mode'));
# Create a new empty entry
$entryfactoryclass = $_SESSION['plaConfig']->GetValue('appearance','entry_factory');
$entryfactoryclass = $_SESSION[APPCONFIG]->GetValue('appearance','entry_factory');
eval('$entry_factory = new '.$entryfactoryclass.'();');
$entry['dn']['tree'] = $entry_factory->newCreatingEntry('');
# Init the entry with incoming data
eval('$reader = new '.$_SESSION['plaConfig']->GetValue('appearance', 'entry_reader').'($ldapserver);');
eval('$reader = new '.$_SESSION[APPCONFIG]->GetValue('appearance', 'entry_reader').'($ldapserver);');
$entry['dn']['tree']->accept($reader);
# Display the creating entry
eval('$writer = new '.$_SESSION['plaConfig']->GetValue('appearance', 'entry_writer').'($ldapserver);');
eval('$writer = new '.$_SESSION[APPCONFIG]->GetValue('appearance', 'entry_writer').'($ldapserver);');
$entry['dn']['tree']->accept($writer);
}
?>

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/update.php,v 1.29 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/update.php,v 1.29.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* Updates or deletes a value from a specified attribute for a specified dn.
@ -57,13 +57,13 @@ foreach ($entry['update'] as $attr => $val) {
} elseif ($val == '') {
$entry['update'][$attr] = array();
if (! $_SESSION['plaConfig']->isCommandAvailable('attribute_delete'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete attribute')));
} else { # Skip change
$entry['update'][$attr] = $val;
if (! $_SESSION['plaConfig']->isCommandAvailable('attribute_add_value')
&& ! $_SESSION['plaConfig']->isCommandAvailable('attribute_delete_value'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value')
&& ! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete_value'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('modify attribute values')));
}
@ -75,8 +75,8 @@ foreach ($entry['update'] as $attr => $val) {
foreach ($val as $i => $v)
$entry['update'][$attr][$i] = $v;
if (! $_SESSION['plaConfig']->isCommandAvailable('attribute_add_value')
&& ! $_SESSION['plaConfig']->isCommandAvailable('attribute_delete_value'))
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value')
&& ! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete_value'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('modify attribute values')));
}
}

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/update_confirm.php,v 1.49 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/update_confirm.php,v 1.49.2.2 2007/12/26 09:26:32 wurley Exp $
/**
* Takes the results of clicking "Save" in template_engine.php and determines which
@ -61,7 +61,7 @@ foreach ($entry['ldap']->getAttributes() as $old_attr) {
/* new values */
/***************/
eval('$reader = new '.$_SESSION['plaConfig']->GetValue('appearance','entry_reader').'($ldapserver);');
eval('$reader = new '.$_SESSION[APPCONFIG]->GetValue('appearance','entry_reader').'($ldapserver);');
$entry['ldap']->accept($reader);
$entry['values']['new'] = array();
@ -171,7 +171,7 @@ if (isset($entry['values']['new']['objectClass'])) {
/* update array */
/****************/
eval('$writer = new '.$_SESSION['plaConfig']->GetValue('appearance','entry_writer').'($ldapserver);');
eval('$writer = new '.$_SESSION[APPCONFIG]->GetValue('appearance','entry_writer').'($ldapserver);');
$writer->draw('Title',$entry['ldap']);
$writer->draw('Subtitle',$entry['ldap']);
@ -204,18 +204,12 @@ if (count($entry['values']['new']) > 0) {
echo "\n\n";
$counter = 0;
$friendly_attrs = $_SESSION['plaConfig']->friendly_attrs;
foreach ($entry['values']['new'] as $attr => $new_val) {
$counter++;
printf('<tr class="%s">',$counter%2 ? 'even' : 'odd');
echo '<td><b>';
$attr_display = isset($friendly_attrs[strtolower($attr)]) ? $friendly_attrs[strtolower($attr)] : $attr;
if (strcmp($attr,$attr_display) && $_SESSION['plaConfig']->isCommandAvailable('schema')) {
printf('<acronym title="Alias for %s">%s</acronym>',$attr,htmlspecialchars($attr_display));
} else {
echo htmlspecialchars($attr_display);
}
echo $_SESSION[APPCONFIG]->getFriendlyHTML($attr);
echo '</b></td>';
echo '<td><span style="white-space: nowrap;">';
@ -329,12 +323,7 @@ if (count($entry['values']['new']) > 0) {
$i = 0;
foreach ($attr_to_delete as $attr) {
if ($i++ != 0) echo '</b>, <b>';
$attr_display = isset($friendly_attrs[strtolower($attr)]) ? $friendly_attrs[strtolower($attr)] : $attr;
if (strcmp($attr,$attr_display) && $_SESSION['plaConfig']->isCommandAvailable('schema')) {
printf('<acronym title="Alias for %s">%s</acronym>',$attr,htmlspecialchars($attr_display));
} else {
echo htmlspecialchars($attr_display);
}
echo $_SESSION[APPCONFIG]->getFriendlyHTML($attr);
}
echo '</b></td></tr></table>';
}

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/view_jpeg_photo.php,v 1.11 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/view_jpeg_photo.php,v 1.11.2.1 2007/12/26 09:26:32 wurley Exp $
/**
* @package phpLDAPadmin
@ -20,7 +20,7 @@ if (! preg_match('/^pla/',$file['name']) || preg_match('/[\.\/\\\\]/',$file['nam
/* Little security measure here (prevents users from accessing
files, like /etc/passwd for example).*/
$file['name'] = basename(addcslashes($file['name'],'/\\'));
$file['name'] = sprintf('%s/%s',$_SESSION['plaConfig']->GetValue('jpeg','tmpdir'),$file['name']);
$file['name'] = sprintf('%s/%s',$_SESSION[APPCONFIG]->GetValue('jpeg','tmpdir'),$file['name']);
if (! file_exists($file['name']))
pla_error(sprintf('%s%s %s',_('No such file'),_(':'),htmlspecialchars($file['name'])));

View File

@ -1,38 +1,36 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/welcome.php,v 1.26 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/welcome.php,v 1.26.2.2 2007/12/26 09:26:32 wurley Exp $
/**
* @package phpLDAPadmin
*/
/**
* Show a simple welcome page.
*/
require './common.php';
echo '<center>';
echo '<br /><br />';
printf('<img src="images/logo.jpg" title="%s" alt="%s" />',
_('phpLDAPadmin logo'),
_('phpLDAPadmin logo'));
printf('<img src="images/logo.jpg" title="%s" alt="%s" />',_('phpLDAPadmin logo'),_('phpLDAPadmin logo'));
echo '<br /><br />';
echo _('Use the menu to the left to navigate');
echo '<br /><br />';
$links = '';
if ($_SESSION['plaConfig']->isCommandAvailable('external_links')) {
if ($_SESSION['plaConfig']->isCommandAvailable('external_links', 'credits')) {
if ($_SESSION[APPCONFIG]->isCommandAvailable('external_links')) {
if ($_SESSION[APPCONFIG]->isCommandAvailable('external_links', 'credits')) {
$links .= sprintf('<a href="%s" target="new">%s</a>',get_href('credits'),_('Credits'));
}
if ($_SESSION['plaConfig']->isCommandAvailable('external_links', 'help')) {
if ($_SESSION[APPCONFIG]->isCommandAvailable('external_links', 'help')) {
if ($links) $links .= ' | ';
$links .= sprintf('<a href="%s" target="new">%s</a>',get_href('documentation'),_('Documentation'));
}
if ($_SESSION['plaConfig']->isCommandAvailable('external_links', 'donation')) {
if ($_SESSION[APPCONFIG]->isCommandAvailable('external_links', 'donation')) {
if ($links) $links .= ' | ';
$links .= sprintf('<a href="%s" target="new">%s</a>',get_href('donate'),_('Donate'));
}

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/Attribute.php,v 1.2 2007/12/15 07:50:31 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/Attribute.php,v 1.2.2.2 2007/12/26 09:26:32 wurley Exp $
/**
* @package phpLDAPadmin
@ -188,18 +188,10 @@ class Attribute {
}
public function getFriendlyName() {
$friendly_attrs = $_SESSION['plaConfig']->friendly_attrs;
$name = real_attr_name($this->name);
if ($this->friendly_name) {
if ($this->friendly_name)
return $this->friendly_name;
} elseif (isset($friendly_attrs[$name])) {
return $friendly_attrs[$name];
} elseif (isset($friendly_attrs[strtolower($name)])) {
return $friendly_attrs[strtolower($name)];
} else {
return $name;
}
else
return $_SESSION[APPCONFIG]->getFriendlyName(real_attr_name($this->name));
}
public function setDescription($description) {

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/AttributeFactory.php,v 1.2 2007/12/15 07:50:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/AttributeFactory.php,v 1.2.2.1 2007/12/26 09:26:33 wurley Exp $
/**
* @package phpLDAPadmin
@ -26,7 +26,7 @@ class AttributeFactory {
} else if (! strcasecmp($name,'sambaLMPassword') || ! strcasecmp($name,'sambaNTPassword')) {
return $this->newSambaPasswordAttribute($name,$values);
} elseif (in_array_ignore_case($name,array_keys($_SESSION['plaConfig']->GetValue('appearance','date_attrs')))) {
} elseif (in_array_ignore_case($name,array_keys($_SESSION[APPCONFIG]->GetValue('appearance','date_attrs')))) {
return $this->newDateAttribute($name,$values);
} elseif (in_array(strtolower($name),array('shadowlastchange','shadowmin',

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/DefaultCreatingEntry.php,v 1.2 2007/12/15 07:50:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/DefaultCreatingEntry.php,v 1.2.2.2 2007/12/29 08:24:10 wurley Exp $
/**
* @package phpLDAPadmin
@ -167,12 +167,13 @@ class DefaultCreatingEntry extends Entry {
# we can use a static variable if there is only one instance of this class
static $attrs = null;
if (DEBUG_ENABLED) debug_log('%s[%s]::getAttributes()',1,get_class($this),$this->getDn());
if (DEBUG_ENABLED)
debug_log('Entered with () for dn (%s)',1,__FILE__,__LINE__,__METHOD__,$this->getDn());
if (! $attrs) {
$attrs = array();
$attributefactoryclass = $_SESSION['plaConfig']->GetValue('appearance','attribute_factory');
$attributefactoryclass = $_SESSION[APPCONFIG]->GetValue('appearance','attribute_factory');
eval('$attribute_factory = new '.$attributefactoryclass.'();');
if ($this->objectClasses) {

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/DefaultEditingEntry.php,v 1.2 2007/12/15 07:50:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/DefaultEditingEntry.php,v 1.2.2.2 2007/12/29 08:25:24 wurley Exp $
/**
* @package phpLDAPadmin
@ -19,19 +19,20 @@ class DefaultEditingEntry extends Entry {
static $attrs = array();
$dn = $this->getDn();
if (DEBUG_ENABLED) debug_log('%s[%s]::getAttributes()',1,get_class($this),$dn);
if (DEBUG_ENABLED)
debug_log('Entered with () for dn (%s)',1,__FILE__,__LINE__,__METHOD__,$dn);
if (! isset($attrs[$dn])) {
$attrs[$dn] = array();
$attributefactoryclass = $_SESSION['plaConfig']->GetValue('appearance','attribute_factory');
$attributefactoryclass = $_SESSION[APPCONFIG]->GetValue('appearance','attribute_factory');
eval('$attribute_factory = new '.$attributefactoryclass.'();');
$int_attrs_vals = $ldapserver->getDNSysAttrs($this->getDn());
if (!$int_attrs_vals) $int_attrs_vals = array();
elseif (!is_array($int_attrs_vals)) $int_attrs_vals = array($int_attrs_vals);
$attrs_vals = $ldapserver->getDNAttrs($this->getDn(),false,$_SESSION['plaConfig']->GetValue('deref','view'));
$attrs_vals = $ldapserver->getDNAttrs($this->getDn(),false,$_SESSION[APPCONFIG]->GetValue('deref','view'));
if (! $attrs_vals) $attrs_vals = array();
elseif (! is_array($attrs_vals)) $attrs_vals = array($attrs_vals);

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/Entry.php,v 1.2 2007/12/15 07:50:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/Entry.php,v 1.2.2.1 2007/12/26 09:26:33 wurley Exp $
/**
* @package phpLDAPadmin
@ -78,9 +78,9 @@ abstract class Entry {
if (DEBUG_ENABLED)
debug_log('LdapServer (%s)',1,__FILE__,__LINE__,__METHOD__, $ldapserver ? $ldapserver->server_id : -1);
$ldap['child_limit'] = $nolimit ? 0 : $_SESSION['plaConfig']->GetValue('search','size_limit');
$ldap['filter'] = $_SESSION['plaConfig']->GetValue('appearance','tree_filter');
$ldap['deref'] = $_SESSION['plaConfig']->GetValue('deref','view');
$ldap['child_limit'] = $nolimit ? 0 : $_SESSION[APPCONFIG]->GetValue('search','size_limit');
$ldap['filter'] = $_SESSION[APPCONFIG]->GetValue('appearance','tree_filter');
$ldap['deref'] = $_SESSION[APPCONFIG]->GetValue('deref','view');
$ldap['children'] = $ldapserver->getContainerContents($this->getDn(),$ldap['child_limit'],$ldap['filter'],$ldap['deref']);
if (DEBUG_ENABLED)

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/EntryReader.php,v 1.2 2007/12/15 07:50:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/EntryReader.php,v 1.2.2.1 2007/12/29 08:24:10 wurley Exp $
define('ENTRY_READER_CREATION_CONTEXT', '1');
define('ENTRY_READER_EDITING_CONTEXT', '2');
@ -25,11 +25,13 @@ class EntryReader extends Visitor {
/**************************/
public function visitEntryStart($entry) {
if (DEBUG_ENABLED) debug_log('%s::visitEntryStart(%s)',1,get_class($this),$entry->getDn());
if (DEBUG_ENABLED)
debug_log('Enter with (%s) for dn (%s)',1,__FILE__,__LINE__,__METHOD__,$entry,$entry->getDn());
}
public function visitEntryEnd($entry) {
if (DEBUG_ENABLED) debug_log('%s::visitEntryEnd(%s)',1,get_class($this),$entry->getDn());
if (DEBUG_ENABLED)
debug_log('Enter with (%s) for dn (%s)',1,__FILE__,__LINE__,__METHOD__,$entry,$entry->getDn());
}
/**************************/
@ -37,14 +39,16 @@ class EntryReader extends Visitor {
/**************************/
public function visitDefaultEditingEntryStart($entry) {
if (DEBUG_ENABLED) debug_log('%s::visitDefaultEditingEntryStart()',1,get_class($this));
if (DEBUG_ENABLED)
debug_log('Enter with (%s) for dn (%s)',1,__FILE__,__LINE__,__METHOD__,$entry,$entry->getDn());
$this->context = ENTRY_READER_EDITING_CONTEXT;
$this->visit('Entry::Start', $entry);
}
public function visitTemplateEditingEntryStart($entry) {
if (DEBUG_ENABLED) debug_log('%s::visitTemplateEditingEntryStart()',1,get_class($this));
if (DEBUG_ENABLED)
debug_log('Enter with (%s) for dn (%s)',1,__FILE__,__LINE__,__METHOD__,$entry,$entry->getDn());
$this->visit('DefaultEditingEntry::Start', $entry);
@ -62,7 +66,8 @@ class EntryReader extends Visitor {
/**************************/
public function visitDefaultCreatingEntryStart($entry) {
if (DEBUG_ENABLED) debug_log('%s::visitDefaultCreatingEntryStart()',1,get_class($this));
if (DEBUG_ENABLED)
debug_log('Enter with (%s) for dn (%s)',1,__FILE__,__LINE__,__METHOD__,$entry,$entry->getDn());
$this->context = ENTRY_READER_CREATION_CONTEXT;
$this->visit('Entry::Start', $entry);
@ -81,7 +86,8 @@ class EntryReader extends Visitor {
}
public function visitTemplateCreatingEntryStart($entry) {
if (DEBUG_ENABLED) debug_log('%s::visitTemplateCreatingEntryStart()',1,get_class($this));
if (DEBUG_ENABLED)
debug_log('Enter with (%s) for dn (%s)',1,__FILE__,__LINE__,__METHOD__,$entry,$entry->getDn());
$this->visit('DefaultCreatingEntry::Start', $entry);
@ -99,7 +105,8 @@ class EntryReader extends Visitor {
/**************************/
public function visitAttribute($attribute) {
if (DEBUG_ENABLED) debug_log('%s::visitAttribute(%s)',1,get_class($this),$attribute->getName());
if (DEBUG_ENABLED)
debug_log('Enter with (%s) for attribute (%s)',1,__FILE__,__LINE__,__METHOD__,$attribute,$attribute->getName());
$name = $attribute->getName();
// @todo editing objectclasses

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/EntryWriter1.php,v 1.3.2.1 2007/12/21 11:32:59 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/EntryWriter1.php,v 1.3.2.4 2007/12/26 09:26:33 wurley Exp $
define('IdEntryRefreshMenuItem', '0');
define('IdEntryExportBaseMenuItem', '1');
@ -56,10 +56,10 @@ class EntryWriter1 extends EntryWriter {
protected function drawEntryMenu($entry) {}
protected function drawEntryJavascript($entry) {
if (isset($_SESSION['plaConfig'])) {
if (isset($_SESSION[APPCONFIG])) {
echo '<script type="text/javascript" language="javascript">';
echo 'var defaults = new Array();var default_date_format = "';
echo $_SESSION['plaConfig']->GetValue('appearance', 'date');
echo $_SESSION[APPCONFIG]->GetValue('appearance', 'date');
echo '";</script>';
}
@ -352,7 +352,7 @@ class EntryWriter1 extends EntryWriter {
echo '</td>';
echo '</tr>';
if ($_SESSION['plaConfig']->GetValue('appearance', 'show_hints')) {
if ($_SESSION[APPCONFIG]->GetValue('appearance', 'show_hints')) {
echo '<tr><td>&nbsp;</td><td><small><img src="images/light.png" alt="Hint" /><span class="hint">';
echo _('Hint: You must choose exactly one structural objectClass (shown in bold above)');
echo '</span></small><br /></td></tr>';
@ -587,7 +587,7 @@ class EntryWriter1 extends EntryWriter {
}
protected function getDefaultEditingEntryMenuItem($entry, $i) {
$config = $_SESSION['plaConfig'];
$config = $_SESSION[APPCONFIG];
switch ($i) {
case IdEntryRefreshMenuItem :
@ -791,7 +791,7 @@ class EntryWriter1 extends EntryWriter {
}
protected function getDefaultEditingEntryDeleteAttributeMessage($entry) {
if ($_SESSION['plaConfig']->isCommandAvailable('attribute_delete_value'))
if ($_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete_value'))
return sprintf($this->hint_layout,_('Hint: To delete an attribute, empty the text field and click save.'));
else
return '';
@ -1464,7 +1464,7 @@ class EntryWriter1 extends EntryWriter {
echo '<td class="attr_note">';
# Setup the $attr_note, which will be displayed to the right of the attr name (if any)
if ($_SESSION['plaConfig']->GetValue('appearance', 'show_attribute_notes')) {
if ($_SESSION[APPCONFIG]->GetValue('appearance', 'show_attribute_notes')) {
$this->draw('Notes', $attribute);
}
@ -1547,7 +1547,7 @@ class EntryWriter1 extends EntryWriter {
switch ($i) {
case IdAttributeAddValueMenuItem :
if ($attribute->isVisible() && !$attribute->isReadOnly()
&& !$attribute->isRdn() && $_SESSION['plaConfig']->isCommandAvailable('attribute_add_value')) {
&& !$attribute->isRdn() && $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value')) {
if ($attribute->getMaxValueCount() < 0 || $attribute->getValueCount() < $attribute->getMaxValueCount()) {
return $this->get('AddValueMenuItem', $attribute);
}
@ -1555,10 +1555,10 @@ class EntryWriter1 extends EntryWriter {
return '';
case IdAttributeModifyMemberMenuItem :
if (in_array($attribute->getName(), $_SESSION['plaConfig']->GetValue('modify_member','groupattr'))) {
if (in_array($attribute->getName(), $_SESSION[APPCONFIG]->GetValue('modify_member','groupattr'))) {
if ($attribute->isVisible() && !$attribute->isReadOnly() && !$attribute->isRdn()
&& ($_SESSION['plaConfig']->isCommandAvailable('attribute_add_value')
|| $_SESSION['plaConfig']->isCommandAvailable('attribute_delete_value'))) {
&& ($_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value')
|| $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete_value'))) {
return $this->get('ModifyMemberMenuItem', $attribute);
}
}
@ -1566,7 +1566,7 @@ class EntryWriter1 extends EntryWriter {
case IdAttributeRenameMenuItem :
if ($attribute->isVisible() && $attribute->isRdn() && !$attribute->isReadOnly()
&& $_SESSION['plaConfig']->isCommandAvailable('entry_rename')) {
&& $_SESSION[APPCONFIG]->isCommandAvailable('entry_rename')) {
return $this->get('RenameMenuItem', $attribute);
}
return '';
@ -1742,8 +1742,8 @@ class EntryWriter1 extends EntryWriter {
$opts = $arr1;
$default = (count($vals) > 0 ? $vals[0] : '');
if (!is_string($default)) $default = '';
if (!is_null($attribute->getValue($i)) || (strlen($default) <= 0)) {
if (!is_scalar($default)) $default = '';
if (!is_null($attribute->getValue($i)) && (strlen($default) <= 0)) {
$default = $this->get('DefaultValueHelper', $attribute, $i);
}
@ -1876,7 +1876,7 @@ class EntryWriter1 extends EntryWriter {
}
protected function drawAttributeName($attribute) {
$config = $_SESSION['plaConfig'];
$config = $_SESSION[APPCONFIG];
$attr_display = $attribute->getFriendlyName();
@ -1896,7 +1896,7 @@ class EntryWriter1 extends EntryWriter {
$friendly_name = $attribute->getFriendlyName();
if ($friendly_name != $attribute->getName()) {
return "<acronym title=\"" . sprintf(_('Note: \'%s\' is an alias for \'%s\''), $friendly_name, $attribute->getName()) . "\">alias</acronym>";
return sprintf('<acronym title="%s: \'%s\' %s \'%s\'">%s</acronym>',_('Note'),$friendly_name,_('is an alias for'),$attribute->getName(),_('alias'));
} else {
return '';
}
@ -1989,12 +1989,12 @@ class EntryWriter1 extends EntryWriter {
}
}
if (! $attribute->isReadOnly() && $_SESSION['plaConfig']->isCommandAvailable('attribute_delete')) {
if (! $attribute->isReadOnly() && $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete')) {
printf('<a href="javascript:deleteAttribute(\'%s\', \'%s\');" style="color:red;">'.
'<img src="images/trash.png" alt="Trash" /> %s</a>',
$attribute->getName(), $attribute->getFriendlyName(), _('delete attribute'));
}
} elseif ($attribute->isReadOnly() || ! $_SESSION['plaConfig']->isCommandAvailable('attribute_add_value')) {
} elseif ($attribute->isReadOnly() || ! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value')) {
printf('<input type="text" class="roval" value="%s" readonly /><br />',
_("[no value]"));
} else {
@ -2081,9 +2081,9 @@ class EntryWriter1 extends EntryWriter {
protected function drawDateAttributeJavascript($attribute) {
$this->draw('Attribute::Javascript', $attribute);
$entry['date'] = $_SESSION['plaConfig']->GetValue('appearance','date_attrs');
$entry['time'] = $_SESSION['plaConfig']->GetValue('appearance','date_attrs_showtime');
$entry['format'] = $_SESSION['plaConfig']->GetValue('appearance', 'date');
$entry['date'] = $_SESSION[APPCONFIG]->GetValue('appearance','date_attrs');
$entry['time'] = $_SESSION[APPCONFIG]->GetValue('appearance','date_attrs_showtime');
$entry['format'] = $_SESSION[APPCONFIG]->GetValue('appearance', 'date');
if (isset($entry['date'][$attribute->getName()]))
$entry['format'] = $entry['date'][$attribute->getName()];
@ -2202,9 +2202,9 @@ class EntryWriter1 extends EntryWriter {
if ($attribute->getEntry() && $attribute->getEntry()->getDn()) {
draw_jpeg_photos($this->ldapserver, $attribute->getEntry()->getDn(),
$attribute->getName(), ! $attribute->isReadOnly()
&& $_SESSION['plaConfig']->isCommandAvailable('attribute_delete'));
&& $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete'));
}
} elseif ($attribute->isReadOnly() || ! $_SESSION['plaConfig']->isCommandAvailable('attribute_add_value')) {
} elseif ($attribute->isReadOnly() || ! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value')) {
printf('<input type="text" class="roval" value="%s" readonly /><br />',_('[no value]'));
} else {
$i = 0;
@ -2633,7 +2633,7 @@ class EntryWriter1 extends EntryWriter {
}
protected function drawShadowAttributeShadowDate($attribute, $shadow_date) {
$config = $_SESSION['plaConfig'];
$config = $_SESSION[APPCONFIG];
//$shadow_format_attrs = array_merge($shadow_before_today_attrs,$shadow_after_today_attrs);
$shadow_before_today_attrs = arrayLower($attribute->shadow_before_today_attrs);

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/EntryWriter2.php,v 1.2 2007/12/15 07:50:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/EntryWriter2.php,v 1.2.2.1 2007/12/26 09:26:33 wurley Exp $
/**
* @package phpLDAPadmin
@ -175,7 +175,7 @@ class EntryWriter2 extends EntryWriter1 {
echo _(':');
echo '<br/>';
if ($_SESSION['plaConfig']->GetValue('appearance', 'show_attribute_notes')) {
if ($_SESSION[APPCONFIG]->GetValue('appearance', 'show_attribute_notes')) {
$this->draw('Notes', $attribute);
}
@ -246,7 +246,7 @@ class EntryWriter2 extends EntryWriter1 {
}
protected function drawAttributeMenu($attribute) {
if ($attribute->getHint() /*&& $_SESSION['plaConfig']->GetValue('appearance', 'show_hints')*/) {
if ($attribute->getHint() /*&& $_SESSION[APPCONFIG]->GetValue('appearance', 'show_hints')*/) {
echo '<img src="images/light.png" alt="Hint" /> <span class="hint">'.$attribute->getHint().'</span>';
}
parent::drawAttributeMenu($attribute);

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/HTMLTree.php,v 1.2 2007/12/15 07:50:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/HTMLTree.php,v 1.2.2.2 2007/12/29 07:23:45 wurley Exp $
/**
* @package phpLDAPadmin
@ -186,22 +186,22 @@ class HTMLTree extends Tree {
switch($i) {
case 0 :
if ($_SESSION['plaConfig']->isCommandAvailable('schema')) return $this->get_schema_menu_item();
if ($_SESSION[APPCONFIG]->isCommandAvailable('schema')) return $this->get_schema_menu_item();
else return '';
case 1 :
if ($_SESSION['plaConfig']->isCommandAvailable('search')) return $this->get_search_menu_item();
if ($_SESSION[APPCONFIG]->isCommandAvailable('search')) return $this->get_search_menu_item();
else return '';
case 2 :
if ($_SESSION['plaConfig']->isCommandAvailable('server_refresh')) return $this->get_refresh_menu_item();
if ($_SESSION[APPCONFIG]->isCommandAvailable('server_refresh')) return $this->get_refresh_menu_item();
else return '';
case 3 :
if ($_SESSION['plaConfig']->isCommandAvailable('server_info')) return $this->get_info_menu_item();
if ($_SESSION[APPCONFIG]->isCommandAvailable('server_info')) return $this->get_info_menu_item();
else return '';
case 4 :
if (!$ldapserver->isReadOnly() && $_SESSION['plaConfig']->isCommandAvailable('import')) return $this->get_import_menu_item();
if (!$ldapserver->isReadOnly() && $_SESSION[APPCONFIG]->isCommandAvailable('import')) return $this->get_import_menu_item();
else return '';
case 5 :
if ($_SESSION['plaConfig']->isCommandAvailable('export')) return $this->get_export_menu_item();
if ($_SESSION[APPCONFIG]->isCommandAvailable('export')) return $this->get_export_menu_item();
else return '';
case 6 :
if ($ldapserver->auth_type != 'config') return $this->get_logout_menu_item();
@ -221,7 +221,7 @@ class HTMLTree extends Tree {
protected function get_search_menu_item() {
$ldapserver = $this->getLdapServer();
$href = sprintf('cmd.php?cmd=search&server_id=%s&form=undefined"',$ldapserver->server_id);
$href = sprintf('cmd.php?cmd=search&server_id=%s&form=undefined',$ldapserver->server_id);
return sprintf('<a title="%s %s" href="%s"><img src="%s" alt="%s" /><br />%s</a>',
_('search'),$ldapserver->name,htmlspecialchars($href),'images/search.png',_('search'),_('search'));

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/TemplateCreatingEntry.php,v 1.3 2007/12/15 11:27:04 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/TemplateCreatingEntry.php,v 1.3.2.1 2007/12/26 09:26:33 wurley Exp $
/**
* @package phpLDAPadmin
@ -104,7 +104,7 @@ class TemplateCreatingEntry extends DefaultCreatingEntry {
: array();
masort($template_attrs,'page,order',1);
$attributefactoryclass = $_SESSION['plaConfig']->GetValue('appearance','attribute_factory');
$attributefactoryclass = $_SESSION[APPCONFIG]->GetValue('appearance','attribute_factory');
eval('$attribute_factory = new '.$attributefactoryclass.'();');
if ($this->objectClasses) {

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/TemplateEditingEntry.php,v 1.3 2007/12/15 11:18:38 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/TemplateEditingEntry.php,v 1.3.2.2 2007/12/29 08:24:11 wurley Exp $
/**
* @package phpLDAPadmin
@ -27,11 +27,11 @@ class TemplateEditingEntry extends DefaultEditingEntry {
global $ldapserver;
if (DEBUG_ENABLED)
debug_log('TemplateEditingEntry::readEditingTemplates()',1);
debug_log('Entered with ()',1,__FILE__,__LINE__,__METHOD__);
if ($this->valid) {
if (DEBUG_ENABLED)
debug_log('TemplateEditingEntry::readEditingTemplates() : all templates [%s] are valid',1,count($this->templates));
debug_log('All templates [%s] are valid',1,__FILE__,__LINE__,__METHOD__,count($this->templates));
return;
}
@ -46,24 +46,28 @@ class TemplateEditingEntry extends DefaultEditingEntry {
foreach ($all_templates as $template_name => $template_attrs) {
# don't select hidden templates
if (isset($template_attrs['visible']) && (! $template_attrs['visible'])) {
if (DEBUG_ENABLED) debug_log('TemplateEditingEntry::readEditingTemplates() : the template %s is not visible',1,$template_name);
if (DEBUG_ENABLED)
debug_log('The template %s is not visible',1,__FILE__,__LINE__,__METHOD__,$template_name);
continue;
}
# don't select invalid templates
if (isset($template_attrs['invalid']) && $template_attrs['invalid']) {
if (DEBUG_ENABLED) debug_log('TemplateEditingEntry::readEditingTemplates() : the template %s is invalid [%s]',1,$template_name,isset($template_attrs['invalid_reason']) ? $template_attrs['invalid_reason'] : '');
if (DEBUG_ENABLED)
debug_log('The template %s is invalid [%s]',1,__FILE__,__LINE__,__METHOD__,$template_name,isset($template_attrs['invalid_reason']) ? $template_attrs['invalid_reason'] : '');
$this->valid = false;
continue;
}
# check the template filter
if (isset($template_attrs['regexp'])) {
if (! @preg_match('/'.$template_attrs['regexp'].'/i',$this->getDn())) {
if (DEBUG_ENABLED) debug_log('TemplateEditingEntry::readEditingTemplates() : the entry dn doesn\'t match the template %s regexp',1,$template_name);
if (DEBUG_ENABLED)
debug_log('The entry dn doesn\'t match the template %s regexp',1,__FILE__,__LINE__,__METHOD__,$template_name);
continue;
}
}
# finally add the template to the list
if (DEBUG_ENABLED) debug_log('TemplateEditingEntry::readEditingTemplates() : the template %s is available for the entry',1,$template_name);
if (DEBUG_ENABLED)
debug_log('The template %s is available for the entry',1,__FILE__,__LINE__,__METHOD__,$template_name);
$this->templates[$template_name] = $template_attrs;
}
}
@ -87,7 +91,8 @@ class TemplateEditingEntry extends DefaultEditingEntry {
static $attrs = array();
$dn = $this->getDn();
if (DEBUG_ENABLED) debug_log('%s[%s]::getAttributes()',1,get_class($this),$dn);
if (DEBUG_ENABLED)
debug_log('Entered with () for dn [%s]',1,__FILE__,__LINE__,__METHOD__,$dn);
if (!$this->selected_template) {
return parent::getAttributes();
@ -95,14 +100,14 @@ class TemplateEditingEntry extends DefaultEditingEntry {
$attrs[$dn] = array();
$tmpl[$dn] = $this->selected_template;
$attributefactoryclass = $_SESSION['plaConfig']->GetValue('appearance','attribute_factory');
$attributefactoryclass = $_SESSION[APPCONFIG]->GetValue('appearance','attribute_factory');
eval('$attribute_factory = new '.$attributefactoryclass.'();');
$int_attrs_vals = $ldapserver->getDNSysAttrs($this->getDn());
if (! $int_attrs_vals) $attrs_vals = array();
elseif (! is_array($int_attrs_vals)) $int_attrs_vals = array($attrs_vals);
$attrs_vals = $ldapserver->getDNAttrs($this->getDn(),false,$_SESSION['plaConfig']->GetValue('deref','view'));
$attrs_vals = $ldapserver->getDNAttrs($this->getDn(),false,$_SESSION[APPCONFIG]->GetValue('deref','view'));
if (! $attrs_vals) $attrs_vals = array();
elseif (! is_array($attrs_vals)) $attrs_vals = array($attrs_vals);

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/Tree.php,v 1.2 2007/12/15 07:50:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/Tree.php,v 1.2.2.1 2007/12/26 09:26:33 wurley Exp $
/**
* @package phpLDAPadmin
@ -29,10 +29,10 @@ abstract class Tree {
static public function getInstance($server_id) {
$tree = get_cached_item($server_id,'tree');
if (!$tree) {
$ldapserver = $_SESSION['plaConfig']->ldapservers->Instance($server_id);
$ldapserver = $_SESSION[APPCONFIG]->ldapservers->Instance($server_id);
if (!$ldapserver) return null;
$treeclass = $_SESSION['plaConfig']->GetValue('appearance','tree');
$treeclass = $_SESSION[APPCONFIG]->GetValue('appearance','tree');
eval('$tree = new '.$treeclass.'($server_id);');
foreach ($ldapserver->getBaseDN() as $baseDn)
@ -45,7 +45,7 @@ abstract class Tree {
}
public function getLdapServer() {
return $_SESSION['plaConfig']->ldapservers->Instance($this->server_id);
return $_SESSION[APPCONFIG]->ldapservers->Instance($this->server_id);
}
/**
@ -71,7 +71,7 @@ abstract class Tree {
* children array of its parent
*
* The added entry is created using the factory class defined
* in $_SESSION['plaConfig']->custom->appearance['entry_factory']
* in $_SESSION[APPCONFIG]->custom->appearance['entry_factory']
*
* @param $dn the dn of the entry to create
*/
@ -79,7 +79,7 @@ abstract class Tree {
if (DEBUG_ENABLED)
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$dn);
$ldapserver = $_SESSION['plaConfig']->ldapservers->Instance($this->server_id);
$ldapserver = $_SESSION[APPCONFIG]->ldapservers->Instance($this->server_id);
# We need to convert the DN to lower case, to avoid any case problems and strip any unnessary spaces after commas.
$dnlower = $this->indexDN($dn);
@ -121,7 +121,7 @@ abstract class Tree {
if (isset($this->misses[$dnlower]))
unset($this->misses[$dnlower]);
$entryfactoryclass = $_SESSION['plaConfig']->GetValue('appearance','entry_factory');
$entryfactoryclass = $_SESSION[APPCONFIG]->GetValue('appearance','entry_factory');
eval('$entry_factory = new '.$entryfactoryclass.'();');
if (DEBUG_ENABLED)
debug_log('New ENTRY (%s) for (%s).',64,__FILE__,__LINE__,__METHOD__,$dnlower,$dn);

View File

@ -1,23 +1,33 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/common.php,v 1.80 2007/12/15 07:50:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/common.php,v 1.80.2.7 2007/12/30 02:05:16 wurley Exp $
/**
* Contains code to be executed at the top of each phpLDAPadmin page.
* Contains code to be executed at the top of each application page.
* include this file at the top of every PHP file.
*
* This file will "pre-initialise" a PLA environment so that any PHP file will have a consistent
* environment with other PLA PHP files.
* This file will "pre-initialise" an application environment so that any PHP file will have a consistent
* environment with other application PHP files.
*
* This code WILL NOT check that all required functions are usable/readable, etc. This process has
* been moved to index.php (which really is only called once when a browser hits PLA for the first time).
* been moved to index.php (which really is only called once when a browser hits the application for the first time).
*
* The list of ADDITIONAL function files is now defined in functions.php.
*
* @package phpLDAPadmin
*/
# Catch any scripts that are called directly.
foreach (array('cmd.php','index.php','view_jpeg_photo.php','entry_chooser.php','password_checker.php', 'download_binary_attr.php') as $script) {
# The index we will store our config in $_SESSION
define('APPCONFIG','plaConfig');
/**
* Catch any scripts that are called directly.
* If they are called directly, then they should be routed back through index.php
*/
$app['direct_scripts'] = array('cmd.php','index.php',
'view_jpeg_photo.php','entry_chooser.php',
'password_checker.php','download_binary_attr.php');
foreach ($app['direct_scripts'] as $script) {
$scriptOK = false;
if (preg_match('/'.$script.'$/',$_SERVER['SCRIPT_NAME'])) {
@ -27,7 +37,7 @@ foreach (array('cmd.php','index.php','view_jpeg_photo.php','entry_chooser.php','
}
if (! $scriptOK) {
if ($_REQUEST['server_id'])
if (isset($_REQUEST['server_id']))
header(sprintf('Location: index.php?server_id=%s',$_REQUEST['server_id']));
else
header('Location: index.php');
@ -35,7 +45,7 @@ if (! $scriptOK) {
}
/**
* Timer stopwatch, used to instrument PLA
* Timer stopwatch, used to instrument the application
*/
if (! function_exists('stopwatch')) {
function stopwatch() {
@ -55,15 +65,19 @@ if (! function_exists('stopwatch')) {
}
}
# For compatability - if common has been sourced, then return to the calling script.
# For compatability - if common has been sourced a second time, then return to the calling script.
} else {
return;
}
if (function_exists('date_default_timezone_set'))
# Set the defualt time zone, if it isnt set in php.ini
if (function_exists('date_default_timezone_set') && ! ini_get('date.timezone'))
date_default_timezone_set('UTC');
# Start out instrumentation
$timer = stopwatch();
# If we are called from index.php, LIBDIR will be set, all other calls to common.php dont need to set it.
if (! defined('LIBDIR'))
define('LIBDIR','../lib/');
@ -74,112 +88,86 @@ if (! defined('E_STRICT'))
# General functions needed to proceed.
ob_start();
require_once realpath(LIBDIR.'functions.php');
if (ob_get_level()) ob_end_clean();
if (ob_get_level())
ob_end_clean();
/* Turn on all notices and warnings. This helps us write cleaner code (we hope at least)
/**
* Turn on all notices and warnings. This helps us write cleaner code (we hope at least)
* Our custom error handler receives all error notices that pass the error_reporting()
* level set above.
*/
# Call our custom defined error handler, if it is defined in functions.php
if (function_exists('pla_error_handler'))
set_error_handler('pla_error_handler');
# Disable error reporting until all our required functions are loaded.
error_reporting(0);
/*
* functions.php should have defined our pla_function_files array, listing all our
/**
* functions.php should have defined our $app['function_files'] array, listing all our
* required functions (order IS important).
* index.php should have checked they exist and are usable - we'll assume that the user
* has been via index.php, and fixed any problems already.
*/
ob_start();
foreach ($pla_function_files as $file_name) {
if (isset($app['function_files']) && is_array($app['function_files']))
foreach ($app['function_files'] as $file_name) {
require_once realpath ($file_name);
}
# Now read in config_default.php
require_once realpath(LIBDIR.'config_default.php');
if (ob_get_level()) ob_end_clean();
if (ob_get_level())
ob_end_clean();
# We are now ready for error reporting.
error_reporting(E_ALL);
# Start our session.
pla_session_start();
# Check we have the correct version of the SESSION cache
if (isset($_SESSION['cache'])) {
if (!is_array($_SESSION[pla_session_id_init])) $_SESSION[pla_session_id_init] = array();
if (!isset($_SESSION[pla_session_id_init]['version']) || !isset($_SESSION[pla_session_id_init]['config'])
|| $_SESSION[pla_session_id_init]['version'] !== pla_version()
|| $_SESSION[pla_session_id_init]['config'] != filemtime(CONFDIR.'config.php')) {
$_SESSION[pla_session_id_init]['version'] = pla_version();
$_SESSION[pla_session_id_init]['config'] = filemtime(CONFDIR.'config.php');
unset($_SESSION['cache']);
unset($_SESSION['plaConfig']);
# Our configuration information has changed, so we'll redirect to index.php to get it reloaded again.
system_message(array(
'title'=>_('Configuration cache stale.'),
'body'=>_('Your configuration has been automatically refreshed.'),
'type'=>'info'));
$config_file = CONFDIR.'config.php';
check_config($config_file);
} else {
# Sanity check, specially when upgrading from a previous release.
foreach (array_keys($_SESSION['cache']) as $id)
if (isset($_SESSION['cache'][$id]['tree']['null']) && ! is_object($_SESSION['cache'][$id]['tree']['null']))
unset($_SESSION['cache'][$id]);
}
}
# If we came via index.php, then set our $config.
if (! isset($_SESSION['plaConfig']) && isset($config))
$_SESSION['plaConfig'] = $config;
# If we get here, and plaConfig is not set, then redirect the user to the index.
if (! isset($_SESSION['plaConfig'])) {
# If we get here, and $_SESSION[APPCONFIG] is not set, then redirect the user to the index.
if (! isset($_SESSION[APPCONFIG])) {
if (isset($_REQUEST['server_id']))
header(sprintf('Location: index.php?server_id=%s',$_REQUEST['server_id']));
else
header('Location: index.php');
die();
} else {
# Check our custom variables.
# @todo: Change this so that we dont process a cached session.
$_SESSION['plaConfig']->CheckCustom();
$_SESSION[APPCONFIG]->CheckCustom();
}
# If we are here, $_SESSION is set - so enabled DEBUGing if it has been configured.
if (($_SESSION['plaConfig']->GetValue('debug','syslog') || $_SESSION['plaConfig']->GetValue('debug','file'))
&& $_SESSION['plaConfig']->GetValue('debug','level'))
if (($_SESSION[APPCONFIG]->GetValue('debug','syslog') || $_SESSION[APPCONFIG]->GetValue('debug','file'))
&& $_SESSION[APPCONFIG]->GetValue('debug','level'))
define('DEBUG_ENABLED',1);
else
define('DEBUG_ENABLED',0);
# Since DEBUG_ENABLED is set later, as $config may not be set, we'll
if (DEBUG_ENABLED)
debug_log('PLA (%s) initialised and starting with (%s).',1,pla_version(),$_REQUEST);
debug_log('Application (%s) initialised and starting with (%s).',1,__FILE__,__LINE__,__METHOD__,
pla_version(),$_REQUEST);
# Set our PHP timelimit.
if ($_SESSION['plaConfig']->GetValue('session','timelimit'))
set_time_limit($_SESSION['plaConfig']->GetValue('session','timelimit'));
if ($_SESSION[APPCONFIG]->GetValue('session','timelimit'))
set_time_limit($_SESSION[APPCONFIG]->GetValue('session','timelimit'));
# If debug mode is set, increase the time_limit, since we probably need it.
if (DEBUG_ENABLED && $_SESSION['plaConfig']->GetValue('session','timelimit'))
set_time_limit($_SESSION['plaConfig']->GetValue('session','timelimit') * 5);
if (DEBUG_ENABLED && $_SESSION[APPCONFIG]->GetValue('session','timelimit'))
set_time_limit($_SESSION[APPCONFIG]->GetValue('session','timelimit') * 5);
# @todo: Change this so that we dont process a cached session.
$_SESSION['plaConfig']->friendly_attrs = process_friendly_attr_table();
/*
/**
* Language configuration. Auto or specified?
* Shall we attempt to auto-determine the language?
*/
$language = $_SESSION['plaConfig']->GetValue('appearance','language');
$language = $_SESSION[APPCONFIG]->GetValue('appearance','language');
if ($language == 'auto') {
# Make sure their browser correctly reports language. If not, skip this.
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
@ -201,11 +189,10 @@ if ($language == 'auto') {
$HTTP_LANGS = array_unique($HTTP_LANGS);
foreach ($HTTP_LANGS as $HTTP_LANG) {
# Try to grab one after the other the language file
$language_file = LANGDIR.$HTTP_LANG;
$language_dir = LANGDIR.$HTTP_LANG;
if ((substr($HTTP_LANG,0,2) == 'en') ||
(file_exists($language_file) && is_readable($language_file))) {
(file_exists($language_dir) && is_readable($language_dir))) {
# Set language
putenv('LANG='.$HTTP_LANG); # e.g. LANG=de_DE
@ -218,16 +205,16 @@ if ($language == 'auto') {
break;
}
}
#todo: Generate an error if language doesnt exist.
}
} else {
# Grab the language file configured in config.php
#todo: Generate an error if language doesnt exist.
if ($language != null) {
if (strcmp($language,'english') == 0)
$language = 'en_GB';
$language_file = LANGDIR.$language;
# Set language
putenv('LANG='.$language); # e.g. LANG=de_DE
$language .= '.UTF-8';
@ -239,7 +226,7 @@ if ($language == 'auto') {
}
}
/*
/**
* Strip slashes from GET, POST, and COOKIE variables if this
* PHP install is configured to automatically addslashes()
*/
@ -251,34 +238,43 @@ if (get_magic_quotes_gpc() && (! isset($slashes_stripped) || ! $slashes_stripped
$slashes_stripped = true;
}
/**
* Create our application repository variable.
*/
if (isset($_REQUEST['server_id'])) {
$ldapserver = $_SESSION['plaConfig']->ldapservers->Instance($_REQUEST['server_id']);
$ldapserver = $_SESSION[APPCONFIG]->ldapservers->Instance($_REQUEST['server_id']);
} else {
$ldapserver = $_SESSION['plaConfig']->ldapservers->Instance(null);
if (isset($_SESSION[APPCONFIG]->ldapservers) && is_object($_SESSION[APPCONFIG]->ldapservers))
$ldapserver = $_SESSION[APPCONFIG]->ldapservers->Instance(null);
}
# Test to see if we should log out the user due to the timeout.
if ($ldapserver->haveAuthInfo() && $ldapserver->auth_type != 'config') {
/* If time out value has been reached:
- log out user
- put $server_id in array of recently timed out servers */
if (session_timed_out($ldapserver)) {
$timeout_url = 'cmd.php?cmd=timeout&server_id='.$ldapserver->server_id;
echo '<script type="text/javascript" language="javascript">location.href=\''.$timeout_url.'\'</script>';
/**
* Look/evaluate our timeout
*/
if (isset($ldapserver) && is_object($ldapserver) && method_exists($ldapserver,'haveAuthInfo')) {
if ($ldapserver->haveAuthInfo() && isset($ldapserver->auth_type) && $ldapserver->auth_type != 'config') {
/**
* If time out value has been reached:
* - log out user
* - put $server_id in array of recently timed out servers
*/
if (function_exists('session_timed_out') && session_timed_out($ldapserver)) {
$app['url_timeout'] = sprintf('cmd.php?cmd=timeout&server_id=%s',$_REQUEST['server_id']);
printf('<script type="text/javascript" language="javascript">location.href=\'%s\'</script>',
htmlspecialchars($app['url_timeout']));
die();
}
}
/*
* Update $_SESSION['activity']
* for timeout and automatic logout feature
*/
if ($ldapserver->haveAuthInfo())
# Update $_SESSION['activity'] for timeout and automatic logout feature
if ($ldapserver->haveAuthInfo() && function_exists('set_lastactivity'))
set_lastactivity($ldapserver);
}
/**
* At this point we have read all our additional function PHP files and our configuration.
* If we are using hooks, run the session_init hook.
*/
if (function_exists('run_hook'))
run_hook('post_session_init',array());
?>

View File

@ -1,22 +1,35 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/config_default.php,v 1.27.2.1 2007/12/20 10:47:20 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/config_default.php,v 1.27.2.3 2007/12/26 01:47:20 wurley Exp $
/**
* Configuration processing and defaults.
*
* @author The phpLDAPadmin development team
* @package phpLDAPadmin
*
* @todo Add validation of set variables to enforce limits or particular values.
*/
# The minimum version of PHP required to run phpLDAPadmin.
define('REQUIRED_PHP_VERSION','5.0.0');
/**
* The config class contains all our configuration settings for a session.
*
* An instance of this class should be stored in $_SESSION to maintain state, and to avoid
* rebuilding/rereading it at the state of each page output.
*
* @package phpLDAPadmin
*
* @author The phpLDAPadmin development team
* @author Deon George
*/
class Config {
public $custom;
protected $default;
public $ldapservers = array();
public $friendly_attrs = array();
protected $friendly_attrs = array();
public $queries = array();
public $attrs_display_order = array();
public $hidden_attrs = array();
@ -59,6 +72,10 @@ class Config {
'desc'=>'Date format whenever dates are shown',
'default'=>'%A %e %B %Y');
$this->default->appearance['custom_templates_only'] = array(
'desc'=>'Only display the custom templates.',
'default'=>false);
$this->default->appearance['date_attrs'] = array(
'desc'=>'Array of attributes that should show a jscalendar',
'default'=>array('shadowExpire'=>'%es','shadowLastChange'=>'%es'));
@ -556,5 +573,63 @@ class Config {
}
return false;
}
/**
* Reads the friendly_attrs array as defined in config.php and lower-cases all
* the keys. Will return an empty array if the friendly_attrs array is not defined
* in config.php. This is simply used so we can more easily lookup user-friendly
* attributes configured by the admin.
*/
function getFriendlyAttrs($friendly_attrs) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
debug_log('Entered with ()',1,__FILE__,__LINE__,__METHOD__);
# If friendly_attrs is not an array, then set to an empty array.
if (! is_array($friendly_attrs))
$this->friendly_attrs = array();
else
foreach ($friendly_attrs as $old_name => $new_name)
$this->friendly_attrs[strtolower($old_name)] = $new_name;
}
/**
* This function will return the friendly name of an attribute, if it exists.
* If the friendly name doesnt exist, the attribute name will be returned.
*
* @param attribute
* @return string friendly name|attribute
*/
public function getFriendlyName($attr) {
if ($this->haveFriendlyName($attr))
return $this->friendly_attrs[strtolower($attr)];
else
return $attr;
}
/**
* This function will return true if a friendly name exists for an attribute.
* If the friendly name doesnt exist, it will return false.
*
* @param attribute
* @return boolean true|false
*/
public function haveFriendlyName($attr) {
return isset($this->friendly_attrs[strtolower($attr)]);
}
/**
* This function will return the <ancronym> html for a friendly name attribute.
*
* @param attribute
* @return string html for the friendly name.
*/
public function getFriendlyHTML($attr) {
if ($this->haveFriendlyName($attr))
return sprintf('<acronym title="%s %s">%s</acronym>',_('Alias for'),$attr,htmlspecialchars($this->getFriendlyName($attr)));
else
return $attr;
}
}
?>

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/export_functions.php,v 1.36 2007/12/15 11:42:01 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/export_functions.php,v 1.36.2.1 2007/12/26 09:26:33 wurley Exp $
/**
* Fuctions and classes for exporting ldap entries to others formats
@ -70,7 +70,7 @@ class LdapExportInfo {
*/
function LdapExportInfo($server_id,$base_dn=null,$query_filter=null,$scope=null) {
$this->ldapserver = $_SESSION['plaConfig']->ldapservers->Instance($server_id);
$this->ldapserver = $_SESSION[APPCONFIG]->ldapservers->Instance($server_id);
$this->ldapserver->base_dn = $base_dn;
$this->ldapserver->query_filter = $query_filter;
$this->ldapserver->scope = $scope;
@ -245,7 +245,7 @@ class PlaLdapExporter extends PlaAbstractExporter {
# get the data to be exported
$this->results = $this->ldap_info->ldapserver->search(null,$this->base_dn,$this->queryFilter,$this->attributes,
$this->scope,true,$_SESSION['plaConfig']->GetValue('deref','export'));
$this->scope,true,$_SESSION[APPCONFIG]->GetValue('deref','export'));
# if no result, there is a something wrong
if (! $this->results && $this->ldap_info->ldapserver->errno())

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/hooks.php,v 1.10 2007/12/15 11:30:24 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/hooks.php,v 1.10.2.1 2007/12/26 09:26:33 wurley Exp $
/**
* Functions related to hooks management.
@ -50,7 +50,7 @@ function sort_array_by_priority($a,$b) {
* @return true if all procedures returned true, false otherwise.
*/
function run_hook($hook_name,$args) {
$hooks = isset($_SESSION['plaConfig']) ? $_SESSION['plaConfig']->hooks : array();
$hooks = isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->hooks : array();
$debug = 0;
syslog_debug("Running hook $hook_name.");
@ -161,8 +161,8 @@ function remove_hook($hook_name,$priority,$hook_function,$rollback_function) {
*/
function clear_hooks($hook_name) {
global $config;
if (!isset($config) && isset($_SESSION['plaConfig']))
$config = $_SESSION['plaConfig'];
if (!isset($config) && isset($_SESSION[APPCONFIG]))
$config = $_SESSION[APPCONFIG];
if (array_key_exists($hook_name,$config->hooks))
unset($config->hooks[$hook_name]);

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/page.php,v 1.3.2.5 2007/12/21 12:51:28 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/page.php,v 1.3.2.11 2007/12/30 02:05:46 wurley Exp $
/**
* Page Rendering Functions
@ -39,14 +39,14 @@ class page {
# Try and work around if php compression is on, or the user has set compression in the config.
# type = 1 for user gzip, 0 for php.ini gzip.
$obStatus = ob_get_status();
if ($obStatus['type'] && $obStatus['status']) {
if (isset($obStatus['type']) && $obStatus['type'] && $obStatus['status']) {
$preOutput = ob_get_contents();
ob_end_clean();
}
header('Content-type: text/html; charset="UTF-8"');
if (isset($_SESSION['plaConfig'])
&& $_SESSION['plaConfig']->GetValue('appearance','compress')
if (isset($_SESSION[APPCONFIG])
&& $_SESSION[APPCONFIG]->GetValue('appearance','compress')
&& eregi('gzip',$_SERVER['HTTP_ACCEPT_ENCODING'])
&& ! ini_get('zlib.output_compression')) {
@ -56,10 +56,10 @@ class page {
debug_log('Sent COMPRESSED header to browser and discarded (%s)',129,__FILE__,__LINE__,__METHOD__,$preOutput);
}
if (isset($_SESSION['plaConfig'])
&& $_SESSION['plaConfig']->GetValue('appearance','compress')
if (isset($_SESSION[APPCONFIG])
&& $_SESSION[APPCONFIG]->GetValue('appearance','compress')
&& ini_get('zlib.output_compression'))
$this->setsysmsg(array(array('title'=>_('Warning'),'body'=>_('WARNING: You cannot have PHP compression and phpLDAPadmin compression enabled at the same time. Please unset zlib.output_compression or set $config->custom->appearance[\'compress\']=false'),'type'=>'warn')));
$this->setsysmsg(array('title'=>_('Warning'),'body'=>_('WARNING: You cannot have PHP compression and phpLDAPadmin compression enabled at the same time. Please unset zlib.output_compression or set $config->custom->appearance[\'compress\']=false'),'type'=>'warn'));
# Turn back on output buffering.
ob_start();
@ -75,7 +75,7 @@ class page {
$this->_app['logo'] = $this->_default['logo'];
if (! is_null($server_id))
$this->_app['urlcss'] = sprintf('%s%s',CSSDIR,$_SESSION['plaConfig']->GetValue('appearance','stylesheet'));
$this->_app['urlcss'] = sprintf('%s%s',CSSDIR,$_SESSION[APPCONFIG]->GetValue('appearance','stylesheet'));
else
$this->_app['urlcss'] = sprintf('%s%s',CSSDIR,'style.css');
@ -99,17 +99,19 @@ class page {
# Page Title
echo '<head>';
if (isset($_SESSION['plaConfig']))
if (isset($_SESSION[APPCONFIG]))
printf('<title>%s (%s) - %s</title>',
$this->_app['title'],pla_version(),$_SESSION['plaConfig']->GetValue('appearance','page_title'));
$this->_app['title'],pla_version(),$_SESSION[APPCONFIG]->GetValue('appearance','page_title'));
else
printf('<title>%s - %s</title>',$this->_app['title'],pla_version());
# Style sheet.
printf('<link type="text/css" rel="stylesheet" href="%s" />',$this->_app['urlcss']);
printf('<link rel="shortcut icon" href="%s/images/favicon.ico" type="image/vnd.microsoft.icon" />','../htdocs/');
if (defined('JSDIR')) {
printf('<link type="text/css" rel="stylesheet" media="all" href="%sjscalendar/calendar-blue.css" title="blue" />',JSDIR);
printf('<link type="text/css" rel="stylesheet" href="%s/phplayersmenu/layerstreemenu.css" />','../htdocs/'.JSDIR);
printf('<link rel="shortcut icon" href="%s/images/favicon.ico" type="image/vnd.microsoft.icon" />','../htdocs/');
echo "\n";
printf('<script type="text/javascript" src="%spla_ajax.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%stree_hide.js"></script>',JSDIR);
@ -117,6 +119,7 @@ class page {
printf('<script type="text/javascript" src="%sto_ascii.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%sjscalendar/calendar.js"></script>','../htdocs/'.JSDIR);
echo "\n";
}
# HTML head requirements.
if (is_array($this->_head) && count ($this->_head))
@ -131,14 +134,14 @@ class page {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
debug_log('Entered with ()',129,__FILE__,__LINE__,__METHOD__);
if (isset($_SESSION['plaConfig']))
$pagetitle = $_SESSION['plaConfig']->GetValue('appearance','page_title') ? ' - '.$_SESSION['plaConfig']->GetValue('appearance','page_title') : '';
if (isset($_SESSION[APPCONFIG]))
$pagetitle = $_SESSION[APPCONFIG]->GetValue('appearance','page_title') ? ' - '.$_SESSION[APPCONFIG]->GetValue('appearance','page_title') : '';
else
$pagetitle = '';
echo '<tr class="head">';
if (is_null($this->server_id))
if (! isset($this->server_id) || is_null($this->server_id))
printf('<td colspan=0>%s</td>','&nbsp;');
else
printf('<td colspan=0>%s %s</td>',$this->_app['title'],$pagetitle);
@ -150,63 +153,31 @@ class page {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
debug_log('Entered with ()',129,__FILE__,__LINE__,__METHOD__);
if (! isset($this->server_id) || is_null($this->server_id)) {
echo '&nbsp;';
return;
}
echo '<table class="control" border=0>';
echo '<tr>';
$empty = true;
if ($_SESSION['plaConfig']->isCommandAvailable('home')) {
printf('<td><a href="cmd.php?cmd=welcome" title="%s"><img src="images/home-big.png" alt="%s" /><br />%s</a></td>',
_('Home'),_('Home'),_('Home'));
if (function_exists('cmd_control_pane'))
foreach (cmd_control_pane() as $cmd => $cmddetails) {
$cmds = preg_split('/:/',$cmd);
if ($_SESSION[APPCONFIG]->isCommandAvailable($cmds)) {
if ((isset($cmddetails['enable']) && trim($cmddetails['enable'])) || ! isset($cmddetails['enable'])) {
printf('<td>%s</td>',$cmddetails['link']);
$empty = false;
}
if ($_SESSION['plaConfig']->isCommandAvailable('purge')) {
printf('<td><a href="cmd.php?cmd=purge_cache" title="%s"><img src="images/trash-big.png" alt="%s" /><br />%s</a></td>',
_('Purge caches'),_('Purge all cached data in phpLDAPadmin, including server schemas.'),_('Purge caches'));
$empty = false;
}
}
if ($_SESSION['plaConfig']->isCommandAvailable('external_links', 'feature')) {
printf('<td><a href="%s" target="new" title="%s"><img src="images/request-feature.png" alt="%s" /><br />%s</a></td>',
get_href('add_rfe'),_('Request feature'),_('light'),_('Request feature'));
$empty = false;
}
if ($_SESSION['plaConfig']->isCommandAvailable('external_links', 'bug')) {
printf('<td><a href="%s" target="new" title="%s"><img src="images/bug-big.png" alt="%s" /><br />%s</a></td>',
get_href('add_bug'),_('Report a bug'),_('bug'),_('Report a bug'));
$empty = false;
}
if ($_SESSION['plaConfig']->isCommandAvailable('external_links', 'donation')) {
printf('<td><a href="%s" target="new" title="%s"><img src="images/smile-big.png" alt="%s" /><br />%s</a></td>',
get_href('donate'),_('Donate'),_('Donate'),_('Donate'));
$empty = false;
}
if (! $_SESSION['plaConfig']->GetValue('appearance','hide_debug_info')) {
printf('<td><a href="cmd.php?cmd=show_cache" title="%s"><img src="images/debug-cache.png" alt="%s" /><br />%s</a></td>',
_('Show Cache'),_('Show Cache'),_('Show Cache'));
$empty = false;
}
if ($_SESSION['plaConfig']->isCommandAvailable('external_links', 'help')) {
printf('<td><a href="%s" target="new" title="%s"><img src="images/help-big.png" alt="%s" /><br />%s</a></td>',
get_href('documentation'),_('Help'),_('Help'),_('Help'));
$empty = false;
}
if ($empty) {
if ($empty)
echo '<td></td>';
}
printf('<td>&nbsp;</td><td class="logo"><img src="%s" alt="Logo" class="logo" /></td>',$this->_app['logo']);
if (isset($this->_app['logo']))
printf('<td class="spacer">&nbsp;</td><td class="logo"><img src="%s" alt="Logo" class="logo" /></td>',$this->_app['logo']);
else
echo '<td class="spacer" colspan=2>&nbsp;</td>';
echo '</tr>';
echo '</table>';
@ -216,10 +187,10 @@ class page {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
debug_log('Entered with ()',129,__FILE__,__LINE__,__METHOD__);
if (! isset($_SESSION['plaConfig']))
if (! isset($_SESSION[APPCONFIG]))
return;
$server_id = is_null($this->server_id) ? min($_SESSION['plaConfig']->ldapservers->GetServerList()) : $this->server_id;
$server_id = is_null($this->server_id) ? min($_SESSION[APPCONFIG]->ldapservers->GetServerList()) : $this->server_id;
echo '<td class="tree" colspan=2>';
if (count(server_info_list(true)) > 1) {
@ -232,9 +203,9 @@ class page {
echo "\n\n";
}
foreach ($_SESSION['plaConfig']->ldapservers->GetServerList() as $server_id) {
foreach ($_SESSION[APPCONFIG]->ldapservers->GetServerList() as $server_id) {
printf('<div id="SID_%s" style="display: %s">',$server_id,($server_id == $this->server_id) ? 'block': 'none');
$ldapserver = $_SESSION['plaConfig']->ldapservers->Instance($server_id);
$ldapserver = $_SESSION[APPCONFIG]->ldapservers->Instance($server_id);
$tree = Tree::getInstance($ldapserver->server_id);
@ -246,7 +217,7 @@ class page {
public function block_add($side,$object) {
if (! is_object($object))
error('not an object');
error(sprintf('block_add called with [%s], but it is not an object',serialize($object)));
$this->_block[$side][] = $object;
}
@ -312,9 +283,11 @@ class page {
ob_start();
}
# System Message
if (isset($_SESSION['sysmsg']) && $_SESSION['sysmsg']) {
$this->setsysmsg($_SESSION['sysmsg']);
# Add the Session System Messages
if (isset($_SESSION['sysmsg']) && is_array($_SESSION['sysmsg'])) {
foreach ($_SESSION['sysmsg'] as $msg)
$this->setsysmsg($msg);
unset($_SESSION['sysmsg']);
}
@ -330,8 +303,8 @@ class page {
echo $object->draw('body');
}
if ($compress && ob_get_level() && isset($_SESSION['plaConfig'])
&& $_SESSION['plaConfig']->GetValue('appearance','compress')
if ($compress && ob_get_level() && isset($_SESSION[APPCONFIG])
&& $_SESSION[APPCONFIG]->GetValue('appearance','compress')
&& ! ini_get('zlib.output_compression')
&& eregi('gzip',$_SERVER['HTTP_ACCEPT_ENCODING'])) {
@ -410,8 +383,8 @@ class page {
echo '</html>';
# compress output
if (ob_get_level() && isset($_SESSION['plaConfig'])
&& $_SESSION['plaConfig']->GetValue('appearance','compress')
if (ob_get_level() && isset($_SESSION[APPCONFIG])
&& $_SESSION[APPCONFIG]->GetValue('appearance','compress')
&& ! ini_get('zlib.output_compression')
&& eregi('gzip',$_SERVER['HTTP_ACCEPT_ENCODING'])) {
@ -434,17 +407,13 @@ class page {
return;
if (isset($this->sysmsg))
$nummsg = count($this->sysmsg);
$msgnum = count($this->sysmsg) + 1;
else
$nummsg = 1;
foreach ($data as $msgno => $msgarray) {
$msgindex = $msgno + $nummsg;
$msgnum = 1;
foreach (array('title','body','type') as $index)
if (isset($msgarray[$index]))
$this->sysmsg[$msgindex][$index] = $msgarray[$index];
}
if (isset($data[$index]))
$this->sysmsg[$msgnum][$index] = $data[$index];
}
}

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_advanced.php,v 1.26 2007/12/15 07:50:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_advanced.php,v 1.26.2.1 2007/12/26 09:26:33 wurley Exp $
/**
* @package phpLDAPadmin
@ -32,8 +32,8 @@ function focus_filter() {
<tr><td class="title" colspan=2><?php echo _('Advanced Search Form'); ?></td></tr>
<?php
$ss = $_SESSION['plaConfig']->isCommandAvailable('search', 'simple_search');
$ps = $_SESSION['plaConfig']->isCommandAvailable('search', 'predefined_search');
$ss = $_SESSION[APPCONFIG]->isCommandAvailable('search', 'simple_search');
$ps = $_SESSION[APPCONFIG]->isCommandAvailable('search', 'predefined_search');
if ($ss | $ps) {
echo '<tr><td class="subtitle" colspan=2>(';
if ($ss) {
@ -104,7 +104,7 @@ if (isset($entry['base_dn']['exist']) && $entry['base_dn']['exist'])
<td><input type="text" name="display_attrs" style="width: 200px" value="<?php
echo $entry['display']['string'] ? htmlspecialchars($entry['display']['string']) :
join(', ',$_SESSION['plaConfig']->GetValue('search','result_attributes')); ?>" /></td>
join(', ',$_SESSION[APPCONFIG]->GetValue('search','result_attributes')); ?>" /></td>
</tr>
<tr>

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_predefined.php,v 1.10 2007/12/15 07:50:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_predefined.php,v 1.10.2.1 2007/12/26 09:26:33 wurley Exp $
/**
* @package phpLDAPadmin
@ -21,8 +21,8 @@ else
printf('<tr><td class="title" colspan=2>%s</td></tr>',_('Predefined Searches'));
$ss = $_SESSION['plaConfig']->isCommandAvailable('search', 'simple_search');
$as = $_SESSION['plaConfig']->isCommandAvailable('search', 'advanced_search');
$ss = $_SESSION[APPCONFIG]->isCommandAvailable('search', 'simple_search');
$as = $_SESSION[APPCONFIG]->isCommandAvailable('search', 'advanced_search');
if ($ss | $as) {
echo '<tr><td class="subtitle" colspan=2>(';
if ($ss) {
@ -37,7 +37,7 @@ if ($ss | $as) {
echo '<tr><td colspan=2>&nbsp;</td></tr>';
if (! isset($_SESSION['plaConfig']->queries) || ! is_array($_SESSION['plaConfig']->queries) || count($_SESSION['plaConfig']->queries) == 0) {
if (! isset($_SESSION[APPCONFIG]->queries) || ! is_array($_SESSION[APPCONFIG]->queries) || count($_SESSION[APPCONFIG]->queries) == 0) {
printf('<tr><td>%s</td></tr>',_('No queries have been defined in config.php.'));
} else {
@ -47,7 +47,7 @@ if (! isset($_SESSION['plaConfig']->queries) || ! is_array($_SESSION['plaConfig'
echo '<td>';
echo '<select name="predefined">';
foreach ($_SESSION['plaConfig']->queries as $q_number => $q) {
foreach ($_SESSION[APPCONFIG]->queries as $q_number => $q) {
if ($selected_q_number === $q_number)
$selected = ' selected';
else

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_simple.php,v 1.16 2007/12/15 07:50:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_simple.php,v 1.16.2.2 2007/12/26 09:26:33 wurley Exp $
/**
* @package phpLDAPadmin
@ -23,8 +23,8 @@
<tr><td class="title"><?php echo _('Simple Search Form'); ?></td></tr>
<?php
$as = $_SESSION['plaConfig']->isCommandAvailable('search', 'advanced_search');
$ps = $_SESSION['plaConfig']->isCommandAvailable('search', 'predefined_search');
$as = $_SESSION[APPCONFIG]->isCommandAvailable('search', 'advanced_search');
$ps = $_SESSION[APPCONFIG]->isCommandAvailable('search', 'predefined_search');
if ($as | $ps) {
echo '<tr><td class="subtitle">(';
if ($as) {
@ -52,16 +52,16 @@
<tr><td><small><b><?php echo _('Search for entries whose'); ?></b></small></td></tr>
<tr><td>
<select name="attribute">
<?php foreach ($_SESSION['plaConfig']->GetValue('search','attributes') as $id => $attribute) { ?>
<?php foreach ($_SESSION[APPCONFIG]->GetValue('search','attributes') as $id => $attribute) { ?>
<option value="<?php echo rawurlencode($attribute); ?>"<?php echo $attribute==$entry['attr']?' selected="true"':''; ?>>
<?php echo htmlspecialchars($ldapserver->showFriendlyAttr($attribute)); ?>
<?php echo htmlspecialchars($_SESSION[APPCONFIG]->getFriendlyName($attribute)); ?>
</option>
<?php } ?>
</select>
<select name="criterion">
<?php
foreach ($_SESSION['plaConfig']->GetValue('search','criteria_options') as $c) { ?>
foreach ($_SESSION[APPCONFIG]->GetValue('search','criteria_options') as $c) { ?>
<option value="<?php echo $c; ?>"<?php echo $c==$entry['criterion']?' selected="true"':''; ?>>
<?php echo htmlspecialchars(_($c)); ?>
</option>

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_results_list.php,v 1.7 2007/12/15 07:50:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_results_list.php,v 1.7.2.2 2007/12/26 09:26:33 wurley Exp $
/**
* @package phpLDAPadmin
@ -23,7 +23,7 @@ foreach ($results as $dn => $dndetails) {
printf('<td class="icon"><img src="images/%s" alt="icon" /></td>',get_icon($ldapserver,$dn));
$formatted_dn = get_rdn($dn);
if (!$_SESSION['plaConfig']->isCommandAvailable('schema')) {
if (!$_SESSION[APPCONFIG]->isCommandAvailable('schema')) {
$formatted_dn = explode('=', $formatted_dn, 2);
$formatted_dn = $formatted_dn[1];
}
@ -32,7 +32,7 @@ foreach ($results as $dn => $dndetails) {
$ldapserver->server_id,rawurlencode(dn_unescape($dn)),htmlspecialchars($formatted_dn));
echo '</tr>';
if ($_SESSION['plaConfig']->isCommandAvailable('schema')) {
if ($_SESSION[APPCONFIG]->isCommandAvailable('schema')) {
printf('<tr class="list_attr"><td class="blank">&nbsp;</td><td class="attr">dn</td><td class="val">%s</td></tr>',htmlspecialchars(dn_unescape($dn)));
}
@ -45,18 +45,9 @@ foreach ($results as $dn => $dndetails) {
if ($ldapserver->isAttrBinary($attr))
$values = array('(binary)');
if (isset($_SESSION['plaConfig']->friendly_attrs[strtolower($attr)])) {
$a = $attr;
$attr = htmlspecialchars($_SESSION['plaConfig']->friendly_attrs[strtolower($attr)]);
if ($_SESSION['plaConfig']->isCommandAvailable('schema')) {
$attr = sprintf('<acronym title="Alias for %s">%s</acronym>', $a, $attr);
}
} else
$attr = htmlspecialchars($attr);
echo '<tr class="list_attr">';
echo '<td class="blank">&nbsp;</td>';
printf('<td class="attr" valign="top">%s</td>',$attr);
printf('<td class="attr" valign="top">%s</td>',$_SESSION[APPCONFIG]->getFriendlyHTML($attr));
echo '<td class="val">';

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_results_table.php,v 1.9 2007/12/15 07:50:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_results_table.php,v 1.9.2.2 2007/12/26 09:26:33 wurley Exp $
/**
* Incoming variables (among others)
@ -10,7 +10,7 @@
* @package phpLDAPadmin
*/
if ($_SESSION['plaConfig']->isCommandAvailable('schema')) {
if ($_SESSION[APPCONFIG]->isCommandAvailable('schema')) {
$all_attrs = array('' =>1, 'dn'=>1);
} else {
$all_attrs = array('' =>1);
@ -33,7 +33,7 @@ foreach ($results as $dn => $dndetails) {
$attrs_display = array();
$attrs_display[''] = sprintf('<center><a href="%s"><img src="images/%s" alt="icon" /></a></center>',$edit_url,get_icon($ldapserver,$dn));
if ($_SESSION['plaConfig']->isCommandAvailable('schema')) {
if ($_SESSION[APPCONFIG]->isCommandAvailable('schema')) {
$dn_display = strlen($dn) > 40
? sprintf('<acronym title="%s">%s...</acronym>',htmlspecialchars($dn),htmlspecialchars(substr($dn,0,40)))
: htmlspecialchars($dn);
@ -47,14 +47,7 @@ foreach ($results as $dn => $dndetails) {
if ($attr == 'dn')
continue;
# Clean up the attr name
if (isset($_SESSION['plaConfig']->friendly_attrs[strtolower($attr)])) {
$attr_display = htmlspecialchars($_SESSION['plaConfig']->friendly_attrs[strtolower($attr)]);
if ($_SESSION['plaConfig']->isCommandAvailable('schema')) {
$attr_display = sprintf('<acronym title="Alias for %s">%s</acronym>', $attr, $attr_display);
}
} else
$attr_display = htmlspecialchars($attr);
$attr_display = $_SESSION[APPCONFIG]->getFriendlyHTML($attr);
if (! isset($all_attrs[$attr_display]))
$all_attrs[$attr_display] = 1;

View File

@ -1,5 +1,5 @@
<?php
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/server_functions.php,v 1.51 2007/12/15 07:50:33 wurley Exp $ */
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/server_functions.php,v 1.51.2.5 2007/12/26 09:26:33 wurley Exp $ */
/**
* Classes and functions for LDAP server configuration and capability
@ -47,24 +47,6 @@ class LDAPserver {
$this->server_id = $server_id;
}
/**
* Checks the specified server id for sanity. Ensures that the server is indeed in the configured
* list and active. This is used by many many scripts to ensure that valid server ID values
* are passed in POST and GET.
*
* @param int $server_id the server_id of the LDAP server as defined in config.php
* @return bool
*/
function isValidServer() {
if (DEBUG_ENABLED)
debug_log('Entered with ()',17,__FILE__,__LINE__,__METHOD__);
if (trim($this->host))
return true;
else
return false;
}
/**
* Check if there is sufficent information to Authenticate to the LDAP server.
*
@ -413,8 +395,8 @@ class LDAPserver {
debug_log('Checking config for BaseDN',80,__FILE__,__LINE__,__METHOD__);
# If the base is set in the configuration file, then just return that.
if (count($_SESSION['plaConfig']->ldapservers->GetValue($this->server_id,'server','base')) > 0) {
$this->_baseDN = $_SESSION['plaConfig']->ldapservers->GetValue($this->server_id,'server','base');
if (count($_SESSION[APPCONFIG]->ldapservers->GetValue($this->server_id,'server','base')) > 0) {
$this->_baseDN = $_SESSION[APPCONFIG]->ldapservers->GetValue($this->server_id,'server','base');
if (DEBUG_ENABLED)
debug_log('Return BaseDN from Config [%s]',17,__FILE__,__LINE__,__METHOD__,implode('|',$this->_baseDN));
@ -478,7 +460,7 @@ class LDAPserver {
$return = true;
elseif ($this->getLoggedInDN() === 'anonymous' &&
($_SESSION['plaConfig']->GetValue('appearance','anonymous_bind_implies_read_only') === true))
($_SESSION[APPCONFIG]->GetValue('appearance','anonymous_bind_implies_read_only') === true))
$return = true;
@ -505,7 +487,7 @@ class LDAPserver {
debug_log('Entered with ()',17,__FILE__,__LINE__,__METHOD__);
if ($this->connect(false) && $this->haveAuthInfo() && ! $this->isReadOnly() &&
$_SESSION['plaConfig']->isCommandAvailable('entry_delete', 'mass_delete'))
$_SESSION[APPCONFIG]->isCommandAvailable('entry_delete', 'mass_delete'))
return true;
@ -533,7 +515,7 @@ class LDAPserver {
if (DEBUG_ENABLED)
debug_log('Entered with ()',17,__FILE__,__LINE__,__METHOD__);
if (! $_SESSION['plaConfig']->isCommandAvailable('entry_create')) return false;
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_create')) return false;
else return $this->show_create;
}
@ -566,7 +548,7 @@ class LDAPserver {
* @return bool True if the feature is enabled and false otherwise.
*/
function isVisible() {
if ($this->isValidServer() && $this->visible)
if ($this->visible)
$return = true;
else
$return = false;
@ -924,6 +906,13 @@ class LDAPserver {
return $schema;
}
/**
* Return the attribute used for login
*/
function getLoginAttr() {
return $this->login_attr;
}
/**
* Fetches whether the login_attr feature is enabled for a specified server.
*
@ -939,7 +928,7 @@ class LDAPserver {
* @return bool
*/
function isLoginAttrEnabled() {
if ((strcasecmp($this->login_attr,'dn') != 0) && trim($this->login_attr))
if ((strcasecmp($this->getLoginAttr(),'dn') != 0) && trim($this->getLoginAttr()))
$return = true;
else
$return = false;
@ -962,9 +951,9 @@ class LDAPserver {
*/
function isLoginStringEnabled() {
if (DEBUG_ENABLED)
debug_log('login_attr is [%s]',80,__FILE__,__LINE__,__METHOD__,$this->login_attr);
debug_log('login_attr is [%s]',80,__FILE__,__LINE__,__METHOD__,$this->getLoginAttr());
if (! strcasecmp($this->login_attr,'string'))
if (! strcasecmp($this->getLoginAttr(),'string'))
$return = true;
else
$return = false;
@ -1004,10 +993,10 @@ class LDAPserver {
*/
function isAnonBindAllowed() {
# If only_login_allowed_dns is set, then we cant have anonymous.
if (count($_SESSION['plaConfig']->ldapservers->GetValue($this->server_id,'login','allowed_dns')) > 0)
if (count($_SESSION[APPCONFIG]->ldapservers->GetValue($this->server_id,'login','allowed_dns')) > 0)
$return = false;
else
$return = $_SESSION['plaConfig']->ldapservers->GetValue($this->server_id,'login','anon_bind');
$return = $_SESSION[APPCONFIG]->ldapservers->GetValue($this->server_id,'login','anon_bind');
if (DEBUG_ENABLED)
debug_log('Entered with (), Returning (%s)',17,__FILE__,__LINE__,__METHOD__,$return);
@ -1826,7 +1815,7 @@ class LDAPserver {
/**
* Determines if an attribute's value can contain multiple lines. Attributes that fall
* in this multi-line category may be configured in config.php. Hence, this function
* accesses the global variable $_SESSION['plaConfig']->custom->appearance['multi_line_attributes'];
* accesses the global variable $_SESSION[APPCONFIG]->custom->appearance['multi_line_attributes'];
*
* Usage example:
* <code>
@ -1851,7 +1840,7 @@ class LDAPserver {
# Next, compare strictly by name first
else
foreach ($_SESSION['plaConfig']->GetValue('appearance','multi_line_attributes') as $multi_line_attr_name)
foreach ($_SESSION[APPCONFIG]->GetValue('appearance','multi_line_attributes') as $multi_line_attr_name)
if (strcasecmp($multi_line_attr_name,$attr_name) == 0) {
$return = true;
break;
@ -1865,7 +1854,7 @@ class LDAPserver {
$syntax_oid = $schema_attr->getSyntaxOID();
if ($syntax_oid)
foreach ($_SESSION['plaConfig']->GetValue('appearance','multi_line_syntax_oids') as $multi_line_syntax_oid)
foreach ($_SESSION[APPCONFIG]->GetValue('appearance','multi_line_syntax_oids') as $multi_line_syntax_oid)
if ($multi_line_syntax_oid == $syntax_oid) {
$return = true;
break;
@ -2212,8 +2201,8 @@ class LDAPserver {
if (DEBUG_ENABLED)
debug_log('Entered with (%s)',17,__FILE__,__LINE__,__METHOD__,$attr);
$read_only_attrs = isset($_SESSION['plaConfig']->read_only_attrs) ? $_SESSION['plaConfig']->read_only_attrs : array();
$read_only_except_dn = isset($_SESSION['plaConfig']->read_only_except_dn) ? $_SESSION['plaConfig']->read_only_except_dn : '';
$read_only_attrs = isset($_SESSION[APPCONFIG]->read_only_attrs) ? $_SESSION[APPCONFIG]->read_only_attrs : array();
$read_only_except_dn = isset($_SESSION[APPCONFIG]->read_only_except_dn) ? $_SESSION[APPCONFIG]->read_only_except_dn : '';
$attr = trim($attr);
if (! $attr)
@ -2258,9 +2247,9 @@ class LDAPserver {
if (DEBUG_ENABLED)
debug_log('Entered with (%s)',17,__FILE__,__LINE__,__METHOD__,$attr);
$hidden_attrs = isset($_SESSION['plaConfig']->hidden_attrs) ? $_SESSION['plaConfig']->hidden_attrs : array();
$hidden_attrs_ro = isset($_SESSION['plaConfig']->hidden_attrs_ro) ? $_SESSION['plaConfig']->hidden_attrs_ro : array();
$hidden_except_dn = isset($_SESSION['plaConfig']->hidden_except_dn) ? $_SESSION['plaConfig']->hidden_except_dn : '';
$hidden_attrs = isset($_SESSION[APPCONFIG]->hidden_attrs) ? $_SESSION[APPCONFIG]->hidden_attrs : array();
$hidden_attrs_ro = isset($_SESSION[APPCONFIG]->hidden_attrs_ro) ? $_SESSION[APPCONFIG]->hidden_attrs_ro : array();
$hidden_except_dn = isset($_SESSION[APPCONFIG]->hidden_except_dn) ? $_SESSION[APPCONFIG]->hidden_except_dn : '';
$attr = trim($attr);
if (! $attr)
@ -2407,9 +2396,9 @@ class LDAPserver {
if (! empty($this->login_class))
$filter = sprintf('(&(objectClass=%s)(%s=%s))',
$this->login_class,$this->login_attr,$_SERVER['PHP_AUTH_USER']);
$this->login_class,$this->getLoginAttr(),$_SERVER['PHP_AUTH_USER']);
else
$filter = sprintf('%s=%s',$this->login_attr,$_SERVER['PHP_AUTH_USER']);
$filter = sprintf('%s=%s',$this->getLoginAttr(),$_SERVER['PHP_AUTH_USER']);
foreach ($this->getBaseDN() as $base_dn) {
$result = $this->search(null,$base_dn,$filter,array('dn'));
@ -2437,20 +2426,15 @@ class LDAPserver {
'title'=>_('Authenticate to server'),
'body'=>_('Bad username or password. Please try again.'),
'type'=>'error'),
'cmd.php?cmd=login_form');
sprintf('cmd.php?cmd=login_form&server_id=%s',$this->server_id));
syslog_notice("Authentification FAILED for $dn");
}
$this->auth_type = 'config';
$this->login_dn = $dn;
$this->login_pass = $pass;
} else {
//system_message(array(
// 'title'=>_('Authenticate to server'),
// 'body'=>_('Sorry, you are not allowed to use phpLDAPadmin with this LDAP server.'),
// 'type'=>'error'),
// 'cmd.php?cmd=login_form');
//pla_error(_('Sorry, you are not allowed to use phpLDAPadmin with this LDAP server.'));
$this->auth_type = 'session';
$return = false;
}
@ -2703,25 +2687,6 @@ class LDAPserver {
return $container;
}
/**
* Show friendly attribute.
*/
function showFriendlyAttr($attr) {
if (DEBUG_ENABLED)
debug_log('Entered with (%s)',17,__FILE__,__LINE__,__METHOD__,$attr);
$_SESSION['plaConfig']->friendly_attrs = process_friendly_attr_table();
if (isset($_SESSION['plaConfig']->friendly_attrs[strtolower($attr)]))
$return = $_SESSION['plaConfig']->friendly_attrs[strtolower($attr)];
else
$return = $attr;
if (DEBUG_ENABLED)
debug_log('Returning (%s)',17,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
/**
* Determins if the specified attribute is contained in the $unique_attrs list
* configured in config.php.
@ -2732,7 +2697,7 @@ class LDAPserver {
if (DEBUG_ENABLED)
debug_log('Entered with (%s)',17,__FILE__,__LINE__,__METHOD__,$attr_name);
$unique_attrs = isset($_SESSION['plaConfig']->unique_attrs) ? $_SESSION['plaConfig']->unique_attrs : array();
$unique_attrs = isset($_SESSION[APPCONFIG]->unique_attrs) ? $_SESSION[APPCONFIG]->unique_attrs : array();
if (isset($unique_attrs) && is_array($unique_attrs))
foreach ($unique_attrs as $attr)
@ -2762,8 +2727,8 @@ class LDAPserver {
if ($this->isUniqueAttr($attr_name)) {
$con = $this->connect(false,'unique_attr',false,true,
$_SESSION['plaConfig']->ldapservers->GetValue($this->server_id,'unique_attrs','dn'),
$_SESSION['plaConfig']->ldapservers->GetValue($this->server_id,'unique_attrs','pass'));
$_SESSION[APPCONFIG]->ldapservers->GetValue($this->server_id,'unique_attrs','dn'),
$_SESSION[APPCONFIG]->ldapservers->GetValue($this->server_id,'unique_attrs','pass'));
if (! $con)
pla_error(sprintf(_('Unable to bind to <b>%s</b> with your with unique_attrs credentials. Please check your configuration file.'),$this->name));
@ -2859,10 +2824,10 @@ class LDAPserver {
$user = trim(strtolower($user));
if (! $_SESSION['plaConfig']->ldapservers->GetValue($this->server_id,'login','allowed_dns'))
if (! $_SESSION[APPCONFIG]->ldapservers->GetValue($this->server_id,'login','allowed_dns'))
return true;
foreach ($_SESSION['plaConfig']->ldapservers->GetValue($this->server_id,'login','allowed_dns') as $login_allowed_dn) {
foreach ($_SESSION[APPCONFIG]->ldapservers->GetValue($this->server_id,'login','allowed_dns') as $login_allowed_dn) {
if (DEBUG_ENABLED)
debug_log('Working through (%s)',80,__FILE__,__LINE__,__METHOD__,$login_allowed_dn);

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/session_functions.php,v 1.18 2007/12/15 07:50:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/session_functions.php,v 1.18.2.3 2007/12/29 08:24:11 wurley Exp $
/**
* A collection of functions to handle sessions throughout phpLDAPadmin.
@ -25,7 +25,7 @@ define('pla_session_id_ses_max', 36);
*/
function pla_session_get_id() {
if (DEBUG_ENABLED)
debug_log('pla_session_get_id(): Entered with ()',1);
debug_log('Entered with ()',1,__FILE__,__LINE__,__METHOD__);
$id_md5 = md5(rand(1,1000000));
$ip_md5 = md5($_SERVER['REMOTE_ADDR']);
@ -50,7 +50,7 @@ function pla_session_get_id() {
*/
function pla_session_verify_id() {
if (DEBUG_ENABLED)
debug_log('pla_session_verify_id(): Entered with ()',1);
debug_log('Entered with ()',1,__FILE__,__LINE__,__METHOD__);
$check_id = session_id();
$ip_md5 = md5($_SERVER['REMOTE_ADDR']);
@ -81,6 +81,8 @@ function pla_session_param() {
* @return bool Returns true if the session was started the first time
*/
function pla_session_start() {
global $config;
/* If session.auto_start is on in the server's PHP configuration (php.ini), then
* we will have problems loading our schema cache since the session will have started
* prior to loading the SchemaItem (and descedants) class. Destroy the auto-started
@ -117,7 +119,41 @@ function pla_session_start() {
if (pla_session_id_paranoid && ! pla_session_verify_id())
pla_error('Session inconsistent or session timeout');
return (! $is_initialized) ? true : false;
# Check we have the correct version of the SESSION cache
if (isset($_SESSION['cache']) || isset($_SESSION[pla_session_id_init])) {
if (!is_array($_SESSION[pla_session_id_init])) $_SESSION[pla_session_id_init] = array();
if (!isset($_SESSION[pla_session_id_init]['version']) || !isset($_SESSION[pla_session_id_init]['config'])
|| $_SESSION[pla_session_id_init]['version'] !== pla_version()
|| $_SESSION[pla_session_id_init]['config'] != filemtime(CONFDIR.'config.php')) {
$_SESSION[pla_session_id_init]['version'] = pla_version();
$_SESSION[pla_session_id_init]['config'] = filemtime(CONFDIR.'config.php');
unset($_SESSION['cache']);
unset($_SESSION[APPCONFIG]);
# Our configuration information has changed, so we'll redirect to index.php to get it reloaded again.
system_message(array(
'title'=>_('Configuration cache stale.'),
'body'=>_('Your configuration has been automatically refreshed.'),
'type'=>'info'));
$config_file = CONFDIR.'config.php';
check_config($config_file);
} else {
# Sanity check, specially when upgrading from a previous release.
if (isset($_SESSION['cache']))
foreach (array_keys($_SESSION['cache']) as $id)
if (isset($_SESSION['cache'][$id]['tree']['null']) && ! is_object($_SESSION['cache'][$id]['tree']['null']))
unset($_SESSION['cache'][$id]);
}
}
# If we came via index.php, then set our $config.
if (! isset($_SESSION[APPCONFIG]) && isset($config))
$_SESSION[APPCONFIG] = $config;
}
/**

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/syslog.php,v 1.13 2007/12/15 07:50:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/syslog.php,v 1.13.2.1 2007/12/26 09:26:33 wurley Exp $
/**
* Functions related to syslog logging.
@ -24,11 +24,11 @@
*/
# If config_default.php hasnt been called yet, then return.
if (! isset($_SESSION['plaConfig']))
if (! defined('APPCONFIG') || ! isset($_SESSION[APPCONFIG]))
return;
/* Initialize syslog */
if ($_SESSION['plaConfig']->GetValue('debug','syslog')) {
if ($_SESSION[APPCONFIG]->GetValue('debug','syslog')) {
define_syslog_variables();
openlog('phpldapadmin', LOG_ODELAY, LOG_DAEMON );
}
@ -42,7 +42,7 @@ if ($_SESSION['plaConfig']->GetValue('debug','syslog')) {
* @param log_string String to log.
*/
function syslog_msg ( $emergency, $log_string, $ldapserver=null ) {
if (isset($_SESSION['plaConfig']) && $_SESSION['plaConfig']->GetValue('debug','syslog')) {
if (isset($_SESSION[APPCONFIG]) && $_SESSION[APPCONFIG]->GetValue('debug','syslog')) {
if (isset($ldapserver->server_id))
$log_string = sprintf('(%s) %s',$ldapserver->getLoggedInDN(),$log_string);

View File

@ -1,5 +1,5 @@
<?php
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/template_functions.php,v 1.43 2007/12/15 11:15:24 wurley Exp $ */
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/template_functions.php,v 1.43.2.2 2007/12/26 09:26:33 wurley Exp $ */
/**
* Classes and functions for the template engine.ation and capability
@ -113,6 +113,10 @@ class Templates {
while( ( $file = readdir( $dir ) ) !== false ) {
if (! preg_match('/.xml$/',$file)) continue;
if ($_SESSION['plaConfig']->GetValue('appearance','custom_templates_only')
&& ! preg_match('/^custom_/',$file))
continue;
$objXML = new xml2array();
$xmldata = $objXML->parse(TMPLDIR.'creation/'.$file);
@ -671,7 +675,7 @@ class Templates {
*/
if ($args[0] == '$')
$args[0] = $_SESSION['plaConfig']->ldapservers->GetValue($ldapserver->server_id,'auto_number','search_base');
$args[0] = $_SESSION[APPCONFIG]->ldapservers->GetValue($ldapserver->server_id,'auto_number','search_base');
$container = $ldapserver->getContainerParent($container,$args[0]);
$vals = get_next_number($ldapserver,$container,$args[1],(!empty($args[2]) && ($args[2] == 'true')) ? true : false,(!empty($args[3])) ? $args[3] : false);

View File

@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/timeout_functions.php,v 1.10 2007/12/15 07:50:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/timeout_functions.php,v 1.10.2.1 2007/12/29 08:24:11 wurley Exp $
/**
* A collection of functions used throughout phpLDAPadmin for the timeout and automatic logout feature
@ -19,7 +19,7 @@
*/
function set_lastactivity($ldapserver) {
if (DEBUG_ENABLED)
debug_log('set_lastactivity(): Entered with (%s)',1,$ldapserver->server_id);
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$ldapserver->server_id);
$_SESSION['activity']['server'][$ldapserver->server_id] = time();
$_SESSION['activity']['rightframe_server_id'] = $ldapserver->server_id;
@ -34,7 +34,7 @@ function set_lastactivity($ldapserver) {
*/
function unset_lastactivity($ldapserver) {
if (DEBUG_ENABLED)
debug_log('unset_lastactivity(): Entered with (%s)',1,$ldapserver->server_id);
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$ldapserver->server_id);
if (isset($_SESSION['activity']['server'][$ldapserver->server_id]))
unset($_SESSION['activity']['server'][$ldapserver->server_id]);
@ -52,7 +52,7 @@ function unset_lastactivity($ldapserver) {
*/
function session_timed_out($ldapserver) {
if (DEBUG_ENABLED)
debug_log('session_timed_out(): Entered with (%s)',1,$ldapserver->server_id);
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$ldapserver->server_id);
# If session hasn't expired yet
if (isset($_SESSION['activity']['server'][$ldapserver->server_id])) {