Extensions bitcoins/yacy added, new API functions for handling proxy/non-proxy added:
[mailer.git] / inc / wrapper-functions.php
index 663654809ffd6ab7907d1d4ec1234700fd658bca..8758f853d6c910cc8bd6b1de640650ed4b017c11 100644 (file)
@@ -194,10 +194,25 @@ function isDirectory ($FQFN) {
        return $GLOBALS[__FUNCTION__][$FQFN];
 }
 
+// "Getter" for the real remote IP number
+function detectRealIpAddress () {
+       // Get remote ip from environment
+       $remoteAddr = determineRealRemoteAddress();
+
+       // Is removeip installed?
+       if (isExtensionActive('removeip')) {
+               // Then anonymize it
+               $remoteAddr = getAnonymousRemoteAddress($remoteAddr);
+       } // END - if
+
+       // Return it
+       return $remoteAddr;
+}
+
 // "Getter" for remote IP number
 function detectRemoteAddr () {
        // Get remote ip from environment
-       $remoteAddr = determineRealRemoteAddress();
+       $remoteAddr = determineRealRemoteAddress(true);
 
        // Is removeip installed?
        if (isExtensionActive('removeip')) {
@@ -271,6 +286,28 @@ function detectServerName () {
        return (getenv('SERVER_NAME'));
 }
 
+// Removes any  existing www. from SERVER_NAME. This is very silly but enough
+// for our purpose here.
+function detectDomainName () {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Get server name
+               $domainName = detectServerName();
+
+               // Is there any www. ?
+               if (substr($domainName, 0, 4) == 'www.') {
+                       // Remove it
+                       $domainName = substr($domainName, 4);
+               } // END - if
+
+               // Set cache
+               $GLOBALS[__FUNCTION__] = $domainName;
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
 // Check wether we are installing
 function isInstalling () {
        // Determine wether we are installing