]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
Rewritten extension handling, if no ext-foo.tpl is there, some cosmetics applied
[mailer.git] / inc / functions.php
index a794e2d9e039b40578dbfcf9303da67a7b3490d2..d6c84e21874b9a6429210d85e831a3c66ef63798 100644 (file)
@@ -2521,7 +2521,8 @@ function searchDirsRecursive ($dir, &$last_changed) {
                $FQFN = str_replace("//", "/", constant('PATH') . $dir. "/". $d);
 
                // Does it match what we are looking for? (We skip a lot files already!)
-               if (!preg_match('@(\.|\.\.|\.revision|\.svn|debug\.log|\.cache)$@', $d)) {      // no . or  ..  or .revision or .svn in the filename
+               if (!preg_match('@(\.|\.\.|\.revision|\.svn|debug\.log|\.cache|config\.php)$@', $d)) {          // no ., .., .revision,  .svn, debug.log or .cache in the filename
+
                        // Is it a file and readable?
                        //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):FQFN={$FQFN}<br />\n";
                        if (isDirectory($FQFN)) {
@@ -2649,8 +2650,14 @@ function getAkt_vers () {
                if (isset($t[2])) $akt_vers[$search] = trim($t[2]);
        } // END - foreach
 
+       // Save the last-changed filename for debugging
+       $akt_vers['File'] = $last_changed['path_name'];
+
        // at least 3 keyword-Tags are needed for propper values
-       if ($res && $res >= 3) {
+       if ($res && $res >= 3
+               && isset($akt_vers['Revision']) && $akt_vers['Revision'] != ''
+               && isset($akt_vers['Date']) && $akt_vers['Date'] != ''
+               && isset($akt_vers['Tag']) && $akt_vers['Tag'] != '') {
                // Prepare content witch need special treadment
 
                // Prepare timestamp for date
@@ -2661,6 +2668,7 @@ function getAkt_vers () {
                if ((isset($akt_vers['Author'])) && ($akt_vers['Author'] != "quix0r")) {
                        $akt_vers['Tag'] .= '-'.strtoupper($akt_vers['Author']);
                } // END - if
+
        } else {
                // No valid Data from the last modificated file so read the Revision from the Server. Fallback-solution!! Should not be removed I think.
                $version = GET_URL("check-updates3.php");
@@ -3323,10 +3331,34 @@ function TRANSLATE_POOL_TYPE ($type) {
        return $translated;
 }
 
+// Determines the real remote address
+function determineRealRemoteAddress () {
+       // Is a proxy in use?
+       if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
+               // Proxy was used
+               $address = $_SERVER['HTTP_X_FORWARDED_FOR'];
+       } elseif (isset($_SERVER['HTTP_CLIENT_IP'])){
+               // Yet, another proxy
+               $address = $_SERVER['HTTP_CLIENT_IP'];
+       } else {
+               // The regular address when no proxy was used
+               $address = $_SERVER['REMOTE_ADDR'];
+       }
+
+       // This strips out the real address from proxy output
+       if (strstr($address, ",")){
+               $addressArray = explode(",", $address);
+               $address = $addressArray[0];
+       } // END - if
+
+       // Return the result
+       return $address;
+}
+
 // "Getter" for remote IP number
 function GET_REMOTE_ADDR () {
        // Get remote ip from environment
-       $remoteAddr = getenv('REMOTE_ADDR');
+       $remoteAddr = determineRealRemoteAddress();
 
        // Is removeip installed?
        if (EXT_IS_ACTIVE("removeip")) {