]> git.mxchange.org Git - ctracker.git/blobdiff - libs/lib_general.php
Continued:
[ctracker.git] / libs / lib_general.php
index d6e1a87900ce077b9bcbb0faec7cfca0dfd8ff14..ad4f25bc2e38077a3b0b3c513f6e2e76d644ee65 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 // Implode recursive a multi-dimension array, taken from www.php.net
-function implode_r ($glue, $array, $array_name = NULL) {
+function implode_r (string $glue, array $array, string $array_name = NULL) {
        $return = [];
        while (list($key,$value) = @each($array)) {
                if (is_array($value)) {
@@ -90,7 +90,7 @@ function crackerTrackerLoadConfiguration () {
 // Getter for ctracker_debug_enabled
 function isCrackerTrackerDebug () {
        // Is it set?
-       $result = ((isset($GLOBALS['ctracker_debug_enabled'])) && ($GLOBALS['ctracker_debug_enabled'] === TRUE));
+       $result = ((isset($GLOBALS['ctracker_debug_enabled'])) && ($GLOBALS['ctracker_debug_enabled'] === true));
 
        // Debug message
        //* DEBUG: */ error_log('result=' . intval($result));
@@ -139,7 +139,7 @@ function isCrackerTrackerProxyUsed () {
 }
 
 // Detects the user-agent string
-function crackerTrackerUserAgent ($sanitize = FALSE) {
+function crackerTrackerUserAgent (bool $sanitize = false) {
        // Default is 'unknown'
        $ua = 'unknown';
 
@@ -150,7 +150,7 @@ function crackerTrackerUserAgent ($sanitize = FALSE) {
        }
 
        // Sanitize it?
-       if ($sanitize === TRUE) {
+       if ($sanitize === true) {
                // Sanitize ...
                $ua = crackerTrackerSanitize($ua);
        }
@@ -160,7 +160,7 @@ function crackerTrackerUserAgent ($sanitize = FALSE) {
 }
 
 // Detects the script name
-function crackerTrackerScriptName ($sanitize = FALSE) {
+function crackerTrackerScriptName (bool $sanitize = false) {
        // Default is NULL
        $scriptName = NULL;
 
@@ -171,7 +171,7 @@ function crackerTrackerScriptName ($sanitize = FALSE) {
        }
 
        // Sanitize it?
-       if ($sanitize === TRUE) {
+       if ($sanitize === true) {
                // Sanitize ...
                $scriptName = crackerTrackerSanitize($scriptName);
        }
@@ -181,7 +181,7 @@ function crackerTrackerScriptName ($sanitize = FALSE) {
 }
 
 // Detects the query string
-function crackerTrackerQueryString ($sanitize = FALSE) {
+function crackerTrackerQueryString (bool $sanitize = false) {
        // Default is NULL
        $query = NULL;
 
@@ -195,7 +195,7 @@ function crackerTrackerQueryString ($sanitize = FALSE) {
        }
 
        // Sanitize it?
-       if ((!empty($query)) && ($sanitize === TRUE)) {
+       if ((!empty($query)) && ($sanitize === true)) {
                // Sanitize ...
                $query = crackerTrackerSanitize($query);
        }
@@ -205,7 +205,7 @@ function crackerTrackerQueryString ($sanitize = FALSE) {
 }
 
 // Detects the server's name
-function crackerTrackerServerName ($sanitize = FALSE) {
+function crackerTrackerServerName (bool $sanitize = false) {
        // Default is NULL
        $serverName = NULL;
 
@@ -216,7 +216,7 @@ function crackerTrackerServerName ($sanitize = FALSE) {
        }
 
        // Sanitize it?
-       if ($sanitize === TRUE) {
+       if ($sanitize === true) {
                // Sanitize ...
                $serverName = crackerTrackerSanitize($serverName);
        }
@@ -226,7 +226,7 @@ function crackerTrackerServerName ($sanitize = FALSE) {
 }
 
 // Detects the referer
-function crackerTrackerReferer ($sanitize = FALSE) {
+function crackerTrackerReferer (bool $sanitize = false) {
        // Default is a dash
        $referer = '-';
 
@@ -237,7 +237,7 @@ function crackerTrackerReferer ($sanitize = FALSE) {
        }
 
        // Sanitize it?
-       if ($sanitize === TRUE) {
+       if ($sanitize === true) {
                // Sanitize ...
                $referer = crackerTrackerSanitize($referer);
        }
@@ -486,7 +486,7 @@ function getCrackerTrackerTicketId () {
 function sendCrackerTrackerCookie () {
        // Set the cookie
        // @TODO Why can't domain be set to value from crackerTrackerServerName() ?
-       setcookie('ctracker_ticket', getCrackerTrackerTicketId(), (time() + 60*60*24), '/', '', crackerTrackerSecured(), TRUE);
+       setcookie('ctracker_ticket', getCrackerTrackerTicketId(), (time() + 60*60*24), '/', '', crackerTrackerSecured(), true);
        $_COOKIE['ctracker_ticket'] = getCrackerTrackerTicketId();
 }
 
@@ -528,7 +528,7 @@ function crackerTrackerSendRawRedirect ($url) {
 
        // check if running on IIS < 6 with CGI-PHP
        if ((isset($_SERVER['SERVER_SOFTWARE'])) && (isset($_SERVER['GATEWAY_INTERFACE'])) &&
-               (strpos($_SERVER['GATEWAY_INTERFACE'],'CGI') !== FALSE) &&
+               (strpos($_SERVER['GATEWAY_INTERFACE'],'CGI') !== false) &&
                (preg_match('|^Microsoft-IIS/(\d)\.\d$|', trim($_SERVER['SERVER_SOFTWARE']), $matches)) &&
                ($matches[1] < 6)) {
                // Send the IIS header
@@ -610,7 +610,7 @@ function ifCtrackerTrackerAntiSpamFieldGiven () {
        // Is request method POST?
        if (crackerTrackerRequestMethod() != 'POST') {
                // Cannot be given
-               return FALSE;
+               return false;
        }
 
        // Walk through all fields
@@ -618,7 +618,7 @@ function ifCtrackerTrackerAntiSpamFieldGiven () {
                // Is one found?
                if (in_array($fieldName, $_POST) && !empty($_POST[$fieldName])) {
                        // Filled out!
-                       return TRUE;
+                       return true;
                }
        }
 }