+// Getter for request method
+function getHttpRequestMethod () {
+ // Console is default
+ $requestMethod = 'console';
+
+ // Is it set?
+ if (isset($_SERVER['REQUEST_METHOD'])) {
+ // Get current request method
+ $requestMethod = $_SERVER['REQUEST_METHOD'];
+ } // END - if
+
+ // Return it
+ return $requestMethod;
+}
+
+// Checks if 'content_type' is set
+function isContentTypeSet () {
+ return isset($GLOBALS['content_type']);
+}
+
+// Setter for content type
+function setContentType ($contentType) {
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'contentType=' . $contentType);
+ $GLOBALS['content_type'] = (string) $contentType;
+}
+
+// Getter for content type
+function getContentType () {
+ // Is it there?
+ if (!isContentTypeSet()) {
+ // Please fix this
+ reportBug(__FUNCTION__, __LINE__, 'content_type not set in GLOBALS array.');
+ } // END - if
+
+ // Return it
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'content_type=' . $GLOBALS['content_type']);
+ return $GLOBALS['content_type'];
+}
+
+// Logs wrong SERVER_NAME attempts
+function logWrongServerNameRedirect () {
+ // Is ext-sql_patches at least version 0.9.2?
+ if (isExtensionInstalledAndNewer('sql_patches', '0.9.2')) {
+ // Is there an entry?
+ if (countSumTotalData(detectServerName(), 'server_name_log', 'server_name_id', 'server_name', TRUE, str_replace('%', '{PER}', sprintf(" AND `server_name_remote_addr`='%s' AND `server_name_ua`='%s' AND `server_name_referrer`='%s'", SQL_ESCAPE(detectRemoteAddr(TRUE)), SQL_ESCAPE(detectUserAgent(TRUE)), SQL_ESCAPE(detectReferer(TRUE))))) == 1) {
+ // Update counter, as all are the same
+ SQL_QUERY_ESC("UPDATE
+ `{?_MYSQL_PREFIX?}_server_name_log`
+SET
+ `server_name_counter`=`server_name_counter`+1
+WHERE
+ `server_name`='%s' AND
+ `server_name_remote_addr`='%s' AND
+ `server_name_ua`='%s' AND
+ `server_name_referrer`='%s'
+LIMIT 1",
+ array(
+ detectServerName(),
+ detectRemoteAddr(TRUE),
+ detectUserAgent(TRUE),
+ detectReferer(TRUE)
+ ), __FUNCTION__, __LINE__);
+ } else {
+ // Then log it away
+ SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_server_name_log` (`server_name`, `server_name_remote_addr`, `server_name_ua`, `server_name_referrer`) VALUES('%s','%s', '%s', '%s')",
+ array(
+ detectServerName(),
+ detectRemoteAddr(TRUE),
+ detectUserAgent(TRUE),
+ detectReferer(TRUE)
+ ), __FUNCTION__, __LINE__);
+ }
+ } // END - if
+}
+