More code cleanup

This commit is contained in:
Timothy Warren 2019-02-12 15:34:47 -05:00
parent 0bb492776e
commit 78813e18f9
15 changed files with 56 additions and 55 deletions

View File

@ -5,7 +5,7 @@ For install instructions in non-English languages, see the wiki:
phpLDAPadmin requires the following: phpLDAPadmin requires the following:
a. A web server (Apache, IIS, etc). a. A web server (Apache, IIS, etc).
b. PHP 5.0.0 or newer (with LDAP support) b. PHP 7.0.0 or newer (with LDAP support)
* To install * To install
@ -19,5 +19,5 @@ For install instructions in non-English languages, see the wiki:
See the wiki: See the wiki:
http://phpldapadmin.sourceforge.net http://phpldapadmin.sourceforge.net
Join our mailing list: Join our mailing list:
https://lists.sourceforge.net/lists/listinfo/phpldapadmin-devel https://lists.sourceforge.net/lists/listinfo/phpldapadmin-devel

View File

@ -1 +1 @@
RELEASE-1.2.3 RELEASE-2.0.0

View File

@ -30,7 +30,7 @@ function example_post_session_init() {
system_message(array( system_message(array(
'title'=>sprintf('Hook called [%s]',__METHOD__), 'title'=>sprintf('Hook called [%s]',__METHOD__),
'body'=>sprintf('<i>Global Vars</i>: <small>%s</small>',join('| ',array_keys($GLOBALS))), 'body'=>sprintf('<i>Global Vars</i>: <small>%s</small>',implode('| ',array_keys($GLOBALS))),
'type'=>'info','special'=>true)); 'type'=>'info','special'=>true));
return true; return true;
@ -97,7 +97,7 @@ function example_pre_entry_create() {
system_message(array( system_message(array(
'title'=>sprintf('Hook called [%s]',__METHOD__), 'title'=>sprintf('Hook called [%s]',__METHOD__),
'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attributes: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],join(',',(array_keys($args[3])))), 'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attributes: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],implode(',',(array_keys($args[3])))),
'type'=>'info','special'=>true)); 'type'=>'info','special'=>true));
return true; return true;
@ -119,7 +119,7 @@ function example_post_entry_create() {
system_message(array( system_message(array(
'title'=>sprintf('Hook called [%s]',__METHOD__), 'title'=>sprintf('Hook called [%s]',__METHOD__),
'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attributes: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],join(',',(array_keys($args[3])))), 'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attributes: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],implode(',',(array_keys($args[3])))),
'type'=>'info','special'=>true)); 'type'=>'info','special'=>true));
return true; return true;
@ -229,7 +229,7 @@ function example_pre_entry_modify() {
system_message(array( system_message(array(
'title'=>sprintf('Hook called [%s]',__METHOD__), 'title'=>sprintf('Hook called [%s]',__METHOD__),
'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attributes: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],join('|',array_keys($args[3]))), 'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attributes: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],implode('|',array_keys($args[3]))),
'type'=>'info','special'=>true)); 'type'=>'info','special'=>true));
return true; return true;
@ -251,7 +251,7 @@ function example_post_entry_modify() {
system_message(array( system_message(array(
'title'=>sprintf('Hook called [%s]',__METHOD__), 'title'=>sprintf('Hook called [%s]',__METHOD__),
'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attributes: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],join('|',array_keys($args[3]))), 'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attributes: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],implode('|',array_keys($args[3]))),
'type'=>'info','special'=>true)); 'type'=>'info','special'=>true));
return true; return true;
@ -276,7 +276,7 @@ function example_pre_attr_add() {
system_message(array( system_message(array(
'title'=>sprintf('Hook called [%s]',__METHOD__), 'title'=>sprintf('Hook called [%s]',__METHOD__),
'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>New Values: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],$args[3],join('|',$args[4])), 'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>New Values: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],$args[3],implode('|',$args[4])),
'type'=>'info','special'=>true)); 'type'=>'info','special'=>true));
return true; return true;
@ -299,7 +299,7 @@ function example_post_attr_add() {
system_message(array( system_message(array(
'title'=>sprintf('Hook called [%s]',__METHOD__), 'title'=>sprintf('Hook called [%s]',__METHOD__),
'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>New Values: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],$args[3],join('|',$args[4])), 'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>New Values: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],$args[3],implode('|',$args[4])),
'type'=>'info','special'=>true)); 'type'=>'info','special'=>true));
return true; return true;
@ -324,7 +324,7 @@ function example_pre_attr_modify() {
system_message(array( system_message(array(
'title'=>sprintf('Hook called [%s]',__METHOD__), 'title'=>sprintf('Hook called [%s]',__METHOD__),
'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>Old Values: <small>%s</small></li><li>New Values: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],$args[3],join('|',$args[4]),join('|',$args[5])), 'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>Old Values: <small>%s</small></li><li>New Values: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],$args[3],implode('|',$args[4]),implode('|',$args[5])),
'type'=>'info','special'=>true)); 'type'=>'info','special'=>true));
return true; return true;
@ -347,7 +347,7 @@ function example_post_attr_modify() {
system_message(array( system_message(array(
'title'=>sprintf('Hook called [%s]',__METHOD__), 'title'=>sprintf('Hook called [%s]',__METHOD__),
'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>Old Values: <small>%s</small></li><li>New Values: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],$args[3],join('|',$args[4]),join('|',$args[5])), 'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>Old Values: <small>%s</small></li><li>New Values: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],$args[3],implode('|',$args[4]),implode('|',$args[5])),
'type'=>'info','special'=>true)); 'type'=>'info','special'=>true));
return true; return true;
@ -370,7 +370,7 @@ function example_pre_attr_delete() {
system_message(array( system_message(array(
'title'=>sprintf('Hook called [%s]',__METHOD__), 'title'=>sprintf('Hook called [%s]',__METHOD__),
'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>Old Values: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],$args[3],join('|',$args[4])), 'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>Old Values: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],$args[3],implode('|',$args[4])),
'type'=>'info','special'=>true)); 'type'=>'info','special'=>true));
return true; return true;
@ -393,7 +393,7 @@ function example_post_attr_delete() {
system_message(array( system_message(array(
'title'=>sprintf('Hook called [%s]',__METHOD__), 'title'=>sprintf('Hook called [%s]',__METHOD__),
'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>Old Values: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],$args[3],join('|',$args[4])), 'body'=>sprintf('<i>Arguments</i>:<ul><li>Server ID: <small>%s</small></li><li>Method: <small>%s</small></li><li>DN: <small>%s</small></li><li>Attribute: <small>%s</small></li><li>Old Values: <small>%s</small></li></ul>',$args[0],$args[1],$args[2],$args[3],implode('|',$args[4])),
'type'=>'info','special'=>true)); 'type'=>'info','special'=>true));
return true; return true;

View File

@ -71,7 +71,7 @@ if ($app['server']->getAuthType() == 'http') {
echo '<table class="forminput" style="margin-left: auto; margin-right: auto;">'; echo '<table class="forminput" style="margin-left: auto; margin-right: auto;">';
printf('<tr><td><b>%s:</b></td></tr>', printf('<tr><td><b>%s:</b></td></tr>',
$app['server']->getValue('login','auth_text') ? $app['server']->getValue('login','auth_text') : $app['server']->getValue('login','auth_text') ?:
($app['server']->getValue('login','attr') == 'dn' ? _('Login DN') : $_SESSION[APPCONFIG]->getFriendlyName($app['server']->getValue('login','attr')))); ($app['server']->getValue('login','attr') == 'dn' ? _('Login DN') : $_SESSION[APPCONFIG]->getFriendlyName($app['server']->getValue('login','attr'))));
printf('<tr><td><input type="text" id="login" name="login" size="40" value="%s" /></td></tr>', printf('<tr><td><input type="text" id="login" name="login" size="40" value="%s" /></td></tr>',

View File

@ -60,7 +60,7 @@ foreach ($entry['schema_types'] as $item => $value) {
} else { } else {
if (isAjaxEnabled()) if (isAjaxEnabled())
{ {
printf('<a href='cmd . php ?%s' onclick="return ajDISPLAY(\'BODY\',\'%s\',\'Loading %s\');" title='Loading % s'>%s</a>', printf('<a href="cmd.php?%s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'Loading %s\');" title="Loading %s">%s</a>',
htmlspecialchars($entry['href'][$item]),htmlspecialchars($entry['href'][$item]),$value,$value,$value); } htmlspecialchars($entry['href'][$item]),htmlspecialchars($entry['href'][$item]),$value,$value,$value); }
else else
{ {
@ -306,7 +306,7 @@ switch($entry['view']) {
break; break;
case 'usage': case 'usage':
printf('<td>%s</td>',$attr->getUsage() ? $attr->getUsage() : '('._('not specified').')'); printf('<td>%s</td>',$attr->getUsage() ?: '('._('not specified').')');
break; break;
case 'maximum_length': case 'maximum_length':

View File

@ -57,14 +57,14 @@ foreach ($attrs as $key => $values) {
if (preg_match('/^[0-9]+\.[0-9]+/', $value)) if (preg_match('/^[0-9]+\.[0-9]+/', $value))
{ {
printf('<td rowspan='2' style='width: 5 %%; vertical - align: top'><img src=' % s / rfc . png' title=' % s' alt=' % s'/></td>', printf('<td rowspan="2" style="width: 5%%; vertical-align:top"><img src="%s/rfc.png" title="%s" alt="%s" /></td>',
IMGDIR,$value,htmlspecialchars($value)); IMGDIR,$value,htmlspecialchars($value));
if ($oidtext = support_oid_to_text($value)) if ($oidtext = support_oid_to_text($value))
{ {
if (isset($oidtext['ref'])) if (isset($oidtext['ref']))
{ {
printf('<td><acronym title=' % s'>%s</acronym></td>',$oidtext['ref'],$oidtext['title']); } else printf('<td><acronym title="%s">%s</acronym></td>',$oidtext['ref'],$oidtext['title']); } else
{ {
printf('<td>%s</td>', $oidtext['title']); printf('<td>%s</td>', $oidtext['title']);
} }
@ -76,7 +76,7 @@ foreach ($attrs as $key => $values) {
} else } else
{ {
printf('<td rowspan='2' colspan='2'>%s</td>',$value); printf('<td rowspan="2" colspan="2">%s</td>',$value);
} }
print '</tr>'; print '</tr>';
@ -91,7 +91,7 @@ foreach ($attrs as $key => $values) {
if ($oidtext) if ($oidtext)
{ {
echo '<tr><td colspan='2'>&nbsp;</td></tr>'; } echo '<tr><td colspan="2">&nbsp;</td></tr>'; }
} }
} }

View File

@ -25,7 +25,7 @@ else
} }
if (isset($request['index']) && isset($request['key'])) { if (isset($request['index']) && isset($request['key'])) {
list($request['server'],$request['x']) = explode(':',$request['index']); [$request['server'],$request['x']] = explode(':',$request['index']);
debug_dump($request['dumpvar'][$request['key']][$request['server']][$request['x']],1); debug_dump($request['dumpvar'][$request['key']][$request['server']][$request['x']],1);
} }

View File

@ -1471,7 +1471,7 @@ class PageRender extends Visitor {
# This is a single value attribute # This is a single value attribute
} else { } else {
$val = $attribute->getValue($i) ? $attribute->getValue($i) : $attribute->getDefault(); $val = $attribute->getValue($i) ?: $attribute->getDefault();
if ($attribute->getHelper()) if ($attribute->getHelper())
{ {

View File

@ -754,7 +754,7 @@ class Template extends xmlTemplate {
{ {
foreach ($rdnarray as $index => $rdnattr) foreach ($rdnarray as $index => $rdnattr)
{ {
list($attr, $value) = explode('=', $rdnattr); [$attr, $value] = explode('=', $rdnattr);
if (strtolower($attr) == $attribute->getName()) if (strtolower($attr) == $attribute->getName())
{ {
@ -890,7 +890,7 @@ class Template extends xmlTemplate {
$modified = false; $modified = false;
foreach ($rdnarray as $index => $rdnattr) { foreach ($rdnarray as $index => $rdnattr) {
list($attr,$value) = explode('=',$rdnattr); [$attr,$value] = explode('=',$rdnattr);
if (strtolower($attr) == $attribute->getName()) { if (strtolower($attr) == $attribute->getName()) {
# If this is already marked as an RDN, then this multivalue RDN was updated on a previous loop # If this is already marked as an RDN, then this multivalue RDN was updated on a previous loop
@ -918,7 +918,7 @@ class Template extends xmlTemplate {
# If we have any RDN values left over, there werent in the original entry and need to be added. # If we have any RDN values left over, there werent in the original entry and need to be added.
foreach ($rdnarray as $rdnattr) { foreach ($rdnarray as $rdnattr) {
list($attr,$value) = explode('=',$rdnattr); [$attr,$value] = explode('=',$rdnattr);
$attribute = $this->addAttribute($attr,array('values'=>array($value))); $attribute = $this->addAttribute($attr,array('values'=>array($value)));
@ -1101,7 +1101,7 @@ class Template extends xmlTemplate {
if ($i !== false) { if ($i !== false) {
$attrs = explode('\+',substr($this->getDN(),0,$i)); $attrs = explode('\+',substr($this->getDN(),0,$i));
foreach ($attrs as $id => $attr) { foreach ($attrs as $id => $attr) {
list ($name,$value) = explode('=',$attr); [$name,$value] = explode('=',$attr);
$attrs[$id] = $name; $attrs[$id] = $name;
} }
@ -1455,7 +1455,7 @@ class Template extends xmlTemplate {
return; return;
} }
list($attr,$string) = preg_split('(([^,]+);(.*))',$arg,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); [$attr,$string] = preg_split('(([^,]+);(.*))',$arg,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
preg_match_all('/%(\w+)(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?%/U',$string,$matchall); preg_match_all('/%(\w+)(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?%/U',$string,$matchall);
//print"<PRE>";print_r($matchall); //0 = highlevel match, 1 = attr, 2 = subst, 3 = mod //print"<PRE>";print_r($matchall); //0 = highlevel match, 1 = attr, 2 = subst, 3 = mod
@ -1542,8 +1542,8 @@ class Template extends xmlTemplate {
if ((isset($substrarray[1][0]) && $substrarray[1][0]) || (isset($substrarray[2][0]) && $substrarray[2][0])) { if ((isset($substrarray[1][0]) && $substrarray[1][0]) || (isset($substrarray[2][0]) && $substrarray[2][0])) {
$attribute->js['autoFill'] .= sprintf(" %s = %s.substr(%s,%s);\n", $attribute->js['autoFill'] .= sprintf(" %s = %s.substr(%s,%s);\n",
$match_attr,$match_attr, $match_attr,$match_attr,
$substrarray[1][0] ? $substrarray[1][0] : '0', $substrarray[1][0] ?: '0',
$substrarray[2][0] ? $substrarray[2][0] : sprintf('%s.length',$match_attr)); $substrarray[2][0] ?: sprintf('%s.length',$match_attr));
} }
} }

View File

@ -91,7 +91,7 @@ class TemplateRender extends PageRender {
if ($attribute->getAutoValue()) if ($attribute->getAutoValue())
{ {
$this->get('Default', $attribute, $this->get('Default', $attribute,
$this->template->getContainer() ? $this->template->getContainer() : $this->getServer()->getContainerPath($this->template->getDN()), $this->template->getContainer() ?: $this->getServer()->getContainerPath($this->template->getDN()),
'autovalue'); 'autovalue');
} }

View File

@ -384,7 +384,7 @@ class Horde_Cipher_blowfish {
$this->setKey($key); $this->setKey($key);
} }
list($L, $R) = array_values(unpack('N*', $block)); [$L, $R] = array_values(unpack('N*', $block));
$parts = $this->_encryptBlock($L, $R); $parts = $this->_encryptBlock($L, $R);
return pack("NN", $parts['L'], $parts['R']); return pack("NN", $parts['L'], $parts['R']);
} }
@ -441,10 +441,10 @@ class Horde_Cipher_blowfish {
{ {
error( error(
sprintf('BLOWFISH: decryptBock()<br>We expected unpack to produce an array, but instead it produced [%s]. This function was entered with (%s,%s). If you think that this is a bug, then please tell the PLA developers how you got here. You are using PLA [%s,%s]', sprintf('BLOWFISH: decryptBock()<br>We expected unpack to produce an array, but instead it produced [%s]. This function was entered with (%s,%s). If you think that this is a bug, then please tell the PLA developers how you got here. You are using PLA [%s,%s]',
serialize($unpack), $block, $key, app_version(), phpversion()), 'error', 'index.php'); serialize($unpack), $block, $key, app_version(), PHP_VERSION), 'error', 'index.php');
} }
list($L, $R) = array_values($unpack); [$L, $R] = array_values($unpack);
$L ^= $this->p[17]; $L ^= $this->p[17];
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[16]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[16];

View File

@ -155,8 +155,8 @@ private $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12
*/ */
private function lshift($count, $data) { private function lshift($count, $data) {
$ret = array(); $ret = array();
for ($i = 0; $i < sizeof($data); $i++) { for ($i = 0; $i < count($data); $i++) {
$ret[$i] = $data[($i + $count)%sizeof($data)]; $ret[$i] = $data[($i + $count)%count($data)];
} }
return $ret; return $ret;
} }
@ -182,7 +182,7 @@ private $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12
*/ */
private function mxor($in1, $in2) { private function mxor($in1, $in2) {
$ret = array(); $ret = array();
for ($i = 0; $i < sizeof($in1); $i++) { for ($i = 0; $i < count($in1); $i++) {
$ret[$i] = $in1[$i] ^ $in2[$i]; $ret[$i] = $in1[$i] ^ $in2[$i];
} }
return $ret; return $ret;
@ -211,7 +211,7 @@ private $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12
$d = $this->lshift($this->sc[$i], $d); $d = $this->lshift($this->sc[$i], $d);
$cd = $c; $cd = $c;
for ($k = 0; $k < sizeof($d); $k++) for ($k = 0; $k < count($d); $k++)
{ {
$cd[] = $d[$k]; $cd[] = $d[$k];
} }
@ -271,7 +271,7 @@ private $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12
} }
} }
$rl = $r; $rl = $r;
for ($i = 0; $i < sizeof($l); $i++) for ($i = 0; $i < count($l); $i++)
{ {
$rl[] = $l[$i]; $rl[] = $l[$i];
} }
@ -345,7 +345,7 @@ private $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12
$p16_1 = $this->smb_hash($sp8, $p14_1, true); $p16_1 = $this->smb_hash($sp8, $p14_1, true);
$p16_2 = $this->smb_hash($sp8, $p14_2, true); $p16_2 = $this->smb_hash($sp8, $p14_2, true);
$p16 = $p16_1; $p16 = $p16_1;
for ($i = 0; $i < sizeof($p16_2); $i++) { for ($i = 0; $i < count($p16_2); $i++) {
$p16[] = $p16_2[$i]; $p16[] = $p16_2[$i];
} }
return $p16; return $p16;
@ -362,10 +362,10 @@ private $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12
$password = substr($password,0,14); $password = substr($password,0,14);
$password = str_pad($password, 14, chr(0)); $password = str_pad($password, 14, chr(0));
$p16 = $this->E_P16($password); $p16 = $this->E_P16($password);
for ($i = 0; $i < sizeof($p16); $i++) { for ($i = 0; $i < count($p16); $i++) {
$p16[$i] = sprintf("%02X", $p16[$i]); $p16[$i] = sprintf("%02X", $p16[$i]);
} }
return join("", $p16); return implode("", $p16);
} }
/** /**

View File

@ -576,7 +576,7 @@ class ldap extends DS {
$query['filter'] = sprintf('(&(%s=%s)%s)', $query['filter'] = sprintf('(&(%s=%s)%s)',
$this->getValue('login','attr'),$user, $this->getValue('login','attr'),$user,
$this->getLoginClass() ? sprintf('(objectclass=%s)',join(')(objectclass=',$this->getLoginClass())) : ''); $this->getLoginClass() ? sprintf('(objectclass=%s)',implode(')(objectclass=',$this->getLoginClass())) : '');
$query['attrs'] = array('dn'); $query['attrs'] = array('dn');
$result = array(); $result = array();

View File

@ -285,7 +285,7 @@ function check_config($config_file) {
require_once LIBDIR.'config_default.php'; require_once LIBDIR.'config_default.php';
# Make sure their PHP version is current enough # Make sure their PHP version is current enough
if (strcmp(phpversion(),REQUIRED_PHP_VERSION) < 0) if (strcmp(PHP_VERSION,REQUIRED_PHP_VERSION) < 0)
{ {
system_message(array( system_message(array(
'title' => _('Incorrect version of PHP'), 'title' => _('Incorrect version of PHP'),
@ -631,7 +631,7 @@ function debug_log($msg,$level,$indent) {
if (preg_match('/%%/',$msg)) if (preg_match('/%%/',$msg))
{ {
$msg = preg_replace('/%%/', join('|', $fargs), $msg); $msg = preg_replace('/%%/', implode('|', $fargs), $msg);
} }
else else
{ {
@ -882,7 +882,7 @@ function blowfish_encrypt($data,$secret=null) {
# If our secret is null or blank, get the default. # If our secret is null or blank, get the default.
if ($secret === null || ! trim($secret)) if ($secret === null || ! trim($secret))
{ {
$secret = $_SESSION[APPCONFIG]->getValue('session', 'blowfish') ? $_SESSION[APPCONFIG]->getValue('session', 'blowfish') : session_id(); $secret = $_SESSION[APPCONFIG]->getValue('session', 'blowfish') ?: session_id();
} }
# If the secret isnt set, then just return the data. # If the secret isnt set, then just return the data.
@ -952,7 +952,7 @@ function blowfish_decrypt($encdata,$secret=null) {
# If our secret is null or blank, get the default. # If our secret is null or blank, get the default.
if ($secret === null || ! trim($secret)) if ($secret === null || ! trim($secret))
{ {
$secret = $_SESSION[APPCONFIG]->getValue('session', 'blowfish') ? $_SESSION[APPCONFIG]->getValue('session', 'blowfish') : session_id(); $secret = $_SESSION[APPCONFIG]->getValue('session', 'blowfish') ?: session_id();
} }
# If the secret isnt set, then just return the data. # If the secret isnt set, then just return the data.
@ -2903,7 +2903,7 @@ function password_check($cryptedpassword,$plainpassword,$attribute='userpassword
error(_('Your system crypt library does not support blowfish encryption.'), 'error', 'index.php'); error(_('Your system crypt library does not support blowfish encryption.'), 'error', 'index.php');
} }
list($version,$rounds,$salt_hash) = explode('$',$cryptedpassword); [$version,$rounds,$salt_hash] = explode('$',$cryptedpassword);
if (crypt($plainpassword,'$'.$version.'$'.$rounds.'$'.$salt_hash) == $cryptedpassword) if (crypt($plainpassword,'$'.$version.'$'.$rounds.'$'.$salt_hash) == $cryptedpassword)
{ {
@ -2924,7 +2924,7 @@ function password_check($cryptedpassword,$plainpassword,$attribute='userpassword
error(_('Your system crypt library does not support md5crypt encryption.'), 'error', 'index.php'); error(_('Your system crypt library does not support md5crypt encryption.'), 'error', 'index.php');
} }
list($dummy,$type,$salt,$hash) = explode('$',$cryptedpassword); [$dummy,$type,$salt,$hash] = explode('$',$cryptedpassword);
if (crypt($plainpassword,'$1$'.$salt) == $cryptedpassword) if (crypt($plainpassword,'$1$'.$salt) == $cryptedpassword)
{ {
@ -3636,9 +3636,10 @@ function binSIDtoText($binsid) {
$result = "$rev-$auth"; $result = "$rev-$auth";
for ($x=0;$x<$subcount;$x++) { foreach ($subauth as $x => $xValue)
{
$subauth[$x] = hexdec(littleEndian(substr($hex_sid,16+($x*8),8))); // get all SECURITY_NT_AUTHORITY $subauth[$x] = hexdec(littleEndian(substr($hex_sid,16+($x*8),8))); // get all SECURITY_NT_AUTHORITY
$result .= sprintf('-%s',$subauth[$x]); $result .= sprintf('-%s', $xValue);
} }
return $result; return $result;

View File

@ -173,7 +173,7 @@ class ImportLDIF extends Import {
# If we have a version line. # If we have a version line.
if (! $haveVersion && preg_match('/^version:/',$lines[0])) { if (! $haveVersion && preg_match('/^version:/',$lines[0])) {
list($text,$version) = $this->getAttrValue(array_shift($lines)); [$text,$version] = $this->getAttrValue(array_shift($lines));
if ($version != 1) if ($version != 1)
{ {
@ -188,7 +188,7 @@ class ImportLDIF extends Import {
# The first line should be the DN # The first line should be the DN
if (preg_match('/^dn:/',$lines[0])) { if (preg_match('/^dn:/',$lines[0])) {
list($text,$dn) = $this->getAttrValue(array_shift($lines)); [$text,$dn] = $this->getAttrValue(array_shift($lines));
# The second line should be our changetype # The second line should be our changetype
if (preg_match('/^changetype:[ ]*(delete|add|modrdn|moddn|modify)/i',$lines[0])) { if (preg_match('/^changetype:[ ]*(delete|add|modrdn|moddn|modify)/i',$lines[0])) {
@ -269,7 +269,7 @@ class ImportLDIF extends Import {
* @return array * @return array
*/ */
private function getAttrValue($line) { private function getAttrValue($line) {
list($attr,$value) = explode(':',$line,2); [$attr,$value] = explode(':',$line,2);
# Get the DN # Get the DN
if (substr($value,0,1) == ':') if (substr($value,0,1) == ':')
@ -455,7 +455,7 @@ class ImportLDIF extends Import {
*/ */
private function getAddDetails($lines) { private function getAddDetails($lines) {
foreach ($lines as $line) { foreach ($lines as $line) {
list($attr,$value) = $this->getAttrValue($line); [$attr,$value] = $this->getAttrValue($line);
if (is_null($attribute = $this->template->getAttribute($attr))) { if (is_null($attribute = $this->template->getAttribute($attr))) {
$attribute = $this->template->addAttribute($attr,array('values'=>array($value))); $attribute = $this->template->addAttribute($attr,array('values'=>array($value)));