This commit is contained in:
Roland Gruber 2018-04-25 19:53:03 +02:00
parent 2a02a26c16
commit ae296aa3b9
26 changed files with 22 additions and 2113 deletions

View File

@ -30,9 +30,6 @@ elseif (file_exists('welcome.php'))
else else
$app['script_cmd'] = null; $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. # Create page.
# Set the index so that we render the right server tree. # Set the index so that we render the right server tree.
$www['page'] = new page($app['server']->getIndex()); $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) { 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(); $copy_message = array();
$children = isset($snapshottree[$dnSRC]) ? $snapshottree[$dnSRC] : null; $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) { 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 = array();
$request['pageSRC'] = new PageRender($serverSRC->getIndex(),get_request('template','REQUEST',false,'none')); $request['pageSRC'] = new PageRender($serverSRC->getIndex(),get_request('template','REQUEST',false,'none'));
$request['pageSRC']->setDN($dnSRC); $request['pageSRC']->setDN($dnSRC);
@ -186,9 +180,6 @@ function copy_dn($serverSRC,$serverDST,$dnSRC,$dnDST,$remove) {
} }
function build_tree($server,$dn,$buildtree) { 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 # We search all children, not only the visible children in the tree
$children = $server->getContainerContents($dn,null,0); $children = $server->getContainerContents($dn,null,0);
@ -198,9 +189,6 @@ function build_tree($server,$dn,$buildtree) {
$buildtree = build_tree($server,$child_dn,$buildtree); $buildtree = build_tree($server,$child_dn,$buildtree);
} }
if (DEBUG_ENABLED)
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$buildtree);
return $buildtree; return $buildtree;
} }
?> ?>

View File

