Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion htdocs/cmd.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
$www['page'] = new page($app['server']->getIndex());

# See if we can render the command
if (trim($www['cmd'])) {
if ($www['cmd'] && trim($www['cmd'])) {
# If this is a READ-WRITE operation, the LDAP server must not be in READ-ONLY mode.
if ($app['server']->isReadOnly() && ! in_array(get_request('cmd','REQUEST'),$app['readwrite_cmds']))
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
Expand Down
2 changes: 1 addition & 1 deletion htdocs/collapse.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
$tree = get_cached_item($app['server']->getIndex(),'tree');
$entry = $tree->getEntry($dn);
$entry->close();
set_cached_item($app['server']->getIndex(),'tree','null',$tree);
set_cached_item($app['server']->getIndex(),$tree,'tree','null');

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()));
Expand Down
2 changes: 1 addition & 1 deletion htdocs/draw_tree_node.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
}

if ($treesave)
set_cached_item($app['server']->getIndex(),'tree','null',$tree);
set_cached_item($app['server']->getIndex(),$tree,'tree','null');

if ($request['dn'])
echo $tree->draw_children($dnentry,$request['code']);
Expand Down
2 changes: 1 addition & 1 deletion htdocs/expand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
$tree = get_cached_item($app['server']->getIndex(),'tree');
$entry = $tree->getEntry($dn);
$entry->open();
set_cached_item($app['server']->getIndex(),'tree','null',$tree);
set_cached_item($app['server']->getIndex(),$tree,'tree','null');

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()));
Expand Down
2 changes: 1 addition & 1 deletion htdocs/export_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
require LIBDIR.'export_functions.php';

