Improvements to debug_log

This commit is contained in:
Deon George 2009-08-19 13:39:37 +10:00
parent 0eaf3bb67b
commit 5669c92371
26 changed files with 1478 additions and 531 deletions

View File

@ -39,7 +39,7 @@ switch ($www['cmd']) {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Ready to render page for command [%s,%s].',128,__FILE__,__LINE__,__METHOD__,$www['cmd'],$app['script_cmd']); 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.

View File

@ -89,9 +89,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$serverSRC->getIndex(),$serverDST->getIndex(),$snapshottree,$dnSRC,$dnDST);
$copy_message = array(); $copy_message = array();
@ -141,9 +140,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s,%s)',17,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$serverSRC->getIndex(),$serverDST->getIndex(),$dnSRC,$dnDST);
$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'));
@ -166,9 +164,8 @@ function copy_dn($serverSRC,$serverDST,$dnSRC,$dnDST,$remove) {
} }
function build_tree($server,$dn,$buildtree) { function build_tree($server,$dn,$buildtree) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server->getIndex(),$dn,$buildtree);
# 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);
@ -180,7 +177,7 @@ function build_tree($server,$dn,$buildtree) {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Returning (%s)',1,__FILE__,__LINE__,__METHOD__,$buildtree); debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$buildtree);
return $buildtree; return $buildtree;
} }

View File

@ -45,7 +45,7 @@ if (isset($app['server']) && ! is_null($request['container'])) {
foreach ($app['server']->getBaseDN() as $base) { foreach ($app['server']->getBaseDN() as $base) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Comparing BaseDN [%s] with container [%s]',64,__FILE__,__LINE__,__METHOD__,$base,$request['container']); 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;

View File

@ -165,14 +165,9 @@ function get_line_end_format() {
*/ */
function get_user_agent_string() { function get_user_agent_string() {
if (isset($_SERVER['HTTP_USER_AGENT'])) if (isset($_SERVER['HTTP_USER_AGENT']))
$return = strtolower($_SERVER['HTTP_USER_AGENT']); return strtolower($_SERVER['HTTP_USER_AGENT']);
else else
$return = ''; return '';
if (DEBUG_ENABLED)
debug_log('Entered with (), Returning (%s)',1,__FILE__,__LINE__,__METHOD__,$return);
return $return;
} }
/** /**

View File

@ -25,8 +25,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s,%s)',33,__FILE__,__LINE__,__METHOD__,$item,$level,$first_child,$last_child); debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer(); $server = $this->getServer();
@ -145,8 +145,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',33,__FILE__,__LINE__,__METHOD__,$parent_entry,$code); 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) {
@ -192,6 +192,9 @@ 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++) {
@ -213,6 +216,9 @@ 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);
printf('<script type="text/javascript" language="javascript" src="%sphplayersmenu/libjs/layersmenu-browser_detection.js"></script>',JSDIR); printf('<script type="text/javascript" language="javascript" src="%sphplayersmenu/libjs/layersmenu-browser_detection.js"></script>',JSDIR);
printf('<script type="text/javascript" language="javascript" src="%sajaxtree.js"></script>',JSDIR); printf('<script type="text/javascript" language="javascript" src="%sajaxtree.js"></script>',JSDIR);
} }
@ -221,6 +227,9 @@ 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 '';
@ -238,6 +247,9 @@ 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 '';
@ -254,6 +266,9 @@ 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(),rawurlencode($entry->getDN())); $href = sprintf('cmd=template_engine&server_id=%s&container=%s',$this->getServerID(),rawurlencode($entry->getDN()));
@ -284,6 +299,9 @@ 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

@ -81,6 +81,9 @@ 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);
@ -128,6 +131,9 @@ 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
@ -135,18 +141,30 @@ 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;
} }
@ -154,6 +172,9 @@ 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;
@ -161,6 +182,9 @@ 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);
@ -170,14 +194,23 @@ 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;
@ -197,6 +230,9 @@ 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();
@ -208,6 +244,9 @@ 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());
@ -222,6 +261,9 @@ 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
@ -229,6 +271,9 @@ 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
@ -236,22 +281,37 @@ 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
@ -259,18 +319,30 @@ 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();
@ -278,14 +350,23 @@ 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')
@ -297,6 +378,9 @@ 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
@ -304,22 +388,37 @@ 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);
@ -352,39 +451,66 @@ 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;
} }
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
@ -392,73 +518,127 @@ 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;
} }
@ -468,6 +648,9 @@ 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;
} }
@ -477,6 +660,9 @@ 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';
@ -494,22 +680,37 @@ 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)
@ -625,6 +826,9 @@ 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(); $return = array();
foreach ($this->getOldValues() as $value) foreach ($this->getOldValues() as $value)
@ -638,6 +842,9 @@ 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(); $return = array();
foreach ($this->getValues() as $value) foreach ($this->getValues() as $value)
@ -657,8 +864,8 @@ class Attribute {
* @return string * @return string
*/ */
private function real_attr_name() { private function real_attr_name() {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$attr_name); debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->name);
return preg_replace('/;.*$/U','',$this->name); return preg_replace('/;.*$/U','',$this->name);
} }
@ -667,6 +874,9 @@ 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

@ -27,8 +27,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with ()',33,__FILE__,__LINE__,__METHOD__); debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer(); $server = $this->getServer();
@ -152,6 +152,9 @@ class HTMLTree extends Tree {
* Draw the server name * Draw the server name
*/ */
protected function draw_server_name() { protected function draw_server_name() {
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">';
@ -171,6 +174,9 @@ 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')))
@ -194,6 +200,9 @@ 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();
@ -309,6 +318,9 @@ 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());
@ -323,6 +335,9 @@ 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);
@ -379,8 +394,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',33,__FILE__,__LINE__,__METHOD__,$item,$level); debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer(); $server = $this->getServer();
@ -452,10 +467,13 @@ class HTMLTree extends Tree {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Leaving (%s,%s)',33,__FILE__,__LINE__,__METHOD__,$item,$level); 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
@ -470,6 +488,9 @@ 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));
@ -485,6 +506,9 @@ 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()));
@ -511,6 +535,9 @@ 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;
@ -522,6 +549,9 @@ 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

@ -23,6 +23,9 @@ 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;
} }
@ -36,14 +39,23 @@ 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();
} }
@ -51,6 +63,9 @@ 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 (DEBUGTMP) printf('<font size=-2>%s:%s</font><br />',time(),__METHOD__);
if ($this->template_id) { if ($this->template_id) {
@ -100,6 +115,9 @@ 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__,
@ -110,6 +128,9 @@ 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__,
@ -129,6 +150,9 @@ 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();
@ -283,9 +307,10 @@ 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__); if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (DEBUG_ENABLED)
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$this->template ? $this->template->getDN() : '');
# First work out our template # First work out our template
$templates = $this->getTemplates(); $templates = $this->getTemplates();
@ -372,6 +397,9 @@ class PageRender extends Visitor {
} }
protected function getNoteAliasAttribute($attribute) { protected function getNoteAliasAttribute($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__); if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
# Is there a user-friendly translation available for this attribute? # Is there a user-friendly translation available for this attribute?
@ -386,6 +414,9 @@ 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__); if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$required_by = ''; $required_by = '';
@ -425,6 +456,9 @@ 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__); 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
@ -435,6 +469,9 @@ 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__); if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
# Is there a hint for this attribute # Is there a hint for this attribute
@ -445,6 +482,9 @@ 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__); if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
# Is this attribute is readonly # Is this attribute is readonly
@ -459,6 +499,9 @@ 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())
@ -1091,9 +1134,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
$attr);
$shadowattr = array(); $shadowattr = array();
$shadowattr['lastchange'] = $this->template->getAttribute('shadowlastchange'); $shadowattr['lastchange'] = $this->template->getAttribute('shadowlastchange');

View File

@ -24,28 +24,28 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',5,__FILE__,__LINE__,__METHOD__,$xmldata); 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) if (DEBUG_ENABLED)
debug_log('Foreach loop Key [%s] Value [%s]',4,__FILE__,__LINE__,__METHOD__,$xml_key,is_array($xml_value)); 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) if (DEBUG_ENABLED)
debug_log('Case [%s]',4,__FILE__,__LINE__,__METHOD__,$xml_key); 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) if (DEBUG_ENABLED)
debug_log('Foreach tattrs Key [%s] Value [%s]',4,__FILE__,__LINE__,__METHOD__, debug_log('Foreach tattrs Key [%s] Value [%s]',4,0,__FILE__,__LINE__,__METHOD__,
$index,$details); $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.
@ -78,7 +78,7 @@ class Query extends xmlTemplate {
default: default:
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Case [%s]',4,__FILE__,__LINE__,__METHOD__,$xml_key); 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('');
@ -123,6 +123,9 @@ 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();
@ -173,6 +176,9 @@ 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;
} }
@ -180,10 +186,16 @@ 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;
} }
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)) {
@ -203,6 +215,9 @@ 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)) {
@ -241,10 +256,16 @@ 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

@ -20,8 +20,8 @@ class QueryRender extends PageRender {
* Intialise and Render the QueryRender * Intialise and Render the QueryRender
*/ */
public function accept() { public function accept() {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with ()',1,__FILE__,__LINE__,__METHOD__); debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__); 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 [GETquery:%s]</font><br />',__METHOD__,get_request('query','REQUEST'));
@ -44,6 +44,9 @@ 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);
} }
@ -51,6 +54,9 @@ 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'))
@ -195,12 +201,18 @@ 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();
@ -509,6 +521,9 @@ var deon=0;
} }
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();
@ -519,6 +534,9 @@ var deon=0;
} }
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

@ -57,6 +57,9 @@ class Template extends xmlTemplate {
private $rdn; private $rdn;
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;
@ -68,21 +71,21 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',5,__FILE__,__LINE__,__METHOD__,$xmldata); 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) if (DEBUG_ENABLED)
debug_log('Foreach loop Key [%s] Value [%s]',4,__FILE__,__LINE__,__METHOD__,$xml_key,is_array($xml_value)); 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) if (DEBUG_ENABLED)
debug_log('Case [%s]',4,__FILE__,__LINE__,__METHOD__,$xml_key); 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'])) {
@ -116,13 +119,13 @@ 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) if (DEBUG_ENABLED)
debug_log('Case [%s]',4,__FILE__,__LINE__,__METHOD__,$xml_key); 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) if (DEBUG_ENABLED)
debug_log('Foreach tattrs Key [%s] Value [%s]',4,__FILE__,__LINE__,__METHOD__, debug_log('Foreach tattrs Key [%s] Value [%s]',4,0,__FILE__,__LINE__,__METHOD__,
$index,$details); $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.
@ -138,7 +141,7 @@ class Template extends xmlTemplate {
default: default:
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Case [%s]',4,__FILE__,__LINE__,__METHOD__,$xml_key); 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');
@ -216,6 +219,9 @@ 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
@ -229,8 +235,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with ()',1,__FILE__,__LINE__,__METHOD__); 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);
@ -245,6 +251,9 @@ 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.
@ -546,6 +555,9 @@ 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__,
@ -564,6 +576,9 @@ 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);
@ -588,6 +603,9 @@ 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;
@ -603,6 +621,9 @@ 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__,
@ -618,6 +639,9 @@ 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;
} }
@ -625,6 +649,9 @@ class Template extends xmlTemplate {
* Copy a DN * Copy a DN
*/ */
public function copy($template,$rdn) { public function copy($template,$rdn) {
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;
@ -683,6 +710,9 @@ 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) {
@ -697,6 +727,9 @@ 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
@ -709,6 +742,9 @@ 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)
@ -725,6 +761,9 @@ 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) {
@ -751,6 +790,9 @@ 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);
@ -776,6 +818,9 @@ 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()) {
@ -798,6 +843,9 @@ 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()) if ($this->getContainer())
return 'create'; return 'create';
elseif ($this->getDN()) elseif ($this->getDN())
@ -812,10 +860,16 @@ 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;
} }
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;
} }
@ -823,6 +877,9 @@ 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
@ -836,6 +893,9 @@ 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;
@ -854,6 +914,9 @@ 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)
@ -867,6 +930,9 @@ 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)
@ -882,6 +948,9 @@ 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();
@ -893,6 +962,9 @@ 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) : '';
} }
@ -902,6 +974,9 @@ 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;
} }
@ -911,6 +986,9 @@ 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;
@ -922,6 +1000,9 @@ 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
@ -929,6 +1010,9 @@ 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;
} }
@ -939,6 +1023,9 @@ 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))
@ -952,6 +1039,9 @@ 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))
@ -964,8 +1054,8 @@ class Template extends xmlTemplate {
* OnChangeAdd javascript processing * OnChangeAdd javascript processing
*/ */
public function OnChangeAdd($origin,$value) { public function OnChangeAdd($origin,$value) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',5,__FILE__,__LINE__,__METHOD__,$origin,$value); debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
$attribute = $this->getAttribute($origin); $attribute = $this->getAttribute($origin);
@ -1130,6 +1220,9 @@ 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.
@ -1241,6 +1334,9 @@ 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();
@ -1273,6 +1369,9 @@ 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();
@ -1351,6 +1450,9 @@ 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))
@ -1367,6 +1469,9 @@ 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

