Remove some no longer to be referenced 1.2 files

This commit is contained in:
Deon George 2024-01-12 10:28:38 +11:00
parent b6d1124d4e
commit ded1f74285
5 changed files with 0 additions and 698 deletions

View File

@ -1,185 +0,0 @@
<?php
/**
* Displays a form for adding an attribute/value to an LDAP entry.
*
* @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 TemplateRender($app['server']->getIndex(),get_request('template','REQUEST',false,null));
$request['page']->setDN($request['dn']);
$request['page']->accept(true);
$request['template'] = $request['page']->getTemplate();
# Render the form
if (get_request('meth','REQUEST') != 'ajax') {
$request['page']->drawTitle(sprintf('%s <b>%s</b>',_('Add new attribute'),get_rdn($request['dn'])));
$request['page']->drawSubTitle();
echo '<div style="text-align: center;">';
if (count($request['template']->getAvailAttrs())) {
# If we have more than the configured entries, we'll separate our input to the old ways.
if (count($request['template']->getAvailAttrs()) > $_SESSION[APPCONFIG]->getValue('appearance','max_add_attrs')) {
$attr = array();
$attr['avail'] = array();
$attr['binary'] = array();
foreach ($request['template']->getAvailAttrs() as $attribute)
if ($app['server']->isAttrBinary($attribute->getName()))
array_push($attr['binary'],$attribute);
else
array_push($attr['avail'],$attribute);
if (count($attr['avail']) > 0) {
echo '<br />';
echo _('Add new attribute');
echo '<br />';
echo '<br />';
echo '<form action="cmd.php" method="post">';
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" />';
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($request['dn']));
echo '<select name="single_item_attr">';
foreach ($attr['avail'] as $attribute) {
# Is there a user-friendly translation available for this attribute?
if ($attribute->haveFriendlyName())
$attr_display = sprintf('%s (%s)',$attribute->getFriendlyName(),$attribute->getName(false));
else
$attr_display = $attribute->getName(false);
printf('<option value="%s">%s</option>',htmlspecialchars($attribute->getName()),$attr_display);
}
echo '</select>';
echo '<input type="text" name="single_item_value" size="20" />';
printf('<input type="submit" name="submit" value="%s" class="update_dn" />',_('Add'));
echo '</div>';
echo '</form>';
} else {
echo '<br />';
printf('<small>(%s)</small>',_('no new attributes available for this entry'));
}
if (count($attr['binary']) > 0) {
echo '<br />';
echo _('Add new binary attribute');
echo '<br />';
echo '<br />';
echo '<!-- Form to add a new BINARY attribute to this entry -->';
echo '<form action="cmd.php" method="post" enctype="multipart/form-data">';
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" />';
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
printf('<input type="hidden" name="dn" value="%s" />',$request['dn']);
echo '<input type="hidden" name="binary" value="true" />';
echo '<select name="single_item_attr">';
foreach ($attr['binary'] as $attribute) {
# Is there a user-friendly translation available for this attribute?
if ($attribute->haveFriendlyName())
$attr_display = sprintf('%s (%s)',$attribute->getFriendlyName(),$attribute->getName(false));
else
$attr_display = $attribute->getName(false);
printf('<option value="%s">%s</option>',htmlspecialchars($attribute->getName()),$attr_display);
}
echo '</select>';
echo '<input type="file" name="single_item_value" size="20" />';
printf('<input type="submit" name="submit" value="%s" class="update_dn" />',_('Add'));
if (! ini_get('file_uploads'))
printf('<br /><small><b>%s</b></small><br />',
_('Your PHP configuration has disabled file uploads. Please check php.ini before proceeding.'));
else
printf('<br /><small><b>%s: %s</b></small><br />',_('Maximum file size'),ini_get('upload_max_filesize'));
echo '</div>';
echo '</form>';
} else {
echo '<br />';
printf('<small>(%s)</small>',_('no new binary attributes available for this entry'));
}
} else {
echo '<br />';
$request['page']->drawFormStart();
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($request['dn']));
echo '<table class="entry" cellspacing="0" align="center" border="0">';
foreach ($request['template']->getAvailAttrs() as $attribute)
$request['page']->draw('Template',$attribute);
$request['page']->drawFormSubmitButton();
echo '</table>';
$request['page']->drawFormEnd();
}
} else {
printf('<small>(%s)</small>',_('no new attributes available for this entry'));
}
echo '</div>';
# The ajax addition (it is going into an existing TemplateRendered page
} else {
# Put our DIV there for the callback
echo '<fieldset>';
printf('<legend>%s</legend>',_('Add Attribute'));
echo '<div id="ajADDATTR">';
echo '<table class="entry" cellspacing="0" align="center" border="0">';
echo '<td valign="top" align="center">';
printf('<select name="attr" onchange="ajDISPLAY(\'%s\',\'cmd=add_value_form&server_id=%s&dn=%s&attr=\'+this.value,\'%s\',\'append\');">',
'ADDATTR',$app['server']->getIndex(),$request['template']->getDNEncode(),_('Please Wait'));
printf('<option value="%s">%s</option>','','');
foreach ($request['template']->getAvailAttrs() as $attribute)
printf('<option value="%s">%s</option>',htmlspecialchars($attribute->getName()),$attribute->getFriendlyName());
echo '</select>';
echo '</td>';
echo '</table>';
echo '</div>';
echo '</fieldset>';
}
?>

View File

@ -1,259 +0,0 @@
<?php
/**
* Displays the information from the monitor context
*
* @package phpLDAPadmin
* @subpackage Page
*/
/**
*/
require './common.php';
$attrs = $app['server']->getRootDSE();
$query = array();
$query['base'] = $attrs['monitorcontext'][0];
$query['scope'] = 'sub';
$query['attrs'] = array('+','*');
$results = $app['server']->query($query,null);
if (! isset($attrs['monitorcontext']) || ! count($results))
system_message(array(
'title'=>_('Monitoring context does not exist'),
'body'=>sprintf('%s: <b>%s</b>',_('Could not obtain the monitor context for this server'),$app['server']->getName()),
'type'=>'warn'),'index.php');
printf('<h3 class="title">%s%s</h3>',_('Monitor info for: '),$app['server']->getName());
printf('<h3 class="subtitle">%s</h3>',_('Server reports the following information about itself'));
echo '<table class="result" border="0">';
# cn=Monitor
printf('<tr class="list_item"><td class="heading" rowspan="2">%s</td></tr>',_('LDAP Server'));
printf('<tr class="list_item"><td class="value">');
echo '<table class="result" border="0">';
printf('<tr><td>%s</td></tr>',$results[$attrs['monitorcontext'][0]]['monitoredinfo'][0]);
echo '</table>';
echo '</td></tr>';
foreach (array(
'cn=Backends,cn=Monitor' => 'cn=Backend %s,%s',
'cn=Overlays,cn=Monitor' => 'cn=Overlay %s,%s'
) as $dn => $child) {
if (isset($results[$dn]['description'])) {
$description = implode(' ',$results[$dn]['description']);
$description = preg_replace('/"/','\'',$description);
} else {
$description = '';
}
printf('<tr class="list_item"><td class="heading" rowspan="2"><acronym title="%s">%s</acronym></td></tr>',$description,$dn);
echo '<tr class="list_item"><td class="value">';
echo '<table class="result"><tr><td>';
echo '<table class="result_table" border="0" width="100%">';
$attrs = array(
'monitorruntimeconfig',
'supportedcontrol'
);
echo '<tr class="highlight">';
printf('<td style="width: 10%%;">%s</td><td style="width: 20%%;">%s</td>',_('Type'),'namingContext');
foreach ($attrs as $attr)
printf('<td style="width: 20%%;">%s</td>',$attr);
echo '</tr>';
$counter = 0;
foreach ($results[$dn]['monitoredinfo'] as $index => $backend) {
printf('<tr class="%s">',$counter++%2==0?'even':'odd');
printf('<td>%s</td>',$backend);
$key = sprintf($child,$index,$dn);
echo '<td>';
if (isset($results[$key]['seealso'])) {
$seealso = is_array($results[$key]['seealso']) ? $results[$key]['seealso'] : array($results[$key]['seealso']);
foreach ($seealso as $db)
if (isset($results[$db]['namingcontexts']))
printf('<acronym title="%s">%s</acronym><br/>',
isset($results[$db]['labeleduri']) ? implode(' ',$results[$db]['labeleduri']) : _('Internal'),
implode(' ',$results[$db]['namingcontexts']));
else
printf('%s ',implode(' ',$results[$db]['monitoredinfo']));
} else {
echo '&nbsp;';
}
echo '</td>';
foreach ($attrs as $attr) {
echo '<td>';
if (isset($results[$key][$attr])) {
if (! is_array($results[$key][$attr]))
$sc = array($results[$key][$attr]);
else
$sc = $results[$key][$attr];
if (strcasecmp('supportedcontrol',$attr) == 0)
foreach ($sc as $control) {
$oidtotext = support_oid_to_text($control);
printf('<acronym title="%s">%s</acronym><br/>',
$control,$oidtotext['title']);
}
else
printf('%s ',implode('<br/>',$sc));
} else {
echo '&nbsp;';
}
echo '</td>';
}
echo '</tr>';
}
echo '</table></td></tr>';
echo '</table>';
echo '</td></tr>';
}
# cn=Connections,cn=Monitor
printf('<tr class="list_item"><td class="heading" rowspan="2"><acronym title="%s">%s</acronym></td></tr>',$results['cn=Connections,cn=Monitor']['description'][0],_('LDAP Connections'));
printf('<tr class="list_item"><td class="value">');
echo '<table class="result"><tr><td>';
echo '<table class="result_table" border="0" width="100%">';
printf('<tr class="highlight"><td class="20%%">%s</td><td class="value" style="width: 80%%;">%s</td></tr>',
_('Total Connections'),$results['cn=Total,cn=Connections,cn=Monitor']['monitorcounter'][0]);
printf('<tr class="highlight"><td class="20%%">%s</td><td class="value" style="width: 80%%;">%s</td></tr>',
_('Current Connections'),$results['cn=Current,cn=Connections,cn=Monitor']['monitorcounter'][0]);
# Look for some connections
foreach ($results as $key => $value) {
if (preg_match('/^cn=Connection.*,cn=Connections,cn=Monitor$/',$key)) {
echo '<tr class="highlight">';
printf('<td>%s</td>',$results[$key]['cn'][0]);
echo '<td class="value">';
echo '<table class="result_table" border="0" width="100%">';
$counter = 0;
foreach (array(
'monitorconnectionactivitytime',
'monitorconnectionauthzdn',
'monitorconnectionget',
'monitorconnectionlistener',
'monitorconnectionlocaladdress',
'monitorconnectionmask',
'monitorconnectionnumber',
'monitorconnectionopscompleted',
'monitorconnectionopsexecuting',
'monitorconnectionopspending',
'monitorconnectionopsreceived',
'monitorconnectionpeeraddress',
'monitorconnectionpeerdomain',
'monitorconnectionprotocol',
'monitorconnectionread',
'monitorconnectionstarttime',
'monitorconnectionwrite'
) as $metric) {
printf('<tr class="%s">',$counter++%2==0?'even':'odd');
printf('<td class="title" style="width: 35%%;">%s</td><td style="width: 65%%;">%s</td>',
$metric,isset($results[$key][$metric]) ? $results[$key][$metric][0] : '&nbsp;');
echo '</tr>';
}
echo '</table>';
echo '</td>';
echo '</tr>';
}
}
echo '</table></td></tr>';
echo '</table>';
echo '</td></tr>';
foreach (array(
'cn=Listeners,cn=Monitor',
'cn=Log,cn=Monitor',
'cn=Operations,cn=Monitor',
'cn=SASL,cn=Monitor',
'cn=TLS,cn=Monitor',
'cn=Statistics,cn=Monitor',
'cn=Threads,cn=Monitor',
'cn=Time,cn=Monitor',
'cn=Waiters,cn=Monitor'
) as $dn ) {
$description = implode(' ',$results[$dn]['description']);
$description = preg_replace('/"/','\'',$description);
printf('<tr class="list_item"><td class="heading" rowspan="2"><acronym title="%s">%s</acronym></td></tr>',$description,$dn);
echo '<tr class="list_item"><td class="value">';
echo '<table class="result"><tr><td>';
echo '<table class="result_table" border="0" width="100%">';
if (isset($results[$dn]['monitoropinitiated']))
printf('<tr class="highlight"><td style="width: 20%%;">%s</td><td class="value" style="width: 80%%;">%s</td></tr>',
'monitorOpInitiated',$results[$dn]['monitoropinitiated'][0]);
if (isset($results[$dn]['monitoropcompleted']))
printf('<tr class="highlight"><td style="width: 20%%;">%s</td><td class="value" style="width: 80%%;">%s</td></tr>',
'monitorOpCompleted',$results[$dn]['monitoropcompleted'][0]);
if (isset($results[$dn]['monitoredinfo']))
printf('<tr class="highlight"><td style="width: 20%%;">%s</td><td class="value" style="width: 80%%;">%s</td></tr>',
'monitoredInfo',$results[$dn]['monitoredinfo'][0]);
# Look for some connecitons
foreach ($results as $key => $value) {
if (preg_match('/^.*,'.$dn.'$/',$key)) {
echo '<tr class="highlight">';
printf('<td style="width: 20%%;">%s</td>',$results[$key]['cn'][0]);
echo '<td class="value" style="width: 80%;">';
echo '<table class="result_table" border="0" width="100%">';
foreach (array(
'labeleduri',
'monitorconnectionlocaladdress',
'monitoredinfo',
'monitorcounter',
'monitoropinitiated',
'monitoropcompleted',
'monitortimestamp'
) as $metric) {
if (isset($results[$key][$metric])) {
printf('<tr class="%s">',$counter++%2==0?'even':'odd');
printf('<td class="title" style="width: 35%%;">%s</td><td style="width: 65%%;">%s</td>',
$metric,$results[$key][$metric][0]);
echo '</tr>';
}
}
echo '</table>';
echo '</td>';
echo '</tr>';
}
}
echo '</table></td></tr>';
echo '</table>';
echo '</td></tr>';
}
echo '</table>';
?>