$request = array();
$request['dn'] = get_request('dn','GET');
$request['dn'] = get_request('dn','GET',false,'');
$request['format'] = get_request('format','GET',false,get_line_end_format());
$request['scope'] = get_request('scope','GET',false,'base');
$request['exporter_id'] = get_request('exporter_id','GET',false,'LDIF');
Expand Down
2 changes: 1 addition & 1 deletion htdocs/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
if ($pass) {
$user = array();
$user['login'] = get_request('login');
$user['password'] = get_request('login_pass');
$user['password'] = get_request('login_pass', 'POST', false, '');

if ($user['login'] && !strlen($user['password'])) {
system_message(array(
Expand Down
4 changes: 2 additions & 2 deletions htdocs/password_checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

$request = array();
$request['componentid'] = get_request('componentid','REQUEST');
$request['hash'] = get_request('hash','REQUEST');
$request['password'] = get_request('check_password','REQUEST');
$request['hash'] = get_request('hash','REQUEST',false,'');
$request['password'] = get_request('check_password','REQUEST',false,'');
$request['action'] = get_request('action','REQUEST');
$request['attribute'] = get_request('attr','REQUEST');

Expand Down
2 changes: 1 addition & 1 deletion htdocs/refresh.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
$entry->open();
}

set_cached_item($app['server']->getIndex(),'tree','null',$tree);
set_cached_item($app['server']->getIndex(),$tree,'tree','null');
}

if (get_request('meth','REQUEST') == 'ajax')
Expand Down
6 changes: 3 additions & 3 deletions htdocs/schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@

foreach ($sattrs as $attr) {
if (isAjaxEnabled() || (is_null($entry['value']) || ! trim($entry['value']) || $entry['value']==$attr->getName())) {
if ((! is_null($entry['value']) && $entry['value']==$attr->getName()) || ! trim($entry['value']))
if (!is_string($entry['value']) || $entry['value']==$attr->getName() || !trim($entry['value']))
$entry['viewed'] = true;

if (isAjaxEnabled() && $entry['value'])
Expand Down Expand Up @@ -380,7 +380,7 @@
$desc = $rule->getName(false);

if (isAjaxEnabled() || (is_null($entry['value']) || ! trim($entry['value']) || $entry['value']==$rule->getName())) {
if ((! is_null($entry['value']) && $entry['value']==$rule->getName()) || ! trim($entry['value']))
if (!is_string($entry['value']) || $entry['value']==$rule->getName() || !trim($entry['value']))
$entry['viewed'] = true;

if (null != $rule->getDescription())
Expand Down Expand Up @@ -468,7 +468,7 @@

foreach ($socs as $name => $oclass) {
if (isAjaxEnabled() || (is_null($entry['value']) || ! trim($entry['value']) || $entry['value']==$oclass->getName())) {
if ((! is_null($entry['value']) && $entry['value']==$oclass->getName()) || ! trim($entry['value']))
if (!is_string($entry['value']) || $entry['value']==$oclass->getName() || !trim($entry['value']))
$entry['viewed'] = true;

if (isAjaxEnabled() && $entry['value'])
Expand Down
2 changes: 1 addition & 1 deletion htdocs/view_jpeg_photo.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
if (! isset($jpeg_data[$request['attr']][$request['index']])) {
if (function_exists('imagecreate')) {
$im = imagecreate(160,30);
if (is_resource($im)) {
if ($im) {
header('Content-type: image/png');

# Set the background
Expand Down
2 changes: 1 addition & 1 deletion lib/AttributeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function newAttribute($name,$values,$server_id,$source=null) {
return $this->newGidAttribute($name,$values,$server_id,$source);

} else {
return new Attribute($name,$values,$server_id,$source);
return new PLAAttribute($name,$values,$server_id,$source);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/BinaryAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @package phpLDAPadmin
* @subpackage Templates
*/
class BinaryAttribute extends Attribute {
class BinaryAttribute extends PLAAttribute {
protected $filepaths;
protected $filenames;

Expand Down
2 changes: 1 addition & 1 deletion lib/DateAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
* @package phpLDAPadmin
* @subpackage Templates
*/
class DateAttribute extends Attribute {
class DateAttribute extends PLAAttribute {
}
?>
2 changes: 1 addition & 1 deletion lib/DnAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
* @package phpLDAPadmin
* @subpackage Templates
*/
class DnAttribute extends Attribute {
class DnAttribute extends PLAAttribute {
}
?>
2 changes: 1 addition & 1 deletion lib/GidAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
* @package phpLDAPadmin
* @subpackage Templates
*/
class GidAttribute extends Attribute {
class GidAttribute extends PLAAttribute {
}
?>
2 changes: 1 addition & 1 deletion lib/HTMLTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ protected function draw_server_name() {

if (! is_null($server->inactivityTime())) {
$m = sprintf(_('Inactivity will log you off at %s'),
strftime('%H:%M',$server->inactivityTime()));
date('%H:%M',$server->inactivityTime()));
printf(' <img width="14" height="14" src="%s/timeout.png" title="%s" alt="%s"/>',IMGDIR,$m,'Timeout');
}
echo '</td></tr>';
Expand Down
2 changes: 1 addition & 1 deletion lib/MultiLineAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @package phpLDAPadmin
* @subpackage Templates
*/
class MultiLineAttribute extends Attribute {
class MultiLineAttribute extends PLAAttribute {
protected $rows = 0;
protected $cols = 0;

Expand Down
2 changes: 1 addition & 1 deletion lib/ObjectClassAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
* @package phpLDAPadmin
* @subpackage Templates
*/
class ObjectClassAttribute extends Attribute {
class ObjectClassAttribute extends PLAAttribute {
}
?>
6 changes: 3 additions & 3 deletions lib/Attribute.php → lib/PLAAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @package phpLDAPadmin
* @subpackage Templates
*/
class Attribute {
class PLAAttribute {
# Attribute Name
public $name;
# Source of this attribute definition
Expand Down Expand Up @@ -258,14 +258,14 @@ public function delValue($i=-1) {
}
}

public function getValue($i) {
public function getValue($i, $default=null) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);

if (isset($this->values[$i]))
return $this->values[$i];
else
return null;
return $default;
}

public function getOldValue($i) {
Expand Down
30 changes: 15 additions & 15 deletions lib/PageRender.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ final public function drawHiddenAttributes() {
final protected function drawHiddenValueAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);

$val = $attribute->getValue($i);
$val = $attribute->getValue($i, '');

printf('<input type="hidden" name="new_values[%s][%s]" id="new_values_%s_%s" value="%s" />',
htmlspecialchars($attribute->getName()),$i,htmlspecialchars($attribute->getName()),$i,
Expand Down Expand Up @@ -607,7 +607,7 @@ protected function drawFormValueAttribute($attribute,$i) {
protected function drawFormReadOnlyValueAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);

$val = $attribute->getValue($i);
$val = $attribute->getValue($i, '');

printf('<input type="text" class="roval" name="new_values[%s][%s]" id="new_values_%s_%s" value="%s" readonly="readonly" />',
htmlspecialchars($attribute->getName()),$i,htmlspecialchars($attribute->getName()),$i,htmlspecialchars($val));
Expand All @@ -616,7 +616,7 @@ protected function drawFormReadOnlyValueAttribute($attribute,$i) {
protected function drawFormReadWriteValueAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);

$val = $attribute->getValue($i);
$val = $attribute->getValue($i, '');

if ($attribute->getHelper() || $attribute->getVerify())
echo '<table cellspacing="0" cellpadding="0" border="0"><tr><td valign="top">';
Expand Down Expand Up @@ -720,7 +720,7 @@ protected function drawFormReadWriteValueBinaryAttribute($attribute,$i) {
protected function drawFormReadWriteValueDateAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);

$val = $attribute->getValue($i);
$val = $attribute->getValue($i, '');

echo '<span style="white-space: nowrap;">';
printf('<input type="text" class="value" id="new_values_%s_%s" name="new_values[%s][%s]" value="%s" %s%s %s %s/>&nbsp;',
Expand All @@ -738,7 +738,7 @@ protected function drawFormReadWriteValueDateAttribute($attribute,$i) {
protected function drawFormReadWriteValueDnAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);

$val = $attribute->getValue($i);
$val = $attribute->getValue($i, '');

if ($attribute->getHelper())
echo '<table cellspacing="0" cellpadding="0"><tr><td valign="top">';
Expand Down Expand Up @@ -827,7 +827,7 @@ final protected function drawOldValueJpegAttribute($attribute,$i) {
if (! $attribute->getOldValue($i))
return;

draw_jpeg_photo($this->getServer(),$this->template->getDN(),$attribute->getName(),$i,false,false);
draw_jpeg_photo($this->getServer(),$this->template->getDN(),$i,$attribute->getName(),false,false);
}

/**
Expand All @@ -844,16 +844,16 @@ final protected function drawCurrentValueJpegAttribute($attribute,$i) {
# If the attribute is modified, the new value needs to be stored in a session variable for the draw_jpeg_photo callback.
if ($attribute->hasBeenModified()) {
$_SESSION['tmp'][$attribute->getName()][$i] = $attribute->getValue($i);
draw_jpeg_photo(null,$this->template->getDN(),$attribute->getName(),$i,false,false);
draw_jpeg_photo(null,$this->template->getDN(),$i,$attribute->getName(),false,false);
} else
draw_jpeg_photo($this->getServer(),$this->template->getDN(),$attribute->getName(),$i,false,false);
draw_jpeg_photo($this->getServer(),$this->template->getDN(),$i,$attribute->getName(),false,false);
}

protected function drawFormReadOnlyValueJpegAttribute($attribute,$i) {
$this->draw('HiddenValue',$attribute,$i);
$_SESSION['tmp'][$attribute->getName()][$i] = $attribute->getValue($i);

draw_jpeg_photo(null,$this->template->getDN(),$attribute->getName(),$i,false,false);
draw_jpeg_photo(null,$this->template->getDN(),$i,$attribute->getName(),false,false);
}

protected function drawFormReadOnlyValueMultiLineAttribute($attribute,$i) {
Expand Down Expand Up @@ -952,7 +952,7 @@ protected function drawFormReadOnlyValuePasswordAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);

$server = $this->getServer();
$val = $attribute->getValue($i);
$val = $attribute->getValue($i, '');

if (trim($val))
$enc_type = get_enc_type($val);
Expand All @@ -974,7 +974,7 @@ protected function drawFormReadWriteValuePasswordAttribute($attribute,$i) {
if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);

$server = $this->getServer();
$val = $attribute->getValue($i);
$val = $attribute->getValue($i, '');

$enc_type = get_enc_type($val);

Expand Down Expand Up @@ -1102,7 +1102,7 @@ protected function drawFormReadWriteValueSelectionAttribute($attribute,$i) {

# This is a single value attribute
} else {
$val = $attribute->getValue($i) ? $attribute->getValue($i) : $attribute->getDefault();
$val = $attribute->getValue($i) ? $attribute->getValue($i) : (is_null($attribute->getDefault())? '': $attribute->getDefault());

if ($attribute->getHelper())
echo '<table cellspacing="0" cellpadding="0"><tr><td valign="top">';
Expand Down Expand Up @@ -1214,15 +1214,15 @@ protected function drawShadowDateShadowAttribute($attribute) {
echo '<br/><small>';
if (($today < $shadow_date) && in_array(strtolower($attribute->getName()),$shadow_before_today_attrs))
printf('<span style="color:red">(%s)</span>',
strftime($_SESSION[APPCONFIG]->getValue('appearance','date'),$shadow_date));
date($_SESSION[APPCONFIG]->getValue('appearance','date'),$shadow_date));

elseif (($today > $shadow_date) && in_array(strtolower($attribute->getName()),$shadow_after_today_attrs))
printf('<span style="color:red">(%s)</span>',
strftime($_SESSION[APPCONFIG]->getValue('appearance','date'),$shadow_date));
date($_SESSION[APPCONFIG]->getValue('appearance','date'),$shadow_date));

else
printf('(%s)',
strftime($_SESSION[APPCONFIG]->getValue('appearance','date'),$shadow_date));
date($_SESSION[APPCONFIG]->getValue('appearance','date'),$shadow_date));

echo '</small><br />';
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PasswordAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
* @package phpLDAPadmin
* @subpackage Templates
*/
class PasswordAttribute extends Attribute {
class PasswordAttribute extends PLAAttribute {
}
?>
2 changes: 1 addition & 1 deletion lib/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function accept() {
$bases = get_request('base','REQUEST',false,null);
$query['filter'] = get_request('filter','REQUEST',false,'objectClass=*');
$query['scope'] = get_request('scope','REQUEST',false,'sub');
$attrs = get_request('display_attrs','REQUEST');
$attrs = get_request('display_attrs','REQUEST',false,'');

$attrs = preg_replace('/\s+/','',$attrs);
if ($attrs)
Expand Down
2 changes: 1 addition & 1 deletion lib/SelectionAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @package phpLDAPadmin
* @subpackage Templates
*/
class SelectionAttribute extends Attribute {
class SelectionAttribute extends PLAAttribute {
protected $selection = array();
protected $multiple;
protected $default;
Expand Down
2 changes: 1 addition & 1 deletion lib/ShadowAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @package phpLDAPadmin
* @subpackage Templates
*/
class ShadowAttribute extends Attribute {
class ShadowAttribute extends PLAAttribute {
public $shadow_before_today_attrs = array('shadowLastChange','shadowMin');
public $shadow_after_today_attrs = array('shadowMax','shadowExpire','shadowWarning','shadowInactive');
}
Expand Down
9 changes: 6 additions & 3 deletions lib/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Template extends xmlTemplate {
# Template RDN attributes
private $rdn;

public function __construct($server_id,$name=null,$filename=null,$type=null,$id=null) {
public function __construct($server_id,$name='',$filename=null,$type=null,$id=null) {
parent::__construct($server_id,$name,$filename,$type,$id);

# If this is the default template, we might disable leafs by default.
Expand Down Expand Up @@ -636,10 +636,13 @@ public function getDN() {

public function getDNEncode($url=true) {
// @todo Be nice to do all this in 1 location
$dn = $this->getDN();
if (is_null($dn))
$dn = '';
if ($url)
return urlencode(preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->getDN()));
return urlencode(preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$dn));
else
return preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->getDN());
return preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$dn);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/TemplateRender.php
Original file line number Diff line number Diff line change
Expand Up @@ -2143,7 +2143,7 @@ protected function drawValueAttribute($attribute,$i) {
if ($attribute->isMultiple() && $i > 0)
return;

$val = $attribute->getValue($i);
$val = $attribute->getValue($i, '');

if ($attribute->isVisible()) {
echo '<table cellspacing="0" cellpadding="0" width="100%" border="0"><tr><td class="icon" style="width: 25px;">';
Expand Down
Loading