@ -24,6 +24,9 @@ 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) 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)); if (DEBUGTMP||DEBUGTMPSUB) printf('<font size=-2>* %s [Visit-Start:%s]</font><br />',__METHOD__,get_class($this));
@ -84,6 +87,9 @@ class TemplateRender extends PageRender {
} }
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();
@ -545,6 +551,9 @@ 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)
@ -557,6 +566,9 @@ 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;
@ -575,6 +587,9 @@ 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
@ -705,9 +720,10 @@ 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 (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (DEBUG_ENABLED)
debug_log('Entered',1,__FILE__,__LINE__,__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)
@ -725,9 +741,10 @@ 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__); if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (DEBUG_ENABLED)
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$this->template->getDN());
foreach ($this->template->getAttributesShown() as $attribute) foreach ($this->template->getAttributesShown() as $attribute)
if ($attribute->getPage() > $this->pagelast) if ($attribute->getPage() > $this->pagelast)
@ -927,6 +944,9 @@ 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); if (DEBUGTMP) printf('<font size=-2>%s (%s)</font><br />',__METHOD__,$i);
switch ($i) { switch ($i) {
@ -1086,6 +1106,9 @@ 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 (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())
@ -1095,6 +1118,9 @@ 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__); if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
return sprintf($this->layout['hint'], return sprintf($this->layout['hint'],
@ -1104,12 +1130,18 @@ 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__); 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__); 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.'));
@ -1118,6 +1150,9 @@ class TemplateRender extends PageRender {
/** 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__); 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());
@ -1131,6 +1166,9 @@ 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())
@ -1142,6 +1180,9 @@ 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__); 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);
@ -1155,6 +1196,9 @@ 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__); 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);
@ -1170,6 +1214,9 @@ 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 (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (get_request('show_internal_attrs','REQUEST')) { if (get_request('show_internal_attrs','REQUEST')) {
@ -1187,6 +1234,9 @@ 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__); 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);
@ -1201,6 +1251,9 @@ 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__); 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());
@ -1214,6 +1267,9 @@ 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__); 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);
@ -1228,6 +1284,9 @@ 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__); if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
$href = sprintf('cmd=template_engine&server_id=%s&container=%s',$this->getServerID(),rawurlencode($this->template->getDN())); $href = sprintf('cmd=template_engine&server_id=%s&container=%s',$this->getServerID(),rawurlencode($this->template->getDN()));
@ -1242,6 +1301,9 @@ 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 (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (! $this->template->getAvailAttrs()) if (! $this->template->getAvailAttrs())
@ -1260,6 +1322,9 @@ 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__); 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', $href = sprintf('cmd=query_engine&server_id=%s&filter=%s&base=%s&scope=one&query=none',
@ -1277,6 +1342,9 @@ 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__); 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');
@ -1935,12 +2003,18 @@ 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__); 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__); 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";
@ -1993,6 +2067,9 @@ 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 (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.
@ -2033,6 +2110,9 @@ 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__); 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',
@ -2048,6 +2128,9 @@ 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__); 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',
@ -2064,6 +2147,9 @@ 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__); 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',
@ -2076,8 +2162,6 @@ function fillRec(id,value) {
protected function drawValueAttribute($attribute,$i) { protected function drawValueAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__); if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
if (DEBUG_ENABLED)
debug_log('Entered with (%s,%d)',1,__FILE__,__LINE__,__METHOD__,$attribute->getName(),$i);
$val = $attribute->getValue($i); $val = $attribute->getValue($i);
@ -2443,6 +2527,9 @@ function deleteAttribute(attrName,friendlyName,i)
} }
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__); if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
switch ($i) { switch ($i) {

View File

@ -28,6 +28,9 @@ 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;
} }
@ -38,6 +41,9 @@ 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) {
@ -69,6 +75,9 @@ 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;
} }
@ -78,6 +87,9 @@ 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);
} }
@ -87,6 +99,9 @@ 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)
@ -109,10 +124,13 @@ 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) if (DEBUG_ENABLED)
debug_log('Entered with (%s), Result (%s)',1,__FILE__,__LINE__,__METHOD__,$dn,$index); debug_log('Result (%s)',1,0,__FILE__,__LINE__,__METHOD__,$index);
return $index; return $index;
} }
@ -124,6 +142,9 @@ 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]))
@ -140,8 +161,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$dn); debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer(); $server = $this->getServer();
$dnlower = $this->indexDN($dn); $dnlower = $this->indexDN($dn);
@ -153,7 +174,7 @@ abstract class Tree {
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) if (DEBUG_ENABLED)
debug_log('New ENTRY (%s).',64,__FILE__,__LINE__,__METHOD__,$dn); 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'));
@ -170,7 +191,7 @@ abstract class Tree {
$parent_dn = $server->getContainer($dn); $parent_dn = $server->getContainer($dn);
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Parent DNs (%s)',64,__FILE__,__LINE__,__METHOD__,$parent_dn); 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);
@ -193,8 +214,8 @@ abstract class Tree {
* @param dn DN to remote * @param dn DN to remote
*/ */
public function delEntry($dn) { public function delEntry($dn) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$dn); debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer(); $server = $this->getServer();
$dnlower = $this->indexDN($dn); $dnlower = $this->indexDN($dn);
@ -217,8 +238,8 @@ abstract class Tree {
* @param dn New DN * @param dn New DN
*/ */
public function renameEntry($dnOLD,$dnNEW) { public function renameEntry($dnOLD,$dnNEW) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',1,__FILE__,__LINE__,__METHOD__,$dnOLD,$dnNEW); debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer(); $server = $this->getServer();
$dnlowerOLD = $this->indexDN($dnOLD); $dnlowerOLD = $this->indexDN($dnOLD);
@ -249,8 +270,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',1,__FILE__,__LINE__,__METHOD__,$dn,$nolimit); debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer(); $server = $this->getServer();
$dnlower = $this->indexDN($dn); $dnlower = $this->indexDN($dn);
@ -272,7 +293,7 @@ abstract class Tree {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Children of (%s) are (%s)',64,__FILE__,__LINE__,__METHOD__,$dn,$ldap['children']); 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)
@ -280,7 +301,7 @@ abstract class Tree {
foreach ($ldap['children'] as $child) { foreach ($ldap['children'] as $child) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Adding (%s)',64,__FILE__,__LINE__,__METHOD__,$child); 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);
@ -290,9 +311,6 @@ abstract class Tree {
$this->entries[$dnlower]->setSizeLimited(); $this->entries[$dnlower]->setSizeLimited();
else else
$this->entries[$dnlower]->unsetSizeLimited(); $this->entries[$dnlower]->unsetSizeLimited();
if (DEBUG_ENABLED)
debug_log('Entered with (%s,%s), Returning ()',1,__FILE__,__LINE__,__METHOD__,$dn,$nolimit);
} }
/** /**
@ -302,8 +320,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',1,__FILE__,__LINE__,__METHOD__,$dn,$nolimit); debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
$dnlower = $this->indexDN($dn); $dnlower = $this->indexDN($dn);

View File

@ -37,6 +37,9 @@ class TreeItem {
private $template = null; private $template = null;
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;
} }
@ -47,6 +50,9 @@ 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;
} }
@ -56,6 +62,9 @@ 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);
} }
@ -63,6 +72,9 @@ 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;
} }
@ -70,18 +82,30 @@ 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;
} }
@ -90,6 +114,9 @@ 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);
return $this->children; return $this->children;
} }
@ -99,17 +126,14 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$dn); debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (in_array($dn,$this->children)) if (in_array($dn,$this->children))
return; return;
array_push($this->children,$dn); array_push($this->children,$dn);
usort($this->children,'pla_compare_dns'); usort($this->children,'pla_compare_dns');
if (DEBUG_ENABLED)
debug_log('Entered with (%s), Leaving ()',1,__FILE__,__LINE__,__METHOD__,$dn);
} }
/** /**
@ -118,8 +142,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$dn); 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.
@ -136,6 +160,9 @@ 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;
} }
@ -143,6 +170,9 @@ 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;
} }
@ -150,6 +180,9 @@ 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;
} }
@ -157,6 +190,9 @@ 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;
} }
@ -164,6 +200,9 @@ 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;
} }
@ -171,6 +210,9 @@ 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;
} }
@ -179,6 +221,9 @@ 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);
@ -189,6 +234,9 @@ 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;
} }
@ -196,6 +244,9 @@ 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;
} }
@ -203,14 +254,23 @@ 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

@ -24,6 +24,9 @@ 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);
@ -75,7 +78,7 @@ abstract class Visitor {
return; return;
} elseif (DEBUG_ENABLED) { } elseif (DEBUG_ENABLED) {
debug_log('Doesnt exist param (%s,%s)',1,__FILE__,__LINE__,__METHOD__,$method,$fnct); 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));
@ -87,6 +90,9 @@ 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
@ -99,6 +105,9 @@ 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

@ -213,7 +213,7 @@ else
define('DEBUG_ENABLED',0); define('DEBUG_ENABLED',0);
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Application (%s) initialised and starting with (%s).',1,__FILE__,__LINE__,__METHOD__, debug_log('Application (%s) initialised and starting with (%s).',1,0,__FILE__,__LINE__,__METHOD__,
app_version(),$_REQUEST); app_version(),$_REQUEST);
# Set our PHP timelimit. # Set our PHP timelimit.

View File

@ -616,6 +616,9 @@ 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) {
@ -648,6 +651,9 @@ 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');
@ -662,6 +668,9 @@ 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];
@ -676,6 +685,9 @@ class Config {
} }
public function configDefinition($key,$index,$config) { public function configDefinition($key,$index,$config) {
if (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;
@ -690,8 +702,8 @@ class Config {
* Return the friendly attributes names * Return the friendly attributes names
*/ */
private function getFriendlyAttrs() { private function getFriendlyAttrs() {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with ()',1,__FILE__,__LINE__,__METHOD__); 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'));
} }
@ -704,6 +716,9 @@ 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)
@ -729,6 +744,9 @@ 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);
} }
@ -739,6 +757,9 @@ 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);
if ($this->haveFriendlyName($attr)) if ($this->haveFriendlyName($attr))
return sprintf('<acronym title="%s %s">%s</acronym>', return sprintf('<acronym title="%s %s">%s</acronym>',
_('Alias for'),$attr->getName(false),$this->getFriendlyName($attr)); _('Alias for'),$attr->getName(false),$this->getFriendlyName($attr));
@ -759,6 +780,9 @@ 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

@ -70,6 +70,9 @@ 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];
@ -115,6 +118,9 @@ 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');
} }
@ -125,6 +131,9 @@ 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 'config': case 'config':
case 'http': case 'http':
@ -144,6 +153,9 @@ 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
@ -182,6 +194,9 @@ 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()) {
@ -208,6 +223,9 @@ 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
@ -241,6 +259,9 @@ 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);
@ -319,6 +340,9 @@ 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]);
@ -344,10 +368,16 @@ 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
@ -355,6 +385,9 @@ 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;
} }
@ -368,6 +401,9 @@ 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.
@ -390,6 +426,9 @@ 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,0,__FILE__,__LINE__,__METHOD__,$fargs,true);
return true; return true;
} }
@ -398,6 +437,9 @@ 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
@ -511,10 +553,6 @@ class Datastore {
* Set values for a database object. * Set values for a database object.
*/ */
public function setValue($key,$setting,$value) { public function setValue($key,$setting,$value) {
if (defined('DEBUG_ENABLED') && (DEBUG_ENABLED))
debug_log('Entered with (%s,%s,%s)',3,__FILE__,__LINE__,__METHOD__,
$key,$setting,$value);
if (! $this->objects[$this->index]->isDefaultKey($key)) if (! $this->objects[$this->index]->isDefaultKey($key))
error("ERROR: Setting a key [$key] that isnt predefined.",'error',true); error("ERROR: Setting a key [$key] that isnt predefined.",'error',true);
@ -539,14 +577,14 @@ 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]))
return $CACHE[$isVisible]; return $CACHE[$isVisible];
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
debug_log('Entered with (%s)',3,__FILE__,__LINE__,__METHOD__,$isVisible);
$CACHE[$isVisible] = array(); $CACHE[$isVisible] = array();
# Debugging incase objects is not set. # Debugging incase objects is not set.
@ -560,10 +598,6 @@ class Datastore {
if (! $isVisible || ($isVisible && $server->getValue('server','visible'))) if (! $isVisible || ($isVisible && $server->getValue('server','visible')))
$CACHE[$isVisible][$id] = $server; $CACHE[$isVisible][$id] = $server;
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
debug_log('Entered with (%s), Returning (%s)',3,__FILE__,__LINE__,__METHOD__,
$isVisible,$CACHE);
return $CACHE[$isVisible]; return $CACHE[$isVisible];
} }
@ -574,8 +608,8 @@ 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) if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',3,__FILE__,__LINE__,__METHOD__,$index); 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)) if (is_null($index))
@ -585,7 +619,7 @@ class Datastore {
debug_dump_backtrace("Error: Datastore instance [$index] doesnt exist?",1); debug_dump_backtrace("Error: Datastore instance [$index] doesnt exist?",1);
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED) if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
debug_log('Returning instance of database (%s)',3,__FILE__,__LINE__,__METHOD__,$index); debug_log('Returning instance of database (%s)',3,0,__FILE__,__LINE__,__METHOD__,$index);
return $this->objects[$index]; return $this->objects[$index];
} }
@ -597,8 +631,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',3,__FILE__,__LINE__,__METHOD__,$name); 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)
@ -615,8 +649,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',3,__FILE__,__LINE__,__METHOD__,$id); 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)

