diff --git a/.gitignore b/.gitignore index 9de9b097..cc327b40 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ node_modules/ **/composer.lock **/vendor/ tools/ -**/.env +**/configs/.env **/.target package-lock.json build/ diff --git a/.phive/phars.xml b/.phive/phars.xml index f71aeb33..59b82e76 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -3,10 +3,10 @@ - + - - + + diff --git a/4dev/tests/Get/dotenv/.env b/4dev/tests/Get/dotenv/.env new file mode 120000 index 00000000..a67af1f7 --- /dev/null +++ b/4dev/tests/Get/dotenv/.env @@ -0,0 +1 @@ +test.env \ No newline at end of file diff --git a/www/lib/CoreLibs/DB/IO.php b/www/lib/CoreLibs/DB/IO.php index 12673fc3..5c083dc4 100644 --- a/www/lib/CoreLibs/DB/IO.php +++ b/www/lib/CoreLibs/DB/IO.php @@ -2232,9 +2232,9 @@ class IO $milliseconds = $matches[13] ?? ''; // clean up, hide entries that have 00 in the time group - $hour = $hour != '00' ? preg_replace('/^0/', '', $hour) : ''; - $minutes = $minutes != '00' ? preg_replace('/^0/', '', $minutes) : ''; - $seconds = $seconds != '00' ? preg_replace('/^0/', '', $seconds) : ''; + $hour = !empty($hour) ? preg_replace('/^0/', '', $hour) : ''; + $minutes = !empty($minutes) ? preg_replace('/^0/', '', $minutes) : ''; + $seconds = !empty($seconds) ? preg_replace('/^0/', '', $seconds) : ''; // strip any leading or trailing spaces $time_string = trim( diff --git a/www/lib/CoreLibs/Output/Form/Elements.php b/www/lib/CoreLibs/Output/Form/Elements.php index 7f25e122..6327e9ed 100644 --- a/www/lib/CoreLibs/Output/Form/Elements.php +++ b/www/lib/CoreLibs/Output/Form/Elements.php @@ -232,8 +232,15 @@ class Elements * @param string $class style sheet * @return string correct string for url href process */ - private static function createUrl($href, $atag, $_1, $_2, $_3, $name, $class): string - { + private static function createUrl( + string $href, + string $atag, + string $_1, + string $_2, + string $_3, + string $name, + string $class + ): string { // $this->debug('URL', "1: $_1 - 2: $_2 - $_3 - atag: $atag - name: $name - class: $class"); // if $_1 ends with //, then we strip $_1 complete & target is also blanked (its an internal link) if (preg_match("/\/\/$/", $_1) && preg_match("/^\//", $_2)) { @@ -250,11 +257,8 @@ class Elements . "##GT##" . ($name ? $name : $_2 . $_3) . "##LT##/a##GT##"; } elseif ($href && !$atag) { return "href=##QUOT##$_1$_2$_3##QUOT##"; - } elseif ($atag) { - return $atag . $_2 . $_3; - } else { - return $href; } + return $atag . $_2 . $_3; } /** @@ -269,8 +273,15 @@ class Elements * @param string $class style sheet * @return string created html email a href string */ - private static function createEmail($mailto, $atag, $_1, $_2, $_3, $title, $class) - { + private static function createEmail( + string $mailto, + string $atag, + string $_1, + string $_2, + string $_3, + string $title, + string $class + ): string { $email = $_1 . "@" . $_2 . "." . $_3; if (!$mailto && !$atag) { return "##LT##a href=##QUOT##mailto:" . $email . "##QUOT##" @@ -278,12 +289,8 @@ class Elements . "##GT##" . ($title ? $title : $email) . "##LT##/a##GT##"; } elseif ($mailto && !$atag) { return "mailto:" . $email; - } elseif ($atag) { - return $atag . $email; - } else { - // else just return email as is - return $email; } + return $atag . $email; } } diff --git a/www/lib/CoreLibs/UrlRequests/Curl.php b/www/lib/CoreLibs/UrlRequests/Curl.php index 1af6318e..30368d3e 100644 --- a/www/lib/CoreLibs/UrlRequests/Curl.php +++ b/www/lib/CoreLibs/UrlRequests/Curl.php @@ -954,11 +954,10 @@ class Curl implements Interface\RequestsInterface ) ) { unset($this->config['headers'][$header_key]); - unset($this->headers_named[$header_key]); + unset($this->headers_named[strtolower($header_key)]); } elseif ( - // string value, array keys = in - // or both array and not a full match in the one before - (is_string($value) || is_array($value)) && + // right side is array, and value is anything string or array + // if right side is string, and we give value array, we do nothing is_array($this->config['headers'][$header_key]) ) { // part remove of key, value must be array @@ -966,10 +965,14 @@ class Curl implements Interface\RequestsInterface $value = [$value]; } // array values so we rewrite the key pos - $this->config['headers'][$header_key] = array_values(array_diff( - $this->config['headers'][$header_key], - $value - )); + /** @var array $headers */ + $headers = $this->config['headers'][$header_key]; + $this->config['headers'][$header_key] = array_values( + array_diff( + $headers, + $value + ) + ); } } }