From: Roland Haeder Date: Sat, 20 Jul 2013 13:07:03 +0000 (+0000) Subject: Use constants instead of keywords X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f4c2023206c9cc58f66883a7423485dd52b900b5;p=ctracker.git Use constants instead of keywords --- diff --git a/libs/lib_connect.php b/libs/lib_connect.php index b981c03..7a155de 100644 --- a/libs/lib_connect.php +++ b/libs/lib_connect.php @@ -94,7 +94,7 @@ function crackerTrackerInsertArray ($table, $rowData) { // Is there a link up? if (!isCrackerTrackerDatabaseLinkUp()) { // Abort silently here - return false; + return FALSE; } // END - if // Is it found? @@ -103,7 +103,7 @@ function crackerTrackerInsertArray ($table, $rowData) { $SQL = 'INSERT INTO `' . $table . '` (`' . implode('`,`', array_keys($rowData)) . '`) VALUES(' . implode_secure($rowData) . ')'; // Reset insert id - $GLOBALS['ctracker_last_insert_id'] = false; + $GLOBALS['ctracker_last_insert_id'] = FALSE; // Run it runCrackerTrackerSql($SQL, __FUNCTION__, __LINE__); @@ -176,7 +176,7 @@ function runCrackerTrackerSql ($SQL, $F, $L) { // Checks wether a table was found function isCrackerTrackerTableCreated ($table) { // Default is not found - $found = false; + $found = FALSE; // Run the query $result = runCrackerTrackerSql('SHOW TABLES', __FUNCTION__, __LINE__); @@ -186,7 +186,7 @@ function isCrackerTrackerTableCreated ($table) { // Is the table there? if ($tab == $table) { // Okay, found. So abort - $found = true; + $found = TRUE; break; } // END - if } // END - if @@ -308,7 +308,7 @@ function isCrackerTrackerIpSuspicious () { // Skip this silently if we have not config if (!isCrackerTrackerDatabaseLinkUp()) { // Skip this step silently, all is not suspicious - return false; + return FALSE; } // END - if // We only need the very last attempt to get! @@ -318,7 +318,7 @@ function isCrackerTrackerIpSuspicious () { $found = (mysql_num_rows($result) == 1); // And again? - if ($found === true) { + if ($found === TRUE) { // Cache the entry $GLOBALS['ctracker_last_suspicious_entry'] = mysql_fetch_array($result); } // END - if @@ -339,7 +339,7 @@ function ifCrackerTrackerIpHasTicket () { $found = (mysql_num_rows($result) == 1); // And again? - if ($found === true) { + if ($found === TRUE) { // Cache the ticket data $GLOBALS['ctracker_last_ticket'] = mysql_fetch_array($result); } // END - if diff --git a/libs/lib_detector.php b/libs/lib_detector.php index 26da674..8064ce9 100644 --- a/libs/lib_detector.php +++ b/libs/lib_detector.php @@ -155,7 +155,7 @@ function sendCrackerTrackerTicketMails () { } // Sends a mail out -function crackerTrackerSendMail ($mail, $recipient = null, $subject = null) { +function crackerTrackerSendMail ($mail, $recipient = NULL, $subject = NULL) { // Construct dummy array $rowData = array( 'remote_addr' => determineCrackerTrackerRealRemoteAddress(), @@ -171,7 +171,7 @@ function crackerTrackerSendMail ($mail, $recipient = null, $subject = null) { print 'Recipient=' . $recipient . '
Subject=' . $subject . '
Text=
' . $mail . '
'; // All fine - return true; + return TRUE; } elseif (!is_null($recipient)) { // Recipient specified return mail($recipient, $subject, $mail, $GLOBALS['ctracker_header']); @@ -187,7 +187,7 @@ function crackerTrackerSendMail ($mail, $recipient = null, $subject = null) { print 'Recipient=' . $recipient . '
Subject=' . $subject . '
Text=
' . $mail . '
'; // All fine - return true; + return TRUE; } } diff --git a/libs/lib_general.php b/libs/lib_general.php index 33f15a0..5799d08 100644 --- a/libs/lib_general.php +++ b/libs/lib_general.php @@ -76,7 +76,7 @@ if (!function_exists('implode_secure')) { // Getter for ctracker_debug_enabled function isCrackerTrackerDebug () { // Is it set? - return ((isset($GLOBALS['ctracker_debug_enabled'])) && ($GLOBALS['ctracker_debug_enabled'] === true)); + return ((isset($GLOBALS['ctracker_debug_enabled'])) && ($GLOBALS['ctracker_debug_enabled'] === TRUE)); } // Determines the real remote address @@ -280,7 +280,7 @@ function crackerTrackerLanguage () { } // END - if // Construct FQFN - $FQFN = sprintf("%s/language/%s.php", + $FQFN = sprintf('%s/language/%s.php', dirname(__FILE__), getCrackerTrackerLanguage() ); @@ -291,9 +291,7 @@ function crackerTrackerLanguage () { $GLOBALS['ctracker_language'] = 'en'; // Construct FQFN again - $FQFN = sprintf("%s/language/en.php", - dirname(__FILE__) - ); + $FQFN = sprintf('%s/language/en.php', dirname(__FILE__)); } // END - if // Load the language file @@ -301,12 +299,12 @@ function crackerTrackerLanguage () { } // Loads a given email template and passes through $content -function crackerTrackerLoadEmailTemplate ($template, array $content = array(), $language = null) { +function crackerTrackerLoadEmailTemplate ($template, array $content = array(), $language = NULL) { // Init language crackerTrackerLanguage(); // Generate the FQFN - $FQFN = sprintf("%s/mails/%s/%s.tpl", + $FQFN = sprintf('%s/mails/%s/%s.tpl', dirname(__FILE__), getCrackerTrackerLanguage($language), $template @@ -374,7 +372,7 @@ function crackerTrackerCompileCode ($code) { } // "Getter" for language -function getCrackerTrackerLanguage ($lang = null) { +function getCrackerTrackerLanguage ($lang = NULL) { // Default is from browser $language = $GLOBALS['ctracker_language']; @@ -407,7 +405,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(); } @@ -457,7 +455,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