Automated code cleanup, part 1

This commit is contained in:
Timothy Warren 2019-02-12 14:52:01 -05:00
parent dea7b9074d
commit f8f0d175b8
87 changed files with 618 additions and 340 deletions

View File

@ -182,4 +182,4 @@ if (get_request('meth','REQUEST') != 'ajax') {
echo '</div>';
echo '</fieldset>';
}
?>

View File

@ -114,4 +114,4 @@ if (count($ldap['attrs']['need']) > 0) {
die();
}
}
?>

View File

@ -170,4 +170,4 @@ if (! strcasecmp($request['attr'],'objectclass') || get_request('meth','REQUEST'
$request['page']->draw('FormReadWriteValue',$attribute,$request['count']);
}
}
?>

View File

@ -68,7 +68,7 @@ if (isAjaxEnabled() && get_request('refresh','REQUEST') && get_request('refresh'
# Capture the output and put into the body of the page.
$www['body'] = new block();
$www['body']->SetBody(ob_get_contents());
$www['body']->setBody(ob_get_contents());
$www['page']->block_add('body',$www['body']);
ob_end_clean();
@ -76,4 +76,4 @@ if ($www['meth'] == 'ajax')
$www['page']->show(get_request('frame','REQUEST',false,'BODY'),true,get_request('raw','REQUEST',false,false));
else
$www['page']->display();
?>

View File

@ -24,4 +24,4 @@ set_cached_item($app['server']->getIndex(),'tree','null',$tree);
header(sprintf('Location:index.php?server_id=%s&junk=%s#%s%s',
$app['server']->getIndex(),random_junk(),htmlid($app['server']->getIndex(),$dn),app_session_param()));
die();
?>

View File

@ -11,4 +11,4 @@
if (! defined('LIBDIR'))
define('LIBDIR',sprintf('%s/',realpath('../lib/')));
require_once LIBDIR.'common.php';
?>

View File

@ -185,4 +185,4 @@ foreach ($attrs_all as $attr) {
echo '</tr>';
}
echo '</table>';
?>

View File

@ -62,4 +62,4 @@ echo "\n";
echo '</table>';
echo '</form>';
?>

View File

@ -206,4 +206,4 @@ function build_tree($server,$dn,$buildtree) {
return $buildtree;
}
?>

View File

@ -100,4 +100,4 @@ if ($_SESSION[APPCONFIG]->getValue('appearance','show_hints'))
# Draw the javascrpt to enable/disable the filter field if this may be a recursive copy
if (count($request['children']) > 0)
printf('<script type="text/javascript" src="%sform_field_toggle_enable.js"></script>',JSDIR);
?>

View File

@ -101,4 +101,4 @@ if ($add_result) {
echo '</center>';
}
}
?>

View File

@ -140,4 +140,4 @@ if (count($request['template']->getLDAPadd(true))) {
echo '</div>';
}
?>

View File

@ -37,4 +37,4 @@ if ($result) {
'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($request['dn'])),
'body'=>ldap_error_msg($app['server']->getErrorMessage(null),$app['server']->getErrorNum(null)),
'type'=>'error'));
?>

View File

@ -46,4 +46,4 @@ else {
die();
}
}
?>

View File

@ -154,4 +154,4 @@ if (count($request['children'])) {
echo '</center>';
echo '<br />';
?>

View File

@ -46,4 +46,4 @@ header(sprintf('Expires: Mon, 26 Jul 1997 05:00:00 GMT',gmdate('r')));
header(sprintf('Last-Modified: %s',gmdate('r')));
echo $search[$request['attr']][$request['index']];
die();
?>

View File

@ -58,4 +58,4 @@ else
$tree->draw($request['noheader']);
die();
?>

View File

@ -126,10 +126,10 @@ echo '</div>';
# Capture the output and put into the body of the page.
$www['body'] = new block();
$www['body']->SetBody(ob_get_contents());
$www['body']->setBody(ob_get_contents());
$www['page']->block_add('body',$www['body']);
ob_end_clean();
# Render the popup.
$www['page']->display(array('CONTROL'=>false,'FOOT'=>false,'HEAD'=>false,'TREE'=>false));
?>

View File

@ -24,4 +24,4 @@ set_cached_item($app['server']->getIndex(),'tree','null',$tree);
header(sprintf('Location:index.php?server_id=%s&junk=%s#%s%s',
$app['server']->getIndex(),random_junk(),htmlid($app['server']->getIndex(),$dn),app_session_param()));
die();
?>

View File

@ -37,4 +37,4 @@ if ($request['file']) {
echo htmlspecialchars($request['export']->export());
print '</pre></span>';
}
?>

View File

@ -173,6 +173,8 @@ function get_user_agent_string() {
/**
* Determine the OS for the browser
* @param $type
* @return bool
*/
function is_browser($type) {
$agents = array();
@ -210,4 +212,4 @@ function is_browser($type) {
else
return false;
}
?>

View File

@ -108,4 +108,4 @@ function display_pla_parse_error($request) {
echo '</table>';
echo '</center>';
}
?>

View File

@ -45,4 +45,4 @@ printf('<tr><td>&nbsp;</td><td class="small"><input type="checkbox" name="contin
printf('<tr><td>&nbsp;</td><td><input type="submit" value="%s" /></td></tr>',_('Proceed >>'));
echo '</table>';
echo '</form>';
?>

View File

@ -145,4 +145,4 @@ if (! preg_match('/^([0-9]+\.?)+/',app_version())) {
}
include './cmd.php';
?>

View File

@ -34,4 +34,4 @@ else
'body'=>_('Invalid Username or Password.'),
'type'=>'error'),
sprintf('cmd.php?cmd=login_form&server_id=%s',get_request('server_id','REQUEST')));
?>

View File

@ -95,4 +95,4 @@ if ($app['server']->getAuthType() == 'http') {
if ($app['server']->isAnonBindAllowed())
printf('<script type="text/javascript" src="%sform_field_toggle_enable.js"></script>',JSDIR);
}
?>

View File

@ -26,4 +26,4 @@ if ($app['server']->logout()) {
'body'=>_('Please report this error to the admins.'),
'type'=>'error'),
sprintf('index.php?server_id=%s',$app['server']->getIndex()));
?>

View File

@ -144,4 +144,4 @@ echo '</table>';
echo '</center>';
echo '<br />';
?>

View File

@ -130,4 +130,4 @@ echo '<br/>';
printf('<input type="submit" id="save_button" name="submit" value="%s" />',_('Update Values'));
echo '</div>';
echo '</form>';
?>

View File

@ -172,4 +172,4 @@ if (count($request['update'])) {
echo _('You made no changes');
echo '</center>';
}
?>

View File

@ -175,4 +175,4 @@ echo '</td></tr>';
echo '</table>';
echo '</form>';
printf('<script type="text/javascript" src="%smodify_member.js"></script>',JSDIR);
?>

View File

@ -256,4 +256,4 @@ foreach (array(
}
echo '</table>';
?>

View File

@ -79,10 +79,10 @@ if ($request['componentid']) {
# Capture the output and put into the body of the page.
$www['body'] = new block();
$www['body']->SetBody(ob_get_contents());
$www['body']->setBody(ob_get_contents());
$www['page']->block_add('body',$www['body']);
ob_end_clean();
# Render the popup.
$www['page']->display(array('CONTROL'=>false,'FOOT'=>false,'HEAD'=>false,'TREE'=>false));
?>

View File

@ -30,4 +30,4 @@ system_message(array(
'body'=>$body,
'type'=>'info'),
get_request('meth','REQUEST') == 'ajax' ? null : 'index.php');
?>

View File

@ -16,4 +16,4 @@ require LIBDIR.'query_functions.php';
$request = array();
$request['page'] = new QueryRender($app['server']->getIndex(),get_request('query','REQUEST',false,null));
$request['page']->accept();
?>

View File

@ -86,4 +86,4 @@ function pla_rdelete($server,$dn) {
}
}
}
?>

View File

@ -43,4 +43,4 @@ else
header(sprintf('Location: cmd.php?server_id=%s',$app['server']->getIndex()));
die();
?>

View File

@ -61,4 +61,4 @@ if ($success) {
'body'=>ldap_error_msg($app['server']->getErrorMessage(null),$app['server']->getErrorNum(null)),
'type'=>'error'));
}
?>

View File

@ -37,4 +37,4 @@ echo '</form>';
echo '</center>';
echo "\n";
?>

View File

@ -637,4 +637,4 @@ function items() {
echo '</script>';
}
?>

View File

@ -86,4 +86,4 @@ foreach ($attrs as $key => $values) {
echo '</td></tr>';
}
echo '</table>';
?>

View File

@ -54,4 +54,4 @@ if ($request['dn']) {
$request['page']->setContainer(get_request('container','REQUEST'));
$request['page']->accept();
}
?>

View File

@ -75,4 +75,4 @@ if ($result) {
header("Location: $redirect_url");
die();
}
?>

View File

@ -250,4 +250,4 @@ function getMustAttrs($oclasses) {
return $mustattrs;
}
?>

View File

@ -74,4 +74,4 @@ header(sprintf('Content-type: %s',$request['type']));
header(sprintf('Content-disposition: inline; filename="%s"',$request['filename']));
echo $jpeg_data[$request['attr']][$request['index']];
die();
?>

View File

@ -26,4 +26,4 @@ if ($_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks')) {
}
echo '</div>';
?>

View File