View File

@ -1,148 +0,0 @@
<?php
/**
* Allows to create new attributes
*
* @author The phpLDAPadmin development team
* @package phpLDAPadmin
*/
/**
* AttributeFactory Class
*
* @package phpLDAPadmin
* @subpackage Templates
*/
class AttributeFactory {
public function newAttribute($name,$values,$server_id,$source=null) {
global $app;
# Check to see if the value is auto generated, our attribute type is dependant on the function called.
if (isset($values['post']) && ! is_array($values['post'])) {
if (preg_match('/^=php\.(\w+)\((.*)\)$/',$values['post'],$matches)) {
switch ($matches[1]) {
case 'Join':
case 'PasswordEncrypt':
break;
default:
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
system_message(array(
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown template [post] function'),$matches[1]),
'body'=>sprintf('%s <small>[%s]</small>',_('The template function is not known and will be ignored.'),$values['post']),
'type'=>'warn'));
unset($values['post']);
}
}
}
# Check our helper functions exists
if (isset($values['helper']['value']) && ! is_array($values['helper']['value']))
if (preg_match('/^=php\.(\w+)\((.*)\)$/',$values['helper']['value'],$matches))
if (! in_array($matches[1],array('GetNextNumber','PasswordEncryptionTypes'))) {
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
system_message(array(
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown template helper function'),$matches[1]),
'body'=>sprintf('%s <small>[%s]</small>',_('The template helper function is not known and will be ignored.'),$values['helper']['value']),
'type'=>'warn'));
unset($values['helper']['value']);
}
# Check to see if the value is auto generated, our attribute type is dependant on the function called.
if (isset($values['value']) && ! is_array($values['value'])) {
if (preg_match('/^=php\.(\w+)\((.*)\)$/',$values['value'],$matches)) {
switch ($matches[1]) {
case 'MultiList':
if (! isset($values['type']))
$values['type'] = 'multiselect';
case 'PickList':
return $this->newSelectionAttribute($name,$values,$server_id,$source);
case 'RandomPassword':
return $this->newRandomPasswordAttribute($name,$values,$server_id,$source);
# Fall through and determine the attribute using other methods.
case 'GetNextNumber':
case 'Function' :
break;
default:
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning'))
system_message(array(
'title'=>sprintf('%s [<i>%s</i>]',_('Unknown template function'),$matches[1]),
'body'=>sprintf('%s <small>[%s]</small>',_('The template function is not known and will be ignored.'),$values['value']),
'type'=>'warn'));
unset($values['value']);
}
}
}
if (isset($values['type']))
switch ($values['type']) {
case 'password':
if (! strcasecmp($name,'sambaLMPassword') || ! strcasecmp($name,'sambaNTPassword'))
return $this->newSambaPasswordAttribute($name,$values,$server_id,$source);
else
return $this->newPasswordAttribute($name,$values,$server_id,$source);
case 'multiselect':
case 'select':
return $this->newSelectionAttribute($name,$values,$server_id,$source);
case 'textarea':
return $this->newMultiLineAttribute($name,$values,$server_id,$source);
}
if ($app['server']->isAttrBinary($name)) {
return $this->newBinaryAttribute($name,$values,$server_id,$source);
} elseif (! strcasecmp($name,'sambaLMPassword') || ! strcasecmp($name,'sambaNTPassword')) {
return $this->newSambaPasswordAttribute($name,$values,$server_id,$source);
} elseif (in_array(strtolower($name),array_keys(array_change_key_case($_SESSION[APPCONFIG]->getValue('appearance','date_attrs'))))) {
return $this->newDateAttribute($name,$values,$server_id,$source);
} elseif (in_array(strtolower($name),array('shadowlastchange','shadowmin','shadowmax','shadowexpire','shadowwarning','shadowinactive'))) {
return $this->newShadowAttribute($name,$values,$server_id,$source);
} elseif ($app['server']->isAttrBoolean($name)) {
$attribute = $this->newSelectionAttribute($name,$values,$server_id,$source);
$attribute->addOption('TRUE',_('true'));
$attribute->addOption('FALSE',_('false'));
return $attribute;
} elseif ($app['server']->isDNAttr($name)) {
return $this->newDnAttribute($name,$values,$server_id,$source);
} elseif ($app['server']->isMultiLineAttr($name)) {
return $this->newMultiLineAttribute($name,$values,$server_id,$source);
} else {
return new Attribute($name,$values,$server_id,$source);
}
}
private function newSambaPasswordAttribute($name,$values,$server_id,$source) {
return new SambaPasswordAttribute($name,$values,$server_id,$source);
}
private function newRandomPasswordAttribute($name,$values,$server_id,$source) {
return new RandomPasswordAttribute($name,$values,$server_id,$source);
}
private function newShadowAttribute($name,$values,$server_id,$source) {
return new ShadowAttribute($name,$values,$server_id,$source);
}
private function newSelectionAttribute($name,$values,$server_id,$source) {
return new SelectionAttribute($name,$values,$server_id,$source);
}
private function newMultiLineAttribute($name,$values,$server_id,$source) {
return new MultiLineAttribute($name,$values,$server_id,$source);
}
}
?>