@ -43,9 +43,6 @@ if (isset($app['server']) && ! is_null($request['container'])) {
sort($request['children']); sort($request['children']);
foreach ($app['server']->getBaseDN() as $base) { 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)) { if (! pla_compare_dns($request['container'],$base)) {
$parent_container = false; $parent_container = false;
$href['up'] = sprintf('entry_chooser.php?form=%s&element=%s&rdn=%s',$request['form'],$request['element'],rawurlencode($request['rdn'])); $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 * @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) { 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(); $server = $this->getServer();
# Level pre-treatment # 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. * 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) { 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(); $children = array();
foreach ($parent_entry->getChildren() as $child) { 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 " | |" * @param $code a string of 0 and 1 ; $code == "000101" will return " | |"
*/ */
protected function get_indentation($code) { protected function get_indentation($code) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$indent = ''; $indent = '';
for ($i=0; $i<strlen($code); $i++) { for ($i=0; $i<strlen($code); $i++) {
@ -208,9 +199,6 @@ class AJAXTree extends HTMLTree {
* Draw the javascript to support the tree. * Draw the javascript to support the tree.
*/ */
protected function draw_javascript() { 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(); parent::draw_javascript();
printf('<script type="text/javascript" src="%slayersmenu-browser_detection.js"></script>',JSDIR); printf('<script type="text/javascript" src="%slayersmenu-browser_detection.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%sajax_tree.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. * Draw the "Create New Entry" item before the children.
*/ */
private function create_before_child($entry,$level) { 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) if (strlen($level) == 0)
return ''; return '';
@ -240,9 +225,6 @@ class AJAXTree extends HTMLTree {
* Draw the "Create New Entry" item after the children. * Draw the "Create New Entry" item after the children.
*/ */
private function create_after_child($entry,$level) { 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) if (strlen($level) == 0)
return ''; return '';
@ -259,9 +241,6 @@ class AJAXTree extends HTMLTree {
* Draw the "Create New Entry" item. * Draw the "Create New Entry" item.
*/ */
private function draw_create_new_entry($entry,$level,$img) { 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 = ''; $output = '';
$href = sprintf('cmd=template_engine&server_id=%s&container=%s',$this->getServerID(),$entry->getDNEncode()); $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 * @return array List of open nodes
*/ */
public function listOpenItems() { public function listOpenItems() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$result = array(); $result = array();
foreach ($this->entries as $dn => $value) foreach ($this->entries as $dn => $value)

View File

@ -79,9 +79,6 @@ class Attribute {
protected $postvalue = array(); protected $postvalue = array();
public function __construct($name,$values,$server_id,$source=null) { 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); $server = $_SESSION[APPCONFIG]->getServer($server_id);
$sattr = $server->getSchemaAttribute($name); $sattr = $server->getSchemaAttribute($name);
@ -129,9 +126,6 @@ class Attribute {
* @return string Attribute name * @return string Attribute name
*/ */
public function getName($lower=true,$real=false) { 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) if ($real)
return $lower ? strtolower($this->name) : $this->name; return $lower ? strtolower($this->name) : $this->name;
else else
@ -139,30 +133,18 @@ class Attribute {
} }
public function getValues() { 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; return $this->values;
} }
public function getOldValues() { 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; return $this->oldvalues;
} }
public function getValueCount() { 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); return count($this->values);
} }
public function getSource() { 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; 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. * Autovalue is called after the attribute is initialised, and thus the values from the ldap server will be set.
*/ */
public function autoValue($new_val) { 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) if ($this->values)
return; return;
@ -180,9 +159,6 @@ class Attribute {
} }
public function initValue($new_val) { public function initValue($new_val) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($this->values || $this->oldvalues) { if ($this->values || $this->oldvalues) {
debug_dump(array('new_val'=>$new_val,'this'=>$this)); debug_dump(array('new_val'=>$new_val,'this'=>$this));
debug_dump_backtrace('new and/or old values are set',1); debug_dump_backtrace('new and/or old values are set',1);
@ -192,23 +168,14 @@ class Attribute {
} }
public function clearValue() { public function clearValue() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->values = array(); $this->values = array();
} }
public function setOldValue($val) { 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; $this->oldvalues = $val;
} }
public function setValue($new_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) {
if ($this->values == $new_val) if ($this->values == $new_val)
return; return;
@ -228,9 +195,6 @@ class Attribute {
} }
public function addValue($new_val,$i=-1) { 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) if ($i < 0)
$i = $this->getValueCount(); $i = $this->getValueCount();
@ -242,9 +206,6 @@ class Attribute {
} }
public function delValue($i=-1) { 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) if ($i < 0)
$this->setValue(array()); $this->setValue(array());
@ -259,9 +220,6 @@ class Attribute {
} }
public function getValue($i) { 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])) if (isset($this->values[$i]))
return $this->values[$i]; return $this->values[$i];
else else
@ -269,9 +227,6 @@ class Attribute {
} }
public function getOldValue($i) { 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])) if (isset($this->oldvalues[$i]))
return $this->oldvalues[$i]; return $this->oldvalues[$i];
else else
@ -279,37 +234,22 @@ class Attribute {
} }
public function getMinValueCount() { 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; return $this->min_value_count;
} }
public function setMinValueCount($min) { 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; $this->min_value_count = $min;
} }
public function getMaxValueCount() { 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; return $this->max_value_count;
} }
public function setMaxValueCount($max) { 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; $this->max_value_count = $max;
} }
public function haveMoreValues() { 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())) if ($this->getMaxValueCount() < 0 || ($this->getValueCount() < $this->getMaxValueCount()))
return true; return true;
else else
@ -317,30 +257,18 @@ class Attribute {
} }
public function justModified() { public function justModified() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->modified = true; $this->modified = true;
} }
public function hasBeenModified() { 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; return $this->modified;
} }
public function isForceDelete() { 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; return $this->forcedelete;
} }
public function setForceDelete() { 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->forcedelete = true;
$this->oldvalues = $this->values; $this->oldvalues = $this->values;
$this->values = array(); $this->values = array();
@ -348,23 +276,14 @@ class Attribute {
} }
public function isInternal() { 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; return $this->internal;
} }
public function setInternal() { public function setInternal() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->internal = true; $this->internal = true;
} }
public function isRequired() { 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) if ($this->getMinValueCount() > 0)
return true; return true;
elseif ($this->ldaptype == 'must') elseif ($this->ldaptype == 'must')
@ -376,9 +295,6 @@ class Attribute {
} }
public function isMay() { 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()) if (($this->ldaptype == 'may') && ! $this->isRequired())
return true; return true;
else else
@ -386,37 +302,22 @@ class Attribute {
} }
public function setType($type) { 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); $this->type = strtolower($type);
} }
public function getType() { 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; return $this->type;
} }
public function setLDAPtype($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); $this->ldaptype = strtolower($type);
} }
public function getLDAPtype() { 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; return $this->ldaptype;
} }
public function setProperties($properties) { 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) { foreach ($properties as $index => $value) {
if ($index == 'maxvalnb') { if ($index == 'maxvalnb') {
$this->setMaxValueCount($value); $this->setMaxValueCount($value);
@ -449,31 +350,19 @@ class Attribute {
} }
public function setRequired() { 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) if ($this->getMinValueCount() <= 0)
$this->setMinValueCount(1); $this->setMinValueCount(1);
} }
public function setOptional() { public function setOptional() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->setMinValueCount(0); $this->setMinValueCount(0);
} }
public function isReadOnly() { 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; return $this->readonly;
} }
public function setReadOnly() { public function setReadOnly() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->readonly = true; $this->readonly = true;
} }
@ -482,37 +371,22 @@ class Attribute {
} }
public function isVisible() { 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); return $this->visible && (! $this->forcehide);
} }
public function hide() { public function hide() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->visible = false; $this->visible = false;
} }
public function show() { public function show() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->visible = true; $this->visible = true;
} }
public function haveFriendlyName() { 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); return $_SESSION[APPCONFIG]->haveFriendlyName($this);
} }
public function getFriendlyName() { 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) if ($this->display)
return $this->display; return $this->display;
else else
@ -520,127 +394,73 @@ class Attribute {
} }
public function setDescription($description) { 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; $this->description = $description;
} }
public function getDescription() { 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; return $this->description;
} }
public function setIcon($icon) { 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; $this->icon = $icon;
} }
public function getIcon() { 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) : ''; return $this->icon ? sprintf('%s/%s',IMGDIR,$this->icon) : '';
} }
public function getHint() { 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; return $this->hint;
} }
public function setHint($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; $this->hint = $hint;
} }
public function getMaxLength() { 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; return $this->maxlength;
} }
public function setMaxLength($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; $this->maxlength = $maxlength;
} }
public function getSize() { 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; return $this->size;
} }
public function setSize($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; $this->size = $size;
} }
public function getSpacer() { 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; return $this->spacer;
} }
public function getPage() { 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; return $this->page;
} }
public function setPage($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; $this->page = $page;
} }
public function getOnChange() { 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; return $this->onchange;
} }
public function getHelper() { 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; return $this->helper;
} }
public function getHelperValue() { 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; return $this->helpervalue;
} }
public function getVerify() { 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; return $this->verify;
} }
public function setRDN($rdn) { 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; $this->rdn = $rdn;
} }
@ -650,9 +470,6 @@ class Attribute {
* @return boolean * @return boolean
*/ */
public function isRDN() { 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; return $this->rdn;
} }
@ -662,9 +479,6 @@ class Attribute {
* @param sattr Schema Attribute * @param sattr Schema Attribute
*/ */
private function setLDAPdetails($sattr) { 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. # By default, set this as a MAY attribute, later processing should make it a MUST attribute if it is.
if (! $this->ldaptype) if (! $this->ldaptype)
$this->ldaptype = 'may'; $this->ldaptype = 'may';
@ -682,37 +496,22 @@ class Attribute {
* This list will be lowercase. * This list will be lowercase.
*/ */
public function getAliases() { 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; return $this->aliases;
} }
public function getAutoValue() { 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; return $this->autovalue;
} }
public function getPostValue() { 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; return $this->postvalue;
} }
public function setPostValue($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; $this->postvalue = $postvalue;
} }
public function setXML($values) { 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 # Mostly all the time, this should be an array
if (is_array($values)) if (is_array($values))
foreach ($values as $index => $value) foreach ($values as $index => $value)
@ -848,9 +647,6 @@ class Attribute {
* Display the values removed in an attribute. * Display the values removed in an attribute.
*/ */
public function getRemovedValues() { 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()); return array_diff($this->getOldValues(),$this->getValues());
} }
@ -858,9 +654,6 @@ class Attribute {
* Display the values removed in an attribute. * Display the values removed in an attribute.
*/ */
public function getAddedValues() { 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()); return array_diff($this->getValues(),$this->getOldValues());
} }
@ -874,9 +667,6 @@ class Attribute {
* @return string * @return string
*/ */
private function real_attr_name() { 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); return preg_replace('/;.*$/U','',$this->name);
} }
@ -884,9 +674,6 @@ class Attribute {
* Does this attribute need supporting JS * Does this attribute need supporting JS
*/ */
public function needJS($type=null) { 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)) { if (is_null($type)) {
foreach (array('focus','blur','validate') as $type) foreach (array('focus','blur','validate') as $type)
if ($this->needJS($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 * @param boolean Only display the tree, or include the server name and menu items
*/ */
public function draw($onlytree=false) { 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; static $js_drawn = false;
$server = $this->getServer(); $server = $this->getServer();
@ -157,9 +154,6 @@ class HTMLTree extends Tree {
*/ */
protected function draw_server_name() { protected function draw_server_name() {
return; return;
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer(); $server = $this->getServer();
echo '<tr class="server">'; echo '<tr class="server">';
@ -179,9 +173,6 @@ class HTMLTree extends Tree {
* Draw the tree menu options * Draw the tree menu options
*/ */
protected function draw_menu() { protected function draw_menu() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$links = ''; $links = '';
if (is_array($_SESSION[APPCONFIG]->getValue('menu','session'))) if (is_array($_SESSION[APPCONFIG]->getValue('menu','session')))
@ -205,9 +196,6 @@ class HTMLTree extends Tree {
* Get the HTML for each tree menu option * Get the HTML for each tree menu option
*/ */
protected function get_menu_item($item) { 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(); $server = $this->getServer();
$menu = array(); $menu = array();
@ -323,9 +311,6 @@ class HTMLTree extends Tree {
} }
protected function get_logout_menu_item() { 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(); $server = $this->getServer();
$href = sprintf('cmd.php?cmd=logout&server_id=%s',$server->getIndex()); $href = sprintf('cmd.php?cmd=logout&server_id=%s',$server->getIndex());
@ -340,9 +325,6 @@ class HTMLTree extends Tree {
* Draw the Logged in User * Draw the Logged in User
*/ */
protected function draw_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(); $server = $this->getServer();
$logged_in_dn = $server->getLogin(null); $logged_in_dn = $server->getLogin(null);
@ -399,9 +381,6 @@ class HTMLTree extends Tree {
* @param int $level Level to start drawing (start to -1) * @param int $level Level to start drawing (start to -1)
*/ */
protected function draw_item($item,$level) { 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(); $server = $this->getServer();
# Get entry to display as node # Get entry to display as node
@ -470,15 +449,9 @@ class HTMLTree extends Tree {
$this->draw_create_link($rdn,$level,$dnENCODE); $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) { 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) if ($level < 0)
return pretty_print_dn($entry->getDN()); return pretty_print_dn($entry->getDN());
else else
@ -493,9 +466,6 @@ class HTMLTree extends Tree {
* @param dn $encoded_dn * @param dn $encoded_dn
*/ */
protected function draw_create_link($rdn,$level,$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. # print the "Create New object" link.
$href = htmlspecialchars(sprintf('cmd.php?cmd=template_engine&server_id=%s&container=%s',$this->getServerID(),$encoded_dn)); $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 * Draw login link
*/ */
protected function 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(); $server = $this->getServer();
$href_parm = htmlspecialchars(sprintf('cmd=%s&server_id=%s',get_custom_file($server->getIndex(),'login_form',''),$server->getIndex())); $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 * If there is javascript, draw it
*/ */
protected function draw_javascript() { 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) { if ($this->javascript) {
echo "<!-- Forms for javascript submit to call to create base_dns -->\n"; echo "<!-- Forms for javascript submit to call to create base_dns -->\n";
echo $this->javascript; echo $this->javascript;
@ -555,9 +519,6 @@ class HTMLTree extends Tree {
* Work out how deep the "opened" tree is. * Work out how deep the "opened" tree is.
*/ */
public function getDepth() { public function getDepth() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer(); $server = $this->getServer();
# If we are not logged in # If we are not logged in

View File

@ -14,8 +14,6 @@
*/ */
class MassRender extends TemplateRender { class MassRender extends TemplateRender {
protected function drawMassFormReadWriteValueAttribute($attribute,$i,$j) { protected function drawMassFormReadWriteValueAttribute($attribute,$i,$j) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$val = $attribute->getValue($i); $val = $attribute->getValue($i);
if ($attribute->getHelper()) if ($attribute->getHelper())

View File

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

View File

@ -22,30 +22,16 @@ class Query extends xmlTemplate {
* @param xmldata Parsed xmldata from xml2array object * @param xmldata Parsed xmldata from xml2array object
*/ */
protected function storeTemplate($xmldata) { 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(); $server = $this->getServer();
foreach ($xmldata['query'] as $xml_key => $xml_value) { 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) { switch ($xml_key) {
# Build our attribute list from the DN and Template. # Build our attribute list from the DN and Template.
case ('attributes'): case ('attributes'):
if (DEBUG_ENABLED)
debug_log('Case [%s]',4,0,__FILE__,__LINE__,__METHOD__,$xml_key);
if (is_array($xmldata['query'][$xml_key])) { if (is_array($xmldata['query'][$xml_key])) {
foreach ($xmldata['query'][$xml_key] as $tattrs) { foreach ($xmldata['query'][$xml_key] as $tattrs) {
foreach ($tattrs as $index => $details) { 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 there is no schema definition for the attribute, it will be ignored.
if ($sattr = $server->getSchemaAttribute($index)) { if ($sattr = $server->getSchemaAttribute($index)) {
if (is_null($attribute = $this->getAttribute($sattr->getName()))) if (is_null($attribute = $this->getAttribute($sattr->getName())))
@ -75,9 +61,6 @@ class Query extends xmlTemplate {
break; break;
default: 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: # Some key definitions need to be an array, some must not be:
$allowed_arrays = array(''); $allowed_arrays = array('');
$storelower = array(''); $storelower = array('');
@ -121,9 +104,6 @@ class Query extends xmlTemplate {
* Accept will run the query and store the results in results() * Accept will run the query and store the results in results()
*/ */
public function accept() { public function accept() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer(); $server = $this->getServer();
$query = array(); $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 * This is temporary to get around objects that use a DN for rendering, for example jpegPhoto
*/ */
public function setDN($dn) { public function setDN($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
$this->dn = $dn; $this->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 * This is temporary to get around objects that use a DN for rendering, for example jpegPhoto
*/ */
public function getDN() { 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; return $this->dn;
} }
@ -204,9 +178,6 @@ class Query extends xmlTemplate {
} }
public function getAttrSortOrder() { public function getAttrSortOrder() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$result = array(); $result = array();
if (count($this->attributes)) { if (count($this->attributes)) {
@ -226,9 +197,6 @@ class Query extends xmlTemplate {
} }
public function getAttrDisplayOrder() { public function getAttrDisplayOrder() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$result = array(); $result = array();
if (count($this->attributes)) { if (count($this->attributes)) {
@ -267,16 +235,10 @@ class Query extends xmlTemplate {
* @return boolean * @return boolean
*/ */
public function isVisible() { 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; return $this->visible;
} }
public function getDescription() { 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; return $this->description;
} }
} }

View File

@ -18,13 +18,6 @@ class QueryRender extends PageRender {
* Intialise and Render the QueryRender * Intialise and Render the QueryRender
*/ */
public function accept() { 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->template_id = $this->getTemplateChoice();
$this->page = get_request('page','REQUEST',false,1); $this->page = get_request('page','REQUEST',false,1);
@ -46,9 +39,6 @@ class QueryRender extends PageRender {
* Get our templates applicable for this object * Get our templates applicable for this object
*/ */
protected function getTemplates() { 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); return new Queries($this->server_id);
} }
@ -56,9 +46,6 @@ class QueryRender extends PageRender {
* Are default queries enabled? * Are default queries enabled?
*/ */
protected function haveDefaultTemplate() { protected function haveDefaultTemplate() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer(); $server = $this->getServer();
if ($server->getValue('query','disable_default')) if ($server->getValue('query','disable_default'))
@ -68,8 +55,6 @@ class QueryRender extends PageRender {
} }
protected function drawTemplateChoice() { protected function drawTemplateChoice() {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$server = $this->getServer(); $server = $this->getServer();
$this->drawTitle(_('Search')); $this->drawTitle(_('Search'));
@ -184,18 +169,12 @@ class QueryRender extends PageRender {
} }
private function visitStart() { 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->drawTitle(_('Search Results'));
$this->drawSubTitle(); $this->drawSubTitle();
echo '<br/>'; echo '<br/>';
} }
private function visitEnd() { private function visitEnd() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer(); $server = $this->getServer();
$afattrs = $this->getAFAttrs(); $afattrs = $this->getAFAttrs();
@ -413,9 +392,6 @@ class QueryRender extends PageRender {
} }
private function getAFattrs() { 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(); $attribute_factory = new AttributeFactory();
$results = array(); $results = array();
@ -426,9 +402,6 @@ class QueryRender extends PageRender {
} }
private function getAjaxRef($dn) { 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)); return preg_replace('/=/','.',base64_encode($dn));
} }

View File

@ -38,9 +38,6 @@ class SelectionAttribute extends Attribute {
} }
public function addValue($new_val,$i=-1) { 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); $this->addOption($new_val,$new_val);
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -6,11 +6,6 @@
* @package phpLDAPadmin * @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 * Abstract Visitor class
* *
@ -22,9 +17,6 @@ abstract class Visitor {
protected $server_id; protected $server_id;
public function __call($method,$args) { 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'))) if (! in_array($method,array('get','visit','draw')))
debug_dump_backtrace(sprintf('Incorrect use of method loading [%s]',$method),1); debug_dump_backtrace(sprintf('Incorrect use of method loading [%s]',$method),1);
@ -40,20 +32,11 @@ abstract class Visitor {
array_push($methods,$call); array_push($methods,$call);
while ($class && ! method_exists($this,$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); $class = get_parent_class($class);
$call = "$method$fnct$class"; $call = "$method$fnct$class";
array_push($methods,$call); 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)) { if (method_exists($this,$call)) {
$r = call_user_func_array(array($this, $call), $args); $r = call_user_func_array(array($this, $call), $args);
@ -62,8 +45,6 @@ abstract class Visitor {
else else
return; 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)); printf('<font size=-2><i>NO Methods: %s</i></font><br />',implode('|',$methods));
@ -75,9 +56,6 @@ abstract class Visitor {
* @return int Server ID * @return int Server ID
*/ */
public function getServerID() { 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)) if (isset($this->server_id))
return $this->server_id; return $this->server_id;
else else
@ -90,9 +68,6 @@ abstract class Visitor {
* @return object DataStore Server * @return object DataStore Server
*/ */
protected function getServer() { 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()); 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')) if ($_SESSION[APPCONFIG]->getValue('appearance','timezone'))
date_default_timezone_set($_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. # Set our PHP timelimit.
if ($_SESSION[APPCONFIG]->getValue('session','timelimit') && ! @ini_get('safe_mode')) if ($_SESSION[APPCONFIG]->getValue('session','timelimit') && ! @ini_get('safe_mode'))
set_time_limit($_SESSION[APPCONFIG]->getValue('session','timelimit')); set_time_limit($_SESSION[APPCONFIG]->getValue('session','timelimit'));
# If debug mode is set, increase the time_limit, since we probably need it.
if (DEBUG_ENABLED && $_SESSION[APPCONFIG]->getValue('session','timelimit') && ! @ini_get('safe_mode'))
set_time_limit($_SESSION[APPCONFIG]->getValue('session','timelimit') * 5);
setlanguage(); setlanguage();
/** /**

View File

@ -630,9 +630,6 @@ class Config {
* Function to check and warn about any unusual defined variables. * Function to check and warn about any unusual defined variables.
*/ */
public function CheckCustom() { 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)) { if (isset($this->custom)) {
foreach ($this->custom as $masterkey => $masterdetails) { foreach ($this->custom as $masterkey => $masterdetails) {
@ -665,9 +662,6 @@ class Config {
* Get a list of available commands. * Get a list of available commands.
*/ */
public function getCommandList() { 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); $config = $this->getConfigArray(false);
masort($config['command'],'summary'); masort($config['command'],'summary');
@ -682,9 +676,6 @@ class Config {
* Simple ACL to see if commands can be run * Simple ACL to see if commands can be run
*/ */
public function isCommandAvailable($index='cmd') { 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(); $a = func_get_args();
array_shift($a); array_shift($a);
$a = $a[0]; $a = $a[0];
@ -699,9 +690,6 @@ class Config {
} }
public function configDefinition($key,$index,$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)) if (! is_array($config) || ! array_key_exists('desc',$config) || ! array_key_exists('default',$config))
return; return;
@ -716,9 +704,6 @@ class Config {
* Return the friendly attributes names * Return the friendly attributes names
*/ */
private function getFriendlyAttrs() { 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')); return array_change_key_case($this->getValue('appearance','friendly_attrs'));
} }
@ -730,9 +715,6 @@ class Config {
* @return string friendly name|attribute * @return string friendly name|attribute
*/ */
public function getFriendlyName($attr) { 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; static $friendly_attrs;
if (! $friendly_attrs) if (! $friendly_attrs)
@ -758,9 +740,6 @@ class Config {
* @return boolean true|false * @return boolean true|false
*/ */
public function haveFriendlyName($attr) { 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); return $attr->getName(false) != $this->getFriendlyName($attr);
} }
@ -771,8 +750,6 @@ class Config {
* @return string html for the friendly name. * @return string html for the friendly name.
*/ */
public function getFriendlyHTML($attr) { 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);
} }
@ -789,9 +766,6 @@ class Config {
* @param boolean $visible - Only return visible servers * @param boolean $visible - Only return visible servers
*/ */
public function getServerList($visible=true) { 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); return $this->servers->getServerList($visible);
} }
} }

View File

@ -68,9 +68,6 @@ abstract class DS {
* Return a configuration value * Return a configuration value
*/ */
public function getValue($key,$setting,$fatal=true) { 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])) if (isset($this->custom->{$key}[$setting]))
return $this->custom->{$key}[$setting]; return $this->custom->{$key}[$setting];
@ -116,9 +113,6 @@ abstract class DS {
* Get the name of this datastore * Get the name of this datastore
*/ */
public function getName() { 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'); return $this->getValue('server','name');
} }
@ -129,9 +123,6 @@ abstract class DS {
* Return the authentication type for this object * Return the authentication type for this object
*/ */
public function getAuthType() { 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')) { switch ($this->getValue('login','auth_type')) {
case 'cookie': case 'cookie':
case 'config': case 'config':
@ -153,9 +144,6 @@ abstract class DS {
* If this returns '', we are logged in with anonymous * If this returns '', we are logged in with anonymous
*/ */
public function getLogin($method=null) { 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); $method = $this->getMethod($method);
# For anonymous binds # For anonymous binds
@ -203,9 +191,6 @@ abstract class DS {
* Set the login details of the user logged into this datastore's connection method * Set the login details of the user logged into this datastore's connection method
*/ */
protected function setLogin($user,$pass,$method=null) { 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); $method = $this->getMethod($method);
switch ($this->getAuthType()) { switch ($this->getAuthType()) {
@ -238,9 +223,6 @@ abstract class DS {
* Get the login password of the user logged into this datastore's connection method * Get the login password of the user logged into this datastore's connection method
*/ */
protected function getPassword($method=null) { 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); $method = $this->getMethod($method);
# For anonymous binds # For anonymous binds
@ -283,9 +265,6 @@ abstract class DS {
* Return if this datastore's connection method has been logged into * Return if this datastore's connection method has been logged into
*/ */
public function isLoggedIn($method=null) { 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(); static $CACHE = array();
$method = $this->getMethod($method); $method = $this->getMethod($method);
@ -387,9 +366,6 @@ abstract class DS {
* Logout of this datastore's connection method * Logout of this datastore's connection method
*/ */
public function logout($method=null) { 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); $method = $this->getMethod($method);
unset ($_SESSION['cache'][$this->index]); unset ($_SESSION['cache'][$this->index]);
@ -420,16 +396,10 @@ abstract class DS {
* Functions that return the condition of the datasource * Functions that return the condition of the datasource
*/ */
public function isVisible() { 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'); return $this->getValue('server','visible');
} }
public function isReadOnly() { 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')) if (! trim($this->getLogin(null)) && $_SESSION[APPCONFIG]->getValue('appearance','anonymous_bind_implies_read_only'))
return true; return true;
else else
@ -437,9 +407,6 @@ abstract class DS {
} }
public function getIndex() { 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; return $this->index;
} }
@ -453,9 +420,6 @@ abstract class DS {
* @return string Connection Method * @return string Connection Method
*/ */
protected function getMethod($method=null) { 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(); static $CACHE = array();
# Immediately return if method is set. # Immediately return if method is set.
@ -478,9 +442,6 @@ abstract class DS {
* This method should be overridden in application specific ds files * This method should be overridden in application specific ds files
*/ */
public function isSessionValid() { public function isSessionValid() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,1,__FILE__,__LINE__,__METHOD__,$fargs,true);
return true; return true;
} }
@ -489,9 +450,6 @@ abstract class DS {
* this function will return null. * this function will return null.
*/ */
public function inactivityTime() { 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'))) if ($this->isLoggedIn() && ! in_array($this->getAuthType(),array('config','http')))
return time()+($this->getValue('login','timeout')*60); return time()+($this->getValue('login','timeout')*60);
else else
@ -638,9 +596,6 @@ class Datastore {
* @return array list of all configured servers. * @return array list of all configured servers.
*/ */
public function getServerList($isVisible=true) { 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; static $CACHE;
if (isset($CACHE[$isVisible])) if (isset($CACHE[$isVisible]))
@ -671,9 +626,6 @@ class Datastore {
* @return object Datastore instance object. * @return object Datastore instance object.
*/ */
public function Instance($index=null) { 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 no index defined, then pick the lowest one.
if (is_null($index) || ! trim($index) || ! is_numeric($index)) if (is_null($index) || ! trim($index) || ! is_numeric($index))
$index = min($this->GetServerList())->getIndex(); $index = min($this->GetServerList())->getIndex();
@ -681,9 +633,6 @@ class Datastore {
if (! isset($this->objects[$index])) if (! isset($this->objects[$index]))
debug_dump_backtrace(sprintf('Error: Datastore instance [%s] doesnt exist?',htmlspecialchars($index)),1); debug_dump_backtrace(sprintf('Error: Datastore instance [%s] doesnt exist?',htmlspecialchars($index)),1);
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
debug_log('Returning instance of database (%s)',3,0,__FILE__,__LINE__,__METHOD__,$index);
return $this->objects[$index]; return $this->objects[$index];
} }
@ -694,9 +643,6 @@ class Datastore {
* @return object Datastore instance object. * @return object Datastore instance object.
*/ */
public function InstanceName($name=null) { 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) foreach ($this->getServerList(false) as $index)
if ($this->objects[$index]->getName() == $name) if ($this->objects[$index]->getName() == $name)
return $this->objects[$index]; return $this->objects[$index];
@ -712,9 +658,6 @@ class Datastore {
* @return object Datastore instance object. * @return object Datastore instance object.
*/ */
public function InstanceId($id=null) { 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) foreach ($this->getServerList(false) as $index)
if ($this->objects[$index->getIndex()]->getValue('server','id') == $id) if ($this->objects[$index->getIndex()]->getValue('server','id') == $id)
return $this->objects[$index->getIndex()]; 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. * @return boolean true if the feature is enabled and false otherwise.
*/ */
function isShowCreateEnabled() { 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')) if (! $_SESSION[APPCONFIG]->isCommandAvailable('script','create'))
return false; return false;
else else
@ -175,18 +172,12 @@ class ldap_pla extends myldap {
* @return boolean * @return boolean
*/ */
public function isAnonBindAllowed() { 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 only_login_allowed_dns is set, then we cant have anonymous.
if (count($this->getValue('login','allowed_dns')) > 0) if (count($this->getValue('login','allowed_dns')) > 0)
$return = false; $return = false;
else else
$return = $this->getValue('login','anon_bind'); $return = $this->getValue('login','anon_bind');
if (DEBUG_ENABLED)
debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -201,9 +192,6 @@ class ldap_pla extends myldap {
* @return boolean * @return boolean
*/ */
function isBranchRenameEnabled() { 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'); return $this->getValue('server','branch_rename');
} }
@ -225,9 +213,6 @@ class ldap_pla extends myldap {
* @return boolean * @return boolean
*/ */
function isMultiLineAttr($attr_name,$val=null) { 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 # Set default return
$return = false; $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; return $return;
} }
@ -302,9 +284,6 @@ class ldap_pla extends myldap {
* @return boolean * @return boolean
*/ */
public function isAttrReadOnly($attr) { 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'); $attrs = $_SESSION[APPCONFIG]->getValue('appearance','readonly_attrs');
$except_dn = $_SESSION[APPCONFIG]->getValue('appearance','readonly_attrs_exempt'); $except_dn = $_SESSION[APPCONFIG]->getValue('appearance','readonly_attrs_exempt');
@ -323,9 +302,6 @@ class ldap_pla extends myldap {
* @return boolean * @return boolean
*/ */
public function isAttrHidden($attr) { 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'); $attrs = $_SESSION[APPCONFIG]->getValue('appearance','hide_attrs');
$except_dn = $_SESSION[APPCONFIG]->getValue('appearance','hide_attrs_exempt'); $except_dn = $_SESSION[APPCONFIG]->getValue('appearance','hide_attrs_exempt');
@ -336,9 +312,6 @@ class ldap_pla extends myldap {
* Add objects * Add objects
*/ */
public function add($dn,$entry_array,$method=null) { 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) foreach ($entry_array as $attr => $val)
$entry_array[$attr] = dn_unescape($val); $entry_array[$attr] = dn_unescape($val);
@ -380,9 +353,6 @@ class ldap_pla extends myldap {
* Delete objects * Delete objects
*/ */
public function delete($dn,$method=null) { 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; $result = false;
if (run_hook('pre_entry_delete',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn))) { 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 * Rename objects
*/ */
public function rename($dn,$new_rdn,$container,$deleteoldrdn,$method=null) { 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; $result = false;
if (run_hook('pre_entry_rename',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'rdn'=>$new_rdn,'container'=>$container))) { 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 * Modify objects
*/ */
public function modify($dn,$attrs,$method=null) { 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. # Check our unique attributes.
if (! $this->checkUniqueAttrs($dn,$attrs)) if (! $this->checkUniqueAttrs($dn,$attrs))
return false; return false;
@ -546,9 +510,6 @@ class ldap_pla extends myldap {
* @return boolean * @return boolean
*/ */
public function isAttrUnique($attr) { 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 # Should this attribute value be unique
if (in_array_ignore_case($attr,$this->getValue('unique','attrs'))) if (in_array_ignore_case($attr,$this->getValue('unique','attrs')))
return true; return true;
@ -567,9 +528,6 @@ class ldap_pla extends myldap {
* @param string|array New values for the attribute * @param string|array New values for the attribute
*/ */
public function checkUniqueAttrs($dn,$attrs) { 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 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)))) if (! $checkattrs = array_intersect(arrayLower($this->getValue('unique','attrs')),array_keys(array_change_key_case($attrs))))
return true; return true;
@ -631,9 +589,6 @@ class ldap_pla extends myldap {
* Check if the session timeout has occured for this LDAP server. * Check if the session timeout has occured for this LDAP server.
*/ */
public function isSessionValid() { 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 inactiveTime() returns a value, we need to check that it has not expired.
if (is_null($this->inactivityTime()) || ! $this->isLoggedIn()) if (is_null($this->inactivityTime()) || ! $this->isLoggedIn())
return true; return true;

View File

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

View File

@ -51,7 +51,7 @@ if (file_exists(LIBDIR.'functions.custom.php'))
/** /**
* Loads class definition * Loads class definition
*/ */
function __autoload($className) { function plaAutoload($className) {
if (file_exists(HOOKSDIR."classes/$className.php")) if (file_exists(HOOKSDIR."classes/$className.php"))
require_once(HOOKSDIR."classes/$className.php"); require_once(HOOKSDIR."classes/$className.php");
elseif (file_exists(LIBDIR."$className.php")) elseif (file_exists(LIBDIR."$className.php"))
@ -66,15 +66,14 @@ function __autoload($className) {
'type'=>'error')); 'type'=>'error'));
} }
spl_autoload_register('plaAutoload');
/** /**
* Strips all slashes from the specified array in place (pass by ref). * Strips all slashes from the specified array in place (pass by ref).
* @param Array The array to strip slashes from, typically one of * @param Array The array to strip slashes from, typically one of
* $_GET, $_POST, or $_COOKIE. * $_GET, $_POST, or $_COOKIE.
*/ */
function array_stripslashes(&$array) { 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)) if (is_array($array))
while (list($key) = each($array)) while (list($key) = each($array))
if (is_array($array[$key]) && $key != $array) if (is_array($array[$key]) && $key != $array)
@ -120,9 +119,6 @@ if (! function_exists('_')) {
* @see set_error_handler * @see set_error_handler
*/ */
function app_error_handler($errno,$errstr,$file,$lineno) { 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 * error_reporting will be 0 if the error context occurred
* within a function call with '@' preprended (ie, @ldap_bind() ); * within a function call with '@' preprended (ie, @ldap_bind() );
@ -284,9 +280,6 @@ function check_config($config_file) {
* @return array * @return array
*/ */
function cmd_control_pane($type) { 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) { switch ($type) {
case 'main' : case 'main' :
return array( return array(
@ -659,9 +652,6 @@ function system_message($msg,$redirect=null) {
* @author lem9 (taken from the phpMyAdmin source) * @author lem9 (taken from the phpMyAdmin source)
*/ */
function blowfish_encrypt($data,$secret=null) { 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 our secret is null or blank, get the default.
if ($secret === null || ! trim($secret)) if ($secret === null || ! trim($secret))
$secret = $_SESSION[APPCONFIG]->getValue('session','blowfish') ? $_SESSION[APPCONFIG]->getValue('session','blowfish') : session_id(); $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) * @author lem9 (taken from the phpMyAdmin source)
*/ */
function blowfish_decrypt($encdata,$secret=null) { 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 :) # This cache gives major speed up for stupid callers :)
static $CACHE = array(); static $CACHE = array();
@ -762,9 +749,6 @@ function blowfish_decrypt($encdata,$secret=null) {
* @return string The padded string * @return string The padded string
*/ */
function full_str_pad($input,$pad_length,$pad_string='',$pad_type=0) { 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 = ''; $str = '';
$length = $pad_length - strlen($input); $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.. * or null if there is nothing cached..
*/ */
function get_cached_item($index,$item,$subitem='null') { 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 # Set default return
$return = null; $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])) if ($_SESSION[APPCONFIG]->getValue('cache',$item) && isset($_SESSION['cache'][$index][$item][$subitem]))
$return = $_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; return $return;
} }
@ -819,9 +797,6 @@ function get_cached_item($index,$item,$subitem='null') {
* Returns true on success of false on failure. * Returns true on success of false on failure.
*/ */
function set_cached_item($index,$item,$subitem='null',$data) { 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. # Check config to make sure session-based caching is enabled.
if ($_SESSION[APPCONFIG]->getValue('cache',$item)) { if ($_SESSION[APPCONFIG]->getValue('cache',$item)) {
global $CACHE; 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 * Deletes the cache for a specified $item for the specified $index
*/ */
function del_cached_item($index,$item,$subitem='null') { 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; global $CACHE;
# Check config to make sure session-based caching is enabled. # Check config to make sure session-based caching is enabled.
@ -864,9 +836,6 @@ function del_cached_item($index,$item,$subitem='null') {
* @return boolean * @return boolean
*/ */
function set_cookie($name,$val,$expire=null,$dir=null) { 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 # Set default return
$return = false; $return = false;
@ -883,9 +852,6 @@ function set_cookie($name,$val,$expire=null,$dir=null) {
$return = true; $return = true;
} }
if (DEBUG_ENABLED)
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
return $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 * @return string The customized filename, if exists, or the standard one
*/ */
function get_custom_file($index,$filename,$path) { 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 # Set default return
$return = $path.$filename; $return = $path.$filename;
$server = $_SESSION[APPCONFIG]->getServer($index); $server = $_SESSION[APPCONFIG]->getServer($index);
@ -910,9 +873,6 @@ function get_custom_file($index,$filename,$path) {
if (! is_null($custom) && is_file(realpath($path.$custom.$filename))) if (! is_null($custom) && is_file(realpath($path.$custom.$filename)))
$return = $path.$custom.$filename; $return = $path.$custom.$filename;
if (DEBUG_ENABLED)
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -925,9 +885,6 @@ function get_custom_file($index,$filename,$path) {
* @return array Sorted multi demension array. * @return array Sorted multi demension array.
*/ */
function masort(&$data,$sortby,$rev=0) { 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);
# if the array to sort is null or empty # if the array to sort is null or empty
if (! $data) return; if (! $data) return;
@ -1042,9 +999,6 @@ function isCompress() {
* @return boolean * @return boolean
*/ */
function obfuscate_password_display($enc=null) { 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')) if ($_SESSION[APPCONFIG]->getValue('appearance','obfuscate_password_display'))
$return = true; $return = true;
@ -1054,9 +1008,6 @@ function obfuscate_password_display($enc=null) {
else else
$return = false; $return = false;
if (DEBUG_ENABLED)
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -1071,9 +1022,6 @@ function obfuscate_password_display($enc=null) {
* @return string * @return string
*/ */
function pretty_print_dn($dn) { 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_save = $dn;
$dn = pla_explode_dn($dn); $dn = pla_explode_dn($dn);
@ -1104,9 +1052,6 @@ function pretty_print_dn($dn) {
* @return boolean * @return boolean
*/ */
function is_dn_string($str) { 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 /* Try to break the string into its component parts if it can be done
ie, "uid=Manager" "dc=example" and "dc=com" */ ie, "uid=Manager" "dc=example" and "dc=com" */
$parts = pla_explode_dn($str); $parts = pla_explode_dn($str);
@ -1141,9 +1086,6 @@ function is_dn_string($str) {
* @return boolean Returns true if the specified string looks like an email address or false otherwise. * @return boolean Returns true if the specified string looks like an email address or false otherwise.
*/ */
function is_mail_string($str) { 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-]+)*$/"; $mail_regex = "/^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*$/";
if (preg_match($mail_regex,$str)) if (preg_match($mail_regex,$str))
@ -1159,9 +1101,6 @@ function is_mail_string($str) {
* @return boolean Returns true if the specified string looks like a web URL or false otherwise. * @return boolean Returns true if the specified string looks like a web URL or false otherwise.
*/ */
function is_url_string($str) { 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+/'; $url_regex = '/^(ftp|https?):\/\/+[\w\.\-\/\?\=\&]*\w+/';
if (preg_match($url_regex,$str)) if (preg_match($url_regex,$str))
@ -1202,9 +1141,6 @@ function is_url_string($str) {
* @return int * @return int
*/ */
function pla_compare_dns($dn1,$dn2) { 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 pla_compare_dns is passed via a tree, then we'll just get the DN part.
if (is_array($dn1)) if (is_array($dn1))
if (isset($dn1['dn'])) if (isset($dn1['dn']))
@ -1301,9 +1237,6 @@ function pla_compare_dns($dn1,$dn2) {
* @return int * @return int
*/ */
function get_next_number($base,$attr,$increment=false,$filter=false,$startmin=null) { 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')); $server = $_SESSION[APPCONFIG]->getServer(get_request('server_id','REQUEST'));
$attr = strtolower($attr); $attr = strtolower($attr);
$query = array(); $query = array();
@ -1493,9 +1426,6 @@ function get_next_number($base,$attr,$increment=false,$filter=false,$startmin=nu
* @return string * @return string
*/ */
function get_icon($server_id,$dn,$object_classes=array()) { 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); $server = $_SESSION[APPCONFIG]->getServer($server_id);
# Fetch and lowercase all the objectClasses in an array # Fetch and lowercase all the objectClasses in an array
@ -1674,9 +1604,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 * @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) { 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)); $empty_str = (is_null($sub_dn) || (($len=strlen(trim($sub_dn))) == 0));
if ($empty_str) if ($empty_str)
@ -1700,9 +1627,6 @@ function expand_dn_with_base($base,$sub_dn) {
* @return string The generated salt string. * @return string The generated salt string.
*/ */
function random_salt($length) { function random_salt($length) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$possible = '0123456789'. $possible = '0123456789'.
'abcdefghijklmnopqrstuvwxyz'. 'abcdefghijklmnopqrstuvwxyz'.
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'. 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
@ -1726,9 +1650,6 @@ function random_salt($length) {
* @return string The RDN * @return string The RDN
*/ */
function get_rdn($dn,$include_attrs=0,$decode=false) { 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)) if (is_null($dn))
return null; return null;
@ -1748,9 +1669,6 @@ function get_rdn($dn,$include_attrs=0,$decode=false) {
* Split an RDN into its attributes * Split an RDN into its attributes
*/ */
function rdn_explode($rdn) { 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. # Setup to work out our RDN.
$rdnarray = explode('\+',$rdn); $rdnarray = explode('\+',$rdn);
@ -1784,9 +1702,6 @@ function rdn_explode($rdn) {
* @return array An associative array contianing the error title and description like so: * @return array An associative array contianing the error title and description like so:
*/ */
function pla_verbose_error($key) { 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(); static $CACHE = array();
if (! count($CACHE)) { if (! count($CACHE)) {
@ -1836,9 +1751,6 @@ function pla_verbose_error($key) {
* @return array An associative array contianing the OID title and description like so: * @return array An associative array contianing the OID title and description like so:
*/ */
function support_oid_to_text($key) { 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(); static $CACHE = array();
$unknown = array(); $unknown = array();
@ -1883,9 +1795,6 @@ function support_oid_to_text($key) {
* Print an LDAP error message * Print an LDAP error message
*/ */
function ldap_error_msg($msg,$errnum) { 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">'; $body = '<table border="0">';
$errnum = ('0x'.str_pad(dechex($errnum),2,0,STR_PAD_LEFT)); $errnum = ('0x'.str_pad(dechex($errnum),2,0,STR_PAD_LEFT));
@ -1928,9 +1837,6 @@ function ldap_error_msg($msg,$errnum) {
* fixed_width, fixed_height, img_opts. * fixed_width, fixed_height, img_opts.
*/ */
function draw_jpeg_photo($server,$dn,$attr_name='jpegphoto',$index,$draw_delete_buttons=false,$options=array()) { 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 = array();
$fixed['width'] = isset($options['fixed_width']) ? $options['fixed_width'] : false; $fixed['width'] = isset($options['fixed_width']) ? $options['fixed_width'] : false;
$fixed['height'] = isset($options['fixed_height']) ? $options['fixed_height'] : false; $fixed['height'] = isset($options['fixed_height']) ? $options['fixed_height'] : false;
@ -2020,9 +1926,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 * @todo Dynamically work this list out so we only present hashes that we can encrypt
*/ */
function password_types() { function password_types() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
return array( return array(
''=>'clear', ''=>'clear',
'crypt-sha512' => 'crypt-sha512', 'crypt-sha512' => 'crypt-sha512',
@ -2043,9 +1946,6 @@ function password_types() {
* @return string The hashed password. * @return string The hashed password.
*/ */
function pla_password_hash($password_clear,$enc_type) { 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); $enc_type = strtolower($enc_type);
switch($enc_type) { switch($enc_type) {
@ -2100,9 +2000,6 @@ function pla_password_hash($password_clear,$enc_type) {
* @return Boolean True if the clear password matches the hash, and false otherwise. * @return Boolean True if the clear password matches the hash, and false otherwise.
*/ */
function password_check($cryptedpassword,$plainpassword,$attribute='userpassword') { 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'))) { if (in_array($attribute,array('sambalmpassword','sambantpassword'))) {
$smb = new smbHash; $smb = new smbHash;
@ -2265,9 +2162,6 @@ function password_check($cryptedpassword,$plainpassword,$attribute='userpassword
* @return string * @return string
*/ */
function get_enc_type($user_password) { 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. # Capture the stuff in the { } to determine if this is crypt, md5, etc.
$enc_type = null; $enc_type = null;
@ -2304,9 +2198,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. * @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') { 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)); $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'); $title = _('Click to popup a dialog to select an entry (DN) graphically');
@ -2335,16 +2226,9 @@ function draw_chooser_link($form,$element,$include_choose_text=true,$rdn='none')
* @return array An array of RDN parts of this format: * @return array An array of RDN parts of this format:
*/ */
function pla_explode_dn($dn,$with_attributes=0) { 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; global $CACHE;
if (isset($CACHE['explode'][$dn][$with_attributes])) { 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]; return $CACHE['explode'][$dn][$with_attributes];
} }
@ -2354,9 +2238,6 @@ function pla_explode_dn($dn,$with_attributes=0) {
$result[0] = ldap_explode_dn(dn_escape($dn),0); $result[0] = ldap_explode_dn(dn_escape($dn),0);
$result[1] = ldap_explode_dn(dn_escape($dn),1); $result[1] = ldap_explode_dn(dn_escape($dn),1);
if (! $result[$with_attributes]) { if (! $result[$with_attributes]) {
if (DEBUG_ENABLED)
debug_log('Returning NULL - NO result.',1,0,__FILE__,__LINE__,__METHOD__);
return array(); return array();
} }
@ -2373,9 +2254,6 @@ function pla_explode_dn($dn,$with_attributes=0) {
$CACHE['explode'][implode(',',array_reverse($result[0]))][$key] = array_reverse($result[$key]); $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]; return $result[$with_attributes];
} }
@ -2383,9 +2261,6 @@ function pla_explode_dn($dn,$with_attributes=0) {
* Parse a DN and escape any special characters * Parse a DN and escape any special characters
*/ */
function dn_escape($dn) { function dn_escape($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$olddn = $dn; $olddn = $dn;
# Check if the RDN has a comma and escape it. # Check if the RDN has a comma and escape it.
@ -2394,9 +2269,6 @@ function dn_escape($dn) {
$dn = preg_replace('/([^\\\\]),(\s*[^=]*\s*)([^,])$/','$1\\\\2C$2$3',$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; return $dn;
} }
@ -2404,9 +2276,6 @@ function dn_escape($dn) {
* Parse a DN and unescape any special characters * Parse a DN and unescape any special characters
*/ */
function dn_unescape($dn) { 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)) { if (is_array($dn)) {
$a = array(); $a = array();
@ -2507,9 +2376,6 @@ function utime() {
* @return string The string created from the array. * @return string The string created from the array.
*/ */
function array_to_query_string($array,$exclude_vars=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)) if (! is_array($array) || ! count($array))
return ''; return '';
@ -2554,9 +2420,6 @@ function array_to_query_string($array,$exclude_vars=array()) {
* @see pla_explode_dns * @see pla_explode_dns
*/ */
function pla_reverse_dn($dn) { 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)))); return (implode(',',array_reverse(pla_explode_dn($dn))));
} }
@ -2577,9 +2440,6 @@ function sortAttrs($a,$b) {
* @returns array Array with values converted to lowercase. * @returns array Array with values converted to lowercase.
*/ */
function arrayLower($array) { 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)) if (! is_array($array))
return $array; return $array;
@ -2594,9 +2454,6 @@ function arrayLower($array) {
* Gets a DN string using the user-configured tree_display_format string to format it. * Gets a DN string using the user-configured tree_display_format string to format it.
*/ */
function draw_formatted_dn($server,$entry) { 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(); $dn = $entry->getDn();
$formats = $_SESSION[APPCONFIG]->getValue('appearance','tree_display_format'); $formats = $_SESSION[APPCONFIG]->getValue('appearance','tree_display_format');
@ -2606,9 +2463,6 @@ function draw_formatted_dn($server,$entry) {
preg_match_all('/%[a-zA-Z_0-9]+/',$format,$tokens); preg_match_all('/%[a-zA-Z_0-9]+/',$format,$tokens);
$tokens = $tokens[0]; $tokens = $tokens[0];
if (DEBUG_ENABLED)
debug_log('The tokens are (%s)',1,0,__FILE__,__LINE__,__METHOD__,$tokens);
foreach ($tokens as $token) { foreach ($tokens as $token) {
if (strcasecmp($token,'%dn') == 0) if (strcasecmp($token,'%dn') == 0)
$format = str_replace($token,pretty_print_dn($dn),$format); $format = str_replace($token,pretty_print_dn($dn),$format);
@ -2652,9 +2506,6 @@ function draw_formatted_dn($server,$entry) {
* Server html select list * Server html select list
*/ */
function server_select_list($selected=null,$logged_on=false,$name='index',$isVisible=true,$js=null) { 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; $count = 0;
$server_menu_html = sprintf('<select name="%s" id="%s" %s>',$name,$name,$js); $server_menu_html = sprintf('<select name="%s" id="%s" %s>',$name,$name,$js);
@ -2690,9 +2541,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 * Converts a little-endian hex-number to one, that 'hexdec' can convert
*/ */
function littleEndian($hex) { function littleEndian($hex) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$result = ''; $result = '';
for ($x=strlen($hex)-2;$x>= 0;$x=$x-2) for ($x=strlen($hex)-2;$x>= 0;$x=$x-2)
@ -2702,9 +2550,6 @@ function littleEndian($hex) {
} }
function binSIDtoText($binsid) { 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); $hex_sid = bin2hex($binsid);
$rev = hexdec(substr($hex_sid,0,2)); // Get revision-part of SID $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 $subcount = hexdec(substr($hex_sid,2,2)); // Get count of sub-auth entries
@ -2733,9 +2578,6 @@ function binSIDtoText($binsid) {
* @return array Array of values keyed by $key. * @return array Array of values keyed by $key.
*/ */
function return_ldap_hash($base,$filter,$key,$attrs,$sort=true) { 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')); $server = $_SESSION[APPCONFIG]->getServer(get_request('server_id','REQUEST'));
$key = strtolower($key); $key = strtolower($key);
@ -2782,9 +2624,6 @@ function return_ldap_hash($base,$filter,$key,$attrs,$sort=true) {
* based on the criteria defined in the array $criteria in config.php * based on the criteria defined in the array $criteria in config.php
*/ */
function password_generate() { 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'); $no_use_similiar = ! $_SESSION[APPCONFIG]->getValue('password','use_similar');
$lowercase = $_SESSION[APPCONFIG]->getValue('password','lowercase'); $lowercase = $_SESSION[APPCONFIG]->getValue('password','lowercase');
$uppercase = $_SESSION[APPCONFIG]->getValue('password','uppercase'); $uppercase = $_SESSION[APPCONFIG]->getValue('password','uppercase');
@ -2849,9 +2688,6 @@ function password_generate() {
shuffle($outarray); shuffle($outarray);
$return = implode('',$outarray); $return = implode('',$outarray);
if (DEBUG_ENABLED)
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -2864,9 +2700,6 @@ function password_generate() {
* @return string The padded string * @return string The padded string
*/ */
function a_array_rand($input,$num_req) { 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) if (count($input) == 0)
return array(); return array();
@ -2889,9 +2722,6 @@ function a_array_rand($input,$num_req) {
$return[] = $input[$idxlist[$i]]; $return[] = $input[$idxlist[$i]];
} }
if (DEBUG_ENABLED)
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -2919,9 +2749,6 @@ function htmlid($sid,$dn) {
* Is PLA configured for AJAX display * Is PLA configured for AJAX display
*/ */
function isAjaxEnabled() { function isAjaxEnabled() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (isset($_SESSION[APPCONFIG])) if (isset($_SESSION[APPCONFIG]))
return ($_SESSION[APPCONFIG]->getValue('appearance','tree') == 'AJAXTree'); return ($_SESSION[APPCONFIG]->getValue('appearance','tree') == 'AJAXTree');
else else

View File

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

View File

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

View File

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

View File

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