diff --git a/INSTALL b/INSTALL index e079b12..65f6946 100644 --- a/INSTALL +++ b/INSTALL @@ -5,7 +5,7 @@ For install instructions in non-English languages, see the wiki: phpLDAPadmin requires the following: 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 @@ -19,5 +19,5 @@ For install instructions in non-English languages, see the wiki: See the wiki: http://phpldapadmin.sourceforge.net - Join our mailing list: + Join our mailing list: https://lists.sourceforge.net/lists/listinfo/phpldapadmin-devel diff --git a/VERSION b/VERSION index e0a90a8..5b09248 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -RELEASE-1.2.3 +RELEASE-2.0.0 diff --git a/hooks/functions/example.php b/hooks/functions/example.php index ac5ed9d..1f66b07 100644 --- a/hooks/functions/example.php +++ b/hooks/functions/example.php @@ -30,7 +30,7 @@ function example_post_session_init() { system_message(array( 'title'=>sprintf('Hook called [%s]',__METHOD__), - 'body'=>sprintf('Global Vars: %s',join('| ',array_keys($GLOBALS))), + 'body'=>sprintf('Global Vars: %s',implode('| ',array_keys($GLOBALS))), 'type'=>'info','special'=>true)); return true; @@ -97,7 +97,7 @@ function example_pre_entry_create() { system_message(array( 'title'=>sprintf('Hook called [%s]',__METHOD__), - 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],join(',',(array_keys($args[3])))), + 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],implode(',',(array_keys($args[3])))), 'type'=>'info','special'=>true)); return true; @@ -119,7 +119,7 @@ function example_post_entry_create() { system_message(array( 'title'=>sprintf('Hook called [%s]',__METHOD__), - 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],join(',',(array_keys($args[3])))), + 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],implode(',',(array_keys($args[3])))), 'type'=>'info','special'=>true)); return true; @@ -229,7 +229,7 @@ function example_pre_entry_modify() { system_message(array( 'title'=>sprintf('Hook called [%s]',__METHOD__), - 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],join('|',array_keys($args[3]))), + 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],implode('|',array_keys($args[3]))), 'type'=>'info','special'=>true)); return true; @@ -251,7 +251,7 @@ function example_post_entry_modify() { system_message(array( 'title'=>sprintf('Hook called [%s]',__METHOD__), - 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],join('|',array_keys($args[3]))), + 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],implode('|',array_keys($args[3]))), 'type'=>'info','special'=>true)); return true; @@ -276,7 +276,7 @@ function example_pre_attr_add() { system_message(array( 'title'=>sprintf('Hook called [%s]',__METHOD__), - 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],$args[3],join('|',$args[4])), + 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],$args[3],implode('|',$args[4])), 'type'=>'info','special'=>true)); return true; @@ -299,7 +299,7 @@ function example_post_attr_add() { system_message(array( 'title'=>sprintf('Hook called [%s]',__METHOD__), - 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],$args[3],join('|',$args[4])), + 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],$args[3],implode('|',$args[4])), 'type'=>'info','special'=>true)); return true; @@ -324,7 +324,7 @@ function example_pre_attr_modify() { system_message(array( 'title'=>sprintf('Hook called [%s]',__METHOD__), - 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],$args[3],join('|',$args[4]),join('|',$args[5])), + 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],$args[3],implode('|',$args[4]),implode('|',$args[5])), 'type'=>'info','special'=>true)); return true; @@ -347,7 +347,7 @@ function example_post_attr_modify() { system_message(array( 'title'=>sprintf('Hook called [%s]',__METHOD__), - 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],$args[3],join('|',$args[4]),join('|',$args[5])), + 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],$args[3],implode('|',$args[4]),implode('|',$args[5])), 'type'=>'info','special'=>true)); return true; @@ -370,7 +370,7 @@ function example_pre_attr_delete() { system_message(array( 'title'=>sprintf('Hook called [%s]',__METHOD__), - 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],$args[3],join('|',$args[4])), + 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],$args[3],implode('|',$args[4])), 'type'=>'info','special'=>true)); return true; @@ -393,7 +393,7 @@ function example_post_attr_delete() { system_message(array( 'title'=>sprintf('Hook called [%s]',__METHOD__), - 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],$args[3],join('|',$args[4])), + 'body'=>sprintf('Arguments:',$args[0],$args[1],$args[2],$args[3],implode('|',$args[4])), 'type'=>'info','special'=>true)); return true; diff --git a/htdocs/login_form.php b/htdocs/login_form.php index c0c7a1b..558b598 100644 --- a/htdocs/login_form.php +++ b/htdocs/login_form.php @@ -71,7 +71,7 @@ if ($app['server']->getAuthType() == 'http') { echo ''; printf('', - $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')))); printf('', diff --git a/htdocs/schema.php b/htdocs/schema.php index 0b50641..1b64306 100644 --- a/htdocs/schema.php +++ b/htdocs/schema.php @@ -60,7 +60,7 @@ foreach ($entry['schema_types'] as $item => $value) { } else { if (isAjaxEnabled()) { - printf('%s', + printf('%s', htmlspecialchars($entry['href'][$item]),htmlspecialchars($entry['href'][$item]),$value,$value,$value); } else { @@ -306,7 +306,7 @@ switch($entry['view']) { break; case 'usage': - printf('',$attr->getUsage() ? $attr->getUsage() : '('._('not specified').')'); + printf('',$attr->getUsage() ?: '('._('not specified').')'); break; case 'maximum_length': diff --git a/htdocs/server_info.php b/htdocs/server_info.php index 73b44f0..dd90291 100644 --- a/htdocs/server_info.php +++ b/htdocs/server_info.php @@ -57,14 +57,14 @@ foreach ($attrs as $key => $values) { if (preg_match('/^[0-9]+\.[0-9]+/', $value)) { - printf('', + printf('', IMGDIR,$value,htmlspecialchars($value)); if ($oidtext = support_oid_to_text($value)) { if (isset($oidtext['ref'])) { - printf('',$oidtext['ref'],$oidtext['title']); } else + printf('',$oidtext['ref'],$oidtext['title']); } else { printf('', $oidtext['title']); } @@ -76,7 +76,7 @@ foreach ($attrs as $key => $values) { } else { - printf('',$value); + printf('',$value); } print ''; @@ -91,7 +91,7 @@ foreach ($attrs as $key => $values) { if ($oidtext) { - echo ''; } + echo ''; } } } diff --git a/htdocs/show_cache.php b/htdocs/show_cache.php index a77158b..878b0af 100644 --- a/htdocs/show_cache.php +++ b/htdocs/show_cache.php @@ -25,7 +25,7 @@ else } 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); } diff --git a/lib/PageRender.php b/lib/PageRender.php index 9e06d10..eaedced 100644 --- a/lib/PageRender.php +++ b/lib/PageRender.php @@ -1471,7 +1471,7 @@ class PageRender extends Visitor { # This is a single value attribute } else { - $val = $attribute->getValue($i) ? $attribute->getValue($i) : $attribute->getDefault(); + $val = $attribute->getValue($i) ?: $attribute->getDefault(); if ($attribute->getHelper()) { diff --git a/lib/Template.php b/lib/Template.php index eca7c2a..105cd06 100644 --- a/lib/Template.php +++ b/lib/Template.php @@ -754,7 +754,7 @@ class Template extends xmlTemplate { { foreach ($rdnarray as $index => $rdnattr) { - list($attr, $value) = explode('=', $rdnattr); + [$attr, $value] = explode('=', $rdnattr); if (strtolower($attr) == $attribute->getName()) { @@ -890,7 +890,7 @@ class Template extends xmlTemplate { $modified = false; foreach ($rdnarray as $index => $rdnattr) { - list($attr,$value) = explode('=',$rdnattr); + [$attr,$value] = explode('=',$rdnattr); if (strtolower($attr) == $attribute->getName()) { # 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. foreach ($rdnarray as $rdnattr) { - list($attr,$value) = explode('=',$rdnattr); + [$attr,$value] = explode('=',$rdnattr); $attribute = $this->addAttribute($attr,array('values'=>array($value))); @@ -1101,7 +1101,7 @@ class Template extends xmlTemplate { if ($i !== false) { $attrs = explode('\+',substr($this->getDN(),0,$i)); foreach ($attrs as $id => $attr) { - list ($name,$value) = explode('=',$attr); + [$name,$value] = explode('=',$attr); $attrs[$id] = $name; } @@ -1455,7 +1455,7 @@ class Template extends xmlTemplate { 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); //print"
";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])) {
 							$attribute->js['autoFill'] .= sprintf("   %s = %s.substr(%s,%s);\n",
 								$match_attr,$match_attr,
-								$substrarray[1][0] ? $substrarray[1][0] : '0',
-								$substrarray[2][0] ? $substrarray[2][0] : sprintf('%s.length',$match_attr));
+								$substrarray[1][0] ?: '0',
+								$substrarray[2][0] ?: sprintf('%s.length',$match_attr));
 						}
 					}
 
