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,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.
*/
set_error_handler('pla_error_handler');
# 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) {
require_once realpath ($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'])) {
header('Location: index.php');
# 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;
}
if (isset($_REQUEST['server_id'])) {
$ldapserver = $_SESSION['plaConfig']->ldapservers->Instance($_REQUEST['server_id']);
} else {
$ldapserver = $_SESSION['plaConfig']->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>';
die();
}
}
/*
* Update $_SESSION['activity']
* for timeout and automatic logout feature
/**
* Create our application repository variable.
*/
if ($ldapserver->haveAuthInfo())
set_lastactivity($ldapserver);
if (isset($_REQUEST['server_id'])) {
$ldapserver = $_SESSION[APPCONFIG]->ldapservers->Instance($_REQUEST['server_id']);
} else {
if (isset($_SESSION[APPCONFIG]->ldapservers) && is_object($_SESSION[APPCONFIG]->ldapservers))
$ldapserver = $_SESSION[APPCONFIG]->ldapservers->Instance(null);
}
/**
* 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() && 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.
*/
run_hook('post_session_init',array());
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,24 +99,27 @@ 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 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);
printf('<script type="text/javascript" src="%sentry_chooser.js"></script>',JSDIR);
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";
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);
echo "\n";
printf('<script type="text/javascript" src="%spla_ajax.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%stree_hide.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%sentry_chooser.js"></script>',JSDIR);
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'));
$empty = false;
}
if (function_exists('cmd_control_pane'))
foreach (cmd_control_pane() as $cmd => $cmddetails) {
$cmds = preg_split('/:/',$cmd);
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[APPCONFIG]->isCommandAvailable($cmds)) {
if ((isset($cmddetails['enable']) && trim($cmddetails['enable'])) || ! isset($cmddetails['enable'])) {
printf('<td>%s</td>',$cmddetails['link']);
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;
}
$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;
$msgnum = 1;
foreach ($data as $msgno => $msgarray) {
$msgindex = $msgno + $nummsg;
foreach (array('title','body','type') as $index)
if (isset($msgarray[$index]))
$this->sysmsg[$msgindex][$index] = $msgarray[$index];
}
foreach (array('title','body','type') as $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])) {