View File

@ -1,35 +0,0 @@
<?php
/**
* Classes and functions for the template engine.
*
* @author The phpLDAPadmin development team
* @package phpLDAPadmin
*/
/**
* Represents a attribute whose values are multiline text
*
* @package phpLDAPadmin
* @subpackage Templates
*/
class MultiLineAttribute extends Attribute {
protected $rows = 0;
protected $cols = 0;
public function getRows() {
return $this->rows;
}
public function setRows($rows) {
$this->rows = $rows;
}
public function getCols() {
return $this->cols;
}
public function setCols($cols) {
$this->cols = $cols;
}
}
?>

View File

@ -1,71 +0,0 @@
<?php
/**
* Classes and functions for the template engine.
*
* @author The phpLDAPadmin development team
* @package phpLDAPadmin
*/
/**
* Represents an attribute whose values are in a predefined list
*
* @package phpLDAPadmin
* @subpackage Templates
*/
class SelectionAttribute extends Attribute {
protected $selection = array();
protected $multiple;
protected $default;
public function __construct($name,$values,$server_id,$source=null) {
# Call our parent constructor
parent::__construct($name,$values,$server_id,$source);
# Our values are set by parent(). If we do have values, and the source was XML, move them to our selection.
if ($this->source == 'XML' && $this->values) {
$this->selection = $this->values;
$this->values = array();
}
if (isset($values['type']) && $values['type'] == 'multiselect')
$this->multiple = true;
else
$this->multiple = false;
}
public function addOption($value,$description) {
$this->selection[$value] = $description;
}
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);
$this->addOption($new_val,$i);
}
public function getOptionCount() {
return count($this->selection);
}
public function getSelection() {
return $this->selection;
}
public function autoValue($value) {
$this->selection = $value;
}
public function getDefault() {
return $this->default;
}
public function isMultiple() {
return $this->multiple;
}
public function setMultiple() {
$this->multiple = true;
}
}
?>