diff --git a/lib/TemplateRender.php b/lib/TemplateRender.php
index cab9dd2..d100918 100644
--- a/lib/TemplateRender.php
+++ b/lib/TemplateRender.php
@@ -91,7 +91,7 @@ class TemplateRender extends PageRender {
 				if ($attribute->getAutoValue())
 				{
 					$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');
 				}
 
diff --git a/lib/blowfish.php b/lib/blowfish.php
index 16a7103..cd50998 100644
--- a/lib/blowfish.php
+++ b/lib/blowfish.php
@@ -384,7 +384,7 @@ class Horde_Cipher_blowfish {
             $this->setKey($key);
         }
 
-        list($L, $R) = array_values(unpack('N*', $block));
+        [$L, $R] = array_values(unpack('N*', $block));
         $parts = $this->_encryptBlock($L, $R);
         return pack("NN", $parts['L'], $parts['R']);
     }
@@ -441,10 +441,10 @@ class Horde_Cipher_blowfish {
 	{
 		error(
 			sprintf('BLOWFISH: decryptBock()
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]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[16]; diff --git a/lib/createlm.php b/lib/createlm.php index 1a8ad5c..c3fb376 100644 --- a/lib/createlm.php +++ b/lib/createlm.php @@ -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) { $ret = array(); - for ($i = 0; $i < sizeof($data); $i++) { - $ret[$i] = $data[($i + $count)%sizeof($data)]; + for ($i = 0; $i < count($data); $i++) { + $ret[$i] = $data[($i + $count)%count($data)]; } 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) { $ret = array(); - for ($i = 0; $i < sizeof($in1); $i++) { + for ($i = 0; $i < count($in1); $i++) { $ret[$i] = $in1[$i] ^ $in2[$i]; } 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); $cd = $c; - for ($k = 0; $k < sizeof($d); $k++) + for ($k = 0; $k < count($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; - for ($i = 0; $i < sizeof($l); $i++) + for ($i = 0; $i < count($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_2 = $this->smb_hash($sp8, $p14_2, true); $p16 = $p16_1; - for ($i = 0; $i < sizeof($p16_2); $i++) { + for ($i = 0; $i < count($p16_2); $i++) { $p16[] = $p16_2[$i]; } 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 = str_pad($password, 14, chr(0)); $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]); } - return join("", $p16); + return implode("", $p16); } /** diff --git a/lib/ds_ldap.php b/lib/ds_ldap.php index f2e63a9..4610454 100644 --- a/lib/ds_ldap.php +++ b/lib/ds_ldap.php @@ -576,7 +576,7 @@ class ldap extends DS { $query['filter'] = sprintf('(&(%s=%s)%s)', $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'); $result = array(); diff --git a/lib/functions.php b/lib/functions.php index a76706a..f3b50d8 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -285,7 +285,7 @@ function check_config($config_file) { require_once LIBDIR.'config_default.php'; # 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( 'title' => _('Incorrect version of PHP'), @@ -631,7 +631,7 @@ function debug_log($msg,$level,$indent) { if (preg_match('/%%/',$msg)) { - $msg = preg_replace('/%%/', join('|', $fargs), $msg); + $msg = preg_replace('/%%/', implode('|', $fargs), $msg); } else { @@ -882,7 +882,7 @@ function blowfish_encrypt($data,$secret=null) { # If our secret is null or blank, get the default. 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. @@ -952,7 +952,7 @@ function blowfish_decrypt($encdata,$secret=null) { # If our secret is null or blank, get the default. 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. @@ -2903,7 +2903,7 @@ function password_check($cryptedpassword,$plainpassword,$attribute='userpassword 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) { @@ -2924,7 +2924,7 @@ function password_check($cryptedpassword,$plainpassword,$attribute='userpassword 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) { @@ -3636,9 +3636,10 @@ function binSIDtoText($binsid) { $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 - $result .= sprintf('-%s',$subauth[$x]); + $result .= sprintf('-%s', $xValue); } return $result; diff --git a/lib/import_functions.php b/lib/import_functions.php index f0c7b56..6611b67 100644 --- a/lib/import_functions.php +++ b/lib/import_functions.php @@ -173,7 +173,7 @@ class ImportLDIF extends Import { # If we have a version line. 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) { @@ -188,7 +188,7 @@ class ImportLDIF extends Import { # The first line should be the DN 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 if (preg_match('/^changetype:[ ]*(delete|add|modrdn|moddn|modify)/i',$lines[0])) { @@ -269,7 +269,7 @@ class ImportLDIF extends Import { * @return array */ private function getAttrValue($line) { - list($attr,$value) = explode(':',$line,2); + [$attr,$value] = explode(':',$line,2); # Get the DN if (substr($value,0,1) == ':') @@ -455,7 +455,7 @@ class ImportLDIF extends Import { */ private function getAddDetails($lines) { foreach ($lines as $line) { - list($attr,$value) = $this->getAttrValue($line); + [$attr,$value] = $this->getAttrValue($line); if (is_null($attribute = $this->template->getAttribute($attr))) { $attribute = $this->template->addAttribute($attr,array('values'=>array($value)));
%s:
%s%s % s%s%s%s%s%s%s