Merge pull request #48 from LDAPAccountManager/php7.2

Php7.2
This commit is contained in:
gruberroland 2018-05-01 10:11:01 +02:00 committed by GitHub
commit 20bee9f684
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 336 additions and 2214 deletions

View File

@ -1,6 +1,6 @@
{
"require-dev" : {
"phpunit/phpunit" : "4.5.0",
"phpunit/phpunit" : "5.4.6",
"squizlabs/php_codesniffer" : "2.7.1"
}
}

View File

@ -1,6 +1,7 @@
June 2018
- Passwords can be checked against external service (e.g. https://api.pwnedpasswords.com/range)
- IMAP: create mailbox via file upload
- PHP 7.2 support
- LAM Pro:
-> Better support for 389ds password expiration

View File

@ -281,7 +281,7 @@ class ldapPublicKey extends baseModule {
*/
function get_pdfEntries($pdfKeys, $typeId) {
$return = array();
if (sizeof($this->attributes['sshPublicKey']) > 0) {
if (!empty($this->attributes['sshPublicKey'])) {
$pdfTable = new PDFTable(_('SSH public keys'));
for ($i = 0; $i < sizeof($this->attributes['sshPublicKey']); $i++) {
$pdfRow = new PDFTableRow();

View File

@ -191,7 +191,7 @@ class quota extends baseModule {
$remote->connect($server);
$quotas = $remote->execute(implode(quota::$SPLIT_DELIMITER, array($userName, "quota", "get", $this->get_scope())));
$remote->disconnect();
if (sizeof($quotas) == 0) {
if (empty($quotas)) {
continue;
}
$allQuotas = explode(":", $quotas);

View File

@ -2240,9 +2240,9 @@ class sambaSamAccount extends baseModule implements passwordService {
// passwords ( = host name)
$partialAccounts[$i]['sambaPwdLastSet'] = time();
if (isset($this->moduleSettings['sambaSamAccount_lmHash'][0]) && ($this->moduleSettings['sambaSamAccount_lmHash'][0] == 'no')) {
$partialAccounts[$i]['sambaLMPassword'] = lmPassword(substr($partialAccounts[$i]['uid'], 0, sizeof($partialAccounts[$i]['uid']) - 1));
$partialAccounts[$i]['sambaLMPassword'] = lmPassword(substr($partialAccounts[$i]['uid'], 0, strlen($partialAccounts[$i]['uid']) - 1));
}
$partialAccounts[$i]['sambaNTPassword'] = ntPassword(substr($partialAccounts[$i]['uid'], 0, sizeof($partialAccounts[$i]['uid']) - 1));
$partialAccounts[$i]['sambaNTPassword'] = ntPassword(substr($partialAccounts[$i]['uid'], 0, strlen($partialAccounts[$i]['uid']) - 1));
// flags
$partialAccounts[$i]['sambaAcctFlags'] = "[W ]";
}

View File

@ -30,9 +30,6 @@ elseif (file_exists('welcome.php'))
else
$app['script_cmd'] = null;
if (DEBUG_ENABLED)
debug_log('Ready to render page for command [%s,%s].',128,0,__FILE__,__LINE__,__METHOD__,$www['cmd'],$app['script_cmd']);
# Create page.
# Set the index so that we render the right server tree.
$www['page'] = new page($app['server']->getIndex());

View File

@ -112,9 +112,6 @@ if ($copy_result) {
}
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;
@ -162,9 +159,6 @@ function r_copy_dn($serverSRC,$serverDST,$snapshottree,$dnSRC,$dnDST,$remove) {
}
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);
@ -186,9 +180,6 @@ function copy_dn($serverSRC,$serverDST,$dnSRC,$dnDST,$remove) {
}
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);
@ -198,9 +189,6 @@ function build_tree($server,$dn,$buildtree) {
$buildtree = build_tree($server,$child_dn,$buildtree);
}
if (DEBUG_ENABLED)
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$buildtree);
return $buildtree;
}
?>

View File

@ -43,9 +43,6 @@ if (isset($app['server']) && ! is_null($request['container'])) {
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']));

View File

@ -23,9 +23,6 @@ class AJAXTree extends HTMLTree {
* @param boolean $last_child is the last child entry, which is normally the "Create New Entry" option
*/
protected function draw_item($item,$level,$first_child=true,$last_child=true) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer();
# Level pre-treatment
@ -136,9 +133,6 @@ class AJAXTree extends HTMLTree {
* Expand and draw a child entry, when it is clicked on. This is using AJAX just to render this section of the tree.
*/
public function draw_children($parent_entry,$code) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$children = array();
foreach ($parent_entry->getChildren() as $child) {
@ -184,9 +178,6 @@ class AJAXTree extends HTMLTree {
* @param $code a string of 0 and 1 ; $code == "000101" will return " | |"
*/
protected function get_indentation($code) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$indent = '';
for ($i=0; $i<strlen($code); $i++) {
@ -208,9 +199,6 @@ class AJAXTree extends HTMLTree {
* Draw the javascript to support the tree.
*/
protected function draw_javascript() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
parent::draw_javascript();
printf('<script type="text/javascript" src="%slayersmenu-browser_detection.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%sajax_tree.js"></script>',JSDIR);
@ -220,9 +208,6 @@ class AJAXTree extends HTMLTree {
* Draw the "Create New Entry" item before the children.
*/
private function create_before_child($entry,$level) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (strlen($level) == 0)
return '';
@ -240,9 +225,6 @@ class AJAXTree extends HTMLTree {
* Draw the "Create New Entry" item after the children.
*/
private function create_after_child($entry,$level) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (strlen($level) == 0)
return '';
@ -259,9 +241,6 @@ class AJAXTree extends HTMLTree {
* Draw the "Create New Entry" item.
*/
private function draw_create_new_entry($entry,$level,$img) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$output = '';
$href = sprintf('cmd=template_engine&server_id=%s&container=%s',$this->getServerID(),$entry->getDNEncode());
@ -292,9 +271,6 @@ class AJAXTree extends HTMLTree {
* @return array List of open nodes
*/
public function listOpenItems() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$result = array();
foreach ($this->entries as $dn => $value)

View File

@ -79,9 +79,6 @@ class Attribute {
protected $postvalue = array();
public function __construct($name,$values,$server_id,$source=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $_SESSION[APPCONFIG]->getServer($server_id);
$sattr = $server->getSchemaAttribute($name);
@ -129,9 +126,6 @@ class Attribute {
* @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
@ -139,30 +133,18 @@ class Attribute {
}
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;
}
@ -170,9 +152,6 @@ class Attribute {
* 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;
@ -180,9 +159,6 @@ class Attribute {
}
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);
@ -192,23 +168,14 @@ class Attribute {
}
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;
@ -228,9 +195,6 @@ class Attribute {
}
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();
@ -242,9 +206,6 @@ class Attribute {
}
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());
@ -259,9 +220,6 @@ class Attribute {
}
public function getValue($i) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (isset($this->values[$i]))
return $this->values[$i];
else
@ -269,9 +227,6 @@ class Attribute {
}
public function getOldValue($i) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (isset($this->oldvalues[$i]))
return $this->oldvalues[$i];
else
@ -279,37 +234,22 @@ class Attribute {
}
public function getMinValueCount() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->min_value_count);
return $this->min_value_count;
}
public function setMinValueCount($min) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->min_value_count = $min;
}
public function getMaxValueCount() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->max_value_count);
return $this->max_value_count;
}
public function setMaxValueCount($max) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->max_value_count = $max;
}
public function haveMoreValues() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($this->getMaxValueCount() < 0 || ($this->getValueCount() < $this->getMaxValueCount()))
return true;
else
@ -317,30 +257,18 @@ class Attribute {
}
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();
@ -348,23 +276,14 @@ class Attribute {
}
public function isInternal() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->internal);
return $this->internal;
}
public function setInternal() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->internal = true;
}
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')
@ -376,9 +295,6 @@ class Attribute {
}
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
@ -386,37 +302,22 @@ class Attribute {
}
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);
@ -449,31 +350,19 @@ class Attribute {
}
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;
}
@ -482,37 +371,22 @@ class Attribute {
}
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
@ -520,127 +394,73 @@ class Attribute {
}
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;
}
public function setRDN($rdn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->rdn = $rdn;
}
@ -650,9 +470,6 @@ class Attribute {
* @return boolean
*/
public function isRDN() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs,$this->rdn);
return $this->rdn;
}
@ -662,9 +479,6 @@ class Attribute {
* @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';
@ -682,37 +496,22 @@ class Attribute {
* 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)
@ -848,9 +647,6 @@ class Attribute {
* 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());
}
@ -858,9 +654,6 @@ class Attribute {
* 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());
}
@ -874,9 +667,6 @@ class Attribute {
* @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);
}
@ -884,9 +674,6 @@ class Attribute {
* 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))

View File