View File

@ -25,6 +25,9 @@ class ldap 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';
@ -129,8 +132,8 @@ class ldap 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',17,__FILE__,__LINE__,__METHOD__,$method); debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
static $CACHE = array(); static $CACHE = array();
@ -162,7 +165,7 @@ class ldap extends DS {
# No identifiable connection exists, lets create a new one. # No identifiable connection exists, lets create a new one.
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Creating NEW connection [%s] for index [%s]',16,__FILE__,__LINE__,__METHOD__, debug_log('Creating NEW connection [%s] for index [%s]',16,0,__FILE__,__LINE__,__METHOD__,
$method,$this->index); $method,$this->index);
if (function_exists('run_hook')) if (function_exists('run_hook'))
@ -176,7 +179,7 @@ class ldap extends DS {
$CACHE[$this->index][$method] = $resource; $CACHE[$this->index][$method] = $resource;
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('LDAP Resource [%s], Host [%s], Port [%s]',16,__FILE__,__LINE__,__METHOD__, debug_log('LDAP Resource [%s], Host [%s], Port [%s]',16,0,__FILE__,__LINE__,__METHOD__,
$resource,$this->getValue('server','host'),$this->getValue('server','port')); $resource,$this->getValue('server','host'),$this->getValue('server','port'));
if (! is_resource($resource)) if (! is_resource($resource))
@ -206,11 +209,11 @@ class ldap extends DS {
debug_dump(array('method'=>$method,'bind'=>$bind,'USER'=>$_SESSION['USER'])); debug_dump(array('method'=>$method,'bind'=>$bind,'USER'=>$_SESSION['USER']));
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Resource [%s], Bind Result [%s]',16,__FILE__,__LINE__,__METHOD__,$resource,$bind); debug_log('Resource [%s], Bind Result [%s]',16,0,__FILE__,__LINE__,__METHOD__,$resource,$bind);
if (! $bind['result']) { if (! $bind['result']) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Leaving with FALSE, bind FAILed',16,__FILE__,__LINE__,__METHOD__); debug_log('Leaving with FALSE, bind FAILed',16,0,__FILE__,__LINE__,__METHOD__);
$this->noconnect = true; $this->noconnect = true;
@ -248,6 +251,9 @@ class ldap extends DS {
* @todo isLoginStringEnabled() based logins * @todo isLoginStringEnabled() based logins
*/ */
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.
@ -306,6 +312,9 @@ class ldap 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);
$size_limit = 500; $size_limit = 500;
$time_limit = 0; $time_limit = 0;
$attrs_only = 0; $attrs_only = 0;
@ -347,11 +356,7 @@ class ldap extends DS {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (%s,%s,%s)',17,__FILE__,__LINE__,__METHOD__, debug_log('%s search PREPARE.',16,0,__FILE__,__LINE__,__METHOD__,$query['scope']);
$query,$index,$debug);
if (DEBUG_ENABLED)
debug_log('%s search PREPARE.',16,__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)));
@ -377,7 +382,7 @@ class ldap extends DS {
debug_dump(array('method'=>$method,'search'=>$search,'error'=>$this->getErrorMessage())); debug_dump(array('method'=>$method,'search'=>$search,'error'=>$this->getErrorMessage()));
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Search scope [%s] base [%s] filter [%s] attrs [%s] COMPLETE (%s).',16,__FILE__,__LINE__,__METHOD__, 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)); $query['scope'],$query['base'],$query['filter'],$query['attrs'],is_null($search));
if (! $search) if (! $search)
@ -429,7 +434,7 @@ class ldap extends DS {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Returning (%s)',17,__FILE__,__LINE__,__METHOD__,$return); debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -440,6 +445,9 @@ class ldap 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));
} }
@ -449,6 +457,9 @@ class ldap 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));
} }
@ -461,6 +472,9 @@ class ldap 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('(&(uid=%s))',$user); $query['filter'] = sprintf('(&(uid=%s))',$user);
$query['attrs'] = array('dn'); $query['attrs'] = array('dn');
$result = $this->query($query,$method); $result = $this->query($query,$method);
@ -479,6 +493,9 @@ class ldap 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');
} }
@ -493,6 +510,9 @@ class ldap 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;
@ -505,6 +525,9 @@ class ldap 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)))
error(_('Could not start TLS. Please check your LDAP server configuration.'),'error',null,true); error(_('Could not start TLS. Please check your LDAP server configuration.'),'error',null,true);
} }
@ -520,6 +543,9 @@ class ldap 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;
@ -535,6 +561,9 @@ class ldap 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);
error(__METHOD__.' has NOT been tested, please let us know if it works and which version of PHP you are using.','info'); error(__METHOD__.' has NOT been tested, please let us know if it works and which version of PHP you are using.','info');
static $CACHE = array(); static $CACHE = array();
@ -551,7 +580,7 @@ class ldap extends DS {
if (! trim($this->getValue('sasl','authz_id'))) { if (! trim($this->getValue('sasl','authz_id'))) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Rewriting bind DN [%s] -> authz_id with regex [%s] and replacement [%s].',9,__FILE__,__LINE__,__METHOD__, debug_log('Rewriting bind DN [%s] -> authz_id with regex [%s] and replacement [%s].',9,0,__FILE__,__LINE__,__METHOD__,
$CACHE['login_dn'], $CACHE['login_dn'],
$this->getValue('sasl','authz_id_regex'), $this->getValue('sasl','authz_id_regex'),
$this->getValue('sasl','authz_id_replacement')); $this->getValue('sasl','authz_id_replacement'));
@ -566,7 +595,7 @@ class ldap extends DS {
'error','index.php'); 'error','index.php');
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Resource [%s], SASL OPTIONS: mech [%s], realm [%s], authz_id [%s], props [%s]',9,__FILE__,__LINE__,__METHOD__, debug_log('Resource [%s], SASL OPTIONS: mech [%s], realm [%s], authz_id [%s], props [%s]',9,0,__FILE__,__LINE__,__METHOD__,
$resource, $resource,
$this->getValue('sasl','mech'), $this->getValue('sasl','mech'),
$this->getValue('sasl','realm'), $this->getValue('sasl','realm'),
@ -595,6 +624,9 @@ class ldap 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;
} }
@ -602,6 +634,9 @@ class ldap 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']))) {
@ -688,6 +723,9 @@ class ldap 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);
} }
@ -708,8 +746,8 @@ class ldap 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',17,__FILE__,__LINE__,__METHOD__,$method); debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
static $CACHE; static $CACHE;
@ -722,14 +760,14 @@ class ldap 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) if (DEBUG_ENABLED)
debug_log('Return BaseDN from Config [%s]',17,__FILE__,__LINE__,__METHOD__,implode('|',$this->getValue('server','base'))); 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) if (DEBUG_ENABLED)
debug_log('Connect to LDAP to find BaseDN',80,__FILE__,__LINE__,__METHOD__); 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();
@ -738,7 +776,7 @@ class ldap extends DS {
if (isset($results['namingcontexts'])) { if (isset($results['namingcontexts'])) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('LDAP Entries:%s',80,__FILE__,__LINE__,__METHOD__,implode('|',$results['namingcontexts'])); debug_log('LDAP Entries:%s',80,0,__FILE__,__LINE__,__METHOD__,implode('|',$results['namingcontexts']));
$result = $results['namingcontexts']; $result = $results['namingcontexts'];
} }
@ -758,8 +796,8 @@ class ldap extends DS {
* @return boolean * @return boolean
*/ */
public function dnExists($dn,$method=null) { public function dnExists($dn,$method=null) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Search for (%s)',16,__FILE__,__LINE__,__METHOD__,$dn); debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$results = $this->getDNAttrValues($dn,$method); $results = $this->getDNAttrValues($dn,$method);
@ -776,6 +814,9 @@ class ldap 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) {
@ -786,7 +827,7 @@ class ldap extends DS {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (%s), Returning (%s)',17,__FILE__,__LINE__,__METHOD__,$dn,$return); debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -799,8 +840,8 @@ class ldap extends DS {
* @return string The container * @return string The container
*/ */
public function getContainerPath($dn,$path='..') { public function getContainerPath($dn,$path='..') {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',17,__FILE__,__LINE__,__METHOD__,$dn,$path); debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$top = $this->getContainerTop($dn); $top = $this->getContainerTop($dn);
@ -846,23 +887,25 @@ class ldap 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)
$container = null; $return = null;
else { else {
$container = $parts[1]; $return = $parts[1];
for ($i=2;$i<count($parts);$i++) for ($i=2;$i<count($parts);$i++)
$container .= sprintf(',%s',$parts[$i]); $return .= sprintf(',%s',$parts[$i]);
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (%s), Returning (%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$return);
$dn,$container);
return $container; return $return;
} }
/** /**
@ -899,8 +942,8 @@ class ldap 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s,%s)',17,__FILE__,__LINE__,__METHOD__,$dn,$size_limit,$filter,$deref); debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$return = array(); $return = array();
@ -921,7 +964,7 @@ class ldap extends DS {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Returning (%s)',17,__FILE__,__LINE__,__METHOD__,$return); debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$return);
# Sort the results # Sort the results
asort($return); asort($return);
@ -949,14 +992,14 @@ class ldap 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',1,__FILE__,__LINE__,__METHOD__,$dn,$with_attributes); 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) if (DEBUG_ENABLED)
debug_log('Return CACHED result (%s) for (%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Return CACHED result (%s) for (%s)',1,0,__FILE__,__LINE__,__METHOD__,
$CACHE['explode'][$dn][$with_attributes],$dn); $CACHE['explode'][$dn][$with_attributes],$dn);
return $CACHE['explode'][$dn][$with_attributes]; return $CACHE['explode'][$dn][$with_attributes];
@ -969,7 +1012,7 @@ class ldap extends DS {
$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) if (DEBUG_ENABLED)
debug_log('Returning NULL - NO result.',1,__FILE__,__LINE__,__METHOD__); debug_log('Returning NULL - NO result.',1,0,__FILE__,__LINE__,__METHOD__);
return array(); return array();
} }
@ -988,8 +1031,7 @@ class ldap extends DS {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (%s,%s), Returning (%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$result[$with_attributes]);
$dn,$with_attributes,$result[$with_attributes]);
return $result[$with_attributes]; return $result[$with_attributes];
} }
@ -998,11 +1040,12 @@ class ldap 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;
$olddn = $dn;
# Check if the RDN has a comma and escape it. # Check if the RDN has a comma and escape it.
while (preg_match('/([^\\\\]),(\s*[^=]*\s*),/',$dn)) while (preg_match('/([^\\\\]),(\s*[^=]*\s*),/',$dn))
$dn = preg_replace('/([^\\\\]),(\s*[^=]*\s*),/','$1\\\\2C$2,',$dn); $dn = preg_replace('/([^\\\\]),(\s*[^=]*\s*),/','$1\\\\2C$2,',$dn);
@ -1010,8 +1053,7 @@ class ldap 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) if (DEBUG_ENABLED)
debug_log('Entered with (%s), Returning (%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$dn);
$olddn,$dn);
return $dn; return $dn;
} }
@ -1020,6 +1062,9 @@ class ldap extends DS {
* Parse a DN and unescape any special characters * Parse a DN and unescape any special characters
*/ */
private function unescapeDN($dn) { private function unescapeDN($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (is_array($dn)) { if (is_array($dn)) {
$a = array(); $a = array();
foreach ($dn as $key => $rdn) foreach ($dn as $key => $rdn)
@ -1032,6 +1077,9 @@ class ldap extends DS {
} }
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';
@ -1057,8 +1105,8 @@ class ldap 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',25,__FILE__,__LINE__,__METHOD__,$dn); 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)
@ -1070,19 +1118,19 @@ class ldap extends DS {
$search = @ldap_read($this->connect($method),$dn,'objectClass=*',array('subschemaSubentry')); $search = @ldap_read($this->connect($method),$dn,'objectClass=*',array('subschemaSubentry'));
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Search returned (%s)',24,__FILE__,__LINE__,__METHOD__,is_resource($search)); 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) if (DEBUG_ENABLED)
debug_log('Trying to find the DN for "broken" ldap.conf',80,__FILE__,__LINE__,__METHOD__); 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')); $search = @ldap_read($this->connect($method),$base,'objectClass=*',array('subschemaSubentry'));
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Search returned (%s) for base (%s)',24,__FILE__,__LINE__,__METHOD__, debug_log('Search returned (%s) for base (%s)',24,0,__FILE__,__LINE__,__METHOD__,
is_resource($search),$base); is_resource($search),$base);
if ($search) if ($search)
@ -1096,7 +1144,7 @@ class ldap extends DS {
if (! @ldap_count_entries($this->connect($method),$search)) { if (! @ldap_count_entries($this->connect($method),$search)) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Search returned 0 entries. Returning NULL',25,__FILE__,__LINE__,__METHOD__); debug_log('Search returned 0 entries. Returning NULL',25,0,__FILE__,__LINE__,__METHOD__);
return null; return null;
} }
@ -1104,7 +1152,7 @@ class ldap extends DS {
$entries = @ldap_get_entries($this->connect($method),$search); $entries = @ldap_get_entries($this->connect($method),$search);
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Search returned [%s]',24,__FILE__,__LINE__,__METHOD__,$entries); 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;
@ -1112,7 +1160,7 @@ class ldap extends DS {
$entry = isset($entries[0]) ? $entries[0] : false; $entry = isset($entries[0]) ? $entries[0] : false;
if (! $entry) { if (! $entry) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entry is false, Returning NULL',80,__FILE__,__LINE__,__METHOD__); debug_log('Entry is false, Returning NULL',80,0,__FILE__,__LINE__,__METHOD__);
return null; return null;
} }
@ -1120,7 +1168,7 @@ class ldap extends DS {
$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) if (DEBUG_ENABLED)
debug_log('Sub Entry is false, Returning NULL',80,__FILE__,__LINE__,__METHOD__); debug_log('Sub Entry is false, Returning NULL',80,0,__FILE__,__LINE__,__METHOD__);
return null; return null;
} }
@ -1128,7 +1176,7 @@ class ldap extends DS {
$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) if (DEBUG_ENABLED)
debug_log('Returning (%s)',25,__FILE__,__LINE__,__METHOD__,$this->_schemaDN); debug_log('Returning (%s)',25,0,__FILE__,__LINE__,__METHOD__,$this->_schemaDN);
return $this->_schemaDN; return $this->_schemaDN;
} }
@ -1161,8 +1209,8 @@ class ldap extends DS {
* etc. * etc.
*/ */
private function getRawSchema($method,$schema_to_fetch,$dn='') { private function getRawSchema($method,$schema_to_fetch,$dn='') {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',25,__FILE__,__LINE__,__METHOD__,$schema_to_fetch,$dn); 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');
@ -1176,7 +1224,7 @@ class ldap extends DS {
$schema = $this->_schema_entries[$schema_to_fetch]; $schema = $this->_schema_entries[$schema_to_fetch];
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Returning CACHED (%s)',25,__FILE__,__LINE__,__METHOD__,$schema); debug_log('Returning CACHED (%s)',25,0,__FILE__,__LINE__,__METHOD__,$schema);
return $schema; return $schema;
} }
@ -1198,11 +1246,11 @@ class ldap extends DS {
if ($schema_dn) { if ($schema_dn) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Using Schema DN (%s)',24,__FILE__,__LINE__,__METHOD__,$schema_dn); 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) if (DEBUG_ENABLED)
debug_log('Looking for schema with Filter (%s)',24,__FILE__,__LINE__,__METHOD__,$schema_filter); 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),0,0,0,LDAP_DEREF_NEVER); $schema_search = @ldap_read($this->connect($method),$schema_dn,$schema_filter,array($schema_to_fetch),0,0,0,LDAP_DEREF_NEVER);
@ -1212,18 +1260,18 @@ class ldap 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) if (DEBUG_ENABLED)
debug_log('Search returned [%s]',24,__FILE__,__LINE__,__METHOD__,$schema_entries); 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) if (DEBUG_ENABLED)
debug_log('Found schema with (DN:%s) (FILTER:%s) (ATTR:%s)',24,__FILE__,__LINE__,__METHOD__, debug_log('Found schema with (DN:%s) (FILTER:%s) (ATTR:%s)',24,0,__FILE__,__LINE__,__METHOD__,
$schema_dn,$schema_filter,$schema_to_fetch); $schema_dn,$schema_filter,$schema_to_fetch);
break; break;
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Didnt find schema with filter (%s)',24,__FILE__,__LINE__,__METHOD__,$schema_filter); 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;
@ -1234,7 +1282,7 @@ class ldap extends DS {
* 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) if (DEBUG_ENABLED)
debug_log('Attempting work-arounds for "broken" LDAP servers...',24,__FILE__,__LINE__,__METHOD__); 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=*)';
@ -1248,7 +1296,7 @@ class ldap 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) if (DEBUG_ENABLED)
debug_log('Attempting [%s] (%s) (%s)<BR>',24,__FILE__,__LINE__,__METHOD__, debug_log('Attempting [%s] (%s) (%s)<BR>',24,0,__FILE__,__LINE__,__METHOD__,
$ldap_server_name,$ldap_dn,$ldap_filter); $ldap_server_name,$ldap_dn,$ldap_filter);
$schema_search = @ldap_read($this->connect($method),$ldap_dn,$ldap_filter, $schema_search = @ldap_read($this->connect($method),$ldap_dn,$ldap_filter,
@ -1259,17 +1307,17 @@ class ldap 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) if (DEBUG_ENABLED)
debug_log('Search returned [%s]',24,__FILE__,__LINE__,__METHOD__,$schema_entries); 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) if (DEBUG_ENABLED)
debug_log('Found schema with filter of (%s)',24,__FILE__,__LINE__,__METHOD__,$ldap_filter); debug_log('Found schema with filter of (%s)',24,0,__FILE__,__LINE__,__METHOD__,$ldap_filter);
break; break;
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Didnt find schema with filter (%s)',24,__FILE__,__LINE__,__METHOD__,$ldap_filter); 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;
@ -1285,7 +1333,7 @@ class ldap extends DS {
* 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) if (DEBUG_ENABLED)
debug_log('Attempting to find schema with scope (%s), filter (objectClass=*) and a blank base.',24,__FILE__,__LINE__,__METHOD__, debug_log('Attempting to find schema with scope (%s), filter (objectClass=*) and a blank base.',24,0,__FILE__,__LINE__,__METHOD__,
$ldap_scope); $ldap_scope);
switch ($ldap_scope) { switch ($ldap_scope) {
@ -1303,17 +1351,17 @@ class ldap 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) if (DEBUG_ENABLED)
debug_log('Search returned [%s]',24,__FILE__,__LINE__,__METHOD__,$schema_entries); 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) if (DEBUG_ENABLED)
debug_log('Found schema with filter of (%s)',24,__FILE__,__LINE__,__METHOD__,'(objectClass=*)'); debug_log('Found schema with filter of (%s)',24,0,__FILE__,__LINE__,__METHOD__,'(objectClass=*)');
break; break;
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Didnt find schema with filter (%s)',24,__FILE__,__LINE__,__METHOD__,'(objectClass=*)'); 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;
@ -1333,7 +1381,7 @@ class ldap extends DS {
'type'=>'error')); 'type'=>'error'));
else else
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Returning because schema_search is NULL ()',25,__FILE__,__LINE__,__METHOD__); 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;
@ -1343,7 +1391,7 @@ class ldap extends DS {
if (! $schema_entries) { if (! $schema_entries) {
$return = false; $return = false;
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Returning false since ldap_get_entries() returned false.',25,__FILE__,__LINE__,__METHOD__,$return); debug_log('Returning false since ldap_get_entries() returned false.',25,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -1357,7 +1405,7 @@ class ldap extends DS {
$return = false; $return = false;
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Returning because (%s) isnt in the schema array. (%s)',25,__FILE__,__LINE__,__METHOD__,$schema_to_fetch,$return); debug_log('Returning because (%s) isnt in the schema array. (%s)',25,0,__FILE__,__LINE__,__METHOD__,$schema_to_fetch,$return);
return $return; return $return;
} }
@ -1374,7 +1422,7 @@ class ldap extends DS {
$this->_schema_entries[$schema_to_fetch] = $schema; $this->_schema_entries[$schema_to_fetch] = $schema;
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Returning (%s)',25,__FILE__,__LINE__,__METHOD__,$schema); debug_log('Returning (%s)',25,0,__FILE__,__LINE__,__METHOD__,$schema);
return $schema; return $schema;
} }
@ -1392,6 +1440,9 @@ class ldap 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);
@ -1402,8 +1453,7 @@ class ldap extends DS {
$return = $socs[$oclass_name]; $return = $socs[$oclass_name];
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (%s,%s), Returning (%s).',25,__FILE__,__LINE__,__METHOD__, debug_log('Returning (%s)',25,0,__FILE__,__LINE__,__METHOD__,$return);
$oclass_name,$dn,$return);
return $return; return $return;
} }
@ -1421,6 +1471,9 @@ class ldap 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);
@ -1431,8 +1484,7 @@ class ldap extends DS {
$return = $sattrs[$attr_name]; $return = $sattrs[$attr_name];
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (%s,%s), Returning (%s).',25,__FILE__,__LINE__,__METHOD__, debug_log('Returning (%s)',25,0,__FILE__,__LINE__,__METHOD__,$return);
$attr_name,$dn,$return);
return $return; return $return;
} }
@ -1451,15 +1503,15 @@ class ldap extends DS {
* @see getSchemaObjectClass * @see getSchemaObjectClass
*/ */
public function SchemaObjectClasses($method=null,$dn='') { public function SchemaObjectClasses($method=null,$dn='') {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',25,__FILE__,__LINE__,__METHOD__,$dn); 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) if (DEBUG_ENABLED)
debug_log('Returning CACHED [%s] (%s)',25,__FILE__,__LINE__,__METHOD__,$this->index,'objectclasses'); debug_log('Returning CACHED [%s] (%s)',25,0,__FILE__,__LINE__,__METHOD__,$this->index,'objectclasses');
return $return; return $return;
} }
@ -1491,7 +1543,7 @@ class ldap extends DS {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Returning (%s)',25,__FILE__,__LINE__,__METHOD__,$return); debug_log('Returning (%s)',25,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -1507,15 +1559,15 @@ class ldap 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',25,__FILE__,__LINE__,__METHOD__,$dn); 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) if (DEBUG_ENABLED)
debug_log('(): Returning CACHED [%s] (%s)',25,__FILE__,__LINE__,__METHOD__,$this->index,'attributes'); debug_log('(): Returning CACHED [%s] (%s)',25,0,__FILE__,__LINE__,__METHOD__,$this->index,'attributes');
return $return; return $return;
} }
@ -1676,7 +1728,7 @@ class ldap extends DS {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Returning (%s)',25,__FILE__,__LINE__,__METHOD__,$return); debug_log('Returning (%s)',25,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -1686,12 +1738,15 @@ class ldap 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) if (DEBUG_ENABLED)
debug_log('Returning CACHED [%s] (%s).',25,__FILE__,__LINE__,__METHOD__,$this->index,'matchingrules'); debug_log('Returning CACHED [%s] (%s).',25,0,__FILE__,__LINE__,__METHOD__,$this->index,'matchingrules');
return $return; return $return;
} }
@ -1749,7 +1804,7 @@ class ldap extends DS {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (%s), Returning (%s).',25,__FILE__,__LINE__,__METHOD__,$dn,$return); debug_log('Returning (%s)',25,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -1759,12 +1814,15 @@ class ldap 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) if (DEBUG_ENABLED)
debug_log('Returning CACHED [%s] (%s).',25,__FILE__,__LINE__,__METHOD__,$this->index,'syntaxes'); debug_log('Returning CACHED [%s] (%s).',25,0,__FILE__,__LINE__,__METHOD__,$this->index,'syntaxes');
return $return; return $return;
} }
@ -1795,7 +1853,7 @@ class ldap extends DS {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (%s), Returning (%s).',25,__FILE__,__LINE__,__METHOD__,$dn,$return); debug_log('Returning (%s)',25,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -1808,8 +1866,8 @@ class ldap extends DS {
* otherwise. * otherwise.
*/ */
function isForceMay($attr_name) { function isForceMay($attr_name) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',17,__FILE__,__LINE__,__METHOD__,$attr_name); 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);
} }
@ -1843,9 +1901,8 @@ class ldap 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s,%s)',17,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$dn,$attr,$method,$deref);
# Ensure our attr is in lowercase # Ensure our attr is in lowercase
$attr = strtolower($attr); $attr = strtolower($attr);
@ -1898,8 +1955,8 @@ class ldap 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s,%s)',17,__FILE__,__LINE__,__METHOD__,$dn,$method,$deref,$attrs); debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
static $CACHE; static $CACHE;
@ -1914,12 +1971,11 @@ class ldap extends DS {
$cacheindex = '*'; $cacheindex = '*';
if (! is_null($cacheindex) && isset($CACHE[$this->index][$method][$dn][$cacheindex])) { if (! is_null($cacheindex) && isset($CACHE[$this->index][$method][$dn][$cacheindex])) {
if (DEBUG_ENABLED)
debug_log('Entered with (%s,%s,%s,%s), Returning CACHED (%s)',17,__FILE__,__LINE__,__METHOD__,
$dn,$method,$deref,$attrs,$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);
@ -1957,8 +2013,8 @@ class ldap extends DS {
* @return boolean * @return boolean
*/ */
function isDNAttr($attr_name,$method=null) { function isDNAttr($attr_name,$method=null) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',17,__FILE__,__LINE__,__METHOD__,$attr_name); debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
# Simple test first # Simple test first
$dn_attrs = array('aliasedObjectName'); $dn_attrs = array('aliasedObjectName');
@ -1998,8 +2054,8 @@ class ldap extends DS {
* @see draw_jpeg_photo * @see draw_jpeg_photo
*/ */
function isJpegPhoto($attr_name) { function isJpegPhoto($attr_name) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',17,__FILE__,__LINE__,__METHOD__,$attr_name); 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'))
@ -2029,8 +2085,8 @@ class ldap extends DS {
* @return boolean * @return boolean
*/ */
function isAttrBoolean($attr_name) { function isAttrBoolean($attr_name) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',17,__FILE__,__LINE__,__METHOD__,$attr_name); 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;
@ -2055,8 +2111,8 @@ class ldap extends DS {
* @see isJpegPhoto * @see isJpegPhoto
*/ */
function isAttrBinary($attr_name) { function isAttrBinary($attr_name) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',17,__FILE__,__LINE__,__METHOD__,$attr_name); 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.
@ -2139,8 +2195,8 @@ class ldap extends DS {
* @return bool true|false * @return bool true|false
*/ */
function userIsMember($user,$group) { function userIsMember($user,$group) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',17,__FILE__,__LINE__,__METHOD__,$user,$group); debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$user = strtolower($user); $user = strtolower($user);
$group = $this->getDNAttrValues($group); $group = $this->getDNAttrValues($group);
@ -2170,8 +2226,8 @@ class ldap 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',17,__FILE__,__LINE__,__METHOD__,$dn); debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$dn = trim(strtolower($dn)); $dn = trim(strtolower($dn));
@ -2180,7 +2236,7 @@ class ldap extends DS {
foreach ($this->getValue('login','allowed_dns') as $login_allowed_dn) { foreach ($this->getValue('login','allowed_dns') as $login_allowed_dn) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Working through (%s)',80,__FILE__,__LINE__,__METHOD__,$login_allowed_dn); 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 ? */
@ -2195,7 +2251,7 @@ class ldap extends DS {
$results = $this->query($query,null); $results = $this->query($query,null);
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Search, Filter [%s], BaseDN [%s] Results [%s]',16,__FILE__,__LINE__,__METHOD__, debug_log('Search, Filter [%s], BaseDN [%s] Results [%s]',16,0,__FILE__,__LINE__,__METHOD__,
$query['filter'],$query['base'],$results); $query['filter'],$query['base'],$results);
if ($results) { if ($results) {
@ -2209,7 +2265,7 @@ class ldap 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) if (DEBUG_ENABLED)
debug_log('Comparing with [%s]',80,__FILE__,__LINE__,__METHOD__,$result_dn); 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)

View File

@ -138,8 +138,8 @@ class ldap_pla extends ldap {
* @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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with ()',17,__FILE__,__LINE__,__METHOD__); 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;
@ -161,13 +161,16 @@ class ldap_pla extends ldap {
* @return boolean * @return boolean
*/ */
function isLoginAttrEnabled() { function isLoginAttrEnabled() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ((strcasecmp($this->getLoginAttr(),'dn') != 0) && trim($this->getLoginAttr())) if ((strcasecmp($this->getLoginAttr(),'dn') != 0) && trim($this->getLoginAttr()))
$return = true; $return = true;
else else
$return = false; $return = false;
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (), Returning (%s)',17,__FILE__,__LINE__,__METHOD__,$return); debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -183,8 +186,8 @@ class ldap_pla extends ldap {
* @return boolean * @return boolean
*/ */
function isLoginStringEnabled() { function isLoginStringEnabled() {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('login_attr is [%s]',80,__FILE__,__LINE__,__METHOD__,$this->getLoginAttr()); debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! strcasecmp($this->getLoginAttr(),'string')) if (! strcasecmp($this->getLoginAttr(),'string'))
$return = true; $return = true;
@ -192,7 +195,7 @@ class ldap_pla extends ldap {
$return = false; $return = false;
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (), Returning (%s)',17,__FILE__,__LINE__,__METHOD__,$return); debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -208,8 +211,8 @@ class ldap_pla extends ldap {
* @return string|false * @return string|false
*/ */
function getLoginString() { function getLoginString() {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with ()',17,__FILE__,__LINE__,__METHOD__,__FILE__,__LINE__,__METHOD__); debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
return $this->login_string; return $this->login_string;
} }
@ -224,6 +227,9 @@ class ldap_pla extends ldap {
* @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;
@ -231,7 +237,7 @@ class ldap_pla extends ldap {
$return = $this->getValue('login','anon_bind'); $return = $this->getValue('login','anon_bind');
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (), Returning (%s)',17,__FILE__,__LINE__,__METHOD__,$return); debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -247,7 +253,8 @@ class ldap_pla extends ldap {
* @return boolean * @return boolean
*/ */
function isBranchRenameEnabled() { function isBranchRenameEnabled() {
debug_log('Entered with (), Returning (%s).',17,__FILE__,__LINE__,__METHOD__,$this->getValue('server','branch_rename')); 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');
} }
@ -271,6 +278,9 @@ class ldap_pla extends ldap {
* @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;
@ -303,7 +313,7 @@ class ldap_pla extends ldap {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (%s,%s), Returning (%s)',17,__FILE__,__LINE__,__METHOD__,$attr_name,$val,$return); debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -320,8 +330,8 @@ class ldap_pla extends ldap {
* @return boolean * @return boolean
*/ */
public function isAttrReadOnly($attr) { public function isAttrReadOnly($attr) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',17,__FILE__,__LINE__,__METHOD__,$attr); 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');
@ -353,8 +363,8 @@ class ldap_pla extends ldap {
* @return boolean * @return boolean
*/ */
public function isAttrHidden($attr) { public function isAttrHidden($attr) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',17,__FILE__,__LINE__,__METHOD__,$attr); 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');
@ -378,8 +388,8 @@ class ldap_pla extends ldap {
* Add objects * Add objects
*/ */
public function add($dn,$entry_array,$method=null) { public function add($dn,$entry_array,$method=null) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s)',17,__FILE__,__LINE__,__METHOD__,$dn,$entry_array,$method); 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);
@ -417,8 +427,8 @@ class ldap_pla extends ldap {
* Delete objects * Delete objects
*/ */
public function delete($dn,$method=null) { public function delete($dn,$method=null) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',17,__FILE__,__LINE__,__METHOD__,$dn,$method); debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$result = false; $result = false;
@ -443,8 +453,8 @@ class ldap_pla extends ldap {
* 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s,%s,%s)',17,__FILE__,__LINE__,__METHOD__,$dn,$new_rdn,$container,$deleteoldrdn,$method); debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$result = false; $result = false;
@ -470,8 +480,8 @@ class ldap_pla extends ldap {
* Modify objects * Modify objects
*/ */
public function modify($dn,$attrs,$method=null) { public function modify($dn,$attrs,$method=null) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s)',17,__FILE__,__LINE__,__METHOD__,$dn,$attrs,$method); 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))
@ -583,8 +593,8 @@ class ldap_pla extends ldap {
* @return boolean * @return boolean
*/ */
public function isAttrUnique($attr) { public function isAttrUnique($attr) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',17,__FILE__,__LINE__,__METHOD__,$attr); 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')))
@ -604,9 +614,8 @@ class ldap_pla extends ldap {
* @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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s)',17,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
$dn,$attrs);
# 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))))
@ -669,6 +678,9 @@ class ldap_pla extends ldap {
* 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

@ -54,9 +54,6 @@ if (file_exists(LIBDIR.'functions.custom.php'))
* Loads class definition * Loads class definition
*/ */
function __autoload($className) { function __autoload($className) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
debug_log('Call to autoload (%s)',1,__FILE__,__LINE__,__METHOD__,$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"))
@ -77,8 +74,8 @@ function __autoload($className) {
* $_GET, $_POST, or $_COOKIE. * $_GET, $_POST, or $_COOKIE.
*/ */
function array_stripslashes(&$array) { function array_stripslashes(&$array) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$array); 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))
@ -125,9 +122,8 @@ 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) if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$errno,$errstr,$file,$lineno);
/** /**
* error_reporting will be 0 if the error context occurred * error_reporting will be 0 if the error context occurred
@ -233,9 +229,6 @@ function app_version() {
$CACHE = 'UNKNOWN'; $CACHE = 'UNKNOWN';
} }
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
debug_log('Entered with (), Returning (%s)',1,__FILE__,__LINE__,__METHOD__,$CACHE);
return $CACHE; return $CACHE;
} }
@ -353,6 +346,9 @@ function check_config($config_file) {
* @return array * @return array
*/ */
function cmd_control_pane($type) { function cmd_control_pane($type) {
if (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(
@ -491,29 +487,25 @@ function debug_sysmsg($msg) {
* @param int Log bit number for this message. * @param int Log bit number for this message.
* @see syslog.php * @see syslog.php
*/ */
function debug_log($msg,$level=0) { function debug_log($msg,$level,$indent) {
global $debug_file; static $debug_file;
# Temporary, to catch when these are not set in the function arguments.
$file = __FILE__;
$line = __LINE__;
$method = __METHOD__;
# In case we are called before we are fully initialised or if debugging is not set. # In case we are called before we are fully initialised or if debugging is not set.
if (! isset($_SESSION[APPCONFIG]) || ! ($_SESSION[APPCONFIG]->getValue('debug','file') if (! isset($_SESSION[APPCONFIG]) ||
|| $_SESSION[APPCONFIG]->getValue('debug','syslog'))) ! ($_SESSION[APPCONFIG]->getValue('debug','file') || $_SESSION[APPCONFIG]->getValue('debug','syslog')))
return false; return;
$debug_level = $_SESSION[APPCONFIG]->getValue('debug','level'); $debug_level = $_SESSION[APPCONFIG]->getValue('debug','level');
if (! $debug_level || (! ($level & $debug_level))) if (! $debug_level || (! ($level & $debug_level)))
return; return;
$debugaddr = false;
if ($_SESSION[APPCONFIG]->getValue('debug','addr')) if ($_SESSION[APPCONFIG]->getValue('debug','addr'))
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] == $_SESSION[APPCONFIG]->getValue('debug','addr')) if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] == $_SESSION[APPCONFIG]->getValue('debug','addr'))
$debugaddr = true; $debugaddr = true;
elseif ($_SERVER['REMOTE_ADDR'] == $_SESSION[APPCONFIG]->getValue('debug','addr')) elseif ($_SERVER['REMOTE_ADDR'] == $_SESSION[APPCONFIG]->getValue('debug','addr'))
$debugaddr = true; $debugaddr = true;
else
$debugaddr = false;
else else
$debugaddr = true; $debugaddr = true;
@ -522,36 +514,51 @@ function debug_log($msg,$level=0) {
return; return;
# If we are limiting debug to a browser, then check that # If we are limiting debug to a browser, then check that
$caller = basename( $_SERVER['PHP_SELF'] ); $caller = basename($_SERVER['PHP_SELF']);
if (func_num_args() > 2) { $args = func_get_args();
$args = func_get_args(); # Discard our first three arguments.
array_shift($args); array_shift($args);
array_shift($args); array_shift($args);
array_shift($args);
# This is temporary, until we change all the debug_log statements. # Pull the file/line/method
if (is_string($args[0]) && preg_match('/.php$/',$args[0])) { if (is_string($args[0]) && preg_match('/.php$/',$args[0])) {
$file = array_shift($args); $file = preg_replace('/.php$/','',array_shift($args));
$line = array_shift($args); $line = array_shift($args);
$method = array_shift($args); $method = array_shift($args);
}
$fargs = array(); } else {
foreach ($args as $key) { $file = 'UNKNOWN';
if (is_array($key) || is_object($key)) $line = 'UNKNOWN';
array_push($fargs,serialize($key)); $method = 'UNKNOWN';
else
array_push($fargs,$key);
}
$msg = vsprintf($msg, array_values($fargs));
} }
# TEMP: New debuglog format
if (preg_match('/%%/',$msg) && $args[0] != 'NOARGS')
$args = array_shift($args);
$fargs = array();
foreach ($args as $key) {
if (is_array($key))
array_push($fargs,serialize($key));
elseif (is_object($key))
array_push($fargs,sprintf('OBJECT:%s',get_class($key)));
else
array_push($fargs,$key);
}
if (preg_match('/%%/',$msg))
$msg = preg_replace('/%%/',join('|',$fargs),$msg);
else
$msg = vsprintf($msg,array_values($fargs));
if (function_exists('stopwatch')) if (function_exists('stopwatch'))
$timer = stopwatch(); $timer = stopwatch();
else else
$timer = null; $timer = null;
$debug_message = sprintf('[%2.3f] %3s-%s(%04s): %s: %s',$timer,$level,basename($file),$line,$method,substr($msg,0,200)); $debug_message = sprintf('[%2.3f] %15s(%04s-%03s): %s%s: %s',$timer,basename($file),$line,$level,str_repeat('.',$indent),$method,substr($msg,0,200));
if ($debug_file || $_SESSION[APPCONFIG]->getValue('debug','file')) { if ($debug_file || $_SESSION[APPCONFIG]->getValue('debug','file')) {
if (! $debug_file) if (! $debug_file)
@ -732,9 +739,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$data,$secret);
# 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))
@ -772,9 +778,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$encdata,$secret);
# This cache gives major speed up for stupid callers :) # This cache gives major speed up for stupid callers :)
static $CACHE = array(); static $CACHE = array();
@ -817,9 +822,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$input,$pad_length,$pad_string,$pad_type);
$str = ''; $str = '';
$length = $pad_length - strlen($input); $length = $pad_length - strlen($input);
@ -853,22 +857,18 @@ 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;
# 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) && isset($_SESSION['cache'][$index][$item][$subitem]))
if (isset($_SESSION['cache'][$index][$item][$subitem])) { $return = $_SESSION['cache'][$index][$item][$subitem];
if (DEBUG_ENABLED)
debug_log('Returning SESSION cached [%s] (%s)',1,__FILE__,__LINE__,__METHOD__,
$item,$subitem);
$return = $_SESSION['cache'][$index][$item][$subitem];
}
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (%s,%s,%s), Returning (%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
$index,$item,$subitem,$return);
return $return; return $return;
} }
@ -879,9 +879,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$index,$item,$subitem,$data);
# 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)) {
@ -889,6 +888,7 @@ function set_cached_item($index,$item,$subitem='null',$data) {
$CACHE[$index][$item][$subitem] = $data; $CACHE[$index][$item][$subitem] = $data;
$_SESSION['cache'][$index][$item][$subitem] = $data; $_SESSION['cache'][$index][$item][$subitem] = $data;
return true; return true;
} else } else
@ -899,11 +899,10 @@ 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') {
global $CACHE; if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (DEBUG_ENABLED) global $CACHE;
debug_log('Entered with (%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__,
$index,$item,$subitem);
# Check config to make sure session-based caching is enabled. # Check config to make sure session-based caching is enabled.
if (isset($_SESSION['cache'][$index][$item][$subitem])) if (isset($_SESSION['cache'][$index][$item][$subitem]))
@ -925,6 +924,9 @@ 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;
@ -942,8 +944,7 @@ function set_cookie($name,$val,$expire=null,$dir=null) {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (%s,%s,%s,%s), Returning (%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
$name,$val,$expire,$dir,$return);
return $return; return $return;
} }
@ -958,6 +959,9 @@ 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);
@ -967,8 +971,7 @@ function get_custom_file($index,$filename,$path) {
$return = $path.$custom.$filename; $return = $path.$custom.$filename;
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (%s,%s,%s), Returning (%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
$index,$filename,$path,$return);
return $return; return $return;
} }
@ -982,9 +985,8 @@ 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 (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$data,$sortby,$rev);
# if the array to sort is null or empty # if the array to sort is null or empty
if (! $data) return; if (! $data) return;
@ -1097,6 +1099,9 @@ 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;
@ -1107,8 +1112,7 @@ function obfuscate_password_display($enc=null) {
$return = false; $return = false;
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (%s), Returning (%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
$enc,$return);
return $return; return $return;
} }
@ -1124,8 +1128,8 @@ function obfuscate_password_display($enc=null) {
* @return string * @return string
*/ */
function pretty_print_dn($dn) { function pretty_print_dn($dn) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$dn); 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);
@ -1157,8 +1161,8 @@ function pretty_print_dn($dn) {
* @return boolean * @return boolean
*/ */
function is_dn_string($str) { function is_dn_string($str) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$str); 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" */
@ -1194,8 +1198,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$str); 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-]+)*$/";
@ -1212,8 +1216,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$str); debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$url_regex = '/^(ftp|https?):\/\/+[\w\.\-\/\?\=\&]*\w+/'; $url_regex = '/^(ftp|https?):\/\/+[\w\.\-\/\?\=\&]*\w+/';
@ -1255,8 +1259,8 @@ function is_url_string($str) {
* @return int * @return int
*/ */
function pla_compare_dns($dn1,$dn2) { function pla_compare_dns($dn1,$dn2) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',1,__FILE__,__LINE__,__METHOD__,$dn1,$dn2); 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))
@ -1354,9 +1358,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$base,$attr,$increment,$filter);
$server = $_SESSION[APPCONFIG]->getServer(get_request('server_id','REQUEST')); $server = $_SESSION[APPCONFIG]->getServer(get_request('server_id','REQUEST'));
$attr = strtolower($attr); $attr = strtolower($attr);
@ -1550,8 +1553,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$dn); debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $_SESSION[APPCONFIG]->getServer($server_id); $server = $_SESSION[APPCONFIG]->getServer($server_id);
@ -1731,9 +1734,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$base,$sub_dn);
$empty_str = (is_null($sub_dn) || (($len=strlen(trim($sub_dn))) == 0)); $empty_str = (is_null($sub_dn) || (($len=strlen(trim($sub_dn))) == 0));
@ -1758,8 +1760,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$length); debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$possible = '0123456789'. $possible = '0123456789'.
'abcdefghijklmnopqrstuvwxyz'. 'abcdefghijklmnopqrstuvwxyz'.
@ -1784,8 +1786,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__,$dn,$include_attrs,$decode); debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (is_null($dn)) if (is_null($dn))
return null; return null;
@ -1806,6 +1808,9 @@ 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);
@ -1839,8 +1844,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$key); debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
static $CACHE = array(); static $CACHE = array();
@ -1891,10 +1896,11 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$key); debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
static $CACHE = array(); static $CACHE = array();
$unknown = array(); $unknown = array();
$unknown['desc'] = 'We have no description for this OID, if you know what this OID provides, please let us know. Please also include an RFC reference if it is available.'; $unknown['desc'] = 'We have no description for this OID, if you know what this OID provides, please let us know. Please also include an RFC reference if it is available.';
$unknown['title'] = 'Can you help with this OID info?'; $unknown['title'] = 'Can you help with this OID info?';
@ -1937,6 +1943,9 @@ 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));
@ -1979,9 +1988,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s,%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
is_object($server),$dn,$attr_name,$index,$draw_delete_buttons,$img_html_attrs);
$fixed = array(); $fixed = array();
$fixed['width'] = isset($options['fixed_width']) ? $options['fixed_width'] : false; $fixed['width'] = isset($options['fixed_width']) ? $options['fixed_width'] : false;
@ -2078,6 +2086,9 @@ 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(
'blowfish', 'blowfish',
'clear', 'clear',
@ -2100,9 +2111,8 @@ function password_types() {
* @return string The hashed password. * @return string The hashed password.
*/ */
function password_hash($password_clear,$enc_type) { function password_hash($password_clear,$enc_type) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$password_clear,$enc_type);
$enc_type = strtolower($enc_type); $enc_type = strtolower($enc_type);
@ -2197,9 +2207,8 @@ function 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) { function password_check($cryptedpassword,$plainpassword) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$cryptedpassword,$plainpassword);
if (preg_match('/{([^}]+)}(.*)/',$cryptedpassword,$matches)) { if (preg_match('/{([^}]+)}(.*)/',$cryptedpassword,$matches)) {
$cryptedpassword = $matches[2]; $cryptedpassword = $matches[2];
@ -2344,8 +2353,8 @@ function password_check($cryptedpassword,$plainpassword) {
* @return string * @return string
*/ */
function get_enc_type($user_password) { function get_enc_type($user_password) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$user_password); 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;
@ -2383,9 +2392,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$form_element,$include_choose_text,$rdn);
if ($rdn == 'none') if ($rdn == 'none')
$href = sprintf("javascript:dnChooserPopup('%s','');",$form_element); $href = sprintf("javascript:dnChooserPopup('%s','');",$form_element);
@ -2419,14 +2427,14 @@ 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) {
global $CACHE; if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (DEBUG_ENABLED) global $CACHE;
debug_log('Entered with (%s,%s)',1,__FILE__,__LINE__,__METHOD__,$dn,$with_attributes);
if (isset($CACHE['explode'][$dn][$with_attributes])) { if (isset($CACHE['explode'][$dn][$with_attributes])) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Return CACHED result (%s) for (%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Return CACHED result (%s) for (%s)',1,0,__FILE__,__LINE__,__METHOD__,
$CACHE['explode'][$dn][$with_attributes],$dn); $CACHE['explode'][$dn][$with_attributes],$dn);
return $CACHE['explode'][$dn][$with_attributes]; return $CACHE['explode'][$dn][$with_attributes];
@ -2439,7 +2447,7 @@ function pla_explode_dn($dn,$with_attributes=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) if (DEBUG_ENABLED)
debug_log('Returning NULL - NO result.',1,__FILE__,__LINE__,__METHOD__); debug_log('Returning NULL - NO result.',1,0,__FILE__,__LINE__,__METHOD__);
return array(); return array();
} }
@ -2458,8 +2466,7 @@ function pla_explode_dn($dn,$with_attributes=0) {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (%s,%s), Returning (%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$result[$with_attributes]);
$dn,$with_attributes,$result[$with_attributes]);
return $result[$with_attributes]; return $result[$with_attributes];
} }
@ -2468,6 +2475,9 @@ 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.
@ -2477,7 +2487,7 @@ 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) if (DEBUG_ENABLED)
debug_log('Entered with (%s), Returning (%s)',1,__FILE__,__LINE__,__METHOD__,$olddn,$dn); debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$dn);
return $dn; return $dn;
} }
@ -2486,12 +2496,17 @@ 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();
foreach ($dn as $key => $rdn) {
foreach ($dn as $key => $rdn)
$a[$key] = preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$rdn); $a[$key] = preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$rdn);
}
return $a; return $a;
} else { } else {
return preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$dn); return preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$dn);
} }
@ -2569,9 +2584,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$array,$exclude_vars,$url_encode_ampersands);
if (! is_array($array) || ! count($array)) if (! is_array($array) || ! count($array))
return ''; return '';
@ -2617,8 +2631,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$dn); 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))));
} }
@ -2627,8 +2641,8 @@ function pla_reverse_dn($dn) {
* Attribute sorting * Attribute sorting
*/ */
function sortAttrs($a,$b) { function sortAttrs($a,$b) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',1,__FILE__,__LINE__,__METHOD__,$a,$b); debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if ($a == $b) if ($a == $b)
return 0; return 0;
@ -2665,8 +2679,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$array); debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! is_array($array)) if (! is_array($array))
return $array; return $array;
@ -2686,8 +2700,8 @@ function arrayLower($array) {
* @return boolean True if its there, false if its not. * @return boolean True if its there, false if its not.
*/ */
function in_array_ignore_case($needle,$haystack) { function in_array_ignore_case($needle,$haystack) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s)',1,__FILE__,__LINE__,__METHOD__,$needle,$haystack); debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! is_array($haystack)) if (! is_array($haystack))
return false; return false;
@ -2705,7 +2719,7 @@ function in_array_ignore_case($needle,$haystack) {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (%s,%s), Returning (%s)',1,__FILE__,__LINE__,__METHOD__,$needle,$haystack,$return); debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -2714,11 +2728,10 @@ function in_array_ignore_case($needle,$haystack) {
* 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) {
$dn = $entry->getDn(); if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (DEBUG_ENABLED) $dn = $entry->getDn();
debug_log('Entered with (%s,%s)',1,__FILE__,__LINE__,__METHOD__,
$server->getIndex(),$dn);
$formats = $_SESSION[APPCONFIG]->getValue('appearance','tree_display_format'); $formats = $_SESSION[APPCONFIG]->getValue('appearance','tree_display_format');
@ -2728,7 +2741,7 @@ function draw_formatted_dn($server,$entry) {
$tokens = $tokens[0]; $tokens = $tokens[0];
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('The tokens are (%s)',1,__FILE__,__LINE__,__METHOD__,$tokens); 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)
@ -2773,9 +2786,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$selected,$logged_on,$name,$js);
$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);
@ -2812,8 +2824,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$hex); debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$result = ''; $result = '';
@ -2824,8 +2836,8 @@ function littleEndian($hex) {
} }
function binSIDtoText($binsid) { function binSIDtoText($binsid) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$binsid); 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
@ -2855,9 +2867,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s,%s,%s,%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server->getIndex(),$base,$filter,$key,$attrs,$sort);
$server = $_SESSION[APPCONFIG]->getServer(get_request('server_id','REQUEST')); $server = $_SESSION[APPCONFIG]->getServer(get_request('server_id','REQUEST'));
$key = strtolower($key); $key = strtolower($key);
@ -2899,6 +2910,9 @@ 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');
@ -2964,7 +2978,8 @@ function password_generate() {
$return = implode('',$outarray); $return = implode('',$outarray);
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (), Returning (%s)',1,__FILE__,__LINE__,__METHOD__,$return); debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
return $return; return $return;
} }
@ -2977,6 +2992,9 @@ 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();
@ -3000,8 +3018,7 @@ function a_array_rand($input,$num_req) {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Entered with (%s,%s), Returning (%s)',1,__FILE__,__LINE__,__METHOD__, debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$return);
$input,$num_req,$return);
return $return; return $return;
} }
@ -3030,6 +3047,9 @@ 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