@ -134,6 +134,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.
* @param $parent_entry
* @param $code
*/
public function draw_children($parent_entry,$code) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -218,6 +220,9 @@ class AJAXTree extends HTMLTree {
/**
* Draw the "Create New Entry" item before the children.
* @param $entry
* @param $level
* @return string
*/
private function create_before_child($entry,$level) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -238,6 +243,9 @@ class AJAXTree extends HTMLTree {
/**
* Draw the "Create New Entry" item after the children.
* @param $entry
* @param $level
* @return string
*/
private function create_after_child($entry,$level) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -257,6 +265,10 @@ class AJAXTree extends HTMLTree {
/**
* Draw the "Create New Entry" item.
* @param $entry
* @param $level
* @param $img
* @return string
*/
private function draw_create_new_entry($entry,$level,$img) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -304,4 +316,4 @@ class AJAXTree extends HTMLTree {
return $result;
}
}
?>

View File

@ -168,6 +168,7 @@ class Attribute {
/**
* Autovalue is called after the attribute is initialised, and thus the values from the ldap server will be set.
* @param $new_val
*/
public function autoValue($new_val) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -870,7 +871,6 @@ class Attribute {
* real_attr_name(), you can more easily fetch these attributes' schema
* with their "real" attribute name.
*
* @param string $attr_name The name of the attribute to examine.
* @return string
*/
private function real_attr_name() {
@ -882,6 +882,8 @@ class Attribute {
/**
* Does this attribute need supporting JS
* @param null $type
* @return bool
*/
public function needJS($type=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -914,4 +916,4 @@ class Attribute {
debug_dump_backtrace(sprintf('Unknown JS request %s',$type),1);
}
}
?>

View File

@ -185,4 +185,4 @@ class AttributeFactory {
return new GidAttribute($name,$values,$server_id,$source);
}
}
?>

View File

@ -57,4 +57,4 @@ class BinaryAttribute extends Attribute {
}
}
}
?>

View File

@ -14,4 +14,4 @@
*/
class DateAttribute extends Attribute {
}
?>

View File

@ -14,4 +14,4 @@
*/
class DnAttribute extends Attribute {
}
?>

View File

@ -14,4 +14,4 @@
*/
class GidAttribute extends Attribute {
}
?>

View File

@ -202,6 +202,8 @@ class HTMLTree extends Tree {
/**
* Get the HTML for each tree menu option
* @param $item
* @return bool|string
*/
protected function get_menu_item($item) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -394,7 +396,7 @@ class HTMLTree extends Tree {
/**
* Recursively descend on the given dn and draw the tree in html
*
* @param dn $dn Current dn.
* @param $item
* @param int $level Level to start drawing (start to -1)
*/
protected function draw_item($item,$level) {
@ -584,4 +586,4 @@ class HTMLTree extends Tree {
return $depths[$server->getIndex()];
}
}
?>

View File

@ -14,4 +14,4 @@
*/
class JpegAttribute extends BinaryAttribute {
}
?>

View File

@ -45,4 +45,4 @@ class MassRender extends TemplateRender {
$this->drawFormReadOnlyValueJpegAttribute($attribute,$i);
}
}
?>

View File

@ -32,4 +32,4 @@ class MultiLineAttribute extends Attribute {
$this->cols = $cols;
}
}
?>

View File

@ -14,4 +14,4 @@
*/
class ObjectClassAttribute extends Attribute {
}
?>

View File

@ -150,6 +150,8 @@ class PageRender extends Visitor {
/**
* Process our <post> arguments from the templates
* @param $attribute
* @param $i
*/
protected function getPostAttribute($attribute,$i) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -371,7 +373,9 @@ class PageRender extends Visitor {
return null;
}
/** DRAW ATTRIBUTE NAME **/
/** DRAW ATTRIBUTE NAME *
* @param $attribute
*/
final protected function drawNameAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -392,7 +396,9 @@ class PageRender extends Visitor {
if (DEBUGTMPSUB) printf(' <small>[%s]</small>',get_class($attribute));
}
/** ATTRIBUTE NOTES */
/** ATTRIBUTE NOTES
* @param $attribute
*/
protected function drawNotesAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -534,6 +540,8 @@ class PageRender extends Visitor {
/**
* Draw specific hidden attribute
* @param $attribute
* @param $i
*/
final protected function drawHiddenValueAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -545,7 +553,9 @@ class PageRender extends Visitor {
htmlspecialchars($val));
}
/** DRAW DISPLAYED OLD VALUES **/
/** DRAW DISPLAYED OLD VALUES *
* @param $attribute
*/
protected function drawOldValuesAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -559,7 +569,9 @@ class PageRender extends Visitor {
echo $attribute->getOldValue($i);
}
/** DRAW DISPLAYED CURRENT VALUES **/
/** DRAW DISPLAYED CURRENT VALUES *
* @param $attribute
*/
protected function drawCurrentValuesAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -574,6 +586,8 @@ class PageRender extends Visitor {
/**
* Draw the current specific value of an attribute
* @param $attribute
* @param $i
*/
final protected function drawCurrentValueAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -584,6 +598,8 @@ class PageRender extends Visitor {
/**
* Draw a input value for an attribute - used in a form.
* @param $attribute
* @param $i
*/
protected function drawFormValueAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -656,6 +672,8 @@ class PageRender extends Visitor {
/**
* Draw specific hidden binary attribute
* @param $attribute
* @param $i
*/
final protected function drawHiddenValueBinaryAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -818,6 +836,8 @@ class PageRender extends Visitor {
/**
* Draw a Jpeg Attribute
* @param $attribute
* @param $i
*/
final protected function drawOldValueJpegAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -832,6 +852,8 @@ class PageRender extends Visitor {
/**
* Draw a Jpeg Attribute
* @param $attribute
* @param $i
*/
final protected function drawCurrentValueJpegAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -1241,4 +1263,4 @@ class PageRender extends Visitor {
$this->draw('ShadowDate',$attribute);
}
}
?>

View File

@ -14,4 +14,4 @@
*/
class PasswordAttribute extends Attribute {
}
?>

View File

@ -177,6 +177,7 @@ class Query extends xmlTemplate {
/**
* This is temporary to get around objects that use a DN for rendering, for example jpegPhoto
* @param $dn
*/
public function setDN($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -280,4 +281,4 @@ class Query extends xmlTemplate {
return $this->description;
}
}
?>

View File

@ -224,7 +224,7 @@ class QueryRender extends PageRender {
debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
$server = $this->getServer();
$afattrs = $this->getAFAttrs();
$afattrs = $this->getAFattrs();
# If Mass Actions Enabled
if ($_SESSION[APPCONFIG]->getValue('mass','enabled')) {
@ -554,4 +554,4 @@ class QueryRender extends PageRender {
echo '</table>';
}
}
?>

View File

@ -14,4 +14,4 @@
*/
class RandomPasswordAttribute extends PasswordAttribute {
}
?>

View File

@ -14,4 +14,4 @@
*/
class SambaPasswordAttribute extends PasswordAttribute {
}
?>

View File

@ -68,4 +68,4 @@ class SelectionAttribute extends Attribute {
$this->multiple = true;
}
}
?>

View File

@ -16,4 +16,4 @@ class ShadowAttribute extends Attribute {
public $shadow_before_today_attrs = array('shadowLastChange','shadowMin');
public $shadow_after_today_attrs = array('shadowMax','shadowExpire','shadowWarning','shadowInactive');
}
?>

View File

@ -239,7 +239,7 @@ class Template extends xmlTemplate {
/**
* Return the templates of type (creation/modification)
*
* @param $string type - creation/modification
* @param $type
* @return array - Array of templates of that type
*/
protected function readTemplates($type) {
@ -257,6 +257,8 @@ class Template extends xmlTemplate {
* After this action, the template should self describe as to whether it is an update, create
* or delete.
* (OLD values are IGNORED, we will have got them when we build this object from the LDAP server DN.)
* @param bool $makeVisible
* @param bool $nocache
*/
public function accept($makeVisible=false,$nocache=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -589,7 +591,7 @@ class Template extends xmlTemplate {
* then the remaining RDNs will be returned.
*
* @param RDN
* @return RDN attributes not processed
* @return array attributes not processed
*/
public function setRDNAttributes($rdn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -627,7 +629,7 @@ class Template extends xmlTemplate {
# If DN is not set, our DN will be made from our RDN and Container.
elseif ($this->getRDN() && $this->getContainer())
return sprintf('%s,%s',$this->getRDN(),$this->GetContainer());
return sprintf('%s,%s',$this->getRDN(),$this->getContainer());
# If container is not set, we're probably creating the base
elseif ($this->getRDN() && get_request('create_base'))
@ -683,6 +685,9 @@ class Template extends xmlTemplate {
/**
* Copy a DN
* @param $template
* @param $rdn
* @param bool $asnew
*/
public function copy($template,$rdn,$asnew=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -752,9 +757,10 @@ class Template extends xmlTemplate {
* Get Attributes by LDAP type
* This function will return a list of attributes by LDAP type (MUST,MAY).
*
* @param $type
* @return array Array of attributes.
*/
function getAttrbyLdapType($type) {
public function getAttrbyLdapType($type) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
@ -770,8 +776,11 @@ class Template extends xmlTemplate {
/**
* Return true if this is a MUST,MAY attribute
* @param $attr
* @param $type
* @return bool
*/
function isAttrType($attr,$type) {
public function isAttrType($attr, $type) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
@ -1039,6 +1048,7 @@ class Template extends xmlTemplate {
* Set a template as invalid
*
* @param string Message indicating the reason the template has been invalidated
* @param bool $admin
*/
public function setInvalid($msg,$admin=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -1107,6 +1117,8 @@ class Template extends xmlTemplate {
/**
* OnChangeAdd javascript processing
* @param $origin
* @param $value
*/
public function OnChangeAdd($origin,$value) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -1220,13 +1232,13 @@ class Template extends xmlTemplate {
$attribute->js['autoFill'] .= sprintf(" %s = %s.split(':')[%s];\n",$match_attr,$match_attr,$tok_idx);
} elseif (strstr($match_mod,'K')) {
preg_match_all('/([0-9]+)/',trim($match_subst),$substrarray);
if (isset($substrarray[1][0])) {
$tok_idx = $substrarray[1][0];
} else {
$tok_idx = '0';
}
$attribute->js['autoFill'] .= sprintf(" %s = %s.split(' ')[%s];\n",$match_attr,$match_attr,$tok_idx);
preg_match_all('/([0-9]+)/',trim($match_subst),$substrarray);
if (isset($substrarray[1][0])) {
$tok_idx = $substrarray[1][0];
} else {
$tok_idx = '0';
}
$attribute->js['autoFill'] .= sprintf(" %s = %s.split(' ')[%s];\n",$match_attr,$match_attr,$tok_idx);
} else {
preg_match_all('/([0-9]*)-([0-9]*)/',trim($match_subst),$substrarray);
@ -1388,6 +1400,8 @@ class Template extends xmlTemplate {
/**
* Return an array, that can be passed to ldap_add().
* Attributes with empty values will be excluded.
* @param bool $attrsOnly
* @return array
*/
public function getLDAPadd($attrsOnly=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -1423,6 +1437,8 @@ class Template extends xmlTemplate {
* if there are changes, and if they are, the 2nd call will just return the results
*
* @param boolean Return the attribute objects (useful for a confirmation process), or the modification array for ldap_modify()
* @param int $index
* @return mixed
*/
public function getLDAPmodify($attrsOnly=false,$index=0) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -1568,4 +1584,4 @@ class Template extends xmlTemplate {
usort($this->attributes,'sortAttrs');
}
}
?>

View File

@ -20,6 +20,7 @@ class TemplateRender extends PageRender {
/**
* Initialise and Render the TemplateRender
* @param bool $norender
*/
public function accept($norender=false) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -840,7 +841,10 @@ class TemplateRender extends PageRender {
}
}
/** PAGE ENTRY MENU ITEMS **/
/** PAGE ENTRY MENU ITEMS *
* @param $i
* @return array|bool
*/
private function getMenuItem($i) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -1302,6 +1306,7 @@ class TemplateRender extends PageRender {
/**
* Container Chooser
* @param $default_container
*/
protected function drawContainerChooser($default_container) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -1449,7 +1454,9 @@ class TemplateRender extends PageRender {
_('Update Object'));
}
/** STEP FORM METHODS **/
/** STEP FORM METHODS *
* @param $page
*/
private function drawStepTitle($page) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -1757,7 +1764,9 @@ function fillRec(id,value) {
echo "\n";
}
/** ATTRIBUTE TITLE **/
/** ATTRIBUTE TITLE *
* @param $attribute
*/
protected function drawTitleAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -1782,7 +1791,9 @@ function fillRec(id,value) {
echo '</tr>';
}
/** ATTRIBUTE LINE **/
/** ATTRIBUTE LINE *
* @param $attribute
*/
protected function drawStartValueLineAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -1845,7 +1856,10 @@ function fillRec(id,value) {
echo "\n";
}
/** DRAW ICONS FOR ATTRIBUTES VALUES **/
/** DRAW ICONS FOR ATTRIBUTES VALUES *
* @param $attribute
* @param $val
*/
protected function drawIconAttribute($attribute,$val) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -1901,7 +1915,9 @@ function fillRec(id,value) {
/** DEFAULT ATTRIBUTE RENDERING **/
/** javacript */
/** javacript
* @param $attribute
*/
protected function drawJavascriptAttribute($attribute) {
if (! $attribute->needJS()) {
@ -2004,7 +2020,9 @@ function fillRec(id,value) {
echo '}';
}
/** ATTRIBUTE MENU **/
/** ATTRIBUTE MENU *
* @param $attribute
*/
protected function drawMenuAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -2135,7 +2153,10 @@ function fillRec(id,value) {
return sprintf('<small>(<a href="%s">%s</a>)</small>',htmlspecialchars($href),_('rename'));
}
/** values **/
/** values *
* @param $attribute
* @param $i
*/
protected function drawValueAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -2263,7 +2284,9 @@ function fillRec(id,value) {
echo '*';
}
/** BINARY ATTRIBUTE RENDERING **/
/** BINARY ATTRIBUTE RENDERING *
* @param $attribute
*/
#@todo do we need a $this->drawJavascriptAttribute($attribute) here too ?
protected function drawJavascriptBinaryAttribute($attribute) {
@ -2308,7 +2331,9 @@ function deleteAttribute(attrName,friendlyName,i)
echo "\n";
}
/** DATE ATTRIBUTE RENDERING **/
/** DATE ATTRIBUTE RENDERING *
* @param $attribute
*/
protected function drawJavaScriptDateAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -2316,7 +2341,7 @@ function deleteAttribute(attrName,friendlyName,i)
printf('<!-- START: DATE ATTRIBUTE %s (%s)-->',__METHOD__,$attribute->getName());
echo "\n";
$this->drawJavaScriptAttribute($attribute);
$this->drawJavascriptAttribute($attribute);
static $drawn = false;
@ -2352,13 +2377,18 @@ function deleteAttribute(attrName,friendlyName,i)
/**
* Draws an HTML date selector button which, when clicked, pops up a date selector dialog.
* @param $attribute
* @param $i
*/
protected function drawSelectorPopupDateAttribute($attribute,$i) {
printf('<a href="javascript:dateSelector(\'%s_%s\');" title="%s"><img src="%s/calendar.png" alt="Calendar" class="chooser" id="f_trigger_%s_%s" style="cursor: pointer;" /></a>',
$attribute->getName(),$i,_('Click to popup a dialog to select a date graphically'),IMGDIR,$attribute->getName(),$i);
}
/** DN ATTRIBUTES **/
/** DN ATTRIBUTES *
* @param $attribute
* @param $val
*/
protected function drawIconDnAttribute($attribute,$val) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -2366,7 +2396,10 @@ function deleteAttribute(attrName,friendlyName,i)
$this->draw('DnValueIcon',$attribute,$val);
}
/** OBJECT CLASS ATTRIBUTE **/
/** OBJECT CLASS ATTRIBUTE *
* @param $attribute
* @param $val
*/
protected function drawIconObjectClassAttribute($attribute,$val) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -2382,7 +2415,9 @@ function deleteAttribute(attrName,friendlyName,i)
}
}
/** PASSWORD ATTRIBUTES **/
/** PASSWORD ATTRIBUTES *
* @param $attribute
*/
protected function drawJavascriptPasswordAttribute($attribute) {
static $drawn = array();
@ -2426,6 +2461,7 @@ function deleteAttribute(attrName,friendlyName,i)
* This will draw the javascript that displays to the user the random password generated
*
* @todo This function doesnt work well if there are more than 1 RandomPasswordAttributes on the form for the same attribute (unlikely situation)
* @param $attribute
*/
protected function drawJavascriptRandomPasswordAttribute($attribute) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -2500,7 +2536,10 @@ function deleteAttribute(attrName,friendlyName,i)
$id,htmlspecialchars($attribute->getName()),$i,$enc);
}
/** SELECTION ATTRIBUTE RENDERING **/
/** SELECTION ATTRIBUTE RENDERING *
* @param $attribute
* @param $val
*/
protected function drawIconSelectionAttribute($attribute,$val) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
@ -2530,4 +2569,4 @@ function deleteAttribute(attrName,friendlyName,i)
}
}
}
?>

View File

@ -36,6 +36,7 @@ abstract class Tree {
* Create an instance of the tree - this is used when we call this class directly
* Tree::getInstance($index)
*
* @param $server_id
* @return object Tree
*/
static public function getInstance($server_id) {
@ -162,7 +163,6 @@ abstract class Tree {
* Add an entry in the tree view ; the entry is added in the
* children array of its parent
*
* @param dn DN to add
* @param string $dn the dn of the entry to create
*/
public function addEntry($dn) {
@ -348,4 +348,4 @@ abstract class Tree {
return count($this->entries[$dnlower]->getChildren());
}
}
?>

View File

@ -71,7 +71,7 @@ class TreeItem {
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);
}
/**
@ -309,4 +309,4 @@ class TreeItem {
return $this->template;
}
}
?>

View File

@ -96,4 +96,4 @@ abstract class Visitor {
return $_SESSION[APPCONFIG]->getServer($this->getServerID());
}
}
?>

View File

@ -297,7 +297,7 @@ class Horde_Cipher_blowfish {
public $_rounds = 16;
/* Constructor */
function Cipher_blowfish($params = null)
public function Cipher_blowfish($params = null)
{
}
@ -306,7 +306,7 @@ class Horde_Cipher_blowfish {
*
* @param String $key The key to use
*/
function setKey($key)
public function setKey($key)
{
$key = $this->_formatKey($key);
$keyPos = $keyXor = 0;
@ -365,7 +365,7 @@ class Horde_Cipher_blowfish {
*
* @return Integer The number of characters per block
*/
function getBlockSize()
public function getBlockSize()
{
return 8;
}
@ -378,7 +378,7 @@ class Horde_Cipher_blowfish {
*
* @return String the encrypted output
*/
function encryptBlock($block, $key = null)
public function encryptBlock($block, $key = null)
{
if (!is_null($key)) {
$this->setKey($key);
@ -389,15 +389,15 @@ class Horde_Cipher_blowfish {
return pack("NN", $parts['L'], $parts['R']);
}
/**
* Encrypt a block on data.
*
* @param String $L The data to encrypt.
* @param String $R The data to encrypt.
*
* @return String The encrypted output.
*/
function _encryptBlock($L, $R)
/**
* Encrypt a block on data.
*
* @param String $L The data to encrypt.
* @param String $R The data to encrypt.
*
* @return array The encrypted output.
*/
public function _encryptBlock($L, $R)
{
$L ^= $this->p[0];
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[1];
@ -429,7 +429,7 @@ class Horde_Cipher_blowfish {
*
* @return String the decrypted output
*/
function decryptBlock($block, $key = null)
public function decryptBlock($block, $key = null)
{
if (!is_null($key)) {
$this->setKey($key);
@ -466,15 +466,16 @@ class Horde_Cipher_blowfish {
return $decrypted;
}
/**
* Converts a text key into an array.
*
* @return array The key.
*/
function _formatKey($key)
/**
* Converts a text key into an array.
*
* @param $key
* @return array The key.
*/
public function _formatKey($key)
{
return array_values(unpack('C*', $key));
}
}
?>

View File

@ -214,14 +214,14 @@ class Config {
'default'=>'AJAXTree');
/** Tree display
* An array of format strings used to display enties in the
* tree viewer (left-hand side). The first format string that
* is completely defined (i.e., does not reference attributes
* that are not defined the object). If there is no format
* string that is completely defined, the last one is used.
*
* You can use special tokens to draw the entries as you wish.
* You can even mix in HTML to format the string.
* An array of format strings used to display enties in the
* tree viewer (left-hand side). The first format string that
* is completely defined (i.e., does not reference attributes
* that are not defined the object). If there is no format
* string that is completely defined, the last one is used.
*
* You can use special tokens to draw the entries as you wish.
* You can even mix in HTML to format the string.
* Here are all the tokens you can use:
* %rdn - draw the RDN of the entry (ie, "cn=Dave")
* %dn - draw the DN of the entry (ie, "cn=Dave,ou=People,dc=example,dc=com"
@ -578,6 +578,8 @@ class Config {
/**
* Access the configuration, taking into account the defaults and the customisations
* @param bool $usecache
* @return array
*/
private function getConfigArray($usecache=true) {
static $CACHE = array();
@ -597,6 +599,10 @@ class Config {
/**
* Get a configuration value.
* @param $key
* @param $index
* @param bool $fatal
* @return string
*/
public function getValue($key,$index,$fatal=true) {
$config = $this->getConfigArray();
@ -685,6 +691,8 @@ class Config {
/**
* Simple ACL to see if commands can be run
* @param string $index
* @return bool
*/
public function isCommandAvailable($index='cmd') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -805,4 +813,4 @@ class Config {
return $this->servers->getServerList($visible);
}
}
?>

View File

@ -133,8 +133,10 @@ private $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12
array( 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11)));
/**
* Fixes too large numbers
*/
* Fixes too large numbers
* @param $i
* @return int
*/
private function x($i) {
if ($i < 0) return 4294967296 - $i;
else return $i;
@ -154,10 +156,11 @@ private $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12
}
/**
* @param array in input data
* @param array p permutation
* @return array
*/
* @param $in
* @param $p
* @param $n
* @return array
*/
private function permute($in, $p, $n) {
$ret = array();
for ($i = 0; $i < $n; $i++) {
@ -185,41 +188,41 @@ private $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12
* @param boolean $forw
* @return array
*/
function doHash($in, $key, $forw) {
public function doHash($in, $key, $forw) {
$ki = array();
$pk1 = $this->permute($key, $this->perm1, 56);
$c = array();
$d = array();
for ($i = 0; $i < 28; $i++) {
$c[$i] = $pk1[$i];
$d[$i] = $pk1[28 + $i];
}
for ($i = 0; $i < 16; $i++) {
$c = $this->lshift($this->sc[$i], $c);
$d = $this->lshift($this->sc[$i], $d);
$cd = $c;
for ($k = 0; $k < sizeof($d); $k++) $cd[] = $d[$k];
$ki[$i] = $this->permute($cd, $this->perm2, 48);
}
$pd1 = $this->permute($in, $this->perm3, 64);
$l = array();
$r = array();
for ($i = 0; $i < 32; $i++) {
$l[$i] = $pd1[$i];
$r[$i] = $pd1[32 + $i];
}
for ($i = 0; $i < 16; $i++) {
$er = $this->permute($r, $this->perm4, 48);
if ($forw) $erk = $this->mxor($er, $ki[$i]);
else $erk = $this->mxor($er, $ki[15 - $i]);
for ($j = 0; $j < 8; $j++) {
for ($k = 0; $k < 6; $k++) {
$b[$j][$k] = $erk[($j * 6) + $k];
@ -230,12 +233,12 @@ private $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12
$n = array();
$m = ($b[$j][0] << 1) | $b[$j][5];
$n = ($b[$j][1] << 3) | ($b[$j][2] << 2) | ($b[$j][3] << 1) | $b[$j][4];
for ($k = 0; $k < 4; $k++) {
$b[$j][$k]=($this->sbox[$j][$m][$n] & (1 << (3-$k)))?1:0;
}
}
for ($j = 0; $j < 8; $j++) {
for ($k = 0; $k < 4; $k++) {
$cb[($j * 4) + $k] = $b[$j][$k];
@ -282,7 +285,7 @@ private $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12
*/
private function smb_hash($in, $key, $forw){
$key2 = $this->str_to_key($key);
for ($i = 0; $i < 64; $i++) {
$inb[$i] = ($in[$i/8] & (1<<(7-($i%8)))) ? 1:0;
$keyb[$i] = ($key2[$i/8] & (1<<(7-($i%8)))) ? 1:0;
@ -358,24 +361,27 @@ private $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12
}
/**
* Unsigned shift operation for 32bit values.
*
* PHP 4 only supports signed shifts by default.
*/
private function unsigned_shift_r($a, $b) {
$z = 0x80000000;
if ($z & $a) {
$a = ($a >> 1);
$a &= (~$z);
$a |= 0x40000000;
$a = ($a >> ($b - 1));
}
else {
$a = ($a >> $b);
}
return $a;
}
* Unsigned shift operation for 32bit values.
*
* PHP 4 only supports signed shifts by default.
* @param $a
* @param $b
* @return bool|int
*/
private function unsigned_shift_r($a, $b) {
$z = 0x80000000;
if ($z & $a) {
$a = ($a >> 1);
$a &= (~$z);
$a |= 0x40000000;
$a = ($a >> ($b - 1));
}
else {
$a = ($a >> $b);
}
return $a;
}
}
?>

View File

@ -21,10 +21,12 @@ abstract class DS {
protected $custom;
protected $type;
abstract function __construct($index);
abstract public function __construct($index);
/**
* This will make the connection to the datasource
* @param $method
* @param bool $debug
*/
abstract protected function connect($method,$debug=false);
@ -33,11 +35,18 @@ abstract class DS {
* method: default = anon, connect to ds using bind_id not auth_id.
* method: 'user', connect with auth_id
* method: '<freetext>', any custom extra connection to ds.
* @param null $user
* @param null $pass
* @param null $method
*/
abstract public function login($user=null,$pass=null,$method=null);
/**
* Query the datasource
* @param $query
* @param $method
* @param null $index
* @param bool $debug
*/
abstract public function query($query,$method,$index=null,$debug=false);
@ -49,6 +58,7 @@ abstract class DS {
/**
* Functions that set and verify object configuration details
* @param $defaults
*/
public function setDefaults($defaults) {
foreach ($defaults as $key => $details)
@ -66,6 +76,10 @@ abstract class DS {
/**
* Return a configuration value
* @param $key
* @param $setting
* @param bool $fatal
* @return |null |null |null
*/
public function getValue($key,$setting,$fatal=true) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -86,6 +100,9 @@ abstract class DS {
/**
* Set a configuration value
* @param $key
* @param $setting
* @param $value
*/
public function setValue($key,$setting,$value) {
if (isset($this->custom->{$key}[$setting]))
@ -151,6 +168,8 @@ abstract class DS {
* Get the login name of the user logged into this datastore's connection method
* If this returns null, we are not logged in.
* If this returns '', we are logged in with anonymous
* @param null $method
* @return string|null
*/
public function getLogin($method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -201,6 +220,10 @@ abstract class DS {
/**
* Set the login details of the user logged into this datastore's connection method
* @param $user
* @param $pass
* @param null $method
* @return bool
*/
protected function setLogin($user,$pass,$method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -236,6 +259,8 @@ abstract class DS {
/**
* Get the login password of the user logged into this datastore's connection method
* @param null $method
* @return string|null
*/
protected function getPassword($method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -281,6 +306,8 @@ abstract class DS {
/**
* Return if this datastore's connection method has been logged into
* @param null $method
* @return mixed
*/
public function isLoggedIn($method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -385,6 +412,8 @@ abstract class DS {
/**
* Logout of this datastore's connection method
* @param null $method
* @return bool
*/
public function logout($method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -443,7 +472,7 @@ abstract class DS {
return $this->index;
}
/**
/**
* Work out which connection method to use.
* If a method is passed, then it will be passed back. If no method is passed, then we'll
* check to see if the user is logged in. If they are, then 'user' is used, otherwise
@ -600,6 +629,8 @@ class Datastore {
/**
* Create a new database object
* @param $type
* @return int
*/
public function newServer($type) {
if (class_exists($type)) {
@ -617,6 +648,9 @@ class Datastore {
/**
* Set values for a database object.
* @param $key
* @param $setting
* @param $value
*/
public function setValue($key,$setting,$value) {
if (! $this->objects[$this->index]->isDefaultKey($key))
@ -681,7 +715,7 @@ class Datastore {
# If no index defined, then pick the lowest one.
if (is_null($index) || ! trim($index) || ! is_numeric($index))
$index = min($this->GetServerList())->getIndex();
$index = min($this->getServerList())->getIndex();
if (! isset($this->objects[$index]))
debug_dump_backtrace(sprintf('Error: Datastore instance [%s] doesnt exist?',htmlspecialchars($index)),1);
@ -728,4 +762,4 @@ class Datastore {
return null;
}
}
?>

View File

@ -117,6 +117,8 @@ class ldap extends DS {
* Connect and Bind to the Database
*
* @param string Which connection method resource to use
* @param bool $debug
* @param bool $new
* @return resource|null Connection resource if successful, null if not.
*/
protected function connect($method,$debug=false,$new=false) {
@ -235,6 +237,10 @@ class ldap extends DS {
/**
* Login to the database with the application user/password
*
* @param null $user
* @param null $pass
* @param null $method
* @param bool $new
* @return boolean true|false for successful login.
*/
public function login($user=null,$pass=null,$method=null,$new=false) {
@ -459,7 +465,9 @@ class ldap extends DS {
/**
* Get a user ID
*
* @param string Which connection method resource to use
* @param $user
* @param null $method
* @return |null
*/
public function getLoginID($user,$method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -548,6 +556,8 @@ class ldap extends DS {
/**
* If TLS is configured, then start it
* @param $resource
* @return bool
*/
private function startTLS($resource) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -597,6 +607,9 @@ class ldap extends DS {
* To be able to use SASL, PHP should have been compliled with --with-ldap-sasl=DIR
*
* @todo This has not been tested, please let the developers know if this function works as expected.
* @param $resource
* @param $method
* @return bool
*/
private function startSASL($resource,$method) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -681,6 +694,9 @@ class ldap extends DS {
/**
* If PROXY AUTH is configured, then start it
* @param $resource
* @param $method
* @return bool
*/
private function startProxy($resource,$method) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -770,6 +786,10 @@ class ldap extends DS {
/**
* Modify attributes of a DN
* @param $dn
* @param $attrs
* @param null $method
* @return bool
*/
public function modify($dn,$attrs,$method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -962,32 +982,31 @@ class ldap extends DS {
* child entries one level beneath the parent. For example, for the following tree:
*
* <code>
* dc=example,dc=com
* ou=People
* cn=Dave
* cn=Fred
* cn=Joe
* ou=More People
* cn=Mark
* cn=Bob
* dc=example,dc=com
* ou=People
* cn=Dave
* cn=Fred
* cn=Joe
* ou=More People
* cn=Mark
* cn=Bob
* </code>
*
* Calling <code>getContainerContents("ou=people,dc=example,dc=com")</code>
* would return the following list:
*
* <code>
* cn=Dave
* cn=Fred
* cn=Joe
* ou=More People
* cn=Dave
* cn=Fred
* cn=Joe
* ou=More People
* </code>
*
* @param string The DN of the entry whose children to return.
* @param string Which connection method resource to use
* @param int (optional) The maximum number of entries to return.
* If unspecified, no limit is applied to the number of entries in the returned.
* @param string (optional) An LDAP filter to apply when fetching children, example: "(objectClass=inetOrgPerson)"
* @param constant (optional) The LDAP deref setting to use in the query
* @param $dn
* @param null $method
* @param int $size_limit
* @param string $filter
* @param int $deref
* @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) {
@ -1087,6 +1106,8 @@ class ldap extends DS {
/**
* Parse a DN and escape any special characters
* @param $dn
* @return string|string[]|null
*/
protected function escapeDN($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -1109,6 +1130,8 @@ class ldap extends DS {
/**
* Parse a DN and unescape any special characters
* @param $dn
* @return array|string|string[]|null
*/
private function unescapeDN($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -1159,8 +1182,8 @@ class ldap extends DS {
* If we cant connect to the LDAP server, we'll return false.
* If we can connect but cant get the entry, then we'll return null.
*
* @param string Which connection method resource to use
* @param dn The DN to use to obtain the schema
* @param string $dn
* @return array|false Schema if available, null if its not or false if we cant connect.
*/
private function getSchemaDN($method=null,$dn='') {
@ -1249,23 +1272,14 @@ class ldap extends DS {
* Please note: On FC systems, it seems that php_ldap uses /etc/openldap/ldap.conf in
* the search base if it is blank - so edit that file and comment out the BASE line.
*
* @param string Which connection method resource to use
* @param string A string indicating which type of schema to
* fetch. Five valid values: 'objectclasses', 'attributetypes',
* 'ldapsyntaxes', 'matchingruleuse', or 'matchingrules'.
* Case insensitive.
* @param dn (optional) This paremeter is the DN of the entry whose schema you
* would like to fetch. Entries have the option of specifying
* their own subschemaSubentry that points to the DN of the system
* schema entry which applies to this attribute. If unspecified,
* this will try to retrieve the schema from the RootDSE subschemaSubentry.
* Failing that, we use some commonly known schema DNs. Default
* value is the Root DSE DN (zero-length string)
* @param $method
* @param $schema_to_fetch
* @param string $dn
* @return array an array of strings of this form:
* Array (
* [0] => "(1.3.6.1.4.1.7165.1.2.2.4 NAME 'gidPool' DESC 'Pool ...
* [1] => "(1.3.6.1.4.1.7165.2.2.3 NAME 'sambaAccount' DESC 'Sa ...
* etc.
* Array (
* [0] => "(1.3.6.1.4.1.7165.1.2.2.4 NAME 'gidPool' DESC 'Pool ...
* [1] => "(1.3.6.1.4.1.7165.2.2.3 NAME 'sambaAccount' DESC 'Sa ...
* etc.
*/
private function getRawSchema($method,$schema_to_fetch,$dn='') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -1549,6 +1563,7 @@ class ldap extends DS {
* Gets a single ObjectClass object specified by name.
*
* @param string $oclass_name The name of the objectClass to fetch.
* @param null $method
* @param string $dn (optional) It is easier to fetch schema if a DN is provided
* which defines the subschemaSubEntry attribute (all entries should).
*
@ -1579,7 +1594,8 @@ class ldap extends DS {
/**
* Gets a single AttributeType object specified by name.
*
* @param string $oclass_name The name of the AttributeType to fetch.
* @param $attr_name
* @param null $method
* @param string $dn (optional) It is easier to fetch schema if a DN is provided
* which defines the subschemaSubEntry attribute (all entries should).
*
@ -1612,6 +1628,7 @@ class ldap extends DS {
* server. Each array entry's key is the name of the objectClass
* in lower-case and the value is an ObjectClass object.
*
* @param null $method
* @param string $dn (optional) It is easier to fetch schema if a DN is provided
* which defines the subschemaSubEntry attribute (all entries should).
*
@ -1671,6 +1688,7 @@ class ldap extends DS {
* server. Each array entry's key is the name of the attributeType
* in lower-case and the value is an AttributeType object.
*
* @param null $method
* @param string $dn (optional) It is easier to fetch schema if a DN is provided
* which defines the subschemaSubEntry attribute (all entries should).
*
@ -1854,6 +1872,9 @@ class ldap extends DS {
/**
* Returns an array of MatchingRule objects for the specified server.
* The key of each entry is the OID of the matching rule.
* @param null $method
* @param string $dn
* @return array|Returns|null
*/
public function MatchingRules($method=null,$dn='') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -1930,6 +1951,9 @@ class ldap extends DS {
/**
* Returns an array of Syntax objects that this LDAP server uses mapped to
* their descriptions. The key of each entry is the OID of the Syntax.
* @param null $method
* @param string $dn
* @return array|Returns|null
*/
public function SchemaSyntaxes($method=null,$dn='') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -1980,9 +2004,10 @@ class ldap extends DS {
* This function determines if the specified attribute is contained in the force_may list
* as configured in config.php.
*
* @param $attr_name
* @return boolean True if the specified attribute is configured to be force as a may attribute
*/
function isForceMay($attr_name) {
public function isForceMay($attr_name) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
@ -1994,25 +2019,22 @@ class ldap extends DS {
* one attribute of an object. Example calls:
*
* <code>
* print_r(getDNAttrValue('cn=Bob,ou=people,dc=example,dc=com','sn'));
* Array (
* [0] => Smith
* )
* print_r(getDNAttrValue('cn=Bob,ou=people,dc=example,dc=com','sn'));
* Array (
* [0] => Smith
* )
*
* print_r(getDNAttrValue('cn=Bob,ou=people,dc=example,dc=com','objectClass'));
* Array (
* [0] => top
* [1] => person
* )
* Array (
* [0] => top
* [1] => person
* )
* </code>
*
* @param string The distinguished name (DN) of the entry whose attributes/values to fetch.
* @param string The attribute whose value(s) to return (ie, "objectClass", "cn", "userPassword")
* @param string Which connection method resource to use
* @param constant For aliases and referrals, this parameter specifies whether to
* follow references to the referenced DN or to fetch the attributes for
* the referencing DN. See http://php.net/ldap_search for the 4 valid
* options.
* @param $dn
* @param $attr
* @param null $method
* @param int $deref
* @return array
* @see getDNAttrValues
* @todo Caching these values may be problematic with multiple calls and different deref values.
@ -2044,29 +2066,28 @@ class ldap extends DS {
* Example of its usage:
* <code>
* print_r(getDNAttrValues('cn=Bob,ou=pepole,dc=example,dc=com')
* Array (
* [objectClass] => Array (
* [0] => person
* [1] => top
* )
* [cn] => Array (
* [0] => Bob
* )
* [sn] => Array (
* [0] => Jones
* )
* [dn] => Array (
* [0] => cn=Bob,ou=pepole,dc=example,dc=com
* )
* )
* Array (
* [objectClass] => Array (
* [0] => person
* [1] => top
* )
* [cn] => Array (
* [0] => Bob
* )
* [sn] => Array (
* [0] => Jones
* )
* [dn] => Array (
* [0] => cn=Bob,ou=pepole,dc=example,dc=com
* )
* )
* </code>
*
* @param string The distinguished name (DN) of the entry whose attributes/values to fetch.
* @param string Which connection method resource to use
* @param constant For aliases and referrals, this parameter specifies whether to
* follow references to the referenced DN or to fetch the attributes for
* the referencing DN. See http://php.net/ldap_search for the 4 valid
* options.
* @param $dn
* @param null $method
* @param int $deref
* @param array $attrs
* @param bool $nocache
* @return array
* @see getDNSysAttrs
* @see getDNAttrValue
@ -2127,9 +2148,10 @@ class ldap extends DS {
* Some examples include 'distinguishedName', 'member' and 'uniqueMember'.
*
* @param string $attr_name The name of the attribute of interest (case insensitive)
* @param null $method
* @return boolean
*/
function isDNAttr($attr_name,$method=null) {
public function isDNAttr($attr_name, $method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
@ -2170,7 +2192,7 @@ class ldap extends DS {
* @return boolean
* @see draw_jpeg_photo
*/
function isJpegPhoto($attr_name) {
public function isJpegPhoto($attr_name) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
@ -2201,7 +2223,7 @@ class ldap extends DS {
* @param string $attr_name The name of the attribute to test.
* @return boolean
*/
function isAttrBoolean($attr_name) {
public function isAttrBoolean($attr_name) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
@ -2227,7 +2249,7 @@ class ldap extends DS {
*
* @see isJpegPhoto
*/
function isAttrBinary($attr_name) {
public function isAttrBinary($attr_name) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
@ -2313,7 +2335,7 @@ class ldap extends DS {
* @param dn $group DN to see if user is a member
* @return bool true|false
*/
function userIsMember($user,$group) {
public function userIsMember($user, $group) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
@ -2343,6 +2365,8 @@ class ldap extends DS {
/**
* This function will determine if the user is allowed to login based on a filter
* @param $dn
* @return bool
*/
protected function userIsAllowedLogin($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -2410,4 +2434,4 @@ class ldap extends DS {
return false;
}
}
?>

View File

@ -13,7 +13,7 @@
* @subpackage DataStore
*/
class ldap_pla extends ldap {
function __construct($index) {
public function __construct($index) {
parent::__construct($index);
$this->default->appearance['password_hash'] = array(
@ -161,7 +161,7 @@ class ldap_pla extends ldap {
*
* @return boolean true if the feature is enabled and false otherwise.
*/
function isShowCreateEnabled() {
public function isShowCreateEnabled() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
@ -206,7 +206,7 @@ class ldap_pla extends ldap {
*
* @return boolean
*/
function isBranchRenameEnabled() {
public function isBranchRenameEnabled() {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
@ -230,7 +230,7 @@ class ldap_pla extends ldap {
* @param string (optional) The current value of the attribute (speeds up the process by searching for carriage returns already in the attribute value)
* @return boolean
*/
function isMultiLineAttr($attr_name,$val=null) {
public function isMultiLineAttr($attr_name, $val=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
@ -340,6 +340,10 @@ class ldap_pla extends ldap {
/**
* Add objects
* @param $dn
* @param $entry_array
* @param null $method
* @return bool
*/
public function add($dn,$entry_array,$method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -384,6 +388,9 @@ class ldap_pla extends ldap {
/**
* Delete objects
* @param $dn
* @param null $method
* @return bool
*/
public function delete($dn,$method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -410,6 +417,12 @@ class ldap_pla extends ldap {
/**
* Rename objects
* @param $dn
* @param $new_rdn
* @param $container
* @param $deleteoldrdn
* @param null $method
* @return bool
*/
public function rename($dn,$new_rdn,$container,$deleteoldrdn,$method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -437,6 +450,10 @@ class ldap_pla extends ldap {
/**
* Modify objects
* @param $dn
* @param $attrs
* @param null $method
* @return bool
*/
public function modify($dn,$attrs,$method=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -656,4 +673,4 @@ class ldap_pla extends ldap {
return true;
}
}
?>

View File

@ -32,7 +32,7 @@ class Exporter {
$this->accept();
}
static function types() {
public static function types() {
$type = array();
$details = ExportCSV::getType();
@ -112,7 +112,7 @@ abstract class Export {
/**
* Return the LDAP server ID
*
* @return int Server ID
* @return The Server ID
*/
protected function getServerID() {
return get_request('server_id','REQUEST');
@ -246,7 +246,7 @@ class ExportCSV extends Export {
return array('type'=>'CSV','description' => 'CSV (Spreadsheet)','extension'=>'csv');
}
function export() {
public function export() {
$server = $this->getServer();
/* Go thru and find all the attribute names first. This is needed, because, otherwise we have
@ -332,6 +332,8 @@ class ExportCSV extends Export {
/**
* Function to escape data, where the qualifier happens to also
* be in the data.
* @param $var
* @return mixed
*/
private function LdapEscape ($var) {
return str_replace($this->qualifier,$this->escapeCode.$this->qualifier,$var);
@ -352,7 +354,7 @@ class ExportDSML extends Export {
/**
* Export entries to DSML format
*/
function export() {
public function export() {
$server = $this->getServer();
# Not very elegant, but do the job for the moment as we have just 4 level
@ -576,7 +578,7 @@ class ExportVCARD extends Export {
/**
* Export entries to VCARD format
*/
function export() {
public function export() {
$server = $this->getServer();
$output = '';
@ -640,4 +642,4 @@ class ExportVCARD extends Export {
return $output;
}
}
?>

View File

@ -50,6 +50,7 @@ if (file_exists(LIBDIR.'functions.custom.php'))
/**
* Loads class definition
* @param $className
*/
function autoload($className) {
if (file_exists(HOOKSDIR."classes/$className.php"))
@ -232,6 +233,8 @@ function app_version() {
* This function will convert the browser two character language into the
* default 5 character language, where the country portion should NOT be
* assumed to be upper case characters of the first two characters.
* @param $lang
* @return string
*/
function auto_lang($lang) {
switch ($lang) {
@ -243,6 +246,8 @@ function auto_lang($lang) {
/**
* Makes sure that the config file is properly setup.
* @param $config_file
* @return Config
*/
function check_config($config_file) {
# Read in config_default.php
@ -310,7 +315,7 @@ function check_config($config_file) {
$body .= '</center>';
$block = new block();
$block->SetBody($body);
$block->setBody($body);
$www['page'] = new page();
$www['page']->block_add('body',$block);
$www['page']->display();
@ -341,6 +346,7 @@ function check_config($config_file) {
/**
* Commands available in the control_panel of the page
*
* @param $type
* @return array
*/
function cmd_control_pane($type) {
@ -414,7 +420,8 @@ function cmd_control_pane($type) {
* This function dumps the $variable for debugging purposes
*
* @param string|array Variable to dump
* @param boolean Whether to stop execution or not.
* @param bool $die
* @param bool $onlydebugaddr
*/
function debug_dump($variable,$die=false,$onlydebugaddr=false) {
if ($onlydebugaddr &&
@ -441,6 +448,7 @@ function debug_dump($variable,$die=false,$onlydebugaddr=false) {
/**
* This function generates a backtrace
*
* @param string $msg
* @param boolean Whether to stop execution or not.
*/
function debug_dump_backtrace($msg='Calling BackTrace',$die=false) {
@ -449,6 +457,7 @@ function debug_dump_backtrace($msg='Calling BackTrace',$die=false) {
/**
* Send a debug as a sys message
* @param $msg
*/
function debug_sysmsg($msg) {
system_message(array('title'=>_('Debug'),'body'=>$msg,'type'=>'debug'));
@ -459,12 +468,12 @@ function debug_sysmsg($msg) {
*
* The global debug level is turned on in your configuration file by setting:
* <code>
* $config->custom->debug['level'] = 255;
* $config->custom->debug['level'] = 255;
* </code>
* together with atleast one output direction (currently file and syslog are supported).
* <code>
* $config->custom->debug['file'] = '/tmp/app_debug.log';
* $config->custom->debug['syslog'] = true;
* $config->custom->debug['file'] = '/tmp/app_debug.log';
* $config->custom->debug['syslog'] = true;
* </code>
*
* The debug level is turned into binary, then if the message levels bit is on
@ -481,8 +490,9 @@ function debug_sysmsg($msg) {
* 7( 64) = Other non generic messages
* 8(128) = Page Processing
* 9(256) = Hooks Processing
* @param string Message to send to syslog
* @param int Log bit number for this message.
* @param $msg
* @param $level
* @param $indent
* @see syslog.php
*/
function debug_log($msg,$level,$indent) {
@ -572,6 +582,11 @@ function debug_log($msg,$level,$indent) {
/**
* Display an error message in the system message panel of the page.
* @param $msg
* @param string $type
* @param null $redirect
* @param bool $fatal
* @param bool $backtrace
*/
function error($msg,$type='note',$redirect=null,$fatal=false,$backtrace=false) {
global $www;
@ -599,7 +614,7 @@ function error($msg,$type='note',$redirect=null,$fatal=false,$backtrace=false) {
# Do we have a backtrace to display?
if ($backtrace) {
$backtraceblock = new block();
$backtraceblock->SetTitle('PHP Debug Backtrace');
$backtraceblock->setTitle('PHP Debug Backtrace');
$body = '<table class="result_table">';
$body .= "\n";
@ -632,7 +647,7 @@ function error($msg,$type='note',$redirect=null,$fatal=false,$backtrace=false) {
$body .= '</table>';
$body .= "\n";
$backtraceblock->SetBody($body);
$backtraceblock->setBody($body);
$www['page']->block_add('body',$backtraceblock);
}
@ -646,6 +661,10 @@ function error($msg,$type='note',$redirect=null,$fatal=false,$backtrace=false) {
/**
* Return the result of a form variable, with optional default
*
* @param $attr
* @param string $type
* @param bool $die
* @param null $default
* @return The form GET/REQUEST/SESSION/POST variable value or its default
*/
function get_request($attr,$type='POST',$die=false,$default=null) {
@ -682,6 +701,9 @@ function get_request($attr,$type='POST',$die=false,$default=null) {
/**
* Record a system message.
* This function can be used as an alternative to generate a system message, if page hasnt yet been defined.
* @param $msg
* @param null $redirect
* @return null
*/
function system_message($msg,$redirect=null) {
if (! is_array($msg))
@ -873,6 +895,9 @@ function full_str_pad($input,$pad_length,$pad_string='',$pad_type=0) {
* the same page load, and one in a session for multiple calls within
* the same user session (spanning multiple page loads).
*
* @param $index
* @param $item
* @param string $subitem
* @return Returns the cached attributed requested,
* or null if there is nothing cached..
*/
@ -897,6 +922,11 @@ function get_cached_item($index,$item,$subitem='null') {
* Caches the specified $item for the specified $index.
*
* Returns true on success of false on failure.
* @param $index
* @param $item
* @param string $subitem
* @param $data
* @return bool
*/
function set_cached_item($index,$item,$subitem='null',$data) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -917,6 +947,9 @@ function set_cached_item($index,$item,$subitem='null',$data) {
/**
* Deletes the cache for a specified $item for the specified $index
* @param $index
* @param $item
* @param string $subitem
*/
function del_cached_item($index,$item,$subitem='null') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -973,9 +1006,9 @@ function set_cookie($name,$val,$expire=null,$dir=null) {
* Get a customized file for a server
* We don't need any caching, because it's done by PHP
*
* @param int The ID of the server
* @param string The requested filename
*
* @param $index
* @param $filename
* @param $path
* @return string The customized filename, if exists, or the standard one
*/
function get_custom_file($index,$filename,$path) {
@ -999,10 +1032,10 @@ function get_custom_file($index,$filename,$path) {
/**
* Sort a multi dimensional array.
*
* @param array Multi demension array passed by reference
* @param string Comma delimited string of sort keys.
* @param boolean Whether to reverse sort.
* @return array Sorted multi demension array.
* @param $data
* @param $sortby
* @param int $rev
* @return void Sorted multi demension array.
*/
function masort(&$data,$sortby,$rev=0) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -1441,10 +1474,11 @@ function pla_compare_dns($dn1,$dn2) {
*
* See config.php.example for more notes on the two mechanisms.
*
* @param string Base to start the search from
* @param string Attribute to query
* @param boolean Increment the result (for pool searches)
* @param string LDAP filter to use (for pool searches)
* @param $base
* @param $attr
* @param bool $increment
* @param bool $filter
* @param null $startmin
* @return int
*/
function get_next_number($base,$attr,$increment=false,$filter=false,$startmin=null) {
@ -1636,7 +1670,9 @@ function get_next_number($base,$attr,$increment=false,$filter=false,$startmin=nu
* are general to an LDAP audience, the phpLDAPadmin team will gladly accept them
* as a patch.
*
* @param string The DN of the entry whose icon you wish to fetch.
* @param $server_id
* @param $dn
* @param array $object_classes
* @return string
*/
function get_icon($server_id,$dn,$object_classes=array()) {
@ -1869,7 +1905,8 @@ function random_salt($length) {
* 'cn=Manager' (it is really the exact opposite of ds_ldap::getContainer()).
*
* @param string The DN whose RDN to return.
* @param boolean If true, include attributes in the RDN string. See http://php.net/ldap_explode_dn for details
* @param int $include_attrs
* @param bool $decode
* @return string The RDN
*/
function get_rdn($dn,$include_attrs=0,$decode=false) {
@ -1893,6 +1930,8 @@ function get_rdn($dn,$include_attrs=0,$decode=false) {
/**
* Split an RDN into its attributes
* @param $rdn
* @return array
*/
function rdn_explode($rdn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -2028,6 +2067,9 @@ function support_oid_to_text($key) {
/**
* Print an LDAP error message
* @param $msg
* @param $errnum
* @return string
*/
function ldap_error_msg($msg,$errnum) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -2311,8 +2353,9 @@ function hash_password($password_clear,$enc_type) {
* Given a clear-text password and a hash, this function determines if the clear-text password
* is the password that was used to generate the hash. This is handy to verify a user's password
* when all that is given is the hash and a "guess".
* @param String The hash.
* @param String The password in clear text to test.
* @param $cryptedpassword
* @param $plainpassword
* @param string $attribute
* @return Boolean True if the clear password matches the hash, and false otherwise.
*/
function password_check($cryptedpassword,$plainpassword,$attribute='userpassword') {
@ -2521,13 +2564,10 @@ function get_enc_type($user_password) {
/**
* Draws an HTML browse button which, when clicked, pops up a DN chooser dialog.
* @param string The name of the form element to which this chooser
* dialog will publish the user's choice. The form element must be a member
* of a form with the "name" or "id" attribute set in the form tag, and the element
* must also define "name" or "id" for JavaScript to uniquely identify it.
* Example $form_element values may include "creation_form.container" or
* "edit_form.member_uid". See /templates/modification/default.php for example usage.
* @param boolean (optional) If true, the function draws the localized text "choose" to the right of the button.
* @param $form
* @param $element
* @param bool $include_choose_text
* @param string $rdn
*/
function draw_chooser_link($form,$element,$include_choose_text=true,$rdn='none') {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -2607,6 +2647,8 @@ function pla_explode_dn($dn,$with_attributes=0) {
/**
* Parse a DN and escape any special characters
* @param $dn
* @return string|string[]|null
*/
function dn_escape($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -2628,6 +2670,8 @@ function dn_escape($dn) {
/**
* Parse a DN and unescape any special characters
* @param $dn
* @return array|string|string[]|null
*/
function dn_unescape($dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -2658,8 +2702,8 @@ function dn_unescape($dn) {
* Fetches the URL for the specified item. This is a convenience function for
* fetching project HREFs (like bugs)
*
* @param string One of "open_bugs", "add_bug", "donate", or "add_rfe"
* (rfe = request for enhancement)
* @param $type
* @param string $extra_info
* @return string The URL to the requested item.
*/
function get_href($type,$extra_info='') {
@ -2786,6 +2830,9 @@ function pla_reverse_dn($dn) {
/**
* Attribute sorting
* @param $a
* @param $b
* @return int|lt
*/
function sortAttrs($a,$b) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -2873,6 +2920,9 @@ function in_array_ignore_case($needle,$haystack) {
/**
* Gets a DN string using the user-configured tree_display_format string to format it.
* @param $server
* @param $entry
* @return mixed
*/
function draw_formatted_dn($server,$entry) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -2931,6 +2981,12 @@ function draw_formatted_dn($server,$entry) {
/**
* Server html select list
* @param null $selected
* @param bool $logged_on
* @param string $name
* @param bool $isVisible
* @param null $js
* @return string
*/
function server_select_list($selected=null,$logged_on=false,$name='index',$isVisible=true,$js=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -2969,6 +3025,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
* @param $hex
* @return string
*/
function littleEndian($hex) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -3140,9 +3198,9 @@ function password_generate() {
* This function returns an array of $num_req values
* randomly picked from the $input array
*
* @param array Array of values
* @param integer Number of values in returned array
* @return string The padded string
* @param $input
* @param $num_req
* @return array The padded string
*/
function a_array_rand($input,$num_req) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -3189,7 +3247,8 @@ function random_junk() {
/**
* Returns a HTML id that can be used in the URL after the #.
*
* @param string The DN to pretty-print.
* @param $sid
* @param $dn
* @return string
*/
function htmlid($sid,$dn) {
@ -3208,4 +3267,4 @@ function isAjaxEnabled() {
else
return false;
}
?>

View File

@ -32,7 +32,7 @@ class Importer {
$this->accept();
}
static function types() {
public static function types() {
$type = array();
$details = ImportLDIF::getType();
@ -117,7 +117,7 @@ abstract class Import {
$server = $this->getServer();
switch ($template->getType()) {
case 'add':
case 'add':
return $server->add($template->getDN(),$template->getLDAPadd());
case 'modify':
@ -247,6 +247,8 @@ class ImportLDIF extends Import {
/**
* Get the Attribute and Decoded Value
* @param $line
* @return array
*/
private function getAttrValue($line) {
list($attr,$value) = explode(':',$line,2);
@ -263,7 +265,7 @@ class ImportLDIF extends Import {
/**
* Get the lines of the next entry
*
* @return The lines (unfolded) of the next entry
* @return array lines (unfolded) of the next entry
*/
private function nextLines() {
$current = array();
@ -378,6 +380,8 @@ class ImportLDIF extends Import {
/**
* Method to retrieve the attribute value of a ldif line,
* and get the base 64 decoded value if it is encoded
* @param $value
* @return bool|string
*/
private function getAttributeValue($value) {
$return = '';
@ -409,6 +413,7 @@ class ImportLDIF extends Import {
/**
* Build the attributes array when the change type is add.
* @param $lines
*/
private function getAddDetails($lines) {
foreach ($lines as $line) {
@ -428,6 +433,8 @@ class ImportLDIF extends Import {
/**
* Build the attributes array for the entry when the change type is modify
* @param $lines
* @return bool
*/
private function getModifyDetails($lines) {
if (! count($lines))
@ -555,8 +562,10 @@ class ImportLDIF extends Import {
/**
* Build the attributes for the entry when the change type is modrdn
* @param $lines
* @return bool
*/
function getModRDNAttributes($lines) {
public function getModRDNAttributes($lines) {
$server = $this->getServer();
$attrs = array();
@ -606,4 +615,4 @@ class ImportLDIF extends Import {
return $this->template;
}
}
?>

View File

@ -298,7 +298,7 @@ class page {
# Add the Session System Messages
if (isset($_SESSION['sysmsg']) && is_array($_SESSION['sysmsg'])) {
foreach ($_SESSION['sysmsg'] as $msg)
foreach ($_SESSION['sysmsg'] as $msg)
$this->setsysmsg($msg);
unset($_SESSION['sysmsg']);
@ -328,6 +328,9 @@ class page {
/**
* Only show a particular page frame - used by an AJAX call
* @param $frame
* @param bool $compress
* @param bool $raw
*/
public function show($frame,$compress=false,$raw=false) {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -375,7 +378,7 @@ class page {
'TREE'=>true,
'FOOT'=>true
);
if ($_SESSION[APPCONFIG]->getValue('appearance','minimalMode')) {
$display = array(
'HEAD'=>false,
@ -516,4 +519,4 @@ class block {
return $output;
}
}
?>

View File

@ -19,4 +19,4 @@
*/
class Queries extends xmlTemplates {
}
?>

View File

@ -68,6 +68,7 @@ abstract class SchemaItem {
* Return the objects name.
*
* param boolean $lower Return the name in lower case (default)
* @param bool $lower
* @return string The name
*/
public function getName($lower=true) {
@ -104,6 +105,8 @@ class ObjectClass extends SchemaItem {
/**
* Creates a new ObjectClass object given a raw LDAP objectClass string.
* @param $class
* @param $server
*/
public function __construct($class,$server) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -277,6 +280,10 @@ class ObjectClass extends SchemaItem {
/**
* Parse an LDAP schema list
* @param $i
* @param $strings
* @param $attrs
* @return
*/
private function parseList($i,$strings,&$attrs) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -368,7 +375,7 @@ class ObjectClass extends SchemaItem {
* Gets an array of AttributeType objects that entries of this ObjectClass must define.
* This differs from getMustAttrNames in that it returns an array of AttributeType objects
*
* @param array $parents An array of ObjectClass objects to use when traversing
* @param bool $parents An array of ObjectClass objects to use when traversing
* the inheritance tree. This presents some what of a bootstrapping problem
* as we must fetch all objectClasses to determine through inheritance which
* attributes this objectClass requires.
@ -409,7 +416,7 @@ class ObjectClass extends SchemaItem {
* Gets an array of AttributeType objects that entries of this ObjectClass may define.
* This differs from getMayAttrNames in that it returns an array of AttributeType objects
*
* @param array $parents An array of ObjectClass objects to use when traversing
* @param bool $parents An array of ObjectClass objects to use when traversing
* the inheritance tree. This presents some what of a bootstrapping problem
* as we must fetch all objectClasses to determine through inheritance which
* attributes this objectClass provides.
@ -459,7 +466,7 @@ class ObjectClass extends SchemaItem {
* This differs from getMustAttrs in that it returns an array of strings rather than
* array of AttributeType objects
*
* @param array $parents An array of ObjectClass objects to use when traversing
* @param bool $parents An array of ObjectClass objects to use when traversing
* the inheritance tree. This presents some what of a bootstrapping problem
* as we must fetch all objectClasses to determine through inheritance which
* attributes this objectClass provides.
@ -486,7 +493,7 @@ class ObjectClass extends SchemaItem {
* This differs from getMayAttrs in that it returns an array of strings rather than
* array of AttributeType objects
*
* @param array $parents An array of ObjectClass objects to use when traversing
* @param bool $parents An array of ObjectClass objects to use when traversing
* the inheritance tree. This presents some what of a bootstrapping problem
* as we must fetch all objectClasses to determine through inheritance which
* attributes this objectClass provides.
@ -622,6 +629,8 @@ class ObjectClass extends SchemaItem {
/**
* Determine if an array is listed in the force_may attrs
* @param $attr
* @return bool
*/
public function isForceMay($attr) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -736,6 +745,7 @@ class AttributeType extends SchemaItem {
/**
* Creates a new AttributeType object from a raw LDAP AttributeType string.
* @param $attr
*/
public function __construct($attr) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -1286,6 +1296,7 @@ class AttributeType extends SchemaItem {
class Syntax extends SchemaItem {
/**
* Creates a new Syntax object from a raw LDAP syntax string.
* @param $class
*/
public function __construct($class) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -1333,8 +1344,9 @@ class MatchingRule extends SchemaItem {
/**
* Creates a new MatchingRule object from a raw LDAP MatchingRule string.
* @param $strings
*/
function __construct($strings) {
public function __construct($strings) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
@ -1416,6 +1428,7 @@ class MatchingRule extends SchemaItem {
/**
* Adds an attribute name to the list of attributes who use this MatchingRule
*
* @param $attr
* @return true if the attribute was added and false otherwise (already in the list)
*/
public function addUsedByAttr($attr) {
@ -1454,7 +1467,7 @@ class MatchingRuleUse extends SchemaItem {
# An array of attribute names who use this MatchingRule
private $used_by_attrs = array();
function __construct($strings) {
public function __construct($strings) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
@ -1536,4 +1549,4 @@ class MatchingRuleUse extends SchemaItem {
return $this->used_by_attrs;
}
}
?>

View File

@ -72,7 +72,7 @@ function app_session_param() {
*
* @see common.php
* @see APP_SESSION_ID
* @return boolean Returns true if the session was started the first time
* @return void Returns true if the session was started the first time
*/
function app_session_start() {
$sysmsg = null;
@ -173,4 +173,4 @@ function app_session_start() {
function app_session_close() {
@session_write_close();
}
?>

View File

@ -20,4 +20,4 @@
*/
class Templates extends xmlTemplates {
}
?>

View File

@ -15,11 +15,11 @@
* @subpackage XML
*/
class xml2array {
var $stack = array();
var $stack_ref;
var $arrOutput = array();
var $resParser;
var $strXmlData;
public $stack = array();
public $stack_ref;
public $arrOutput = array();
public $resParser;
public $strXmlData;
private function push_pos(&$pos) {
$this->stack[count($this->stack)] = &$pos;
@ -102,6 +102,7 @@ class xml2array {
/**
* This function will parse an XML array and make a normal array.
*
* @param $details
* @return array - Clean XML data
*/
private function cleanXML($details) {

View File

@ -18,7 +18,7 @@ abstract class xmlTemplates {
# Our array of the available templates.
protected $templates = array();
function __construct($server_id) {
public function __construct($server_id) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
@ -86,7 +86,7 @@ abstract class xmlTemplates {
if (! in_array($filename,$this->getTemplateFiles())) {
$templatename = preg_replace('/.xml$/','',$file);
$this->templates[$index] = new $class['name']($this->server_id,$templatename,$filename,$type,$index);
$index++;
@ -183,8 +183,9 @@ abstract class xmlTemplates {
* Return a list of templates by their type
* This function should return a sorted list, as the array is built sorted.
*
* @param string Type of template, eg: creation, modification
* @param boolean Exclude templates purposely disabled.
* @param null $type
* @param null $container
* @param bool $disabled
* @return array List of templates of the type
*/
public function getTemplates($type=null,$container=null,$disabled=false) {
@ -219,7 +220,7 @@ abstract class xmlTemplates {
* @param string The template ID as it was when it was generated (normally used in $_REQUEST vars).
* @return object Template (or default template if the ID doesnt exist)
*/
function getTemplate($templateid) {
public function getTemplate($templateid) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
@ -385,6 +386,7 @@ abstract class xmlTemplate {
/**
* Test if a template is of a type
*
* @param $type
* @return boolean
*/
public function isType($type) {
@ -423,7 +425,10 @@ abstract class xmlTemplate {
/**
* Add another attribute to this template
*
* @return int Attribute ID
* @param $name
* @param $value
* @param null $source
* @return Attribute|DnAttribute|GidAttribute|MultiLineAttribute Attribute ID
*/
public function addAttribute($name,$value,$source=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
@ -493,4 +498,4 @@ abstract class xmlTemplate {
*/
public function isAdminDisabled() {}
}
?>