@ -25,9 +25,6 @@ class HTMLTree extends Tree {
* @param boolean Only display the tree, or include the server name and menu items
*/
public function draw($onlytree=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
static $js_drawn = false;
$server = $this->getServer();
@ -157,9 +154,6 @@ class HTMLTree extends Tree {
*/
protected function draw_server_name() {
return;
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer();
echo '<tr class="server">';
@ -179,9 +173,6 @@ class HTMLTree extends Tree {
* Draw the tree menu options
*/
protected function draw_menu() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$links = '';
if (is_array($_SESSION[APPCONFIG]->getValue('menu','session')))
@ -205,9 +196,6 @@ class HTMLTree extends Tree {
* Get the HTML for each tree menu option
*/
protected function get_menu_item($item) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer();
$menu = array();
@ -323,9 +311,6 @@ class HTMLTree extends Tree {
}
protected function get_logout_menu_item() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer();
$href = sprintf('cmd.php?cmd=logout&server_id=%s',$server->getIndex());
@ -340,9 +325,6 @@ class HTMLTree extends Tree {
* Draw the Logged in User
*/
protected function draw_logged_in_user() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer();
$logged_in_dn = $server->getLogin(null);
@ -399,9 +381,6 @@ class HTMLTree extends Tree {
* @param int $level Level to start drawing (start to -1)
*/
protected function draw_item($item,$level) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer();
# Get entry to display as node
@ -470,15 +449,9 @@ class HTMLTree extends Tree {
$this->draw_create_link($rdn,$level,$dnENCODE);
}
}
if (DEBUG_ENABLED)
debug_log('Leaving (%s,%s)',33,0,__FILE__,__LINE__,__METHOD__,$item,$level);
}
protected function get_formatted_dn($entry,$level) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($level < 0)
return pretty_print_dn($entry->getDN());
else
@ -493,9 +466,6 @@ class HTMLTree extends Tree {
* @param dn $encoded_dn
*/
protected function draw_create_link($rdn,$level,$encoded_dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
# print the "Create New object" link.
$href = htmlspecialchars(sprintf('cmd.php?cmd=template_engine&server_id=%s&container=%s',$this->getServerID(),$encoded_dn));
@ -511,9 +481,6 @@ class HTMLTree extends Tree {
* Draw login link
*/
protected function draw_login_link() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer();
$href_parm = htmlspecialchars(sprintf('cmd=%s&server_id=%s',get_custom_file($server->getIndex(),'login_form',''),$server->getIndex()));
@ -540,9 +507,6 @@ class HTMLTree extends Tree {
* If there is javascript, draw it
*/
protected function draw_javascript() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($this->javascript) {
echo "<!-- Forms for javascript submit to call to create base_dns -->\n";
echo $this->javascript;
@ -555,9 +519,6 @@ class HTMLTree extends Tree {
* Work out how deep the "opened" tree is.
*/
public function getDepth() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer();
# If we are not logged in

View File

@ -14,8 +14,6 @@
*/
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())

View File

@ -21,9 +21,6 @@ class PageRender extends Visitor {
protected $page;
public function __construct($server_id,$template_id) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->server_id = $server_id;
$this->template_id = $template_id;
}
@ -37,23 +34,14 @@ class PageRender extends Visitor {
* 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 Templates($this->server_id);
}
public function getTemplate() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
return $this->template;
}
public function getTemplateID() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
return $this->template->getID();
}
@ -61,11 +49,6 @@ class PageRender extends Visitor {
* Initialise the PageRender
*/
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:%s</font><br />',time(),__METHOD__);
if ($this->template_id) {
$templates = $this->getTemplates();
$this->template = $templates->getTemplate($this->template_id);
@ -93,8 +76,6 @@ class PageRender extends Visitor {
}
foreach ($this->template->getAttributes(true) as $attribute) {
if (DEBUGTMP||DEBUGTMPSUB) printf('<font size=-2>* %s [Accept:%s]</font><br />',__METHOD__,get_class($attribute));
$this->visit('',$attribute);
}
}
@ -113,9 +94,6 @@ class PageRender extends Visitor {
}
public function setDN($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($this->container)
system_message(array(
'title'=>__METHOD__,
@ -126,9 +104,6 @@ class PageRender extends Visitor {
}
public function setContainer($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($this->dn)
system_message(array(
'title'=>__METHOD__,
@ -148,9 +123,6 @@ class PageRender extends Visitor {
* Process our <post> arguments from the templates
*/
protected function getPostAttribute($attribute,$i) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
$autovalue = $attribute->getPostValue();
$args = explode(';',$autovalue['args']);
$server = $this->getServer();
@ -311,32 +283,21 @@ class PageRender extends Visitor {
* @return string Template ID to be used or null if the user was presented with a list.
*/
protected function getTemplateChoice() {
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__);
# First work out our template
$templates = $this->getTemplates();
$template = $templates->getTemplate($this->template_id);
# If the template we asked for is available
if ($this->template_id === $template->getID()) {
if (DEBUGTMP) printf('<font size=-2>%s:<u>%s</u></font><br />',__METHOD__,'Choosing the SELECTED template');
return $this->template_id;
# If there are no defined templates
} elseif (count($templates->getTemplates($this->getMode(),$this->getModeContainer(),false)) <= 0) {
if (DEBUGTMP) printf('<font size=-2>%s:<u>%s</u></font><br />',__METHOD__,'Choosing the DEFAULT template, no other template applicable');
# Since getTemplate() returns a default template if the one we want doesnt exist, we can return $templates->getID(), it should be the default.
return $template->getID();
# If there is only 1 defined template, and no default available, then that is our template.
} elseif ((count($templates->getTemplates($this->getMode(),$this->getModeContainer(),true)) == 1) && ! $this->haveDefaultTemplate()) {
if (DEBUGTMP) printf('<font size=-2>%s:<u>%s</u></font><br />',__METHOD__,'AUTOMATIC choosing a template, only 1 template applicable');
$template = $templates->getTemplates($this->getMode(),$this->getModeContainer(),true);
$template = array_shift($template);
@ -347,8 +308,6 @@ class PageRender extends Visitor {
$this->drawTemplateChoice();
} else {
if (DEBUGTMP) printf('<font size=-2>%s:<u>%s</u></font><br />',__METHOD__,'SELECT a template to use.');
# Propose the template choice
$this->drawTemplateChoice();
}
@ -360,8 +319,6 @@ class PageRender extends Visitor {
/** DRAW ATTRIBUTE NAME **/
final protected function drawNameAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$href = sprintf('cmd.php?cmd=schema&server_id=%s&view=attributes&viewvalue=%s',
$this->getServerID(),$attribute->getName());
@ -374,15 +331,11 @@ class PageRender extends Visitor {
('Click to view the schema definition for attribute type'),$attribute->getName(false),_($attribute->getFriendlyName()));
else
printf('<acronym title="%s">%s</acronym>',_('This attribute is not defined in the LDAP schema'),_($attribute->getFriendlyName()));
if (DEBUGTMPSUB) printf(' <small>[%s]</small>',get_class($attribute));
}
/** ATTRIBUTE NOTES */
protected function drawNotesAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$attr_note = '';
foreach (array('NoteAlias','NoteRequired','NoteRDN','NoteHint','NoteRO') as $note) {
@ -406,11 +359,6 @@ class PageRender extends Visitor {
#@todo this function shouldnt re-calculate requiredness, it should be known in the template already - need to set the ldaptype when initiating the attribute.
protected function getNoteRequiredAttribute($attribute) {
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__);
$required_by = '';
$sattr_required = '';
@ -448,11 +396,6 @@ class PageRender extends Visitor {
}
protected function getNoteRDNAttribute($attribute) {
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__);
# Is this attribute required because its the RDN
if ($attribute->isRDN())
return sprintf('<acronym title="%s">rdn</acronym>',_('This attribute is required for the RDN.'));
@ -461,11 +404,6 @@ class PageRender extends Visitor {
}
protected function getNoteHintAttribute($attribute) {
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__);
# Is there a hint for this attribute
if ($attribute->getHint())
return sprintf('<acronym title="%s">%s</acronym>',_($attribute->getHint()),_('hint'));
@ -474,11 +412,6 @@ class PageRender extends Visitor {
}
protected function getNoteROAttribute($attribute) {
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__);
return '';
}
/** DRAW HIDDEN VALUES **/
@ -487,9 +420,6 @@ class PageRender extends Visitor {
* Draw all hidden attributes
*/
final public function drawHiddenAttributes() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
foreach ($this->template->getAttributes(true) as $attribute)
if ($attribute->hasbeenModified()) {
if ($attribute->getValues())
@ -506,8 +436,6 @@ class PageRender extends Visitor {
* Draw specific hidden attribute
*/
final protected function drawHiddenValueAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$val = $attribute->getValue($i);
printf('<input type="hidden" name="new_values[%s][%s]" id="new_values_%s_%s" value="%s" />',
@ -517,23 +445,17 @@ class PageRender extends Visitor {
/** DRAW DISPLAYED OLD VALUES **/
protected function drawOldValuesAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
foreach ($attribute->getValues() as $index => $details)
$this->draw('OldValue',$attribute,$index);
}
final protected function drawOldValueAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
echo $attribute->getOldValue($i);
}
/** DRAW DISPLAYED CURRENT VALUES **/
protected function drawCurrentValuesAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
for ($i=0;$i<$attribute->getValueCount();$i++) {
if ($i > 0)
echo '<br/>';
@ -546,9 +468,6 @@ class PageRender extends Visitor {
* Draw the current specific value of an attribute
*/
final protected function drawCurrentValueAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (DEBUGTMPSUB) printf(' <small>[%s]</small>',__METHOD__);
echo htmlspecialchars($attribute->getValue($i));
}
@ -556,9 +475,6 @@ class PageRender extends Visitor {
* Draw a input value for an attribute - used in a form.
*/
protected function drawFormValueAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (DEBUGTMPSUB) printf(' <small>[%s]</small>',__METHOD__);
if ($this->getServer()->isReadOnly() || $attribute->isReadOnly()
|| ($attribute->isRDN() && $this->template->getType() != 'creation' && $i < count($attribute->getValues())))
@ -575,8 +491,6 @@ class PageRender extends Visitor {
}
protected function drawFormReadOnlyValueAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$val = $attribute->getValue($i);
printf('<input type="text" class="roval" name="new_values[%s][%s]" id="new_values_%s_%s" value="%s" readonly="readonly" />',
@ -584,8 +498,6 @@ class PageRender extends Visitor {
}
protected function drawFormReadWriteValueAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$val = $attribute->getValue($i);
if ($attribute->getHelper() || $attribute->getVerify())
@ -628,8 +540,6 @@ class PageRender extends Visitor {
* Draw specific hidden binary attribute
*/
final protected function drawHiddenValueBinaryAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$val = $attribute->getValue($i);
printf('<input type="hidden" name="new_values[%s][%s]" value="%s" />',
@ -652,8 +562,6 @@ class PageRender extends Visitor {
}
protected function drawFormReadOnlyValueBinaryAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$this->draw('CurrentValue',$attribute,$i);
echo '<br/><br/>';
@ -667,8 +575,6 @@ class PageRender extends Visitor {
}
protected function drawFormReadWriteValueBinaryAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if ($attribute->getValue($i)) {
$this->draw('FormReadOnlyValue',$attribute,$i);
@ -688,8 +594,6 @@ class PageRender extends Visitor {
}
protected function drawFormReadWriteValueDateAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$val = $attribute->getValue($i);
echo '<span style="white-space: nowrap;">';
@ -706,8 +610,6 @@ class PageRender extends Visitor {
}
protected function drawFormReadWriteValueDnAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$val = $attribute->getValue($i);
if ($attribute->getHelper())
@ -737,8 +639,6 @@ class PageRender extends Visitor {
}
protected function drawFormReadWriteValueGidAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$this->drawFormReadWriteValueAttribute($attribute,$i);
$server = $this->getServer();
@ -790,9 +690,6 @@ class PageRender extends Visitor {
* Draw a Jpeg Attribute
*/
final protected function drawOldValueJpegAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (DEBUGTMPSUB) printf(' <small>[%s]</small>',__METHOD__);
# If we dont have a value, we'll just return;
if (! $attribute->getOldValue($i))
return;
@ -804,9 +701,6 @@ class PageRender extends Visitor {
* Draw a Jpeg Attribute
*/
final protected function drawCurrentValueJpegAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (DEBUGTMPSUB) printf(' <small>[%s]</small>',__METHOD__);
# If we dont have a value, we'll just return;
if (! $attribute->getValue($i))
return;
@ -827,8 +721,6 @@ class PageRender extends Visitor {
}
protected function drawFormReadOnlyValueMultiLineAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$val = $attribute->getValue($i);
printf('<textarea class="roval" rows="%s" cols="%s" name="new_values[%s][%s]" id="new_values_%s_%s" readonly="readonly">%s</textarea>',
@ -840,8 +732,6 @@ class PageRender extends Visitor {
}
protected function drawFormReadWriteValueMultiLineAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$val = $attribute->getValue($i);
printf('<textarea class="value" rows="%s" cols="%s" name="new_values[%s][%s]" id="new_values_%s_%s" %s%s>%s</textarea>',
@ -855,8 +745,6 @@ class PageRender extends Visitor {
}
protected function drawFormValueObjectClassAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$val = $attribute->getValue($i);
/* It seems that openLDAP allows us to remove additional structural objectclasses
@ -895,9 +783,6 @@ class PageRender extends Visitor {
}
protected function drawOldValuePasswordAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (DEBUGTMPSUB) printf(' <small>[%s]</small>',__METHOD__);
$val = $attribute->getOldValue($i);
if (obfuscate_password_display(get_enc_type($val)))
@ -907,9 +792,6 @@ class PageRender extends Visitor {
}
final protected function drawCurrentValuePasswordAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (DEBUGTMPSUB) printf(' <small>[%s]</small>',__METHOD__);
$val = $attribute->getValue($i);
if (obfuscate_password_display(get_enc_type($val)))
@ -919,8 +801,6 @@ class PageRender extends Visitor {
}
protected function drawFormReadOnlyValuePasswordAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$server = $this->getServer();
$val = $attribute->getValue($i);
@ -941,8 +821,6 @@ class PageRender extends Visitor {
}
protected function drawFormReadWriteValuePasswordAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$server = $this->getServer();
$val = $attribute->getValue($i);
@ -994,8 +872,6 @@ class PageRender extends Visitor {
}
protected function drawFormReadWriteValueSelectionAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if ($attribute->isMultiple()) {
# For multiple selection, we draw the component only one time
if ($i > 0)
@ -1126,9 +1002,6 @@ class PageRender extends Visitor {
* @param string A shadow attribute name
*/
private function shadow_date($attribute) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
$shadowattr = array();
$shadowattr['lastchange'] = $this->template->getAttribute('shadowlastchange');
$shadowattr['max'] = $this->template->getAttribute('shadowmax');
@ -1165,8 +1038,6 @@ class PageRender extends Visitor {
}
protected function drawShadowDateShadowAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$shadow_before_today_attrs = arrayLower($attribute->shadow_before_today_attrs);
$shadow_after_today_attrs = arrayLower($attribute->shadow_after_today_attrs);
$shadow_date = $this->shadow_date($attribute);
@ -1193,15 +1064,11 @@ class PageRender extends Visitor {
}
protected function drawFormReadOnlyValueShadowAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$this->drawFormReadOnlyValueAttribute($attribute,$i);
$this->draw('ShadowDate',$attribute);
}
protected function drawFormReadWriteValueShadowAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$this->drawFormReadWriteValueAttribute($attribute,$i);
$this->draw('ShadowDate',$attribute);
}

View File

@ -22,30 +22,16 @@ class Query extends xmlTemplate {
* @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())))
@ -75,9 +61,6 @@ class Query extends xmlTemplate {
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('');
@ -121,9 +104,6 @@ class Query extends xmlTemplate {
* 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();
@ -179,9 +159,6 @@ class Query extends xmlTemplate {
* 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;
}
@ -189,9 +166,6 @@ class Query extends xmlTemplate {
* 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;
}
@ -204,9 +178,6 @@ class Query extends xmlTemplate {
}
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)) {
@ -226,9 +197,6 @@ class Query extends xmlTemplate {
}
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)) {
@ -267,16 +235,10 @@ class Query extends xmlTemplate {
* @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;
}
}

View File

@ -18,13 +18,6 @@ class QueryRender extends PageRender {
* 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);
@ -46,9 +39,6 @@ class QueryRender extends PageRender {
* 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);
}
@ -56,9 +46,6 @@ class QueryRender extends PageRender {
* 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'))
@ -68,8 +55,6 @@ class QueryRender extends PageRender {
}
protected function drawTemplateChoice() {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$server = $this->getServer();
$this->drawTitle(_('Search'));
@ -184,18 +169,12 @@ class QueryRender extends PageRender {
}
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();
@ -413,9 +392,6 @@ class QueryRender extends PageRender {
}
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();
@ -426,9 +402,6 @@ class QueryRender extends PageRender {
}
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));
}

View File

@ -38,9 +38,6 @@ class SelectionAttribute extends Attribute {
}
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,$new_val);
}

View File

@ -65,9 +65,6 @@ class Template extends xmlTemplate {
}
public function __clone() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
# We need to clone our attributes, when passing back a template with getTemplate
foreach ($this->attributes as $key => $value)
$this->attributes[$key] = clone $value;
@ -79,22 +76,13 @@ class Template extends xmlTemplate {
* @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();
$objectclasses = array();
foreach ($xmldata['template'] 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 object Classes from the DN and Template.
case ('objectclasses'):
if (DEBUG_ENABLED)
debug_log('Case [%s]',4,0,__FILE__,__LINE__,__METHOD__,$xml_key);
if (isset($xmldata['template'][$xml_key]['objectclass']))
if (is_array($xmldata['template'][$xml_key]['objectclass'])) {
foreach ($xmldata['template'][$xml_key]['objectclass'] as $index => $details) {
@ -126,16 +114,9 @@ class Template extends xmlTemplate {
# 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['template'][$xml_key])) {
foreach ($xmldata['template'][$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($this->getAttribute($sattr->getName())))
@ -148,9 +129,6 @@ class Template extends xmlTemplate {
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('rdn');
$storelower = array('rdn');
@ -227,9 +205,6 @@ class Template extends xmlTemplate {
* @return boolean
*/
protected function hasDefaultTemplate() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($_SESSION[APPCONFIG]->getValue('appearance','disable_default_template'))
return false;
else
@ -243,9 +218,6 @@ class Template extends xmlTemplate {
* @return array - Array of templates of that type
*/
protected function readTemplates($type) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$template_xml = new Templates($this->server_id);
return $template_xml->getTemplates($type);
}
@ -259,9 +231,6 @@ class Template extends xmlTemplate {
* (OLD values are IGNORED, we will have got them when we build this object from the LDAP server DN.)
*/
public function accept($makeVisible=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer();
# If a DN is set, then query the LDAP server for the details.
@ -571,9 +540,6 @@ class Template extends xmlTemplate {
* @param dn The DN of the entry
*/
public function setDN($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (isset($this->container))
system_message(array(
'title'=>__METHOD__,
@ -592,9 +558,6 @@ class Template extends xmlTemplate {
* @return RDN attributes not processed
*/
public function setRDNAttributes($rdn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
# Setup to work out our RDN.
$rdnarray = rdn_explode($rdn);
@ -619,9 +582,6 @@ class Template extends xmlTemplate {
* @return dn
*/
public function getDN() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs,$this->dn);
if ($this->dn)
return $this->dn;
@ -649,9 +609,6 @@ class Template extends xmlTemplate {
* @todo Trigger a query to the LDAP server and generate an error if the container doesnt exist
*/
public function setContainer($container) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (isset($this->dn))
system_message(array(
'title'=>__METHOD__,
@ -667,9 +624,6 @@ class Template extends xmlTemplate {
* @return dn DN of the container
*/
public function getContainer() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->container);
return $this->container;
}
@ -685,9 +639,6 @@ class Template extends xmlTemplate {
* Copy a DN
*/
public function copy($template,$rdn,$asnew=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$rdnarray = rdn_explode($rdn);
$counter = 1;
@ -755,9 +706,6 @@ class Template extends xmlTemplate {
* @return array Array of attributes.
*/
function getAttrbyLdapType($type) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$result = array();
foreach ($this->attributes as $index => $attribute) {
@ -772,9 +720,6 @@ class Template extends xmlTemplate {
* Return true if this is a MUST,MAY attribute
*/
function isAttrType($attr,$type) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (in_array(strtolower($attr),$this->getAttrbyLdapType($type)))
return true;
else
@ -787,9 +732,6 @@ class Template extends xmlTemplate {
* @return array Array of RDN objects
*/
private function getRDNObjects() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$return = array();
foreach ($this->attributes as $attribute)
@ -806,9 +748,6 @@ class Template extends xmlTemplate {
* @return array RDNs in order.
*/
public function getRDNAttrs() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$return = array();
foreach ($this->getRDNObjects() as $attribute) {
@ -835,9 +774,6 @@ class Template extends xmlTemplate {
* @return rdn RDN for this template
*/
public function getRDN() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
# If the DN is set, then the RDN will be calculated from it.
if ($this->dn)
return get_rdn($this->dn);
@ -863,9 +799,6 @@ class Template extends xmlTemplate {
* Return the attribute name part of the RDN
*/
public function getRDNAttributeName() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$attr = array();
if ($this->getDN()) {
@ -888,9 +821,6 @@ class Template extends xmlTemplate {
* Determine the type of template this is
*/
public function getContext() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($this->getContainer() && get_request('cmd','REQUEST') == 'copy')
return 'copyasnew';
elseif ($this->getContainer() || get_request('create_base'))
@ -907,9 +837,6 @@ class Template extends xmlTemplate {
* @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;
}
@ -922,9 +849,6 @@ class Template extends xmlTemplate {
}
public function getRegExp() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->regexp);
return $this->regexp;
}
@ -932,9 +856,6 @@ class Template extends xmlTemplate {
* Test if this template has been marked as a read-only template
*/
public function isReadOnly() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ((($this->getContext() == 'edit') && $this->readonly) || $this->getServer()->isReadOnly())
return true;
else
@ -948,9 +869,6 @@ class Template extends xmlTemplate {
* @return array Array of attributes
*/
public function getAttributes($optional=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($optional)
return $this->attributes;
@ -969,9 +887,6 @@ class Template extends xmlTemplate {
* Return a list of attributes that should be shown
*/
public function getAttributesShown() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$result = array();
foreach ($this->attributes as $attribute)
@ -985,9 +900,6 @@ class Template extends xmlTemplate {
* Return a list of the internal attributes
*/
public function getAttributesInternal() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$result = array();
foreach ($this->attributes as $attribute)
@ -1003,9 +915,6 @@ class Template extends xmlTemplate {
* @return array Array of Objects
*/
public function getObjectClasses() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$attribute = $this->getAttribute('objectclass');
if ($attribute)
return $attribute->getValues();
@ -1017,9 +926,6 @@ class Template extends xmlTemplate {
* Get template 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 isset($this->icon) ? sprintf('%s/%s',IMGDIR,$this->icon) : '';
}
@ -1029,9 +935,6 @@ class Template extends xmlTemplate {
* @return string 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;
}
@ -1041,9 +944,6 @@ class Template extends xmlTemplate {
* @param string Message indicating the reason the template has been invalidated
*/
public function setInvalid($msg,$admin=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->invalid = true;
$this->invalid_reason = $msg;
$this->invalid_admin = $admin;
@ -1055,9 +955,6 @@ class Template extends xmlTemplate {
* @return string Invalid reason, or false if not invalid
*/
public function isInValid() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($this->invalid)
return $this->invalid_reason;
else
@ -1065,9 +962,6 @@ class Template extends xmlTemplate {
}
public function isAdminDisabled() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->invalid_admin);
return $this->invalid_admin;
}
@ -1078,9 +972,6 @@ class Template extends xmlTemplate {
* @param int
*/
private function setMinValueCount($attr,$value) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$attribute = $this->getAttribute($attr);
if (! is_null($attribute))
@ -1094,9 +985,6 @@ class Template extends xmlTemplate {
* @param string (MUST,MAY,OPTIONAL)
*/
private function setAttrLDAPtype($attr,$value) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$attribute = $this->getAttribute($attr);
if (is_null($attribute))
@ -1109,9 +997,6 @@ class Template extends xmlTemplate {
* OnChangeAdd javascript processing
*/
public function OnChangeAdd($origin,$value) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$attribute = $this->getAttribute($origin);
if (preg_match('/^=(\w+)\((.*)\)$/',$value,$matches)) {
@ -1220,13 +1105,13 @@ class Template extends xmlTemplate {
$attribute->js['autoFill'] .= sprintf(" %s = %s.split(':')[%s];\n",$match_attr,$match_attr,$tok_idx);
} elseif (strstr($match_mod,'K')) {
preg_match_all('/([0-9]+)/',trim($match_subst),$substrarray);
if (isset($substrarray[1][0])) {
$tok_idx = $substrarray[1][0];
} else {
$tok_idx = '0';
}
$attribute->js['autoFill'] .= sprintf(" %s = %s.split(' ')[%s];\n",$match_attr,$match_attr,$tok_idx);
preg_match_all('/([0-9]+)/',trim($match_subst),$substrarray);
if (isset($substrarray[1][0])) {
$tok_idx = $substrarray[1][0];
} else {
$tok_idx = '0';
}
$attribute->js['autoFill'] .= sprintf(" %s = %s.split(' ')[%s];\n",$match_attr,$match_attr,$tok_idx);
} else {
preg_match_all('/([0-9]*)-([0-9]*)/',trim($match_subst),$substrarray);
@ -1275,9 +1160,6 @@ class Template extends xmlTemplate {
* STRUCTURAL - without one, creating an entry will just product an LDAP error.
*/
private function rebuildTemplateAttrs() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer();
# Collect our structural, MUST & MAY attributes.
@ -1390,9 +1272,6 @@ class Template extends xmlTemplate {
* Attributes with empty values will be excluded.
*/
public function getLDAPadd($attrsOnly=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$return = array();
$returnattrs = array();
@ -1425,9 +1304,6 @@ class Template extends xmlTemplate {
* @param boolean Return the attribute objects (useful for a confirmation process), or the modification array for ldap_modify()
*/
public function getLDAPmodify($attrsOnly=false,$index=0) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
static $return = array();
static $returnattrs = array();
@ -1506,9 +1382,6 @@ class Template extends xmlTemplate {
* We'll cache this result in the event of multiple calls.
*/
public function getForceDeleteAttrs() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
static $result = array();
if (count($result))
@ -1525,9 +1398,6 @@ class Template extends xmlTemplate {
* Get available attributes
*/
public function getAvailAttrs() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$attributes = array();
$server = $this->getServer();

View File

@ -22,12 +22,6 @@ class TemplateRender extends PageRender {
* Initialise and Render the TemplateRender
*/
public function accept($norender=false) {
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:%s</font><br />',time(),__METHOD__);
if (DEBUGTMP||DEBUGTMPSUB) printf('<font size=-2>* %s [Visit-Start:%s]</font><br />',__METHOD__,get_class($this));
$tree = get_cached_item($this->server_id,'tree');
if (! $tree)
$tree = Tree::getInstance($this->server_id);
@ -79,16 +73,11 @@ class TemplateRender extends PageRender {
$attribute->show();
}
if (DEBUGTMP||DEBUGTMPSUB) printf('<font size=-2>* %s [Visit-End:%s]</font><br />',__METHOD__,get_class($this));
$this->visitEnd();
}
}
protected function getDefaultAttribute($attribute,$container,$type) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
switch ($type) {
case 'autovalue':
$autovalue = $attribute->getAutoValue();
@ -432,9 +421,6 @@ class TemplateRender extends PageRender {
* Applicable modes are "create" or "edit"
*/
protected function getMode() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($this->dn)
return 'modification';
elseif ($this->container)
@ -449,9 +435,6 @@ class TemplateRender extends PageRender {
* Return the container for this mode
*/
protected function getModeContainer() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
switch ($this->getMode()) {
case 'creation':
return $this->container;
@ -470,9 +453,6 @@ class TemplateRender extends PageRender {
* Is the default template enabled?
*/
protected function haveDefaultTemplate() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($_SESSION[APPCONFIG]->getValue('appearance','disable_default_template'))
return false;
else
@ -483,8 +463,6 @@ class TemplateRender extends PageRender {
* Present a list of available templates for creating and editing LDAP entries
*/
protected function drawTemplateChoice() {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$this->drawTitle();
$this->drawSubTitle();
echo "\n";
@ -607,11 +585,6 @@ class TemplateRender extends PageRender {
* so that it can be rendered.
*/
private function visitStart() {
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 we have a DN, then we are an editing template
if ($this->dn)
$this->template->setDN($this->dn);
@ -628,11 +601,6 @@ class TemplateRender extends PageRender {
}
private function visitEnd() {
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__);
foreach ($this->template->getAttributesShown() as $attribute)
if ($attribute->getPage() > $this->pagelast)
$this->pagelast = $attribute->getPage();
@ -675,8 +643,6 @@ class TemplateRender extends PageRender {
/** PAGE DRAWING METHODS **/
private function drawHeader() {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
# Title
$this->drawTitle();
if (get_request('create_base'))
@ -690,8 +656,6 @@ class TemplateRender extends PageRender {
}
public function drawTitle($title=null) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (is_null($title))
switch ($this->getMode()) {
case 'creation':
@ -710,8 +674,6 @@ class TemplateRender extends PageRender {
}
public function drawSubTitle($subtitle=null) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if ($subtitle)
return parent::drawSubTitle($subtitle);
@ -742,8 +704,6 @@ class TemplateRender extends PageRender {
/** PAGE ENTRY MENU **/
private function drawMenu() {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
# We only have a menu for editing entries.
if ($this->template->getContext() == 'edit') {
@ -834,11 +794,6 @@ class TemplateRender extends PageRender {
/** PAGE ENTRY MENU ITEMS **/
private function getMenuItem($i) {
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 (%s)</font><br />',__METHOD__,$i);
switch ($i) {
case 'entryrefresh':
if ($_SESSION[APPCONFIG]->isCommandAvailable('cmd','entry_refresh'))
@ -996,11 +951,6 @@ class TemplateRender extends PageRender {
}
protected function getDeleteAttributeMessage() {
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 ($_SESSION[APPCONFIG]->isCommandAvailable('script','delete_attr') && ! $this->template->isReadOnly())
return sprintf($this->layout['hint'],_('Hint: To delete an attribute, empty the text field and click save.'));
else
@ -1008,11 +958,6 @@ class TemplateRender extends PageRender {
}
protected function getModifiedAttributesMessage(&$modified_attributes) {
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__);
return sprintf($this->layout['hint'],
(count($modified_attributes) == 1) ?
sprintf(_('An attribute (%s) was modified and is highlighted below.'),implode('',$modified_attributes)) :
@ -1020,31 +965,16 @@ class TemplateRender extends PageRender {
}
protected function getReadOnlyMessage() {
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__);
return sprintf($this->layout['hint'],_('Viewing entry in read-only mode.'));
}
protected function getViewSchemaMessage() {
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__);
return sprintf($this->layout['hint'],('Hint: To view the schema for an attribute, click the attribute name.'));
}
/** PAGE ENTRY MENU ITEMS DETAILS **/
private function getMenuItemRefresh() {
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__);
$href = sprintf('cmd=template_engine&%s&junk=%s',$this->url_base,random_junk());
if (isAjaxEnabled())
@ -1056,9 +986,6 @@ class TemplateRender extends PageRender {
}
protected function getMenuItemSwitchTemplate() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
$href = sprintf('cmd=template_engine&%s&template=',$this->url_base);
if (isAjaxEnabled())
@ -1070,11 +997,6 @@ class TemplateRender extends PageRender {
}
protected function getMenuItemExportBase() {
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__);
$href = sprintf('cmd=export_form&%s&scope=base',$this->url_base);
if (isAjaxEnabled())
@ -1086,11 +1008,6 @@ class TemplateRender extends PageRender {
}
private function getMenuItemMove() {
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__);
$href = sprintf('cmd=copy_form&%s',$this->url_base);
if (isAjaxEnabled())
@ -1104,11 +1021,6 @@ class TemplateRender extends PageRender {
}
protected function getMenuItemInternalAttributes() {
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 (get_request('show_internal_attrs','REQUEST')) {
$href = sprintf('cmd=template_engine&%s&junk=',$this->url_base,random_junk());
@ -1124,11 +1036,6 @@ class TemplateRender extends PageRender {
}
private function getMenuItemDelete() {
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__);
$href = sprintf('cmd=delete_form&%s',$this->url_base);
if (isAjaxEnabled())
@ -1141,11 +1048,6 @@ class TemplateRender extends PageRender {
}
protected function getMenuItemRename() {
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__);
$href = sprintf('cmd=rename_form&%s&template=%s',$this->url_base,$this->template->getID());
if (isAjaxEnabled())
@ -1157,11 +1059,6 @@ class TemplateRender extends PageRender {
}
protected function getMenuItemCompare() {
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__);
$href = sprintf('cmd=compare_form&%s',$this->url_base);
if (isAjaxEnabled())
@ -1174,11 +1071,6 @@ class TemplateRender extends PageRender {
}
protected function getMenuItemCreate() {
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__);
$href = sprintf('cmd=template_engine&server_id=%s&container=%s',$this->getServerID(),$this->template->getDNEncode());
if (isAjaxEnabled())
@ -1191,11 +1083,6 @@ class TemplateRender extends PageRender {
}
protected function getMenuItemAddAttribute() {
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 (! $this->template->getAvailAttrs())
return '';
@ -1212,11 +1099,6 @@ class TemplateRender extends PageRender {
}
protected function getMenuItemShowChildren($children_count) {
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__);
$href = sprintf('cmd=query_engine&server_id=%s&filter=%s&base=%s&scope=one&query=none&size_limit=0&search=true',
$this->getServerID(),rawurlencode('objectClass=*'),$this->template->getDNEncode());
@ -1232,11 +1114,6 @@ class TemplateRender extends PageRender {
}
protected function getMenuItemExportSub() {
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__);
$href = sprintf('cmd=export_form&%s&scope=%s',$this->url_base,'sub');
if (isAjaxEnabled())
@ -1254,8 +1131,6 @@ class TemplateRender extends PageRender {
* RDN Chooser
*/
protected function drawRDNChooser() {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (! count($this->template->getRDNAttrs())) {
printf('<tr><th colspan="2">%s</th></tr>','RDN');
@ -1295,8 +1170,6 @@ class TemplateRender extends PageRender {
* Container Chooser
*/
protected function drawContainerChooser($default_container) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
echo '<tr>';
printf('<td class="heading">%s</td>',_('Container'));
echo '<td>';
@ -1314,8 +1187,6 @@ class TemplateRender extends PageRender {
* Object Class Chooser
*/
protected function drawObjectClassChooser() {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$socs = $this->getServer()->SchemaObjectClasses();
if (! $socs)
$socs = array();
@ -1357,8 +1228,6 @@ class TemplateRender extends PageRender {
}
protected function drawInternalAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$this->draw('Template',$attribute);
}
@ -1376,8 +1245,6 @@ class TemplateRender extends PageRender {
}
protected function drawForm($nosubmit=false) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
echo '<div>';
printf('<input type="hidden" name="server_id" value="%s" />',$this->getServerID());
printf('<input type="hidden" name="dn" value="%s" />',$this->template->getDNEncode(false));
@ -1398,8 +1265,6 @@ class TemplateRender extends PageRender {
}
public function drawFormEnd() {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
# Include the RDN details to support creating the base
if (get_request('create_base')) {
if (get_request('rdn')) {
@ -1415,25 +1280,9 @@ class TemplateRender extends PageRender {
# Javascript
$this->drawJavascript();
# For debugging, show the template object.
if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_debug_info') && get_request('debug','GET')) {
echo "\n\n";
printf('<img src="%s/plus.png" alt="Plus" onclick="if (document.getElementById(\'DEBUGtemplate\').style.display == \'none\') { document.getElementById(\'DEBUGtemplate\').style.display = \'block\' } else { document.getElementById(\'DEBUGtemplate\').style.display = \'none\' };"/>',IMGDIR);
echo '<div id="DEBUGtemplate" style="display: none">';
echo '<fieldset>';
printf('<legend>DEBUG: %s</legend>',$this->template->getDescription());
echo '<textarea cols="120" rows="20">';
debug_dump($this);
echo '</textarea>';
echo '</fieldset>';
echo '</div>';
}
}
public function drawFormSubmitButton() {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (! $this->template->isReadOnly())
// @todo cant use AJAX here, it affects file uploads.
printf('<tr><td colspan="2" style="text-align: center;"><input type="submit" id="create_button" name="submit" value="%s" /></td></tr>',
@ -1443,9 +1292,6 @@ class TemplateRender extends PageRender {
/** STEP FORM METHODS **/
private function drawStepTitle($page) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (DEBUGTMP||DEBUGTMPSUB) printf('<font size=-2>* %s [templateNAME:%s]</font><br />',__METHOD__,$this->template->getName());
# The default template needs to ask the user for objectClasses.
if ($this->template->isType('default')) {
# The default template only uses 2 pages
@ -1468,8 +1314,6 @@ class TemplateRender extends PageRender {
}
private function drawStepFormStart($page) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (($this->template->isType('default') && $this->template->getContext() == 'create' && $page == 1) || $page < $this->pagelast) {
echo '<form action="cmd.php?cmd=template_engine" method="post" enctype="multipart/form-data" id="entry_form" onsubmit="return submitForm(this)">';
echo '<div>';
@ -1486,8 +1330,6 @@ class TemplateRender extends PageRender {
}
protected function drawStepForm($page) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
printf('<input type="hidden" name="server_id" value="%s" />',$this->getServerID());
printf('<input type="hidden" name="template" value="%s" />',$this->template->getID());
printf('<input type="hidden" name="page" value="%s" />',$page+1);
@ -1524,14 +1366,10 @@ class TemplateRender extends PageRender {
}
private function drawStepFormEnd() {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$this->drawFormEnd();
}
private function drawStepFormSubmitButton($page) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
echo '<tr>';
if ($page < $this->pagelast)
printf('<td>&nbsp;</td><td><input type="submit" id="create_button" value="%s &gt;&gt;" /></td>',_('Proceed'));
@ -1546,8 +1384,6 @@ class TemplateRender extends PageRender {
* Given our known objectClass in the template, this will render the required MAY and optional MUST attributes
*/
private function drawStepFormDefaultAttributes() {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
# Put required attributes first
$attrs = array();
$attrs['required'] = array();
@ -1586,8 +1422,6 @@ class TemplateRender extends PageRender {
/** DRAW ATTRIBUTES **/
private function drawShownAttributes() {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
foreach ($this->template->getAttributesShown() as $attribute)
if (($attribute->getPage() == $this->page) && ($attribute->isRequired() || $attribute->isMay())) {
$this->draw('Template',$attribute);
@ -1598,8 +1432,6 @@ class TemplateRender extends PageRender {
/** DRAW PAGE JAVACRIPT */
protected function drawJavascript() {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
echo "\n";
printf('<!-- START: %s -->',__METHOD__);
echo "\n";
@ -1751,8 +1583,6 @@ function fillRec(id,value) {
/** ATTRIBUTE TITLE **/
protected function drawTitleAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (($this->template->getContext() == 'edit')
&& ($attribute->hasBeenModified() || in_array($attribute->getName(),get_request('modified_attrs','REQUEST',false,array()))))
echo '<tr class="updated">';
@ -1776,8 +1606,6 @@ function fillRec(id,value) {
/** ATTRIBUTE LINE **/
protected function drawStartValueLineAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (($this->template->getContext() == 'edit')
&& ($attribute->hasBeenModified() || in_array($attribute->getName(),get_request('modified_attrs','REQUEST',false,array()))))
echo '<tr class="updated">';
@ -1788,8 +1616,6 @@ function fillRec(id,value) {
}
protected function drawEndValueLineAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
echo '</td>';
echo '</tr>';
@ -1802,15 +1628,11 @@ function fillRec(id,value) {
}
protected function drawTemplateAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$this->draw('Title',$attribute);
$this->draw('TemplateValues',$attribute);
}
protected function drawTemplateValuesAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s:%s</font><br />',time(),__METHOD__);
$this->draw('StartValueLine',$attribute);
# Draws values
@ -1839,8 +1661,6 @@ function fillRec(id,value) {
/** DRAW ICONS FOR ATTRIBUTES VALUES **/
protected function drawIconAttribute($attribute,$val) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (is_dn_string($val) || $this->getServer()->isDNAttr($attribute->getName()))
$this->draw('DnValueIcon',$attribute,$val);
elseif (is_mail_string($val))
@ -1855,8 +1675,6 @@ function fillRec(id,value) {
}
protected function drawDnValueIconAttribute($attribute,$val) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (strlen($val) <= 0)
printf('<img src="%s/ldap-alias.png" alt="Go" style="float: right;" />&nbsp;',IMGDIR);
elseif ($this->getServer()->dnExists($val))
@ -1867,8 +1685,6 @@ function fillRec(id,value) {
}
protected function drawMailValueIconAttribute($attribute,$val) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$img = sprintf('<img src="%s/mail.png" alt="%s" style="float: right;" />',IMGDIR,_('Email'));
if (strlen($val) <= 0)
echo $img;
@ -1878,8 +1694,6 @@ function fillRec(id,value) {
}
protected function drawUrlValueIconAttribute($attribute,$val) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$img = sprintf('<img src="%s/ldap-dc.png" alt="%s" style="float: right;" />',IMGDIR,_('URL'));
$url = explode(' +',$val,2);
@ -1948,20 +1762,10 @@ function fillRec(id,value) {
}
protected function getFocusJavascriptAttribute($attribute,$component) {
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__);
return '';
}
protected function getBlurJavascriptAttribute($attribute,$component) {
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__);
$j = "\t".'fill('.$component.'.id,pla_getComponentValue('.$component.'));'."\n";
$j .= "\t".'validate_'.$attribute->getName().'('.$component.',false);'."\n";
@ -1998,8 +1802,6 @@ function fillRec(id,value) {
/** ATTRIBUTE MENU **/
protected function drawMenuAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$result = '';
$item = '';
@ -2017,11 +1819,6 @@ function fillRec(id,value) {
}
protected function getMenuItemAttribute($attribute,$action) {
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 there is no DN, then this is a creating entry.
if (($this->template->getContext() == 'create') || $this->template->isReadOnly())
return false;
@ -2060,11 +1857,6 @@ function fillRec(id,value) {
}
protected function getAddValueMenuItemAttribute($attribute) {
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__);
$href_parm = htmlspecialchars(sprintf('cmd=add_value_form&server_id=%s&dn=%s&attr=%s',
$this->getServerID(),$this->template->getDNEncode(),rawurlencode($attribute->getName(false))));
@ -2078,11 +1870,6 @@ function fillRec(id,value) {
}
protected function getAddValueMenuItemObjectClassAttribute($attribute) {
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__);
$href_parm = htmlspecialchars(sprintf('cmd=add_value_form&server_id=%s&dn=%s&attr=%s',
$this->getServerID(),$this->template->getDNEncode(),rawurlencode($attribute->getName(false))));
@ -2096,11 +1883,6 @@ function fillRec(id,value) {
}
protected function getModifyMemberMenuItemAttribute($attribute) {
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__);
$href = sprintf('cmd=modify_member_form&server_id=%s&dn=%s&attr=%s',
$this->getServerID(),$this->template->getDNEncode(),rawurlencode($attribute->getName()));
@ -2115,11 +1897,6 @@ function fillRec(id,value) {
}
protected function getRenameMenuItemAttribute($attribute) {
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__);
$href = sprintf('cmd.php?cmd=rename_form&server_id=%s&dn=%s&template=%s',
$this->getServerID(),$this->template->getDNEncode(),$this->template->getID());
@ -2129,8 +1906,6 @@ function fillRec(id,value) {
/** values **/
protected function drawValueAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if ($attribute->isMultiple() && $i > 0)
return;
@ -2161,8 +1936,6 @@ function fillRec(id,value) {
# @todo for userPasswords, we need to capture the default value of select lists, without specifying <default>
protected function drawHelperAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$params = $attribute->getHelper();
# We take the first <id> only
@ -2248,8 +2021,6 @@ function fillRec(id,value) {
}
protected function drawRequiredSymbolAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if ($attribute->isRequired() && ! $attribute->isReadOnly())
echo '*';
}
@ -2302,8 +2073,6 @@ function deleteAttribute(attrName,friendlyName,i)
/** DATE ATTRIBUTE RENDERING **/
protected function drawJavaScriptDateAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
printf('<!-- START: DATE ATTRIBUTE %s (%s)-->',__METHOD__,$attribute->getName());
echo "\n";
@ -2352,8 +2121,6 @@ function deleteAttribute(attrName,friendlyName,i)
/** DN ATTRIBUTES **/
protected function drawIconDnAttribute($attribute,$val) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$this->draw('DnValueIcon',$attribute,$val);
}
@ -2395,8 +2162,6 @@ function deleteAttribute(attrName,friendlyName,i)
}
protected function drawCheckLinkPasswordAttribute($attribute,$component_id) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
printf('<small><a href="javascript:passwordComparePopup(\'%s\',\'%s\')">%s...</a></small><br />',
$component_id,$attribute->getName(),_('Check password'));
}
@ -2409,8 +2174,6 @@ function deleteAttribute(attrName,friendlyName,i)
* @todo This function doesnt work well if there are more than 1 RandomPasswordAttributes on the form for the same attribute (unlikely situation)
*/
protected function drawJavascriptRandomPasswordAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
printf("\n<!-- START: %s -->\n",__METHOD__);
$this->drawJavascriptPasswordAttribute($attribute);
@ -2484,18 +2247,11 @@ function deleteAttribute(attrName,friendlyName,i)
/** SELECTION ATTRIBUTE RENDERING **/
protected function drawIconSelectionAttribute($attribute,$val) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (! $attribute->isMultiple() || $attribute->isReadOnly())
$this->drawIconAttribute($attribute,$val);
}
protected function getMenuItemSelectionAttribute($attribute,$i) {
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__);
switch ($i) {
case 'add':
if (! $attribute->isMultiple())

View File

@ -26,9 +26,6 @@ abstract class Tree {
abstract public function draw();
protected function __construct($server_id) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->server_id = $server_id;
}
@ -39,9 +36,6 @@ abstract class Tree {
* @return object Tree
*/
static public function getInstance($server_id) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$tree = get_cached_item($server_id,'tree');
if (! $tree) {
@ -76,9 +70,6 @@ abstract class Tree {
* @return int Server ID that this tree is for
*/
protected function getServerID() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->server_id);
return $this->server_id;
}
@ -88,9 +79,6 @@ abstract class Tree {
* @return object Server Object for this tree
*/
protected function getServer() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
return $_SESSION[APPCONFIG]->getServer($this->server_id);
}
@ -100,9 +88,6 @@ abstract class Tree {
* @return array Base DN entries
*/
public function getBaseEntries() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$return = array();
foreach ($this->entries as $details)
@ -125,14 +110,7 @@ abstract class Tree {
* @return dn Lowercase clean DN
*/
private function indexDN($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$index = strtolower(implode(',',pla_explode_dn($dn)));
if (DEBUG_ENABLED)
debug_log('Result (%s)',1,0,__FILE__,__LINE__,__METHOD__,$index);
return $index;
}
@ -143,9 +121,6 @@ abstract class Tree {
* @return object Tree DN object
*/
public function getEntry($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$dnlower = $this->indexDN($dn);
if (isset($this->entries[$dnlower]))
@ -162,9 +137,6 @@ abstract class Tree {
* @param string $dn the dn of the entry to create
*/
public function addEntry($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer();
$dnlower = $this->indexDN($dn);
@ -175,9 +147,6 @@ abstract class Tree {
if (isset($this->entries[$dnlower]))
debug_dump_backtrace('Calling add entry to an entry that ALREADY exists?',1);
if (DEBUG_ENABLED)
debug_log('New ENTRY (%s).',64,0,__FILE__,__LINE__,__METHOD__,$dn);
$tree_factory = new TreeItem($server->getIndex(),$dn);
$tree_factory->setObjectClasses($server->getDNAttrValue($dn,'objectClass'));
@ -195,9 +164,6 @@ abstract class Tree {
} else {
$parent_dn = $server->getContainer($dn);
if (DEBUG_ENABLED)
debug_log('Parent DNs (%s)',64,0,__FILE__,__LINE__,__METHOD__,$parent_dn);
if ($parent_dn) {
$parent_entry = $this->getEntry($parent_dn);
@ -219,9 +185,6 @@ abstract class Tree {
* @param dn DN to remote
*/
public function delEntry($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer();
$dnlower = $this->indexDN($dn);
@ -243,9 +206,6 @@ abstract class Tree {
* @param dn New DN
*/
public function renameEntry($dnOLD,$dnNEW) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer();
$dnlowerOLD = $this->indexDN($dnOLD);
$dnlowerNEW = $this->indexDN($dnNEW);
@ -275,9 +235,6 @@ abstract class Tree {
* @param boolean LDAP Size Limit
*/
public function readChildren($dn,$nolimit=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer();
$dnlower = $this->indexDN($dn);
@ -297,9 +254,6 @@ abstract class Tree {
return;
}
if (DEBUG_ENABLED)
debug_log('Children of (%s) are (%s)',64,0,__FILE__,__LINE__,__METHOD__,$dn,$ldap['children']);
# Relax our execution time, it might take some time to load this
if ($nolimit)
@set_time_limit($_SESSION[APPCONFIG]->getValue('search','time_limit'));
@ -307,9 +261,6 @@ abstract class Tree {
$this->entries[$dnlower]->readingChildren(true);
foreach ($ldap['children'] as $child) {
if (DEBUG_ENABLED)
debug_log('Adding (%s)',64,0,__FILE__,__LINE__,__METHOD__,$child);
if (! in_array($child,$this->entries[$dnlower]->getChildren()))
$this->entries[$dnlower]->addChild($child);
}
@ -329,9 +280,6 @@ abstract class Tree {
* @param boolean LDAP Size Limit
*/
protected function readChildrenNumber($dn,$nolimit=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$dnlower = $this->indexDN($dn);
if (! isset($this->entries[$dnlower]))

View File

@ -39,9 +39,6 @@ class TreeItem {
private $reading_children = false;
public function __construct($server_id,$dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->server_id = $server_id;
$this->dn = $dn;
}
@ -52,9 +49,6 @@ class TreeItem {
* @return DN The DN of this item.
*/
public function getDN() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->dn);
return $this->dn;
}
@ -68,9 +62,6 @@ class TreeItem {
* @return RDN The RDN of this items DN.
*/
public function getRDN() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
return get_rdn($this->getDn(),0,true);
}
@ -78,9 +69,6 @@ class TreeItem {
* Set this item as a LDAP base DN item.
*/
public function setBase() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->base_entry = true;
}
@ -88,30 +76,18 @@ class TreeItem {
* Return if this item is a base DN item.
*/
public function isBaseDN() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->base_entry);
return $this->base_entry;
}
public function setObjectClasses($oc) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->objectclasses = $oc;
}
public function getObjectClasses() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->objectclasses);
return $this->objectclasses;
}
public function isInLDAP() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
return count($this->objectclasses) ? true : false;
}
@ -120,9 +96,6 @@ class TreeItem {
* or an array of the dn of the children
*/
public function getChildren() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->children);
if ($this->childsort && ! $this->reading_children) {
usort($this->children,'pla_compare_dns');
$this->childsort = false;
@ -139,9 +112,6 @@ class TreeItem {
* Do the children require resorting
*/
public function isChildSorted() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->childsort);
return $this->childsort;
}
@ -149,9 +119,6 @@ class TreeItem {
* Mark the children as sorted
*/
public function childSorted() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->childsort = false;
}
@ -161,9 +128,6 @@ class TreeItem {
* @param DN The DN to add.
*/
public function addChild($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (in_array($dn,$this->children))
return;
@ -177,9 +141,6 @@ class TreeItem {
* @param DN The DN to add.
*/
public function delChild($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($this->children) {
# If the parent hasnt been opened in the tree, then there wont be any children.
$index = array_search($dn,$this->children);
@ -195,9 +156,6 @@ class TreeItem {
* @param DN The DN to rename to.
*/
public function rename($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->dn = $dn;
}
@ -205,9 +163,6 @@ class TreeItem {
* Return if this item has been opened.
*/
public function isOpened() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->open);
return $this->open;
}
@ -215,9 +170,6 @@ class TreeItem {
* Mark this node as closed.
*/
public function close() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->open = false;
}
@ -225,9 +177,6 @@ class TreeItem {
* Opens the node ; the children of the node must have been defined
*/
public function open() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->open = true;
}
@ -235,9 +184,6 @@ class TreeItem {
* Mark this node as a leaf.
*/
public function setLeaf() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->leaf = true;
}
@ -245,9 +191,6 @@ class TreeItem {
* Return if this node is a leaf.
*/
public function isLeaf() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->leaf);
return $this->leaf;
}
@ -256,9 +199,6 @@ class TreeItem {
* If the icon hasnt been set, it will call get_icon()
*/
public function getIcon() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->icon);
if (! $this->icon)
$this->icon = get_icon($this->server_id,$this->dn,$this->objectclasses);
@ -269,9 +209,6 @@ class TreeItem {
* Mark this node as a size limited (it wont have all its children).
*/
public function setSizeLimited() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->size_limited = true;
}
@ -279,9 +216,6 @@ class TreeItem {
* Clear the size limited flag.
*/
public function unsetSizeLimited() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->size_limited = false;
}
@ -289,23 +223,14 @@ class TreeItem {
* Return if this node has hit an LDAP size limit (and thus doesnt have all its children).
*/
public function isSizeLimited() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
return $this->size_limited;
}
public function setTemplate($template) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->template = $template;
}
public function getTemplate() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
return $this->template;
}
}

View File

@ -6,11 +6,6 @@
* @package phpLDAPadmin
*/
/**/
# To make it easier to debug this script, define these constants, which will add some __METHOD__ location displays to the rendered text.
define('DEBUGTMP',0);
define('DEBUGTMPSUB',0);
/**
* Abstract Visitor class
*
@ -22,9 +17,6 @@ abstract class Visitor {
protected $server_id;
public function __call($method,$args) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! in_array($method,array('get','visit','draw')))
debug_dump_backtrace(sprintf('Incorrect use of method loading [%s]',$method),1);
@ -40,20 +32,11 @@ abstract class Visitor {
array_push($methods,$call);
while ($class && ! method_exists($this,$call)) {
if (defined('DEBUGTMP') && DEBUGTMP)
printf('<font size=-2><i>Class (%s): Method doesnt exist (%s,%s)</i></font><br />',$class,get_class($this),$call);
$class = get_parent_class($class);
$call = "$method$fnct$class";
array_push($methods,$call);
}
if (defined('DEBUGTMP') && DEBUGTMP)
printf('<font size=-2><i>Calling Methods: %s</i></font><br />',implode('|',$methods));
if (defined('DEBUGTMP') && DEBUGTMP && method_exists($this,$call))
printf('<font size=-2>Method Exists: %s::%s (%s)</font><br />',get_class($this),$call,$args);
if (method_exists($this,$call)) {
$r = call_user_func_array(array($this, $call), $args);
@ -62,8 +45,6 @@ abstract class Visitor {
else
return;
} elseif (DEBUG_ENABLED) {
debug_log('Doesnt exist param (%s,%s)',1,0,__FILE__,__LINE__,__METHOD__,$method,$fnct);
}
printf('<font size=-2><i>NO Methods: %s</i></font><br />',implode('|',$methods));
@ -75,9 +56,6 @@ abstract class Visitor {
* @return int Server ID
*/
public function getServerID() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->server_id);
if (isset($this->server_id))
return $this->server_id;
else
@ -90,9 +68,6 @@ abstract class Visitor {
* @return object DataStore Server
*/
protected function getServer() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
return $_SESSION[APPCONFIG]->getServer($this->getServerID());
}
}

View File

@ -197,25 +197,10 @@ if (isset($_SERVER['SERVER_SOFTWARE']) && ! isset($_SESSION[APPCONFIG])) {
if ($_SESSION[APPCONFIG]->getValue('appearance','timezone'))
date_default_timezone_set($_SESSION[APPCONFIG]->getValue('appearance','timezone'));
# If we are here, $_SESSION is set - so enabled DEBUGing if it has been configured.
if (($_SESSION[APPCONFIG]->getValue('debug','syslog') || $_SESSION[APPCONFIG]->getValue('debug','file'))
&& $_SESSION[APPCONFIG]->getValue('debug','level'))
define('DEBUG_ENABLED',1);
else
define('DEBUG_ENABLED',0);
if (DEBUG_ENABLED)
debug_log('Application (%s) initialised and starting with (%s).',1,0,__FILE__,__LINE__,__METHOD__,
app_version(),$_REQUEST);
# Set our PHP timelimit.
if ($_SESSION[APPCONFIG]->getValue('session','timelimit') && ! @ini_get('safe_mode'))
set_time_limit($_SESSION[APPCONFIG]->getValue('session','timelimit'));
# If debug mode is set, increase the time_limit, since we probably need it.
if (DEBUG_ENABLED && $_SESSION[APPCONFIG]->getValue('session','timelimit') && ! @ini_get('safe_mode'))
set_time_limit($_SESSION[APPCONFIG]->getValue('session','timelimit') * 5);
setlanguage();
/**

View File

@ -214,14 +214,14 @@ class Config {
'default'=>'AJAXTree');
/** Tree display
* An array of format strings used to display enties in the
* tree viewer (left-hand side). The first format string that
* is completely defined (i.e., does not reference attributes
* that are not defined the object). If there is no format
* string that is completely defined, the last one is used.
*
* You can use special tokens to draw the entries as you wish.
* You can even mix in HTML to format the string.
* An array of format strings used to display enties in the
* tree viewer (left-hand side). The first format string that
* is completely defined (i.e., does not reference attributes
* that are not defined the object). If there is no format
* string that is completely defined, the last one is used.
*
* You can use special tokens to draw the entries as you wish.
* You can even mix in HTML to format the string.
* Here are all the tokens you can use:
* %rdn - draw the RDN of the entry (ie, "cn=Dave")
* %dn - draw the DN of the entry (ie, "cn=Dave,ou=People,dc=example,dc=com"
@ -630,9 +630,6 @@ class Config {
* Function to check and warn about any unusual defined variables.
*/
public function CheckCustom() {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',3,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (isset($this->custom)) {
foreach ($this->custom as $masterkey => $masterdetails) {
@ -665,9 +662,6 @@ class Config {
* Get a list of available commands.
*/
public function getCommandList() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',3,0,__FILE__,__LINE__,__METHOD__,$fargs);
$config = $this->getConfigArray(false);
masort($config['command'],'summary');
@ -682,9 +676,6 @@ class Config {
* Simple ACL to see if commands can be run
*/
public function isCommandAvailable($index='cmd') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',3,0,__FILE__,__LINE__,__METHOD__,$fargs);
$a = func_get_args();
array_shift($a);
$a = $a[0];
@ -699,9 +690,6 @@ class Config {
}
public function configDefinition($key,$index,$config) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',3,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! is_array($config) || ! array_key_exists('desc',$config) || ! array_key_exists('default',$config))
return;
@ -716,9 +704,6 @@ class Config {
* Return the friendly attributes names
*/
private function getFriendlyAttrs() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',3,0,__FILE__,__LINE__,__METHOD__,$fargs);
return array_change_key_case($this->getValue('appearance','friendly_attrs'));
}
@ -730,9 +715,6 @@ class Config {
* @return string friendly name|attribute
*/
public function getFriendlyName($attr) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',3,0,__FILE__,__LINE__,__METHOD__,$fargs);
static $friendly_attrs;
if (! $friendly_attrs)
@ -758,9 +740,6 @@ class Config {
* @return boolean true|false
*/
public function haveFriendlyName($attr) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',3,0,__FILE__,__LINE__,__METHOD__,$fargs);
return $attr->getName(false) != $this->getFriendlyName($attr);
}
@ -771,9 +750,7 @@ class Config {
* @return string html for the friendly name.
*/
public function getFriendlyHTML($attr) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',3,0,__FILE__,__LINE__,__METHOD__,$fargs);
return $attr->getName(false);
return $attr->getName(false);
}
public function setServers($servers) {
@ -789,9 +766,6 @@ class Config {
* @param boolean $visible - Only return visible servers
*/
public function getServerList($visible=true) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',3,0,__FILE__,__LINE__,__METHOD__,$fargs);
return $this->servers->getServerList($visible);
}
}

View File

@ -68,9 +68,6 @@ abstract class DS {
* 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];
@ -116,9 +113,6 @@ abstract class DS {
* 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');
}
@ -129,9 +123,6 @@ abstract class DS {
* 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':
@ -153,9 +144,6 @@ abstract class DS {
* 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
@ -203,9 +191,6 @@ abstract class DS {
* 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()) {
@ -238,9 +223,6 @@ abstract class DS {
* 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
@ -283,9 +265,6 @@ abstract class DS {
* 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);
@ -387,9 +366,6 @@ abstract class DS {
* 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]);
@ -420,16 +396,10 @@ abstract class DS {
* 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
@ -437,13 +407,10 @@ abstract class DS {
}
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
@ -453,9 +420,6 @@ abstract class DS {
* @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.
@ -478,9 +442,6 @@ abstract class DS {
* 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;
}
@ -489,9 +450,6 @@ abstract class DS {
* 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
@ -638,9 +596,6 @@ class Datastore {
* @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]))
@ -671,9 +626,6 @@ class Datastore {
* @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();
@ -681,9 +633,6 @@ class Datastore {
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];
}
@ -694,9 +643,6 @@ class Datastore {
* @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];
@ -712,9 +658,6 @@ class Datastore {
* @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()];

View File

@ -156,9 +156,6 @@ class ldap_pla extends myldap {
* @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
@ -175,18 +172,12 @@ class ldap_pla extends myldap {
* @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;
}
@ -201,9 +192,6 @@ class ldap_pla extends myldap {
* @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');
}
@ -225,9 +213,6 @@ class ldap_pla extends myldap {
* @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;
@ -259,9 +244,6 @@ class ldap_pla extends myldap {
}
}
if (DEBUG_ENABLED)
debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
@ -302,9 +284,6 @@ class ldap_pla extends myldap {
* @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');
@ -323,9 +302,6 @@ class ldap_pla extends myldap {
* @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');
@ -336,9 +312,6 @@ class ldap_pla extends myldap {
* 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);
@ -380,9 +353,6 @@ class ldap_pla extends myldap {
* 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))) {
@ -406,9 +376,6 @@ class ldap_pla extends myldap {
* 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))) {
@ -433,9 +400,6 @@ class ldap_pla extends myldap {
* 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;
@ -546,9 +510,6 @@ class ldap_pla extends myldap {
* @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;
@ -567,9 +528,6 @@ class ldap_pla extends myldap {
* @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;
@ -631,9 +589,6 @@ class ldap_pla extends myldap {
* 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;

View File

@ -23,9 +23,6 @@ class myldap extends DS {
private $force_may = array();
public function __construct($index) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->index = $index;
$this->type = 'ldap';
@ -127,9 +124,6 @@ class myldap extends DS {
* @return resource|null Connection resource if successful, null if not.
*/
protected function connect($method,$debug=false,$new=false) {
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);
@ -159,10 +153,6 @@ class myldap extends DS {
$CACHE[$this->index][$method] = null;
# No identifiable connection exists, lets create a new one.
if (DEBUG_ENABLED)
debug_log('Creating NEW connection [%s] for index [%s]',16,0,__FILE__,__LINE__,__METHOD__,
$method,$this->index);
if (function_exists('run_hook'))
run_hook('pre_connect',array('server_id'=>$this->index,'method'=>$method));
@ -173,10 +163,6 @@ class myldap extends DS {
$CACHE[$this->index][$method] = $resource;
if (DEBUG_ENABLED)
debug_log('LDAP Resource [%s], Host [%s], Port [%s]',16,0,__FILE__,__LINE__,__METHOD__,
$resource,$this->getValue('server','host'),$this->getValue('server','port'));
if (! is_resource($resource))
debug_dump_backtrace('UNHANDLED, $resource is not a resource',1);
@ -205,13 +191,7 @@ class myldap extends DS {
if ($debug)
debug_dump(array('method'=>$method,'bind'=>$bind,'USER'=>$_SESSION['USER']));
if (DEBUG_ENABLED)
debug_log('Resource [%s], Bind Result [%s]',16,0,__FILE__,__LINE__,__METHOD__,$resource,$bind);
if (! $bind['result']) {
if (DEBUG_ENABLED)
debug_log('Leaving with FALSE, bind FAILed',16,0,__FILE__,__LINE__,__METHOD__);
$this->noconnect = true;
system_message(array(
@ -247,9 +227,6 @@ class myldap extends DS {
* @return boolean true|false for successful login.
*/
public function login($user=null,$pass=null,$method=null,$new=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$userDN = null;
# Get the userDN from the username.
@ -311,9 +288,6 @@ class myldap extends DS {
* @return array|null Results of query.
*/
public function query($query,$method,$index=null,$debug=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$attrs_only = 0;
# Defaults
@ -354,9 +328,6 @@ class myldap extends DS {
return array();
}
if (DEBUG_ENABLED)
debug_log('%s search PREPARE.',16,0,__FILE__,__LINE__,__METHOD__,$query['scope']);
if ($debug)
debug_dump(array('query'=>$query,'server'=>$this->getIndex(),'con'=>$this->connect($method)));
@ -380,10 +351,6 @@ class myldap extends DS {
if ($debug)
debug_dump(array('method'=>$method,'search'=>$search,'error'=>$this->getErrorMessage()));
if (DEBUG_ENABLED)
debug_log('Search scope [%s] base [%s] filter [%s] attrs [%s] COMPLETE (%s).',16,0,__FILE__,__LINE__,__METHOD__,
$query['scope'],$query['base'],$query['filter'],$query['attrs'],is_null($search));
if (! $search)
return array();
@ -432,9 +399,6 @@ class myldap extends DS {
ksort($return[$key]);
}
if (DEBUG_ENABLED)
debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
@ -444,9 +408,6 @@ class myldap extends DS {
* @param string Which connection method resource to use
*/
public function getErrorMessage($method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
return ldap_error($this->connect($method));
}
@ -456,9 +417,6 @@ class myldap extends DS {
* @param string Which connection method resource to use
*/
public function getErrorNum($method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
return ldap_errno($this->connect($method));
}
@ -471,9 +429,6 @@ class myldap extends DS {
* @param string Which connection method resource to use
*/
public function getLoginID($user,$method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$query['filter'] = sprintf('(&(%s=%s)%s)',
$this->getValue('login','attr'),$user,
$this->getLoginClass() ? sprintf('(objectclass=%s)',join(')(objectclass=',$this->getLoginClass())) : '');
@ -504,9 +459,6 @@ class myldap extends DS {
* If no login base DNs are defined, then the LDAP server Base DNs are used.
*/
private function getLoginBaseDN() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,1,__FILE__,__LINE__,__METHOD__,$fargs);
if ($this->getValue('login','base'))
return $this->getValue('login','base');
else
@ -517,9 +469,6 @@ class myldap extends DS {
* Return the login classes that a user must have to login
*/
private function getLoginClass() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,1,__FILE__,__LINE__,__METHOD__,$fargs);
return $this->getValue('login','class');
}
@ -527,9 +476,6 @@ class myldap extends DS {
* Return if anonymous bind is allowed in the configuration
*/
public function isAnonBindAllowed() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
return $this->getValue('login','anon_bind');
}
@ -544,9 +490,6 @@ class myldap extends DS {
* @return boolean
*/
private function isTLSEnabled() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($this->getValue('server','tls') && ! function_exists('ldap_start_tls')) {
error(('TLS has been enabled in your config, but your PHP install does not support TLS. TLS will be disabled.'),'warn');
return false;
@ -559,9 +502,6 @@ class myldap extends DS {
* If TLS is configured, then start it
*/
private function startTLS($resource) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! $this->getValue('server','tls') || (function_exists('ldap_start_tls') && ! @ldap_start_tls($resource))) {
system_message(array(
'title'=>sprintf('%s (%s)',('Could not start TLS.'),$this->getName()),
@ -585,9 +525,6 @@ class myldap extends DS {
* @return boolean
*/
private function isSASLEnabled() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($this->getValue('server','sasl') && ! function_exists('ldap_sasl_bind')) {
error(('SASL has been enabled in your config, but your PHP install does not support SASL. SASL will be disabled.'),'warn');
return false;
@ -603,9 +540,6 @@ class myldap extends DS {
* @todo This has not been tested, please let the developers know if this function works as expected.
*/
private function startSASL($resource,$method) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
static $CACHE = array();
if (! $this->getValue('server','sasl') || ! function_exists('ldap_start_tls'))
@ -622,12 +556,6 @@ class myldap extends DS {
if (! isset($CACHE['authz_id']))
if (! trim($this->getValue('sasl','authz_id')) && $mech != 'gssapi') {
if (DEBUG_ENABLED)
debug_log('Rewriting bind DN [%s] -> authz_id with regex [%s] and replacement [%s].',9,0,__FILE__,__LINE__,__METHOD__,
$CACHE['login_dn'],
$this->getValue('sasl','authz_id_regex'),
$this->getValue('sasl','authz_id_replacement'));
$CACHE['authz_id'] = @preg_replace($this->getValue('sasl','authz_id_regex'),
$this->getValue('sasl','authz_id_replacement'),$CACHE['login_dn']);
@ -637,14 +565,6 @@ class myldap extends DS {
$this->getValue('sasl','authz_id_regex'),(isset($php_errormsg) ? $php_errormsg : '')),
'error','index.php');
if (DEBUG_ENABLED)
debug_log('Resource [%s], SASL OPTIONS: mech [%s], realm [%s], authz_id [%s], props [%s]',9,0,__FILE__,__LINE__,__METHOD__,
$resource,
$this->getValue('sasl','mech'),
$this->getValue('sasl','realm'),
$CACHE['authz_id'],
$this->getValue('sasl','props'));
} else
$CACHE['authz_id'] = $this->getValue('sasl','authz_id');
@ -667,9 +587,6 @@ class myldap extends DS {
* @return boolean
*/
private function isProxyEnabled() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
return $this->getValue('login','auth_type') == 'proxy' ? true : false;
}
@ -677,9 +594,6 @@ class myldap extends DS {
* If PROXY AUTH is configured, then start it
*/
private function startProxy($resource,$method) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$rootdse = $this->getRootDSE();
if (! (isset($rootdse['supportedcontrol']) && in_array('2.16.840.1.113730.3.4.18',$rootdse['supportedcontrol']))) {
@ -766,9 +680,6 @@ class myldap extends DS {
* Modify attributes of a DN
*/
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);
# We need to supress the error here - programming should detect and report it.
return @ldap_mod_replace($this->connect($method),$dn,$attrs);
}
@ -789,9 +700,6 @@ class myldap extends DS {
* @todo Sort the entries, so that they are in the correct DN order.
*/
public function getBaseDN($method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
static $CACHE;
$method = $this->getMethod($method);
@ -802,25 +710,16 @@ class myldap extends DS {
# If the base is set in the configuration file, then just return that.
if (count($this->getValue('server','base'))) {
if (DEBUG_ENABLED)
debug_log('Return BaseDN from Config [%s]',17,0,__FILE__,__LINE__,__METHOD__,implode('|',$this->getValue('server','base')));
$CACHE[$this->index][$method] = $this->getValue('server','base');
# We need to figure it out.
} else {
if (DEBUG_ENABLED)
debug_log('Connect to LDAP to find BaseDN',80,0,__FILE__,__LINE__,__METHOD__);
# Set this to empty, in case we loop back here looking for the baseDNs
$CACHE[$this->index][$method] = array();
$results = $this->getDNAttrValues('',$method);
if (isset($results['namingcontexts'])) {
if (DEBUG_ENABLED)
debug_log('LDAP Entries:%s',80,0,__FILE__,__LINE__,__METHOD__,implode('|',$results['namingcontexts']));
$result = $results['namingcontexts'];
}
@ -839,9 +738,6 @@ class myldap extends DS {
* @return boolean
*/
public function dnExists($dn,$method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$results = $this->getDNAttrValues($dn,$method);
if ($results)
@ -857,9 +753,6 @@ class myldap extends DS {
* @return string The container
*/
public function getContainerTop($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$return = $dn;
foreach ($this->getBaseDN() as $base) {
@ -869,9 +762,6 @@ class myldap extends DS {
}
}
if (DEBUG_ENABLED)
debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
@ -883,9 +773,6 @@ class myldap extends DS {
* @return string The container
*/
public function getContainerPath($dn,$path='..') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$top = $this->getContainerTop($dn);
if ($path[0] == '/') {
@ -930,9 +817,6 @@ class myldap extends DS {
* @return string The container
*/
public function getContainer($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$parts = $this->explodeDN($dn);
if (count($parts) <= 1)
@ -945,9 +829,6 @@ class myldap extends DS {
$return .= sprintf(',%s',$parts[$i]);
}
if (DEBUG_ENABLED)
debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
@ -985,9 +866,6 @@ class myldap extends DS {
* @return array An array of DN strings listing the immediate children of the specified entry.
*/
public function getContainerContents($dn,$method=null,$size_limit=0,$filter='(objectClass=*)',$deref=LDAP_DEREF_NEVER) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$return = array();
$query = array();
@ -1006,9 +884,6 @@ class myldap extends DS {
}
}
if (DEBUG_ENABLED)
debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$return);
# Sort the results
asort($return);
@ -1035,16 +910,9 @@ class myldap extends DS {
* NOTE: When a multivalue RDN is passed to ldap_explode_dn, the results returns with 'value + value';
*/
private function explodeDN($dn,$with_attributes=0) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
static $CACHE;
if (isset($CACHE['explode'][$dn][$with_attributes])) {
if (DEBUG_ENABLED)
debug_log('Return CACHED result (%s) for (%s)',1,0,__FILE__,__LINE__,__METHOD__,
$CACHE['explode'][$dn][$with_attributes],$dn);
return $CACHE['explode'][$dn][$with_attributes];
}
@ -1054,9 +922,6 @@ class myldap extends DS {
$result[0] = ldap_explode_dn($this->escapeDN($dn),0);
$result[1] = ldap_explode_dn($this->escapeDN($dn),1);
if (! $result[$with_attributes]) {
if (DEBUG_ENABLED)
debug_log('Returning NULL - NO result.',1,0,__FILE__,__LINE__,__METHOD__);
return array();
}
@ -1073,9 +938,6 @@ class myldap extends DS {
$CACHE['explode'][implode(',',array_reverse($result[0]))][$key] = array_reverse($result[$key]);
}
if (DEBUG_ENABLED)
debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$result[$with_attributes]);
return $result[$with_attributes];
}
@ -1083,9 +945,6 @@ class myldap extends DS {
* Parse a DN and escape any special characters
*/
protected function escapeDN($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! trim($dn))
return $dn;
@ -1095,16 +954,10 @@ class myldap extends DS {
$dn = preg_replace('/([^\\\\]),(\s*[^=]*\s*)([^,])$/','$1\\\\2C$2$3',$dn);
if (DEBUG_ENABLED)
debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$dn);
return $dn;
}
public function getRootDSE($method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$query = array();
$query['base'] = '';
$query['scope'] = 'base';
@ -1130,9 +983,6 @@ class myldap extends DS {
* @return array|false Schema if available, null if its not or false if we cant connect.
*/
private function getSchemaDN($method=null,$dn='') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',25,0,__FILE__,__LINE__,__METHOD__,$fargs);
# If we already got the SchemaDN, then return it.
if ($this->_schemaDN)
return $this->_schemaDN;
@ -1142,22 +992,11 @@ class myldap extends DS {
$search = @ldap_read($this->connect($method),$dn,'objectclass=*',array('subschemaSubentry'),false,0,10,LDAP_DEREF_NEVER);
if (DEBUG_ENABLED)
debug_log('Search returned (%s)',24,0,__FILE__,__LINE__,__METHOD__,is_resource($search));
# Fix for broken ldap.conf configuration.
if (! $search && ! $dn) {
if (DEBUG_ENABLED)
debug_log('Trying to find the DN for "broken" ldap.conf',80,0,__FILE__,__LINE__,__METHOD__);
if (isset($this->_baseDN)) {
foreach ($this->_baseDN as $base) {
$search = @ldap_read($this->connect($method),$base,'objectclass=*',array('subschemaSubentry'),false,0,10,LDAP_DEREF_NEVER);
if (DEBUG_ENABLED)
debug_log('Search returned (%s) for base (%s)',24,0,__FILE__,__LINE__,__METHOD__,
is_resource($search),$base);
if ($search)
break;
}
@ -1168,41 +1007,26 @@ class myldap extends DS {
return null;
if (! @ldap_count_entries($this->connect($method),$search)) {
if (DEBUG_ENABLED)
debug_log('Search returned 0 entries. Returning NULL',25,0,__FILE__,__LINE__,__METHOD__);
return null;
}
$entries = @ldap_get_entries($this->connect($method),$search);
if (DEBUG_ENABLED)
debug_log('Search returned [%s]',24,0,__FILE__,__LINE__,__METHOD__,$entries);
if (! $entries || ! is_array($entries))
return null;
$entry = isset($entries[0]) ? $entries[0] : false;
if (! $entry) {
if (DEBUG_ENABLED)
debug_log('Entry is false, Returning NULL',80,0,__FILE__,__LINE__,__METHOD__);
return null;
}
$sub_schema_sub_entry = isset($entry[0]) ? $entry[0] : false;
if (! $sub_schema_sub_entry) {
if (DEBUG_ENABLED)
debug_log('Sub Entry is false, Returning NULL',80,0,__FILE__,__LINE__,__METHOD__);
return null;
}
$this->_schemaDN = isset($entry[$sub_schema_sub_entry][0]) ? $entry[$sub_schema_sub_entry][0] : false;
if (DEBUG_ENABLED)
debug_log('Returning (%s)',25,0,__FILE__,__LINE__,__METHOD__,$this->_schemaDN);
return $this->_schemaDN;
}
@ -1234,9 +1058,6 @@ class myldap extends DS {
* etc.
*/
private function getRawSchema($method,$schema_to_fetch,$dn='') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',25,0,__FILE__,__LINE__,__METHOD__,$fargs);
$valid_schema_to_fetch = array('objectclasses','attributetypes','ldapsyntaxes','matchingrules','matchingruleuse');
if (! $this->connect($method) || $this->noconnect)
@ -1247,10 +1068,6 @@ class myldap extends DS {
if (! is_null($this->_schema_entries) && isset($this->_schema_entries[$schema_to_fetch])) {
$schema = $this->_schema_entries[$schema_to_fetch];
if (DEBUG_ENABLED)
debug_log('Returning CACHED (%s)',25,0,__FILE__,__LINE__,__METHOD__,$schema);
return $schema;
}
@ -1270,13 +1087,7 @@ class myldap extends DS {
$schema_search = null;
if ($schema_dn) {
if (DEBUG_ENABLED)
debug_log('Using Schema DN (%s)',24,0,__FILE__,__LINE__,__METHOD__,$schema_dn);
foreach (array('(objectClass=*)','(objectClass=subschema)') as $schema_filter) {
if (DEBUG_ENABLED)
debug_log('Looking for schema with Filter (%s)',24,0,__FILE__,__LINE__,__METHOD__,$schema_filter);
$schema_search = @ldap_read($this->connect($method),$schema_dn,$schema_filter,array($schema_to_fetch),false,0,10,LDAP_DEREF_NEVER);
if (is_null($schema_search))
@ -1284,20 +1095,10 @@ class myldap extends DS {
$schema_entries = @ldap_get_entries($this->connect($method),$schema_search);
if (DEBUG_ENABLED)
debug_log('Search returned [%s]',24,0,__FILE__,__LINE__,__METHOD__,$schema_entries);
if (is_array($schema_entries) && isset($schema_entries['count']) && $schema_entries['count']) {
if (DEBUG_ENABLED)
debug_log('Found schema with (DN:%s) (FILTER:%s) (ATTR:%s)',24,0,__FILE__,__LINE__,__METHOD__,
$schema_dn,$schema_filter,$schema_to_fetch);
break;
}
if (DEBUG_ENABLED)
debug_log('Didnt find schema with filter (%s)',24,0,__FILE__,__LINE__,__METHOD__,$schema_filter);
unset($schema_entries);
$schema_search = null;
}
@ -1306,9 +1107,6 @@ class myldap extends DS {
/* Second chance: If the DN or Root DSE didn't give us the subschemaSubentry, ie $schema_search
* is still null, use some common subSchemaSubentry DNs as a work-around. */
if (is_null($schema_search)) {
if (DEBUG_ENABLED)
debug_log('Attempting work-arounds for "broken" LDAP servers...',24,0,__FILE__,__LINE__,__METHOD__);
foreach ($this->getBaseDN() as $base) {
$ldap['W2K3 AD'][expand_dn_with_base($base,'cn=Aggregate,cn=Schema,cn=configuration,')] = '(objectClass=*)';
$ldap['W2K AD'][expand_dn_with_base($base,'cn=Schema,cn=configuration,')] = '(objectClass=*)';
@ -1320,29 +1118,16 @@ class myldap extends DS {
foreach ($ldap as $ldap_server_name => $ldap_options) {
foreach ($ldap_options as $ldap_dn => $ldap_filter) {
if (DEBUG_ENABLED)
debug_log('Attempting [%s] (%s) (%s)<BR>',24,0,__FILE__,__LINE__,__METHOD__,
$ldap_server_name,$ldap_dn,$ldap_filter);
$schema_search = @ldap_read($this->connect($method),$ldap_dn,$ldap_filter,array($schema_to_fetch),false,0,10,LDAP_DEREF_NEVER);
if (is_null($schema_search))
continue;
$schema_entries = @ldap_get_entries($this->connect($method),$schema_search);
if (DEBUG_ENABLED)
debug_log('Search returned [%s]',24,0,__FILE__,__LINE__,__METHOD__,$schema_entries);
if ($schema_entries && isset($schema_entries[0][$schema_to_fetch])) {
if (DEBUG_ENABLED)
debug_log('Found schema with filter of (%s)',24,0,__FILE__,__LINE__,__METHOD__,$ldap_filter);
break;
}
if (DEBUG_ENABLED)
debug_log('Didnt find schema with filter (%s)',24,0,__FILE__,__LINE__,__METHOD__,$ldap_filter);
unset($schema_entries);
$schema_search = null;
}
@ -1356,10 +1141,6 @@ class myldap extends DS {
* Attempt to pull schema from Root DSE with scope "base", or
* Attempt to pull schema from Root DSE with scope "one" (work-around for Isode M-Vault X.500/LDAP) */
foreach (array('base','one') as $ldap_scope) {
if (DEBUG_ENABLED)
debug_log('Attempting to find schema with scope (%s), filter (objectClass=*) and a blank base.',24,0,__FILE__,__LINE__,__METHOD__,
$ldap_scope);
switch ($ldap_scope) {
case 'base':
$schema_search = @ldap_read($this->connect($method),'','(objectClass=*)',array($schema_to_fetch),false,0,10,LDAP_DEREF_NEVER);
@ -1374,19 +1155,10 @@ class myldap extends DS {
continue;
$schema_entries = @ldap_get_entries($this->connect($method),$schema_search);
if (DEBUG_ENABLED)
debug_log('Search returned [%s]',24,0,__FILE__,__LINE__,__METHOD__,$schema_entries);
if ($schema_entries && isset($schema_entries[0][$schema_to_fetch])) {
if (DEBUG_ENABLED)
debug_log('Found schema with filter of (%s)',24,0,__FILE__,__LINE__,__METHOD__,'(objectClass=*)');
break;
}
if (DEBUG_ENABLED)
debug_log('Didnt find schema with filter (%s)',24,0,__FILE__,__LINE__,__METHOD__,'(objectClass=*)');
unset($schema_entries);
$schema_search = null;
}
@ -1403,9 +1175,6 @@ class myldap extends DS {
'title'=>sprintf('%s (%s)',('Our attempts to find your SCHEMA have failed'),$schema_to_fetch),
'body'=>sprintf('<b>%s</b>: %s',('Error'),$schema_error_message),
'type'=>'error'));
else
if (DEBUG_ENABLED)
debug_log('Returning because schema_search is NULL ()',25,0,__FILE__,__LINE__,__METHOD__);
# We'll set this, so if we return here our cache will return the known false.
$this->_schema_entries[$schema_to_fetch] = false;
@ -1414,9 +1183,6 @@ class myldap extends DS {
if (! $schema_entries) {
$return = false;
if (DEBUG_ENABLED)
debug_log('Returning false since ldap_get_entries() returned false.',25,0,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
@ -1427,10 +1193,6 @@ class myldap extends DS {
} else {
$return = false;
if (DEBUG_ENABLED)
debug_log('Returning because (%s) isnt in the schema array. (%s)',25,0,__FILE__,__LINE__,__METHOD__,$schema_to_fetch,$return);
return $return;
}
}
@ -1445,9 +1207,6 @@ class myldap extends DS {
unset($schema['count']);
$this->_schema_entries[$schema_to_fetch] = $schema;
if (DEBUG_ENABLED)
debug_log('Returning (%s)',25,0,__FILE__,__LINE__,__METHOD__,$schema);
return $schema;
}
@ -1464,9 +1223,6 @@ class myldap extends DS {
* @see SchemaObjectClasses
*/
public function getSchemaObjectClass($oclass_name,$method=null,$dn='') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',25,0,__FILE__,__LINE__,__METHOD__,$fargs);
$oclass_name = strtolower($oclass_name);
$socs = $this->SchemaObjectClasses($method,$dn);
@ -1476,9 +1232,6 @@ class myldap extends DS {
if (isset($socs[$oclass_name]))
$return = $socs[$oclass_name];
if (DEBUG_ENABLED)
debug_log('Returning (%s)',25,0,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
@ -1495,9 +1248,6 @@ class myldap extends DS {
* @see SchemaAttributes
*/
public function getSchemaAttribute($attr_name,$method=null,$dn='') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',25,0,__FILE__,__LINE__,__METHOD__,$fargs);
$attr_name = strtolower($attr_name);
$sattrs = $this->SchemaAttributes($method,$dn);
@ -1507,9 +1257,6 @@ class myldap extends DS {
if (isset($sattrs[$attr_name]))
$return = $sattrs[$attr_name];
if (DEBUG_ENABLED)
debug_log('Returning (%s)',25,0,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
@ -1527,16 +1274,10 @@ class myldap extends DS {
* @see getSchemaObjectClass
*/
public function SchemaObjectClasses($method=null,$dn='') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',25,0,__FILE__,__LINE__,__METHOD__,$fargs);
# Set default return
$return = null;
if ($return = get_cached_item($this->index,'schema','objectclasses')) {
if (DEBUG_ENABLED)
debug_log('Returning CACHED [%s] (%s)',25,0,__FILE__,__LINE__,__METHOD__,$this->index,'objectclasses');
return $return;
}
@ -1566,9 +1307,6 @@ class myldap extends DS {
set_cached_item($this->index,'schema','objectclasses',$return);
}
if (DEBUG_ENABLED)
debug_log('Returning (%s)',25,0,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
@ -1583,16 +1321,10 @@ class myldap extends DS {
* @return array An array of AttributeType objects.
*/
public function SchemaAttributes($method=null,$dn='') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',25,0,__FILE__,__LINE__,__METHOD__,$fargs);
# Set default return
$return = null;
if ($return = get_cached_item($this->index,'schema','attributes')) {
if (DEBUG_ENABLED)
debug_log('(): Returning CACHED [%s] (%s)',25,0,__FILE__,__LINE__,__METHOD__,$this->index,'attributes');
return $return;
}
@ -1751,9 +1483,6 @@ class myldap extends DS {
set_cached_item($this->index,'schema','attributes',$return);
}
if (DEBUG_ENABLED)
debug_log('Returning (%s)',25,0,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
@ -1762,16 +1491,10 @@ class myldap extends DS {
* The key of each entry is the OID of the matching rule.
*/
public function MatchingRules($method=null,$dn='') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',25,0,__FILE__,__LINE__,__METHOD__,$fargs);
# Set default return
$return = null;
if ($return = get_cached_item($this->index,'schema','matchingrules')) {
if (DEBUG_ENABLED)
debug_log('Returning CACHED [%s] (%s).',25,0,__FILE__,__LINE__,__METHOD__,$this->index,'matchingrules');
return $return;
}
@ -1827,9 +1550,6 @@ class myldap extends DS {
set_cached_item($this->index,'schema','matchingrules',$return);
}
if (DEBUG_ENABLED)
debug_log('Returning (%s)',25,0,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
@ -1838,16 +1558,10 @@ class myldap extends DS {
* their descriptions. The key of each entry is the OID of the Syntax.
*/
public function SchemaSyntaxes($method=null,$dn='') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',25,0,__FILE__,__LINE__,__METHOD__,$fargs);
# Set default return
$return = null;
if ($return = get_cached_item($this->index,'schema','syntaxes')) {
if (DEBUG_ENABLED)
debug_log('Returning CACHED [%s] (%s).',25,0,__FILE__,__LINE__,__METHOD__,$this->index,'syntaxes');
return $return;
}
@ -1876,9 +1590,6 @@ class myldap extends DS {
set_cached_item($this->index,'schema','syntaxes',$return);
}
if (DEBUG_ENABLED)
debug_log('Returning (%s)',25,0,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
@ -1890,9 +1601,6 @@ class myldap extends DS {
* otherwise.
*/
function isForceMay($attr_name) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
return in_array($attr_name,$this->force_may);
}
@ -1925,9 +1633,6 @@ class myldap extends DS {
* @todo Caching these values may be problematic with multiple calls and different deref values.
*/
public function getDNAttrValue($dn,$attr,$method=null,$deref=LDAP_DEREF_NEVER) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
# Ensure our attr is in lowercase
$attr = strtolower($attr);
@ -1979,9 +1684,6 @@ class myldap extends DS {
* @see getDNAttrValue
*/
public function getDNAttrValues($dn,$method=null,$deref=LDAP_DEREF_NEVER,$attrs=array('*','+')) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
static $CACHE;
$cacheindex = null;
@ -1996,10 +1698,6 @@ class myldap extends DS {
if (! is_null($cacheindex) && isset($CACHE[$this->index][$method][$dn][$cacheindex])) {
$results = $CACHE[$this->index][$method][$dn][$cacheindex];
if (DEBUG_ENABLED)
debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$results);
} else {
$query = array();
$query['base'] = $this->escapeDN($dn);
@ -2037,9 +1735,6 @@ class myldap extends DS {
* @return boolean
*/
function isDNAttr($attr_name,$method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
# Simple test first
$dn_attrs = array('aliasedObjectName');
foreach ($dn_attrs as $dn_attr)
@ -2078,9 +1773,6 @@ class myldap extends DS {
* @see draw_jpeg_photo
*/
function isJpegPhoto($attr_name) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
# easy quick check
if (! strcasecmp($attr_name,'jpegPhoto') || ! strcasecmp($attr_name,'photo'))
return true;
@ -2109,9 +1801,6 @@ class myldap extends DS {
* @return boolean
*/
function isAttrBoolean($attr_name) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$type = ($sattr = $this->getSchemaAttribute($attr_name)) ? $sattr->getType() : null;
if (! strcasecmp('boolean',$type) ||
@ -2135,9 +1824,6 @@ class myldap extends DS {
* @see isJpegPhoto
*/
function isAttrBinary($attr_name) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
/**
* Determining if an attribute is binary can be an expensive operation.
* We cache the results for each attr name on each server in the $attr_cache
@ -2221,9 +1907,6 @@ class myldap extends DS {
* @return bool true|false
*/
function userIsMember($user,$group) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$user = strtolower($user);
$group = $this->getDNAttrValues($group);
@ -2252,18 +1935,12 @@ class myldap extends DS {
* This function will determine if the user is allowed to login based on a filter
*/
protected function userIsAllowedLogin($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$dn = trim(strtolower($dn));
if (! $this->getValue('login','allowed_dns'))
return true;
foreach ($this->getValue('login','allowed_dns') as $login_allowed_dn) {
if (DEBUG_ENABLED)
debug_log('Working through (%s)',80,0,__FILE__,__LINE__,__METHOD__,$login_allowed_dn);
/* Check if $login_allowed_dn is an ldap search filter
* Is first occurence of 'filter=' (case ensitive) at position 0 ? */
if (preg_match('/^\([&|]\(/',$login_allowed_dn)) {
@ -2276,10 +1953,6 @@ class myldap extends DS {
$results = $this->query($query,null);
if (DEBUG_ENABLED)
debug_log('Search, Filter [%s], BaseDN [%s] Results [%s]',16,0,__FILE__,__LINE__,__METHOD__,
$query['filter'],$query['base'],$results);
if ($results) {
$dn_array = array();
@ -2290,9 +1963,6 @@ class myldap extends DS {
if (count($dn_array))
foreach ($dn_array as $result_dn) {
if (DEBUG_ENABLED)
debug_log('Comparing with [%s]',80,0,__FILE__,__LINE__,__METHOD__,$result_dn);
# Check if $result_dn is a user DN
if (strcasecmp($dn,trim(strtolower($result_dn))) == 0)
return true;

View File

@ -51,7 +51,7 @@ if (file_exists(LIBDIR.'functions.custom.php'))
/**
* Loads class definition
*/
function __autoload($className) {
function plaAutoload($className) {
if (file_exists(HOOKSDIR."classes/$className.php"))
require_once(HOOKSDIR."classes/$className.php");
elseif (file_exists(LIBDIR."$className.php"))
@ -66,15 +66,14 @@ function __autoload($className) {
'type'=>'error'));
}
spl_autoload_register('plaAutoload');
/**
* Strips all slashes from the specified array in place (pass by ref).
* @param Array The array to strip slashes from, typically one of
* $_GET, $_POST, or $_COOKIE.
*/
function array_stripslashes(&$array) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (is_array($array))
while (list($key) = each($array))
if (is_array($array[$key]) && $key != $array)
@ -120,9 +119,6 @@ if (! function_exists('_')) {
* @see set_error_handler
*/
function app_error_handler($errno,$errstr,$file,$lineno) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
/**
* error_reporting will be 0 if the error context occurred
* within a function call with '@' preprended (ie, @ldap_bind() );
@ -284,9 +280,6 @@ function check_config($config_file) {
* @return array
*/
function cmd_control_pane($type) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
switch ($type) {
case 'main' :
return array(
@ -659,9 +652,6 @@ function system_message($msg,$redirect=null) {
* @author lem9 (taken from the phpMyAdmin source)
*/
function blowfish_encrypt($data,$secret=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
# If our secret is null or blank, get the default.
if ($secret === null || ! trim($secret))
$secret = $_SESSION[APPCONFIG]->getValue('session','blowfish') ? $_SESSION[APPCONFIG]->getValue('session','blowfish') : session_id();
@ -708,9 +698,6 @@ function blowfish_encrypt($data,$secret=null) {
* @author lem9 (taken from the phpMyAdmin source)
*/
function blowfish_decrypt($encdata,$secret=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
# This cache gives major speed up for stupid callers :)
static $CACHE = array();
@ -762,9 +749,6 @@ function blowfish_decrypt($encdata,$secret=null) {
* @return string The padded string
*/
function full_str_pad($input,$pad_length,$pad_string='',$pad_type=0) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$str = '';
$length = $pad_length - strlen($input);
@ -797,9 +781,6 @@ function full_str_pad($input,$pad_length,$pad_string='',$pad_type=0) {
* or null if there is nothing cached..
*/
function get_cached_item($index,$item,$subitem='null') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
# Set default return
$return = null;
@ -807,9 +788,6 @@ function get_cached_item($index,$item,$subitem='null') {
if ($_SESSION[APPCONFIG]->getValue('cache',$item) && isset($_SESSION['cache'][$index][$item][$subitem]))
$return = $_SESSION['cache'][$index][$item][$subitem];
if (DEBUG_ENABLED)
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
@ -819,9 +797,6 @@ function get_cached_item($index,$item,$subitem='null') {
* Returns true on success of false on failure.
*/
function set_cached_item($index,$item,$subitem='null',$data) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
# Check config to make sure session-based caching is enabled.
if ($_SESSION[APPCONFIG]->getValue('cache',$item)) {
global $CACHE;
@ -839,9 +814,6 @@ function set_cached_item($index,$item,$subitem='null',$data) {
* Deletes the cache for a specified $item for the specified $index
*/
function del_cached_item($index,$item,$subitem='null') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
global $CACHE;
# Check config to make sure session-based caching is enabled.
@ -864,9 +836,6 @@ function del_cached_item($index,$item,$subitem='null') {
* @return boolean
*/
function set_cookie($name,$val,$expire=null,$dir=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
# Set default return
$return = false;
@ -883,9 +852,6 @@ function set_cookie($name,$val,$expire=null,$dir=null) {
$return = true;
}
if (DEBUG_ENABLED)
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
@ -899,9 +865,6 @@ function set_cookie($name,$val,$expire=null,$dir=null) {
* @return string The customized filename, if exists, or the standard one
*/
function get_custom_file($index,$filename,$path) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
# Set default return
$return = $path.$filename;
$server = $_SESSION[APPCONFIG]->getServer($index);
@ -910,105 +873,102 @@ function get_custom_file($index,$filename,$path) {
if (! is_null($custom) && is_file(realpath($path.$custom.$filename)))
$return = $path.$custom.$filename;
if (DEBUG_ENABLED)
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
$masortSortBy = array();
/**
* Sort a multi dimensional array.
*
* @param array Multi demension array passed by reference
* @param string Comma delimited string of sort keys.
* @param boolean Whether to reverse sort.
* @return array Sorted multi demension array.
*/
function masort(&$data,$sortby,$rev=0) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
function masort(&$data,$sortby,$rev=false) {
global $masortSortBy;
$masortSortBy = explode(',', $sortby);
foreach ($masortSortBy as $index => $value) {
if (!preg_match('/^[a-zA-z0-9_]+$/', $value)) {
unset($masortSortBy[$index]);
}
}
$masortSortBy = array_values($masortSortBy);
uasort($data, 'masortCallback');
if ($rev) {
$data = array_reverse($data, true);
}
}
# if the array to sort is null or empty
if (! $data) return;
static $CACHE = array();
if (empty($CACHE[$sortby])) {
$code = "\$c=0;\n";
foreach (explode(',',$sortby) as $key) {
if (!preg_match('/^[a-zA-z0-9_]+$/', $key)) {
return;
/**
* Callback to sort for masort().
*
* @param array|object $a first parameter
* @param array|object $b second parameter
* @return int comparison result
*/
function masortCallback($a, $b) {
global $masortSortBy;
foreach ($masortSortBy as $key) {
if (is_object($a)) {
if (is_array($a->$key)) {
asort($a->$key);
$aa = array_shift($a->$key);
}
$code .= "if (is_object(\$a) || is_object(\$b)) {\n";
$code .= " if (is_array(\$a->$key)) {\n";
$code .= " asort(\$a->$key);\n";
$code .= " \$aa = array_shift(\$a->$key);\n";
$code .= " } else\n";
$code .= " \$aa = \$a->$key;\n";
$code .= " if (is_array(\$b->$key)) {\n";
$code .= " asort(\$b->$key);\n";
$code .= " \$bb = array_shift(\$b->$key);\n";
$code .= " } else\n";
$code .= " \$bb = \$b->$key;\n";
$code .= " if (\$aa != \$bb)";
if ($rev)
$code .= " return (\$aa < \$bb ? 1 : -1);\n";
else
$code .= " return (\$aa > \$bb ? 1 : -1);\n";
$code .= "} else {\n";
$code .= " \$a = array_change_key_case(\$a);\n";
$code .= " \$b = array_change_key_case(\$b);\n";
else {
$aa = $a->$key;
}
if (is_array($b->$key)) {
asort($b->$key);
$bb = array_shift($b->$key);
}
else {
$bb = $b->$key;
}
if ($aa != $bb) {
return ($aa > $bb ? 1 : -1);
}
}
else {
$a = array_change_key_case($a);
$b = array_change_key_case($b);
$key = strtolower($key);
$code .= " if ((! isset(\$a['$key'])) && isset(\$b['$key'])) return 1;\n";
$code .= " if (isset(\$a['$key']) && (! isset(\$b['$key']))) return -1;\n";
if ((! isset($a[$key])) && isset($b[$key])) {
return 1;
}
if (isset($a[$key]) && (! isset($b[$key]))) {
return -1;
}
if ((isset($a[$key])) && (isset($b[$key]))) {
if (is_array($a[$key])) {
asort($a[$key]);
$aa = array_shift($a[$key]);
}
else {
$aa = $a[$key];
}
if (is_array($b[$key])) {
asort($b[$key]);
$bb = array_shift($b[$key]);
}
else {
$bb = $b[$key];
}
$code .= " if ((isset(\$a['$key'])) && (isset(\$b['$key']))) {\n";
$code .= " if (is_array(\$a['$key'])) {\n";
$code .= " asort(\$a['$key']);\n";
$code .= " \$aa = array_shift(\$a['$key']);\n";
$code .= " } else\n";
$code .= " \$aa = \$a['$key'];\n";
$code .= " if (is_array(\$b['$key'])) {\n";
$code .= " asort(\$b['$key']);\n";
$code .= " \$bb = array_shift(\$b['$key']);\n";
$code .= " } else\n";
$code .= " \$bb = \$b['$key'];\n";
$code .= " if (\$aa != \$bb)\n";
$code .= " if (is_numeric(\$aa) && is_numeric(\$bb)) {\n";
if ($rev)
$code .= " return (\$aa < \$bb ? 1 : -1);\n";
else
$code .= " return (\$aa > \$bb ? 1 : -1);\n";
$code .= " } else {\n";
if ($rev)
$code .= " if ( (\$c = strcasecmp(\$bb,\$aa)) != 0 ) return \$c;\n";
else
$code .= " if ( (\$c = strcasecmp(\$aa,\$bb)) != 0 ) return \$c;\n";
$code .= " }\n";
$code .= " }\n";
$code .= "}\n";
if ($aa != $bb) {
if (is_numeric($aa) && is_numeric($bb)) {
return ($aa > $bb ? 1 : -1);
}
else {
if (($c = strcasecmp($aa,$bb)) != 0 ) {
return $c;
}
}
}
}
}
$code .= 'return $c;';
$CACHE[$sortby] = create_function('$a, $b',$code);
}
uasort($data,$CACHE[$sortby]);
}
/**
@ -1042,9 +1002,6 @@ function isCompress() {
* @return boolean
*/
function obfuscate_password_display($enc=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($_SESSION[APPCONFIG]->getValue('appearance','obfuscate_password_display'))
$return = true;
@ -1054,9 +1011,6 @@ function obfuscate_password_display($enc=null) {
else
$return = false;
if (DEBUG_ENABLED)
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
@ -1071,9 +1025,6 @@ function obfuscate_password_display($enc=null) {
* @return string
*/
function pretty_print_dn($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$dn_save = $dn;
$dn = pla_explode_dn($dn);
@ -1104,9 +1055,6 @@ function pretty_print_dn($dn) {
* @return boolean
*/
function is_dn_string($str) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
/* Try to break the string into its component parts if it can be done
ie, "uid=Manager" "dc=example" and "dc=com" */
$parts = pla_explode_dn($str);
@ -1141,9 +1089,6 @@ function is_dn_string($str) {
* @return boolean Returns true if the specified string looks like an email address or false otherwise.
*/
function is_mail_string($str) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$mail_regex = "/^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*$/";
if (preg_match($mail_regex,$str))
@ -1159,9 +1104,6 @@ function is_mail_string($str) {
* @return boolean Returns true if the specified string looks like a web URL or false otherwise.
*/
function is_url_string($str) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$url_regex = '/^(ftp|https?):\/\/+[\w\.\-\/\?\=\&]*\w+/';
if (preg_match($url_regex,$str))
@ -1202,9 +1144,6 @@ function is_url_string($str) {
* @return int
*/
function pla_compare_dns($dn1,$dn2) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
# If pla_compare_dns is passed via a tree, then we'll just get the DN part.
if (is_array($dn1))
if (isset($dn1['dn']))
@ -1301,9 +1240,6 @@ function pla_compare_dns($dn1,$dn2) {
* @return int
*/
function get_next_number($base,$attr,$increment=false,$filter=false,$startmin=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $_SESSION[APPCONFIG]->getServer(get_request('server_id','REQUEST'));
$attr = strtolower($attr);
$query = array();
@ -1493,9 +1429,6 @@ function get_next_number($base,$attr,$increment=false,$filter=false,$startmin=nu
* @return string
*/
function get_icon($server_id,$dn,$object_classes=array()) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $_SESSION[APPCONFIG]->getServer($server_id);
# Fetch and lowercase all the objectClasses in an array
@ -1674,9 +1607,6 @@ function get_icon($server_id,$dn,$object_classes=array()) {
* @return string|null Returns null if both base is null and sub_dn is null or empty
*/
function expand_dn_with_base($base,$sub_dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$empty_str = (is_null($sub_dn) || (($len=strlen(trim($sub_dn))) == 0));
if ($empty_str)
@ -1700,9 +1630,6 @@ function expand_dn_with_base($base,$sub_dn) {
* @return string The generated salt string.
*/
function random_salt($length) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$possible = '0123456789'.
'abcdefghijklmnopqrstuvwxyz'.
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
@ -1726,9 +1653,6 @@ function random_salt($length) {
* @return string The RDN
*/
function get_rdn($dn,$include_attrs=0,$decode=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (is_null($dn))
return null;
@ -1748,9 +1672,6 @@ function get_rdn($dn,$include_attrs=0,$decode=false) {
* Split an RDN into its attributes
*/
function rdn_explode($rdn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
# Setup to work out our RDN.
$rdnarray = explode('\+',$rdn);
@ -1784,9 +1705,6 @@ function rdn_explode($rdn) {
* @return array An associative array contianing the error title and description like so:
*/
function pla_verbose_error($key) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
static $CACHE = array();
if (! count($CACHE)) {
@ -1836,9 +1754,6 @@ function pla_verbose_error($key) {
* @return array An associative array contianing the OID title and description like so:
*/
function support_oid_to_text($key) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
static $CACHE = array();
$unknown = array();
@ -1883,9 +1798,6 @@ function support_oid_to_text($key) {
* Print an LDAP error message
*/
function ldap_error_msg($msg,$errnum) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$body = '<table border="0">';
$errnum = ('0x'.str_pad(dechex($errnum),2,0,STR_PAD_LEFT));
@ -1928,9 +1840,6 @@ function ldap_error_msg($msg,$errnum) {
* fixed_width, fixed_height, img_opts.
*/
function draw_jpeg_photo($server,$dn,$attr_name='jpegphoto',$index,$draw_delete_buttons=false,$options=array()) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$fixed = array();
$fixed['width'] = isset($options['fixed_width']) ? $options['fixed_width'] : false;
$fixed['height'] = isset($options['fixed_height']) ? $options['fixed_height'] : false;
@ -2020,9 +1929,6 @@ function draw_jpeg_photo($server,$dn,$attr_name='jpegphoto',$index,$draw_delete_
* @todo Dynamically work this list out so we only present hashes that we can encrypt
*/
function password_types() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
return array(
''=>'clear',
'crypt-sha512' => 'crypt-sha512',
@ -2043,9 +1949,6 @@ function password_types() {
* @return string The hashed password.
*/
function pla_password_hash($password_clear,$enc_type) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$enc_type = strtolower($enc_type);
switch($enc_type) {
@ -2100,9 +2003,6 @@ function pla_password_hash($password_clear,$enc_type) {
* @return Boolean True if the clear password matches the hash, and false otherwise.
*/
function password_check($cryptedpassword,$plainpassword,$attribute='userpassword') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (in_array($attribute,array('sambalmpassword','sambantpassword'))) {
$smb = new smbHash;
@ -2265,9 +2165,6 @@ function password_check($cryptedpassword,$plainpassword,$attribute='userpassword
* @return string
*/
function get_enc_type($user_password) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
# Capture the stuff in the { } to determine if this is crypt, md5, etc.
$enc_type = null;
@ -2304,9 +2201,6 @@ function get_enc_type($user_password) {
* @param boolean (optional) If true, the function draws the localized text "choose" to the right of the button.
*/
function draw_chooser_link($form,$element,$include_choose_text=true,$rdn='none') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$href = sprintf("javascript:dnChooserPopup('%s','%s','%s');",$form,$element,$rdn == 'none' ? '' : rawurlencode($rdn));
$title = _('Click to popup a dialog to select an entry (DN) graphically');
@ -2335,16 +2229,9 @@ function draw_chooser_link($form,$element,$include_choose_text=true,$rdn='none')
* @return array An array of RDN parts of this format:
*/
function pla_explode_dn($dn,$with_attributes=0) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
global $CACHE;
if (isset($CACHE['explode'][$dn][$with_attributes])) {
if (DEBUG_ENABLED)
debug_log('Return CACHED result (%s) for (%s)',1,0,__FILE__,__LINE__,__METHOD__,
$CACHE['explode'][$dn][$with_attributes],$dn);
return $CACHE['explode'][$dn][$with_attributes];
}
@ -2354,9 +2241,6 @@ function pla_explode_dn($dn,$with_attributes=0) {
$result[0] = ldap_explode_dn(dn_escape($dn),0);
$result[1] = ldap_explode_dn(dn_escape($dn),1);
if (! $result[$with_attributes]) {
if (DEBUG_ENABLED)
debug_log('Returning NULL - NO result.',1,0,__FILE__,__LINE__,__METHOD__);
return array();
}
@ -2373,9 +2257,6 @@ function pla_explode_dn($dn,$with_attributes=0) {
$CACHE['explode'][implode(',',array_reverse($result[0]))][$key] = array_reverse($result[$key]);
}
if (DEBUG_ENABLED)
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$result[$with_attributes]);
return $result[$with_attributes];
}
@ -2383,9 +2264,6 @@ function pla_explode_dn($dn,$with_attributes=0) {
* Parse a DN and escape any special characters
*/
function dn_escape($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$olddn = $dn;
# Check if the RDN has a comma and escape it.
@ -2394,9 +2272,6 @@ function dn_escape($dn) {
$dn = preg_replace('/([^\\\\]),(\s*[^=]*\s*)([^,])$/','$1\\\\2C$2$3',$dn);
if (DEBUG_ENABLED)
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$dn);
return $dn;
}
@ -2404,9 +2279,6 @@ function dn_escape($dn) {
* Parse a DN and unescape any special characters
*/
function dn_unescape($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (is_array($dn)) {
$a = array();
@ -2507,9 +2379,6 @@ function utime() {
* @return string The string created from the array.
*/
function array_to_query_string($array,$exclude_vars=array()) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! is_array($array) || ! count($array))
return '';
@ -2554,9 +2423,6 @@ function array_to_query_string($array,$exclude_vars=array()) {
* @see pla_explode_dns
*/
function pla_reverse_dn($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
return (implode(',',array_reverse(pla_explode_dn($dn))));
}
@ -2577,9 +2443,6 @@ function sortAttrs($a,$b) {
* @returns array Array with values converted to lowercase.
*/
function arrayLower($array) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! is_array($array))
return $array;
@ -2594,9 +2457,6 @@ function arrayLower($array) {
* Gets a DN string using the user-configured tree_display_format string to format it.
*/
function draw_formatted_dn($server,$entry) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$dn = $entry->getDn();
$formats = $_SESSION[APPCONFIG]->getValue('appearance','tree_display_format');
@ -2606,9 +2466,6 @@ function draw_formatted_dn($server,$entry) {
preg_match_all('/%[a-zA-Z_0-9]+/',$format,$tokens);
$tokens = $tokens[0];
if (DEBUG_ENABLED)
debug_log('The tokens are (%s)',1,0,__FILE__,__LINE__,__METHOD__,$tokens);
foreach ($tokens as $token) {
if (strcasecmp($token,'%dn') == 0)
$format = str_replace($token,pretty_print_dn($dn),$format);
@ -2652,9 +2509,6 @@ function draw_formatted_dn($server,$entry) {
* Server html select list
*/
function server_select_list($selected=null,$logged_on=false,$name='index',$isVisible=true,$js=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$count = 0;
$server_menu_html = sprintf('<select name="%s" id="%s" %s>',$name,$name,$js);
@ -2690,9 +2544,6 @@ function server_select_list($selected=null,$logged_on=false,$name='index',$isVis
* Converts a little-endian hex-number to one, that 'hexdec' can convert
*/
function littleEndian($hex) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$result = '';
for ($x=strlen($hex)-2;$x>= 0;$x=$x-2)
@ -2702,9 +2553,6 @@ function littleEndian($hex) {
}
function binSIDtoText($binsid) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$hex_sid = bin2hex($binsid);
$rev = hexdec(substr($hex_sid,0,2)); // Get revision-part of SID
$subcount = hexdec(substr($hex_sid,2,2)); // Get count of sub-auth entries
@ -2733,9 +2581,6 @@ function binSIDtoText($binsid) {
* @return array Array of values keyed by $key.
*/
function return_ldap_hash($base,$filter,$key,$attrs,$sort=true) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $_SESSION[APPCONFIG]->getServer(get_request('server_id','REQUEST'));
$key = strtolower($key);
@ -2782,9 +2627,6 @@ function return_ldap_hash($base,$filter,$key,$attrs,$sort=true) {
* based on the criteria defined in the array $criteria in config.php
*/
function password_generate() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$no_use_similiar = ! $_SESSION[APPCONFIG]->getValue('password','use_similar');
$lowercase = $_SESSION[APPCONFIG]->getValue('password','lowercase');
$uppercase = $_SESSION[APPCONFIG]->getValue('password','uppercase');
@ -2849,9 +2691,6 @@ function password_generate() {
shuffle($outarray);
$return = implode('',$outarray);
if (DEBUG_ENABLED)
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
@ -2864,9 +2703,6 @@ function password_generate() {
* @return string The padded string
*/
function a_array_rand($input,$num_req) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (count($input) == 0)
return array();
@ -2889,9 +2725,6 @@ function a_array_rand($input,$num_req) {
$return[] = $input[$idxlist[$i]];
}
if (DEBUG_ENABLED)
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
return $return;
}
@ -2919,9 +2752,6 @@ function htmlid($sid,$dn) {
* Is PLA configured for AJAX display
*/
function isAjaxEnabled() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (isset($_SESSION[APPCONFIG]))
return ($_SESSION[APPCONFIG]->getValue('appearance','tree') == 'AJAXTree');
else

View File

@ -32,9 +32,6 @@
* element priority. 1 otherwise.
*/
function sort_array_by_priority($a,$b) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',257,0,__FILE__,__LINE__,__METHOD__,$fargs);
return (($a['priority'] < $b['priority']) ? -1 : 1 );
}
@ -50,15 +47,9 @@ function sort_array_by_priority($a,$b) {
* @return true if all procedures returned true, false otherwise.
*/
function run_hook($hook_name,$args) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',257,0,__FILE__,__LINE__,__METHOD__,$fargs);
$hooks = isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->hooks : array();
if (! count($hooks) || ! array_key_exists($hook_name,$hooks)) {
if (DEBUG_ENABLED)
debug_log('Returning, HOOK not defined (%s)',257,0,__FILE__,__LINE__,__METHOD__,$hook_name);
return true;
}
@ -69,34 +60,18 @@ function run_hook($hook_name,$args) {
* since all procedures have been attached to the hook with a
* numerical weight. */
while (list($key,$hook) = each($hooks[$hook_name])) {
if (DEBUG_ENABLED)
debug_log('Calling HOOK Function (%s)(%s)',257,0,__FILE__,__LINE__,__METHOD__,
$hook['hook_function'],$args);
array_push($rollbacks,$hook['rollback_function']);
$result = call_user_func_array($hook['hook_function'],$args);
if (DEBUG_ENABLED)
debug_log('Called HOOK Function (%s)',257,0,__FILE__,__LINE__,__METHOD__,
$hook['hook_function']);
/* If a procedure fails (identified by a false return), its optional rollback is executed with
* the same arguments. After that, all rollbacks from
* previously executed procedures are executed in the reverse
* order. */
if (! is_null($result) && $result == false) {
if (DEBUG_ENABLED)
debug_log('HOOK Function [%s] return (%s)',257,0,__FILE__,__LINE__,__METHOD__,
$hook['hook_function'],$result);
while ($rollbacks) {
$rollback = array_pop($rollbacks);
if ($rollback != false) {
if (DEBUG_ENABLED)
debug_log('HOOK Function Rollback (%s)',257,0,__FILE__,__LINE__,__METHOD__,
$rollback);
call_user_func_array($rollback,$args);
}
}
@ -117,9 +92,6 @@ function run_hook($hook_name,$args) {
* @param rollback_function Name of the php rollback function called upon failure.
*/
function add_hook($hook_name,$hook_function,$priority=0,$rollback_function=null) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',257,0,__FILE__,__LINE__,__METHOD__,$fargs);
# First, see if the hook function exists.
if (! function_exists($hook_function)) {
system_message(array(
@ -153,9 +125,6 @@ function add_hook($hook_name,$hook_function,$priority=0,$rollback_function=null)
* procedures that call this function as a rollback will be removed.
*/
function remove_hook($hook_name,$hook_function,$priority,$rollback_function) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',257,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (array_key_exists($hook_name,$_SESSION[APPCONFIG]->hooks)) {
reset($_SESSION[APPCONFIG]->hooks[$hook_name]);
@ -176,9 +145,6 @@ function remove_hook($hook_name,$hook_function,$priority,$rollback_function) {
* @param hook_name Name of hook to clear.
*/
function clear_hooks($hook_name) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',257,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (array_key_exists($hook_name,$_SESSION[APPCONFIG]->hooks))
unset($_SESSION[APPCONFIG]->hooks[$hook_name]);
}

View File

@ -26,9 +26,6 @@ class page {
protected $_default;
public function __construct($index=null) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
# If we done have a configuration, then our IMGDIR and CSS are not defined
if (! defined('IMGDIR'))
define('IMGDIR','images/default');
@ -65,9 +62,6 @@ class page {
header('Content-type: text/html; charset="UTF-8"');
if (isCompress()) {
header('Content-Encoding: gzip');
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
debug_log('Sent COMPRESSED header to browser and discarded (%s)',129,0,__FILE__,__LINE__,__METHOD__,$preOutput);
}
if (isset($_SESSION[APPCONFIG])
@ -85,17 +79,11 @@ class page {
/* Add to the HTML Header */
public function head_add($html) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->_head[] .= $html;
}
/* Print out the HTML header */
private function pageheader_print() {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
# HTML prepage requirements.
foreach ($this->_pageheader as $line)
echo $line."\n";
@ -139,9 +127,6 @@ class page {
}
private function head_print() {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (isset($_SESSION[APPCONFIG]))
$pagetitle = $_SESSION[APPCONFIG]->getValue('appearance','page_title') ? ' - '.$_SESSION[APPCONFIG]->getValue('appearance','page_title') : '';
else
@ -175,9 +160,6 @@ class page {
}
private function control_print() {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
echo '<table class="control" width="100%" border="0">';
echo '<tr><td>';
@ -203,9 +185,6 @@ class page {
}
protected function tree() {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! isset($_SESSION[APPCONFIG]))
return;
@ -232,9 +211,6 @@ class page {
}
public function block_add($side,$object) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! is_object($object))
error(sprintf('block_add called with [%s], but it is not an object',serialize($object)));
@ -242,9 +218,6 @@ class page {
}
private function block_print($side) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! isset($this->_block[$side]))
return;
@ -255,9 +228,6 @@ class page {
}
private function sysmsg() {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (isset($this->sysmsg)) {
foreach ($this->sysmsg as $index => $details) {
switch ($details['type']) {
@ -293,12 +263,9 @@ class page {
}
private function body($raw=false) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
# Add the Session System Messages
if (isset($_SESSION['sysmsg']) && is_array($_SESSION['sysmsg'])) {
foreach ($_SESSION['sysmsg'] as $msg)
foreach ($_SESSION['sysmsg'] as $msg)
$this->setsysmsg($msg);
unset($_SESSION['sysmsg']);
@ -317,9 +284,6 @@ class page {
}
private function footer_print() {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
printf('<tr class="foot"><td><small>%s</small></td><td colspan="2"><div id="ajFOOT">%s</div>%s</td></tr>',
isCompress() ? '[C]' : '&nbsp;',
app_version(),
@ -330,9 +294,6 @@ class page {
* Only show a particular page frame - used by an AJAX call
*/
public function show($frame,$compress=false,$raw=false) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
# If the body is called via AJAX, and compression is enable, we need to compress the output
if ($compress && ob_get_level() && isCompress()) {
ob_end_clean();
@ -356,18 +317,11 @@ class page {
$output = ob_get_contents();
ob_end_clean();
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
debug_log('Sending COMPRESSED output to browser[(%s),%s]',129,0,__FILE__,__LINE__,__METHOD__,
strlen($output),$output);
print gzencode($output);
}
}
public function display($filter=array()) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
# Control what is displayed.
$display = array(
'HEAD'=>false,
@ -434,18 +388,11 @@ class page {
$output = ob_get_contents();
ob_end_clean();
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
debug_log('Sending COMPRESSED output to browser[(%s),%s]',129,0,__FILE__,__LINE__,__METHOD__,
strlen($output),$output);
print gzencode($output);
}
}
public function setsysmsg($data) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! is_array($data))
return;

View File

@ -27,30 +27,18 @@ abstract class SchemaItem {
private $is_obsolete = false;
public function setOID($oid) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->oid = $oid;
}
public function setDescription($desc) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->description = $desc;
}
public function getOID() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->oid);
return $this->oid;
}
public function getDescription() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->description);
return $this->description;
}
@ -58,9 +46,6 @@ abstract class SchemaItem {
* Gets whether this objectClass is flagged as obsolete by the LDAP server.
*/
public function getIsObsolete() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->is_obsolete);
return $this->is_obsolete;
}
@ -71,9 +56,6 @@ abstract class SchemaItem {
* @return string The name
*/
public function getName($lower=true) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->name);
return $lower ? strtolower($this->name) : $this->name;
}
}
@ -106,9 +88,6 @@ class ObjectClass extends SchemaItem {
* Creates a new ObjectClass object given a raw LDAP objectClass string.
*/
public function __construct($class,$server) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->server_id = $server->getIndex();
$this->type = $server->getValue('server','schema_oclass_default');
@ -151,8 +130,6 @@ class ObjectClass extends SchemaItem {
$this->name = preg_replace('/^\'/','',$this->name);
$this->name = preg_replace('/\'$/','',$this->name);
if (DEBUG_ENABLED)
debug_log('Case NAME returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->name);
break;
case 'DESC':
@ -165,15 +142,11 @@ class ObjectClass extends SchemaItem {
} while (! preg_match('/\'$/s',$strings[$i]));
if (DEBUG_ENABLED)
debug_log('Case DESC returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->description);
break;
case 'OBSOLETE':
$this->is_obsolete = TRUE;
if (DEBUG_ENABLED)
debug_log('Case OBSOLETE returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->is_obsolete);
break;
case 'SUP':
@ -191,29 +164,19 @@ class ObjectClass extends SchemaItem {
} while (! preg_match('/\)+\)?/',$strings[$i+1]));
}
if (DEBUG_ENABLED)
debug_log('Case SUP returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->sup_classes);
break;
case 'ABSTRACT':
$this->type = 'abstract';
if (DEBUG_ENABLED)
debug_log('Case ABSTRACT returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->type);
break;
case 'STRUCTURAL':
$this->type = 'structural';
if (DEBUG_ENABLED)
debug_log('Case STRUCTURAL returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->type);
break;
case 'AUXILIARY':
$this->type = 'auxiliary';
if (DEBUG_ENABLED)
debug_log('Case AUXILIARY returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->type);
break;
case 'MUST':
@ -221,9 +184,6 @@ class ObjectClass extends SchemaItem {
$i = $this->parseList(++$i,$strings,$attrs);
if (DEBUG_ENABLED)
debug_log('parseList returned %d (%s)',8,0,__FILE__,__LINE__,__METHOD__,$i,$attrs);
foreach ($attrs as $string) {
$attr = new ObjectClass_ObjectClassAttribute($string,$this->name);
@ -234,9 +194,6 @@ class ObjectClass extends SchemaItem {
} else
array_push($this->must_attrs,$attr);
}
if (DEBUG_ENABLED)
debug_log('Case MUST returned (%s) (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->must_attrs,$this->force_may);
break;
case 'MAY':
@ -244,24 +201,15 @@ class ObjectClass extends SchemaItem {
$i = $this->parseList(++$i,$strings,$attrs);
if (DEBUG_ENABLED)
debug_log('parseList returned %d (%s)',8,0,__FILE__,__LINE__,__METHOD__,$i,$attrs);
foreach ($attrs as $string) {
$attr = new ObjectClass_ObjectClassAttribute($string,$this->name);
array_push($this->may_attrs,$attr);
}
if (DEBUG_ENABLED)
debug_log('Case MAY returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->may_attrs);
break;
default:
if (preg_match('/[\d\.]+/i',$strings[$i]) && $i == 1) {
$this->setOID($strings[$i]);
if (DEBUG_ENABLED)
debug_log('Case default returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->getOID());
}
break;
}
@ -269,19 +217,12 @@ class ObjectClass extends SchemaItem {
$this->description = preg_replace("/^\'/",'',$this->description);
$this->description = preg_replace("/\'$/",'',$this->description);
if (DEBUG_ENABLED)
debug_log('Returning () - NAME (%s), DESCRIPTION (%s), MUST (%s), MAY (%s), FORCE MAY (%s)',9,0,__FILE__,__LINE__,__METHOD__,
$this->name,$this->description,$this->must_attrs,$this->may_attrs,$this->force_may);
}
/**
* Parse an LDAP schema list
*/
private function parseList($i,$strings,&$attrs) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
/*
* A list starts with a ( followed by a list of attributes separated by $ terminated by )
* The first token can therefore be a ( or a (NAME or a (NAME)
@ -333,9 +274,6 @@ class ObjectClass extends SchemaItem {
sort($attrs);
if (DEBUG_ENABLED)
debug_log('Returning (%d,[%s],[%s])',9,0,__FILE__,__LINE__,__METHOD__,$i,$strings,$attrs);
return $i;
}
@ -343,9 +281,6 @@ class ObjectClass extends SchemaItem {
* This will return all our parent ObjectClass Objects
*/
public function getParents() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ((count($this->sup_classes) == 1) && ($this->sup_classes[0] == 'top'))
return array();
@ -379,9 +314,6 @@ class ObjectClass extends SchemaItem {
* @see getMayAttrNames
*/
public function getMustAttrs($parents=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! $parents)
return $this->must_attrs;
@ -421,9 +353,6 @@ class ObjectClass extends SchemaItem {
* @see AttributeType
*/
public function getMayAttrs($parents=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! $parents)
return $this->may_attrs;
@ -448,9 +377,6 @@ class ObjectClass extends SchemaItem {
}
public function getForceMayAttrs() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
return $this->force_may;
}
@ -470,9 +396,6 @@ class ObjectClass extends SchemaItem {
* @see getMayAttrNames
*/
public function getMustAttrNames($parents=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
$attr_names = array();
foreach ($this->getMustAttrs($parents) as $attr)
@ -497,9 +420,6 @@ class ObjectClass extends SchemaItem {
* @see getMustAttrNames
*/
public function getMayAttrNames($parents=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
$attr_names = array();
foreach ($this->getMayAttrs($parents) as $attr)
@ -516,9 +436,6 @@ class ObjectClass extends SchemaItem {
* @return boolean Returns true on success or false on failure (objectclass already existed for example)
*/
public function addChildObjectClass($name) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
$name = trim($name);
foreach ($this->children_objectclasses as $existing_objectclass)
@ -534,9 +451,6 @@ class ObjectClass extends SchemaItem {
* @return Array Names of objectClasses which inherit from this objectClass.
*/
public function getChildObjectClasses() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
return $this->children_objectclasses;
}
@ -546,9 +460,6 @@ class ObjectClass extends SchemaItem {
* @return array An array of objectClass names (strings)
*/
public function getSupClasses() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
return $this->sup_classes;
}
@ -558,9 +469,6 @@ class ObjectClass extends SchemaItem {
* @param array ObjectClasses that this attribute may be related to
*/
public function isRelated($oclass) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
# If I am in the array, we'll just return false
if (in_array_ignore_case($this->name,$oclass))
return false;
@ -581,9 +489,6 @@ class ObjectClass extends SchemaItem {
* Gets the type of this objectClass: STRUCTURAL, ABSTRACT, or AUXILIARY.
*/
public function getType() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->type);
return $this->type;
}
@ -595,9 +500,6 @@ class ObjectClass extends SchemaItem {
* @param array $attr An array of attribute names (strings) to add.
*/
private function addMustAttrs($attr) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! is_array($attr) || ! count($attr))
return;
@ -611,9 +513,6 @@ class ObjectClass extends SchemaItem {
* @param array $attr An array of attribute names (strings) to add.
*/
private function addMayAttrs($attr) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! is_array($attr) || ! count($attr))
return;
@ -624,9 +523,6 @@ class ObjectClass extends SchemaItem {
* Determine if an array is listed in the force_may attrs
*/
public function isForceMay($attr) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
foreach ($this->force_may as $forcemay)
if ($forcemay->getName() == $attr)
return true;
@ -635,9 +531,6 @@ class ObjectClass extends SchemaItem {
}
public function isStructural() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($this->type == 'structural')
return true;
else
@ -671,26 +564,17 @@ class ObjectClass_ObjectClassAttribute {
* @param string $source the name of the ObjectClass which specifies this attribute.
*/
public function __construct($name,$source) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->name = $name;
$this->source = $source;
}
# Gets this attribute's name
public function getName($lower=true) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->name);
return $lower ? strtolower($this->name) : $this->name;
}
# Gets the name of the ObjectClass which originally specified this attribute.
public function getSource() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->source);
return $this->source;
}
}
@ -738,9 +622,6 @@ class AttributeType extends SchemaItem {
* Creates a new AttributeType object from a raw LDAP AttributeType string.
*/
public function __construct($attr) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
$strings = preg_split('/[\s,]+/',$attr,-1,PREG_SPLIT_DELIM_CAPTURE);
for($i=0; $i<count($strings); $i++) {
@ -788,9 +669,6 @@ class AttributeType extends SchemaItem {
$this->addAlias($alias);
}
}
if (DEBUG_ENABLED)
debug_log('Case NAME returned (%s) (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->name,$this->aliases);
break;
case 'DESC':
@ -801,48 +679,30 @@ class AttributeType extends SchemaItem {
else
$this->description=$this->description.' '.$strings[$i];
} while (! preg_match("/\'$/s",$strings[$i]));
if (DEBUG_ENABLED)
debug_log('Case DESC returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->description);
break;
case 'OBSOLETE':
$this->is_obsolete = TRUE;
if (DEBUG_ENABLED)
debug_log('Case OBSOLETE returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->is_obsolete);
break;
case 'SUP':
$i++;
$this->sup_attribute = $strings[$i];
if (DEBUG_ENABLED)
debug_log('Case SUP returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->sup_attribute);
break;
case 'EQUALITY':
$i++;
$this->equality = $strings[$i];
if (DEBUG_ENABLED)
debug_log('Case EQUALITY returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->equality);
break;
case 'ORDERING':
$i++;
$this->ordering = $strings[$i];
if (DEBUG_ENABLED)
debug_log('Case ORDERING returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->ordering);
break;
case 'SUBSTR':
$i++;
$this->sub_str = $strings[$i];
if (DEBUG_ENABLED)
debug_log('Case SUBSTR returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->sub_str);
break;
case 'SYNTAX':
@ -862,46 +722,28 @@ class AttributeType extends SchemaItem {
$this->name .= ' '.$strings[$i];
} while ($strings[$i] != '}');
}
if (DEBUG_ENABLED)
debug_log('Case SYNTAX returned (%s) (%s) (%s)',8,0,__FILE__,__LINE__,__METHOD__,
$this->syntax,$this->syntax_oid,$this->max_length);
break;
case 'SINGLE-VALUE':
$this->is_single_value = TRUE;
if (DEBUG_ENABLED)
debug_log('Case SINGLE-VALUE returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->is_single_value);
break;
case 'COLLECTIVE':
$this->is_collective = TRUE;
if (DEBUG_ENABLED)
debug_log('Case COLLECTIVE returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->is_collective);
break;
case 'NO-USER-MODIFICATION':
$this->is_no_user_modification = TRUE;
if (DEBUG_ENABLED)
debug_log('Case NO-USER-MODIFICATION returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->is_no_user_modification);
break;
case 'USAGE':
$i++;
$this->usage = $strings[$i];
if (DEBUG_ENABLED)
debug_log('Case USAGE returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->usage);
break;
default:
if (preg_match('/[\d\.]+/i',$strings[$i]) && $i == 1) {
$this->setOID($strings[$i]);
if (DEBUG_ENABLED)
debug_log('Case default returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->getOID());
}
}
}
@ -916,9 +758,6 @@ class AttributeType extends SchemaItem {
$this->syntax_oid = preg_replace("/\'$/",'',$this->syntax_oid);
$this->sup_attribute = preg_replace("/^\'/",'',$this->sup_attribute);
$this->sup_attribute = preg_replace("/\'$/",'',$this->sup_attribute);
if (DEBUG_ENABLED)
debug_log('Returning ()',9,0,__FILE__,__LINE__,__METHOD__);
}
/**
@ -927,9 +766,6 @@ class AttributeType extends SchemaItem {
* @return string
*/
public function getUsage() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->usage);
return $this->usage;
}
@ -940,9 +776,6 @@ class AttributeType extends SchemaItem {
* @return string
*/
public function getSupAttribute() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->sup_attribute);
return $this->sup_attribute;
}
@ -952,9 +785,6 @@ class AttributeType extends SchemaItem {
* @return string
*/
public function getEquality() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->equality);
return $this->equality;
}
@ -964,9 +794,6 @@ class AttributeType extends SchemaItem {
* @return string
*/
public function getOrdering() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->ordering);
return $this->ordering;
}
@ -976,9 +803,6 @@ class AttributeType extends SchemaItem {
* @return string
*/
public function getSubstr() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->sub_str);
return $this->sub_str;
}
@ -989,9 +813,6 @@ class AttributeType extends SchemaItem {
* an empty array if no attribute aliases this object.
*/
public function getAliases() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->aliases);
return $this->aliases;
}
@ -1002,9 +823,6 @@ class AttributeType extends SchemaItem {
* @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;
@ -1018,9 +836,6 @@ class AttributeType extends SchemaItem {
* @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;
}
@ -1033,9 +848,6 @@ class AttributeType extends SchemaItem {
* @return string The syntax OID string.
*/
public function getSyntaxOID() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->syntax_oid);
return $this->syntax_oid;
}
@ -1045,9 +857,6 @@ class AttributeType extends SchemaItem {
* @return int The maximum length (in characters) of this attribute or null if no maximum is specified.
*/
public function getMaxLength() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->max_length);
return $this->max_length;
}
@ -1058,9 +867,6 @@ class AttributeType extends SchemaItem {
* @return boolean Returns true if this attribute is single-valued or false otherwise.
*/
public function getIsSingleValue() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->is_single_value);
return $this->is_single_value;
}
@ -1070,9 +876,6 @@ class AttributeType extends SchemaItem {
* @param boolean $is
*/
public function setIsSingleValue($is) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->is_single_value = $is;
}
@ -1082,9 +885,6 @@ class AttributeType extends SchemaItem {
* @return boolean Returns true if this attribute is collective and false otherwise.
*/
public function getIsCollective() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->is_collective);
return $this->is_collective;
}
@ -1094,9 +894,6 @@ class AttributeType extends SchemaItem {
* @return boolean Returns true if this attribute is not modifiable by users.
*/
public function getIsNoUserModification() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->is_no_user_modification);
return $this->is_no_user_modification;
}
@ -1106,9 +903,6 @@ class AttributeType extends SchemaItem {
* @return string The attribute's type.
*/
public function getType() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->type);
return $this->type;
}
@ -1120,9 +914,6 @@ class AttributeType extends SchemaItem {
* attribute name is not found in this attribute's list of aliases)
*/
public function removeAlias($remove_alias_name) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
foreach ($this->aliases as $i => $alias_name) {
if (strcasecmp($alias_name,$remove_alias_name) == 0) {
@ -1141,9 +932,6 @@ class AttributeType extends SchemaItem {
* @param string $alias The name of a new attribute to add to this attribute's list of aliases.
*/
public function addAlias($alias) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
array_push($this->aliases,$alias);
}
@ -1153,9 +941,6 @@ class AttributeType extends SchemaItem {
* @param string $name The new name to give this attribute.
*/
public function setName($name) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->name = $name;
}
@ -1165,9 +950,6 @@ class AttributeType extends SchemaItem {
* @param string $attr The name of the new parent (SUP) attribute
*/
public function setSupAttribute($attr) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->sup_attribute = $attr;
}
@ -1177,9 +959,6 @@ class AttributeType extends SchemaItem {
* @param array $aliases The array of alias names (strings)
*/
public function setAliases($aliases) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->aliases = $aliases;
}
@ -1189,9 +968,6 @@ class AttributeType extends SchemaItem {
* @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;
}
@ -1202,13 +978,7 @@ class AttributeType extends SchemaItem {
* @param string $name The name of the objectClass to add.
*/
public function addUsedInObjectClass($name) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
foreach ($this->used_in_object_classes as $used_in_object_class) {
if (DEBUG_ENABLED)
debug_log('Checking (%s) with (%s)',8,0,__FILE__,__LINE__,__METHOD__,$used_in_object_class,$name);
if (strcasecmp($used_in_object_class,$name) == 0)
return false;
}
@ -1223,9 +993,6 @@ class AttributeType extends SchemaItem {
* @return array An array of names of objectclasses (strings) which provide this attribute
*/
public function getUsedInObjectClasses() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->used_in_object_classes);
return $this->used_in_object_classes;
}
@ -1236,9 +1003,6 @@ class AttributeType extends SchemaItem {
* @param string $name The name of the objectClass to add.
*/
public function addRequiredByObjectClass($name) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
foreach ($this->required_by_object_classes as $required_by_object_class)
if (strcasecmp($required_by_object_class,$name) == 0)
return false;
@ -1253,9 +1017,6 @@ class AttributeType extends SchemaItem {
* @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;
}
@ -1263,16 +1024,10 @@ class AttributeType extends SchemaItem {
* 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;
}
public function isForceMay() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->forced_as_may);
return $this->forced_as_may;
}
}
@ -1288,9 +1043,6 @@ class Syntax extends SchemaItem {
* Creates a new Syntax object from a raw LDAP syntax string.
*/
public function __construct($class) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
$strings = preg_split('/[\s,]+/',$class,-1,PREG_SPLIT_DELIM_CAPTURE);
for($i=0; $i<count($strings); $i++) {
@ -1335,9 +1087,6 @@ class MatchingRule extends SchemaItem {
* Creates a new MatchingRule object from a raw LDAP MatchingRule string.
*/
function __construct($strings) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
$strings = preg_split('/[\s,]+/',$strings,-1,PREG_SPLIT_DELIM_CAPTURE);
for ($i=0; $i<count($strings); $i++) {
@ -1407,9 +1156,6 @@ class MatchingRule extends SchemaItem {
* @param array $attrs The array of attribute names (strings) which use this MatchingRule
*/
public function setUsedByAttrs($attrs) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->used_by_attrs = $attrs;
}
@ -1419,9 +1165,6 @@ class MatchingRule extends SchemaItem {
* @return true if the attribute was added and false otherwise (already in the list)
*/
public function addUsedByAttr($attr) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
foreach ($this->used_by_attrs as $attr_name)
if (strcasecmp($attr_name,$attr) == 0)
return false;
@ -1437,9 +1180,6 @@ class MatchingRule extends SchemaItem {
* @return array The array of attribute names (strings).
*/
public function getUsedByAttrs() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->used_by_attrs);
return $this->used_by_attrs;
}
}
@ -1455,9 +1195,6 @@ class MatchingRuleUse extends SchemaItem {
private $used_by_attrs = array();
function __construct($strings) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
$strings = preg_split('/[\s,]+/',$strings,-1,PREG_SPLIT_DELIM_CAPTURE);
for($i=0; $i<count($strings); $i++) {
@ -1530,9 +1267,6 @@ class MatchingRuleUse extends SchemaItem {
* @return array The array of attribute names (strings).
*/
public function getUsedByAttrs() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->used_by_attrs);
return $this->used_by_attrs;
}
}

View File

@ -19,9 +19,6 @@ abstract class xmlTemplates {
protected $templates = array();
function __construct($server_id) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->server_id = $server_id;
$server = $_SESSION[APPCONFIG]->getServer($this->server_id);
$custom_prefix = $server->getValue('custom','pages_prefix');
@ -30,9 +27,6 @@ abstract class xmlTemplates {
# Try to get the templates from our CACHE.
if ($this->templates = get_cached_item($server_id,$class['item'])) {
if (DEBUG_ENABLED)
debug_log('Using CACHED templates',4,0,__FILE__,__LINE__,__METHOD__);
# See if the template_time has expired to see if we should reload the templates.
foreach ($this->templates as $index => $template) {
# If the file no longer exists, we'll delete the template.
@ -62,9 +56,6 @@ abstract class xmlTemplates {
}
}
if (DEBUG_ENABLED)
debug_log('Templates refreshed',4,0,__FILE__,__LINE__,__METHOD__);
# See if there are any new template files
$index = max(array_keys($this->templates))+1;
foreach ($class['types'] as $type) {
@ -87,7 +78,7 @@ abstract class xmlTemplates {
if (! in_array($filename,$this->getTemplateFiles())) {
$templatename = preg_replace('/.xml$/','',$file);
$className = $class['name'];
$this->templates[$index] = new $className($this->server_id,$templatename,$filename,$type,$index);
$index++;
@ -103,9 +94,6 @@ abstract class xmlTemplates {
}
} else {
if (DEBUG_ENABLED)
debug_log('Parsing templates',4,0,__FILE__,__LINE__,__METHOD__);
# Need to reset this, as get_cached_item() returns null if nothing cached.
$this->templates = array();
$changed = true;
@ -138,9 +126,6 @@ abstract class xmlTemplates {
}
}
if (DEBUG_ENABLED)
debug_log('Templates loaded',4,0,__FILE__,__LINE__,__METHOD__);
if ($changed) {
masort($this->templates,'title');
set_cached_item($server_id,$class['item'],'null',$this->templates);
@ -151,9 +136,6 @@ abstract class xmlTemplates {
* This will return our custom class variables, used by the parent to create objects.
*/
private function getClassVars() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$class = array();
switch (get_class($this)) {
@ -191,9 +173,6 @@ abstract class xmlTemplates {
* @return array List of templates of the type
*/
public function getTemplates($type=null,$container=null,$disabled=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$result = array();
if (is_array($this->templates))
@ -223,9 +202,6 @@ abstract class xmlTemplates {
* @return object Template (or default template if the ID doesnt exist)
*/
function getTemplate($templateid) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$class = $this->getClassVars();
foreach ($this->templates as $template)
@ -242,9 +218,6 @@ abstract class xmlTemplates {
* Get a list of template filenames.
*/
private function getTemplateFiles() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$result = array();
foreach ($this->templates as $template)
@ -277,9 +250,6 @@ abstract class xmlTemplate {
protected $attributes = array();
public function __construct($server_id,$name=null,$filename=null,$type=null,$id=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->server_id = $server_id;
$this->name = $name;
$this->type = $type;
@ -304,9 +274,6 @@ abstract class xmlTemplate {
* @return int Attribute ID in the array
*/
protected function getAttrID($attr) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
foreach ($this->attributes as $index => $attribute)
if (strtolower($attr) == $attribute->getName() || in_array(strtolower($attr),$attribute->getAliases()))
return $index;
@ -318,9 +285,6 @@ abstract class xmlTemplate {
* Get the Template filename.
*/
public function getFileName() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->filename);
return $this->filename;
}
@ -328,9 +292,6 @@ abstract class xmlTemplate {
* Return the template by ID
*/
public function getID() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs,$this->id);
if ($this->name)
return sprintf('%s:%s',$this->getName(false),$this->id);
else
@ -343,9 +304,6 @@ abstract class xmlTemplate {
* @param boolean Force the name to be lowercase (default)
*/
public function getName($lower=true) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->name);
if ($lower)
return strtolower($this->name);
else
@ -356,9 +314,6 @@ abstract class xmlTemplate {
* Get the Template read time.
*/
public function getReadTime() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->readtime);
return $this->readtime;
}
@ -368,9 +323,6 @@ abstract class xmlTemplate {
* @return object DataStore Server
*/
protected function getServer() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
return $_SESSION[APPCONFIG]->getServer($this->getServerID());
}
@ -380,9 +332,6 @@ abstract class xmlTemplate {
* @return int Server ID
*/
protected function getServerID() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->server_id);
return $this->server_id;
}
@ -392,9 +341,6 @@ abstract class xmlTemplate {
* @return boolean
*/
public function isType($type) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs,$this->type);
if ($this->type == $type)
return true;
else
@ -405,9 +351,6 @@ abstract class xmlTemplate {
* Return the template 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;
}
@ -415,9 +358,6 @@ abstract class xmlTemplate {
* Get template title
*/
public function getTitle() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! isset($this->title) && ! isset($this->description))
return '';
@ -430,9 +370,6 @@ abstract class xmlTemplate {
* @return int Attribute ID
*/
public function addAttribute($name,$value,$source=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! is_array($value))
debug_dump_backtrace('Value should be an array()',1);
@ -463,9 +400,6 @@ abstract class xmlTemplate {
* @return array Array of attributes Names
*/
public function getAttributeNames() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$result = array();
foreach ($this->attributes as $attribute)
@ -481,9 +415,6 @@ abstract class xmlTemplate {
* @return object Attribute
*/
public function getAttribute($name) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
foreach ($this->attributes as $attribute)
if (($attribute->getName(true, true) == strtolower($name)) || in_array(strtolower($name),$attribute->getAliases()))
return $attribute;

View File

@ -148,7 +148,9 @@ $tabindex = 1;
$modules = array_keys($options);
$_SESSION['conf_types'] = array();
for ($i = 0; $i < sizeof($modules); $i++) {
if (sizeof($options[$modules[$i]]) < 1) continue;
if (empty($options[$modules[$i]])) {
continue;
}
$module = moduleCache::getModule($modules[$i], 'none');
$iconImage = $module->getIcon();
if ($iconImage != null) {

View File

@ -0,0 +1,189 @@
<?php
/*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2018 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
*/
define('LIBDIR','lam/templates/3rdParty/pla/lib/');
include 'lam/templates/3rdParty/pla/lib/functions.php';
/**
* LAMConfig test case.
*
* @author Roland Gruber
*/
class PlaFunctionsTest extends PHPUnit_Framework_TestCase {
public function test_masort() {
$data = array(
'a' => array('key1' => '1'),
'b' => array('key1' => '5', 'key2' => 3),
'c' => array('key1' => '2'),
'd' => array('key1' => '3'),
);
masort($data, 'key1', 0);
$dataWanted = array(
'a' => array('key1' => '1'),
'c' => array('key1' => '2'),
'd' => array('key1' => '3'),
'b' => array('key1' => '5', 'key2' => 3),
);
$this->compareArray($dataWanted, $data);
}
public function test_masortRev() {
$data = array(
'a' => array('key1' => '1'),
'b' => array('key1' => '5', 'key2' => 3),
'c' => array('key1' => '2'),
'd' => array('key1' => '3'),
);
masort($data, 'key1', true);
$dataWanted = array(
'b' => array('key1' => '5', 'key2' => 3),
'd' => array('key1' => '3'),
'c' => array('key1' => '2'),
'a' => array('key1' => '1'),
);
$this->compareArray($dataWanted, $data);
}
public function test_masortPartialData() {
$data = array(
'a' => array('key1' => '1'),
'b' => array('key1' => '5', 'key2' => 3),
'c' => array('key1' => '2'),
'd' => array('key1' => '3'),
);
masort($data, 'key2', 0);
$dataWanted = array(
'b' => array('key1' => '5', 'key2' => 3),
'a' => array('key1' => '1'),
'c' => array('key1' => '2'),
'd' => array('key1' => '3'),
);
$this->compareArray($dataWanted, $data);
}
public function test_masortMultiSort() {
$data = array(
'a' => array('key1' => '1', 'key2' => 4),
'b' => array('key1' => '5', 'key2' => 3),
'c' => array('key1' => '1', 'key2' => 1),
'd' => array('key1' => '5', 'key2' => 2),
'e' => array('key1' => '6', 'key2' => 2),
);
masort($data, 'key1,key2', 0);
$dataWanted = array(
'c' => array('key1' => '1', 'key2' => 1),
'a' => array('key1' => '1', 'key2' => 4),
'd' => array('key1' => '5', 'key2' => 2),
'b' => array('key1' => '5', 'key2' => 3),
'e' => array('key1' => '6', 'key2' => 2),
);
$this->compareArray($dataWanted, $data);
}
public function test_masortObject() {
$data = array(
'a' => (object) ['key1' => '1'],
'b' => (object) ['key1' => '5', 'key2' => 3],
'c' => (object) ['key1' => '2'],
'd' => (object) ['key1' => '3'],
);
masort($data, 'key1', 0);
$dataWanted = array(
'a' => (object) ['key1' => '1'],
'c' => (object) ['key1' => '2'],
'd' => (object) ['key1' => '3'],
'b' => (object) ['key1' => '5', 'key2' => 3],
);
$this->compareArray($dataWanted, $data);
}
public function test_masortObjectMultiSort() {
$data = array(
'a' => (object) ['key1' => '1'],
'b' => (object) ['key1' => '5', 'key2' => 3],
'c' => (object) ['key1' => '2'],
'd' => (object) ['key1' => '5', 'key2' => 1],
);
masort($data, 'key1,key2', 0);
$dataWanted = array(
'a' => (object) ['key1' => '1'],
'c' => (object) ['key1' => '2'],
'd' => (object) ['key1' => '5', 'key2' => 1],
'b' => (object) ['key1' => '5', 'key2' => 3],
);
$this->compareArray($dataWanted, $data);
}
private function compareArray($dataWanted, $dataNew) {
$this->assertEquals(sizeof($dataWanted), sizeof($dataNew));
$keysWanted = array_keys($dataWanted);
$keysNew = array_keys($dataNew);
foreach ($keysWanted as $index => $key) {
$this->assertEquals($keysWanted[$index], $keysNew[$index]);
if (is_array($dataWanted[$key])) {
$this->compareArray($dataWanted[$key], $dataNew[$keysNew[$index]]);
}
elseif (is_object($dataWanted[$key])) {
$this->compareObject($dataWanted[$key], $dataNew[$keysNew[$index]]);
}
else {
$this->assertEquals($dataWanted[$key], $dataNew[$keysNew[$index]]);
}
}
}
private function compareObject($dataWanted, $dataNew) {
$membersWanted = get_object_vars($dataWanted);
$membersNew = get_object_vars($dataNew);
$this->assertEquals(sizeof($membersWanted), sizeof($membersNew));
foreach ($membersWanted as $name => $value) {
if (is_array($dataWanted->$name)) {
$this->compareArray($dataWanted->$name, $dataNew->$name);
}
else {
$this->assertEquals($dataWanted->$name, $dataNew->$name);
}
}
}
}
?>

View File

@ -1,9 +1,8 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2016 Roland Gruber
Copyright (C) 2016 - 2018 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
@ -45,6 +44,7 @@ if (is_readable('lam/lib/modules/ppolicyUser.inc')) {
const ONE_YEAR_POLICY = 'cn=policy1,dc=test';
private $options = array();
private $resultLog = null;
public function setUp() {
$this->job = $this->getMockBuilder('PPolicyPasswordNotifyJob')
@ -60,6 +60,8 @@ if (is_readable('lam/lib/modules/ppolicyUser.inc')) {
));
$this->options['test_mailNotificationPeriod' . PPolicyUserPasswordNotifyJobTest::JOB_ID][0] = PPolicyUserPasswordNotifyJobTest::WARNING;
$this->options['test_mailDefaultPolicy' . PPolicyUserPasswordNotifyJobTest::JOB_ID][0] = PPolicyUserPasswordNotifyJobTest::DEFAULT_POLICY;
$this->resultLog = new \LAM\JOB\JobResultLog();
$this->assertFalse($this->resultLog->hasError());
}
public function testNoAccounts() {
@ -69,7 +71,8 @@ if (is_readable('lam/lib/modules/ppolicyUser.inc')) {
$this->job->expects($this->never())->method('sendMail');
$pdo = array();
$this->job->execute(PPolicyUserPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false);
$this->job->execute(PPolicyUserPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false, $this->resultLog);
$this->assertFalse($this->resultLog->hasError());
}
public function testAccountDoesNotExpire() {
@ -83,7 +86,8 @@ if (is_readable('lam/lib/modules/ppolicyUser.inc')) {
$this->job->expects($this->never())->method('sendMail');
$pdo = array();
$this->job->execute(PPolicyUserPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false);
$this->job->execute(PPolicyUserPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false, $this->resultLog);
$this->assertFalse($this->resultLog->hasError());
}
public function testAccountLocked() {
@ -98,7 +102,8 @@ if (is_readable('lam/lib/modules/ppolicyUser.inc')) {
$this->job->expects($this->never())->method('sendMail');
$pdo = array();
$this->job->execute(PPolicyUserPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false);
$this->job->execute(PPolicyUserPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false, $this->resultLog);
$this->assertFalse($this->resultLog->hasError());
}
public function testAccountExpired() {
@ -112,7 +117,8 @@ if (is_readable('lam/lib/modules/ppolicyUser.inc')) {
$this->job->expects($this->never())->method('sendMail');
$pdo = array();
$this->job->execute(PPolicyUserPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false);
$this->job->execute(PPolicyUserPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false, $this->resultLog);
$this->assertFalse($this->resultLog->hasError());
}
public function testWarningNotReached() {
@ -130,7 +136,8 @@ if (is_readable('lam/lib/modules/ppolicyUser.inc')) {
$this->job->expects($this->never())->method('sendMail');
$pdo = array();
$this->job->execute(PPolicyUserPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false);
$this->job->execute(PPolicyUserPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false, $this->resultLog);
$this->assertFalse($this->resultLog->hasError());
}
public function testAlreadyWarned() {
@ -149,7 +156,8 @@ if (is_readable('lam/lib/modules/ppolicyUser.inc')) {
$this->job->expects($this->never())->method('sendMail');
$pdo = array();
$this->job->execute(PPolicyUserPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false);
$this->job->execute(PPolicyUserPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false, $this->resultLog);
$this->assertFalse($this->resultLog->hasError());
}
public function testWarning() {
@ -168,7 +176,8 @@ if (is_readable('lam/lib/modules/ppolicyUser.inc')) {
$this->job->expects($this->once())->method('sendMail');
$pdo = array();
$this->job->execute(PPolicyUserPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false);
$this->job->execute(PPolicyUserPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false, $this->resultLog);
$this->assertFalse($this->resultLog->hasError());
}
public function testWarningDryRun() {
@ -187,7 +196,8 @@ if (is_readable('lam/lib/modules/ppolicyUser.inc')) {
$this->job->expects($this->never())->method('sendMail');
$pdo = array();
$this->job->execute(PPolicyUserPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, true);
$this->job->execute(PPolicyUserPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, true, $this->resultLog);
$this->assertFalse($this->resultLog->hasError());
}
public function testGetWarningTimeInSeconds() {

View File

@ -1,9 +1,8 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2016 - 2017 Roland Gruber
Copyright (C) 2016 - 2018 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
@ -131,6 +130,7 @@ if (is_readable('lam/lib/passwordExpirationJob.inc')) {
const WARNING = '14';
private $options = array();
private $resultLog = null;
public function setUp() {
$this->job = $this->getMockBuilder('ShadowAccountPasswordNotifyJob')
@ -139,6 +139,7 @@ if (is_readable('lam/lib/passwordExpirationJob.inc')) {
$this->job->method('getConfigPrefix')->willReturn('test');
$this->job->method('sendMail')->willReturn(true);
$this->options['test_mailNotificationPeriod' . ShadowAccountPasswordNotifyJobTest::JOB_ID][0] = ShadowAccountPasswordNotifyJobTest::WARNING;
$this->resultLog = new \LAM\JOB\JobResultLog();
}
public function testNoAccounts() {
@ -148,7 +149,8 @@ if (is_readable('lam/lib/passwordExpirationJob.inc')) {
$this->job->expects($this->never())->method('sendMail');
$pdo = array();
$this->job->execute(ShadowAccountPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false);
$this->job->execute(ShadowAccountPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false, $this->resultLog);
$this->assertFalse($this->resultLog->hasError());
}
public function testAccountDoesNotExpire() {
@ -162,7 +164,8 @@ if (is_readable('lam/lib/passwordExpirationJob.inc')) {
$this->job->expects($this->never())->method('sendMail');
$pdo = array();
$this->job->execute(ShadowAccountPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false);
$this->job->execute(ShadowAccountPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false, $this->resultLog);
$this->assertFalse($this->resultLog->hasError());
}
public function testAccountExpired() {
@ -176,7 +179,8 @@ if (is_readable('lam/lib/passwordExpirationJob.inc')) {
$this->job->expects($this->never())->method('sendMail');
$pdo = array();
$this->job->execute(ShadowAccountPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false);
$this->job->execute(ShadowAccountPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false, $this->resultLog);
$this->assertFalse($this->resultLog->hasError());
}
public function testWarningNotReached() {
@ -193,7 +197,8 @@ if (is_readable('lam/lib/passwordExpirationJob.inc')) {
$this->job->expects($this->never())->method('sendMail');
$pdo = array();
$this->job->execute(ShadowAccountPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false);
$this->job->execute(ShadowAccountPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false, $this->resultLog);
$this->assertFalse($this->resultLog->hasError());
}
public function testAlreadyWarned() {
@ -211,7 +216,8 @@ if (is_readable('lam/lib/passwordExpirationJob.inc')) {
$this->job->expects($this->never())->method('sendMail');
$pdo = array();
$this->job->execute(ShadowAccountPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false);
$this->job->execute(ShadowAccountPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false, $this->resultLog);
$this->assertFalse($this->resultLog->hasError());
}
public function testWarning() {
@ -229,7 +235,8 @@ if (is_readable('lam/lib/passwordExpirationJob.inc')) {
$this->job->expects($this->once())->method('sendMail');
$pdo = array();
$this->job->execute(ShadowAccountPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false);
$this->job->execute(ShadowAccountPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, false, $this->resultLog);
$this->assertFalse($this->resultLog->hasError());
}
public function testWarningDryRun() {
@ -247,7 +254,8 @@ if (is_readable('lam/lib/passwordExpirationJob.inc')) {
$this->job->expects($this->never())->method('sendMail');
$pdo = array();
$this->job->execute(ShadowAccountPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, true);
$this->job->execute(ShadowAccountPasswordNotifyJobTest::JOB_ID, $this->options, $pdo, true, $this->resultLog);
$this->assertFalse($this->resultLog->hasError());
}
}