]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
Fixed logfile writing in installation phase, .revision is now ignored
[mailer.git] / inc / functions.php
index 77447fb99786f289545fa8c314c35798dbe116b1..05cf4378aca2cccaf13b748751c61d0420ec2f75 100644 (file)
@@ -950,7 +950,7 @@ function LOAD_URL ($URL, $addUrlData=true) {
                LOAD_TEMPLATE("redirect_url", false, str_replace("&", "&", $URL));
                LOAD_INC("inc/footer.php");
        }
                LOAD_TEMPLATE("redirect_url", false, str_replace("&", "&", $URL));
                LOAD_INC("inc/footer.php");
        }
-       exit;
+       shutdown();
 }
 
 // Wrapper for LOAD_URL but URL comes from a configuration entry
 }
 
 // Wrapper for LOAD_URL but URL comes from a configuration entry
@@ -1777,7 +1777,11 @@ function GET_URL ($script) {
        $request  = "GET /" . trim($script) . " HTTP/1.1\r\n";
        $request .= "Host: " . $host . "\r\n";
        $request .= "Referer: " . constant('URL') . "/admin.php\r\n";
        $request  = "GET /" . trim($script) . " HTTP/1.1\r\n";
        $request .= "Host: " . $host . "\r\n";
        $request .= "Referer: " . constant('URL') . "/admin.php\r\n";
-       $request .= "User-Agent: " . constant('TITLE') . "/" . constant('FULL_VERSION') . "\r\n";
+       if (defined('FULL_VERSION')) {
+               $request .= "User-Agent: " . constant('TITLE') . "/" . constant('FULL_VERSION') . "\r\n";
+       } else {
+               $request .= "User-Agent: " . constant('TITLE') . "/?.?.?\r\n";
+       }
        $request .= "Content-Type: text/plain\r\n";
        $request .= "Cache-Control: no-cache\r\n";
        $request .= "Connection: Close\r\n\r\n";
        $request .= "Content-Type: text/plain\r\n";
        $request .= "Cache-Control: no-cache\r\n";
        $request .= "Connection: Close\r\n\r\n";
@@ -2255,7 +2259,7 @@ function mxchange_die ($msg) {
        LOAD_INC_ONCE("inc/footer.php");
 
        // Exit explicitly
        LOAD_INC_ONCE("inc/footer.php");
 
        // Exit explicitly
-       exit;
+       shutdown();
 }
 
 // Display parsing time and number of SQL queries in footer
 }
 
 // Display parsing time and number of SQL queries in footer
@@ -2522,7 +2526,7 @@ function clearOutputBuffer () {
 }
 
 // Function to search for the last modifikated file
 }
 
 // Function to search for the last modifikated file
-function searchDirsRecoursive($dir, &$last_changed) {
+function searchDirsRecoursive ($dir, &$last_changed) {
        $ds = scandir($dir); // Needs adjustment for PHP < 5.0.0!!
        foreach ($ds as $d) {
                $f_name = $dir.'/'.$d; // makes a proper Filename
        $ds = scandir($dir); // Needs adjustment for PHP < 5.0.0!!
        foreach ($ds as $d) {
                $f_name = $dir.'/'.$d; // makes a proper Filename
@@ -2603,20 +2607,17 @@ function getActualVersion ($type = 'Revision') {
                }
        }
 }
                }
        }
 }
-function getSearchFor()
-{
+
+function getSearchFor () {
        $searchFor[] = 'Revision';
        $searchFor[] = 'Date';
        $searchFor[] = 'Tag';
        $searchFor[] = 'Author';
 
        return $searchFor;
        $searchFor[] = 'Revision';
        $searchFor[] = 'Date';
        $searchFor[] = 'Tag';
        $searchFor[] = 'Author';
 
        return $searchFor;
-
 }
 
 }
 
-
-function getAkt_vers()
-{
+function getAkt_vers () {
        $next_dir = '.';
        $last_changed['path_name'] = '';
        $last_changed['time'] = 0;
        $next_dir = '.';
        $last_changed['path_name'] = '';
        $last_changed['time'] = 0;
@@ -3461,7 +3462,9 @@ function DETERMINE_REFID () {
 
 // Check wether we are installing
 function isInstalling () {
 
 // Check wether we are installing
 function isInstalling () {
-       return (isset($GLOBALS['mxchange_installing']));
+       $installing = ((isset($GLOBALS['mxchange_installing'])) || (REQUEST_ISSET_GET('installing')));
+       //* DEBUG: */ var_dump($installing);
+       return $installing;
 }
 
 // Check wether this script is installed
 }
 
 // Check wether this script is installed
@@ -3501,6 +3504,23 @@ function isCacheInstanceValid () {
        return ((isset($GLOBALS['cache_instance'])) && (is_object($GLOBALS['cache_instance'])));
 }
 
        return ((isset($GLOBALS['cache_instance'])) && (is_object($GLOBALS['cache_instance'])));
 }
 
+// Our shutdown-function
+function shutdown () {
+       // Call the filter chain 'shutdown'
+       runFilterChain('shutdown', null, false);
+
+       if (SQL_IS_LINK_UP()) {
+               // Close link
+               SQL_CLOSE(__FILE__, __LINE__);
+       } elseif (!isInstalling()) {
+               // No database link
+               addFatalMessage(__FILE__, __LINE__, getMessage('NO_DB_LINK_SHUTDOWN'));
+       }
+
+       // Stop executing here
+       exit;
+}
+
 //////////////////////////////////////////////////
 // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
 //////////////////////////////////////////////////
 //////////////////////////////////////////////////
 // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
 //////////////////////////////////////////////////