diff --git a/include/class_objects.inc b/include/class_objects.inc index 988be13000ea42fa02c8dbef6b833fb18b2568fb..fc82e262706252ad594f2c458ae088210e20ae48 100644 --- a/include/class_objects.inc +++ b/include/class_objects.inc @@ -348,7 +348,10 @@ class objects return $tabObject; } - static function link (string $dn, string $type, string $subaction = '', string $text = NULL, bool $icon = TRUE, bool $link = TRUE): string + /** + * @param string|array|null $text + */ + static function link (string $dn, string $type, string $subaction = '', $text = NULL, bool $icon = TRUE, bool $link = TRUE): string { global $config; diff --git a/include/class_tests.inc b/include/class_tests.inc index 60d8d3ff4effa77cf6abee79cad95614d274040d..a6265977333518ae236ef18bd864f509a8d1fd61 100644 --- a/include/class_tests.inc +++ b/include/class_tests.inc @@ -310,10 +310,10 @@ class tests if (!tests::is_ipv4($ip1) || !tests::is_ipv4($ip2)) { return FALSE; } else { - $ar1 = explode(".", $ip1); + $ar1 = array_map('intval', explode('.', $ip1)); $var1 = $ar1[0] * (16777216) + $ar1[1] * (65536) + $ar1[2] * (256) + $ar1[3]; - $ar2 = explode(".", $ip2); + $ar2 = array_map('intval', explode('.', $ip2)); $var2 = $ar2[0] * (16777216) + $ar2[1] * (65536) + $ar2[2] * (256) + $ar2[3]; return ($var1 < $var2); } @@ -325,15 +325,15 @@ class tests * * \param string $network Name of the network * - * \param string $netmask The netmask of the IP address + * \param string $netmask The netmask of the IPv4 address * - * \param string $address The IP address + * \param string $address The IPv4 address */ public static function is_in_network ($network, $netmask, $address) { - $nw = explode('.', $network); - $nm = explode('.', $netmask); - $ad = explode('.', $address); + $nw = array_map('intval', explode('.', $network)); + $nm = array_map('intval', explode('.', $netmask)); + $ad = array_map('intval', explode('.', $address)); /* Generate inverted netmask */ $ni = []; @@ -351,12 +351,12 @@ class tests return ($first < $curr && $last > $curr); } - /* \brief Check if the specified IP address $address is inside the given network */ + /* \brief Check if the specified IPv4 address $address is inside the given network */ public static function is_in_ip_range ($from, $to, $address) { - $from = explode('.', $from); - $to = explode('.', $to); - $ad = explode('.', $address); + $from = array_map('intval', explode('.', $from)); + $to = array_map('intval', explode('.', $to)); + $ad = array_map('intval', explode('.', $address)); /* Transform to integer */ $from = $from[0] * (16777216) + $from[1] * (65536) + $from[2] * (256) + $from[3]; diff --git a/include/management/class_EntrySortIterator.inc b/include/management/class_EntrySortIterator.inc index 1420ed09f055a3b21ca1c757a5fa44cf44e00dd1..158bc96e8b47f4b01147c0db24408dc03fe293d4 100644 --- a/include/management/class_EntrySortIterator.inc +++ b/include/management/class_EntrySortIterator.inc @@ -59,12 +59,10 @@ class EntrySortIterator implements Iterator /*! * \brief Put the array pointer to the first element - * - * \return the first element of the array */ function rewind () { - return reset($this->data); + reset($this->data); } /*! @@ -89,12 +87,10 @@ class EntrySortIterator implements Iterator /*! * \brief Get the next data element - * - * \return The next element pointed by array pointer */ function next () { - return next($this->data); + next($this->data); } /*! diff --git a/include/simpleplugin/attributes/class_SetAttribute.inc b/include/simpleplugin/attributes/class_SetAttribute.inc index 268f3a5aa6c9d3a10e0280258eacb3d3ecf0732f..dadfc17999c8832e5d57549b22aba3af4408a76d 100644 --- a/include/simpleplugin/attributes/class_SetAttribute.inc +++ b/include/simpleplugin/attributes/class_SetAttribute.inc @@ -634,7 +634,7 @@ class OrderedArrayAttribute extends SetAttribute if ($this->order) { if (preg_match('/^'.$id.'_up_/', $postValue)) { $key = preg_replace('/^'.$id.'_up_/', '', $postValue); - $key = preg_replace('/_[xy]$/', '', $key); + $key = (int)preg_replace('/_[xy]$/', '', $key); $tmp = $this->postValue[$key]; $this->postValue[$key] = $this->postValue[$key - 1]; @@ -643,7 +643,7 @@ class OrderedArrayAttribute extends SetAttribute } if (preg_match('/^'.$id.'_down_/', $postValue)) { $key = preg_replace('/^'.$id.'_down_/', '', $postValue); - $key = preg_replace('/_[xy]$/', '', $key); + $key = (int)preg_replace('/_[xy]$/', '', $key); $tmp = $this->postValue[$key]; $this->postValue[$key] = $this->postValue[$key + 1]; diff --git a/setup/class_setupStepChecks.inc b/setup/class_setupStepChecks.inc index 14a7f534b0f36fed3d410e62a378978ca5845445..616f25637173a7bb9f0edc6de052b9e53b386f98 100644 --- a/setup/class_setupStepChecks.inc +++ b/setup/class_setupStepChecks.inc @@ -112,14 +112,6 @@ class setupStepChecks extends setupStep $M = TRUE; $basic_checks[] = ["NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ]; - /* Check for installed mhash module */ - $N = msgPool::checkingFor("hash method"); - $D = _("FusionDirectory requires either 'mhash' or the 'sha1' module to make use of SSHA encryption."); - $S = msgPool::installPhpModule("mhash/sha1"); - $R = is_callable('mhash') || is_callable('sha1'); - $M = FALSE; - $basic_checks[] = ["NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ]; - /* Check if imap module is available */ $N = msgPool::checkingFor("IMAP"); $D = _("FusionDirectory requires this module to talk to an IMAP server."); diff --git a/setup/class_setupStepMigrate.inc b/setup/class_setupStepMigrate.inc index 8ce431bdf021cca8e605ee04be3e094d6cffa387..0fd4830b6df1d4ad163dd5cc5db4170cafda463d 100644 --- a/setup/class_setupStepMigrate.inc +++ b/setup/class_setupStepMigrate.inc @@ -892,8 +892,8 @@ class setupStepMigrate extends setupStep /* Creating user */ $tabObject = objects::create('user'); - $tabObject->givenName = 'System'; - $tabObject->sn = 'Administrator'; + $tabObject->getBaseObject()->givenName = 'System'; + $tabObject->getBaseObject()->sn = 'Administrator'; $tabObject->update(); $errors = $tabObject->save(); if (!empty($errors)) {