Remove some no longer to be referenced 1.2 files
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
?>
|
@@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
@@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user