Remove old 1.2 code no longer in use, and same laravel framework items not used
This commit is contained in:
parent
37c7d91744
commit
32aed0f458
@ -28,7 +28,7 @@ Take a look at the [Docker Container](https://github.com/leenooks/phpLDAPadmin/w
|
||||
|
||||
The update to v2 is progressing well - here is a list of work to do and done:
|
||||
|
||||
- [ ] Creating new LDAP entries
|
||||
- [X] Creating new LDAP entries
|
||||
- [ ] Delete existing LDAP entries
|
||||
- [X] Updating existing LDAP Entries
|
||||
- [X] Password attributes
|
||||
|
@ -311,707 +311,4 @@ class Attribute implements \Countable, \ArrayAccess, \Iterator
|
||||
{
|
||||
$this->is_rdn = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of the attribute.
|
||||
*
|
||||
* @param boolean $lower - Return the attribute in normal or lower case (default lower)
|
||||
* @param boolean $real - Return the real attribute name (with ;binary, or just the name)
|
||||
* @return string Attribute name
|
||||
*
|
||||
public function getName($lower=true,$real=false) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs,$this->name);
|
||||
|
||||
if ($real)
|
||||
return $lower ? strtolower($this->name) : $this->name;
|
||||
else
|
||||
return $lower ? strtolower($this->real_attr_name()) : $this->real_attr_name();
|
||||
}
|
||||
|
||||
public function getValues() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->values);
|
||||
|
||||
return $this->values;
|
||||
}
|
||||
|
||||
public function getOldValues() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->oldvalues);
|
||||
|
||||
return $this->oldvalues;
|
||||
}
|
||||
|
||||
public function getValueCount() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs,$this->values);
|
||||
|
||||
return count($this->values);
|
||||
}
|
||||
|
||||
public function getSource() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->source);
|
||||
|
||||
return $this->source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Autovalue is called after the attribute is initialised, and thus the values from the ldap server will be set.
|
||||
*
|
||||
public function autoValue($new_val) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if ($this->values)
|
||||
return;
|
||||
|
||||
$this->values = $new_val;
|
||||
}
|
||||
|
||||
public function initValue($new_val) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if ($this->values || $this->oldvalues) {
|
||||
debug_dump(array('new_val'=>$new_val,'this'=>$this));
|
||||
debug_dump_backtrace('new and/or old values are set',1);
|
||||
}
|
||||
|
||||
$this->values = $new_val;
|
||||
}
|
||||
|
||||
public function clearValue() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->values = array();
|
||||
}
|
||||
|
||||
public function setOldValue($val) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->oldvalues = $val;
|
||||
}
|
||||
|
||||
public function setValue($new_val) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if ($this->values) {
|
||||
if ($this->values == $new_val)
|
||||
return;
|
||||
|
||||
if ($this->oldvalues) {
|
||||
debug_dump($this);
|
||||
debug_dump_backtrace('old values are set',1);
|
||||
} else
|
||||
$this->oldvalues = $this->values;
|
||||
}
|
||||
|
||||
if ($new_val == $this->values)
|
||||
return;
|
||||
|
||||
$this->values = $new_val;
|
||||
$this->justModified();
|
||||
}
|
||||
|
||||
public function addValue($new_val,$i=-1) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if ($i < 0)
|
||||
$i = $this->getValueCount();
|
||||
|
||||
$old_val = $this->getValue($i);
|
||||
if (is_null($old_val) || ($old_val != $new_val))
|
||||
$this->justModified();
|
||||
|
||||
$this->values[$i] = $new_val;
|
||||
}
|
||||
|
||||
public function delValue($i=-1) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if ($i < 0)
|
||||
$this->setValue(array());
|
||||
|
||||
if (! $this->hasBeenModified())
|
||||
$this->oldvalues = $this->values;
|
||||
|
||||
if (isset($this->values[$i])) {
|
||||
unset($this->values[$i]);
|
||||
$this->values = array_values($this->values);
|
||||
$this->justModified();
|
||||
}
|
||||
}
|
||||
|
||||
public function justModified() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->modified = true;
|
||||
}
|
||||
|
||||
public function hasBeenModified() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->modified);
|
||||
|
||||
return $this->modified;
|
||||
}
|
||||
|
||||
public function isForceDelete() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->forcedelete);
|
||||
|
||||
return $this->forcedelete;
|
||||
}
|
||||
|
||||
public function setForceDelete() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->forcedelete = true;
|
||||
$this->oldvalues = $this->values;
|
||||
$this->values = array();
|
||||
$this->justModified();
|
||||
}
|
||||
|
||||
public function isRequired() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if ($this->getMinValueCount() > 0)
|
||||
return true;
|
||||
elseif ($this->ldaptype == 'must')
|
||||
return true;
|
||||
elseif ($this->isRDN())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isMay() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if (($this->ldaptype == 'may') && ! $this->isRequired())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setType($type) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->type = strtolower($type);
|
||||
}
|
||||
|
||||
public function getType() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->type);
|
||||
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function setLDAPtype($type) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->ldaptype = strtolower($type);
|
||||
}
|
||||
|
||||
public function getLDAPtype() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->ldaptype);
|
||||
|
||||
return $this->ldaptype;
|
||||
}
|
||||
|
||||
public function setProperties($properties) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
foreach ($properties as $index => $value) {
|
||||
if ($index == 'maxvalnb') {
|
||||
$this->setMaxValueCount($value);
|
||||
continue;
|
||||
|
||||
} elseif ($index == 'minvalnb') {
|
||||
$this->setMinValueCount($value);
|
||||
continue;
|
||||
|
||||
} elseif ($index == 'maxlength') {
|
||||
$this->setMinValueCount($value);
|
||||
continue;
|
||||
|
||||
} elseif ($index == 'hidden') {
|
||||
$this->visible = $value;
|
||||
continue;
|
||||
|
||||
} elseif (in_array($index,array('cols','rows'))) {
|
||||
# @todo To be implemented
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($this->$index))
|
||||
$this->$index = $value;
|
||||
else {
|
||||
debug_dump($this);
|
||||
debug_dump_backtrace(sprintf('Unknown property (%s) with value (%s) for (%s)',$index,$value,$this->getName()),1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setRequired() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if ($this->getMinValueCount() <= 0)
|
||||
$this->setMinValueCount(1);
|
||||
}
|
||||
|
||||
public function setOptional() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->setMinValueCount(0);
|
||||
}
|
||||
|
||||
public function isReadOnly() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->readonly);
|
||||
|
||||
return $this->readonly;
|
||||
}
|
||||
|
||||
public function setReadOnly() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->readonly = true;
|
||||
}
|
||||
|
||||
public function isMultiple() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isVisible() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
return $this->visible && (! $this->forcehide);
|
||||
}
|
||||
|
||||
public function hide() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->visible = false;
|
||||
}
|
||||
|
||||
public function show() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->visible = true;
|
||||
}
|
||||
|
||||
public function haveFriendlyName() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
return $_SESSION[APPCONFIG]->haveFriendlyName($this);
|
||||
}
|
||||
|
||||
public function getFriendlyName() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->display);
|
||||
|
||||
if ($this->display)
|
||||
return $this->display;
|
||||
else
|
||||
return $_SESSION[APPCONFIG]->getFriendlyName($this);
|
||||
}
|
||||
|
||||
public function setDescription($description) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
public function getDescription() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->description);
|
||||
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setIcon($icon) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->icon = $icon;
|
||||
}
|
||||
|
||||
public function getIcon() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->icon);
|
||||
|
||||
return $this->icon ? sprintf('%s/%s',IMGDIR,$this->icon) : '';
|
||||
}
|
||||
|
||||
public function getHint() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->hint);
|
||||
|
||||
return $this->hint;
|
||||
}
|
||||
|
||||
public function setHint($hint) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->hint = $hint;
|
||||
}
|
||||
|
||||
public function getMaxLength() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->maxlength);
|
||||
|
||||
return $this->maxlength;
|
||||
}
|
||||
|
||||
public function setMaxLength($maxlength) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->maxlength = $maxlength;
|
||||
}
|
||||
|
||||
public function getSize() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->size);
|
||||
|
||||
return $this->size;
|
||||
}
|
||||
|
||||
public function setSize($size) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->size = $size;
|
||||
}
|
||||
|
||||
public function getSpacer() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->spacer);
|
||||
|
||||
return $this->spacer;
|
||||
}
|
||||
|
||||
public function getPage() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->page);
|
||||
|
||||
return $this->page;
|
||||
}
|
||||
public function setPage($page) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->page = $page;
|
||||
}
|
||||
|
||||
public function getOnChange() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->onchange);
|
||||
|
||||
return $this->onchange;
|
||||
}
|
||||
|
||||
public function getHelper() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->helper);
|
||||
|
||||
return $this->helper;
|
||||
}
|
||||
|
||||
public function getHelperValue() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->helpervalue);
|
||||
|
||||
return $this->helpervalue;
|
||||
}
|
||||
|
||||
public function getVerify() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->verify);
|
||||
|
||||
return $this->verify;
|
||||
}
|
||||
|
||||
/**
|
||||
* Capture all the LDAP details we are interested in
|
||||
*
|
||||
* @param sattr Schema Attribute
|
||||
*
|
||||
private function setLDAPdetails($sattr) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# By default, set this as a MAY attribute, later processing should make it a MUST attribute if it is.
|
||||
if (! $this->ldaptype)
|
||||
$this->ldaptype = 'may';
|
||||
|
||||
# Store our Aliases
|
||||
foreach ($sattr->getAliases() as $alias)
|
||||
array_push($this->aliases,strtolower($alias));
|
||||
|
||||
if ($sattr->getIsSingleValue())
|
||||
$this->setMaxValueCount(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of aliases for this Attribute (as defined by the schema)
|
||||
* This list will be lowercase.
|
||||
*
|
||||
public function getAliases() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->aliases);
|
||||
|
||||
return $this->aliases;
|
||||
}
|
||||
|
||||
public function getAutoValue() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->autovalue);
|
||||
|
||||
return $this->autovalue;
|
||||
}
|
||||
|
||||
public function getPostValue() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->postvalue);
|
||||
|
||||
return $this->postvalue;
|
||||
}
|
||||
|
||||
public function setPostValue($postvalue) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->postvalue = $postvalue;
|
||||
}
|
||||
|
||||
public function setXML($values) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# Mostly all the time, this should be an array
|
||||
if (is_array($values))
|
||||
foreach ($values as $index => $value)
|
||||
switch ($index) {
|
||||
# Helpers should be accompanied with a <post> attribute.
|
||||
case 'helper':
|
||||
if (! isset($values['post']) && ! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Missing [post] setting in XML file'),$index),
|
||||
'body'=>_('[helper] needs an accompanying [post] action.'),
|
||||
'type'=>'warn'));
|
||||
|
||||
if (isset($value['value']) && ! is_array($value['value']) && preg_match('/^=php\.(\w+)\((.*)\)$/',$value['value'],$matches)) {
|
||||
$this->helpervalue['function'] = $matches[1];
|
||||
$this->helpervalue['args'] = $matches[2];
|
||||
|
||||
unset ($value['value']);
|
||||
}
|
||||
|
||||
foreach ($value as $i => $detail) {
|
||||
if (! in_array($i,array('default','display','id','value'))) {
|
||||
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$i),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('Unknown XML type setting for helper will be ignored.'),$detail),
|
||||
'type'=>'warn'));
|
||||
|
||||
unset($value[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->$index = $value;
|
||||
|
||||
break;
|
||||
|
||||
case 'hidden': $value ? $this->visible = false : $this->visible = true;
|
||||
break;
|
||||
|
||||
case 'spacer': $value ? $this->$index = true : $this->$index = false;
|
||||
break;
|
||||
|
||||
# Essentially, we ignore type, it is used to select an Attribute type in the Factory. But we'll generated a warning if there is an unknown type.
|
||||
case 'type':
|
||||
if (! in_array($value,array('password','multiselect','select','textarea')) && ! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$index),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('Unknown XML type setting will be ignored.'),$value),
|
||||
'type'=>'warn'));
|
||||
|
||||
break;
|
||||
|
||||
case 'post':
|
||||
if (preg_match('/^=php\.(\w+)\((.*)\)$/',$value,$matches)) {
|
||||
$this->postvalue['function'] = $matches[1];
|
||||
$this->postvalue['args'] = $matches[2];
|
||||
|
||||
} else
|
||||
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$index),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('Unknown XML type setting will be ignored.'),$value),
|
||||
'type'=>'warn'));
|
||||
|
||||
case 'value':
|
||||
if (is_array($value))
|
||||
foreach ($value as $x => $y) {
|
||||
if (! $this->haveMoreValues()) {
|
||||
system_message(array(
|
||||
'title'=>_('Automatically removed attribute values from template'),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('Template defines more values than can be accepted by attribute.'),$this->getName(true)),
|
||||
'type'=>'warn'));
|
||||
|
||||
$this->clearValue();
|
||||
|
||||
break;
|
||||
|
||||
} else
|
||||
$this->addValue($x,$y);
|
||||
}
|
||||
|
||||
else
|
||||
# Check to see if the value is auto generated.
|
||||
if (preg_match('/^=php\.(\w+)\((.*)\)$/',$value,$matches)) {
|
||||
$this->autovalue['function'] = $matches[1];
|
||||
$this->autovalue['args'] = $matches[2];
|
||||
|
||||
# We'll add a hint too
|
||||
if (! $this->hint)
|
||||
$this->hint = _('Automatically determined');
|
||||
|
||||
} else
|
||||
$this->addValue($value);
|
||||
|
||||
break;
|
||||
|
||||
# Queries
|
||||
case 'ordersort':
|
||||
|
||||
# Creation/Editing Templates
|
||||
case 'cols':
|
||||
case 'default':
|
||||
case 'display':
|
||||
case 'hint':
|
||||
case 'icon':
|
||||
case 'maxlength':
|
||||
case 'onchange':
|
||||
case 'order':
|
||||
case 'page':
|
||||
case 'readonly':
|
||||
case 'rows':
|
||||
case 'size':
|
||||
case 'values':
|
||||
case 'verify': $this->$index = $value;
|
||||
break;
|
||||
|
||||
case 'max':
|
||||
if ($this->getMaxValueCount() == -1)
|
||||
$this->setMaxValueCount($value);
|
||||
|
||||
default:
|
||||
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
|
||||
system_message(array(
|
||||
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown XML setting'),$index),
|
||||
'body'=>sprintf('%s <small>[%s]</small>',_('Unknown attribute setting will be ignored.'),serialize($value)),
|
||||
'type'=>'warn'));
|
||||
}
|
||||
|
||||
elseif (is_string($values) && (strlen($values) > 0))
|
||||
$this->values = array($values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the values removed in an attribute.
|
||||
*
|
||||
public function getRemovedValues() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
return array_diff($this->getOldValues(),$this->getValues());
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the values removed in an attribute.
|
||||
*
|
||||
public function getAddedValues() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
return array_diff($this->getValues(),$this->getOldValues());
|
||||
}
|
||||
|
||||
/**
|
||||
* Prunes off anything after the ";" in an attr name. This is useful for
|
||||
* attributes that may have ";binary" appended to their names. With
|
||||
* real_attr_name(), you can more easily fetch these attributes' schema
|
||||
* with their "real" attribute name.
|
||||
*
|
||||
* @param string $attr_name The name of the attribute to examine.
|
||||
* @return string
|
||||
*
|
||||
private function real_attr_name() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->name);
|
||||
|
||||
return preg_replace('/;.*$/U','',$this->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this attribute need supporting JS
|
||||
*
|
||||
public function needJS($type=null) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if (is_null($type)) {
|
||||
foreach (array('focus','blur','validate') as $type)
|
||||
if ($this->needJS($type))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
} elseif ($type == 'focus') {
|
||||
# We dont have any focus javascript routines.
|
||||
return false;
|
||||
|
||||
} elseif ($type == 'blur') {
|
||||
if ($this->onchange || $this->isRequired())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
} elseif ($type == 'validate') {
|
||||
if ($this->isRequired())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
} else
|
||||
debug_dump_backtrace(sprintf('Unknown JS request %s',$type),1);
|
||||
}
|
||||
*/
|
||||
}
|
@ -418,18 +418,6 @@ final class AttributeType extends Base {
|
||||
return $this->ordering;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of "required by" objectClasses, that is the list of objectClasses
|
||||
* which provide must have attribute.
|
||||
*
|
||||
* @return array An array of names of objectclasses (strings) which provide this attribute
|
||||
*/
|
||||
public function getRequiredByObjectClasses() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->required_by_object_classes);
|
||||
|
||||
return $this->required_by_object_classes;
|
||||
}
|
||||
/**
|
||||
* Gets this attribute's substring matching specification
|
||||
*
|
||||
@ -465,29 +453,6 @@ final class AttributeType extends Base {
|
||||
return $this->syntax_oid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets this attribute's raw syntax string (ie: "1.2.3.4{16}").
|
||||
*
|
||||
* @return string The raw syntax string
|
||||
*/
|
||||
public function getSyntaxString() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->syntax);
|
||||
|
||||
return $this->syntax;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets this attribute's type
|
||||
*
|
||||
* @return string The attribute's type.
|
||||
* @deprecated use $this->type;
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets this attribute's usage string as defined by the LDAP server
|
||||
*
|
||||
@ -511,23 +476,6 @@ final class AttributeType extends Base {
|
||||
return $this->used_in_object_classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the specified attribute is an alias for this one (based on this attribute's alias list).
|
||||
*
|
||||
* @param string $attr_name The name of the attribute to check.
|
||||
* @return boolean TRUE if the specified attribute is an alias for this one, or FALSE otherwise.
|
||||
*/
|
||||
public function isAliasFor($attr_name) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
foreach ($this->aliases as $alias_attr_name)
|
||||
if (strcasecmp($alias_attr_name,$attr_name) == 0)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @deprecated use $this->forced_as_may
|
||||
@ -563,9 +511,6 @@ final class AttributeType extends Base {
|
||||
* This function will mark this attribute as a forced MAY attribute
|
||||
*/
|
||||
public function setForceMay() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->forced_as_may = TRUE;
|
||||
}
|
||||
|
||||
@ -589,18 +534,6 @@ final class AttributeType extends Base {
|
||||
$this->sup_attribute = trim($attr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this attribute's type.
|
||||
*
|
||||
* @param string $type The new type.
|
||||
*/
|
||||
public function setType($type) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Request validation array
|
||||
*
|
||||
|
@ -338,16 +338,6 @@ final class Server
|
||||
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'matchingruleuse':
|
||||
if (isset($this->matchingruleuse))
|
||||
return is_null($key) ? $this->matchingruleuse : $this->matchingruleuse->get($key);
|
||||
else
|
||||
$this->matchingruleuse = collect();
|
||||
|
||||
break;
|
||||
*/
|
||||
|
||||
case 'objectclasses':
|
||||
if (isset($this->objectclasses))
|
||||
return $this->objectclasses;
|
||||
@ -381,21 +371,6 @@ final class Server
|
||||
|
||||
$o = new AttributeType($line);
|
||||
$this->attributetypes->put($o->name_lc,$o);
|
||||
|
||||
/*
|
||||
if (isset($syntaxes[$attr->getSyntaxOID()])) {
|
||||
$syntax = $syntaxes[$attr->getSyntaxOID()];
|
||||
$attr->setType($syntax->getDescription());
|
||||
}
|
||||
$this->attributetypes[$attr->getName()] = $attr;
|
||||
*/
|
||||
|
||||
/**
|
||||
* bug 856832: create an entry in the $attrs_oid array too. This
|
||||
* will be a ref to the $attrs entry for maintenance and performance
|
||||
* reasons
|
||||
*/
|
||||
//$attrs_oid[$attr->getOID()] = &$attrs[$attr->getName()];
|
||||
}
|
||||
|
||||
// go back and add data from aliased attributeTypes
|
||||
|
@ -1,568 +0,0 @@
|
||||
<?php
|
||||
/** NOTE **
|
||||
** Make sure that <?php is the FIRST line of this file!
|
||||
** IE: There should NOT be any blank lines or spaces BEFORE <?php
|
||||
**/
|
||||
|
||||
/**
|
||||
* The phpLDAPadmin config file
|
||||
* See: http://phpldapadmin.sourceforge.net/wiki/index.php/Config.php
|
||||
*
|
||||
* This is where you can customise some of the phpLDAPadmin defaults
|
||||
* that are defined in config_default.php.
|
||||
*
|
||||
* To override a default, use the $config->custom variable to do so.
|
||||
* For example, the default for defining the language in config_default.php
|
||||
*
|
||||
* $this->default->appearance['language'] = array(
|
||||
* 'desc'=>'Language',
|
||||
* 'default'=>'auto');
|
||||
*
|
||||
* to override this, use $config->custom->appearance['language'] = 'en_EN';
|
||||
*
|
||||
* This file is also used to configure your LDAP server connections.
|
||||
*
|
||||
* You must specify at least one LDAP server there. You may add
|
||||
* as many as you like. You can also specify your language, and
|
||||
* many other options.
|
||||
*
|
||||
* NOTE: Commented out values in this file prefixed by //, represent the
|
||||
* defaults that have been defined in config_default.php.
|
||||
* Commented out values prefixed by #, dont reflect their default value, you can
|
||||
* check config_default.php if you want to see what the default is.
|
||||
*
|
||||
* DONT change config_default.php, you changes will be lost by the next release
|
||||
* of PLA. Instead change this file - as it will NOT be replaced by a new
|
||||
* version of phpLDAPadmin.
|
||||
*/
|
||||
|
||||
/*********************************************
|
||||
* Useful important configuration overrides *
|
||||
*********************************************/
|
||||
|
||||
/* If you are asked to put PLA in debug mode, this is how you do it: */
|
||||
# $config->custom->debug['level'] = 255;
|
||||
# $config->custom->debug['syslog'] = true;
|
||||
# $config->custom->debug['file'] = '/tmp/pla_debug.log';
|
||||
|
||||
/* phpLDAPadmin can encrypt the content of sensitive cookies if you set this
|
||||
to a big random string. */
|
||||
// $config->custom->session['blowfish'] = null;
|
||||
|
||||
/* If your auth_type is http, you can override your HTTP Authentication Realm. */
|
||||
// $config->custom->session['http_realm'] = sprintf('%s %s',app_name(),'login');
|
||||
|
||||
/* The language setting. If you set this to 'auto', phpLDAPadmin will attempt
|
||||
to determine your language automatically.
|
||||
If PLA doesnt show (all) strings in your language, then you can do some
|
||||
translation at http://translations.launchpad.net/phpldapadmin and download
|
||||
the translation files, replacing those provided with PLA.
|
||||
(We'll pick up the translations before making the next release too!) */
|
||||
// $config->custom->appearance['language'] = 'auto';
|
||||
|
||||
/* The temporary storage directory where we will put jpegPhoto data
|
||||
This directory must be readable and writable by your web server. */
|
||||
// $config->custom->jpeg['tmpdir'] = '/tmp'; // Example for Unix systems
|
||||
# $config->custom->jpeg['tmpdir'] = 'c:\\temp'; // Example for Windows systems
|
||||
|
||||
/* Set this to (bool)true if you do NOT want a random salt used when
|
||||
calling crypt(). Instead, use the first two letters of the user's
|
||||
password. This is insecure but unfortunately needed for some older
|
||||
environments. */
|
||||
# $config->custom->password['no_random_crypt_salt'] = true;
|
||||
|
||||
/* PHP script timeout control. If php runs longer than this many seconds then
|
||||
PHP will stop with an Maximum Execution time error. Increase this value from
|
||||
the default if queries to your LDAP server are slow. The default is either
|
||||
30 seconds or the setting of max_exection_time if this is null. */
|
||||
// $config->custom->session['timelimit'] = 30;
|
||||
|
||||
/* Our local timezone
|
||||
This is to make sure that when we ask the system for the current time, we
|
||||
get the right local time. If this is not set, all time() calculations will
|
||||
assume UTC if you have not set PHP date.timezone. */
|
||||
// $config->custom->appearance['timezone'] = null;
|
||||
# $config->custom->appearance['timezone'] = 'Australia/Melbourne';
|
||||
|
||||
/*********************************************
|
||||
* Commands *
|
||||
*********************************************/
|
||||
|
||||
/* Command availability ; if you don't authorize a command the command
|
||||
links will not be shown and the command action will not be permitted.
|
||||
For better security, set also ACL in your ldap directory. */
|
||||
/*
|
||||
$config->custom->commands['cmd'] = array(
|
||||
'entry_internal_attributes_show' => true,
|
||||
'entry_refresh' => true,
|
||||
'oslinks' => true,
|
||||
'switch_template' => true
|
||||
);
|
||||
|
||||
$config->custom->commands['script'] = array(
|
||||
'add_attr_form' => true,
|
||||
'add_oclass_form' => true,
|
||||
'add_value_form' => true,
|
||||
'collapse' => true,
|
||||
'compare' => true,
|
||||
'compare_form' => true,
|
||||
'copy' => true,
|
||||
'copy_form' => true,
|
||||
'create' => true,
|
||||
'create_confirm' => true,
|
||||
'delete' => true,
|
||||
'delete_attr' => true,
|
||||
'delete_form' => true,
|
||||
'draw_tree_node' => true,
|
||||
'expand' => true,
|
||||
'export' => true,
|
||||
'export_form' => true,
|
||||
'import' => true,
|
||||
'import_form' => true,
|
||||
'login' => true,
|
||||
'logout' => true,
|
||||
'login_form' => true,
|
||||
'mass_delete' => true,
|
||||
'mass_edit' => true,
|
||||
'mass_update' => true,
|
||||
'modify_member_form' => true,
|
||||
'monitor' => true,
|
||||
'purge_cache' => true,
|
||||
'query_engine' => true,
|
||||
'rename' => true,
|
||||
'rename_form' => true,
|
||||
'rdelete' => true,
|
||||
'refresh' => true,
|
||||
'schema' => true,
|
||||
'server_info' => true,
|
||||
'show_cache' => true,
|
||||
'template_engine' => true,
|
||||
'update_confirm' => true,
|
||||
'update' => true
|
||||
);
|
||||
*/
|
||||
|
||||
/*********************************************
|
||||
* Appearance *
|
||||
*********************************************/
|
||||
|
||||
/* If you want to choose the appearance of the tree, specify a class name which
|
||||
inherits from the Tree class. */
|
||||
// $config->custom->appearance['tree'] = 'AJAXTree';
|
||||
# $config->custom->appearance['tree'] = 'HTMLTree';
|
||||
|
||||
/* Just show your custom templates. */
|
||||
// $config->custom->appearance['custom_templates_only'] = false;
|
||||
|
||||
/* Disable the default template. */
|
||||
// $config->custom->appearance['disable_default_template'] = false;
|
||||
|
||||
/* Hide the warnings for invalid objectClasses/attributes in templates. */
|
||||
// $config->custom->appearance['hide_template_warning'] = false;
|
||||
|
||||
/* Set to true if you would like to hide header and footer parts. */
|
||||
// $config->custom->appearance['minimalMode'] = false;
|
||||
|
||||
/* Configure what objects are shown in left hand tree */
|
||||
// $config->custom->appearance['tree_filter'] = '(objectclass=*)';
|
||||
|
||||
/* The height and width of the tree. If these values are not set, then
|
||||
no tree scroll bars are provided. */
|
||||
// $config->custom->appearance['tree_height'] = null;
|
||||
# $config->custom->appearance['tree_height'] = 600;
|
||||
// $config->custom->appearance['tree_width'] = null;
|
||||
# $config->custom->appearance['tree_width'] = 250;
|
||||
|
||||
/* Confirm create and update operations, allowing you to review the changes
|
||||
and optionally skip attributes during the create/update operation. */
|
||||
// $config->custom->confirm['create'] = true;
|
||||
// $config->custom->confirm['update'] = true;
|
||||
|
||||
/* Confirm copy operations, and treat them like create operations. This allows
|
||||
you to edit the attributes (thus changing any that might conflict with
|
||||
uniqueness) before creating the new entry. */
|
||||
// $config->custom->confirm['copy'] = true;
|
||||
|
||||
/*********************************************
|
||||
* User-friendly attribute translation *
|
||||
*********************************************/
|
||||
|
||||
/* Use this array to map attribute names to user friendly names. For example, if
|
||||
you don't want to see "facsimileTelephoneNumber" but rather "Fax". */
|
||||
// $config->custom->appearance['friendly_attrs'] = array();
|
||||
$config->custom->appearance['friendly_attrs'] = array(
|
||||
'facsimileTelephoneNumber' => 'Fax',
|
||||
'gid' => 'Group',
|
||||
'mail' => 'Email',
|
||||
'telephoneNumber' => 'Telephone',
|
||||
'uid' => 'User Name',
|
||||
'userPassword' => 'Password'
|
||||
);
|
||||
|
||||
/*********************************************
|
||||
* Hidden attributes *
|
||||
*********************************************/
|
||||
|
||||
/* You may want to hide certain attributes from being edited. If you want to
|
||||
hide attributes from the user, you should use your LDAP servers ACLs.
|
||||
NOTE: The user must be able to read the hide_attrs_exempt entry to be
|
||||
excluded. */
|
||||
// $config->custom->appearance['hide_attrs'] = array();
|
||||
# $config->custom->appearance['hide_attrs'] = array('objectClass');
|
||||
|
||||
/* Members of this list will be exempt from the hidden attributes. */
|
||||
// $config->custom->appearance['hide_attrs_exempt'] = null;
|
||||
# $config->custom->appearance['hide_attrs_exempt'] = 'cn=PLA UnHide,ou=Groups,c=AU';
|
||||
|
||||
/*********************************************
|
||||
* Read-only attributes *
|
||||
*********************************************/
|
||||
|
||||
/* You may want to phpLDAPadmin to display certain attributes as read only,
|
||||
meaning that users will not be presented a form for modifying those
|
||||
attributes, and they will not be allowed to be modified on the "back-end"
|
||||
either. You may configure this list here:
|
||||
NOTE: The user must be able to read the readonly_attrs_exempt entry to be
|
||||
excluded. */
|
||||
// $config->custom->appearance['readonly_attrs'] = array();
|
||||
|
||||
/* Members of this list will be exempt from the readonly attributes. */
|
||||
// $config->custom->appearance['readonly_attrs_exempt'] = null;
|
||||
# $config->custom->appearance['readonly_attrs_exempt'] = 'cn=PLA ReadWrite,ou=Groups,c=AU';
|
||||
|
||||
/*********************************************
|
||||
* Group attributes *
|
||||
*********************************************/
|
||||
|
||||
/* Add "modify group members" link to the attribute. */
|
||||
// $config->custom->modify_member['groupattr'] = array('member','uniqueMember','memberUid','sudoUser');
|
||||
|
||||
/* Configure filter for member search. This only applies to "modify group members" feature */
|
||||
// $config->custom->modify_member['filter'] = '(objectclass=Person)';
|
||||
|
||||
/* Attribute that is added to the group member attribute. */
|
||||
// $config->custom->modify_member['attr'] = 'dn';
|
||||
|
||||
|
||||
/* For Posix attributes */
|
||||
// $config->custom->modify_member['posixattr'] = 'uid';
|
||||
// $config->custom->modify_member['posixfilter'] = '(uid=*)';
|
||||
// $config->custom->modify_member['posixgroupattr'] = 'memberUid';
|
||||
|
||||
/*********************************************
|
||||
* Define your LDAP servers in this section *
|
||||
*********************************************/
|
||||
|
||||
$servers = new Datastore();
|
||||
|
||||
/* $servers->NewServer('ldap_pla') must be called before each new LDAP server
|
||||
declaration. */
|
||||
$servers->newServer('ldap_pla');
|
||||
|
||||
/* A convenient name that will appear in the tree viewer and throughout
|
||||
phpLDAPadmin to identify this LDAP server to users. */
|
||||
$servers->setValue('server','name','My LDAP Server');
|
||||
|
||||
/* Examples:
|
||||
'ldap.example.com',
|
||||
'ldaps://ldap.example.com/',
|
||||
'ldapi://%2fusr%local%2fvar%2frun%2fldapi'
|
||||
(Unix socket at /usr/local/var/run/ldap) */
|
||||
// $servers->setValue('server','host','127.0.0.1');
|
||||
|
||||
/* The port your LDAP server listens on (no quotes). 389 is standard. */
|
||||
// $servers->setValue('server','port',389);
|
||||
|
||||
/* Array of base DNs of your LDAP server. Leave this blank to have phpLDAPadmin
|
||||
auto-detect it for you. */
|
||||
// $servers->setValue('server','base',array(''));
|
||||
|
||||
/* Five options for auth_type:
|
||||
1. 'cookie': you will login via a web form, and a client-side cookie will
|
||||
store your login dn and password.
|
||||
2. 'session': same as cookie but your login dn and password are stored on the
|
||||
web server in a persistent session variable.
|
||||
3. 'http': same as session but your login dn and password are retrieved via
|
||||
HTTP authentication.
|
||||
4. 'config': specify your login dn and password here in this config file. No
|
||||
login will be required to use phpLDAPadmin for this server.
|
||||
5. 'sasl': login will be taken from the webserver's kerberos authentication.
|
||||
Currently only GSSAPI has been tested (using mod_auth_kerb).
|
||||
|
||||
Choose wisely to protect your authentication information appropriately for
|
||||
your situation. If you choose 'cookie', your cookie contents will be
|
||||
encrypted using blowfish and the secret your specify above as
|
||||
session['blowfish']. */
|
||||
// $servers->setValue('login','auth_type','session');
|
||||
|
||||
/* The DN of the user for phpLDAPadmin to bind with. For anonymous binds or
|
||||
'cookie','session' or 'sasl' auth_types, LEAVE THE LOGIN_DN AND LOGIN_PASS
|
||||
BLANK. If you specify a login_attr in conjunction with a cookie or session
|
||||
auth_type, then you can also specify the bind_id/bind_pass here for searching
|
||||
the directory for users (ie, if your LDAP server does not allow anonymous
|
||||
binds. */
|
||||
// $servers->setValue('login','bind_id','');
|
||||
# $servers->setValue('login','bind_id','cn=Manager,dc=example,dc=com');
|
||||
|
||||
/* Your LDAP password. If you specified an empty bind_id above, this MUST also
|
||||
be blank. */
|
||||
// $servers->setValue('login','bind_pass','');
|
||||
# $servers->setValue('login','bind_pass','secret');
|
||||
|
||||
/* Use TLS (Transport Layer Security) to connect to the LDAP server. */
|
||||
// $servers->setValue('server','tls',false);
|
||||
|
||||
/************************************
|
||||
* SASL Authentication *
|
||||
************************************/
|
||||
|
||||
/* Enable SASL authentication LDAP SASL authentication requires PHP 5.x
|
||||
configured with --with-ldap-sasl=DIR. If this option is disabled (ie, set to
|
||||
false), then all other sasl options are ignored. */
|
||||
# $servers->setValue('login','auth_type','sasl');
|
||||
|
||||
/* SASL GSSAPI auth mechanism (requires auth_type of sasl) */
|
||||
// $servers->setValue('sasl','mech','GSSAPI');
|
||||
|
||||
/* SASL PLAIN support... this mech converts simple binds to SASL
|
||||
PLAIN binds using any auth_type (or other bind_id/pass) as credentials.
|
||||
NOTE: auth_type must be simple auth compatible (ie not sasl) */
|
||||
# $servers->setValue('sasl','mech','PLAIN');
|
||||
|
||||
/* SASL authentication realm name */
|
||||
// $servers->setValue('sasl','realm','');
|
||||
# $servers->setValue('sasl','realm','EXAMPLE.COM');
|
||||
|
||||
/* SASL authorization ID name
|
||||
If this option is undefined, authorization id will be computed from bind DN,
|
||||
using authz_id_regex and authz_id_replacement. */
|
||||
// $servers->setValue('sasl','authz_id', null);
|
||||
|
||||
/* SASL authorization id regex and replacement
|
||||
When authz_id property is not set (default), phpLDAPAdmin will try to
|
||||
figure out authorization id by itself from bind distinguished name (DN).
|
||||
|
||||
This procedure is done by calling preg_replace() php function in the
|
||||
following way:
|
||||
|
||||
$authz_id = preg_replace($sasl_authz_id_regex,$sasl_authz_id_replacement,
|
||||
$bind_dn);
|
||||
|
||||
For info about pcre regexes, see:
|
||||
- pcre(3), perlre(3)
|
||||
- http://www.php.net/preg_replace */
|
||||
// $servers->setValue('sasl','authz_id_regex',null);
|
||||
// $servers->setValue('sasl','authz_id_replacement',null);
|
||||
# $servers->setValue('sasl','authz_id_regex','/^uid=([^,]+)(.+)/i');
|
||||
# $servers->setValue('sasl','authz_id_replacement','$1');
|
||||
|
||||
/* SASL auth security props.
|
||||
See http://beepcore-tcl.sourceforge.net/tclsasl.html#anchor5 for explanation. */
|
||||
// $servers->setValue('sasl','props',null);
|
||||
|
||||
/* Default password hashing algorithm. One of md5, ssha, sha, md5crpyt, smd5,
|
||||
blowfish, crypt or leave blank for now default algorithm. */
|
||||
// $servers->setValue('appearance','pla_password_hash','md5');
|
||||
|
||||
/* If you specified 'cookie' or 'session' as the auth_type above, you can
|
||||
optionally specify here an attribute to use when logging in. If you enter
|
||||
'uid' and login as 'dsmith', phpLDAPadmin will search for (uid=dsmith)
|
||||
and log in as that user.
|
||||
Leave blank or specify 'dn' to use full DN for logging in. Note also that if
|
||||
your LDAP server requires you to login to perform searches, you can enter the
|
||||
DN to use when searching in 'bind_id' and 'bind_pass' above. */
|
||||
// $servers->setValue('login','attr','dn');
|
||||
|
||||
/* Base DNs to used for logins. If this value is not set, then the LDAP server
|
||||
Base DNs are used. */
|
||||
// $servers->setValue('login','base',array());
|
||||
|
||||
/* If login_attr was set to 'dn', it is possible to specify a template string to
|
||||
build the DN from. Use '%s' where user input should be inserted. A user may
|
||||
still enter the complete DN. In this case the template will not be used. */
|
||||
// $servers->setValue('login','bind_dn_template',null);
|
||||
# $servers->setValue('login','bind_dn_template','cn=%s,ou=people,dc=example,dc=com');
|
||||
|
||||
/* If you specified something different from 'dn', for example 'uid', as the
|
||||
login_attr above, you can optionally specify here to fall back to
|
||||
authentication with dn.
|
||||
This is useful, when users should be able to log in with their uid, but
|
||||
the ldap administrator wants to log in with his root-dn, that does not
|
||||
necessarily have the uid attribute.
|
||||
When using this feature, login_class is ignored. */
|
||||
// $servers->setValue('login','fallback_dn',false);
|
||||
|
||||
/* Specify true If you want phpLDAPadmin to not display or permit any
|
||||
modification to the LDAP server. */
|
||||
// $servers->setValue('server','read_only',false);
|
||||
|
||||
/* Specify false if you do not want phpLDAPadmin to draw the 'Create new' links
|
||||
in the tree viewer. */
|
||||
// $servers->setValue('appearance','show_create',true);
|
||||
|
||||
/* Set to true if you would like to initially open the first level of each tree. */
|
||||
// $servers->setValue('appearance','open_tree',false);
|
||||
|
||||
/* Set to true to display authorization ID in place of login dn (PHP 7.2+) */
|
||||
// $servers->setValue('appearance','show_authz',false);
|
||||
|
||||
/* This feature allows phpLDAPadmin to automatically determine the next
|
||||
available uidNumber for a new entry. */
|
||||
// $servers->setValue('auto_number','enable',true);
|
||||
|
||||
/* The mechanism to use when finding the next available uidNumber. Two possible
|
||||
values: 'uidpool' or 'search'.
|
||||
The 'uidpool' mechanism uses an existing uidPool entry in your LDAP server to
|
||||
blindly lookup the next available uidNumber. The 'search' mechanism searches
|
||||
for entries with a uidNumber value and finds the first available uidNumber
|
||||
(slower). */
|
||||
// $servers->setValue('auto_number','mechanism','search');
|
||||
|
||||
/* The DN of the search base when the 'search' mechanism is used above. */
|
||||
# $servers->setValue('auto_number','search_base','ou=People,dc=example,dc=com');
|
||||
|
||||
/* The minimum number to use when searching for the next available number
|
||||
(only when 'search' is used for auto_number. */
|
||||
// $servers->setValue('auto_number','min',array('uidNumber'=>1000,'gidNumber'=>500));
|
||||
|
||||
/* If you set this, then phpldapadmin will bind to LDAP with this user ID when
|
||||
searching for the uidnumber. The idea is, this user id would have full
|
||||
(readonly) access to uidnumber in your ldap directory (the logged in user
|
||||
may not), so that you can be guaranteed to get a unique uidnumber for your
|
||||
directory. */
|
||||
// $servers->setValue('auto_number','dn',null);
|
||||
|
||||
/* The password for the dn above. */
|
||||
// $servers->setValue('auto_number','pass',null);
|
||||
|
||||
/* Enable anonymous bind login. */
|
||||
// $servers->setValue('login','anon_bind',true);
|
||||
|
||||
/* Use customized page with prefix when available. */
|
||||
# $servers->setValue('custom','pages_prefix','custom_');
|
||||
|
||||
/* If you set this, then only these DNs are allowed to log in. This array can
|
||||
contain individual users, groups or ldap search filter(s). Keep in mind that
|
||||
the user has not authenticated yet, so this will be an anonymous search to
|
||||
the LDAP server, so make your ACLs allow these searches to return results! */
|
||||
# $servers->setValue('login','allowed_dns',array(
|
||||
# 'uid=stran,ou=People,dc=example,dc=com',
|
||||
# '(&(gidNumber=811)(objectClass=groupOfNames))',
|
||||
# '(|(uidNumber=200)(uidNumber=201))',
|
||||
# 'cn=callcenter,ou=Group,dc=example,dc=com'));
|
||||
|
||||
/* Set this if you dont want this LDAP server to show in the tree */
|
||||
// $servers->setValue('server','visible',true);
|
||||
|
||||
/* Set this if you want to hide the base DNs that dont exist instead of
|
||||
displaying the message "The base entry doesnt exist, create it?"
|
||||
// $servers->setValue('server','hide_noaccess_base',false);
|
||||
# $servers->setValue('server','hide_noaccess_base',true);
|
||||
|
||||
/* This is the time out value in minutes for the server. After as many minutes
|
||||
of inactivity you will be automatically logged out. If not set, the default
|
||||
value will be ( session_cache_expire()-1 ) */
|
||||
# $servers->setValue('login','timeout',30);
|
||||
|
||||
/* Set this if you want phpldapadmin to perform rename operation on entry which
|
||||
has children. Certain servers are known to allow it, certain are not. */
|
||||
// $servers->setValue('server','branch_rename',false);
|
||||
|
||||
/* If you set this, then phpldapadmin will show these attributes as
|
||||
internal attributes, even if they are not defined in your schema. */
|
||||
// $servers->setValue('server','custom_sys_attrs',array(''));
|
||||
# $servers->setValue('server','custom_sys_attrs',array('passwordExpirationTime','passwordAllowChangeTime'));
|
||||
|
||||
/* If you set this, then phpldapadmin will show these attributes on
|
||||
objects, even if they are not defined in your schema. */
|
||||
// $servers->setValue('server','custom_attrs',array(''));
|
||||
# $servers->setValue('server','custom_attrs',array('nsRoleDN','nsRole','nsAccountLock'));
|
||||
|
||||
/*********************************************
|
||||
* Unique attributes *
|
||||
*********************************************/
|
||||
|
||||
/* You may want phpLDAPadmin to enforce some attributes to have unique values
|
||||
(ie: not belong to other entries in your tree. This (together with
|
||||
'unique','dn' and 'unique','pass' option will not let updates to
|
||||
occur with other attributes have the same value. */
|
||||
# $servers->setValue('unique','attrs',array('mail','uid','uidNumber'));
|
||||
|
||||
/* If you set this, then phpldapadmin will bind to LDAP with this user ID when
|
||||
searching for attribute uniqueness. The idea is, this user id would have full
|
||||
(readonly) access to your ldap directory (the logged in user may not), so
|
||||
that you can be guaranteed to get a unique uidnumber for your directory. */
|
||||
// $servers->setValue('unique','dn',null);
|
||||
|
||||
/* The password for the dn above. */
|
||||
// $servers->setValue('unique','pass',null);
|
||||
|
||||
/**************************************************************************
|
||||
* If you want to configure additional LDAP servers, do so below. *
|
||||
* Remove the commented lines and use this section as a template for all *
|
||||
* your other LDAP servers. *
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
$servers->newServer('ldap_pla');
|
||||
$servers->setValue('server','name','LDAP Server');
|
||||
$servers->setValue('server','host','127.0.0.1');
|
||||
$servers->setValue('server','port',389);
|
||||
$servers->setValue('server','base',array(''));
|
||||
$servers->setValue('login','auth_type','cookie');
|
||||
$servers->setValue('login','bind_id','');
|
||||
$servers->setValue('login','bind_pass','');
|
||||
$servers->setValue('server','tls',false);
|
||||
|
||||
# SASL auth
|
||||
$servers->setValue('login','auth_type','sasl');
|
||||
$servers->setValue('sasl','mech','GSSAPI');
|
||||
$servers->setValue('sasl','realm','EXAMPLE.COM');
|
||||
$servers->setValue('sasl','authz_id',null);
|
||||
$servers->setValue('sasl','authz_id_regex','/^uid=([^,]+)(.+)/i');
|
||||
$servers->setValue('sasl','authz_id_replacement','$1');
|
||||
$servers->setValue('sasl','props',null);
|
||||
|
||||
$servers->setValue('appearance','pla_password_hash','md5');
|
||||
$servers->setValue('login','attr','dn');
|
||||
$servers->setValue('login','fallback_dn',false);
|
||||
$servers->setValue('login','class',null);
|
||||
$servers->setValue('server','read_only',false);
|
||||
$servers->setValue('appearance','show_create',true);
|
||||
|
||||
$servers->setValue('auto_number','enable',true);
|
||||
$servers->setValue('auto_number','mechanism','search');
|
||||
$servers->setValue('auto_number','search_base',null);
|
||||
$servers->setValue('auto_number','min',array('uidNumber'=>1000,'gidNumber'=>500));
|
||||
$servers->setValue('auto_number','dn',null);
|
||||
$servers->setValue('auto_number','pass',null);
|
||||
|
||||
$servers->setValue('login','anon_bind',true);
|
||||
$servers->setValue('custom','pages_prefix','custom_');
|
||||
$servers->setValue('unique','attrs',array('mail','uid','uidNumber'));
|
||||
$servers->setValue('unique','dn',null);
|
||||
$servers->setValue('unique','pass',null);
|
||||
|
||||
$servers->setValue('server','visible',true);
|
||||
$servers->setValue('login','timeout',30);
|
||||
$servers->setValue('server','branch_rename',false);
|
||||
$servers->setValue('server','custom_sys_attrs',array('passwordExpirationTime','passwordAllowChangeTime'));
|
||||
$servers->setValue('server','custom_attrs',array('nsRoleDN','nsRole','nsAccountLock'));
|
||||
$servers->setValue('server','force_may',array('uidNumber','gidNumber','sambaSID'));
|
||||
*/
|
||||
|
||||
|
||||
/***********************************************************************************
|
||||
* If you want to configure Google reCAPTCHA on autentication form, do so below. *
|
||||
* Remove the commented lines and use this section as a template for all *
|
||||
* reCAPTCHA v2 Generate on https://www.google.com/recaptcha/ *
|
||||
* *
|
||||
* IMPORTANT: Select reCAPTCHA v2 on Type of reCAPTCHA *
|
||||
***********************************************************************************/
|
||||
|
||||
|
||||
$config->custom->session['reCAPTCHA-enable'] = false;
|
||||
$config->custom->session['reCAPTCHA-key-site'] = '<put-here-key-site>';
|
||||
$config->custom->session['reCAPTCHA-key-server'] = '<put-here-key-server>';
|
||||
|
||||
?>
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use App\User;
|
||||
use Faker\Generator as Faker;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This directory should contain each of the model factory definitions for
|
||||
| your application. Factories provide a convenient way to generate new
|
||||
| model instances for testing / seeding your application's database.
|
||||
|
|
||||
*/
|
||||
|
||||
/*
|
||||
$factory->define(User::class, function (Faker $faker) {
|
||||
return [
|
||||
'name' => $faker->name,
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
'email_verified_at' => now(),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
});
|
||||
*/
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// $this->call(UserSeeder::class);
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This script provides a convienent method to call the proper common.php
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
if (! defined('LIBDIR'))
|
||||
define('LIBDIR',sprintf('%s/',realpath('../lib/')));
|
||||
require_once LIBDIR.'common.php';
|
||||
?>
|
@ -1,188 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Compares two DN entries side by side.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DNs we are working with
|
||||
$request = array();
|
||||
$request['dnSRC'] = get_request('dn_src');
|
||||
$request['dnDST'] = get_request('dn_dst');
|
||||
|
||||
$ldap = array();
|
||||
$ldap['SRC'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_src'));
|
||||
$ldap['DST'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_dst'));
|
||||
|
||||
if (! $ldap['SRC']->dnExists($request['dnSRC']))
|
||||
error(sprintf('%s (%s)',_('No such entry.'),pretty_print_dn($request['dnSRC'])),'error','index.php');
|
||||
|
||||
if (! $ldap['DST']->dnExists($request['dnDST']))
|
||||
error(sprintf('%s (%s)',_('No such entry.'),pretty_print_dn($request['dnDST'])),'error','index.php');
|
||||
|
||||
$request['pageSRC'] = new PageRender($ldap['SRC']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['pageSRC']->setDN($request['dnSRC']);
|
||||
$request['pageSRC']->accept();
|
||||
$request['templateSRC'] = $request['pageSRC']->getTemplate();
|
||||
|
||||
$request['pageDST'] = new PageRender($ldap['DST']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['pageDST']->setDN($request['dnDST']);
|
||||
$request['pageDST']->accept();
|
||||
$request['templateDST'] = $request['pageDST']->getTemplate();
|
||||
|
||||
# Get a list of all attributes.
|
||||
$attrs_all = array_unique(array_merge($request['templateSRC']->getAttributeNames(),$request['templateDST']->getAttributeNames()));
|
||||
|
||||
$request['pageSRC']->drawTitle(_('Comparing the following DNs'));
|
||||
|
||||
echo '<br/>';
|
||||
|
||||
echo '<table class="entry" width="100%" border="0">';
|
||||
echo '<tr class="heading">';
|
||||
|
||||
$href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',
|
||||
$ldap['SRC']->getIndex(),rawurlencode($request['dnSRC']));
|
||||
printf('<td colspan="2" style="width: 40%%;">%s: <b>%s</b><br />%s: <b><a href="%s">%s</a></b></td>',
|
||||
_('Server'),$ldap['SRC']->getName(),_('Distinguished Name'),
|
||||
htmlspecialchars($href),$request['dnSRC']);
|
||||
|
||||
$href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',
|
||||
$ldap['DST']->getIndex(),rawurlencode($request['dnDST']));
|
||||
printf('<td colspan="2" style="width: 40%%;">%s: <b>%s</b><br />%s: <b><a href="%s">%s</a></b></td>',
|
||||
_('Server'),$ldap['DST']->getName(),_('Distinguished Name'),
|
||||
htmlspecialchars($href),$request['dnDST']);
|
||||
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td colspan="4" style="text-align: right;">';
|
||||
echo '<form action="cmd.php?cmd=compare" method="post">';
|
||||
echo '<div>';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="server_id_src" value="%s" />',$ldap['DST']->getIndex());
|
||||
printf('<input type="hidden" name="server_id_dst" value="%s" />',$ldap['SRC']->getIndex());
|
||||
printf('<input type="hidden" name="dn_src" value="%s" />',htmlspecialchars($request['dnDST']));
|
||||
printf('<input type="hidden" name="dn_dst" value="%s" />',htmlspecialchars($request['dnSRC']));
|
||||
printf('<input type="submit" value="%s" />',_('Switch Entry'));
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
if (! is_array($attrs_all) || ! count($attrs_all)) {
|
||||
printf('<tr><td colspan="4">(%s)</td></tr>',_('This entry has no attributes'));
|
||||
print '</table>';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sort($attrs_all);
|
||||
|
||||
# Work through each of the attributes.
|
||||
foreach ($attrs_all as $attr) {
|
||||
# Has the config.php specified that this attribute is to be hidden or shown?
|
||||
if ($ldap['SRC']->isAttrHidden($attr) || $ldap['DST']->isAttrHidden($attr))
|
||||
continue;
|
||||
|
||||
$attributeSRC = $request['templateSRC']->getAttribute($attr);
|
||||
$attributeDST = $request['templateDST']->getAttribute($attr);
|
||||
|
||||
# Get the values and see if they are the same.
|
||||
if ($attributeSRC && $attributeDST && ($attributeSRC->getValues() == $attributeDST->getValues()))
|
||||
echo '<tr>';
|
||||
else
|
||||
echo '<tr>';
|
||||
|
||||
foreach (array('src','dst') as $side) {
|
||||
# If we are on the source side, show the attribute name.
|
||||
switch ($side) {
|
||||
case 'src':
|
||||
if ($attributeSRC) {
|
||||
echo '<td class="title">';
|
||||
$request['pageSRC']->draw('Name',$attributeSRC);
|
||||
echo '</td>';
|
||||
|
||||
if ($request['pageSRC']->getServerID() == $request['pageDST']->getServerID())
|
||||
echo '<td class="title"> </td>';
|
||||
|
||||
else {
|
||||
echo '<td class="note" style="text-align: right;">';
|
||||
$request['pageSRC']->draw('Notes',$attributeSRC);
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
} else {
|
||||
echo '<td colspan="2"> </td>';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'dst':
|
||||
if ($attributeDST) {
|
||||
if ($attributeSRC && ($request['pageSRC']->getServerID() == $request['pageDST']->getServerID()))
|
||||
echo '<td class="title"> </td>';
|
||||
|
||||
else {
|
||||
echo '<td class="title" >';
|
||||
$request['pageDST']->draw('Name',$attributeDST);
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
echo '<td class="note" style="text-align: right;">';
|
||||
$request['pageDST']->draw('Notes',$attributeDST);
|
||||
echo '</td>';
|
||||
|
||||
} else {
|
||||
echo '<td colspan="2"> </td>';
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
echo "\n\n";
|
||||
|
||||
# Get the values and see if they are the same.
|
||||
if ($attributeSRC && $attributeDST && ($attributeSRC->getValues() == $attributeDST->getValues()))
|
||||
echo '<tr style="background-color: #F0F0F0;">';
|
||||
else
|
||||
echo '<tr>';
|
||||
|
||||
foreach (array('src','dst') as $side) {
|
||||
echo '<td class="value" colspan="2"><table border="0">';
|
||||
echo '<tr><td>';
|
||||
|
||||
switch ($side) {
|
||||
case 'src':
|
||||
|
||||
if ($attributeSRC && count($attributeSRC->getValues()))
|
||||
$request['pageSRC']->draw('CurrentValues',$attributeSRC);
|
||||
else
|
||||
echo ' ';
|
||||
|
||||
break;
|
||||
|
||||
case 'dst':
|
||||
if ($attributeDST && count($attributeDST->getValues()))
|
||||
$request['pageDST']->draw('CurrentValues',$attributeDST);
|
||||
else
|
||||
echo ' ';
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
echo '</td></tr>';
|
||||
echo '</table></td>';
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
?>
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Compares two DN entries side by side.
|
||||
* This is the entry form to determine which DN to compare this DN with.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DN we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET');
|
||||
|
||||
# Check if the entry exists.
|
||||
if (! $request['dn'] || ! $app['server']->dnExists($request['dn']))
|
||||
error(sprintf(_('The entry (%s) does not exist.'),$request['dn']),'error','index.php');
|
||||
|
||||
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->setDN($request['dn']);
|
||||
$request['page']->accept();
|
||||
|
||||
# Render the form
|
||||
$request['page']->drawTitle(sprintf('%s <b>%s</b>',_('Compare another DN with'),get_rdn($request['dn'])));
|
||||
$request['page']->drawSubTitle();
|
||||
|
||||
printf('<script type="text/javascript" src="%sdnChooserPopup.js"></script>',JSDIR);
|
||||
echo '<div style="text-align: center;">';
|
||||
printf('%s <b>%s</b> %s<br />',_('Compare'),get_rdn($request['dn']),_('with '));
|
||||
echo '</div>';
|
||||
|
||||
echo '<form action="cmd.php" method="post" id="compare_form">';
|
||||
echo '<div>';
|
||||
echo '<input type="hidden" name="cmd" value="compare" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="server_id_src" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn_src" value="%s" />',htmlspecialchars($request['dn']));
|
||||
echo '</div>';
|
||||
echo "\n";
|
||||
|
||||
echo '<table border="0" style="border-spacing: 10px; margin-left: auto; margin-right: auto;">';
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym>:</td>',
|
||||
_('Compare this DN with another'),_('Destination DN'));
|
||||
echo '<td>';
|
||||
echo '<input type="text" name="dn_dst" size="45" value="" />';
|
||||
draw_chooser_link('compare_form','dn_dst','true','');
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
printf('<tr><td>%s:</td><td>%s</td></tr>',_('Destination Server'),server_select_list($app['server']->getIndex(),true,'server_id_dst'));
|
||||
echo "\n";
|
||||
|
||||
printf('<tr><td colspan="2" style="text-align: center;"><input type="submit" value="%s" /></td></tr>',_('Compare'));
|
||||
echo "\n";
|
||||
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
?>
|
209
htdocs/copy.php
209
htdocs/copy.php
@ -1,209 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copies a given object to create a new one.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DNs we are working with
|
||||
$request = array();
|
||||
$request['dnSRC'] = get_request('dn_src');
|
||||
$request['dnDST'] = get_request('dn_dst');
|
||||
|
||||
$ldap = array();
|
||||
$ldap['SRC'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_src'));
|
||||
$ldap['DST'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_dst'));
|
||||
|
||||
# Error checking
|
||||
if (! trim($request['dnDST']))
|
||||
error(_('You left the destination DN blank.'),'error','index.php');
|
||||
|
||||
if ($ldap['DST']->isReadOnly())
|
||||
error(_('Destination server is currently READ-ONLY.'),'error','index.php');
|
||||
|
||||
if ($ldap['DST']->dnExists($request['dnDST']))
|
||||
error(sprintf(_('The destination entry (%s) already exists.'),pretty_print_dn($request['dnDST'])),'error','index.php');
|
||||
|
||||
if (! $ldap['DST']->dnExists($ldap['DST']->getContainer($request['dnDST'])))
|
||||
error(sprintf(_('The destination container (%s) does not exist.'),
|
||||
pretty_print_dn($ldap['DST']->getContainer($request['dnDST']))),'error','index.php');
|
||||
|
||||
if (pla_compare_dns($request['dnSRC'],$request['dnDST']) == 0 && $ldap['SRC']->getIndex() == $ldap['DST']->getIndex())
|
||||
error(_('The source and destination DN are the same.'),'error','index.php');
|
||||
|
||||
$request['recursive'] = (get_request('recursive') == 'on') ? true : false;
|
||||
$request['remove'] = (get_request('remove') == 'yes') ? true : false;
|
||||
|
||||
if ($request['recursive']) {
|
||||
$filter = get_request('filter','POST',false,'(objectClass=*)');
|
||||
|
||||
# Build a tree similar to that of the tree browser to give to r_copy_dn
|
||||
$ldap['tree'] = array();
|
||||
printf('<h3 class="title">%s%s</h3>',_('Copying '),$request['dnSRC']);
|
||||
printf('<h3 class="subtitle">%s</h3>',_('Recursive copy progress'));
|
||||
print '<br /><br />';
|
||||
|
||||
print '<small>';
|
||||
printf ('%s...',_('Building snapshot of tree to copy'));
|
||||
|
||||
$ldap['tree'] = build_tree($ldap['SRC'],$request['dnSRC'],array(),$filter);
|
||||
printf('<span style="color:green">%s</span><br />',_('Success'));
|
||||
|
||||
# Prevent script from bailing early on a long delete
|
||||
@set_time_limit(0);
|
||||
|
||||
$copy_result = r_copy_dn($ldap['SRC'],$ldap['DST'],$ldap['tree'],$request['dnSRC'],$request['dnDST'],$request['remove']);
|
||||
$copy_message = $copy_result;
|
||||
print '</small>';
|
||||
|
||||
} else {
|
||||
if ($_SESSION[APPCONFIG]->getValue('confirm','copy') && !$request['remove']) {
|
||||
$request['pageSRC'] = new TemplateRender($ldap['SRC']->getIndex(),get_request('template','REQUEST',false,null));
|
||||
$request['pageSRC']->setDN($request['dnSRC']);
|
||||
$request['pageSRC']->accept(true);
|
||||
|
||||
$request['pageDST'] = new TemplateRender($ldap['DST']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['pageDST']->setContainer($app['server']->getContainer($request['dnDST']));
|
||||
$request['pageDST']->accept(true);
|
||||
|
||||
$request['templateSRC'] = $request['pageSRC']->getTemplate();
|
||||
$request['templateDST'] = $request['pageDST']->getTemplate();
|
||||
|
||||
$request['templateDST']->copy($request['templateSRC'],get_rdn($request['dnDST']),true);
|
||||
|
||||
# Set all attributes with a values as shown, and remove the add value options
|
||||
foreach ($request['templateDST']->getAttributes(true) as $sattribute)
|
||||
if ($sattribute->getValues() && ! $sattribute->isInternal()) {
|
||||
$sattribute->show();
|
||||
$sattribute->setMaxValueCount(count($sattribute->getValues()));
|
||||
}
|
||||
|
||||
$request['pageDST']->accept();
|
||||
|
||||
return;
|
||||
|
||||
} else {
|
||||
$copy_result = copy_dn($ldap['SRC'],$ldap['DST'],$request['dnSRC'],$request['dnDST'],$request['remove']);
|
||||
|
||||
if ($copy_result)
|
||||
$copy_message = sprintf('%s %s: <b>%s</b> %s',
|
||||
$request['remove'] ? _('Move successful') : _('Copy successful'),
|
||||
_('DN'),$request['dnDST'],_('has been created.'));
|
||||
else
|
||||
$copy_message = sprintf('%s %s: <b>%s</b> %s',
|
||||
$request['remove'] ? _('Move NOT successful') : _('Copy NOT successful'),
|
||||
_('DN'),$request['dnDST'],_('has NOT been created.'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($copy_result) {
|
||||
$redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s&refresh=SID_%s_nodes&noheader=1',
|
||||
$ldap['DST']->getIndex(),rawurlencode($request['dnDST']),$ldap['DST']->getIndex());
|
||||
|
||||
system_message(array(
|
||||
'title'=>_('Copy Entry'),
|
||||
'body'=>$copy_message,
|
||||
'type'=>'info'),
|
||||
$redirect_url);
|
||||
}
|
||||
|
||||
function r_copy_dn($serverSRC,$serverDST,$snapshottree,$dnSRC,$dnDST,$remove) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$copy_message = array();
|
||||
|
||||
$children = isset($snapshottree[$dnSRC]) ? $snapshottree[$dnSRC] : null;
|
||||
|
||||
# If we have children, then we need to copy, then delete for a move
|
||||
if (is_array($children) && count($children)) {
|
||||
|
||||
$copy_result = copy_dn($serverSRC,$serverDST,$dnSRC,$dnDST,false);
|
||||
|
||||
if (! $copy_result)
|
||||
return false;
|
||||
|
||||
array_push($copy_message,sprintf('%s %s: <b>%s</b> %s',_('Copy successful'),_('DN'),$dnDST,_('has been created.')));
|
||||
|
||||
$hadError = false;
|
||||
foreach ($children as $child_dn) {
|
||||
$dnDST_new = sprintf('%s,%s',get_rdn($child_dn),$dnDST);
|
||||
$copy_result = r_copy_dn($serverSRC,$serverDST,$snapshottree,$child_dn,$dnDST_new,$remove);
|
||||
$copy_message = array_merge($copy_message,array_values($copy_result));
|
||||
|
||||
if (! $copy_result)
|
||||
$hadError = true;
|
||||
}
|
||||
|
||||
if (! $hadError && $remove) {
|
||||
$delete_result = $serverSRC->delete($dnSRC);
|
||||
|
||||
if ($delete_result)
|
||||
array_push($copy_message,sprintf('%s %s: <b>%s</b> %s',_('Delete successful'),_('DN'),$dnDST,_('has been deleted.')));
|
||||
}
|
||||
|
||||
} else {
|
||||
$copy_result = copy_dn($serverSRC,$serverDST,$dnSRC,$dnDST,$remove);
|
||||
|
||||
if ($copy_result)
|
||||
array_push($copy_message,sprintf('%s %s: <b>%s</b> %s',
|
||||
$remove ? _('Move successful') : _('Copy successful'),
|
||||
_('DN'),$dnDST,_('has been created.')));
|
||||
else
|
||||
array_push($copy_message,sprintf('%s %s: <b>%s</b> %s',
|
||||
$remove ? _('Move NOT successful') : _('Copy NOT successful'),
|
||||
_('DN'),$dnDST,_('has NOT been created.')));
|
||||
}
|
||||
|
||||
return $copy_message;
|
||||
}
|
||||
|
||||
function copy_dn($serverSRC,$serverDST,$dnSRC,$dnDST,$remove) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$request = array();
|
||||
$request['pageSRC'] = new PageRender($serverSRC->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['pageSRC']->setDN($dnSRC);
|
||||
$request['pageSRC']->accept();
|
||||
|
||||
$request['pageDST'] = new PageRender($serverDST->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['pageDST']->setContainer($serverDST->getContainer($dnDST));
|
||||
$request['pageDST']->accept();
|
||||
|
||||
$request['templateSRC'] = $request['pageSRC']->getTemplate();
|
||||
$request['templateDST'] = $request['pageDST']->getTemplate();
|
||||
$request['templateDST']->copy($request['pageSRC']->getTemplate(),get_rdn($dnDST,0));
|
||||
|
||||
# Create of move the entry
|
||||
if ($remove)
|
||||
return $serverDST->rename($request['templateSRC']->getDN(),$request['templateDST']->getRDN(),$serverDST->getContainer($dnDST),true);
|
||||
else
|
||||
return $serverDST->add($request['templateDST']->getDN(),$request['templateDST']->getLDAPadd());
|
||||
}
|
||||
|
||||
function build_tree($server,$dn,$buildtree) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# We search all children, not only the visible children in the tree
|
||||
$children = $server->getContainerContents($dn,null,0);
|
||||
|
||||
if (count($children)) {
|
||||
$buildtree[$dn] = $children;
|
||||
foreach ($children as $child_dn)
|
||||
$buildtree = build_tree($server,$child_dn,$buildtree);
|
||||
}
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$buildtree);
|
||||
|
||||
return $buildtree;
|
||||
}
|
||||
?>
|
@ -1,103 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copies a given object to create a new one.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DN we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET');
|
||||
|
||||
# Check if the entry exists.
|
||||
if (! $request['dn'] || ! $app['server']->dnExists($request['dn']))
|
||||
error(sprintf(_('The entry (%s) does not exist.'),$request['dn']),'error','index.php');
|
||||
|
||||
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->setDN($request['dn']);
|
||||
$request['page']->accept();
|
||||
|
||||
# Render the form
|
||||
$request['page']->drawTitle(sprintf('%s <b>%s</b>',_('Copy'),get_rdn($request['dn'])));
|
||||
$request['page']->drawSubTitle();
|
||||
|
||||
printf('<script type="text/javascript" src="%sdnChooserPopup.js"></script>',JSDIR);
|
||||
echo '<div style="text-align: center;">';
|
||||
printf('%s <b>%s</b> %s:<br /><br />',_('Copy'),get_rdn($request['dn']),_('to a new object'));
|
||||
echo '</div>';
|
||||
|
||||
echo '<form action="cmd.php" method="post" id="copy_form">';
|
||||
echo '<div>';
|
||||
echo '<input type="hidden" name="cmd" value="copy" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="server_id_src" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn_src" value="%s" />',htmlspecialchars($request['dn']));
|
||||
echo '</div>';
|
||||
echo "\n";
|
||||
|
||||
echo '<table border="0" style="border-spacing: 10px; margin-left: auto; margin-right: auto;">';
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym>:</td>',
|
||||
_('The full DN of the new entry to be created when copying the source entry'),_('Destination DN'));
|
||||
echo '<td>';
|
||||
printf('<input type="text" name="dn_dst" size="45" value="%s" />',htmlspecialchars($request['dn']));
|
||||
draw_chooser_link('copy_form','dn_dst','true',get_rdn($request['dn']));
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
printf('<tr><td>%s:</td><td>%s</td></tr>',_('Destination Server'),server_select_list($app['server']->getIndex(),true,'server_id_dst'));
|
||||
echo "\n";
|
||||
|
||||
# We search all children, not only the visible children in the tree
|
||||
$request['children'] = $app['server']->getContainerContents($request['dn']);
|
||||
|
||||
if (count($request['children']) > 0) {
|
||||
echo '<tr>';
|
||||
printf('<td><label for="recursive">%s</label>:</td>',_('Recursive copy'));
|
||||
echo '<td><input type="checkbox" id="recursive" name="recursive" onclick="copy_field_toggle(this)" />';
|
||||
printf('<small>(%s)</small></td>',_('Recursively copy all children of this object as well.'));
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym>:</td>',
|
||||
_('When performing a recursive copy, only copy those entries which match this filter'),_('Filter'));
|
||||
echo '<td><input type="text" name="filter" value="(objectClass=*)" size="45" disabled />';
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td>%s</td>',_('Delete after copy (move):'));
|
||||
echo '<td><input type="checkbox" name="remove" value="yes" disabled />';
|
||||
printf('<small>(%s)</small)</td>',_('Make sure your filter (above) will select all child records.'));
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
} else {
|
||||
printf('<tr><td>%s</td><td><input type="checkbox" name="remove" value="yes"/></td></tr>',_('Delete after copy (move):'));
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
printf('<tr><td colspan="2" style="text-align: center;"><input type="submit" value="%s" /></td></tr>',_('Copy '));
|
||||
echo "\n";
|
||||
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
|
||||
if ($_SESSION[APPCONFIG]->getValue('appearance','show_hints'))
|
||||
printf('<div style="text-align: center;"><small><img src="%s/light.png" alt="Light" /><span class="hint">%s</span></small></div>',
|
||||
IMGDIR,_('Hint: Copying between different servers only works if there are no schema violations'));
|
||||
|
||||
|
||||
# Draw the javascrpt to enable/disable the filter field if this may be a recursive copy
|
||||
if (count($request['children']) > 0)
|
||||
printf('<script type="text/javascript" src="%sform_field_toggle_enable.js"></script>',JSDIR);
|
||||
?>
|
@ -1,103 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Creates a new object in LDAP.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# If cancel was selected, we'll redirect
|
||||
if (get_request('cancel','REQUEST')) {
|
||||
header('Location: index.php');
|
||||
die();
|
||||
}
|
||||
|
||||
$request = array();
|
||||
$request['redirect'] = get_request('redirect','POST',false,false);
|
||||
|
||||
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->setContainer(get_request('container','REQUEST',true));
|
||||
$request['page']->accept();
|
||||
$request['template'] = $request['page']->getTemplate();
|
||||
|
||||
if ((! $request['template']->getContainer() || ! $app['server']->dnExists($request['template']->getContainer())) && ! get_request('create_base'))
|
||||
error(sprintf(_('The container you specified (%s) does not exist. Please try again.'),$request['template']->getContainer()),'error','index.php');
|
||||
|
||||
# Check if the container is a leaf - we shouldnt really return a hit here, the template engine shouldnt have allowed a user to attempt to create an entry...
|
||||
$tree = get_cached_item($app['server']->getIndex(),'tree');
|
||||
|
||||
$request['container'] = $tree->getEntry($request['template']->getContainer());
|
||||
if (! $request['container'] && ! get_request('create_base')) {
|
||||
$tree->addEntry($request['template']->getContainer());
|
||||
$request['container'] = $tree->getEntry($request['template']->getContainer());
|
||||
}
|
||||
|
||||
# Check our RDN
|
||||
if (! count($request['template']->getRDNAttrs()))
|
||||
error(_('The were no attributes marked as an RDN attribute.'),'error','index.php');
|
||||
if (! $request['template']->getRDN())
|
||||
error(_('The RDN field is empty?'),'error','index.php');
|
||||
|
||||
# Some other attribute checking...
|
||||
foreach ($request['template']->getAttributes() as $attribute) {
|
||||
# Check that our Required Attributes have a value - we shouldnt really return a hit here, the template engine shouldnt have allowed this to slip through.
|
||||
if ($attribute->isRequired() && ! count($attribute->getValues()))
|
||||
error(sprintf(_('You left the value blank for required attribute (%s).'),
|
||||
$attribute->getName(false)),'error','index.php');
|
||||
}
|
||||
|
||||
# Create the entry
|
||||
$add_result = $app['server']->add($request['template']->getDN(),$request['template']->getLDAPadd());
|
||||
|
||||
if ($add_result) {
|
||||
$action_number = $_SESSION[APPCONFIG]->getValue('appearance','action_after_creation');
|
||||
$href = sprintf('cmd=template_engine&server_id=%s',$app['server']->getIndex());
|
||||
|
||||
if ($request['redirect'])
|
||||
$redirect_url = $request['redirect'];
|
||||
|
||||
else if ($action_number == 2)
|
||||
$redirect_url = sprintf('cmd.php?%s&template=%s&container=%s',
|
||||
$href,'default',$request['template']->getContainerEncode());
|
||||
|
||||
else
|
||||
$redirect_url = sprintf('cmd.php?%s&template=%s&dn=%s',
|
||||
$href,'default',$request['template']->getDNEncode());
|
||||
|
||||
if ($action_number == 1 || $action_number == 2)
|
||||
printf('<meta http-equiv="refresh" content="0; url=%s" />',$redirect_url);
|
||||
|
||||
if ($action_number == 1 || $action_number == 2) {
|
||||
$create_message = sprintf('%s %s: <b>%s</b> %s',
|
||||
_('Creation successful!'),_('DN'),$request['template']->getDN(),_('has been created.'));
|
||||
|
||||
if (isAjaxEnabled())
|
||||
$redirect_url .= sprintf('&refresh=SID_%s_nodes&noheader=1',$app['server']->getIndex());
|
||||
|
||||
system_message(array(
|
||||
'title'=>_('Create Entry'),
|
||||
'body'=>$create_message,
|
||||
'type'=>'info'),
|
||||
$redirect_url);
|
||||
|
||||
} else {
|
||||
$request['page']->drawTitle(_('Entry created'));
|
||||
$request['page']->drawSubTitle(sprintf('%s: <b>%s</b> %s: <b>%s</b>',
|
||||
_('Server'),$app['server']->getName(),_('Distinguished Name'),$request['template']->getDN()));
|
||||
|
||||
echo '<br />';
|
||||
echo '<center>';
|
||||
printf('<a href="cmd.php?%s&dn=%s">%s</a>.',
|
||||
htmlspecialchars($href),rawurlencode($request['template']->getDN()),_('Display the new created entry'));
|
||||
echo '<br />';
|
||||
printf('<a href="cmd.php?%s&container=%s">%s</a>.',
|
||||
htmlspecialchars($href),rawurlencode($request['template']->getContainer()),_('Create another entry'));
|
||||
echo '</center>';
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,142 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Creates a new object in LDAP.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$request = array();
|
||||
$request['redirect'] = get_request('redirect','POST',false,false);
|
||||
|
||||
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->setContainer(get_request('container','REQUEST',true));
|
||||
$request['page']->accept();
|
||||
$request['template'] = $request['page']->getTemplate();
|
||||
|
||||
if (! $request['template']->getContainer() || ! $app['server']->dnExists($request['template']->getContainer()))
|
||||
error(sprintf(_('The container you specified (%s) does not exist. Please try again.'),$request['template']->getContainer()),'error','index.php');
|
||||
|
||||
# Check if the container is a leaf - we shouldnt really return a hit here, the template engine shouldnt have allowed a user to attempt to create an entry...
|
||||
$tree = get_cached_item($app['server']->getIndex(),'tree');
|
||||
|
||||
$request['container'] = $tree->getEntry($request['template']->getContainer());
|
||||
if (! $request['container']) {
|
||||
$tree->addEntry($request['template']->getContainer());
|
||||
$request['container'] = $tree->getEntry($request['template']->getContainer());
|
||||
}
|
||||
|
||||
# Check our RDN
|
||||
if (! count($request['template']->getRDNAttrs()))
|
||||
error(_('The were no attributes marked as an RDN attribute.'),'error','index.php');
|
||||
if (! $request['template']->getRDN())
|
||||
error(_('The RDN field is empty?'),'error','index.php');
|
||||
|
||||
# Some other attribute checking...
|
||||
foreach ($request['template']->getAttributes() as $attribute) {
|
||||
# Check that our Required Attributes have a value - we shouldnt really return a hit here, the template engine shouldnt have allowed this to slip through.
|
||||
if ($attribute->isRequired() && ! count($attribute->getValues()))
|
||||
error(sprintf(_('You left the value blank for required attribute (%s).'),
|
||||
$attribute->getName(false)),'error','index.php');
|
||||
}
|
||||
|
||||
# Check for unique attributes
|
||||
$app['server']->checkUniqueAttrs($request['template']->getDN(),$request['template']->getLDAPadd());
|
||||
|
||||
$request['page']->drawTitle(_('Create LDAP Entry'));
|
||||
$request['page']->drawSubTitle(sprintf('%s: <b>%s</b> %s: <b>%s</b>',
|
||||
_('Server'),$app['server']->getName(),_('Container'),$request['template']->getContainer()));
|
||||
|
||||
# Confirm the creation
|
||||
if (count($request['template']->getLDAPadd(true))) {
|
||||
echo '<div style="text-align: center;">';
|
||||
echo _('Do you want to create this entry?');
|
||||
echo '<br /><br />';
|
||||
echo '</div>';
|
||||
|
||||
echo "\n\n";
|
||||
echo '<form action="cmd.php" method="post" id="create_form">';
|
||||
echo '<div>';
|
||||
echo '<input type="hidden" name="cmd" value="create" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="container" value="%s" />',$request['template']->getContainerEncode(false));
|
||||
printf('<input type="hidden" name="template" value="%s" />',$request['template']->getID());
|
||||
foreach ($request['template']->getRDNAttrs() as $rdn)
|
||||
printf('<input type="hidden" name="rdn_attribute[]" value="%s" />',htmlspecialchars($rdn));
|
||||
echo "\n";
|
||||
|
||||
$request['page']->drawHiddenAttributes();
|
||||
echo '</div>';
|
||||
|
||||
echo '<table class="result_table" style="margin-left: auto; margin-right: auto;">';
|
||||
echo "\n";
|
||||
|
||||
printf('<tr class="heading"><td>%s</td><td>%s</td><td>%s</td></tr>',
|
||||
_('Attribute'),_('New Value'),_('Skip'));
|
||||
echo "\n\n";
|
||||
|
||||
$counter = 0;
|
||||
printf('<tr class="%s"><td colspan="3" style="text-align: center;"><b>%s</b></td></tr>',$counter%2 ? 'even' : 'odd',htmlspecialchars($request['template']->getDN()));
|
||||
|
||||
foreach ($request['template']->getLDAPadd(true) as $attribute) {
|
||||
$counter++;
|
||||
|
||||
printf('<tr class="%s">',$counter%2 ? 'even' : 'odd');
|
||||
printf('<td><b>%s</b></td>',$attribute->getFriendlyName());
|
||||
|
||||
# Show NEW Values
|
||||
echo '<td><span style="white-space: nowrap;">';
|
||||
$request['page']->draw('CurrentValues',$attribute);
|
||||
echo '</span></td>';
|
||||
|
||||
# Show SKIP Option
|
||||
$input_disabled = '';
|
||||
$input_onclick = '';
|
||||
|
||||
if ($attribute->isRequired())
|
||||
$input_disabled = 'disabled="disabled"';
|
||||
|
||||
printf('<td><input name="skip_array[%s]" id="skip_array_%s" type="checkbox" %s %s/></td>',
|
||||
htmlspecialchars($attribute->getName()),htmlspecialchars($attribute->getName()),$input_disabled,$input_onclick);
|
||||
echo '</tr>';
|
||||
echo "\n\n";
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo '<div style="text-align: center;">';
|
||||
echo '<br />';
|
||||
|
||||
printf('<input type="submit" value="%s" %s/>',
|
||||
_('Commit'),
|
||||
(isAjaxEnabled() ? sprintf('onclick="return ajSUBMIT(\'BODY\',document.getElementById(\'create_form\'),\'%s\');"',_('Updating Object')) : ''));
|
||||
|
||||
printf('<input type="submit" name="cancel" value="%s" %s/>',
|
||||
_('Cancel'),
|
||||
(isAjaxEnabled() ? sprintf('onclick="return ajDISPLAY(\'BODY\',\'cmd=template_engine&server_id=%s&container=%s\',\'%s\');"',$app['server']->getIndex(),$request['template']->getContainer(),_('Retrieving DN')) : ''));
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
echo '<br />';
|
||||
|
||||
} else {
|
||||
$href = sprintf('cmd=template_engine&server_id=%s&dn=%s',
|
||||
$app['server']->getIndex(),$request['template']->getDNEncode());
|
||||
|
||||
echo '<div style="text-align: center;">';
|
||||
echo _('You made no changes');
|
||||
|
||||
if (isAjaxEnabled())
|
||||
printf(' <a href="cmd.php?%s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'%s\');">%s</a>.',
|
||||
htmlspecialchars($href),htmlspecialchars($href),_('Retrieving DN'),_('Go back'));
|
||||
else
|
||||
printf(' <a href="cmd.php?%s">%s</a>.',htmlspecialchars($href),_('Go back'));
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Deletes a DN and presents a "job's done" message.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DNs we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','REQUEST',true);
|
||||
|
||||
if (! $app['server']->dnExists($request['dn']))
|
||||
error(sprintf('%s (%s)',_('No such entry.'),'<b>'.pretty_print_dn($request['dn']).'</b>'),'error','index.php');
|
||||
|
||||
# Delete the entry.
|
||||
$result = $app['server']->delete($request['dn']);
|
||||
|
||||
if ($result) {
|
||||
$redirect_url = '';
|
||||
|
||||
if (isAjaxEnabled())
|
||||
$redirect_url .= sprintf('&refresh=SID_%s_nodes&noheader=1',$app['server']->getIndex());
|
||||
|
||||
system_message(array(
|
||||
'title'=>_('Delete DN'),
|
||||
'body'=>_('Successfully deleted DN ').sprintf('<b>%s</b>',$request['dn']),
|
||||
'type'=>'info'),
|
||||
sprintf('index.php?server_id=%s%s',$app['server']->getIndex(),$redirect_url));
|
||||
} else
|
||||
system_message(array(
|
||||
'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($request['dn'])),
|
||||
'body'=>ldap_error_msg($app['server']->getErrorMessage(null),$app['server']->getErrorNum(null)),
|
||||
'type'=>'error'));
|
||||
?>
|
@ -1,49 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Deletes an attribute from an entry with NO confirmation.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','REQUEST',true);
|
||||
$request['attr'] = get_request('attr','REQUEST',true);
|
||||
$request['index'] = get_request('index','REQUEST',true);
|
||||
|
||||
if ($app['server']->isAttrReadOnly($request['attr']))
|
||||
error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),$request['attr']),'error','index.php');
|
||||
|
||||
$update_array = array();
|
||||
$update_array[$request['attr']] = $app['server']->getDNAttrValue($request['dn'],$request['attr']);
|
||||
|
||||
$redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',
|
||||
$app['server']->getIndex(),rawurlencode($request['dn']));
|
||||
|
||||
if (! isset($update_array[$request['attr']][$request['index']]))
|
||||
system_message(array(
|
||||
'title'=>_('Could not delete attribute value.'),
|
||||
'body'=>sprintf('%s. %s/%s',_('The attribute value does not exist'),$request['attr'],$request['index']),
|
||||
'type'=>'warn'),$redirect_url);
|
||||
|
||||
else {
|
||||
unset($update_array[$request['attr']][$request['index']]);
|
||||
foreach ($update_array as $key => $values)
|
||||
$update_array[$key] = array_values($values);
|
||||
|
||||
$result = $app['server']->modify($request['dn'],$update_array);
|
||||
|
||||
if ($result) {
|
||||
foreach ($update_array as $attr => $junk)
|
||||
$redirect_url .= sprintf('&modified_attrs[]=%s',$attr);
|
||||
|
||||
header("Location: $redirect_url");
|
||||
die();
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,157 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Displays a last chance confirmation form to delete a DN.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DN we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET');
|
||||
|
||||
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->setDN($request['dn']);
|
||||
$request['page']->accept();
|
||||
$request['template'] = $request['page']->getTemplate();
|
||||
|
||||
# Check if the entry exists.
|
||||
if (! $request['dn'] || ! $app['server']->dnExists($request['dn']))
|
||||
system_message(array(
|
||||
'title'=>_('Entry does not exist'),
|
||||
'body'=>sprintf('%s (%s)',_('The entry does not exist'),$request['dn']),
|
||||
'type'=>'error'),'index.php');
|
||||
|
||||
# We search all children, not only the visible children in the tree
|
||||
$request['children'] = $app['server']->getContainerContents($request['dn'],null,0,'(objectClass=*)',LDAP_DEREF_NEVER);
|
||||
|
||||
printf('<h3 class="title">%s %s</h3>',_('Delete'),htmlspecialchars(get_rdn($request['dn'])));
|
||||
printf('<h3 class="subtitle">%s: <b>%s</b> %s: <b>%s</b></h3>',
|
||||
_('Server'),$app['server']->getName(),_('Distinguished Name'),$request['dn']);
|
||||
echo "\n";
|
||||
|
||||
echo '<center>';
|
||||
|
||||
if (count($request['children'])) {
|
||||
printf('<b>%s</b><br /><br />',_('Permanently delete all children also?'));
|
||||
|
||||
$search['href'] = htmlspecialchars(sprintf('cmd.php?cmd=query_engine&server_id=%s&filter=%s&base=%s&scope=sub&query=none&format=list',
|
||||
$app['server']->getIndex(),rawurlencode('objectClass=*'),rawurlencode($request['dn'])));
|
||||
|
||||
$query = array();
|
||||
$query['base'] = $request['dn'];
|
||||
$query['scope'] = 'sub';
|
||||
$query['attrs'] = array('dn');
|
||||
$query['size_limit'] = 0;
|
||||
$query['deref'] = LDAP_DEREF_NEVER;
|
||||
$request['search'] = $app['server']->query($query,null);
|
||||
|
||||
echo '<table class="forminput" border="0">';
|
||||
echo '<tr>';
|
||||
echo '<td colspan="2">';
|
||||
printf(_('This entry is the root of a sub-tree containing %s entries.'),count($request['search']));
|
||||
printf(' <small>(<a href="%s">%s</a>)</small>',
|
||||
$search['href'],_('view entries'));
|
||||
echo '</td></tr>';
|
||||
|
||||
echo '<tr><td colspan="2"> </td></tr>';
|
||||
|
||||
printf('<tr><td colspan="2">%s</td></tr>',
|
||||
sprintf(_('phpLDAPadmin can recursively delete this entry and all %s of its children. See below for a list of all the entries that this action will delete. Do you want to do this?'),count($request['search'])));
|
||||
|
||||
echo '<tr><td colspan="2"> </td></tr>';
|
||||
|
||||
printf('<tr><td colspan="2"><small>%s</small></td></tr>',
|
||||
_('Note: this is potentially very dangerous and you do this at your own risk. This operation cannot be undone. Take into consideration aliases, referrals, and other things that may cause problems.'));
|
||||
echo "\n";
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td style="width: 50%; text-align: center;">';
|
||||
echo '<form action="cmd.php" method="post" id="delete_form">';
|
||||
echo '<input type="hidden" name="cmd" value="rdelete" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',$request['template']->getDNEncode(false));
|
||||
//@todo need to refresh the tree after a delete
|
||||
printf('<input type="submit" value="%s" %s />',
|
||||
sprintf(_('Delete all %s objects'),count($request['search'])),
|
||||
(isAjaxEnabled() ? sprintf('onclick="return ajSUBMIT(\'BODY\',document.getElementById(\'delete_form\'),\'%s\');"',_('Deleting Object(s)')) : ''));
|
||||
echo '</form>';
|
||||
echo '</td>';
|
||||
|
||||
echo '<td style="width: 50%; text-align: center;">';
|
||||
echo '<form action="cmd.php" method="get">';
|
||||
echo '<input type="hidden" name="cmd" value="template_engine" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',$request['template']->getDNEncode(false));
|
||||
printf('<input type="submit" name="submit" value="%s" %s />',
|
||||
_('Cancel'),
|
||||
(isAjaxEnabled() ? sprintf('onclick="return ajDISPLAY(\'BODY\',\'cmd=template_engine&server_id=%s&dn=%s\',\'%s\');"',$app['server']->getIndex(),$request['template']->getDNEncode(),_('Retrieving DN')) : ''));
|
||||
echo '</form>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
echo '</table>';
|
||||
echo "\n";
|
||||
|
||||
echo '<br /><br />';
|
||||
echo _('List of entries to be deleted:');
|
||||
echo '<br />';
|
||||
|
||||
$i = 0;
|
||||
printf('<select size="%s" multiple disabled style="background:white; color:black;width:500px" >',min(10,count($request['search'])));
|
||||
foreach ($request['search'] as $key => $value)
|
||||
printf('<option>%s. %s</option>',++$i,dn_unescape($value['dn']));
|
||||
echo '</select>';
|
||||
echo "\n";
|
||||
|
||||
} else {
|
||||
echo '<table class="forminput" border="0">';
|
||||
|
||||
printf('<tr><td colspan="4">%s</td></tr>',_('Are you sure you want to permanently delete this object?'));
|
||||
echo '<tr><td colspan="4"> </td></tr>';
|
||||
|
||||
printf('<tr><td style="width: 10%%;">%s:</td><td colspan="3" style="width: 75%%;"><b>%s</b></td></tr>',_('Server'),$app['server']->getName());
|
||||
printf('<tr><td style="width: 10%%;"><acronym title="%s">%s</acronym></td><td colspan="3" style="width: 75%%;"><b>%s</b></td></tr>',
|
||||
_('Distinguished Name'),_('DN'),$request['dn']);
|
||||
echo '<tr><td colspan="4"> </td></tr>';
|
||||
echo "\n";
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td colspan="2" style="width: 50%; text-align: center;">';
|
||||
echo '<form action="cmd.php" method="post" id="delete_form">';
|
||||
echo '<input type="hidden" name="cmd" value="delete" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',$request['template']->getDNEncode(false));
|
||||
//@todo need to refresh the tree after a delete
|
||||
printf('<input type="submit" name="submit" value="%s" %s />',
|
||||
_('Delete'),
|
||||
(isAjaxEnabled() ? sprintf('onclick="return ajSUBMIT(\'BODY\',document.getElementById(\'delete_form\'),\'%s\');"',_('Deleting Object(s)')) : ''));
|
||||
echo '</form>';
|
||||
|
||||
echo '</td>';
|
||||
echo '<td colspan="2" style="width: 50%; text-align: center;">';
|
||||
|
||||
echo '<form action="cmd.php" method="get">';
|
||||
echo '<input type="hidden" name="cmd" value="template_engine" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',$request['template']->getDNEncode(false));
|
||||
printf('<input type="submit" name="submit" value="%s" %s />',
|
||||
_('Cancel'),
|
||||
(isAjaxEnabled() ? sprintf('onclick="return ajDISPLAY(\'BODY\',\'cmd=template_engine&server_id=%s&dn=%s\',\'%s\');"',$app['server']->getIndex(),$request['template']->getDNEncode(),_('Retrieving DN')) : ''));
|
||||
echo '</form>';
|
||||
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
echo '</center>';
|
||||
echo '<br />';
|
||||
?>
|
@ -1,135 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Display a selection (popup window) to pick a DN.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
include './common.php';
|
||||
|
||||
$www['page'] = new page();
|
||||
|
||||
$request = array();
|
||||
$request['container'] = get_request('container','GET');
|
||||
$request['form'] = htmlspecialchars(addslashes(get_request('form','GET')));
|
||||
$request['element'] = htmlspecialchars(addslashes(get_request('element','GET')));
|
||||
$request['rdn'] = htmlspecialchars(addslashes(get_request('rdn','GET')));
|
||||
|
||||
echo '<div class="popup">';
|
||||
printf('<h3 class="subtitle">%s</h3>',_('Entry Chooser'));
|
||||
|
||||
echo '<script type="text/javascript">';
|
||||
echo ' function returnDN(dn) {';
|
||||
printf(" eval ('o = opener.document.getElementById(\"%s\").%s;');",$request['form'],$request['element']);
|
||||
echo ' o.value = dn;';
|
||||
echo ' close();';
|
||||
echo ' }';
|
||||
echo '</script>';
|
||||
|
||||
echo '<table class="forminput" width="100%" border="0">';
|
||||
if ($request['container']) {
|
||||
printf('<tr><td class="heading" colspan="3">%s:</td><td>%s</td></tr>',_('Server'),$app['server']->getName());
|
||||
printf('<tr><td class="heading" colspan="3">%s:</td><td>%s</td></tr>',_('Looking in'),htmlspecialchars($request['container']));
|
||||
echo '<tr><td class="blank" colspan="4"> </td></tr>';
|
||||
}
|
||||
|
||||
# Has the user already begun to descend into a specific server tree?
|
||||
if (isset($app['server']) && ! is_null($request['container'])) {
|
||||
$tree = get_cached_item($app['server']->getIndex(),'tree');
|
||||
|
||||
$request['children'] = $app['server']->getContainerContents($request['container'],null,0,'(objectClass=*)',$_SESSION[APPCONFIG]->getValue('deref','tree'));
|
||||
sort($request['children']);
|
||||
|
||||
foreach ($app['server']->getBaseDN() as $base) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Comparing BaseDN [%s] with container [%s]',64,0,__FILE__,__LINE__,__METHOD__,$base,$request['container']);
|
||||
|
||||
if (! pla_compare_dns($request['container'],$base)) {
|
||||
$parent_container = false;
|
||||
$href['up'] = sprintf('entry_chooser.php?form=%s&element=%s&rdn=%s',$request['form'],$request['element'],rawurlencode($request['rdn']));
|
||||
break;
|
||||
|
||||
} else {
|
||||
$parent_container = $app['server']->getContainer($request['container']);
|
||||
$href['up'] = sprintf('entry_chooser.php?form=%s&element=%s&rdn=%s&server_id=%s&container=%s',
|
||||
$request['form'],$request['element'],$request['rdn'],$app['server']->getIndex(),rawurlencode($parent_container));
|
||||
}
|
||||
}
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td class="blank"> </td>';
|
||||
printf('<td class="icon"><a href="%s"><img src="%s/up.png" alt="Up" /></a></td>',$href['up'],IMGDIR);
|
||||
printf('<td colspan="2"><a href="%s">%s...</a></td>',$href['up'],_('Back Up'));
|
||||
echo '</tr>';
|
||||
|
||||
if (! count($request['children']))
|
||||
printf('<td class="blank" colspan="2"> </td><td colspan="2">(%s)</td>',_('no entries'));
|
||||
|
||||
else
|
||||
foreach ($request['children'] as $dn) {
|
||||
$href['return'] = sprintf("javascript:returnDN('%s%s')",($request['rdn'] ? sprintf('%s,',$request['rdn']) : ''),str_replace('\\','\\\\',$dn));
|
||||
$href['expand'] = sprintf('entry_chooser.php?server_id=%s&form=%s&element=%s&rdn=%s&container=%s',
|
||||
$app['server']->getIndex(),$request['form'],$request['element'],$request['rdn'],rawurlencode($dn));
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td class="blank"> </td>';
|
||||
printf('<td class="icon"><a href="%s"><img src="%s/plus.png" alt="Plus" /></a></td>',$href['expand'],IMGDIR);
|
||||
|
||||
$entry = $tree->getEntry($dn);
|
||||
if (is_null($entry)) {
|
||||
$tree->addEntry($dn);
|
||||
$entry = $tree->getEntry($dn);
|
||||
}
|
||||
|
||||
if ($entry)
|
||||
$item = draw_formatted_dn($app['server'], $entry);
|
||||
else
|
||||
$item = $dn;
|
||||
|
||||
printf('<td colspan="2"><a href="%s">%s</a></td>',$href['return'], $item );
|
||||
echo '</tr>';
|
||||
echo "\n\n";
|
||||
}
|
||||
|
||||
# Draw the root of the selection tree (ie, list all the servers)
|
||||
} else {
|
||||
foreach ($_SESSION[APPCONFIG]->getServerList() as $index => $server) {
|
||||
if ($server->isLoggedIn(null)) {
|
||||
printf('<tr><td class="heading" colspan="3">%s:</td><td class="heading">%s</td></tr>',_('Server'),$server->getName());
|
||||
foreach ($server->getBaseDN() as $dn) {
|
||||
if (! $dn) {
|
||||
printf('<tr><td class="blank"> </td><td colspan="3">(%s)</td></tr>',_('Could not determine base DN'));
|
||||
|
||||
} else {
|
||||
$href['return'] = sprintf("javascript:returnDN('%s%s')",($request['rdn'] ? sprintf('%s,',$request['rdn']) : ''),rawurlencode($dn));
|
||||
$href['expand'] = htmlspecialchars(sprintf('entry_chooser.php?server_id=%s&form=%s&element=%s&rdn=%s&container=%s',
|
||||
$server->getIndex(),$request['form'],$request['element'],$request['rdn'],rawurlencode($dn)));
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td class="blank"> </td>';
|
||||
printf('<td colspan="2" class="icon"><a href="%s"><img src="%s/plus.png" alt="Plus" /></a></td>',$href['expand'],IMGDIR);
|
||||
printf('<td colspan="2"><a href="%s">%s</a></td>',$href['return'],$dn);
|
||||
}
|
||||
}
|
||||
|
||||
echo '<tr><td class="blank" colspan="4"> </td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
|
||||
# Capture the output and put into the body of the page.
|
||||
$www['body'] = new block();
|
||||
$www['body']->SetBody(ob_get_contents());
|
||||
$www['page']->block_add('body',$www['body']);
|
||||
ob_end_clean();
|
||||
|
||||
# Render the popup.
|
||||
$www['page']->display(array('CONTROL'=>false,'FOOT'=>false,'HEAD'=>false,'TREE'=>false));
|
||||
?>
|
89
htdocs/js/modify_member.js
vendored
89
htdocs/js/modify_member.js
vendored
@ -1,89 +0,0 @@
|
||||
var m1 = document.getElementById('member').notmembers;
|
||||
var m2 = document.getElementById('member').members;
|
||||
|
||||
/* This function generates hidden input array from new group members
|
||||
* when submit button is pressed.
|
||||
* see modify_member_form.php
|
||||
*/
|
||||
function update_new_values(memberattr) {
|
||||
el = document.getElementById("dnu");
|
||||
|
||||
for (i=0;i<m2.length;i++) {
|
||||
el.innerHTML =
|
||||
el.innerHTML +
|
||||
"<input type='hidden' name='new_values[" + memberattr + "][" + i + "]' value='" + m2.options[i].text + "' />";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* This function moves members from left select box to right one
|
||||
* see modify_member_form.php
|
||||
*/
|
||||
function one2two() {
|
||||
m1len = m1.length ;
|
||||
|
||||
for (i=0;i<m1len;i++) {
|
||||
if (m1.options[i].selected == true) {
|
||||
m2len = m2.length;
|
||||
m2.options[m2len]= new Option(m1.options[i].text);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=(m1len-1);i>=0;i--){
|
||||
if (m1.options[i].selected == true) {
|
||||
m1.options[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* This function moves members from right select box to left one
|
||||
* see modify_member_form.php
|
||||
*/
|
||||
function two2one() {
|
||||
m2len = m2.length ;
|
||||
|
||||
for (i=0;i<m2len;i++){
|
||||
if (m2.options[i].selected == true) {
|
||||
m1len = m1.length;
|
||||
m1.options[m1len]= new Option(m2.options[i].text);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=(m2len-1);i>=0;i--) {
|
||||
if (m2.options[i].selected == true) {
|
||||
m2.options[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* This function moves all members from left select box to right one
|
||||
* see modify_member_form.php
|
||||
*/
|
||||
function all2two() {
|
||||
m1len = m1.length ;
|
||||
|
||||
for (i=0;i<m1len;i++) {
|
||||
m2len = m2.length;
|
||||
m2.options[m2len]= new Option(m1.options[i].text);
|
||||
}
|
||||
|
||||
for (i=(m1len-1);i>=0;i--) {
|
||||
m1.options[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
/* This function moves all members from right select box to left one
|
||||
* see modify_member_form.php
|
||||
*/
|
||||
function all2one() {
|
||||
m2len = m2.length ;
|
||||
|
||||
for (i=0;i<m2len;i++) {
|
||||
m1len = m1.length;
|
||||
m1.options[m1len]= new Option(m2.options[i].text);
|
||||
}
|
||||
|
||||
for (i=(m2len-1);i>=0;i--) {
|
||||
m2.options[i] = null;
|
||||
}
|
||||
}
|
@ -1,147 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Displays a last chance confirmation form to delete a DN.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DN we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','REQUEST');
|
||||
|
||||
if (! $request['dn'])
|
||||
system_message(array(
|
||||
'title'=>_('No entry selected'),
|
||||
'body'=>_('No entry was selected to delete'),
|
||||
'type'=>'warn'),'index.php');
|
||||
|
||||
if (! is_array($request['dn']))
|
||||
$request['dn'] = array($request['dn']);
|
||||
|
||||
$request['children'] = array();
|
||||
$request['parent'] = array();
|
||||
foreach ($request['dn'] as $dn) {
|
||||
# Check if the entry exists.
|
||||
if (! $dn || ! $app['server']->dnExists($dn))
|
||||
system_message(array(
|
||||
'title'=>_('Entry does not exist'),
|
||||
'body'=>sprintf('%s (%s/%s)',_('The entry does not exist and will be ignored'),$dn),
|
||||
'type'=>'error'));
|
||||
|
||||
# We search all children, not only the visible children in the tree
|
||||
if (! in_array_ignore_case($dn,$request['children'])) {
|
||||
$request['children'] = array_merge($request['children'],$app['server']->getContainerContents($dn,null,0,'(objectClass=*)',LDAP_DEREF_NEVER));
|
||||
array_push($request['parent'],$dn);
|
||||
}
|
||||
}
|
||||
|
||||
printf('<h3 class="title">%s</h3>',_('Mass Delete'));
|
||||
printf('<h3 class="subtitle">%s: <b>%s</b></h3>',_('Server'),$app['server']->getName());
|
||||
echo "\n";
|
||||
|
||||
echo '<center>';
|
||||
echo '<table class="forminput" border="0">';
|
||||
|
||||
if (count($request['parent']) == 1)
|
||||
printf('<tr><td colspan="4"><b>%s</b></td></tr>',_('Are you sure you want to permanently delete this object?'));
|
||||
else
|
||||
printf('<tr><td colspan="4"><b>%s</b></td></tr>',_('Are you sure you want to permanently delete these objects?'));
|
||||
|
||||
echo '<tr><td colspan="4"> </td></tr>';
|
||||
printf('<tr><td style="width: 10%%;">%s:</td><td colspan="3" style="width: 75%%;"><b>%s</b></td></tr>',_('Server'),$app['server']->getName());
|
||||
|
||||
foreach ($request['parent'] as $dn)
|
||||
printf('<tr><td style="width: 10%%;"><acronym title="%s">%s</acronym></td><td colspan="3" style="width: 75%%;"><b>%s</b></td></tr>',
|
||||
_('Distinguished Name'),_('DN'),$dn);
|
||||
|
||||
echo '<tr><td colspan="4"> </td></tr>';
|
||||
|
||||
$request['delete'] = $request['parent'];
|
||||
|
||||
if (count($request['children'])) {
|
||||
printf('<tr><td colspan="4"><b>%s</b></td></tr>',_('Permanently delete all children also?'));
|
||||
echo '<tr><td colspan="4"> </td></tr>';
|
||||
|
||||
# We need to see if the children have children
|
||||
$query = array();
|
||||
$query['scope'] = 'sub';
|
||||
$query['attrs'] = array('dn');
|
||||
$query['size_limit'] = 0;
|
||||
$query['deref'] = LDAP_DEREF_NEVER;
|
||||
|
||||
$request['search'] = array();
|
||||
foreach ($request['children'] as $dn) {
|
||||
$query['base'] = $dn;
|
||||
$request['search'] = array_merge($request['search'],$app['server']->query($query,null));
|
||||
}
|
||||
|
||||
foreach ($request['search'] as $value)
|
||||
array_push($request['delete'],$value['dn']);
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td colspan="4">';
|
||||
printf(_('This request also includes %s children entries.'),count($request['children']));
|
||||
echo '</td></tr>';
|
||||
|
||||
printf('<tr><td colspan="4">%s</td></tr>',
|
||||
sprintf(_('phpLDAPadmin can also recursively delete all %s of the child entries. See below for a list of all the entries that this action will delete. Do you want to do this?'),count($request['children'])));
|
||||
|
||||
echo '<tr><td colspan="4"> </td></tr>';
|
||||
|
||||
printf('<tr><td colspan="4"><small>%s</small></td></tr>',
|
||||
_('Note: this is potentially very dangerous and you do this at your own risk. This operation cannot be undone. Take into consideration aliases, referrals, and other things that may cause problems.'));
|
||||
echo "\n";
|
||||
|
||||
echo '<tr><td colspan="4"> </td></tr>';
|
||||
|
||||
echo "\n";
|
||||
|
||||
printf('<tr><td colspan="4"><center><b>%s</b></center></td></tr>',_('List of entries to be deleted:'));
|
||||
echo '<tr><td colspan="4"> </td></tr>';
|
||||
|
||||
$i = 0;
|
||||
echo '<tr><td colspan="4"><center>';
|
||||
printf('<select size="%s" multiple disabled style="background:white; color:black;width:500px" >',min(10,count($request['delete'])));
|
||||
foreach ($request['delete'] as $key => $value)
|
||||
printf('<option>%s. %s</option>',++$i,htmlspecialchars(dn_unescape($value)));
|
||||
echo '</select>';
|
||||
echo '</center></td></tr>';
|
||||
echo "\n";
|
||||
|
||||
echo '<tr><td colspan="4"> </td></tr>';
|
||||
}
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td colspan="2" style="width: 50%; text-align: center;">';
|
||||
echo '<form action="cmd.php" method="post">';
|
||||
echo '<input type="hidden" name="cmd" value="rdelete" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
foreach ($request['parent'] as $dn)
|
||||
printf('<input type="hidden" name="dn[]" value="%s" />',htmlspecialchars($dn));
|
||||
printf('<input type="submit" value="%s" />',sprintf(_('Delete all %s objects'),count($request['delete'])));
|
||||
echo '</form>';
|
||||
echo '</center></td>';
|
||||
|
||||
echo '<td colspan="2" style="width: 50%; text-align: center;">';
|
||||
|
||||
echo '<form action="cmd.php" method="get">';
|
||||
echo '<input type="hidden" name="cmd" value="template_engine" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="submit" name="submit" value="%s" />',_('Cancel'));
|
||||
echo '</form>';
|
||||
|
||||
echo '</center></td>';
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
echo '</table>';
|
||||
echo '</center>';
|
||||
|
||||
echo '<br />';
|
||||
?>
|
@ -1,133 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Main command page for phpLDAPadmin
|
||||
* Enable mass editing of Attribute values from a list of DNs.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require_once './common.php';
|
||||
|
||||
# The DN we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','REQUEST');
|
||||
$request['attrs'] = get_request('attrs','REQUEST');
|
||||
|
||||
# Check if the entries exist.
|
||||
$counter = 0;
|
||||
$attrcols = array();
|
||||
foreach ($request['dn'] as $dn) {
|
||||
# Check if the entry exists.
|
||||
if (! $dn || ! $app['server']->dnExists($dn)) {
|
||||
system_message(array(
|
||||
'title'=>_('Entry does not exist'),
|
||||
'body'=>sprintf('%s (%s/%s)',_('The entry does not exist and will be ignored'),$dn),
|
||||
'type'=>'error'));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$request['page'][$counter] = new MassRender($app['server']->getIndex(),'none');
|
||||
$request['page'][$counter]->setDN($dn);
|
||||
$request['page'][$counter]->accept(true);
|
||||
|
||||
$template = $request['page'][$counter]->getTemplate();
|
||||
|
||||
# Mark our attributes to edit as shown.
|
||||
foreach ($template->getAttributes(true) as $attribute) {
|
||||
if ($attribute->isInternal())
|
||||
continue;
|
||||
|
||||
if (in_array_ignore_case($attribute->getName(),$request['attrs']) || in_array('*',$request['attrs'])) {
|
||||
$attribute->show();
|
||||
|
||||
# Get a list of our columns (we are not interested in these attribute values)
|
||||
if (! isset($attrcols[$attribute->getName()]))
|
||||
$attrcols[$attribute->getName()] = $attribute;
|
||||
}
|
||||
}
|
||||
|
||||
$counter++;
|
||||
}
|
||||
|
||||
usort($attrcols,'sortAttrs');
|
||||
|
||||
if (! count($request['page']))
|
||||
header('Location: index.php');
|
||||
|
||||
# We'll render this forms Title with the first DN's object.
|
||||
$request['page'][0]->drawTitle(_('Bulk edit the following DNs'));
|
||||
$request['page'][0]->drawSubTitle(sprintf('%s: <b>%s</b>',_('Server'),$app['server']->getName()));
|
||||
|
||||
echo '<form action="cmd.php" method="post">';
|
||||
echo '<div>';
|
||||
echo '<input type="hidden" name="cmd" value="mass_update" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
|
||||
foreach ($request['page'] as $j => $page)
|
||||
printf('<input type="hidden" name="dn[%s]" value="%s" />',$j,$page->getTemplate()->getDN());
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echo '<table class="result_table" border="0">';
|
||||
echo '<tr class="heading">';
|
||||
echo '<td>DN</td>';
|
||||
|
||||
foreach ($attrcols as $attribute) {
|
||||
echo '<td>';
|
||||
$request['page'][0]->draw('Name',$attribute);
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
|
||||
$counter = 0;
|
||||
foreach ($request['page'] as $j => $page) {
|
||||
$template = $page->getTemplate();
|
||||
|
||||
printf('<tr class="%s">',$counter++%2==0?'even':'odd');
|
||||
printf('<td><span style="white-space: nowrap;"><acronym title="%s"><b>%s</b>...</acronym></span></td>',
|
||||
$template->getDN(),substr($template->getDN(),0,20));
|
||||
|
||||
foreach ($attrcols as $attrcol) {
|
||||
$attribute = $template->getAttribute($attrcol->getName());
|
||||
|
||||
echo '<td>';
|
||||
if ($attribute) {
|
||||
foreach ($attribute->getValues() as $i => $val)
|
||||
$page->draw('MassFormReadWriteValue',$attribute,$i,$j);
|
||||
|
||||
# The attribute doesnt exist. If it is available by the shema, we can draw an empty input box.
|
||||
} else {
|
||||
$match = false;
|
||||
|
||||
foreach ($template->getAvailAttrs() as $attribute) {
|
||||
if ($attrcol->getName() == $attribute->getName()) {
|
||||
$page->draw('MassFormReadWriteValue',$attribute,0,$j);
|
||||
$match = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $match)
|
||||
printf('<center><small>%s</small></center>', _('Attribute not available'));
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
echo '<div>';
|
||||
echo '<br/>';
|
||||
printf('<input type="submit" id="save_button" name="submit" value="%s" />',_('Update Values'));
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
?>
|
@ -1,175 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Main command page for phpLDAPadmin
|
||||
* This script will handle bulk updates.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require_once './common.php';
|
||||
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','REQUEST',true);
|
||||
$request['mass_values'] = get_request('mass_values','REQUEST',true);
|
||||
|
||||
# Check if the entries exist.
|
||||
$request['update'] = array();
|
||||
|
||||
foreach ($request['dn'] as $index => $dn) {
|
||||
# Check if the entry exists.
|
||||
if (! $dn || ! $app['server']->dnExists($dn)) {
|
||||
system_message(array(
|
||||
'title'=>_('Entry does not exist'),
|
||||
'body'=>sprintf('%s (%s/%s)',_('The entry does not exist and will be ignored'),$dn),
|
||||
'type'=>'error'));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
# Simulate the requirements for *Render->accept()
|
||||
if (! isset($request['mass_values'][$index]))
|
||||
continue;
|
||||
|
||||
$_REQUEST['new_values'] = $request['mass_values'][$index];
|
||||
|
||||
$render = new MassRender($app['server']->getIndex(),'none');
|
||||
$render->setDN($dn);
|
||||
$render->accept(true);
|
||||
|
||||
if ($render->getTemplate()->getLDAPmodify(false,$index))
|
||||
$request['update'][$index] = $render;
|
||||
}
|
||||
|
||||
# We can use the $render to give us a title
|
||||
$render->drawTitle(_('Bulk update the following DNs'));
|
||||
$render->drawSubTitle(sprintf('%s: <b>%s</b>',_('Server'),$app['server']->getName()));
|
||||
|
||||
if (count($request['update'])) {
|
||||
if (get_request('confirm','REQUEST')) {
|
||||
foreach ($request['update'] as $index => $page) {
|
||||
$template = $page->getTemplate();
|
||||
|
||||
# Perform the modification
|
||||
$result = $app['server']->modify($template->getDN(),$template->getLDAPmodify(false,$index));
|
||||
|
||||
if ($result)
|
||||
printf('%s: <b>%s</b><br>',$template->getDN(),_('Modification successful!'));
|
||||
else
|
||||
printf('%s: <b>%s</b><br>',$template->getDN(),_('Modification NOT successful!'));
|
||||
}
|
||||
|
||||
} else {
|
||||
echo '<form action="cmd.php" method="post">';
|
||||
echo '<input type="hidden" name="cmd" value="mass_update" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
echo '<input type="hidden" name="confirm" value="1" />';
|
||||
|
||||
foreach ($request['update'] as $j => $page)
|
||||
printf('<input type="hidden" name="dn[%s]" value="%s" />',$j,$page->getTemplate()->getDN());
|
||||
|
||||
echo '<table class="result_box" width="100%" border="1">';
|
||||
echo '<tr><td>';
|
||||
|
||||
echo '<br/>';
|
||||
|
||||
echo '<table class="result" border="0">';
|
||||
echo '<tr><td>';
|
||||
printf(_('There will be %s updates done with this mass update'),sprintf('<b>%s</b>',count($request['update'])));
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
|
||||
echo '<br/>';
|
||||
|
||||
foreach ($request['update'] as $index => $page) {
|
||||
$template = $page->getTemplate();
|
||||
|
||||
echo '<table class="result" border="0">';
|
||||
echo '<tr class="list_title">';
|
||||
printf('<td class="icon"><img src="%s/%s" alt="icon" /></td>',IMGDIR,get_icon($app['server']->getIndex(),$template->getDN()));
|
||||
|
||||
printf('<td colspan="3"><a href="cmd.php?cmd=template_engine&server_id=%s&dn=%s">%s</a></td>',
|
||||
$app['server']->getIndex(),rawurlencode(dn_unescape($template->getDN())),htmlspecialchars(get_rdn($template->getDN())));
|
||||
echo '</tr>';
|
||||
|
||||
printf('<tr class="list_item"><td class="blank"> </td><td class="heading">dn</td><td class="value" style="width: 45%%;">%s</td><td class="value" style="width: 45%%;"><b>%s</b></td></tr>',
|
||||
htmlspecialchars(dn_unescape($template->getDN())),_('Old Value'));
|
||||
|
||||
foreach ($template->getLDAPmodify(true,$index) as $attribute) {
|
||||
echo '<tr class="list_item">';
|
||||
echo '<td class="blank"> </td>';
|
||||
|
||||
echo '<td class="heading">';
|
||||
$page->draw('Name',$attribute);
|
||||
echo '</td>';
|
||||
|
||||
# Show NEW Values
|
||||
echo '<td><span style="white-space: nowrap;">';
|
||||
|
||||
if (! $attribute->getValueCount() || $attribute->isForceDelete()) {
|
||||
printf('<span style="color: red">[%s]</span>',_('attribute deleted'));
|
||||
printf('<input type="hidden" name="mass_values[%s][%s][%s]" value="%s" />',$index,$attribute->getName(),0,'');
|
||||
}
|
||||
|
||||
foreach ($attribute->getValues() as $key => $value) {
|
||||
# For multiple values, we'll highlight the changed ones
|
||||
if ((count($attribute->getValues()) > 5) && in_array($value,$attribute->getAddedValues()))
|
||||
echo '<span style="color:#004400; background:#FFFFA0">';
|
||||
|
||||
$page->draw('CurrentValue',$attribute,$key);
|
||||
|
||||
# For multiple values, close the highlighting
|
||||
if ((count($attribute->getValues()) > 5) && in_array($value,$attribute->getAddedValues()))
|
||||
echo '</span>';
|
||||
|
||||
echo '<br />';
|
||||
printf('<input type="hidden" name="mass_values[%s][%s][%s]" value="%s" />',$index,$attribute->getName(),$key,$value);
|
||||
}
|
||||
|
||||
echo '</span></td>';
|
||||
|
||||
# Show OLD Values
|
||||
echo '<td><span style="white-space: nowrap;">';
|
||||
|
||||
if (! $attribute->getOldValues())
|
||||
printf('<span style="color: green">[%s]</span>',_('attribute doesnt exist'));
|
||||
|
||||
foreach ($attribute->getOldValues() as $key => $value) {
|
||||
# For multiple values, we'll highlight the changed ones
|
||||
if ((count($attribute->getOldValues()) > 5) && in_array($value,$attribute->getRemovedValues()) && count($attribute->getValues()))
|
||||
echo '<span style="color:#880000; background:#FFFFA0">';
|
||||
|
||||
$page->draw('OldValue',$attribute,$key);
|
||||
|
||||
# For multiple values, close the highlighting
|
||||
if ((count($attribute->getOldValues()) > 5) && in_array($value,$attribute->getRemovedValues()) && count($attribute->getValues()))
|
||||
echo '</span>';
|
||||
|
||||
echo '<br />';
|
||||
}
|
||||
|
||||
echo '</span></td>';
|
||||
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo '<br/>';
|
||||
}
|
||||
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
printf('<input type="submit" id="save_button" name="submit" value="%s" />',_('Update Values'));
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
} else {
|
||||
echo '<center>';
|
||||
echo _('You made no changes');
|
||||
echo '</center>';
|
||||
}
|
||||
?>
|
@ -1,178 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Displays a form to allow the user to modify group members.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DN we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET');
|
||||
$request['attr'] = get_request('attr','GET');
|
||||
|
||||
$request['page'] = new TemplateRender($app['server']->getIndex(),get_request('template','REQUEST',false,null));
|
||||
$request['page']->setDN($request['dn']);
|
||||
$request['page']->accept(true);
|
||||
$request['template'] = $request['page']->getTemplate();
|
||||
|
||||
if (! is_null($request['dn']))
|
||||
$rdn = get_rdn($request['dn']);
|
||||
else
|
||||
$rdn = null;
|
||||
|
||||
# Get all current group members
|
||||
$current_members = $app['server']->getDNAttrValue($request['dn'],$request['attr']);
|
||||
usort($current_members,'pla_compare_dns');
|
||||
|
||||
# Loop through all base dn's and search possible member entries
|
||||
$query = array();
|
||||
|
||||
# Get all entries that can be added to the group
|
||||
if (preg_match("/^".$request['attr']."$/i",$_SESSION[APPCONFIG]->getValue('modify_member','posixgroupattr'))) {
|
||||
$query['filter'] = $_SESSION[APPCONFIG]->getValue('modify_member','posixfilter');
|
||||
$attr = $_SESSION[APPCONFIG]->getValue('modify_member','posixattr');
|
||||
|
||||
} else {
|
||||
$query['filter'] = $_SESSION[APPCONFIG]->getValue('modify_member','filter');
|
||||
$attr = $_SESSION[APPCONFIG]->getValue('modify_member','attr');
|
||||
}
|
||||
|
||||
$query['attrs'] = array($attr);
|
||||
|
||||
$possible_values = array();
|
||||
foreach ($app['server']->getBaseDN() as $base) {
|
||||
$query['base'] = $base;
|
||||
|
||||
$possible_values = array_merge($possible_values,$app['server']->query($query,null));
|
||||
}
|
||||
|
||||
usort($possible_values,'pla_compare_dns');
|
||||
|
||||
$request['page']->drawTitle(sprintf('%s <b>%s</b>',_('Modify group'),get_rdn($request['dn'])));
|
||||
$request['page']->drawSubTitle();
|
||||
|
||||
printf('%s <b>%s</b> %s <b>%s</b>:',
|
||||
_('There are'),count($current_members),_('members in group'),htmlspecialchars(get_rdn($request['dn'])));
|
||||
|
||||
$possible_members = array();
|
||||
for ($i=0;$i<count($possible_values);$i++) {
|
||||
if (preg_match("/^".$request['attr']."$/i",$_SESSION[APPCONFIG]->getValue('modify_member','posixgroupattr')))
|
||||
$possible_members[$i] = $possible_values[$i][$_SESSION[APPCONFIG]->getValue('modify_member','posixattr')][0];
|
||||
else
|
||||
$possible_members[$i] = $possible_values[$i][$_SESSION[APPCONFIG]->getValue('modify_member','attr')][0];
|
||||
}
|
||||
|
||||
# Show only user that are not already in group.
|
||||
$possible_members = array_diff($possible_members,$current_members);
|
||||
usort($possible_members,'pla_compare_dns');
|
||||
|
||||
/* Draw form with select boxes, left for all possible members and
|
||||
* right one for those that belong to group */
|
||||
|
||||
# Modifications will be sent to update_confirm which takes care of rest of the processing
|
||||
echo '<br />';
|
||||
echo '<br />';
|
||||
|
||||
echo '<form action="cmd.php" method="post" class="add_value" id="member">';
|
||||
echo '<div>';
|
||||
if ($_SESSION[APPCONFIG]->getValue('confirm','update'))
|
||||
echo '<input type="hidden" name="cmd" value="update_confirm" />';
|
||||
else
|
||||
echo '<input type="hidden" name="cmd" value="update" />';
|
||||
echo '</div>';
|
||||
|
||||
echo '<table class="modify_members">';
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><img src="%s/ldap-user.png" alt="Users" /> %s</td>',IMGDIR,_('Available members'));
|
||||
printf('<td><img src="%s/ldap-uniquegroup.png" alt="Members" /> %s</td>',IMGDIR,_('Group members'));
|
||||
echo '</tr>';
|
||||
|
||||
# Generate select box from all possible members
|
||||
echo '<tr>';
|
||||
echo '<td>';
|
||||
echo '<select name="notmembers" size="10" multiple="multiple">';
|
||||
|
||||
switch ($request['attr']) {
|
||||
case 'nisnetgrouptriple':
|
||||
foreach ($possible_members as $possible) {
|
||||
// Added for output formating
|
||||
$matches = preg_split('/[=,]/',$possible);
|
||||
$possible = sprintf('(,%s,)',$matches[1]);
|
||||
|
||||
if (! in_array($possible,$current_members))
|
||||
printf('<option>%s</option>',$possible);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ('memberuid' || 'member' || 'uniquemember'):
|
||||
foreach ($possible_members as $possible) {
|
||||
if (! in_array($possible,$current_members))
|
||||
printf('<option>%s</option>',$possible);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
echo '</select>';
|
||||
echo '</td>';
|
||||
|
||||
# Generate select box from all current members
|
||||
echo '<td>';
|
||||
echo '<select name="members" size="10" multiple="multiple">';
|
||||
|
||||
foreach ($current_members as $current)
|
||||
printf('<option>%s</option>',htmlspecialchars($current));
|
||||
|
||||
echo '</select>';
|
||||
echo '</td>';
|
||||
|
||||
echo '</tr>';
|
||||
|
||||
# Show buttons which move users from left to right and vice versa
|
||||
echo '<tr>';
|
||||
echo '<td>';
|
||||
printf('<input type="button" onclick="one2two()" value="%s >>" /> <input type="button" onclick="all2two()" value="%s >>" />',
|
||||
_('Add selected'),_('Add all'));
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
printf('<input type="button" onclick="two2one()" value="<< %s" /> <input type="button" onclick="all2one()" value="<< %s" />',
|
||||
_('Remove selected'),('Remove all'));
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr><td colspan="2">';
|
||||
|
||||
# Hidden attributes for update_confirm.php
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',rawurlencode($request['dn']));
|
||||
printf('<input type="hidden" name="attr" value="%s" />',$request['attr']);
|
||||
|
||||
/* Generate array of input text boxes from current members.
|
||||
* update_confirm.php will see this as old_values[member-attribute][item] */
|
||||
for ($i=0; $i<count($current_members); $i++)
|
||||
printf('<input type="hidden" name="old_values[%s][%s]" value="%s" />',
|
||||
htmlspecialchars($request['attr']),$i,htmlspecialchars($current_members[$i]));
|
||||
|
||||
/* Javascript generates array of input text boxes from new members.
|
||||
* update_confirm.php will see this as new_values[member-attribute][item]
|
||||
* Input text boxes will be generated to div=dnu */
|
||||
echo '<div id="dnu">';
|
||||
printf('<input type="hidden" name="new_values[%s][]" value="" />',htmlspecialchars($request['attr']));
|
||||
echo '</div>';
|
||||
|
||||
# Submit values to update_confirm.php and when clicked, run addSelected
|
||||
printf('<input type="submit" name="save" value="%s" onclick="update_new_values(\'%s\')" />',_('Save changes'),$request['attr']);
|
||||
echo '</td></tr>';
|
||||
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
printf('<script type="text/javascript" src="%smodify_member.js"></script>',JSDIR);
|
||||
?>
|
@ -1,88 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Check the password used by an entry.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$www['page'] = new page();
|
||||
|
||||
$request = array();
|
||||
$request['componentid'] = get_request('componentid','REQUEST');
|
||||
$request['hash'] = get_request('hash','REQUEST');
|
||||
$request['password'] = get_request('check_password','REQUEST');
|
||||
$request['action'] = get_request('action','REQUEST');
|
||||
$request['attribute'] = get_request('attr','REQUEST');
|
||||
|
||||
if (get_request('base64','REQUEST')) {
|
||||
$request['hash'] = base64_decode($request['hash']);
|
||||
$request['password'] = base64_decode($request['password']);
|
||||
}
|
||||
|
||||
$request['enc_type'] = get_enc_type($request['hash']);
|
||||
|
||||
printf('<h3 class="subtitle">%s</h3>',_('Password Checker Tool'));
|
||||
|
||||
echo '<form action="password_checker.php" method="post">';
|
||||
echo '<input type="hidden" name="action" value="compare" />';
|
||||
printf('<input type="hidden" name="attr" value="%s" />',$request['attribute']);
|
||||
|
||||
echo '<table class="forminput" width="100%" border="0">';
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td class="heading">%s</td>',_('Compare'));
|
||||
printf('<td><input type="%s" name="hash" id="hash" value="%s" /></td>',
|
||||
(obfuscate_password_display($request['enc_type']) ? 'password' : 'text'),htmlspecialchars($request['hash']));
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td class="heading">%s</td>',_('To'));
|
||||
printf('<td><input type="password" name="check_password" value="%s" /></td>',
|
||||
htmlspecialchars($request['password']));
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td> </td>';
|
||||
|
||||
echo '<td><input type="submit" value="Compare" />';
|
||||
|
||||
if ($request['action'] == 'compare') {
|
||||
echo ' <b>';
|
||||
|
||||
if (password_check($request['hash'],$request['password'],$request['attribute']))
|
||||
printf('<span class="good">%s</span>',_('Passwords match!'));
|
||||
else
|
||||
printf('<span class="bad">%s</span>',_('Passwords do not match!'));
|
||||
|
||||
echo '</b>';
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
|
||||
# Pull our password from the form that opened this window.
|
||||
if ($request['componentid']) {
|
||||
echo '<script type="text/javascript">';
|
||||
printf('var c = window.opener.document.getElementById("%s");',$request['componentid']);
|
||||
printf('var h = document.getElementById("%s");','hash');
|
||||
echo 'if (c && h) { h.value = c.value; }';
|
||||
echo '</script>';
|
||||
}
|
||||
|
||||
# Capture the output and put into the body of the page.
|
||||
$www['body'] = new block();
|
||||
$www['body']->SetBody(ob_get_contents());
|
||||
$www['page']->block_add('body',$www['body']);
|
||||
ob_end_clean();
|
||||
|
||||
# Render the popup.
|
||||
$www['page']->display(array('CONTROL'=>false,'FOOT'=>false,'HEAD'=>false,'TREE'=>false));
|
||||
?>
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Query render engine.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
* @author The phpLDAPadmin development team
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
require LIBDIR.'query_functions.php';
|
||||
|
||||
$request = array();
|
||||
$request['page'] = new QueryRender($app['server']->getIndex(),get_request('query','REQUEST',false,null));
|
||||
$request['page']->accept();
|
||||
?>
|
@ -1,89 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Recursively deletes the specified DN and all of its children
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','REQUEST',true);
|
||||
|
||||
if (! is_array($request['dn']))
|
||||
$request['dn'] = array($request['dn']);
|
||||
|
||||
$request['parent'] = array();
|
||||
foreach ($request['dn'] as $dn)
|
||||
if (! $app['server']->dnExists($dn))
|
||||
system_message(array(
|
||||
'title'=>_('Entry does not exist'),
|
||||
'body'=>sprintf('%s (%s)',_('Unable to delete entry, it does not exist'),$dn),
|
||||
'type'=>'error'));
|
||||
else
|
||||
array_push($request['parent'],$dn);
|
||||
|
||||
printf('<h3 class="title">%s</h3>',_('Delete LDAP entries'));
|
||||
printf('<h3 class="subtitle">%s</h3>',_('Recursive delete progress'));
|
||||
|
||||
# Prevent script from bailing early on a long delete
|
||||
@set_time_limit(0);
|
||||
|
||||
foreach ($request['parent'] as $dn) {
|
||||
echo '<br /><br />';
|
||||
echo '<small>';
|
||||
$result = pla_rdelete($app['server'],$dn);
|
||||
echo '</small><br />';
|
||||
|
||||
if ($result) {
|
||||
printf(_('Entry %s and sub-tree deleted successfully.'),'<b>'.$dn.'</b>');
|
||||
|
||||
} else {
|
||||
system_message(array(
|
||||
'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($request['dn'])),
|
||||
'body'=>ldap_error_msg($app['server']->getErrorMessage(null),$app['server']->getErrorNum(null)),
|
||||
'type'=>'error'));
|
||||
}
|
||||
}
|
||||
|
||||
function pla_rdelete($server,$dn) {
|
||||
# We delete all children, not only the visible children in the tree
|
||||
$children = $server->getContainerContents($dn,null,0,'(objectClass=*)',LDAP_DEREF_NEVER);
|
||||
|
||||
if (! is_array($children) || count($children) == 0) {
|
||||
printf('<span style="white-space: nowrap;">%s %s...',_('Deleting'),$dn);
|
||||
|
||||
if ($server->delete($dn)) {
|
||||
printf(' <span style="color:green">%s</span></span><br />',_('Success'));
|
||||
return true;
|
||||
|
||||
} else {
|
||||
system_message(array(
|
||||
'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($dn)),
|
||||
'body'=>ldap_error_msg($server->getErrorMessage(null),$server->getErrorNum(null)),
|
||||
'type'=>'error'));
|
||||
}
|
||||
|
||||
} else {
|
||||
foreach ($children as $child_dn)
|
||||
pla_rdelete($server,$child_dn);
|
||||
|
||||
printf('<span style="white-space: nowrap;">%s %s...',_('Deleting'),$dn);
|
||||
|
||||
if ($server->delete($dn)) {
|
||||
printf(' <span style="color:green">%s</span></span><br />',_('Success'));
|
||||
return true;
|
||||
|
||||
} else {
|
||||
system_message(array(
|
||||
'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($dn)),
|
||||
'body'=>ldap_error_msg($server->getErrorMessage(null),$server->getErrorNum(null)),
|
||||
'type'=>'error'));
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,64 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Renames a DN to a different name.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DN we are working with
|
||||
$request = array();
|
||||
$request['dnSRC'] = get_request('dn','REQUEST');
|
||||
$request['rdnDST'] = get_request('new_rdn','REQUEST');
|
||||
$request['container'] = $app['server']->getContainer($request['dnSRC']);
|
||||
|
||||
# Error checking
|
||||
if (! $app['server']->isBranchRenameEnabled()) {
|
||||
# We search all children, not only the visible children in the tree
|
||||
$children = $app['server']->getContainerContents($request['dnSRC'],null,0,'(objectClass=*)',LDAP_DEREF_NEVER);
|
||||
|
||||
if (count($children) > 0)
|
||||
error(_('You cannot rename an entry which has children entries (eg, the rename operation is not allowed on non-leaf entries)'),'error','index.php');
|
||||
}
|
||||
|
||||
$request['dnDST'] = sprintf('%s,%s',$request['rdnDST'],$request['container']);
|
||||
|
||||
if ($request['dnDST'] == $request['dnSRC'])
|
||||
error(_('You did not change the RDN'),'error','index.php');
|
||||
|
||||
$rdnattr = array();
|
||||
$rdnattr['SRC'] = explode('=',$request['dnSRC']);
|
||||
$rdnattr['SRC'] = $rdnattr['SRC'][0];
|
||||
|
||||
$new_dn_value = explode('=',$request['rdnDST'],2);
|
||||
$rdnattr['DST'] = $new_dn_value[0];
|
||||
|
||||
if (count($new_dn_value) != 2 || ! isset($new_dn_value[1]))
|
||||
error(_('Invalid RDN value'),'error','index.php');
|
||||
|
||||
$deleteoldrdn = $rdnattr['SRC'] == $rdnattr['DST'];
|
||||
$success = $app['server']->rename($request['dnSRC'],$request['rdnDST'],$request['container'],$deleteoldrdn);
|
||||
|
||||
if ($success) {
|
||||
$rename_message = sprintf('%s',_('Rename successful!'));
|
||||
$redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s&template=%s',
|
||||
$app['server']->getIndex(),rawurlencode($request['dnDST']),get_request('template','REQUEST'));
|
||||
|
||||
system_message(array(
|
||||
'title'=>_('Rename Entry'),
|
||||
'body'=>$rename_message,
|
||||
'type'=>'info'),
|
||||
$redirect_url);
|
||||
|
||||
} else {
|
||||
system_message(array(
|
||||
'title'=>_('Could not rename the entry.'),
|
||||
'body'=>ldap_error_msg($app['server']->getErrorMessage(null),$app['server']->getErrorNum(null)),
|
||||
'type'=>'error'));
|
||||
}
|
||||
?>
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Displays a form for renaming an LDAP entry.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DN we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET');
|
||||
$request['template'] = get_request('template','GET');
|
||||
|
||||
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->setDN($request['dn']);
|
||||
$request['page']->accept();
|
||||
|
||||
# Render the form
|
||||
$request['page']->drawTitle(sprintf('%s <b>%s</b>',_('Rename'),get_rdn($request['dn'])));
|
||||
$request['page']->drawSubTitle();
|
||||
|
||||
echo '<center>';
|
||||
printf('%s <b>%s</b> %s:<br /><br />',_('Rename'),get_rdn($request['dn']),_('to a new object'));
|
||||
|
||||
echo '<form action="cmd.php?cmd=rename" method="post" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',rawurlencode($request['dn']));
|
||||
printf('<input type="hidden" name="template" value="%s" />',$request['template']);
|
||||
printf('<input type="text" name="new_rdn" size="30" value="%s" />',get_rdn($request['dn']));
|
||||
printf('<input type="submit" value="%s" />',_('Rename'));
|
||||
echo '</form>';
|
||||
|
||||
echo '</center>';
|
||||
echo "\n";
|
||||
?>
|
@ -1,57 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Template render engine.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
* @author The phpLDAPadmin development team
|
||||
*/
|
||||
|
||||
/**
|
||||
The template engine has the following responsibilities:
|
||||
* If we are passed a DN, then we are editing an existing entry
|
||||
* If we are not passed a DN, then we are passed a container (and creating a new entry in that container)
|
||||
|
||||
In both cases, we are optionally passed a template ID.
|
||||
* If we have a template ID, then we'll render the creation/editing using that template
|
||||
* If we are not passed a template ID, then we'll either:
|
||||
* Present a list of available templates,
|
||||
* Present the default template, because there are non available (due to hidden,regexp or non-existant)
|
||||
* Present the only template, if there is only one.
|
||||
|
||||
Creating and editing entries use two objects:
|
||||
* A template object which describes how the template should be rendered (and what values should asked for, etc)
|
||||
* A page object, which is responsible for actually sending out the HTML to the browser.
|
||||
|
||||
So:
|
||||
* we init a new TemplateRender object
|
||||
* we init a new Template object
|
||||
* set the DN or container on the template object
|
||||
* If setting the DN, this in turn should read the "old values" from the LDAP server
|
||||
* If we are not on the first page (ie: 2nd, 3rd, 4th step, etc), we should accept the post values that we have obtained thus far
|
||||
|
||||
* Finally submit the update to "update_confirm", or the create to "create", when complete.
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','REQUEST');
|
||||
$request['page'] = new TemplateRender($app['server']->getIndex(),get_request('template','REQUEST',false,null));
|
||||
|
||||
# If we have a DN, then this is to edit the entry.
|
||||
if ($request['dn']) {
|
||||
$app['server']->dnExists($request['dn'])
|
||||
or error(sprintf('%s (%s)',_('No such entry'),pretty_print_dn($request['dn'])),'error','index.php');
|
||||
|
||||
$request['page']->setDN($request['dn']);
|
||||
$request['page']->accept();
|
||||
|
||||
} else {
|
||||
if ($app['server']->isReadOnly())
|
||||
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
|
||||
|
||||
$request['page']->setContainer(get_request('container','REQUEST'));
|
||||
$request['page']->accept();
|
||||
}
|
||||
?>
|
@ -1,48 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This class will render the editing of multiple LDAP entries.
|
||||
*
|
||||
* @author The phpLDAPadmin development team
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* TemplateRender class
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Templates
|
||||
*/
|
||||
class MassRender extends TemplateRender {
|
||||
protected function drawMassFormReadWriteValueAttribute($attribute,$i,$j) {
|
||||
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
|
||||
|
||||
$val = $attribute->getValue($i);
|
||||
|
||||
if ($attribute->getHelper())
|
||||
echo '<table cellspacing="0" cellpadding="0" border=1><tr><td valign="top">';
|
||||
|
||||
printf('<input type="text" class="value" name="mass_values[%s][%s][%s]" id="new_values_%s_%s_%s" value="%s" %s%s %s %s/>',
|
||||
$j,htmlspecialchars($attribute->getName()),$i,
|
||||
$j,htmlspecialchars($attribute->getName()),$i,
|
||||
htmlspecialchars($val),
|
||||
$attribute->needJS('focus') ? sprintf('onfocus="focus_%s(this);" ',$attribute->getName()) : '',
|
||||
$attribute->needJS('blur') ? sprintf('onblur="blur_%s(this);" ',$attribute->getName()) : '',
|
||||
($attribute->getSize() > 0) ? sprintf('size="%s"',$attribute->getSize()) : '',
|
||||
($attribute->getMaxLength() > 0) ? sprintf('maxlength="%s"',$attribute->getMaxLength()) : '');
|
||||
|
||||
if ($attribute->getHelper()) {
|
||||
echo '</td><td valign="top">';
|
||||
$this->draw('AttributeHelper',$attribute,$i);
|
||||
echo '</td></tr></table>';
|
||||
}
|
||||
}
|
||||
|
||||
protected function drawMassFormReadWriteValueBinaryAttribute($attribute,$i,$j) {
|
||||
$this->drawFormReadWriteValueBinaryAttribute($attribute,$i);
|
||||
}
|
||||
|
||||
protected function drawMassFormReadWriteValueJpegAttribute($attribute,$i,$j) {
|
||||
$this->drawFormReadOnlyValueJpegAttribute($attribute,$i);
|
||||
}
|
||||
}
|
||||
?>
|
1201
lib/PageRender.php
1201
lib/PageRender.php
File diff suppressed because it is too large
Load Diff
283
lib/Query.php
283
lib/Query.php
@ -1,283 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Classes and functions for the query engine.
|
||||
*
|
||||
* @author The phpLDAPadmin development team
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Query Class
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Queries
|
||||
*/
|
||||
class Query extends xmlTemplate {
|
||||
protected $description = '';
|
||||
public $results = array();
|
||||
|
||||
/**
|
||||
* Main processing to store the template.
|
||||
*
|
||||
* @param xmldata Parsed xmldata from xml2array object
|
||||
*/
|
||||
protected function storeTemplate($xmldata) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$server = $this->getServer();
|
||||
|
||||
foreach ($xmldata['query'] as $xml_key => $xml_value) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Foreach loop Key [%s] Value [%s]',4,0,__FILE__,__LINE__,__METHOD__,$xml_key,is_array($xml_value));
|
||||
|
||||
switch ($xml_key) {
|
||||
|
||||
# Build our attribute list from the DN and Template.
|
||||
case ('attributes'):
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Case [%s]',4,0,__FILE__,__LINE__,__METHOD__,$xml_key);
|
||||
|
||||
if (is_array($xmldata['query'][$xml_key])) {
|
||||
foreach ($xmldata['query'][$xml_key] as $tattrs) {
|
||||
foreach ($tattrs as $index => $details) {
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Foreach tattrs Key [%s] Value [%s]',4,0,__FILE__,__LINE__,__METHOD__,
|
||||
$index,$details);
|
||||
|
||||
# If there is no schema definition for the attribute, it will be ignored.
|
||||
if ($sattr = $server->getSchemaAttribute($index)) {
|
||||
if (is_null($attribute = $this->getAttribute($sattr->getName())))
|
||||
$attribute = $this->addAttribute($sattr->getName(false),array('values'=>array()));
|
||||
|
||||
$attribute->show();
|
||||
$attribute->setXML($details);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
# Build our bases list from the DN and Template.
|
||||
case ('bases'):
|
||||
if (isset($xmldata['query'][$xml_key]['base']))
|
||||
if (is_array($xmldata['query'][$xml_key]['base']))
|
||||
$this->base = $xmldata['query'][$xml_key]['base'];
|
||||
else
|
||||
$this->base = array($xmldata['query'][$xml_key]['base']);
|
||||
else
|
||||
error(sprintf(_('In the XML file (%s), [%s] contains an unknown key.'),
|
||||
$this->filename,$xml_key),'error','index.php');
|
||||
|
||||
$this->base = array_unique($this->base);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Case [%s]',4,0,__FILE__,__LINE__,__METHOD__,$xml_key);
|
||||
|
||||
# Some key definitions need to be an array, some must not be:
|
||||
$allowed_arrays = array('');
|
||||
$storelower = array('');
|
||||
$storearray = array('');
|
||||
|
||||
# Items that must be stored lowercase
|
||||
if (in_array($xml_key,$storelower))
|
||||
if (is_array($xml_value))
|
||||
foreach ($xml_value as $index => $value)
|
||||
$xml_value[$index] = strtolower($value);
|
||||
else
|
||||
$xml_value = strtolower($xml_value);
|
||||
|
||||
# Items that must be stored as arrays
|
||||
if (in_array($xml_key,$storearray) && ! is_array($xml_value))
|
||||
$xml_value = array($xml_value);
|
||||
|
||||
# Items that should not be an array
|
||||
if (! in_array($xml_key,$allowed_arrays) && is_array($xml_value)) {
|
||||
debug_dump(array(__METHOD__,'key'=>$xml_key,'value'=>$xml_value));
|
||||
error(sprintf(_('In the XML file (%s), [%s] is an array, it must be a string.'),
|
||||
$this->filename,$xml_key),'error');
|
||||
}
|
||||
|
||||
$this->$xml_key = $xml_value;
|
||||
}
|
||||
}
|
||||
|
||||
# Check we have some manditory items.
|
||||
foreach (array() as $key) {
|
||||
if (! isset($this->$key)
|
||||
|| (! is_array($this->$key) && ! trim($this->$key))) {
|
||||
|
||||
$this->setInvalid(sprintf(_('Missing %s in the XML file.'),$key));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Accept will run the query and store the results in results()
|
||||
*/
|
||||
public function accept() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$server = $this->getServer();
|
||||
|
||||
$query = array();
|
||||
$query['size_limit'] = get_request('size_limit','REQUEST',false,$_SESSION[APPCONFIG]->getValue('search','size_limit'));
|
||||
$query['format'] = get_request('format','REQUEST',false,$_SESSION[APPCONFIG]->getValue('search','display'));
|
||||
$query['orderby'] = get_request('orderby','REQUEST',false,'dn');
|
||||
|
||||
# If this is a custom search, we need to populate are paramters
|
||||
if ($this->getID() == 'none') {
|
||||
$bases = get_request('base','REQUEST',false,null);
|
||||
$query['filter'] = get_request('filter','REQUEST',false,'objectClass=*');
|
||||
$query['scope'] = get_request('scope','REQUEST',false,'sub');
|
||||
$attrs = get_request('display_attrs','REQUEST');
|
||||
|
||||
$attrs = preg_replace('/\s+/','',$attrs);
|
||||
if ($attrs)
|
||||
$query['attrs'] = explode(',',$attrs);
|
||||
else
|
||||
$query['attrs'] = array('*');
|
||||
|
||||
} else {
|
||||
$bases = $this->base;
|
||||
$query['filter'] = $this->filter;
|
||||
$query['scope'] = $this->scope;
|
||||
$query['attrs'] = $this->getAttributeNames();
|
||||
}
|
||||
|
||||
if (! $bases)
|
||||
$bases = $server->getBaseDN();
|
||||
elseif (! is_array($bases))
|
||||
$bases = explode('|',$bases);
|
||||
|
||||
foreach ($bases as $base) {
|
||||
$query['base'] = $base;
|
||||
|
||||
$time_start = utime();
|
||||
$this->results[$base] = $server->query($query,null);
|
||||
$time_end = utime();
|
||||
|
||||
$this->resultsdata[$base]['time'] = round($time_end-$time_start,2);
|
||||
$this->resultsdata[$base]['scope'] = $query['scope'];
|
||||
$this->resultsdata[$base]['filter'] = $query['filter'];
|
||||
$this->resultsdata[$base]['attrs'] = $query['attrs'];
|
||||
|
||||
if ($this->getAttrSortOrder() == 'dn')
|
||||
usort($this->results[$base],'pla_compare_dns');
|
||||
elseif ($this->getAttrSortOrder())
|
||||
masort($this->results[$base],$this->getAttrSortOrder());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is temporary to get around objects that use a DN for rendering, for example jpegPhoto
|
||||
*/
|
||||
public function setDN($dn) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->dn = $dn;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is temporary to get around objects that use a DN for rendering, for example jpegPhoto
|
||||
*/
|
||||
public function getDN() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->dn);
|
||||
|
||||
return $this->dn;
|
||||
}
|
||||
|
||||
public function getDNEncode($url=true) {
|
||||
// @todo Be nice to do all this in 1 location
|
||||
if ($url)
|
||||
return urlencode(preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->dn));
|
||||
else
|
||||
return preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->dn);
|
||||
}
|
||||
|
||||
public function getAttrSortOrder() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$result = array();
|
||||
|
||||
if (count($this->attributes)) {
|
||||
masort($this->attributes,'ordersort');
|
||||
|
||||
foreach ($this->attributes as $attribute)
|
||||
array_push($result,$attribute->getName());
|
||||
|
||||
} else {
|
||||
$display = preg_replace('/,\s+/',',',get_request('orderby','REQUEST',false,'dn'));
|
||||
|
||||
if (trim($display))
|
||||
$result = explode(',',$display);
|
||||
}
|
||||
|
||||
return implode(',',$result);
|
||||
}
|
||||
|
||||
public function getAttrDisplayOrder() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$result = array();
|
||||
|
||||
if (count($this->attributes)) {
|
||||
masort($this->attributes,'order');
|
||||
|
||||
foreach ($this->attributes as $attribute)
|
||||
array_push($result,$attribute->getName());
|
||||
|
||||
} else {
|
||||
$display = preg_replace('/,\s+/',',',get_request('display_attrs','REQUEST',false,''));
|
||||
|
||||
if (trim($display))
|
||||
$result = explode(',',$display);
|
||||
}
|
||||
|
||||
# If our display order is empty, then dynamically build it
|
||||
if (! count($result)) {
|
||||
foreach ($this->results as $details)
|
||||
foreach ($details as $attrs)
|
||||
$result = array_merge($result,array_keys(array_change_key_case($attrs)));
|
||||
|
||||
$result = array_unique($result);
|
||||
sort($result);
|
||||
}
|
||||
|
||||
# Put the DN first
|
||||
array_unshift($result,'dn');
|
||||
$result = array_unique($result);
|
||||
|
||||
return implode(',',$result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the template is visible
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isVisible() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->visible);
|
||||
|
||||
return $this->visible;
|
||||
}
|
||||
|
||||
public function getDescription() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->description);
|
||||
|
||||
return $this->description;
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,557 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @author The phpLDAPadmin development team
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* QueryRender class
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Templates
|
||||
* @todo need to add paging
|
||||
*/
|
||||
class QueryRender extends PageRender {
|
||||
/** CORE FUNCTIONS **/
|
||||
|
||||
/**
|
||||
* Intialise and Render the QueryRender
|
||||
*/
|
||||
public function accept() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
|
||||
if (DEBUGTMP||DEBUGTMPSUB) printf('<font size=-2>* %s [GETquery:%s]</font><br />',__METHOD__,get_request('query','REQUEST'));
|
||||
if (DEBUGTMP||DEBUGTMPSUB) printf('<font size=-2>* %s [Page:%s]</font><br />',__METHOD__,get_request('page','REQUEST'));
|
||||
|
||||
$this->template_id = $this->getTemplateChoice();
|
||||
$this->page = get_request('page','REQUEST',false,1);
|
||||
|
||||
# If we are the default template, make sure we pressed search
|
||||
if ($this->template_id == 'none' && ! get_request('search','REQUEST'))
|
||||
$this->drawTemplateChoice();
|
||||
|
||||
elseif ($this->template_id) {
|
||||
$templates = $this->getTemplates();
|
||||
$this->template = $templates->getTemplate($this->template_id);
|
||||
$this->template->accept();
|
||||
|
||||
$this->visitStart();
|
||||
$this->visitEnd();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get our templates applicable for this object
|
||||
*/
|
||||
protected function getTemplates() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
return new Queries($this->server_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Are default queries enabled?
|
||||
*/
|
||||
protected function haveDefaultTemplate() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$server = $this->getServer();
|
||||
|
||||
if ($server->getValue('query','disable_default'))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function drawTemplateChoice() {
|
||||
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
|
||||
|
||||
$server = $this->getServer();
|
||||
|
||||
$this->drawTitle(_('Search'));
|
||||
$this->drawSubTitle();
|
||||
|
||||
echo "\n";
|
||||
|
||||
$baseDNs = $server->getBaseDN();
|
||||
|
||||
printf('<script type="text/javascript" src="%sdnChooserPopup.js"></script>',JSDIR);
|
||||
echo '<form action="cmd.php" id="advanced_search_form">';
|
||||
echo '<div>';
|
||||
echo '<input type="hidden" name="cmd" value="query_engine" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$server->getIndex());
|
||||
echo '</div>';
|
||||
|
||||
echo '<table class="forminput" border="0" style="margin-left: auto; margin-right: auto;">';
|
||||
echo '<tr><td colspan="2"> </td></tr>';
|
||||
|
||||
$templates = $this->getTemplates();
|
||||
|
||||
if (count($templates->getTemplates())) {
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym></td>',_('Run a predefined query'),_('Predefined Query'));
|
||||
echo '<td>';
|
||||
echo '<select name="query">';
|
||||
if ($this->haveDefaultTemplate())
|
||||
printf('<option value="%s" %s>%s</option>','none','',_('Custom Query'));
|
||||
|
||||
foreach ($templates->getTemplates() as $template)
|
||||
printf('<option value="%s" %s>%s</option>',
|
||||
$template->getID(),
|
||||
($this->template_id == $template->getID() ? 'selected="selected"' : ''),
|
||||
$template->getDescription());
|
||||
echo '</select>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym></td>',_('The format to show the query results'),_('Display Format'));
|
||||
echo '<td>';
|
||||
echo '<select name="format" style="width: 200px">';
|
||||
|
||||
printf('<option value="list" %s>%s</option>',
|
||||
$_SESSION[APPCONFIG]->getValue('search','display') == 'list' ? 'selected="selected"' : '',_('list'));
|
||||
printf('<option value="table" %s>%s</option>',
|
||||
$_SESSION[APPCONFIG]->getValue('search','display') == 'table' ? 'selected="selected"' : '',_('table'));
|
||||
|
||||
echo '</select>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym></td>',_('Entries to show per page'),_('Show Results'));
|
||||
echo '<td>';
|
||||
echo '<select name="showresults" style="width: 200px">';
|
||||
|
||||
printf('<option value="na" %s>%s</option>',
|
||||
'','NA');
|
||||
|
||||
echo '</select>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
|
||||
echo '<td colspan="2">';
|
||||
printf('<div id="customquery" style="display: %s">','block');
|
||||
echo '<br/>';
|
||||
echo '<fieldset>';
|
||||
printf('<legend>%s</legend>',_('Custom Query'));
|
||||
echo '<table border="0"><tr>';
|
||||
|
||||
printf('<td>%s</td>',_('Base DN'));
|
||||
printf('<td><input type="text" name="base" value="%s" style="width: 200px" id="base" />',count($baseDNs) == 1 ? $baseDNs[0] : '');
|
||||
|
||||
draw_chooser_link('advanced_search_form','base');
|
||||
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym></td>',_('The scope in which to search'),_('Search Scope'));
|
||||
|
||||
echo '<td>';
|
||||
echo '<select name="scope" style="width: 200px">';
|
||||
|
||||
printf('<option value="sub" %s>%s</option>',
|
||||
'',_('Sub (entire subtree)'));
|
||||
|
||||
printf('<option value="one" %s>%s</option>',
|
||||
'',_('One (one level beneath base)'));
|
||||
|
||||
printf('<option value="base" %s>%s</option>',
|
||||
'',_('Base (base dn only)'));
|
||||
|
||||
echo '</select>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym></td>',
|
||||
htmlspecialchars(_('Standard LDAP search filter. Example: (&(sn=Smith)(givenName=David))')),_('Search Filter'));
|
||||
|
||||
printf('<td><input type="text" name="filter" id="filter" style="width: 200px" value="%s" /></td>',
|
||||
'objectClass=*');
|
||||
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym></td>',
|
||||
_('A list of attributes to display in the results (comma-separated)'),_('Show Attributes'));
|
||||
|
||||
printf('<td><input type="text" name="display_attrs" style="width: 200px" value="%s" /></td>',
|
||||
implode(', ',$_SESSION[APPCONFIG]->getValue('search','result_attributes')));
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym></td>',_('Order by'),_('Order by'));
|
||||
printf('<td><input type="text" name="orderby" id="orderby" style="width: 200px" value="%s" /></td>','');
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym></td>',_('Set the search results to 0 to retrieve all available records'),_('Search Results'));
|
||||
printf('<td><input type="text" name="size_limit" id="size_limit" style="width: 200px" value="%s" /></td>',$_SESSION[APPCONFIG]->getValue('search','size_limit'));
|
||||
echo '</tr>';
|
||||
|
||||
echo '</table>';
|
||||
echo '</fieldset>';
|
||||
echo '</div>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
printf('<tr><td colspan="2" style="text-align: center;"><br /><input type="submit" name="search" value="%s" /></td></tr>',_('Search'));
|
||||
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
private function visitStart() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$this->drawTitle(_('Search Results'));
|
||||
$this->drawSubTitle();
|
||||
echo '<br/>';
|
||||
}
|
||||
|
||||
private function visitEnd() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$server = $this->getServer();
|
||||
$afattrs = $this->getAFAttrs();
|
||||
|
||||
# If Mass Actions Enabled
|
||||
if ($_SESSION[APPCONFIG]->getValue('mass','enabled')) {
|
||||
$mass_actions = array(
|
||||
_('delete') => 'mass_delete',
|
||||
_('edit') => 'mass_edit'
|
||||
);
|
||||
}
|
||||
|
||||
$this->drawBaseTabs();
|
||||
$ado = $this->template->getAttrDisplayOrder();
|
||||
$counter = 0;
|
||||
$j = 0;
|
||||
|
||||
foreach ($this->template->results as $base => $results) {
|
||||
$counter++;
|
||||
|
||||
if (! $show = get_request('show','REQUEST'))
|
||||
$show = ($counter === 1 ? $this->getAjaxRef($base) : null);
|
||||
|
||||
printf('<div id="DN%s" style="display: %s">',
|
||||
$this->getAjaxRef($base), ($show == $this->getAjaxRef($base) ? 'block' : 'none'));
|
||||
|
||||
echo '<table class="result_box" border="0" width="100%">';
|
||||
echo '<tr><td>';
|
||||
echo '<br/>';
|
||||
echo '<br/>';
|
||||
|
||||
$this->drawResultsTable($base,count($results));
|
||||
|
||||
echo '<br/>';
|
||||
echo '<br/>';
|
||||
|
||||
switch(get_request('format','REQUEST',false,$_SESSION[APPCONFIG]->getValue('search','display'))) {
|
||||
case 'list':
|
||||
foreach ($results as $dndetails) {
|
||||
$dndetails = array_change_key_case($dndetails);
|
||||
|
||||
# Temporarily set our DN, for rendering that leverages our DN (eg: JpegPhoto)
|
||||
$this->template->setDN($dndetails['dn']);
|
||||
|
||||
echo '<table class="result" border="0">';
|
||||
|
||||
echo '<tr class="list_title">';
|
||||
printf('<td class="icon"><img src="%s/%s" alt="icon" /></td>',IMGDIR,get_icon($server->getIndex(),$dndetails['dn']));
|
||||
|
||||
printf('<td colspan="2"><a href="cmd.php?cmd=template_engine&server_id=%s&dn=%s">%s</a></td>',
|
||||
$server->getIndex(),$this->template->getDNEncode(),htmlspecialchars(get_rdn($dndetails['dn'])));
|
||||
echo '</tr>';
|
||||
|
||||
printf('<tr class="list_item"><td class="blank"> </td><td class="heading">dn</td><td class="value">%s</td></tr>',
|
||||
htmlspecialchars(dn_unescape($dndetails['dn'])));
|
||||
|
||||
# Iterate over each attribute for this entry
|
||||
foreach (explode(',',$ado) as $attr) {
|
||||
$attr = strtolower($attr);
|
||||
|
||||
# Ignore DN, we've already displayed it.
|
||||
if ($attr == 'dn')
|
||||
continue;
|
||||
|
||||
if (! isset($dndetails[$attr]))
|
||||
continue;
|
||||
|
||||
# Set our object with our values
|
||||
$afattrs[$attr]->clearValue();
|
||||
|
||||
if (is_array($dndetails[$attr]))
|
||||
$afattrs[$attr]->initValue($dndetails[$attr]);
|
||||
else
|
||||
$afattrs[$attr]->initValue(array($dndetails[$attr]));
|
||||
|
||||
echo '<tr class="list_item">';
|
||||
echo '<td class="blank"> </td>';
|
||||
|
||||
echo '<td class="heading">';
|
||||
$this->draw('Name',$afattrs[$attr]);
|
||||
echo '</td>';
|
||||
|
||||
echo '<td>';
|
||||
$this->draw('CurrentValues',$afattrs[$attr]);
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
echo '<br/>';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
# Display the results.
|
||||
case 'table':
|
||||
if (! $results) {
|
||||
echo _('Search returned no results');
|
||||
|
||||
continue 2;
|
||||
}
|
||||
|
||||
printf('<form action="cmd.php" method="post" id="massform_%s">',$counter);
|
||||
echo '<div>';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$server->getIndex());
|
||||
|
||||
foreach ($this->template->resultsdata[$base]['attrs'] as $attr)
|
||||
printf('<input type="hidden" name="attrs[]" value="%s" />',$attr);
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echo '<table class="result_table" border="0">';
|
||||
|
||||
echo '<thead class="fixheader">';
|
||||
echo '<tr class="heading">';
|
||||
echo '<td> </td>';
|
||||
echo '<td> </td>';
|
||||
|
||||
foreach (explode(',',$ado) as $attr) {
|
||||
echo '<td>';
|
||||
$this->draw('Name',$afattrs[$attr]);
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
echo '</thead>';
|
||||
|
||||
echo '<tbody class="scroll">';
|
||||
foreach ($results as $dndetails) {
|
||||
$j++;
|
||||
$dndetails = array_change_key_case($dndetails);
|
||||
|
||||
# Temporarily set our DN, for rendering that leverages our DN (eg: JpegPhoto)
|
||||
$this->template->setDN($dndetails['dn']);
|
||||
|
||||
printf('<tr class="%s" id="tr_ma_%s" onclick="var cb=document.getElementById(\'ma_%s\'); cb.checked=!cb.checked;">',
|
||||
$j%2 ? 'even' : 'odd',$j,$j);
|
||||
|
||||
# Is mass action enabled.
|
||||
if ($_SESSION[APPCONFIG]->getValue('mass','enabled'))
|
||||
printf('<td><input type="checkbox" id="ma_%s" name="dn[]" value="%s" onclick="this.checked=!this.checked;" /></td>',$j,$dndetails['dn']);
|
||||
|
||||
$href = sprintf('cmd=template_engine&server_id=%s&dn=%s',$server->getIndex(),$this->template->getDNEncode());
|
||||
printf('<td class="icon"><a href="cmd.php?%s"><img src="%s/%s" alt="icon" /></a></td>',
|
||||
htmlspecialchars($href),
|
||||
IMGDIR,get_icon($server->getIndex(),$dndetails['dn']));
|
||||
|
||||
# We'll clone our attribute factory attributes, since we need to add the values to them for rendering.
|
||||
foreach (explode(',',$ado) as $attr) {
|
||||
# If the entry is blank, we'll draw an empty box and continue.
|
||||
if (! isset($dndetails[$attr])) {
|
||||
echo '<td> </td>';
|
||||
continue;
|
||||
}
|
||||
|
||||
# Special case for DNs
|
||||
if ($attr == 'dn') {
|
||||
$dn_display = strlen($dndetails['dn']) > 40
|
||||
? sprintf('<acronym title="%s">%s...</acronym>',htmlspecialchars($dndetails['dn']),htmlspecialchars(substr($dndetails['dn'],0,40)))
|
||||
: htmlspecialchars($dndetails['dn']);
|
||||
|
||||
printf('<td><a href="cmd.php?%s">%s</a></td>',htmlspecialchars($href),$dn_display);
|
||||
continue;
|
||||
}
|
||||
|
||||
# Set our object with our values
|
||||
$afattrs[$attr]->clearValue();
|
||||
if (is_array($dndetails[$attr]))
|
||||
$afattrs[$attr]->initValue($dndetails[$attr]);
|
||||
else
|
||||
$afattrs[$attr]->initValue(array($dndetails[$attr]));
|
||||
|
||||
echo '<td>';
|
||||
$this->draw('CurrentValues',$afattrs[$attr]);
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
# Is mass action enabled.
|
||||
if ($_SESSION[APPCONFIG]->getValue('mass','enabled')) {
|
||||
printf('<tr class="%s">',++$j%2 ? 'odd' : 'even');
|
||||
printf('<td><input type="checkbox" name="allbox" value="1" onclick="CheckAll(1,\'massform_\',%s);" /></td>',$counter);
|
||||
printf('<td colspan="%s">',2+count(explode(',',$ado)));
|
||||
|
||||
foreach ($mass_actions as $display => $action)
|
||||
printf('<button type="submit" name="cmd" value="%s">%s</button> ',$action,$display);
|
||||
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '</tbody>';
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
echo "\n\n";
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
printf('Have ID [%s], run this query for page [%s]',$this->template_id,$this->page);
|
||||
}
|
||||
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
echo "\n\n";
|
||||
}
|
||||
|
||||
if (get_request('format','REQUEST',false,'table') == 'table')
|
||||
printf('<script type="text/javascript" src="%sCheckAll.js"></script>',JSDIR);
|
||||
}
|
||||
|
||||
public function drawSubTitle($subtitle=null) {
|
||||
if (is_null($subtitle)) {
|
||||
$server = $this->getServer();
|
||||
|
||||
$subtitle = sprintf('%s: <b>%s</b>',_('Server'),$server->getName());
|
||||
|
||||
if ($this->template) {
|
||||
$subtitle .= '<br />';
|
||||
$subtitle .= sprintf('%s: <b>%s</b>',('Query'),$this->template->getID() != 'none' ? $this->template->getTitle() : _('Default'));
|
||||
if ($this->template->getName())
|
||||
$subtitle .= sprintf(' (<b>%s</b>)',$this->template->getName(false));
|
||||
}
|
||||
}
|
||||
|
||||
parent::drawSubTitle($subtitle);
|
||||
}
|
||||
|
||||
private function getAFattrs() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$attribute_factory = new AttributeFactory();
|
||||
$results = array();
|
||||
|
||||
foreach (explode(',',$this->template->getAttrDisplayOrder()) as $attr)
|
||||
$results[strtolower($attr)] = $attribute_factory->newAttribute($attr,array('values'=>array()),$this->getServerID());
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
private function getAjaxRef($dn) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
return preg_replace('/=/','.',base64_encode($dn));
|
||||
}
|
||||
|
||||
private function drawBaseTabs() {
|
||||
# Setup the Javascript to show/hide our DIVs.
|
||||
echo '<script type="text/javascript">';
|
||||
echo 'function items() {';
|
||||
echo 'var $items = new Array();';
|
||||
$counter = 0;
|
||||
foreach ($this->template->results as $base => $results)
|
||||
printf("items[%s] = '%s';",$counter++,$this->getAjaxRef($base));
|
||||
echo 'return items;';
|
||||
echo '}</script>';
|
||||
echo "\n\n";
|
||||
|
||||
echo '<table class="result_table" border="0">';
|
||||
echo '<tr>';
|
||||
$counter = 0;
|
||||
foreach ($this->template->results as $base => $results) {
|
||||
if (! $show = get_request('show','REQUEST'))
|
||||
$show = ($counter++ === 0 ? $this->getAjaxRef($base) : null);
|
||||
|
||||
printf('<td id="CTL%s" onclick="return ajSHOWTHIS(\'DN\',\'%s\',\'CTL\');" style="background-color: %s;">%s</td>',
|
||||
$this->getAjaxRef($base),
|
||||
$this->getAjaxRef($base),
|
||||
($show == $this->getAjaxRef($base) ? '#F0F0F0' : '#E0E0E0'),
|
||||
htmlspecialchars($base));
|
||||
}
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
echo "\n\n";
|
||||
}
|
||||
|
||||
private function drawResultsTable($base,$results) {
|
||||
$server = $this->getServer();
|
||||
|
||||
echo '<table class="result" border="0">';
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td>%s: <b>%s</b><br/><br/><div class="execution_time">(%s %s)</div></td>',_('Entries found'),
|
||||
number_format($results),$this->template->resultsdata[$base]['time'],_('seconds'));
|
||||
|
||||
if ($_SESSION[APPCONFIG]->isCommandAvailable('script','export') && $_SESSION[APPCONFIG]->isCommandAvailable('script','export_form')) {
|
||||
$href = htmlspecialchars(sprintf('cmd.php?cmd=export_form&server_id=%s&scope=%s&dn=%s&filter=%s&attributes=%s',
|
||||
$server->getIndex(),$this->template->resultsdata[$base]['scope'],
|
||||
$base,rawurlencode($this->template->resultsdata[$base]['filter']),
|
||||
rawurlencode(implode(', ',$this->template->resultsdata[$base]['attrs']))));
|
||||
|
||||
printf('<td style="text-align: right; width: 85%%"><small>[ <a href="%s"><img src="%s/save.png" alt="Save" /> %s</a> ]</small>',
|
||||
$href,IMGDIR,_('export results'));
|
||||
}
|
||||
|
||||
printf('<small>[ <img src="%s/rename.png" alt="rename" /> %s:',IMGDIR,_('Format'));
|
||||
|
||||
foreach (array('list','table') as $f) {
|
||||
echo ' ';
|
||||
|
||||
if (get_request('format','REQUEST',false,$_SESSION[APPCONFIG]->getValue('search','display')) == $f) {
|
||||
printf('<b>%s</b>',_($f));
|
||||
|
||||
} else {
|
||||
$query_string = htmlspecialchars(sprintf('%s&format=%s&show=%s&focusbase=%s',array_to_query_string($_GET,array('format','meth')),$f,$this->getAjaxRef($base),$base));
|
||||
|
||||
if (isAjaxEnabled())
|
||||
printf('<a href="cmd.php?%s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'%s\');">%s</a>',
|
||||
$query_string,$query_string,_('Loading Search'),_($f));
|
||||
else
|
||||
printf('<a href="cmd.php?%s">%s</a>',$query_string,_($f));
|
||||
}
|
||||
}
|
||||
|
||||
echo ' ]</small>';
|
||||
|
||||
echo '<br />';
|
||||
printf('<small>%s: <b>%s</b></small>',_('Base DN'),htmlspecialchars($base));
|
||||
|
||||
echo '<br />';
|
||||
printf('<small>%s: <b>%s</b></small>',_('Filter performed'),htmlspecialchars($this->template->resultsdata[$base]['filter']));
|
||||
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Classes and functions for the template engine.
|
||||
*
|
||||
* @author The phpLDAPadmin development team
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a shadow date attribute
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Templates
|
||||
*/
|
||||
class ShadowAttribute extends Attribute {
|
||||
public $shadow_before_today_attrs = array('shadowLastChange','shadowMin');
|
||||
public $shadow_after_today_attrs = array('shadowMax','shadowExpire','shadowWarning','shadowInactive');
|
||||
}
|
||||
?>
|
1571
lib/Template.php
1571
lib/Template.php
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
381
lib/createlm.php
381
lib/createlm.php
@ -1,381 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
$Id$
|
||||
|
||||
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
|
||||
Copyright (C) 2004 - 2006 Roland Gruber
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class provides functions to calculate Samba NT and LM hashes.
|
||||
*
|
||||
* The code is a conversion from createntlm.pl (Benjamin Kuit) and smbdes.c/md4.c (Andrew Tridgell).
|
||||
*
|
||||
* @author Roland Gruber
|
||||
* @package lam
|
||||
*/
|
||||
|
||||
/**
|
||||
* Calculates NT and LM hashes.
|
||||
*
|
||||
* The important functions are lmhash($password) and nthash($password).
|
||||
*
|
||||
* @package lam
|
||||
*/
|
||||
class smbHash {
|
||||
|
||||
# Contants used in lanlam hash calculations
|
||||
# Ported from SAMBA/source/libsmb/smbdes.c:perm1[56]
|
||||
private $perm1 = array(57, 49, 41, 33, 25, 17, 9,
|
||||
1, 58, 50, 42, 34, 26, 18,
|
||||
10, 2, 59, 51, 43, 35, 27,
|
||||
19, 11, 3, 60, 52, 44, 36,
|
||||
63, 55, 47, 39, 31, 23, 15,
|
||||
7, 62, 54, 46, 38, 30, 22,
|
||||
14, 6, 61, 53, 45, 37, 29,
|
||||
21, 13, 5, 28, 20, 12, 4);
|
||||
# Ported from SAMBA/source/libsmb/smbdes.c:perm2[48]
|
||||
private $perm2 = array(14, 17, 11, 24, 1, 5,
|
||||
3, 28, 15, 6, 21, 10,
|
||||
23, 19, 12, 4, 26, 8,
|
||||
16, 7, 27, 20, 13, 2,
|
||||
41, 52, 31, 37, 47, 55,
|
||||
30, 40, 51, 45, 33, 48,
|
||||
44, 49, 39, 56, 34, 53,
|
||||
46, 42, 50, 36, 29, 32);
|
||||
# Ported from SAMBA/source/libsmb/smbdes.c:perm3[64]
|
||||
private $perm3 = array(58, 50, 42, 34, 26, 18, 10, 2,
|
||||
60, 52, 44, 36, 28, 20, 12, 4,
|
||||
62, 54, 46, 38, 30, 22, 14, 6,
|
||||
64, 56, 48, 40, 32, 24, 16, 8,
|
||||
57, 49, 41, 33, 25, 17, 9, 1,
|
||||
59, 51, 43, 35, 27, 19, 11, 3,
|
||||
61, 53, 45, 37, 29, 21, 13, 5,
|
||||
63, 55, 47, 39, 31, 23, 15, 7);
|
||||
# Ported from SAMBA/source/libsmb/smbdes.c:perm4[48]
|
||||
private $perm4 = array(32, 1, 2, 3, 4, 5,
|
||||
4, 5, 6, 7, 8, 9,
|
||||
8, 9, 10, 11, 12, 13,
|
||||
12, 13, 14, 15, 16, 17,
|
||||
16, 17, 18, 19, 20, 21,
|
||||
20, 21, 22, 23, 24, 25,
|
||||
24, 25, 26, 27, 28, 29,
|
||||
28, 29, 30, 31, 32, 1);
|
||||
# Ported from SAMBA/source/libsmb/smbdes.c:perm5[32]
|
||||
private $perm5 = array(16, 7, 20, 21,
|
||||
29, 12, 28, 17,
|
||||
1, 15, 23, 26,
|
||||
5, 18, 31, 10,
|
||||
2, 8, 24, 14,
|
||||
32, 27, 3, 9,
|
||||
19, 13, 30, 6,
|
||||
22, 11, 4, 25);
|
||||
# Ported from SAMBA/source/libsmb/smbdes.c:perm6[64]
|
||||
private $perm6 = array(40, 8, 48, 16, 56, 24, 64, 32,
|
||||
39, 7, 47, 15, 55, 23, 63, 31,
|
||||
38, 6, 46, 14, 54, 22, 62, 30,
|
||||
37, 5, 45, 13, 53, 21, 61, 29,
|
||||
36, 4, 44, 12, 52, 20, 60, 28,
|
||||
35, 3, 43, 11, 51, 19, 59, 27,
|
||||
34, 2, 42, 10, 50, 18, 58, 26,
|
||||
33, 1, 41, 9, 49, 17, 57, 25);
|
||||
# Ported from SAMBA/source/libsmb/smbdes.c:sc[16]
|
||||
private $sc = array(1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1);
|
||||
# Ported from SAMBA/source/libsmb/smbdes.c:sbox[8][4][16]
|
||||
# Side note, I used cut and paste for all these numbers, I did NOT
|
||||
# type them all in =)
|
||||
private $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7),
|
||||
array( 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8),
|
||||
array( 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0),
|
||||
array(15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13)),
|
||||
array(array(15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10),
|
||||
array( 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5),
|
||||
array( 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15),
|
||||
array(13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9)),
|
||||
array(array(10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8),
|
||||
array(13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1),
|
||||
array(13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7),
|
||||
array( 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12)),
|
||||
array(array( 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15),
|
||||
array(13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9),
|
||||
array(10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4),
|
||||
array( 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14)),
|
||||
array(array( 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9),
|
||||
array(14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6),
|
||||
array( 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14),
|
||||
array(11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3)),
|
||||
array(array(12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11),
|
||||
array(10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8),
|
||||
array( 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6),
|
||||
array( 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13)),
|
||||
array(array( 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1),
|
||||
array(13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6),
|
||||
array( 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2),
|
||||
array( 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12)),
|
||||
array(array(13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7),
|
||||
array( 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2),
|
||||
array( 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8),
|
||||
array( 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11)));
|
||||
|
||||
/**
|
||||
* Fixes too large numbers
|
||||
*/
|
||||
private function x($i) {
|
||||
if ($i < 0) return 4294967296 - $i;
|
||||
else return $i;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer count
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
private function lshift($count, $data) {
|
||||
$ret = array();
|
||||
for ($i = 0; $i < sizeof($data); $i++) {
|
||||
$ret[$i] = $data[($i + $count)%sizeof($data)];
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array in input data
|
||||
* @param array p permutation
|
||||
* @return array
|
||||
*/
|
||||
private function permute($in, $p, $n) {
|
||||
$ret = array();
|
||||
for ($i = 0; $i < $n; $i++) {
|
||||
$ret[$i] = $in[$p[$i] - 1]?1:0;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $in1
|
||||
* @param array $in2
|
||||
* @return array
|
||||
*/
|
||||
private function mxor($in1, $in2) {
|
||||
$ret = array();
|
||||
for ($i = 0; $i < sizeof($in1); $i++) {
|
||||
$ret[$i] = $in1[$i] ^ $in2[$i];
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $in
|
||||
* @param array $key
|
||||
* @param boolean $forw
|
||||
* @return array
|
||||
*/
|
||||
function doHash($in, $key, $forw) {
|
||||
$ki = array();
|
||||
|
||||
$pk1 = $this->permute($key, $this->perm1, 56);
|
||||
|
||||
$c = array();
|
||||
$d = array();
|
||||
for ($i = 0; $i < 28; $i++) {
|
||||
$c[$i] = $pk1[$i];
|
||||
$d[$i] = $pk1[28 + $i];
|
||||
}
|
||||
|
||||
for ($i = 0; $i < 16; $i++) {
|
||||
$c = $this->lshift($this->sc[$i], $c);
|
||||
$d = $this->lshift($this->sc[$i], $d);
|
||||
|
||||
$cd = $c;
|
||||
for ($k = 0; $k < sizeof($d); $k++) $cd[] = $d[$k];
|
||||
$ki[$i] = $this->permute($cd, $this->perm2, 48);
|
||||
}
|
||||
|
||||
$pd1 = $this->permute($in, $this->perm3, 64);
|
||||
|
||||
$l = array();
|
||||
$r = array();
|
||||
for ($i = 0; $i < 32; $i++) {
|
||||
$l[$i] = $pd1[$i];
|
||||
$r[$i] = $pd1[32 + $i];
|
||||
}
|
||||
|
||||
for ($i = 0; $i < 16; $i++) {
|
||||
$er = $this->permute($r, $this->perm4, 48);
|
||||
if ($forw) $erk = $this->mxor($er, $ki[$i]);
|
||||
else $erk = $this->mxor($er, $ki[15 - $i]);
|
||||
|
||||
for ($j = 0; $j < 8; $j++) {
|
||||
for ($k = 0; $k < 6; $k++) {
|
||||
$b[$j][$k] = $erk[($j * 6) + $k];
|
||||
}
|
||||
}
|
||||
for ($j = 0; $j < 8; $j++) {
|
||||
$m = array();
|
||||
$n = array();
|
||||
$m = ($b[$j][0] << 1) | $b[$j][5];
|
||||
$n = ($b[$j][1] << 3) | ($b[$j][2] << 2) | ($b[$j][3] << 1) | $b[$j][4];
|
||||
|
||||
for ($k = 0; $k < 4; $k++) {
|
||||
$b[$j][$k]=($this->sbox[$j][$m][$n] & (1 << (3-$k)))?1:0;
|
||||
}
|
||||
}
|
||||
|
||||
for ($j = 0; $j < 8; $j++) {
|
||||
for ($k = 0; $k < 4; $k++) {
|
||||
$cb[($j * 4) + $k] = $b[$j][$k];
|
||||
}
|
||||
}
|
||||
$pcb = $this->permute($cb, $this->perm5, 32);
|
||||
$r2 = $this->mxor($l, $pcb);
|
||||
for ($k = 0; $k < 32; $k++) $l[$k] = $r[$k];
|
||||
for ($k = 0; $k < 32; $k++) $r[$k] = $r2[$k];
|
||||
}
|
||||
$rl = $r;
|
||||
for ($i = 0; $i < sizeof($l); $i++) $rl[] = $l[$i];
|
||||
return $this->permute($rl, $this->perm6, 64);
|
||||
}
|
||||
|
||||
/**
|
||||
* str_to_key
|
||||
*
|
||||
* @param string $str
|
||||
* @return string key
|
||||
*/
|
||||
private function str_to_key($str) {
|
||||
$key[0] = $this->unsigned_shift_r($str[0], 1);
|
||||
$key[1] = (($str[0]&0x01)<<6) | $this->unsigned_shift_r($str[1], 2);
|
||||
$key[2] = (($str[1]&0x03)<<5) | $this->unsigned_shift_r($str[2], 3);
|
||||
$key[3] = (($str[2]&0x07)<<4) | $this->unsigned_shift_r($str[3], 4);
|
||||
$key[4] = (($str[3]&0x0F)<<3) | $this->unsigned_shift_r($str[4], 5);
|
||||
$key[5] = (($str[4]&0x1F)<<2) | $this->unsigned_shift_r($str[5], 6);
|
||||
$key[6] = (($str[5]&0x3F)<<1) | $this->unsigned_shift_r($str[6], 7);
|
||||
$key[7] = $str[6]&0x7F;
|
||||
for ($i = 0; $i < 8; $i++) {
|
||||
$key[$i] = ($key[$i] << 1);
|
||||
}
|
||||
return $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* smb_hash
|
||||
*
|
||||
* @param unknown_type $in
|
||||
* @param unknown_type $key
|
||||
* @param unknown_type $forw
|
||||
* @return unknown
|
||||
*/
|
||||
private function smb_hash($in, $key, $forw){
|
||||
$key2 = $this->str_to_key($key);
|
||||
|
||||
for ($i = 0; $i < 64; $i++) {
|
||||
$inb[$i] = ($in[$i/8] & (1<<(7-($i%8)))) ? 1:0;
|
||||
$keyb[$i] = ($key2[$i/8] & (1<<(7-($i%8)))) ? 1:0;
|
||||
$outb[$i] = 0;
|
||||
}
|
||||
$outb = $this->doHash($inb, $keyb, $forw);
|
||||
for ($i = 0; $i < 8; $i++) {
|
||||
$out[$i] = 0;
|
||||
}
|
||||
for ($i = 0; $i < 64; $i++) {
|
||||
if ( $outb[$i] ) {
|
||||
$out[$i/8] |= (1<<(7-($i%8)));
|
||||
}
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* E_P16
|
||||
*
|
||||
* @param unknown_type $in
|
||||
* @return unknown
|
||||
*/
|
||||
private function E_P16($in) {
|
||||
$p14 = array_values(unpack("C*",$in));
|
||||
$sp8 = array(0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25);
|
||||
$p14_1 = array();
|
||||
$p14_2 = array();
|
||||
for ($i = 0; $i < 7; $i++) {
|
||||
$p14_1[$i] = $p14[$i];
|
||||
$p14_2[$i] = $p14[$i + 7];
|
||||
}
|
||||
$p16_1 = $this->smb_hash($sp8, $p14_1, true);
|
||||
$p16_2 = $this->smb_hash($sp8, $p14_2, true);
|
||||
$p16 = $p16_1;
|
||||
for ($i = 0; $i < sizeof($p16_2); $i++) {
|
||||
$p16[] = $p16_2[$i];
|
||||
}
|
||||
return $p16;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the LM hash of a given password.
|
||||
*
|
||||
* @param string $password password
|
||||
* @return string hash value
|
||||
*/
|
||||
public function lmhash($password = "") {
|
||||
$password = strtoupper($password);
|
||||
$password = substr($password,0,14);
|
||||
$password = str_pad($password, 14, chr(0));
|
||||
$p16 = $this->E_P16($password);
|
||||
for ($i = 0; $i < sizeof($p16); $i++) {
|
||||
$p16[$i] = sprintf("%02X", $p16[$i]);
|
||||
}
|
||||
return join("", $p16);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the NT hash of a given password.
|
||||
*
|
||||
* @param string $password password
|
||||
* @return string hash value
|
||||
*/
|
||||
public function nthash($password = "") {
|
||||
if (function_exists('mhash'))
|
||||
if (defined('MHASH_MD4'))
|
||||
return strtoupper(bin2hex(mhash(MHASH_MD4,iconv('UTF-8','UTF-16LE',$password))));
|
||||
else
|
||||
return strtoupper(hash('md4', iconv("UTF-8","UTF-16LE",$password)));
|
||||
else
|
||||
error(_('Your PHP install does not have the mhash() function. Cannot do hashes.'),'error','index.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsigned shift operation for 32bit values.
|
||||
*
|
||||
* PHP 4 only supports signed shifts by default.
|
||||
*/
|
||||
private function unsigned_shift_r($a, $b) {
|
||||
$z = 0x80000000;
|
||||
if ($z & $a) {
|
||||
$a = ($a >> 1);
|
||||
$a &= (~$z);
|
||||
$a |= 0x40000000;
|
||||
$a = ($a >> ($b - 1));
|
||||
}
|
||||
else {
|
||||
$a = ($a >> $b);
|
||||
}
|
||||
return $a;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
735
lib/ds.php
735
lib/ds.php
@ -1,735 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Classes and functions for communication of Data Stores
|
||||
*
|
||||
* @author The phpLDAPadmin development team
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* This abstract class provides the basic variables and methods.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage DataStore
|
||||
*/
|
||||
abstract class DS {
|
||||
# ID of this db.
|
||||
protected $index;
|
||||
|
||||
# Configuration paramters.
|
||||
protected $default;
|
||||
protected $custom;
|
||||
protected $type;
|
||||
|
||||
abstract function __construct($index);
|
||||
|
||||
/**
|
||||
* This will make the connection to the datasource
|
||||
*/
|
||||
abstract protected function connect($method,$debug=false);
|
||||
|
||||
/**
|
||||
* Login to the datastore
|
||||
* method: default = anon, connect to ds using bind_id not auth_id.
|
||||
* method: 'user', connect with auth_id
|
||||
* method: '<freetext>', any custom extra connection to ds.
|
||||
*/
|
||||
abstract public function login($user=null,$pass=null,$method=null);
|
||||
|
||||
/**
|
||||
* Query the datasource
|
||||
*/
|
||||
abstract public function query($query,$method,$index=null,$debug=false);
|
||||
|
||||
/**
|
||||
* Return error details from previous operation
|
||||
*/
|
||||
abstract protected function getErrorMessage();
|
||||
abstract protected function getErrorNum();
|
||||
|
||||
/**
|
||||
* Functions that set and verify object configuration details
|
||||
*/
|
||||
public function setDefaults($defaults) {
|
||||
foreach ($defaults as $key => $details)
|
||||
foreach ($details as $setting => $value)
|
||||
$this->default->{$key}[$setting] = $value;
|
||||
}
|
||||
|
||||
public function isDefaultKey($key) {
|
||||
return isset($this->default->$key);
|
||||
}
|
||||
|
||||
public function isDefaultSetting($key,$setting) {
|
||||
return array_key_exists($setting,$this->default->{$key});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a configuration value
|
||||
*/
|
||||
public function getValue($key,$setting,$fatal=true) {
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,1,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if (isset($this->custom->{$key}[$setting]))
|
||||
return $this->custom->{$key}[$setting];
|
||||
|
||||
elseif (isset($this->default->{$key}[$setting]) && array_key_exists('default',$this->default->{$key}[$setting]))
|
||||
return $this->default->{$key}[$setting]['default'];
|
||||
|
||||
elseif ($fatal)
|
||||
debug_dump_backtrace("Error trying to get a non-existant value ($key,$setting)",1);
|
||||
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a configuration value
|
||||
*/
|
||||
public function setValue($key,$setting,$value) {
|
||||
if (isset($this->custom->{$key}[$setting]))
|
||||
system_message(array(
|
||||
'title'=>_('Configuration setting already defined.'),
|
||||
'body'=>sprintf('A call has been made to reset a configuration value (%s,%s,%s)',
|
||||
$key,$setting,$value),
|
||||
'type'=>'info'));
|
||||
|
||||
$this->custom->{$key}[$setting] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the untested config items
|
||||
*/
|
||||
public function untested() {
|
||||
$result = array();
|
||||
|
||||
foreach ($this->default as $option => $details)
|
||||
foreach ($details as $param => $values)
|
||||
if (isset($values['untested']) && $values['untested'])
|
||||
array_push($result,sprintf('%s.%s',$option,$param));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of this datastore
|
||||
*/
|
||||
public function getName() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
return $this->getValue('server','name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Functions that enable login and logout of the application
|
||||
*/
|
||||
/**
|
||||
* Return the authentication type for this object
|
||||
*/
|
||||
public function getAuthType() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
switch ($this->getValue('login','auth_type')) {
|
||||
case 'cookie':
|
||||
case 'config':
|
||||
case 'http':
|
||||
case 'proxy':
|
||||
case 'session':
|
||||
case 'sasl':
|
||||
return $this->getValue('login','auth_type');
|
||||
|
||||
default:
|
||||
die(sprintf('Error: <b>%s</b> hasnt been configured for auth_type <b>%s</b>',__METHOD__,
|
||||
$this->getValue('login','auth_type')));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the login name of the user logged into this datastore's connection method
|
||||
* If this returns null, we are not logged in.
|
||||
* If this returns '', we are logged in with anonymous
|
||||
*/
|
||||
public function getLogin($method=null) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$method = $this->getMethod($method);
|
||||
|
||||
# For anonymous binds
|
||||
if ($method == 'anon')
|
||||
if (isset($_SESSION['USER'][$this->index][$method]['name']))
|
||||
return '';
|
||||
else
|
||||
return null;
|
||||
|
||||
switch ($this->getAuthType()) {
|
||||
case 'cookie':
|
||||
if (! isset($_COOKIE[$method.'-USER']))
|
||||
# If our bind_id is set, we'll pass that back for logins.
|
||||
return (! is_null($this->getValue('login','bind_id')) && $method == 'login') ? $this->getValue('login','bind_id') : null;
|
||||
else
|
||||
return blowfish_decrypt($_COOKIE[$method.'-USER']);
|
||||
|
||||
case 'config':
|
||||
if (! isset($_SESSION['USER'][$this->index][$method]['name']))
|
||||
return $this->getValue('login','bind_id');
|
||||
else
|
||||
return blowfish_decrypt($_SESSION['USER'][$this->index][$method]['name']);
|
||||
|
||||
case 'proxy':
|
||||
if (! isset($_SESSION['USER'][$this->index][$method]['proxy']))
|
||||
return $this->getValue('login','bind_id');
|
||||
else
|
||||
return blowfish_decrypt($_SESSION['USER'][$this->index][$method]['proxy']);
|
||||
|
||||
case 'http':
|
||||
case 'session':
|
||||
case 'sasl':
|
||||
if (! isset($_SESSION['USER'][$this->index][$method]['name']))
|
||||
# If our bind_id is set, we'll pass that back for logins.
|
||||
return (! is_null($this->getValue('login','bind_id')) && $method == 'login') ? $this->getValue('login','bind_id') : null;
|
||||
else
|
||||
return blowfish_decrypt($_SESSION['USER'][$this->index][$method]['name']);
|
||||
|
||||
default:
|
||||
die(sprintf('Error: %s hasnt been configured for auth_type %s',__METHOD__,$this->getAuthType()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the login details of the user logged into this datastore's connection method
|
||||
*/
|
||||
protected function setLogin($user,$pass,$method=null) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$method = $this->getMethod($method);
|
||||
|
||||
switch ($this->getAuthType()) {
|
||||
case 'cookie':
|
||||
set_cookie($method.'-USER',blowfish_encrypt($user),NULL,'/');
|
||||
set_cookie($method.'-PASS',blowfish_encrypt($pass),NULL,'/');
|
||||
return true;
|
||||
|
||||
case 'config':
|
||||
return true;
|
||||
|
||||
case 'proxy':
|
||||
if (isset($_SESSION['USER'][$this->index][$method]['proxy']))
|
||||
unset($_SESSION['USER'][$this->index][$method]['proxy']);
|
||||
|
||||
case 'http':
|
||||
case 'session':
|
||||
case 'sasl':
|
||||
$_SESSION['USER'][$this->index][$method]['name'] = blowfish_encrypt($user);
|
||||
$_SESSION['USER'][$this->index][$method]['pass'] = blowfish_encrypt($pass);
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
die(sprintf('Error: %s hasnt been configured for auth_type %s',__METHOD__,$this->getAuthType()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the login password of the user logged into this datastore's connection method
|
||||
*/
|
||||
protected function getPassword($method=null) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$method = $this->getMethod($method);
|
||||
|
||||
# For anonymous binds
|
||||
if ($method == 'anon')
|
||||
if (isset($_SESSION['USER'][$this->index][$method]['name']))
|
||||
return '';
|
||||
else
|
||||
return null;
|
||||
|
||||
switch ($this->getAuthType()) {
|
||||
case 'cookie':
|
||||
if (! isset($_COOKIE[$method.'-PASS']))
|
||||
# If our bind_id is set, we'll pass that back for logins.
|
||||
return (! is_null($this->getValue('login','bind_pass')) && $method == 'login') ? $this->getValue('login','bind_pass') : null;
|
||||
else
|
||||
return blowfish_decrypt($_COOKIE[$method.'-PASS']);
|
||||
|
||||
case 'config':
|
||||
case 'proxy':
|
||||
if (! isset($_SESSION['USER'][$this->index][$method]['pass']))
|
||||
return $this->getValue('login','bind_pass');
|
||||
else
|
||||
return blowfish_decrypt($_SESSION['USER'][$this->index][$method]['pass']);
|
||||
|
||||
case 'http':
|
||||
case 'session':
|
||||
case 'sasl':
|
||||
if (! isset($_SESSION['USER'][$this->index][$method]['pass']))
|
||||
# If our bind_pass is set, we'll pass that back for logins.
|
||||
return (! is_null($this->getValue('login','bind_pass')) && $method == 'login') ? $this->getValue('login','bind_pass') : null;
|
||||
else
|
||||
return blowfish_decrypt($_SESSION['USER'][$this->index][$method]['pass']);
|
||||
|
||||
default:
|
||||
die(sprintf('Error: %s hasnt been configured for auth_type %s',__METHOD__,$this->getAuthType()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if this datastore's connection method has been logged into
|
||||
*/
|
||||
public function isLoggedIn($method=null) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
static $CACHE = array();
|
||||
|
||||
$method = $this->getMethod($method);
|
||||
|
||||
if (isset($CACHE[$this->index][$method]) && ! is_null($CACHE[$this->index][$method]))
|
||||
return $CACHE[$this->index][$method];
|
||||
|
||||
$CACHE[$this->index][$method] = null;
|
||||
|
||||
# For some authentication types, we need to do the login here
|
||||
switch ($this->getAuthType()) {
|
||||
case 'config':
|
||||
if (! $CACHE[$this->index][$method] = $this->login($this->getLogin($method),$this->getPassword($method),$method))
|
||||
system_message(array(
|
||||
'title'=>_('Unable to login.'),
|
||||
'body'=>_('Your configuration file has authentication set to CONFIG based authentication, however, the userid/password failed to login'),
|
||||
'type'=>'error'));
|
||||
|
||||
break;
|
||||
|
||||
case 'http':
|
||||
# If our auth vars are not set, throw up a login box.
|
||||
if (! isset($_SERVER['PHP_AUTH_USER'])) {
|
||||
# If this server is not in focus, skip the basic auth prompt.
|
||||
if (get_request('server_id','REQUEST') != $this->getIndex()) {
|
||||
$CACHE[$this->index][$method] = false;
|
||||
break;
|
||||
}
|
||||
|
||||
header(sprintf('WWW-Authenticate: Basic realm="%s %s"',app_name(),_('login')));
|
||||
|
||||
if ($_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.0')
|
||||
header('HTTP/1.0 401 Unauthorized'); // http 1.0 method
|
||||
else
|
||||
header('Status: 401 Unauthorized'); // http 1.1 method
|
||||
|
||||
# If we still dont have login details...
|
||||
if (! isset($_SERVER['PHP_AUTH_USER'])) {
|
||||
system_message(array(
|
||||
'title'=>_('Unable to login.'),
|
||||
'body'=>_('Your configuration file has authentication set to HTTP based authentication, however, there was none presented'),
|
||||
'type'=>'error'));
|
||||
|
||||
$CACHE[$this->index][$method] = false;
|
||||
}
|
||||
|
||||
# Check our auth vars are valid.
|
||||
} else {
|
||||
if (! $this->login($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW'],$method)) {
|
||||
system_message(array(
|
||||
'title'=>_('Unable to login.'),
|
||||
'body'=>_('Your HTTP based authentication is not accepted by the LDAP server'),
|
||||
'type'=>'error'));
|
||||
|
||||
$CACHE[$this->index][$method] = false;
|
||||
|
||||
} else
|
||||
$CACHE[$this->index][$method] = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'proxy':
|
||||
$CACHE[$this->index][$method] = $this->login($this->getValue('login','bind_id'),$this->getValue('login','bind_pass'),$method);
|
||||
|
||||
break;
|
||||
|
||||
case 'sasl':
|
||||
# Propogate any given Kerberos credential cache location
|
||||
if (isset($_ENV['REDIRECT_KRB5CCNAME']))
|
||||
putenv(sprintf('KRB5CCNAME=%s',$_ENV['REDIRECT_KRB5CCNAME']));
|
||||
elseif (isset($_SERVER['KRB5CCNAME']))
|
||||
putenv(sprintf('KRB5CCNAME=%s',$_SERVER['KRB5CCNAME']));
|
||||
|
||||
# Map the SASL auth ID to a DN
|
||||
$regex = $this->getValue('login', 'sasl_dn_regex');
|
||||
$replacement = $this->getValue('login', 'sasl_dn_replacement');
|
||||
|
||||
if ($regex && $replacement) {
|
||||
$userDN = preg_replace($regex, $replacement, $_SERVER['REMOTE_USER']);
|
||||
|
||||
$CACHE[$this->index][$method] = $this->login($userDN, '', $method);
|
||||
|
||||
# Otherwise, use the user name as is
|
||||
# For GSSAPI Authentication + mod_auth_kerb and Basic Authentication
|
||||
} else
|
||||
$CACHE[$this->index][$method] = $this->login(isset($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'] : '', '', $method);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$CACHE[$this->index][$method] = is_null($this->getLogin($method)) ? false : true;
|
||||
}
|
||||
|
||||
return $CACHE[$this->index][$method];
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout of this datastore's connection method
|
||||
*/
|
||||
public function logout($method=null) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$method = $this->getMethod($method);
|
||||
|
||||
unset ($_SESSION['cache'][$this->index]);
|
||||
|
||||
switch ($this->getAuthType()) {
|
||||
case 'cookie':
|
||||
set_cookie($method.'-USER','',time()-3600,'/');
|
||||
set_cookie($method.'-PASS','',time()-3600,'/');
|
||||
|
||||
case 'config':
|
||||
return true;
|
||||
|
||||
case 'http':
|
||||
case 'proxy':
|
||||
case 'session':
|
||||
case 'sasl':
|
||||
if (isset($_SESSION['USER'][$this->index][$method]))
|
||||
unset($_SESSION['USER'][$this->index][$method]);
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
die(sprintf('Error: %s hasnt been configured for auth_type %s',__METHOD__,$this->getAuthType()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Functions that return the condition of the datasource
|
||||
*/
|
||||
public function isVisible() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
return $this->getValue('server','visible');
|
||||
}
|
||||
|
||||
public function isReadOnly() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if (! trim($this->getLogin(null)) && $_SESSION[APPCONFIG]->getValue('appearance','anonymous_bind_implies_read_only'))
|
||||
return true;
|
||||
else
|
||||
return $this->getValue('server','read_only');
|
||||
}
|
||||
|
||||
public function getIndex() {
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->index);
|
||||
|
||||
return $this->index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Work out which connection method to use.
|
||||
* If a method is passed, then it will be passed back. If no method is passed, then we'll
|
||||
* check to see if the user is logged in. If they are, then 'user' is used, otherwise
|
||||
* 'anon' is used.
|
||||
*
|
||||
* @param int Server ID
|
||||
* @return string Connection Method
|
||||
*/
|
||||
protected function getMethod($method=null) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
static $CACHE = array();
|
||||
|
||||
# Immediately return if method is set.
|
||||
if (! is_null($method))
|
||||
return $method;
|
||||
|
||||
# If we have been here already, then return our result
|
||||
if (isset($CACHE[$this->index]) && ! is_null($CACHE))
|
||||
return $CACHE[$this->index];
|
||||
|
||||
$CACHE[$this->index] = 'anon';
|
||||
|
||||
if ($this->isLoggedIn('user'))
|
||||
$CACHE[$this->index] = 'user';
|
||||
|
||||
return $CACHE[$this->index];
|
||||
}
|
||||
|
||||
/**
|
||||
* This method should be overridden in application specific ds files
|
||||
*/
|
||||
public function isSessionValid() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,1,__FILE__,__LINE__,__METHOD__,$fargs,true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the time left in seconds until this connection times out. If there is not timeout,
|
||||
* this function will return null.
|
||||
*/
|
||||
public function inactivityTime() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if ($this->isLoggedIn() && ! in_array($this->getAuthType(),array('config','http')))
|
||||
return time()+($this->getValue('login','timeout')*60);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The list of database sources
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage DataStore
|
||||
*/
|
||||
class Datastore {
|
||||
# Out DS index id
|
||||
private $index;
|
||||
# List of all the objects
|
||||
private $objects = array();
|
||||
# Default settings
|
||||
private $default;
|
||||
|
||||
public function __construct() {
|
||||
$this->default = new StdClass;
|
||||
|
||||
$this->default->server['id'] = array(
|
||||
'desc'=>'Server ID',
|
||||
'default'=>null);
|
||||
|
||||
$this->default->server['name'] = array(
|
||||
'desc'=>'Server name',
|
||||
'default'=>null);
|
||||
|
||||
# Connectivity Info
|
||||
$this->default->server['host'] = array(
|
||||
'desc'=>'Host Name',
|
||||
'default'=>'127.0.0.1');
|
||||
|
||||
$this->default->server['port'] = array(
|
||||
'desc'=>'Port Number',
|
||||
'default'=>null);
|
||||
|
||||
# Read or write only access
|
||||
$this->default->server['read_only'] = array(
|
||||
'desc'=>'Server is in READ ONLY mode',
|
||||
'default'=>false);
|
||||
|
||||
$this->default->server['visible'] = array(
|
||||
'desc'=>'Whether this server is visible',
|
||||
'default'=>true);
|
||||
|
||||
$this->default->server['hide_noaccess_base'] = array(
|
||||
'desc'=>'If base DNs are not accessible, hide them instead of showing create',
|
||||
'default'=>false);
|
||||
|
||||
# Authentication Information
|
||||
$this->default->login['auth_type'] = array(
|
||||
'desc'=>'Authentication Type',
|
||||
'default'=>'session');
|
||||
|
||||
/*
|
||||
/* ID to login to this application, this assumes that there is
|
||||
* application authentication on top of authentication required to
|
||||
* access the data source **
|
||||
$this->default->login['auth_id'] = array(
|
||||
'desc'=>'User Login ID to login to this DS',
|
||||
'untested'=>true,
|
||||
'default'=>null);
|
||||
|
||||
$this->default->login['auth_pass'] = array(
|
||||
'desc'=>'User Login Password to login to this DS',
|
||||
'untested'=>true,
|
||||
'default'=>null);
|
||||
*/
|
||||
|
||||
$this->default->login['auth_text'] = array(
|
||||
'desc'=>'Text to show at the login prompt',
|
||||
'default'=>null);
|
||||
|
||||
$this->default->login['bind_id'] = array(
|
||||
'desc'=>'User Login ID to bind to this DS',
|
||||
'default'=>null);
|
||||
|
||||
$this->default->login['bind_dn_template'] = array(
|
||||
'desc'=>'Template string for user login DN to bind to this DS. Use \'%s\' where user input should be inserted.',
|
||||
'default'=>null);
|
||||
|
||||
$this->default->login['bind_pass'] = array(
|
||||
'desc'=>'User Login Password to bind to this DS',
|
||||
'default'=>null);
|
||||
|
||||
$this->default->login['timeout'] = array(
|
||||
'desc'=>'Session timout in seconds',
|
||||
'default'=>session_cache_expire()-1);
|
||||
|
||||
$this->default->login['sasl_dn_regex'] = array(
|
||||
'desc'=>'SASL authorization id to user dn PCRE regular expression',
|
||||
'untested'=>true,
|
||||
'default'=>null);
|
||||
|
||||
$this->default->login['sasl_dn_replacement'] = array(
|
||||
'desc'=>'SASL authorization id to user dn PCRE regular expression replacement string',
|
||||
'untested'=>true,
|
||||
'default'=>null);
|
||||
|
||||
# Prefix for custom pages
|
||||
$this->default->custom['pages_prefix'] = array(
|
||||
'desc'=>'Prefix name for custom pages',
|
||||
'default'=>'custom_');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new database object
|
||||
*/
|
||||
public function newServer($type) {
|
||||
if (class_exists($type)) {
|
||||
$this->index = count($this->objects)+1;
|
||||
$this->objects[$this->index] = new $type($this->index);
|
||||
|
||||
$this->objects[$this->index]->setDefaults($this->default);
|
||||
return $this->index;
|
||||
|
||||
} else {
|
||||
printf('ERROR: Class [%s] doesnt exist',$type);
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set values for a database object.
|
||||
*/
|
||||
public function setValue($key,$setting,$value) {
|
||||
if (! $this->objects[$this->index]->isDefaultKey($key))
|
||||
error("ERROR: Setting a key [$key] that isnt predefined.",'error',true);
|
||||
|
||||
if (! $this->objects[$this->index]->isDefaultSetting($key,$setting))
|
||||
error("ERROR: Setting a index [$key,$setting] that isnt predefined.",'error',true);
|
||||
|
||||
# Test if its should be an array or not.
|
||||
if (is_array($this->objects[$this->index]->getValue($key,$setting)) && ! is_array($value))
|
||||
error("Error in configuration file, {$key}['$setting'] SHOULD be an array of values.",'error',true);
|
||||
|
||||
if (! is_array($this->objects[$this->index]->getValue($key,$setting)) && is_array($value))
|
||||
error("Error in configuration file, {$key}['$setting'] should NOT be an array of values.",'error',true);
|
||||
|
||||
# Store the value in the object.
|
||||
$this->objects[$this->index]->setValue($key,$setting,$value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all the configured servers.
|
||||
*
|
||||
* @param boolean Only show visible servers.
|
||||
* @return array list of all configured servers.
|
||||
*/
|
||||
public function getServerList($isVisible=true) {
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
static $CACHE;
|
||||
|
||||
if (isset($CACHE[$isVisible]))
|
||||
return $CACHE[$isVisible];
|
||||
|
||||
$CACHE[$isVisible] = array();
|
||||
|
||||
# Debugging incase objects is not set.
|
||||
if (! $this->objects) {
|
||||
print "<PRE>";
|
||||
debug_print_backtrace();
|
||||
die();
|
||||
}
|
||||
|
||||
foreach ($this->objects as $id => $server)
|
||||
if (! $isVisible || ($isVisible && $server->getValue('server','visible')))
|
||||
$CACHE[$isVisible][$id] = $server;
|
||||
|
||||
masort($CACHE[$isVisible],'name');
|
||||
|
||||
return $CACHE[$isVisible];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an object Instance of a configured database.
|
||||
*
|
||||
* @param int Index
|
||||
* @return object Datastore instance object.
|
||||
*/
|
||||
public function Instance($index=null) {
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# If no index defined, then pick the lowest one.
|
||||
if (is_null($index) || ! trim($index) || ! is_numeric($index))
|
||||
$index = min($this->GetServerList())->getIndex();
|
||||
|
||||
if (! isset($this->objects[$index]))
|
||||
debug_dump_backtrace(sprintf('Error: Datastore instance [%s] doesnt exist?',htmlspecialchars($index)),1);
|
||||
|
||||
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
|
||||
debug_log('Returning instance of database (%s)',3,0,__FILE__,__LINE__,__METHOD__,$index);
|
||||
|
||||
return $this->objects[$index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an object Instance of a configured database.
|
||||
*
|
||||
* @param string Name of the instance to retrieve
|
||||
* @return object Datastore instance object.
|
||||
*/
|
||||
public function InstanceName($name=null) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
foreach ($this->getServerList(false) as $index)
|
||||
if ($this->objects[$index]->getName() == $name)
|
||||
return $this->objects[$index];
|
||||
|
||||
# If we get here, then no object with the name exists.
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an object Instance of a configured database.
|
||||
*
|
||||
* @param string ID of the instance to retrieve
|
||||
* @return object Datastore instance object.
|
||||
*/
|
||||
public function InstanceId($id=null) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
foreach ($this->getServerList(false) as $index)
|
||||
if ($this->objects[$index->getIndex()]->getValue('server','id') == $id)
|
||||
return $this->objects[$index->getIndex()];
|
||||
|
||||
# If we get here, then no object with the name exists.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
?>
|
1581
lib/ds_ldap.php
1581
lib/ds_ldap.php
File diff suppressed because it is too large
Load Diff
@ -1,677 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Classes and functions for communication of Data Stores
|
||||
*
|
||||
* @author The phpLDAPadmin development team
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* This abstract class provides variables and methods for LDAP datastores for use by PLA.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage DataStore
|
||||
*/
|
||||
class ldap_pla extends ldap {
|
||||
function __construct($index) {
|
||||
parent::__construct($index);
|
||||
|
||||
$this->default->appearance['pla_password_hash'] = array(
|
||||
'desc'=>'Default HASH to use for passwords',
|
||||
'default'=>'md5');
|
||||
|
||||
$this->default->appearance['show_create'] = array(
|
||||
'desc'=>'Whether to show the "Create new Entry here" in the tree browser',
|
||||
'default'=>true);
|
||||
|
||||
$this->default->appearance['open_tree'] = array(
|
||||
'desc'=>'Whether to initially open each tree',
|
||||
'default'=>false);
|
||||
|
||||
$this->default->appearance['show_authz'] = array(
|
||||
'desc'=>'Enable display of authorization ID as login',
|
||||
'default'=>false);
|
||||
|
||||
$this->default->login['fallback_dn'] = array(
|
||||
'desc'=>'If the attribute base login fails, see if a DN was entered',
|
||||
'default'=>false);
|
||||
|
||||
$this->default->query['disable_default'] = array(
|
||||
'desc'=>'Configuration to disable the default query template',
|
||||
'default'=>false);
|
||||
|
||||
$this->default->query['custom_only'] = array(
|
||||
'desc'=>'Configuration to force the usage of custom query templates',
|
||||
'default'=>false);
|
||||
|
||||
$this->default->server['branch_rename'] = array(
|
||||
'desc'=>'Enable renaming of branches',
|
||||
'default'=>false);
|
||||
|
||||
$this->default->server['custom_attrs'] = array(
|
||||
'desc'=>'Custom operational attributes to be treated as regular attributes',
|
||||
'default'=>array(''));
|
||||
|
||||
$this->default->server['custom_sys_attrs'] = array(
|
||||
'desc'=>'Custom operational attributes to be treated as internal attributes',
|
||||
'default'=>array('+'));
|
||||
|
||||
# This was added in case the LDAP server doesnt provide them with a base +,* query.
|
||||
$this->default->server['root_dse_attributes'] = array(
|
||||
'desc'=>'RootDSE attributes for use when displaying server info',
|
||||
'default'=>array(
|
||||
'namingContexts',
|
||||
'subschemaSubentry',
|
||||
'altServer',
|
||||
'supportedExtension',
|
||||
'supportedControl',
|
||||
'supportedSASLMechanisms',
|
||||
'supportedLDAPVersion',
|
||||
'currentTime',
|
||||
'dsServiceName',
|
||||
'defaultNamingContext',
|
||||
'schemaNamingContext',
|
||||
'configurationNamingContext',
|
||||
'rootDomainNamingContext',
|
||||
'supportedLDAPPolicies',
|
||||
'highestCommittedUSN',
|
||||
'dnsHostName',
|
||||
'ldapServiceName',
|
||||
'serverName',
|
||||
'supportedCapabilities',
|
||||
'changeLog',
|
||||
'tlsAvailableCipherSuites',
|
||||
'tlsImplementationVersion',
|
||||
'supportedSASLMechanisms',
|
||||
'dsaVersion',
|
||||
'myAccessPoint',
|
||||
'dseType',
|
||||
'+',
|
||||
'*'
|
||||
));
|
||||
|
||||
$this->default->server['force_may'] = array(
|
||||
'desc'=>'Force server MUST attributes as MAY attributes',
|
||||
'default'=>array(
|
||||
));
|
||||
|
||||
# Settings for auto_number
|
||||
$this->default->auto_number['enable'] = array(
|
||||
'desc'=>'Enable the AUTO UID feature',
|
||||
'default'=>true);
|
||||
|
||||
$this->default->auto_number['mechanism'] = array(
|
||||
'desc'=>'Mechanism to use to search for automatic numbers',
|
||||
'default'=>'search');
|
||||
|
||||
$this->default->auto_number['search_base'] = array(
|
||||
'desc'=>'Base DN to use for search mechanisms',
|
||||
'default'=>null);
|
||||
|
||||
$this->default->auto_number['min'] = array(
|
||||
'desc'=>'Minimum number to start with',
|
||||
'default'=>array('uidNumber'=>1000,'gidNumber'=>500));
|
||||
|
||||
$this->default->auto_number['dn'] = array(
|
||||
'desc'=>'DN to use when evaluating numbers',
|
||||
'default'=>null);
|
||||
|
||||
$this->default->auto_number['pass'] = array(
|
||||
'desc'=>'Password for DN to use when evaluating numbers',
|
||||
'default'=>null);
|
||||
|
||||
$this->default->unique['attrs'] = array(
|
||||
'desc'=>'Attributes to check for uniqueness before allowing updates',
|
||||
'default'=>array('mail','uid','uidNumber'));
|
||||
|
||||
$this->default->unique['dn'] = array(
|
||||
'desc'=>'DN to use when evaluating attribute uniqueness',
|
||||
'default'=>null);
|
||||
|
||||
$this->default->unique['pass'] = array(
|
||||
'desc'=>'Password for DN to use when evaluating attribute uniqueness',
|
||||
'default'=>null);
|
||||
}
|
||||
|
||||
public function __get($key) {
|
||||
switch ($key) {
|
||||
case 'name':
|
||||
return $this->getValue('server','name');
|
||||
|
||||
default:
|
||||
system_message(array(
|
||||
'title'=>_('Unknown request for Object value.'),
|
||||
'body'=>sprintf(_('Attempt to obtain value %s from %s'),$key,get_class($this)),
|
||||
'type'=>'error'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the admin has configured phpLDAPadmin to show the "Create New" link in the tree viewer.
|
||||
* <code>
|
||||
* $servers->setValue('appearance','show_create',true|false);
|
||||
* </code>
|
||||
* If NOT set, then default to show the Create New item.
|
||||
* If IS set, then return the value (it should be true or false).
|
||||
*
|
||||
* The entry creation command must be available.
|
||||
* <code>
|
||||
* $config->custom->commands['script'] = array('create' => true);
|
||||
* </code>
|
||||
*
|
||||
* @return boolean true if the feature is enabled and false otherwise.
|
||||
*/
|
||||
function isShowCreateEnabled() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
if (! $_SESSION[APPCONFIG]->isCommandAvailable('script','create'))
|
||||
return false;
|
||||
else
|
||||
return $this->getValue('appearance','show_create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch whether the user has configured a certain server login to be non anonymous
|
||||
*
|
||||
* <code>
|
||||
* $servers->setValue('login','anon_bind',true|false);
|
||||
* </code>
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isAnonBindAllowed() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# If only_login_allowed_dns is set, then we cant have anonymous.
|
||||
if (count($this->getValue('login','allowed_dns')) > 0)
|
||||
$return = false;
|
||||
else
|
||||
$return = $this->getValue('login','anon_bind');
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$return);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the user has configured the specified server to enable branch (non-leaf) renames.
|
||||
*
|
||||
* This is configured in config.php thus:
|
||||
* <code>
|
||||
* $servers->setValue('server','branch_rename',true|false);
|
||||
* </code>
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function isBranchRenameEnabled() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
return $this->getValue('server','branch_rename');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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[APPCONFIG]->custom->appearance['multi_line_attributes'];
|
||||
*
|
||||
* Usage example:
|
||||
* <code>
|
||||
* if ($ldapserver->isMultiLineAttr('postalAddress'))
|
||||
* echo '<textarea name="postalAddress"></textarea>';
|
||||
* else
|
||||
* echo '<input name="postalAddress" type="text">';
|
||||
* </code>
|
||||
*
|
||||
* @param string The name of the attribute of interested (case insensivite)
|
||||
* @param string (optional) The current value of the attribute (speeds up the process by searching for carriage returns already in the attribute value)
|
||||
* @return boolean
|
||||
*/
|
||||
function isMultiLineAttr($attr_name,$val=null) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# Set default return
|
||||
$return = false;
|
||||
|
||||
# First, check the optional val param for a \n or a \r
|
||||
if (! is_null($val) && (strpos($val,"\n") || strpos($val,"\r")))
|
||||
$return = true;
|
||||
|
||||
# Next, compare strictly by name first
|
||||
else
|
||||
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;
|
||||
}
|
||||
|
||||
# If unfound, compare by syntax OID
|
||||
if (! $return) {
|
||||
$sattr = $this->getSchemaAttribute($attr_name);
|
||||
|
||||
if ($sattr) {
|
||||
$syntax_oid = $sattr->getSyntaxOID();
|
||||
|
||||
if ($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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$return);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the specified attribute is configured according to
|
||||
* the test enabled in config.php
|
||||
*
|
||||
* @param string The name of the attribute to test.
|
||||
* @param array The attributes to test against.
|
||||
* @param dn A DN that is exempt from these tests.
|
||||
* @return boolean
|
||||
*/
|
||||
private function isAttrTest($attr,$attrs,$except_dn) {
|
||||
$attr = trim($attr);
|
||||
if (! trim($attr) || ! count($attrs))
|
||||
return false;
|
||||
|
||||
# Is the user excluded?
|
||||
if ($except_dn && $this->userIsMember($this->getLogin(),$except_dn))
|
||||
return false;
|
||||
|
||||
foreach ($attrs as $attr_name)
|
||||
if (strcasecmp($attr,trim($attr_name)) == 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the specified attribute is configured as read only
|
||||
* in config.php.
|
||||
* Attributes are configured as read-only in config.php thus:
|
||||
* <code>
|
||||
* $config->custom->appearance['readonly_attrs'] = array('objectClass');
|
||||
* </code>
|
||||
*
|
||||
* @param string The name of the attribute to test.
|
||||
* @return boolean
|
||||
*/
|
||||
public function isAttrReadOnly($attr) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$attrs = $_SESSION[APPCONFIG]->getValue('appearance','readonly_attrs');
|
||||
$except_dn = $_SESSION[APPCONFIG]->getValue('appearance','readonly_attrs_exempt');
|
||||
|
||||
return $this->isAttrTest($attr,$attrs,$except_dn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the specified attribute is configured as hidden
|
||||
* in config.php.
|
||||
* Attributes are configured as hidden in config.php thus:
|
||||
* <code>
|
||||
* $config->custom->appearance['hide_attrs'] = array('objectClass');
|
||||
* </code>
|
||||
*
|
||||
* @param string The name of the attribute to test.
|
||||
* @return boolean
|
||||
*/
|
||||
public function isAttrHidden($attr) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$attrs = $_SESSION[APPCONFIG]->getValue('appearance','hide_attrs');
|
||||
$except_dn = $_SESSION[APPCONFIG]->getValue('appearance','hide_attrs_exempt');
|
||||
|
||||
return $this->isAttrTest($attr,$attrs,$except_dn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add objects
|
||||
*/
|
||||
public function add($dn,$entry_array,$method=null) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
foreach ($entry_array as $attr => $val)
|
||||
$entry_array[$attr] = dn_unescape($val);
|
||||
|
||||
$result = false;
|
||||
|
||||
# Check our unique attributes.
|
||||
if (! $this->checkUniqueAttrs($dn,$entry_array))
|
||||
return false;
|
||||
|
||||
if (run_hook('pre_entry_create',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'attrs'=>$entry_array))) {
|
||||
$result = @ldap_add($this->connect($method),dn_escape($dn),$entry_array);
|
||||
|
||||
if ($result) {
|
||||
# Update the tree
|
||||
$tree = get_cached_item($this->index,'tree');
|
||||
|
||||
# If we created the base, delete it, then add it back
|
||||
if (get_request('create_base'))
|
||||
$tree->delEntry($dn);
|
||||
|
||||
$tree->addEntry($dn);
|
||||
|
||||
set_cached_item($this->index,'tree','null',$tree);
|
||||
|
||||
run_hook('post_entry_create',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'attrs'=>$entry_array));
|
||||
|
||||
} else {
|
||||
system_message(array(
|
||||
'title'=>_('Could not add the object to the LDAP server.'),
|
||||
'body'=>ldap_error_msg($this->getErrorMessage(null),$this->getErrorNum(null)),
|
||||
'type'=>'error'));
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete objects
|
||||
*/
|
||||
public function delete($dn,$method=null) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$result = false;
|
||||
|
||||
if (run_hook('pre_entry_delete',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn))) {
|
||||
$result = @ldap_delete($this->connect($method),dn_escape($dn));
|
||||
|
||||
if ($result) {
|
||||
# Update the tree
|
||||
$tree = get_cached_item($this->index,'tree');
|
||||
$tree->delEntry($dn);
|
||||
|
||||
set_cached_item($this->index,'tree','null',$tree);
|
||||
|
||||
run_hook('post_entry_delete',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn));
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename objects
|
||||
*/
|
||||
public function rename($dn,$new_rdn,$container,$deleteoldrdn,$method=null) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$result = false;
|
||||
|
||||
if (run_hook('pre_entry_rename',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'rdn'=>$new_rdn,'container'=>$container))) {
|
||||
$result = @ldap_rename($this->connect($method),$dn,$new_rdn,$container,$deleteoldrdn);
|
||||
|
||||
if ($result) {
|
||||
# Update the tree
|
||||
$tree = get_cached_item($this->index,'tree');
|
||||
$newdn = sprintf('%s,%s',$new_rdn,$container);
|
||||
$tree->renameEntry($dn,$newdn);
|
||||
|
||||
set_cached_item($this->index,'tree','null',$tree);
|
||||
|
||||
run_hook('post_entry_rename',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'rdn'=>$new_rdn,'container'=>$container));
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify objects
|
||||
*/
|
||||
public function modify($dn,$attrs,$method=null) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# Check our unique attributes.
|
||||
if (! $this->checkUniqueAttrs($dn,$attrs))
|
||||
return false;
|
||||
|
||||
$result = false;
|
||||
$summary = array();
|
||||
$current_attrs = $this->getDNAttrValues($dn,$method,LDAP_DEREF_NEVER,array('*'));
|
||||
|
||||
# Go through our attributes and call our hooks for each attribute changing its value
|
||||
foreach ($attrs as $attr => $values) {
|
||||
# For new attributes
|
||||
if (count($values) && ! isset($current_attrs[$attr])) {
|
||||
if (! run_hook('pre_attr_add',
|
||||
array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'attr'=>$attr,'newvalue'=>$values))) {
|
||||
|
||||
unset($attrs[$attr]);
|
||||
system_message(array(
|
||||
'title'=>_('Attribute not added'),
|
||||
'body'=>sprintf('%s (<b>%s</b>)',_('Hook pre_attr_add prevented attribute from being added'),$attr),
|
||||
'type'=>'warn'));
|
||||
|
||||
} else
|
||||
$summary['add'][$attr]['new'] = $values;
|
||||
|
||||
# For modify attributes
|
||||
} elseif (count($values)) {
|
||||
if (! run_hook('pre_attr_modify',
|
||||
array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'attr'=>$attr,'oldvalue'=>$current_attrs[$attr],'newvalue'=>$values))) {
|
||||
|
||||
unset($attrs[$attr]);
|
||||
system_message(array(
|
||||
'title'=>_('Attribute not modified'),
|
||||
'body'=>sprintf('%s (<b>%s</b>)',_('Hook pre_attr_modify prevented attribute from being modified'),$attr),
|
||||
'type'=>'warn'));
|
||||
|
||||
} else {
|
||||
$summary['modify'][$attr]['new'] = $values;
|
||||
$summary['modify'][$attr]['old'] = $current_attrs[$attr];
|
||||
}
|
||||
|
||||
# For delete attributes
|
||||
} else {
|
||||
if (! run_hook('pre_attr_delete',
|
||||
array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'attr'=>$attr,'oldvalue'=>$current_attrs[$attr]))) {
|
||||
|
||||
unset($attrs[$attr]);
|
||||
system_message(array(
|
||||
'title'=>_('Attribute not deleted'),
|
||||
'body'=>sprintf('%s (<b>%s</b>)',_('Hook pre_attr_delete prevented attribute from being deleted'),$attr),
|
||||
'type'=>'warn'));
|
||||
|
||||
} else
|
||||
$summary['delete'][$attr]['old'] = $current_attrs[$attr];
|
||||
}
|
||||
}
|
||||
|
||||
if (! count($attrs))
|
||||
return false;
|
||||
|
||||
if (run_hook('pre_entry_modify',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'attrs'=>$attrs))) {
|
||||
$result = @ldap_modify($this->connect($method),$dn,$attrs);
|
||||
|
||||
if ($result) {
|
||||
run_hook('post_entry_modify',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'attrs'=>$attrs));
|
||||
|
||||
foreach (array('add','modify','delete') as $mode)
|
||||
if (isset($summary[$mode]))
|
||||
foreach ($summary[$mode] as $attr => $values)
|
||||
switch ($mode) {
|
||||
case 'add':
|
||||
run_hook(sprintf('post_attr_%s',$mode),
|
||||
array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'attr'=>$attr,'newvalue'=>$values['new']));
|
||||
break;
|
||||
|
||||
case 'modify':
|
||||
run_hook(sprintf('post_attr_%s',$mode),
|
||||
array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'attr'=>$attr,'oldvalue'=>$values['old'],'newvalue'=>$values['new']));
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
run_hook(sprintf('post_attr_%s',$mode),
|
||||
array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'attr'=>$attr,'oldvalue'=>$values['old']));
|
||||
break;
|
||||
|
||||
default:
|
||||
debug_dump_backtrace(sprintf('Unkown mode %s',$mode),1);
|
||||
}
|
||||
} else {
|
||||
system_message(array(
|
||||
'title'=>_('Could not perform ldap_modify operation.'),
|
||||
'body'=>ldap_error_msg($this->getErrorMessage($method),$this->getErrorNum($method)),
|
||||
'type'=>'error'));
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the specified attribute is configured as unique
|
||||
* in config.php.
|
||||
* Attributes are configured as hidden in config.php thus:
|
||||
* <code>
|
||||
* $servers->setValue('unique','attrs',array('mail','uid','uidNumber'));
|
||||
* </code>
|
||||
*
|
||||
* @param string $attr The name of the attribute to test.
|
||||
* @return boolean
|
||||
*/
|
||||
public function isAttrUnique($attr) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# Should this attribute value be unique
|
||||
if (in_array_ignore_case($attr,$this->getValue('unique','attrs')))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will check whether the value for an attribute being changed
|
||||
* is already assigned to another DN.
|
||||
*
|
||||
* Returns the bad value, or null if all values are OK
|
||||
*
|
||||
* @param dn DN that is being changed
|
||||
* @param string Attribute being changed
|
||||
* @param string|array New values for the attribute
|
||||
*/
|
||||
public function checkUniqueAttrs($dn,$attrs) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# If none of the attributes are defined unique, we'll return immediately;
|
||||
if (! $checkattrs = array_intersect(arrayLower($this->getValue('unique','attrs')),array_keys(array_change_key_case($attrs))))
|
||||
return true;
|
||||
|
||||
# Check see and use our alternate uid_dn and password if we have it.
|
||||
if (! $this->login($this->getValue('unique','dn'),$this->getValue('unique','pass'),'unique')) {
|
||||
system_message(array(
|
||||
'title'=>_('UNIQUE invalid login/password'),
|
||||
'body'=>sprintf('%s (<b>%s</b>)',_('Unable to connect to LDAP server with the unique login/password, please check your configuration.'),
|
||||
$this->getName()),
|
||||
'type'=>'warn'));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = array();
|
||||
|
||||
# Build our search filter to double check each attribute.
|
||||
$query['filter'] = '(|';
|
||||
foreach ($checkattrs as $attr)
|
||||
foreach ($attrs[$attr] as $val)
|
||||
if ($val)
|
||||
$query['filter'] .= sprintf('(%s=%s)',$attr,$val);
|
||||
$query['filter'] .= ')';
|
||||
|
||||
$query['attrs'] = $checkattrs;
|
||||
|
||||
# Search through our bases and see if we have match
|
||||
foreach ($this->getBaseDN() as $base) {
|
||||
$query['base'] = $base;
|
||||
|
||||
# Do the search
|
||||
$results = $this->query($query,'unique');
|
||||
|
||||
# If we have a match.
|
||||
if (count($results))
|
||||
foreach ($results as $values)
|
||||
# If one of the attributes is owned to somebody else, then we may as well die here.
|
||||
if ($values['dn'] != $dn) {
|
||||
$href = sprintf('cmd.php?cmd=query_engine&server_id=%s&filter=%s&scope=sub&query=none&format=list&search=true',$this->index,$query['filter']);
|
||||
|
||||
system_message(array(
|
||||
'title'=>_('Attribute value would not be unique'),
|
||||
'body'=>sprintf('%s (<b><a href="%s">%s</a></b>)',
|
||||
_('This update has been or will be cancelled, it would result in an attribute value not being unique. You might like to search the LDAP server for the offending entry.'),
|
||||
htmlspecialchars($href),
|
||||
_('Search')),
|
||||
'type'=>'warn'));
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
# If we get here, then it must be OK?
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the session timeout has occured for this LDAP server.
|
||||
*/
|
||||
public function isSessionValid() {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# If inactiveTime() returns a value, we need to check that it has not expired.
|
||||
if (is_null($this->inactivityTime()) || ! $this->isLoggedIn())
|
||||
return true;
|
||||
|
||||
# If session has expired
|
||||
if ((isset($_SESSION['ACTIVITY'][$this->getIndex()])) && ($_SESSION['ACTIVITY'][$this->getIndex()] < time())) {
|
||||
$this->logout();
|
||||
unset($_SESSION['ACTIVITY'][$this->getIndex()]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$_SESSION['ACTIVITY'][$this->getIndex()] = $this->inactivityTime();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return login, or authorization ID if show_authz enabled
|
||||
*/
|
||||
public function displayLogin($method=null) {
|
||||
// check for whoami function, added in 7.2
|
||||
if ($this->getValue('appearance', 'show_authz') && function_exists('ldap_exop_whoami')) {
|
||||
$result = @ldap_exop_whoami($this->connect($method));
|
||||
if ($result) // strip any dn: or u: prefix
|
||||
$result = preg_replace('/^(u|dn):/i', '', $result);
|
||||
else // fall back to login on error
|
||||
$result = $this->getLogin($method);
|
||||
return $result;
|
||||
}
|
||||
else {
|
||||
return $this->getLogin($method);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
2520
lib/functions.php
2520
lib/functions.php
File diff suppressed because it is too large
Load Diff
@ -1,94 +0,0 @@
|
||||
0x00 LDAP_SUCCESS "The operation completed successfully."
|
||||
0x01 LDAP_OPERATIONS_ERROR "An operations error occurred. This is
|
||||
typically the result of an internal error on your LDAP server."
|
||||
0x02 LDAP_PROTOCOL_ERROR "A protocol violation was detected."
|
||||
0x03 LDAP_TIMELIMIT_EXCEEDED "The operation timed out waiting to complete."
|
||||
0x04 LDAP_SIZELIMIT_EXCEEDED "The LDAP server refused to serve such a large result set."
|
||||
0x05 LDAP_COMPARE_FALSE "A compare operation returned false."
|
||||
0x06 LDAP_COMPARE_TRUE "A compare operation returned true."
|
||||
0x07 LDAP_AUTH_METHOD_NOT_SUPPORTED "The authentication method you specified is not supported by
|
||||
the LDAP server."
|
||||
0x08 LDAP_STRONG_AUTH_REQUIRED "This LDAP server requires strong (encrypted) authentication,
|
||||
not clear text."
|
||||
0x09 LDAP_PARTIAL_RESULTS "The result set received is a partial result set."
|
||||
0x0a LDAP_REFERRAL ""
|
||||
0x0b LDAP_ADMINLIMIT_EXCEEDED ""
|
||||
0x0c LDAP_UNAVAILABLE_CRITICAL_EXTENSION ""
|
||||
0x0d LDAP_CONFIDENTIALITY_REQUIRED ""
|
||||
0x0e LDAP_SASL_BIND_INPROGRESS ""
|
||||
0x10 LDAP_NO_SUCH_ATTRIBUTE "That entry does not contain the attribute specified."
|
||||
0x11 LDAP_UNDEFINED_TYPE "The attribute type specified is invalid."
|
||||
0x12 LDAP_INAPPROPRIATE_MATCHING "This usually means that your LDAP server has not defined an equality rule
|
||||
for the attribute you are trying to alter. This is not phpLDAPadmin's fault as the
|
||||
LDAP server has refused to perform the operation (as well it should if there is
|
||||
no equality rule for it to use for the operation). This generally applies when
|
||||
adding a new value to a binary attribute, or removing a single value from a
|
||||
multi-valued binary attribute."
|
||||
0x13 LDAP_CONSTRAINT_VIOLATION "Some constraint would be violated by performing the action. This can happen when
|
||||
you try to add a second value to a single-valued attribute, for example."
|
||||
0x14 LDAP_TYPE_OR_VALUE_EXISTS "An attribute type or attribute value
|
||||
specified already exists in the entry"
|
||||
0x15 LDAP_INVALID_SYNTAX "An invalid attribute value was specified."
|
||||
0x20 LDAP_NO_SUCH_OBJECT "That object does not exist."
|
||||
0x21 LDAP_ALIAS_PROBLEM "An alias in the directory points to a
|
||||
non-existent entry."
|
||||
0x22 LDAP_INVALID_DN_SYNTAX "You used an invalid syntax in the specified DN."
|
||||
0x23 LDAP_IS_LEAF "The object specified is a leaf"
|
||||
0x24 LDAP_ALIAS_DEREF_PROBLEM "A problem was encountereed when
|
||||
dereferencing an alias"
|
||||
0x30 LDAP_INAPPROPRIATE_AUTH "Inappropriate authentication was
|
||||
specified (e.g. LDAP_AUTH_SIMPLE was
|
||||
specified and the entry does not have
|
||||
a userPassword attribute)."
|
||||
0x31 LDAP_INVALID_CREDENTIALS "Incorrect login DN and/or password."
|
||||
0x32 LDAP_INSUFFICIENT_ACCESS "You do not have sufficient permissions
|
||||
to perform that operation."
|
||||
0x33 LDAP_BUSY "The LDAP server is busy."
|
||||
0x34 LDAP_UNAVAILABLE "The LDAP server is unavailable."
|
||||
0x35 LDAP_UNWILLING_TO_PERFORM "The LDAP server refused to perform the operation."
|
||||
0x36 LDAP_LOOP_DETECT "A loop was detected."
|
||||
0x3C LDAP_SORT_CONTROL_MISSING ""
|
||||
0x3D LDAP_INDEX_RANGE_ERROR ""
|
||||
0x40 LDAP_NAMING_VIOLATION "A naming violation occurred. This usually
|
||||
means that you tried to change the value of an attribute that is used in the
|
||||
DN. For example, if you change the 'cn' value of an entry whose DN is 'cn=Bob
|
||||
Jones,dc=example,dc=com', you must also rename the entry to reflect the
|
||||
change."
|
||||
0x41 LDAP_OBJECT_CLASS_VIOLATION "You tried to perform an operation that would cause an undefined attribute
|
||||
to exist or that would remove a required attribute, given the current list
|
||||
of ObjectClasses. This can also occur if you do not
|
||||
specify a structural objectClass when creating an entry, or if you specify
|
||||
more than one structural objectClass."
|
||||
0x42 LDAP_NOT_ALLOWED_ON_NONLEAF "The entry you tried to operate on has children. Usually this means you
|
||||
tried to delete or rename the entry, which you cannot do to an entry
|
||||
with children."
|
||||
0x43 LDAP_NOT_ALLOWED_ON_RDN "You cannot preform that operation on a the relative distinguished name
|
||||
(RDN) of an object."
|
||||
0x44 LDAP_ALREADY_EXISTS "The object already exists. Usually you are trying to create a new object
|
||||
on top of an existing one."
|
||||
0x45 LDAP_NO_OBJECT_CLASS_MODS "ObjectClass modifications are not allowed."
|
||||
0x46 LDAP_RESULTS_TOO_LARGE ""
|
||||
0x47 LDAP_AFFECTS_MULTIPLE_DSAS ""
|
||||
0x50 LDAP_OTHER ""
|
||||
0x51 LDAP_SERVER_DOWN "The LDAP server is down."
|
||||
0x52 LDAP_LOCAL_ERROR ""
|
||||
0x53 LDAP_ENCODING_ERROR ""
|
||||
0x54 LDAP_DECODING_ERROR ""
|
||||
0x55 LDAP_TIMEOUT ""
|
||||
0x56 LDAP_AUTH_UNKNOWN ""
|
||||
0x57 LDAP_FILTER_ERROR "The LDAP search filter specified is inavlid."
|
||||
0x58 LDAP_USER_CANCELLED "The user cancelled the LDAP operation."
|
||||
0x59 LDAP_PARAM_ERROR "An ldap routine was called with a bad
|
||||
parameter."
|
||||
0x5a LDAP_NO_MEMORY "A memory allocation (e.g., malloc(3)
|
||||
or other dynamic memory allocator)
|
||||
call failed in an ldap library rou-
|
||||
tine."
|
||||
0x5b LDAP_CONNECT_ERROR ""
|
||||
0x5c LDAP_NOT_SUPPORTED "The requested operation is not supported by the LDAP server."
|
||||
0x5d LDAP_CONTROL_NOT_FOUND ""
|
||||
0x5e LDAP_NO_RESULTS_RETURNED "The search came back empty."
|
||||
0x5f LDAP_MORE_RESULTS_TO_RETURN "The LDAP server has more results that it would like to return."
|
||||
0x60 LDAP_CLIENT_LOOP ""
|
||||
0x61 LDAP_REFERRAL_LIMIT_EXCEEDED "This means that a search was performed that required the LDAP
|
||||
server to follow a chain of referrals that was too lengthy."
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Classes and functions for searching the LDAP server
|
||||
*
|
||||
* These classes and functions will read our XML search files, for defined
|
||||
* search reports.
|
||||
*
|
||||
* @author The phpLDAPadmin development team
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Query Class
|
||||
*
|
||||
* This class will store all our pre-defined search definitions.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Queries
|
||||
*/
|
||||
class Queries extends xmlTemplates {
|
||||
}
|
||||
?>
|
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Classes and functions for the template engine.
|
||||
*
|
||||
* These classes and functions will read our XML template files, as well as
|
||||
* query the LDAP server and build a template object that can be used for user
|
||||
* input.
|
||||
*
|
||||
* @author The phpLDAPadmin development team
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Templates Class
|
||||
*
|
||||
* This class will store all our templates.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Templates
|
||||
*/
|
||||
class Templates extends xmlTemplates {
|
||||
}
|
||||
?>
|
@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New LDAP Alias</description>
|
||||
<icon>ldap-alias.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>uid</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Generic: LDAP Alias</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="alias"></objectClass>
|
||||
<objectClass id="extensibleObject"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="aliasedObjectName">
|
||||
<display>Alias To</display>
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="uid">
|
||||
<display>User ID</display>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,91 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Courier Mail Account</description>
|
||||
<icon>mail_account.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>cn</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Courier Mail: Account</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="inetOrgPerson"></objectClass>
|
||||
<objectClass id="courierMailAccount"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="givenName">
|
||||
<display>Given Name</display>
|
||||
<onchange>=autoFill(cn;%givenName% %sn%)</onchange>
|
||||
<onchange>=autoFill(uid;%gidNumber|0-0/T%-%givenName|0-1/l%%sn/l%)</onchange>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sn">
|
||||
<display>Last name</display>
|
||||
<onchange>=autoFill(cn;%givenName% %sn%)</onchange>
|
||||
<onchange>=autoFill(uid;%gidNumber|0-0/T%-%givenName|0-1/l%%sn/l%)</onchange>
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="cn">
|
||||
<display>Common Name</display>
|
||||
<order>3</order>
|
||||
<page>1</page>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="uid">
|
||||
<display>User ID</display>
|
||||
<icon>ldap-uid.png</icon>
|
||||
<!--<onchange>=autoFill(homeDirectory;/home/users/%uid%)</onchange>-->
|
||||
<onchange>=autoFill(homeDirectory;/home/users/%gidNumber|0-0/T%/%uid|3-%)</onchange>
|
||||
<order>4</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="uidNumber">
|
||||
<display>UID Number</display>
|
||||
<icon>terminal.png</icon>
|
||||
<order>6</order>
|
||||
<page>1</page>
|
||||
<readonly>1</readonly>
|
||||
<value>=php.GetNextNumber(/;uidNumber)</value>
|
||||
</attribute>
|
||||
<attribute id="gidNumber">
|
||||
<display>GID Number</display>
|
||||
<onchange>=autoFill(uid;%gidNumber|0-0/T%-%givenName|0-1/l%%sn/l%)</onchange>
|
||||
<onchange>=autoFill(homeDirectory;/home/users/%gidNumber|0-0/T%/%uid|3-%)</onchange>
|
||||
<order>7</order>
|
||||
<page>1</page>
|
||||
<spacer>1</spacer>
|
||||
<value><![CDATA[=php.PickList(/;(&(objectClass=posixGroup));gidNumber;%cn%;;;;cn)]]></value>
|
||||
</attribute>
|
||||
<attribute id="homeDirectory">
|
||||
<display>Home Directory</display>
|
||||
<order>8</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="mail">
|
||||
<display>Email</display>
|
||||
<icon>mail.png</icon>
|
||||
<order>9</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="mailbox">
|
||||
<display>Mailbox</display>
|
||||
<order>10</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="userPassword">
|
||||
<display>Password</display>
|
||||
<icon>lock.png</icon>
|
||||
<order>11</order>
|
||||
<page>1</page>
|
||||
<post>=php.PasswordEncrypt(%enc%;%userPassword%)</post>
|
||||
<verify>1</verify>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Courier Mail Alias</description>
|
||||
<icon>mail_alias.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>cn</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Courier Mail: Alias</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="inetOrgPerson"></objectClass>
|
||||
<objectClass id="courierMailAlias"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="cn">
|
||||
<display>Common Name</display>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sn">
|
||||
<display>Last name</display>
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="mail">
|
||||
<display>Email</display>
|
||||
<order>3</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="maildrop">
|
||||
<display>Maildrop</display>
|
||||
<order>4</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New DNS Entry</description>
|
||||
<icon>ldap-dc.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>dc</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Generic: DNS Entry</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="dnsDomain"></objectClass>
|
||||
<objectClass id="domainRelatedObject"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="dc">
|
||||
<display>Domain Component</display>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="associatedDomain">
|
||||
<display>Associated Domain</display>
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>This is the description</description>
|
||||
<icon>star.png</icon>
|
||||
<invalid>1</invalid>
|
||||
<rdn>o</rdn>
|
||||
<regexp>^$</regexp>
|
||||
<title>Example entry</title>
|
||||
<visible>0</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="organization"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="attribute1">
|
||||
<display>Attribute 1</display>
|
||||
<hint>This is an example</hint>
|
||||
<icon>ldap-uid.png</icon>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="attribute2">
|
||||
<display>Attribute 2</display>
|
||||
<order>2</order>
|
||||
<page>2</page>
|
||||
</attribute>
|
||||
<attribute id="attribute3">
|
||||
<display>Attribute 3</display>
|
||||
<order>1</order>
|
||||
<page>2</page>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,96 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Address Book Entry</description>
|
||||
<icon>address-book.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>cn</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Generic: Address Book Entry</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="inetOrgPerson"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="givenName">
|
||||
<display>First name</display>
|
||||
<icon>ldap-uid.png</icon>
|
||||
<onchange>=autoFill(cn;%givenName% %sn%)</onchange>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sn">
|
||||
<display>Last name</display>
|
||||
<onchange>=autoFill(cn;%givenName% %sn%)</onchange>
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="cn">
|
||||
<display>Common Name</display>
|
||||
<order>3</order>
|
||||
<page>1</page>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="jpegPhoto">
|
||||
<display>Photo</display>
|
||||
<order>3</order>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="o">
|
||||
<display>Organisation</display>
|
||||
<order>4</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="street">
|
||||
<cols>50</cols>
|
||||
<display>Street</display>
|
||||
<icon>mail.png</icon>
|
||||
<order>4</order>
|
||||
<page>1</page>
|
||||
<rows>4</rows>
|
||||
<type>textarea</type>
|
||||
</attribute>
|
||||
<attribute id="l">
|
||||
<display>City</display>
|
||||
<order>5</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="st">
|
||||
<display>State</display>
|
||||
<order>6</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="postalCode">
|
||||
<display>Postal code</display>
|
||||
<order>7</order>
|
||||
<page>1</page>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="telephoneNumber">
|
||||
<display>Work phone</display>
|
||||
<icon>phone.png</icon>
|
||||
<order>8</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="facsimileTelephoneNumber">
|
||||
<display>Fax</display>
|
||||
<order>9</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="mobile">
|
||||
<display>Mobile</display>
|
||||
<order>9</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="mail">
|
||||
<display>Email</display>
|
||||
<order>10</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,109 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Address Book Entry</description>
|
||||
<icon>address-book.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>cn</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Kolab: User Entry</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="inetOrgPerson"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="givenName">
|
||||
<display>First name</display>
|
||||
<icon>ldap-uid.png</icon>
|
||||
<onchange>=autoFill(cn;%givenName% %sn%)</onchange>
|
||||
<order>1</order>
|
||||
</attribute>
|
||||
<attribute id="sn">
|
||||
<display>Last name</display>
|
||||
<onchange>=autoFill(cn;%givenName% %sn%)</onchange>
|
||||
<order>2</order>
|
||||
</attribute>
|
||||
<attribute id="cn">
|
||||
<display>Common Name</display>
|
||||
<order>3</order>
|
||||
</attribute>
|
||||
<attribute id="mail">
|
||||
<display>Email</display>
|
||||
<order>4</order>
|
||||
</attribute>
|
||||
<attribute id="userPassword">
|
||||
<display>Password</display>
|
||||
<icon>lock.png</icon>
|
||||
<order>5</order>
|
||||
<post>=php.PasswordEncrypt(%enc%;%userPassword%)</post>
|
||||
<spacer>1</spacer>
|
||||
<verify>1</verify>
|
||||
</attribute>
|
||||
<attribute id="title">
|
||||
<display>Title</display>
|
||||
<icon>ldap-ou.png</icon>
|
||||
<order>6</order>
|
||||
</attribute>
|
||||
<attribute id="alias">
|
||||
<display>Alias</display>
|
||||
<order>7</order>
|
||||
</attribute>
|
||||
<attribute id="o">
|
||||
<display>Organisation</display>
|
||||
<order>8</order>
|
||||
</attribute>
|
||||
<attribute id="ou">
|
||||
<display>Organisational unit</display>
|
||||
<order>9</order>
|
||||
</attribute>
|
||||
<attribute id="roomNumber">
|
||||
<display>Room Number</display>
|
||||
<order>10</order>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="street">
|
||||
<display>Address</display>
|
||||
<icon>mail.png</icon>
|
||||
<order>11</order>
|
||||
</attribute>
|
||||
<attribute id="postOfficeBox">
|
||||
<display>Post box</display>
|
||||
<order>12</order>
|
||||
</attribute>
|
||||
<attribute id="l">
|
||||
<display>City</display>
|
||||
<order>13</order>
|
||||
</attribute>
|
||||
<attribute id="st">
|
||||
<display>State</display>
|
||||
<order>14</order>
|
||||
</attribute>
|
||||
<attribute id="postalCode">
|
||||
<display>Postal code</display>
|
||||
<order>15</order>
|
||||
</attribute>
|
||||
<!-- <attribute id="c">
|
||||
<display>Country</display>
|
||||
<order>16</order>
|
||||
<spacer>1</spacer>
|
||||
</attribute> -->
|
||||
<attribute id="telephoneNumber">
|
||||
<display>Work phone</display>
|
||||
<icon>phone.png</icon>
|
||||
<order>17</order>
|
||||
</attribute>
|
||||
<attribute id="facsimileTelephoneNumber">
|
||||
<display>Fax</display>
|
||||
<order>18</order>
|
||||
</attribute>
|
||||
<attribute id="mobile">
|
||||
<display>Mobile</display>
|
||||
<order>19</order>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,161 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Thunderbird Address Book Entry</description>
|
||||
<icon>address-book.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>cn</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Thunderbird: Address Book Entry</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="inetOrgPerson"></objectClass>
|
||||
<objectClass id="mozillaOrgPerson"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="givenName">
|
||||
<display>First Name</display>
|
||||
<onchange>=autoFill(cn;%sn% %givenName%)</onchange>
|
||||
<order>1</order>
|
||||
</attribute>
|
||||
<attribute id="sn">
|
||||
<display>Last Name</display>
|
||||
<onchange>=autoFill(cn;%sn% %givenName%)</onchange>
|
||||
<order>2</order>
|
||||
</attribute>
|
||||
<attribute id="cn">
|
||||
<display>Display Name</display>
|
||||
<order>3</order>
|
||||
</attribute>
|
||||
<attribute id="mozillaNickName">
|
||||
<display>NickName</display>
|
||||
<order>4</order>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="mail">
|
||||
<display>Email</display>
|
||||
<order>5</order>
|
||||
</attribute>
|
||||
<attribute id="mozillaSecondEmail">
|
||||
<display>Alternative Email</display>
|
||||
<order>6</order>
|
||||
</attribute>
|
||||
<attribute id="nsAIMid">
|
||||
<display>AIM Nick</display>
|
||||
<order>7</order>
|
||||
</attribute>
|
||||
<attribute id="mozillaUseHtmlMail">
|
||||
<display>HTML Email Format</display>
|
||||
<order>8</order>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="telephoneNumber">
|
||||
<display>Work Phone Number</display>
|
||||
<order>9</order>
|
||||
</attribute>
|
||||
<attribute id="homePhone">
|
||||
<display>Home Phone Number</display>
|
||||
<order>10</order>
|
||||
</attribute>
|
||||
<attribute id="facsimileTelephoneNumber">
|
||||
<display>Fax Number</display>
|
||||
<order>11</order>
|
||||
</attribute>
|
||||
<attribute id="pager">
|
||||
<display>Pager</display>
|
||||
<order>12</order>
|
||||
</attribute>
|
||||
<attribute id="mobile">
|
||||
<display>Mobile</display>
|
||||
<order>13</order>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="mozillaHomeStreet">
|
||||
<display>Address (personal)</display>
|
||||
<order>14</order>
|
||||
</attribute>
|
||||
<attribute id="mozillaHomeLocalityName">
|
||||
<display>City (personal)</display>
|
||||
<order>15</order>
|
||||
</attribute>
|
||||
<attribute id="mozillaHomeState">
|
||||
<display>State (personal)</display>
|
||||
<order>16</order>
|
||||
</attribute>
|
||||
<attribute id="mozillaHomePostalCode">
|
||||
<display>Zip (personal)</display>
|
||||
<order>17</order>
|
||||
</attribute>
|
||||
<attribute id="mozillaHomeCountryName">
|
||||
<display>Country (personal)</display>
|
||||
<order>18</order>
|
||||
</attribute>
|
||||
<attribute id="mozillaHomeUrl">
|
||||
<display>Web page (personal)</display>
|
||||
<order>19</order>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="title">
|
||||
<display>Title (professional)</display>
|
||||
<order>20</order>
|
||||
</attribute>
|
||||
<attribute id="ou">
|
||||
<display>Department (professional)</display>
|
||||
<order>21</order>
|
||||
</attribute>
|
||||
<attribute id="o">
|
||||
<display>Organization (professional)</display>
|
||||
<order>22</order>
|
||||
</attribute>
|
||||
<attribute id="street">
|
||||
<display>Address (professional)</display>
|
||||
<order>23</order>
|
||||
</attribute>
|
||||
<attribute id="l">
|
||||
<display>City (professional)</display>
|
||||
<order>24</order>
|
||||
</attribute>
|
||||
<attribute id="st">
|
||||
<display>State (professional)</display>
|
||||
<order>25</order>
|
||||
</attribute>
|
||||
<attribute id="postalCode">
|
||||
<display>Zip (professional)</display>
|
||||
<order>26</order>
|
||||
</attribute>
|
||||
<attribute id="c">
|
||||
<display>Country (professional)</display>
|
||||
<order>27</order>
|
||||
</attribute>
|
||||
<attribute id="mozillaWorkUrl">
|
||||
<display>Web Page (professional)</display>
|
||||
<order>28</order>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="mozillaCustom1">
|
||||
<display>Custom 1</display>
|
||||
<order>29</order>
|
||||
</attribute>
|
||||
<attribute id="mozillaCustom2">
|
||||
<display>Custom 2</display>
|
||||
<order>30</order>
|
||||
</attribute>
|
||||
<attribute id="mozillaCustom3">
|
||||
<display>Custom 3</display>
|
||||
<order>31</order>
|
||||
</attribute>
|
||||
<attribute id="mozillaCustom4">
|
||||
<display>Custom 4</display>
|
||||
<order>32</order>
|
||||
</attribute>
|
||||
<attribute id="description">
|
||||
<display>Description</display>
|
||||
<order>33</order>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,77 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Organisational Role</description>
|
||||
<icon>ldap-o.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>cn</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Generic: Organisational Role</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="organizationalRole"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="cn">
|
||||
<display>Role CN</display>
|
||||
<order>1</order>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="telephoneNumber">
|
||||
<display>Work phone</display>
|
||||
<icon>phone.png</icon>
|
||||
<order>2</order>
|
||||
</attribute>
|
||||
<attribute id="facsimileTelephoneNumber">
|
||||
<display>Fax</display>
|
||||
<order>3</order>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="description">
|
||||
<display>Comments</display>
|
||||
<icon>light.png</icon>
|
||||
<order>4</order>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="roleOccupant">
|
||||
<display>Occupant</display>
|
||||
<icon>ldap-default.png</icon>
|
||||
<order>5</order>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="street">
|
||||
<display>Street Address</display>
|
||||
<icon>mail.png</icon>
|
||||
<order>6</order>
|
||||
</attribute>
|
||||
<attribute id="l">
|
||||
<display>City</display>
|
||||
<order>7</order>
|
||||
</attribute>
|
||||
<attribute id="st">
|
||||
<display>State</display>
|
||||
<order>8</order>
|
||||
</attribute>
|
||||
<attribute id="postalCode">
|
||||
<display>Postal code</display>
|
||||
<order>9</order>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="postalAddress">
|
||||
<display>Postal Address</display>
|
||||
<icon>mail.png</icon>
|
||||
<order>10</order>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="registeredAddress">
|
||||
<display>Registered Address</display>
|
||||
<icon>mail.png</icon>
|
||||
<order>11</order>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Organisational Unit</description>
|
||||
<icon>ldap-ou.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>ou</rdn>
|
||||
<!-- <regexp>^o=.*,</regexp> -->
|
||||
<title>Generic: Organisational Unit</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="organizationalUnit"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="ou">
|
||||
<display>Organisational Unit</display>
|
||||
<hint>don't include "ou="</hint>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,99 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "../template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New User Account</description>
|
||||
<icon>ldap-user.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>cn</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Generic: User Account</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="inetOrgPerson"></objectClass>
|
||||
<objectClass id="posixAccount"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="givenName">
|
||||
<display>First name</display>
|
||||
<icon>ldap-uid.png</icon>
|
||||
<onchange>=autoFill(cn;%givenName% %sn%)</onchange>
|
||||
<onchange>=autoFill(uid;%givenName|0-1/l%%sn/l%)</onchange>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sn">
|
||||
<display>Last name</display>
|
||||
<onchange>=autoFill(cn;%givenName% %sn%)</onchange>
|
||||
<onchange>=autoFill(uid;%givenName|0-1/l%%sn/l%)</onchange>
|
||||
<!-- <onchange>=autoFill(homeDirectory;/home/users/%uid|0-1/l%/%uid%)</onchange> -->
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="cn">
|
||||
<display>Common Name</display>
|
||||
<order>3</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="uid">
|
||||
<display>User ID</display>
|
||||
<onchange>=autoFill(homeDirectory;/home/users/%uid%)</onchange>
|
||||
<order>4</order>
|
||||
<page>1</page>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="homeDirectory">
|
||||
<display>Home directory</display>
|
||||
<!-- <onchange>=autoFill(homeDirectory;/home/users/%gidNumber|0-0/T%/%uid|3-%)</onchange> -->
|
||||
<order>8</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="uidNumber">
|
||||
<display>UID Number</display>
|
||||
<icon>terminal.png</icon>
|
||||
<order>6</order>
|
||||
<page>1</page>
|
||||
<readonly>1</readonly>
|
||||
<value>=php.GetNextNumber(/;uidNumber)</value>
|
||||
</attribute>
|
||||
<attribute id="gidNumber">
|
||||
<display>GID Number</display>
|
||||
<!-- <onchange>=autoFill(homeDirectory;/home/users/%gidNumber|0-0/T%/%uid|3-%)</onchange> -->
|
||||
<order>7</order>
|
||||
<page>1</page>
|
||||
<value><![CDATA[=php.PickList(/;(&(objectClass=posixGroup));gidNumber;%cn%;;;;cn)]]></value>
|
||||
</attribute>
|
||||
<attribute id="loginShell">
|
||||
<display>Login shell</display>
|
||||
<order>9</order>
|
||||
<page>1</page>
|
||||
<!-- <value><![CDATA[=php.PickList(/;(&(objectClass=posixAccount));loginShell;%loginShell%;;;;loginShell)]]></value> -->
|
||||
<type>select</type>
|
||||
<value id="/bin/bash">Bash</value>
|
||||
<value id="/bin/csh">C Shell</value>
|
||||
<value id="/bin/dash">Dash</value>
|
||||
<value id="/bin/sh">Shell</value>
|
||||
<value id="/bin/tsh">Turbo C Shell</value>
|
||||
<value id="/bin/false">False</value>
|
||||
<value id="/usr/sbin/nologin">No Login</value>
|
||||
</attribute>
|
||||
<attribute id="userPassword">
|
||||
<display>Password</display>
|
||||
<!-- <helper>
|
||||
<display>Encryption</display>
|
||||
<id>enc</id>
|
||||
<value>=php.PasswordEncryptionTypes()</value>
|
||||
</helper> -->
|
||||
<icon>lock.png</icon>
|
||||
<order>5</order>
|
||||
<page>1</page>
|
||||
<post>=php.PasswordEncrypt(%enc%;%userPassword%)</post>
|
||||
<spacer>1</spacer>
|
||||
<verify>1</verify>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Posix Group</description>
|
||||
<icon>ldap-ou.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>cn</rdn>
|
||||
<!-- <regexp>^ou=.*,</regexp> -->
|
||||
<title>Generic: Posix Group</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="posixGroup"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="cn">
|
||||
<display>Group</display>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="gidNumber">
|
||||
<display>GID Number</display>
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
<readonly>1</readonly>
|
||||
<spacer>1</spacer>
|
||||
<value>=php.GetNextNumber(/;gidNumber)</value>
|
||||
<!-- <value><![CDATA[=php.GetNextNumber(/;gidNumber;false;(&(objectClass=posixGroup));*2,+1000)]]></value> -->
|
||||
</attribute>
|
||||
<attribute id="memberUid">
|
||||
<display>Users</display>
|
||||
<hidden>0</hidden>
|
||||
<order>3</order>
|
||||
<page>1</page>
|
||||
<value><![CDATA[=php.MultiList(/;(&(objectClass=posixAccount));uid;%cn% (%uid|-4%))]]></value>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Samba Domain</description>
|
||||
<icon>ldap-dc.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>sambaDomainName</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Samba: Domain</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="sambaDomain"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="sambaDomainName">
|
||||
<display>Samba Domain Name</display>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sambaSID">
|
||||
<display>Samba SID</display>
|
||||
<hint>Samba SID is in the format S-1-5-21-x-y-z</hint>
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
<value>S-1-5-21-</value>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,70 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Samba3 Group Mapping</description>
|
||||
<icon>ldap-ou.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>cn</rdn>
|
||||
<!-- <regexp>^ou=.*,</regexp> -->
|
||||
<title>Samba: Group Mapping</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="posixGroup"></objectClass>
|
||||
<objectClass id="sambaGroupMapping"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="cn">
|
||||
<display>Group</display>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="displayName">
|
||||
<display>Windows Name</display>
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="gidNumber">
|
||||
<display>GID Number</display>
|
||||
<order>3</order>
|
||||
<page>1</page>
|
||||
<readonly>1</readonly>
|
||||
<spacer>1</spacer>
|
||||
<value><![CDATA[=php.GetNextNumber(/;gidNumber;true;(&(objectClass=sambaDomain)(sambaDomainName=mysambadomain))]]></value>
|
||||
</attribute>
|
||||
<attribute id="sambaSID">
|
||||
<display>Samba SID</display>
|
||||
<helper>
|
||||
<id>sidsuffix</id>
|
||||
<value><![CDATA[=php.GetNextNumber(/;gidNumber;false;(&(objectClass=sambaDomain)(sambaDomainName=mysambadomain));*2,+1000)]]></value>
|
||||
</helper>
|
||||
<order>4</order>
|
||||
<post>=php.Join(-;%sambaSID%,%sidsuffix%)</post>
|
||||
<page>1</page>
|
||||
<value><![CDATA[=php.PickList(/;(&(objectClass=sambaDomain));sambaSID;%sambaSID% (%sambaDomainName%);;;;sambaDomainName)]]></value>
|
||||
</attribute>
|
||||
<attribute id="sambaGroupType">
|
||||
<display>Samba Group Type</display>
|
||||
<order>5</order>
|
||||
<page>1</page>
|
||||
<spacer>1</spacer>
|
||||
<type>select</type>
|
||||
<value id="2">Domain Group</value>
|
||||
<value id="4">Local Group</value>
|
||||
<value id="5">Well-known Group</value>
|
||||
</attribute>
|
||||
<attribute id="memberUid">
|
||||
<display>Users</display>
|
||||
<hidden>0</hidden>
|
||||
<order>10</order>
|
||||
<page>1</page>
|
||||
<size>10</size>
|
||||
<value><![CDATA[=php.MultiList(/;(&(objectClass=posixAccount));uid)]]></value>
|
||||
<!-- <value><![CDATA[=php.MultiList(/;(&(objectClass=posixAccount));uid;%cn% %uid|-4/U%;memberUid;dmdName=users,dc=localdomain;root => cn=root, nobody => cn=nobody;cn;;;)]]></value> -->
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,67 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Samba3 Machine</description>
|
||||
<icon>server.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>uid</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Samba: Machine</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="sambaSAMAccount"></objectClass>
|
||||
<objectClass id="posixAccount"></objectClass>
|
||||
<objectClass id="account"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="uid">
|
||||
<display>Machine Name</display>
|
||||
<hint>The machine name should end with a $</hint>
|
||||
<icon>terminal.png</icon>
|
||||
<onchange>=autoFill(cn;%uid%)</onchange>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="uidNumber">
|
||||
<display>UID Number</display>
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
<readonly>1</readonly>
|
||||
<value>=php.GetNextNumber(/;uidNumber)</value>
|
||||
</attribute>
|
||||
<attribute id="gidNumber">
|
||||
<display>GID Number</display>
|
||||
<order>3</order>
|
||||
<page>1</page>
|
||||
<value><![CDATA[=php.PickList(/;(&(objectClass=posixGroup));gidNumber;%cn%;;;;cn)]]></value>
|
||||
</attribute>
|
||||
<attribute id="sambaSID">
|
||||
<display>Samba SID</display>
|
||||
<helper>
|
||||
<id>sidsuffix</id>
|
||||
<value></value>
|
||||
</helper>
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
<post>=php.Join(-;%sambaSID%,%sidsuffix%)</post>
|
||||
<value><![CDATA[=php.PickList(/;(&(objectClass=sambaDomain));sambaSID;%sambaSID% (%sambaDomainName%);;;;sambaDomainName)]]></value>
|
||||
</attribute>
|
||||
<attribute id="sambaAcctFlags">
|
||||
<hidden>1</hidden>
|
||||
<value>[W]</value>
|
||||
</attribute>
|
||||
<attribute id="homeDirectory">
|
||||
<hidden>1</hidden>
|
||||
<value>/dev/null</value>
|
||||
</attribute>
|
||||
<attribute id="cn">
|
||||
<hidden>1</hidden>
|
||||
<value></value>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,133 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Samba3 Account</description>
|
||||
<icon>ldap-user.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>cn</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Samba: Account</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="inetOrgPerson"></objectClass>
|
||||
<objectClass id="sambaSAMAccount"></objectClass>
|
||||
<objectClass id="posixAccount"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="givenName">
|
||||
<display>First name</display>
|
||||
<icon>ldap-uid.png</icon>
|
||||
<onchange>=autoFill(cn;%givenName% %sn%)</onchange>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sn">
|
||||
<display>Last name</display>
|
||||
<onchange>=autoFill(cn;%givenName% %sn%)</onchange>
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="cn">
|
||||
<display>Common Name</display>
|
||||
<order>3</order>
|
||||
<page>1</page>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="gidNumber">
|
||||
<display>GID Number</display>
|
||||
<onchange>=autoFill(homeDirectory;/home/users/%gidNumber|0-0/T%/%uid|3-%)</onchange>
|
||||
<onchange>=autoFill(uid;%gidNumber|0-0/T%-%givenName|0-1/l%%sn/l%)</onchange>
|
||||
<order>4</order>
|
||||
<page>1</page>
|
||||
<value><![CDATA[=php.PickList(/;(&(objectClass=posixGroup));gidNumber;%cn%;;;;cn)]]></value>
|
||||
</attribute>
|
||||
<attribute id="uid">
|
||||
<display>User ID</display>
|
||||
<onchange>=autoFill(homeDirectory;/home/users/%gidNumber|0-0/T%/%uid|3-%)</onchange>
|
||||
<order>5</order>
|
||||
<page>1</page>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="uidNumber">
|
||||
<display>UID Number</display>
|
||||
<order>6</order>
|
||||
<page>1</page>
|
||||
<readonly>1</readonly>
|
||||
<value>=php.GetNextNumber(/;uidNumber)</value>
|
||||
</attribute>
|
||||
<attribute id="sambaSID">
|
||||
<display>Samba SID</display>
|
||||
<helper>
|
||||
<id>sidsuffix</id>
|
||||
<value>=php.GetNextNumber(/;uidNumber;false;;*2,+1000)</value>
|
||||
</helper>
|
||||
<order>7</order>
|
||||
<page>1</page>
|
||||
<post>=php.Join(-;%sambaSID%,%sidsuffix%)</post>
|
||||
<spacer>1</spacer>
|
||||
<value><![CDATA[=php.PickList(/;(&(objectClass=sambaDomain));sambaSID;%sambaSID% (%sambaDomainName%);;;;sambaDomainName)]]></value>
|
||||
</attribute>
|
||||
<attribute id="userPassword">
|
||||
<display>Password</display>
|
||||
<icon>lock.png</icon>
|
||||
<onchange>=autoFill(sambaLMPassword;%userPassword%)</onchange>
|
||||
<onchange>=autoFill(sambaNTPassword;%userPassword%)</onchange>
|
||||
<order>8</order>
|
||||
<post>=php.PasswordEncrypt(%enc%;%userPassword%)</post>
|
||||
<page>1</page>
|
||||
<verify>1</verify>
|
||||
</attribute>
|
||||
<attribute id="sambaLMPassword">
|
||||
<display>LM Password</display>
|
||||
<order>9</order>
|
||||
<page>1</page>
|
||||
<post>=php.PasswordEncrypt(LM;%sambaLMPassword%)</post>
|
||||
<type>password</type>
|
||||
</attribute>
|
||||
<attribute id="sambaNTPassword">
|
||||
<display>NT Password</display>
|
||||
<order>10</order>
|
||||
<page>1</page>
|
||||
<post>=php.PasswordEncrypt(NT;%sambaNTPassword%)</post>
|
||||
<spacer>1</spacer>
|
||||
<type>password</type>
|
||||
</attribute>
|
||||
<attribute id="loginShell">
|
||||
<display>Login shell</display>
|
||||
<icon>terminal.png</icon>
|
||||
<order>11</order>
|
||||
<page>1</page>
|
||||
<type>select</type>
|
||||
<!-- <value><![CDATA[=php.PickList(/;(&(objectClass=posixAccount));loginShell;%loginShell%)]]></value> -->
|
||||
<value id="/bin/sh">/bin/sh</value>
|
||||
<value id="/bin/csh">/bin/csh</value>
|
||||
<value id="/bin/tsh">/bin/tsh</value>
|
||||
</attribute>
|
||||
<attribute id="sambaPrimaryGroupSID">
|
||||
<display>Primary Group ID</display>
|
||||
<helper>
|
||||
<id>sidpgsuffix</id>
|
||||
<value></value>
|
||||
</helper>
|
||||
<order>13</order>
|
||||
<page>1</page>
|
||||
<post>=php.Join(-;%sambaPrimaryGroupSID%,%sidpgsuffix%)</post>
|
||||
<spacer>1</spacer>
|
||||
<value><![CDATA[=php.PickList(/;(&(objectClass=sambaGroupMapping));sambaSID;%sambaSID% (%cn%);sambaPrimaryGroupSID;;;;cn)]]></value>
|
||||
</attribute>
|
||||
<attribute id="homeDirectory">
|
||||
<display>Home directory</display>
|
||||
<order>14</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sambaAcctFlags">
|
||||
<hidden>1</hidden>
|
||||
<value>[U]</value>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,48 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Sendmail Alias</description>
|
||||
<icon>mail.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>sendmailMTACluster</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Sendmail: Alias</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="sendmailMTAAliasObject"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="sendmailMTACluster">
|
||||
<display>Sendmail Cluster Name</display>
|
||||
<icon>ldap-default.png</icon>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sendmailMTAHost">
|
||||
<display>Sendmail Hostname</display>
|
||||
<hint>Leave Blank</hint>
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sendmailMTAKey">
|
||||
<display>Email alias</display>
|
||||
<order>3</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sendmailMTAAliasValue">
|
||||
<display>Recipient Addresses</display>
|
||||
<order>4</order>
|
||||
<page>1</page>
|
||||
<type>textarea</type>
|
||||
</attribute>
|
||||
<attribute id="sendmailMTAAliasGrouping">
|
||||
<hidden>1</hidden>
|
||||
<value>aliases</value>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Sendmail Domain</description>
|
||||
<icon>mail.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>sendmailMTACluster</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Sendmail: Domain</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="sendmailMTAClass"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="sendmailMTACluster">
|
||||
<display>Sendmail Cluster Name</display>
|
||||
<icon>ldap-default.png</icon>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sendmailMTAHost">
|
||||
<display>Sendmail Hostname</display>
|
||||
<hint>Leave Blank</hint>
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sendmailMTAClassValue">
|
||||
<display>Email domain</display>
|
||||
<order>3</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sendmailMTAClassName">
|
||||
<hidden>1</hidden>
|
||||
<value>w</value>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Sendmail Cluster</description>
|
||||
<icon>mail.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>sendmailMTACluster</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Sendmail: Cluster</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="sendmailMTA"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="sendmailMTACluster">
|
||||
<display>Alias To</display>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,53 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<!--This template doesnt does not appear to be correct. If it is correct, or if
|
||||
you have modifications to make it correct, then let us know, and we'll
|
||||
update and enable it.-->
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Sendmail Relays</description>
|
||||
<icon>mail.png</icon>
|
||||
<invalid>1</invalid>
|
||||
<rdn>sendmailMTACluster</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Sendmail: Relays</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="sendmailMTAMapObject"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="sendmailMTACluster">
|
||||
<display>Sendmail Cluster Name</display>
|
||||
<icon>ldap-default.png</icon>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sendmailMTAHost">
|
||||
<display>Sendmail Hostname</display>
|
||||
<hint>Leave Blank</hint>
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sendmailMTAKey">
|
||||
<display>Host/Network/Address</display>
|
||||
<order>3</order>
|
||||
<page>1</page>
|
||||
<type>select</type>
|
||||
<value id="RELAY">RELAY: Allow host/network/address to relay</value>
|
||||
<value id="OK">OK: Accept local mail but disallow relay</value>
|
||||
<value id="REJECT">REJECT: Reject messages</value>
|
||||
<value id="DISCARD">DISCARD: Discard messages</value>
|
||||
<value id="SKIP">SKIP: Apply default action to messages</value>
|
||||
<value id="ERROR">ERROR: Reject message with custom error</value>
|
||||
</attribute>
|
||||
<attribute id="sendmailMTAMapName">
|
||||
<hidden>1</hidden>
|
||||
<value>access</value>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Sendmail Domain</description>
|
||||
<icon>mail.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>sendmailMTACluster</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Sendmail: Virtual Domain</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="sendmailMTAClass"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="sendmailMTACluster">
|
||||
<display>Sendmail Cluster Name</display>
|
||||
<icon>ldap-default.png</icon>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sendmailMTAHost">
|
||||
<display>Sendmail Hostname</display>
|
||||
<hint>Leave Blank</hint>
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sendmailMTAClassValue">
|
||||
<display>Email domain</display>
|
||||
<order>3</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sendmailMTAClassName">
|
||||
<hidden>1</hidden>
|
||||
<value>VirtHost</value>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,54 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<!--This template doesnt does not appear to be correct. If it is correct, or if
|
||||
you have modifications to make it correct, then let us know, and we'll
|
||||
update and enable it.-->
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Sendmail Virtual User</description>
|
||||
<icon>mail.png</icon>
|
||||
<invalid>1</invalid>
|
||||
<rdn>sendmailMTAMapObject</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Sendmail: Virtual Users</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="sendmailMTAMapObject"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="sendmailMTACluster">
|
||||
<display>Sendmail Cluster Name</display>
|
||||
<icon>ldap-default.png</icon>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sendmailMTAHost">
|
||||
<display>Sendmail Hostname</display>
|
||||
<hint>Leave Blank</hint>
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sendmailMTAKey">
|
||||
<display>Email alias</display>
|
||||
<hint>use @example.com to map entire domain</hint>
|
||||
<order>3</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="sendmailMTAMapValue">
|
||||
<display>Recipient Addresses</display>
|
||||
<hint>use %1 to map user name port of address</hint>
|
||||
<order>4</order>
|
||||
<page>1</page>
|
||||
<type>textarea</type>
|
||||
</attribute>
|
||||
<attribute id="sendmailMTAMapName">
|
||||
<hidden>1</hidden>
|
||||
<value>virtuser</value>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,37 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Simple Security Object</description>
|
||||
<icon>ldap-user.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>userid</rdn>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Generic: Simple Security Object</title>
|
||||
<visible>1</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="account"></objectClass>
|
||||
<objectClass id="simpleSecurityObject"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="userid">
|
||||
<display>User Name</display>
|
||||
<icon>ldap-uid.png</icon>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="userPassword">
|
||||
<display>Password</display>
|
||||
<icon>lock.png</icon>
|
||||
<order>5</order>
|
||||
<page>1</page>
|
||||
<post>=php.PasswordEncrypt(%enc%;%userPassword%)</post>
|
||||
<verify>1</verify>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,85 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<description>Address Book Entry</description>
|
||||
<icon>address-book.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<rdn>cn</rdn>
|
||||
<noleaf>1</noleaf>
|
||||
<!--<regexp>^ou=People,o=.*,</regexp>-->
|
||||
<title>Generic: Address Book Entry</title>
|
||||
<visible>0</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="inetOrgPerson"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="givenName">
|
||||
<display>First name</display>
|
||||
<icon>ldap-uid.png</icon>
|
||||
<onchange>=autoFill(cn;%givenName% %sn%)</onchange>
|
||||
<order>1</order>
|
||||
</attribute>
|
||||
<attribute id="sn">
|
||||
<display>Last name</display>
|
||||
<onchange>=autoFill(cn;%givenName% %sn%)</onchange>
|
||||
<order>2</order>
|
||||
</attribute>
|
||||
<attribute id="cn">
|
||||
<display>Common Name</display>
|
||||
<order>3</order>
|
||||
<readonly>1</readonly>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="jpegPhoto">
|
||||
<display>Photo</display>
|
||||
<order>3</order>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="o">
|
||||
<display>Organisation</display>
|
||||
<order>4</order>
|
||||
</attribute>
|
||||
<attribute id="street">
|
||||
<cols>50</cols>
|
||||
<display>Street</display>
|
||||
<icon>mail.png</icon>
|
||||
<order>5</order>
|
||||
<rows>4</rows>
|
||||
<type>textarea</type>
|
||||
</attribute>
|
||||
<attribute id="l">
|
||||
<display>City</display>
|
||||
<order>6</order>
|
||||
</attribute>
|
||||
<attribute id="st">
|
||||
<display>State</display>
|
||||
<order>7</order>
|
||||
</attribute>
|
||||
<attribute id="postalCode">
|
||||
<display>Postal code</display>
|
||||
<order>8</order>
|
||||
<spacer>1</spacer>
|
||||
</attribute>
|
||||
<attribute id="telephoneNumber">
|
||||
<display>Work phone</display>
|
||||
<icon>phone.png</icon>
|
||||
<order>9</order>
|
||||
</attribute>
|
||||
<attribute id="facsimileTelephoneNumber">
|
||||
<display>Fax</display>
|
||||
<order>10</order>
|
||||
</attribute>
|
||||
<attribute id="mobile">
|
||||
<display>Mobile</display>
|
||||
<order>11</order>
|
||||
</attribute>
|
||||
<attribute id="mail">
|
||||
<display>Email</display>
|
||||
<order>12</order>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE template SYSTEM "template.dtd">
|
||||
|
||||
<template>
|
||||
<askcontainer>1</askcontainer>
|
||||
<description>New Posix Group</description>
|
||||
<icon>ldap-ou.png</icon>
|
||||
<invalid>0</invalid>
|
||||
<noleaf>1</noleaf>
|
||||
<rdn>cn</rdn>
|
||||
<!-- <regexp>^ou=.*,</regexp> -->
|
||||
<title>Generic: Posix Group</title>
|
||||
<visible>0</visible>
|
||||
|
||||
<objectClasses>
|
||||
<objectClass id="posixGroup"></objectClass>
|
||||
</objectClasses>
|
||||
|
||||
<attributes>
|
||||
<attribute id="cn">
|
||||
<display>Group</display>
|
||||
<order>1</order>
|
||||
<page>1</page>
|
||||
</attribute>
|
||||
<attribute id="gidNumber">
|
||||
<display>GID Number</display>
|
||||
<!-- <option><![CDATA[=php.GetNextNumber(/;gidNumber;false;(&(objectClass=posixGroup));*2,+1000)]]></option> -->
|
||||
<order>2</order>
|
||||
<page>1</page>
|
||||
<readonly>1</readonly>
|
||||
<spacer>1</spacer>
|
||||
<value>=php.GetNextNumber(/;gidNumber)</value>
|
||||
</attribute>
|
||||
<attribute id="memberUid">
|
||||
<display>Users</display>
|
||||
<hidden>0</hidden>
|
||||
<order>3</order>
|
||||
<page>1</page>
|
||||
<value><![CDATA[=php.MultiList(/;(objectClass=posixAccount);uid;%cn% (%uid|-4%))]]></value>
|
||||
</attribute>
|
||||
</attributes>
|
||||
|
||||
</template>
|
@ -1,71 +0,0 @@
|
||||
<!--
|
||||
==========================================================================
|
||||
This is the DTD for phpLDAPAdmin Templates.
|
||||
|
||||
Copyright (c) 2009
|
||||
|
||||
Temporary URI for the DTD: http://phpldapadmin.sf.net/release/templates/template.dtd
|
||||
Validate your templates here: http://www.xmlvalidation.com
|
||||
==========================================================================
|
||||
-->
|
||||
|
||||
<!-- Unused -->
|
||||
<!ENTITY % Boolean "(0 | 1)">
|
||||
|
||||
<!-- ================================================================ -->
|
||||
|
||||
<!-- Template Definition -->
|
||||
<!ELEMENT template (askcontainer?,description?,icon?,invalid?,rdn?,regexp?,
|
||||
title,visible?,objectClasses,attributes)>
|
||||
|
||||
<!-- ObjectClasses Definition -->
|
||||
<!ELEMENT objectClasses (objectClass+)>
|
||||
<!ELEMENT objectClass EMPTY>
|
||||
<!ATTLIST objectClass id CDATA #REQUIRED>
|
||||
|
||||
<!-- Attributes Definition -->
|
||||
<!ELEMENT attributes (attribute*)>
|
||||
<!ELEMENT attribute (cols?,default?,display?,helper?,hidden?,hint?,icon?,
|
||||
maxlength?,onchange*,order?,page?,post?,presubmit?,readonly?,rows?,size?,
|
||||
spacer?,type?,value*,verify?)?>
|
||||
<!ATTLIST attribute id CDATA #REQUIRED>
|
||||
|
||||
<!-- helper -->
|
||||
<!ELEMENT helper (default?,display?,id?,value*)>
|
||||
|
||||
<!-- ================================================================ -->
|
||||
|
||||
<!-- Common Parameters -->
|
||||
<!ELEMENT icon (#PCDATA)>
|
||||
<!ELEMENT default (#PCDATA)>
|
||||
<!ELEMENT display (#PCDATA)>
|
||||
<!ELEMENT value (#PCDATA)>
|
||||
|
||||
<!-- Header Parameters -->
|
||||
<!ELEMENT askcontainer (#PCDATA)>
|
||||
<!ELEMENT description (#PCDATA)>
|
||||
<!ELEMENT invalid (#PCDATA)>
|
||||
<!ELEMENT rdn (#PCDATA)>
|
||||
<!ELEMENT regexp (#PCDATA)>
|
||||
<!ELEMENT title (#PCDATA)>
|
||||
<!ELEMENT visible (#PCDATA)>
|
||||
|
||||
<!-- Attribute Parameters -->
|
||||
<!ELEMENT cols (#PCDATA)>
|
||||
<!ELEMENT hidden (#PCDATA)>
|
||||
<!ELEMENT hint (#PCDATA)>
|
||||
<!ELEMENT maxlength (#PCDATA)>
|
||||
<!ELEMENT onchange (#PCDATA)>
|
||||
<!ELEMENT order (#PCDATA)>
|
||||
<!ELEMENT page (#PCDATA)>
|
||||
<!ELEMENT post (#PCDATA)>
|
||||
<!ELEMENT presubmit (#PCDATA)>
|
||||
<!ELEMENT readonly (#PCDATA)>
|
||||
<!ELEMENT rows (#PCDATA)>
|
||||
<!ELEMENT size (#PCDATA)>
|
||||
<!ELEMENT spacer (#PCDATA)>
|
||||
<!ELEMENT type (#PCDATA)>
|
||||
<!ELEMENT verify (#PCDATA)>
|
||||
|
||||
<!-- Helper Parameters -->
|
||||
<!ELEMENT id (#PCDATA)>
|
Loading…
x
Reference in New Issue
Block a user