@ -34,6 +34,9 @@
* 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 );
} }
@ -49,16 +52,14 @@ 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 (DEBUG_ENABLED) if (! count($hooks) || ! array_key_exists($hook_name,$hooks)) {
debug_log('Running HOOK (%s,%s)',257,__FILE__,__LINE__,__METHOD__,
$hook_name,$args);
if (! array_key_exists($hook_name,$hooks)) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Returning, HOOK not defined (%s)',257,__FILE__,__LINE__,__METHOD__, debug_log('Returning, HOOK not defined (%s)',257,0,__FILE__,__LINE__,__METHOD__,$hook_name);
$hook_name);
return true; return true;
} }
@ -71,14 +72,14 @@ function run_hook($hook_name,$args) {
* numerical weight. */ * numerical weight. */
while (list($key,$hook) = each($hooks[$hook_name])) { while (list($key,$hook) = each($hooks[$hook_name])) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Calling HOOK Function (%s)(%s)',257,__FILE__,__LINE__,__METHOD__, debug_log('Calling HOOK Function (%s)(%s)',257,0,__FILE__,__LINE__,__METHOD__,
$hook['hook_function'],$args); $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) if (DEBUG_ENABLED)
debug_log('Called HOOK Function (%s)',257,__FILE__,__LINE__,__METHOD__, debug_log('Called HOOK Function (%s)',257,0,__FILE__,__LINE__,__METHOD__,
$hook['hook_function']); $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
@ -87,7 +88,7 @@ function run_hook($hook_name,$args) {
* order. */ * order. */
if (! is_null($result) && $result == false) { if (! is_null($result) && $result == false) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('HOOK Function [%s] return (%s)',257,__FILE__,__LINE__,__METHOD__, debug_log('HOOK Function [%s] return (%s)',257,0,__FILE__,__LINE__,__METHOD__,
$hook['hook_function'],$result); $hook['hook_function'],$result);
while ($rollbacks) { while ($rollbacks) {
@ -95,7 +96,7 @@ function run_hook($hook_name,$args) {
if ($rollback != false) { if ($rollback != false) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('HOOK Function Rollback (%s)',257,__FILE__,__LINE__,__METHOD__, debug_log('HOOK Function Rollback (%s)',257,0,__FILE__,__LINE__,__METHOD__,
$rollback); $rollback);
call_user_func_array($rollback,$args); call_user_func_array($rollback,$args);
@ -118,6 +119,9 @@ 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 (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(
@ -151,6 +155,9 @@ 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 (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]);
@ -171,6 +178,9 @@ 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

@ -28,8 +28,8 @@ class page {
protected $_default; protected $_default;
public function __construct($index=null) { public function __construct($index=null) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with [%s]',129,__FILE__,__LINE__,__METHOD__,$index); 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'))
@ -69,7 +69,7 @@ class page {
header('Content-Encoding: gzip'); header('Content-Encoding: gzip');
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Sent COMPRESSED header to browser and discarded (%s)',129,__FILE__,__LINE__,__METHOD__,$preOutput); debug_log('Sent COMPRESSED header to browser and discarded (%s)',129,0,__FILE__,__LINE__,__METHOD__,$preOutput);
} }
if (isset($_SESSION[APPCONFIG]) if (isset($_SESSION[APPCONFIG])
@ -91,13 +91,16 @@ class page {
/* Add to the HTML Header */ /* Add to the HTML Header */
public function head_add($html) { public function head_add($html) {
if (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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with ()',129,__FILE__,__LINE__,__METHOD__); 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)
@ -138,8 +141,8 @@ class page {
} }
private function head_print() { private function head_print() {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with ()',129,__FILE__,__LINE__,__METHOD__); 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') : '';
@ -174,8 +177,8 @@ class page {
} }
private function control_print() { private function control_print() {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with ()',129,__FILE__,__LINE__,__METHOD__); 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>';
@ -202,8 +205,8 @@ class page {
} }
protected function tree() { protected function tree() {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with ()',129,__FILE__,__LINE__,__METHOD__); debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! isset($_SESSION[APPCONFIG])) if (! isset($_SESSION[APPCONFIG]))
return; return;
@ -231,6 +234,9 @@ class page {
} }
public function block_add($side,$object) { public function block_add($side,$object) {
if (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)));
@ -238,8 +244,8 @@ class page {
} }
private function block_print($side) { private function block_print($side) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with ()',129,__FILE__,__LINE__,__METHOD__); debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! isset($this->_block[$side])) if (! isset($this->_block[$side]))
return; return;
@ -251,8 +257,8 @@ class page {
} }
private function sysmsg() { private function sysmsg() {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with ()',129,__FILE__,__LINE__,__METHOD__); 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) {
@ -289,8 +295,8 @@ class page {
} }
private function body($raw=false) { private function body($raw=false) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with ()',129,__FILE__,__LINE__,__METHOD__); 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'])) {
@ -313,8 +319,8 @@ class page {
} }
private function footer_print() { private function footer_print() {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with ()',129,__FILE__,__LINE__,__METHOD__); 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;',
@ -326,8 +332,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',129,__FILE__,__LINE__,__METHOD__,$compress); 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()) {
@ -353,7 +359,7 @@ class page {
ob_end_clean(); ob_end_clean();
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Sending COMPRESSED output to browser[(%s),%s]',129,__FILE__,__LINE__,__METHOD__, debug_log('Sending COMPRESSED output to browser[(%s),%s]',129,0,__FILE__,__LINE__,__METHOD__,
strlen($output),$output); strlen($output),$output);
print gzencode($output); print gzencode($output);
@ -361,8 +367,8 @@ class page {
} }
public function display($filter=array()) { public function display($filter=array()) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with [%s]',129,__FILE__,__LINE__,__METHOD__,$filter); debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
# Control what is displayed. # Control what is displayed.
$display = array( $display = array(
@ -431,7 +437,7 @@ class page {
ob_end_clean(); ob_end_clean();
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Sending COMPRESSED output to browser[(%s),%s]',129,__FILE__,__LINE__,__METHOD__, debug_log('Sending COMPRESSED output to browser[(%s),%s]',129,0,__FILE__,__LINE__,__METHOD__,
strlen($output),$output); strlen($output),$output);
print gzencode($output); print gzencode($output);
@ -439,8 +445,8 @@ class page {
} }
public function setsysmsg($data) { public function setsysmsg($data) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with [%s]',129,__FILE__,__LINE__,__METHOD__,$data); debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! is_array($data)) if (! is_array($data))
return; return;
@ -467,9 +473,6 @@ class block {
private $body; private $body;
private $foot; private $foot;
public function __construct() {
}
public function setTitle($html) { public function setTitle($html) {
$this->title = $html; $this->title = $html;
} }

View File

@ -29,18 +29,30 @@ 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,0,__FILE__,__LINE__,__METHOD__,$fargs);
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;
} }
@ -48,6 +60,9 @@ 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;
} }
@ -58,6 +73,9 @@ 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;
} }
} }
@ -90,8 +108,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',9,__FILE__,__LINE__,__METHOD__,$class); 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');
@ -136,7 +154,7 @@ class ObjectClass extends SchemaItem {
$this->name = preg_replace('/\'$/','',$this->name); $this->name = preg_replace('/\'$/','',$this->name);
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Case NAME returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->name); debug_log('Case NAME returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->name);
break; break;
case 'DESC': case 'DESC':
@ -150,14 +168,14 @@ class ObjectClass extends SchemaItem {
} while (! preg_match('/\'$/s',$strings[$i])); } while (! preg_match('/\'$/s',$strings[$i]));
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Case DESC returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->description); 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) if (DEBUG_ENABLED)
debug_log('Case OBSOLETE returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->is_obsolete); debug_log('Case OBSOLETE returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->is_obsolete);
break; break;
case 'SUP': case 'SUP':
@ -176,28 +194,28 @@ class ObjectClass extends SchemaItem {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Case SUP returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->sup_classes); 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) if (DEBUG_ENABLED)
debug_log('Case ABSTRACT returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->type); 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) if (DEBUG_ENABLED)
debug_log('Case STRUCTURAL returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->type); 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) if (DEBUG_ENABLED)
debug_log('Case AUXILIARY returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->type); debug_log('Case AUXILIARY returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->type);
break; break;
case 'MUST': case 'MUST':
@ -206,7 +224,7 @@ class ObjectClass extends SchemaItem {
$i = $this->parseList(++$i,$strings,$attrs); $i = $this->parseList(++$i,$strings,$attrs);
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('parseList returned %d (%s)',8,__FILE__,__LINE__,__METHOD__,$i,$attrs); 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);
@ -220,7 +238,7 @@ class ObjectClass extends SchemaItem {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Case MUST returned (%s) (%s)',8,__FILE__,__LINE__,__METHOD__,$this->must_attrs,$this->force_may); debug_log('Case MUST returned (%s) (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->must_attrs,$this->force_may);
break; break;
case 'MAY': case 'MAY':
@ -229,7 +247,7 @@ class ObjectClass extends SchemaItem {
$i = $this->parseList(++$i,$strings,$attrs); $i = $this->parseList(++$i,$strings,$attrs);
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('parseList returned %d (%s)',8,__FILE__,__LINE__,__METHOD__,$i,$attrs); 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);
@ -237,7 +255,7 @@ class ObjectClass extends SchemaItem {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Case MAY returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->may_attrs); debug_log('Case MAY returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->may_attrs);
break; break;
default: default:
@ -245,7 +263,7 @@ class ObjectClass extends SchemaItem {
$this->setOID($strings[$i]); $this->setOID($strings[$i]);
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Case default returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->getOID()); debug_log('Case default returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->getOID());
} }
break; break;
} }
@ -255,7 +273,7 @@ class ObjectClass extends SchemaItem {
$this->description = preg_replace("/\'$/",'',$this->description); $this->description = preg_replace("/\'$/",'',$this->description);
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Returning () - NAME (%s), DESCRIPTION (%s), MUST (%s), MAY (%s), FORCE MAY (%s)',9,__FILE__,__LINE__,__METHOD__, 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); $this->name,$this->description,$this->must_attrs,$this->may_attrs,$this->force_may);
} }
@ -263,14 +281,15 @@ class ObjectClass extends SchemaItem {
* 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)
* The last token can therefore be a ) or NAME) * The last token can therefore be a ) or NAME)
* The last token may be terminate by more than one bracket * The last token may be terminate by more than one bracket
*/ */
if (DEBUG_ENABLED)
debug_log('Entered with (%d,%s,%s)',9,__FILE__,__LINE__,__METHOD__,$i,$strings,$attrs);
$string = $strings[$i]; $string = $strings[$i];
if (! preg_match('/^\(/',$string)) { if (! preg_match('/^\(/',$string)) {
@ -317,7 +336,7 @@ class ObjectClass extends SchemaItem {
sort($attrs); sort($attrs);
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Returning (%d,[%s],[%s])',9,__FILE__,__LINE__,__METHOD__,$i,$strings,$attrs); debug_log('Returning (%d,[%s],[%s])',9,0,__FILE__,__LINE__,__METHOD__,$i,$strings,$attrs);
return $i; return $i;
} }
@ -326,6 +345,9 @@ 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();
@ -359,8 +381,8 @@ class ObjectClass extends SchemaItem {
* @see getMayAttrNames * @see getMayAttrNames
*/ */
public function getMustAttrs($parents=false) { public function getMustAttrs($parents=false) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',9,__FILE__,__LINE__,__METHOD__,$parents); debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! $parents) if (! $parents)
return $this->must_attrs; return $this->must_attrs;
@ -401,8 +423,8 @@ class ObjectClass extends SchemaItem {
* @see AttributeType * @see AttributeType
*/ */
public function getMayAttrs($parents=false) { public function getMayAttrs($parents=false) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',9,__FILE__,__LINE__,__METHOD__,$parents); debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! $parents) if (! $parents)
return $this->may_attrs; return $this->may_attrs;
@ -428,6 +450,9 @@ 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;
} }
@ -447,8 +472,8 @@ class ObjectClass extends SchemaItem {
* @see getMayAttrNames * @see getMayAttrNames
*/ */
public function getMustAttrNames($parents=false) { public function getMustAttrNames($parents=false) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',9,__FILE__,__LINE__,__METHOD__,$parents); debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
$attr_names = array(); $attr_names = array();
@ -474,8 +499,8 @@ class ObjectClass extends SchemaItem {
* @see getMustAttrNames * @see getMustAttrNames
*/ */
public function getMayAttrNames($parents=false) { public function getMayAttrNames($parents=false) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',9,__FILE__,__LINE__,__METHOD__,$parents); debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
$attr_names = array(); $attr_names = array();
@ -493,8 +518,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',9,__FILE__,__LINE__,__METHOD__,$name); debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
$name = trim($name); $name = trim($name);
@ -511,6 +536,9 @@ 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;
} }
@ -520,6 +548,9 @@ 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;
} }
@ -529,6 +560,9 @@ 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;
@ -549,6 +583,9 @@ 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;
} }
@ -560,8 +597,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',9,__FILE__,__LINE__,__METHOD__,$attr); debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! is_array($attr) || ! count($attr)) if (! is_array($attr) || ! count($attr))
return; return;
@ -576,8 +613,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',9,__FILE__,__LINE__,__METHOD__,$attr); debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
if (! is_array($attr) || ! count($attr)) if (! is_array($attr) || ! count($attr))
return; return;
@ -589,6 +626,9 @@ 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;
@ -597,6 +637,9 @@ 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
@ -630,8 +673,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with name (%s), source (%s)',9,__FILE__,__LINE__,__METHOD__,$name,$source); debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
$this->name = $name; $this->name = $name;
$this->source = $source; $this->source = $source;
@ -639,11 +682,17 @@ class ObjectClass_ObjectClassAttribute {
# 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;
} }
} }
@ -691,8 +740,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',9,__FILE__,__LINE__,__METHOD__,$attr); 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);
@ -743,7 +792,7 @@ class AttributeType extends SchemaItem {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Case NAME returned (%s) (%s)',8,__FILE__,__LINE__,__METHOD__,$this->name,$this->aliases); debug_log('Case NAME returned (%s) (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->name,$this->aliases);
break; break;
case 'DESC': case 'DESC':
@ -756,14 +805,14 @@ class AttributeType extends SchemaItem {
} while (! preg_match("/\'$/s",$strings[$i])); } while (! preg_match("/\'$/s",$strings[$i]));
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Case DESC returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->description); 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) if (DEBUG_ENABLED)
debug_log('Case OBSOLETE returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->is_obsolete); debug_log('Case OBSOLETE returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->is_obsolete);
break; break;
case 'SUP': case 'SUP':
@ -771,7 +820,7 @@ class AttributeType extends SchemaItem {
$this->sup_attribute = $strings[$i]; $this->sup_attribute = $strings[$i];
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Case SUP returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->sup_attribute); debug_log('Case SUP returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->sup_attribute);
break; break;
case 'EQUALITY': case 'EQUALITY':
@ -779,7 +828,7 @@ class AttributeType extends SchemaItem {
$this->equality = $strings[$i]; $this->equality = $strings[$i];
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Case EQUALITY returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->equality); debug_log('Case EQUALITY returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->equality);
break; break;
case 'ORDERING': case 'ORDERING':
@ -787,7 +836,7 @@ class AttributeType extends SchemaItem {
$this->ordering = $strings[$i]; $this->ordering = $strings[$i];
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Case ORDERING returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->ordering); debug_log('Case ORDERING returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->ordering);
break; break;
case 'SUBSTR': case 'SUBSTR':
@ -795,7 +844,7 @@ class AttributeType extends SchemaItem {
$this->sub_str = $strings[$i]; $this->sub_str = $strings[$i];
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Case SUBSTR returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->sub_str); debug_log('Case SUBSTR returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->sub_str);
break; break;
case 'SYNTAX': case 'SYNTAX':
@ -817,28 +866,28 @@ class AttributeType extends SchemaItem {
} }
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Case SYNTAX returned (%s) (%s) (%s)',8,__FILE__,__LINE__,__METHOD__, debug_log('Case SYNTAX returned (%s) (%s) (%s)',8,0,__FILE__,__LINE__,__METHOD__,
$this->syntax,$this->syntax_oid,$this->max_length); $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) if (DEBUG_ENABLED)
debug_log('Case SINGLE-VALUE returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->is_single_value); 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) if (DEBUG_ENABLED)
debug_log('Case COLLECTIVE returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->is_collective); 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) if (DEBUG_ENABLED)
debug_log('Case NO-USER-MODIFICATION returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->is_no_user_modification); debug_log('Case NO-USER-MODIFICATION returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->is_no_user_modification);
break; break;
case 'USAGE': case 'USAGE':
@ -846,7 +895,7 @@ class AttributeType extends SchemaItem {
$this->usage = $strings[$i]; $this->usage = $strings[$i];
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Case USAGE returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->usage); debug_log('Case USAGE returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->usage);
break; break;
default: default:
@ -854,7 +903,7 @@ class AttributeType extends SchemaItem {
$this->setOID($strings[$i]); $this->setOID($strings[$i]);
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Case default returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->getOID()); debug_log('Case default returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->getOID());
} }
} }
} }
@ -871,7 +920,7 @@ class AttributeType extends SchemaItem {
$this->sup_attribute = preg_replace("/\'$/",'',$this->sup_attribute); $this->sup_attribute = preg_replace("/\'$/",'',$this->sup_attribute);
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Returning ()',9,__FILE__,__LINE__,__METHOD__); debug_log('Returning ()',9,0,__FILE__,__LINE__,__METHOD__);
} }
/** /**
@ -880,6 +929,9 @@ 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;
} }
@ -890,10 +942,10 @@ class AttributeType extends SchemaItem {
* @return string * @return string
*/ */
public function getSupAttribute() { public function getSupAttribute() {
if ($this->sup_attribute) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
return $this->sup_attribute; debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->sup_attribute);
else
return null; return $this->sup_attribute;
} }
/** /**
@ -902,6 +954,9 @@ 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;
} }
@ -911,6 +966,9 @@ 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;
} }
@ -920,6 +978,9 @@ 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;
} }
@ -930,6 +991,9 @@ 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;
} }
@ -940,8 +1004,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',9,__FILE__,__LINE__,__METHOD__,$attr_name); 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)
@ -956,6 +1020,9 @@ 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;
} }
@ -968,6 +1035,9 @@ 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;
} }
@ -977,6 +1047,9 @@ 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;
} }
@ -987,6 +1060,9 @@ 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;
} }
@ -996,6 +1072,9 @@ 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;
} }
@ -1005,6 +1084,9 @@ 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;
} }
@ -1014,6 +1096,9 @@ 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;
} }
@ -1023,6 +1108,9 @@ 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;
} }
@ -1034,8 +1122,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',9,__FILE__,__LINE__,__METHOD__,$remove_alias_name); debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
foreach ($this->aliases as $i => $alias_name) { foreach ($this->aliases as $i => $alias_name) {
@ -1055,6 +1143,9 @@ 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);
} }
@ -1064,6 +1155,9 @@ 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;
} }
@ -1073,6 +1167,9 @@ 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;
} }
@ -1082,6 +1179,9 @@ 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;
} }
@ -1091,6 +1191,9 @@ 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;
} }
@ -1101,12 +1204,12 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',9,__FILE__,__LINE__,__METHOD__,$name); 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) if (DEBUG_ENABLED)
debug_log('Checking (%s) with (%s)',8,__FILE__,__LINE__,__METHOD__,$used_in_object_class,$name); 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;
@ -1122,6 +1225,9 @@ 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;
} }
@ -1132,8 +1238,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',9,__FILE__,__LINE__,__METHOD__,$name); 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)
@ -1149,6 +1255,9 @@ 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;
} }
@ -1156,10 +1265,16 @@ 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;
} }
} }
@ -1175,8 +1290,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',9,__FILE__,__LINE__,__METHOD__,$class); 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);
@ -1222,8 +1337,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',9,__FILE__,__LINE__,__METHOD__,$strings); 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);
@ -1294,6 +1409,9 @@ 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;
} }
@ -1303,8 +1421,8 @@ 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) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',9,__FILE__,__LINE__,__METHOD__,$attr); 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)
@ -1321,6 +1439,9 @@ 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;
} }
} }
@ -1336,8 +1457,8 @@ class MatchingRuleUse extends SchemaItem {
private $used_by_attrs = array(); private $used_by_attrs = array();
function __construct($strings) { function __construct($strings) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',9,__FILE__,__LINE__,__METHOD__,$strings); 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);
@ -1411,6 +1532,9 @@ 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

@ -26,9 +26,6 @@ define('app_session_id_ses_max', 36);
* @return string the new session ID string * @return string the new session ID string
*/ */
function app_session_get_id() { function app_session_get_id() {
if (DEBUG_ENABLED)
debug_log('Entered with ()',1,__FILE__,__LINE__,__METHOD__);
$id_md5 = md5(rand(1,1000000)); $id_md5 = md5(rand(1,1000000));
$ip_md5 = md5($_SERVER['REMOTE_ADDR']); $ip_md5 = md5($_SERVER['REMOTE_ADDR']);
$id_hex = hexdec($id_md5[0]) + 1; $id_hex = hexdec($id_md5[0]) + 1;
@ -51,9 +48,6 @@ function app_session_get_id() {
* @return boolean True, if the session is valid * @return boolean True, if the session is valid
*/ */
function app_session_verify_id() { function app_session_verify_id() {
if (DEBUG_ENABLED)
debug_log('Entered with ()',1,__FILE__,__LINE__,__METHOD__);
$check_id = session_id(); $check_id = session_id();
$ip_md5 = md5($_SERVER['REMOTE_ADDR']); $ip_md5 = md5($_SERVER['REMOTE_ADDR']);
$id_hex = hexdec($check_id[0]) + 1; $id_hex = hexdec($check_id[0]) + 1;

View File

@ -21,8 +21,8 @@ abstract class xmlTemplates {
protected $templates = array(); protected $templates = array();
function __construct($server_id) { function __construct($server_id) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered with (%s)',5,__FILE__,__LINE__,__METHOD__,$server_id); 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);
@ -33,7 +33,7 @@ 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) if (DEBUG_ENABLED)
debug_log('Using CACHED templates',5,__FILE__,__LINE__,__METHOD__); 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) {
@ -63,6 +63,9 @@ 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) {
@ -101,7 +104,7 @@ abstract class xmlTemplates {
} else { } else {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Parsing templates',5,__FILE__,__LINE__,__METHOD__); 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();
@ -134,6 +137,9 @@ 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);
@ -144,6 +150,9 @@ 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)) {
@ -181,6 +190,9 @@ 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))
@ -206,6 +218,9 @@ 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)
@ -221,6 +236,9 @@ 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)
@ -253,6 +271,9 @@ 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;
@ -277,6 +298,9 @@ 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;
@ -288,6 +312,9 @@ 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;
} }
@ -295,6 +322,9 @@ 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
@ -307,6 +337,9 @@ 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
@ -317,6 +350,9 @@ 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;
} }
@ -326,6 +362,9 @@ 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());
} }
@ -335,6 +374,9 @@ 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;
} }
@ -344,6 +386,9 @@ 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
@ -354,6 +399,9 @@ 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;
} }
@ -361,6 +409,9 @@ 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 '';
@ -373,6 +424,9 @@ 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);
@ -403,6 +457,9 @@ 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)
@ -418,6 +475,9 @@ 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() == strtolower($name)) || in_array(strtolower($name),$attribute->getAliases())) if (($attribute->getName() == strtolower($name)) || in_array(strtolower($name),$attribute->getAliases()))
return $attribute; return $attribute;