*/
// 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)) {
// 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));
}
// Detects the user-agent string
-function crackerTrackerUserAgent ($sanitize = FALSE) {
+function crackerTrackerUserAgent (bool $sanitize = false) {
// Default is 'unknown'
$ua = 'unknown';
}
// Sanitize it?
- if ($sanitize === TRUE) {
+ if ($sanitize === true) {
// Sanitize ...
$ua = crackerTrackerSanitize($ua);
}
}
// Detects the script name
-function crackerTrackerScriptName ($sanitize = FALSE) {
+function crackerTrackerScriptName (bool $sanitize = false) {
// Default is NULL
$scriptName = NULL;
}
// Sanitize it?
- if ($sanitize === TRUE) {
+ if ($sanitize === true) {
// Sanitize ...
$scriptName = crackerTrackerSanitize($scriptName);
}
}
// Detects the query string
-function crackerTrackerQueryString ($sanitize = FALSE) {
+function crackerTrackerQueryString (bool $sanitize = false) {
// Default is NULL
$query = NULL;
}
// Sanitize it?
- if ((!empty($query)) && ($sanitize === TRUE)) {
+ if ((!empty($query)) && ($sanitize === true)) {
// Sanitize ...
$query = crackerTrackerSanitize($query);
}
}
// Detects the server's name
-function crackerTrackerServerName ($sanitize = FALSE) {
+function crackerTrackerServerName (bool $sanitize = false) {
// Default is NULL
$serverName = NULL;
}
// Sanitize it?
- if ($sanitize === TRUE) {
+ if ($sanitize === true) {
// Sanitize ...
$serverName = crackerTrackerSanitize($serverName);
}
}
// Detects the referer
-function crackerTrackerReferer ($sanitize = FALSE) {
+function crackerTrackerReferer (bool $sanitize = false) {
// Default is a dash
$referer = '-';
}
// Sanitize it?
- if ($sanitize === TRUE) {
+ if ($sanitize === true) {
// Sanitize ...
$referer = crackerTrackerSanitize($referer);
}
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();
}
// 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
// Is request method POST?
if (crackerTrackerRequestMethod() != 'POST') {
// Cannot be given
- return FALSE;
+ return false;
}
// Walk through all fields
// Is one found?
if (in_array($fieldName, $_POST) && !empty($_POST[$fieldName])) {
// Filled out!
- return TRUE;
+ return true;
}
}
}