From: Roland Häder Date: Fri, 6 Mar 2009 21:09:38 +0000 (+0000) Subject: Fixed logfile writing in installation phase, .revision is now ignored X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=commitdiff_plain;h=f3e4c2c048761589836fdbe6bd2e46599a1833a7 Fixed logfile writing in installation phase, .revision is now ignored --- diff --git a/.gitattributes b/.gitattributes index c46d5c5f5c..20fca9e54a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -90,6 +90,7 @@ inc/autopurge/purge-mails.php -text inc/autopurge/purge-tsks.php -text inc/autopurge/purge-unconfirmed.php -text inc/cache/.htaccess -text +inc/cache/.revision -text inc/check-reset.php -text inc/config-functions.php -text inc/config.php -text diff --git a/admin.php b/admin.php index 631eebc65a..d075c1d220 100644 --- a/admin.php +++ b/admin.php @@ -60,4 +60,7 @@ if (isInstalled()) { } // Really all done here... ;-) +shutdown(); + +// ?> diff --git a/agb.php b/agb.php index f564e7bd4d..4cee173d8d 100644 --- a/agb.php +++ b/agb.php @@ -60,4 +60,7 @@ if (isInstalled()) { } // Really all done here... ;-) +shutdown(); + +// ?> diff --git a/beg.php b/beg.php index 98b3e2d6c9..4446302f51 100644 --- a/beg.php +++ b/beg.php @@ -240,4 +240,7 @@ if (isInstalled()) { } // Really all done here... ;-) +shutdown(); + +// ?> diff --git a/birthday_confirm.php b/birthday_confirm.php index 704d3bffd5..8c6022fe7e 100644 --- a/birthday_confirm.php +++ b/birthday_confirm.php @@ -136,5 +136,9 @@ WHERE b.userid=%s AND b.chk_value='%s' LIMIT 1", // You have to install first! LOAD_URL("install.php"); } + // Really all done here... ;-) +shutdown(); + +// ?> diff --git a/click.php b/click.php index 1393bc19f7..a13bb7787e 100644 --- a/click.php +++ b/click.php @@ -65,5 +65,8 @@ if (((REQUEST_ISSET_GET(('user'))) || (REQUEST_ISSET_GET(('reseller')))) && (REQ // Load index page LOAD_URL("index.php"); +// Shutdown +shutdown(); + // [EOF] ?> diff --git a/confirm.php b/confirm.php index 86c4f13205..6f2d080373 100644 --- a/confirm.php +++ b/confirm.php @@ -70,4 +70,7 @@ if ((isInstalled()) && (isAdminRegistered())) { } // Really all done here... ;-) +shutdown(); + +// ?> diff --git a/debug.php b/debug.php index f1c2272fcc..bd5716bf4d 100644 --- a/debug.php +++ b/debug.php @@ -55,7 +55,7 @@ if ((isInstalled()) && (getTotalFatalErrors() == 0)) { // Is the extension installed? if (!EXT_IS_ACTIVE("debug")) { // Then abort here - exit; + shutdown(); } // END - if // Is the request parameter set? @@ -90,4 +90,7 @@ if ((isInstalled()) && (getTotalFatalErrors() == 0)) { } // END - if // Really all done here... ;-) +shutdown(); + +// ?> diff --git a/doubler.php b/doubler.php index cf96c73ad5..82a71d6d85 100644 --- a/doubler.php +++ b/doubler.php @@ -279,4 +279,7 @@ if (isInstalled()) { } // Really all done here... ;-) +shutdown(); + +// ?> diff --git a/img.php b/img.php index c150e17c15..e82c6a60c9 100644 --- a/img.php +++ b/img.php @@ -80,4 +80,7 @@ if (isInstalled()) { } // Really all done here... ;-) +shutdown(); + +// ?> diff --git a/inc/cache/.revision b/inc/cache/.revision new file mode 100644 index 0000000000..2458b5058e --- /dev/null +++ b/inc/cache/.revision @@ -0,0 +1,4 @@ +856 +1236367472 +0.2.1-FINAL-STELZI +stelzi \ No newline at end of file diff --git a/inc/config.php b/inc/config.php index 5f54475e2f..db220c2a3a 100644 --- a/inc/config.php +++ b/inc/config.php @@ -10,7 +10,12 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Ihre Konfigurationsdaten (MySQL) * * -------------------------------------------------------------------- * - * * + * $Revision:: 856 $ * + * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009) $ * + * $Tag:: 0.2.1-FINAL $ * + * $Author:: stelzi $ * + * Needs to be in all Files and every File needs "svn propset * + * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2008 by Roland Haeder * * For more information visit: http://www.mxchange.org * @@ -122,9 +127,6 @@ define('DEBUG_MODE', false); // CFG: DEBUG-WEEKLY (comment in to test weekly reset, comment out to not test) //define('DEBUG_WEEKLY', true); -// When we are not installing -if (!defined('mxchange_installing')) define('mxchange_installing', false); - // Your MySQL data (we don't like M$ SQL ;-) ) $MySQL = array( // CFG: MYSQL-HOST diff --git a/inc/databases.php b/inc/databases.php index 7e3f7d06ae..9e37689206 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -11,7 +11,7 @@ * Kurzbeschreibung : Definitionen und Datenfelder (hart-codertiert) * * -------------------------------------------------------------------- * * $Revision:: 856 $ * - * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009) $ * + * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009) $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: stelzi $ * * Needs to be in all Files and every File needs "svn propset * @@ -83,7 +83,8 @@ define('SERVER_URL', "http://www.mxchange.org"); // Full version string: /([0-9]){1}\.([0-9]){1}\.([0-9]){1}(-(alpha|beta|pre|rc([1-3]))([0-9]+))?/ // If you understand regular expressions ^^^ you may know how I versionize... ;-) -define('FULL_VERSION', getActualVersion('Tag')); +//define('FULL_VERSION', getActualVersion('Tag')); +define('FULL_VERSION', "0.2.1-FINAL"); // Replacement strings $GLOBALS['replacer'] = array( @@ -101,8 +102,10 @@ setConfigEntry('one_day', (60*60*24)); define('START_YDAY', MAKE_TIME(0, 0, 0, time() - getConfig('one_day'))); define('START_TDAY', MAKE_TIME(0, 0, 0, time())); -// Current SVN revision -define('CURR_SVN_REVISION', getActualVersion('Revision'));define('CURR_SVN_DATE' , getActualVersion('Date')); +// Current SVN revision and date +define('CURR_SVN_REVISION', getActualVersion('Revision')); +define('CURR_SVN_DATE' , getActualVersion('Date')); + // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/fatal_errors.php b/inc/fatal_errors.php index ea05cca122..d1b8a4fd90 100644 --- a/inc/fatal_errors.php +++ b/inc/fatal_errors.php @@ -82,7 +82,7 @@ if (getTotalFatalErrors() > 0) { LOAD_TEMPLATE("runtime_fatal_table", false, $OUT); // Abort here - exit; + shutdown(); } // Message to regular users (non-admin) diff --git a/inc/filters.php b/inc/filters.php index efc1b7ea80..74d7c43e5d 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -243,6 +243,12 @@ function FILTER_FLUSH_FILTERS () { // Clear all previous SQL queries INIT_SQLS(); + // Are we installing? + if (isInstalling()) { + // Then silently skip this filter + return true; + } // END - if + // Is a database link here and not in installation mode? if ((!SQL_IS_LINK_UP()) && (!isInstalling())) { // Abort here diff --git a/inc/footer.php b/inc/footer.php index f57c784813..fcb2ec0c14 100644 --- a/inc/footer.php +++ b/inc/footer.php @@ -83,5 +83,8 @@ $GLOBALS['footer_sent'] = 1; // Output HTML code OUTPUT_HTML(""); +// Shutdown +shutdown(); + // ?> diff --git a/inc/functions.php b/inc/functions.php index 77447fb997..05cf4378ac 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -950,7 +950,7 @@ function LOAD_URL ($URL, $addUrlData=true) { 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 @@ -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 .= "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"; @@ -2255,7 +2259,7 @@ function mxchange_die ($msg) { LOAD_INC_ONCE("inc/footer.php"); // Exit explicitly - exit; + shutdown(); } // 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 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 @@ -2603,20 +2607,17 @@ function getActualVersion ($type = 'Revision') { } } } -function getSearchFor() -{ + +function getSearchFor () { $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; @@ -3461,7 +3462,9 @@ function DETERMINE_REFID () { // 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 @@ -3501,6 +3504,23 @@ function isCacheInstanceValid () { 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 // ////////////////////////////////////////////////// diff --git a/inc/hooks.php b/inc/hooks.php index 03e3aa0aa0..ccc0927a3b 100644 --- a/inc/hooks.php +++ b/inc/hooks.php @@ -42,19 +42,5 @@ if (!defined('__SECURITY')) { require($INC); } -// Call-back function for running shutdown functions and close database connection -function __SHUTDOWN_HOOK () { - // 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')); - } -} - // [EOF] ?> diff --git a/inc/install-inc.php b/inc/install-inc.php index 26d21d89e9..bb7ea7bd1f 100644 --- a/inc/install-inc.php +++ b/inc/install-inc.php @@ -46,9 +46,6 @@ if (!defined('__SECURITY')) { require($INC); } -// Load sql_patches here -LOAD_EXTENSION("sql_patches"); - // Init variables $mysql = ""; if ((REQUEST_ISSET_POST(('mysql'))) && (is_array(REQUEST_POST('mysql')))) $mysql = REQUEST_POST('mysql'); diff --git a/inc/modules/admin/what-logs.php b/inc/modules/admin/what-logs.php index ddc6a6b48e..711ad3edc1 100644 --- a/inc/modules/admin/what-logs.php +++ b/inc/modules/admin/what-logs.php @@ -82,7 +82,7 @@ if (REQUEST_ISSET_GET(('access'))) { // Output the logfile's content and exit print($content); - exit; + shutdown(); } else { // Not readable! LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('LOGFILE_NOT_READABLE'), $access)); diff --git a/inc/modules/admin/what-usage.php b/inc/modules/admin/what-usage.php index 334b7915d0..e347f4d005 100644 --- a/inc/modules/admin/what-usage.php +++ b/inc/modules/admin/what-usage.php @@ -70,7 +70,7 @@ if (REQUEST_ISSET_GET(('image'))) { imagepng($image); imagedestroy($image); } - exit; + shutdown(); } elseif (!REQUEST_ISSET_GET(('usage'))) { $FQFN = sprintf("%s%s/index.html", constant('PATH'), diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index c932435b45..2a442bf481 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -57,11 +57,8 @@ foreach (array('request-functions', 'session-functions', 'config-functions', 'fi // Set error handler set_error_handler('__errorHandler'); -// Register shutdown hook -register_shutdown_function('__SHUTDOWN_HOOK'); - // Check if the user setups his MySQL stuff... -if ((empty($MySQL['login'])) && (!defined('mxchange_installing')) && (!REQUEST_ISSET_GET(('installing'))) && (isInstalled())) { +if ((empty($MySQL['login'])) && (!isInstalling()) && (!REQUEST_ISSET_GET('installing')) && (isInstalled())) { // No login entered and outside installation mode OUTPUT_HTML("{--LANG_WARNING--}: "); if (isInstalled()) { @@ -238,7 +235,7 @@ if ((!isInstalling()) && (isInstalled())) { LOAD_EXTENSION("sql_patches"); } -if ((getTotalFatalErrors() > 0) && (isInstalled()) && (!defined('mxchange_installing')) && ($GLOBALS['output_mode'] != "1")) { +if ((getTotalFatalErrors() > 0) && (isInstalled()) && (!isInstalling()) && ($GLOBALS['output_mode'] != "1")) { // One or more fatal error(s) occur during connect... LOAD_INC_ONCE("inc/header.php"); LOAD_INC_ONCE("inc/fatal_errors.php"); diff --git a/inc/security.php b/inc/security.php index ee26d4a30e..cc18063897 100644 --- a/inc/security.php +++ b/inc/security.php @@ -66,6 +66,6 @@ echo " \n"; -exit; +shutdown(); // ?> diff --git a/index.php b/index.php index d0acfbc3f0..885a5f1532 100644 --- a/index.php +++ b/index.php @@ -96,4 +96,7 @@ if (isInstalled()) { } // All done here... +shutdown(); + +// ?> diff --git a/install.php b/install.php index 78eeeef999..89b6e33c96 100644 --- a/install.php +++ b/install.php @@ -46,12 +46,12 @@ * MA 02110-1301 USA * ************************************************************************/ -// Tell every module / include file we are installing -$GLOBALS['mxchange_installing'] = true; - // Load security system require("inc/libs/security_functions.php"); +// Tell every module / include file we are installing +$GLOBALS['mxchange_installing'] = true; + // Init "action" and "what" $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; diff --git a/js.php b/js.php index 6425422128..2a94a011bb 100644 --- a/js.php +++ b/js.php @@ -82,5 +82,8 @@ if ((isInstalled()) && (REQUEST_ISSET_GET(('tag')))) { LOAD_INC_ONCE("inc/footer.php"); } // END - if +// Shutdown +shutdown(); + // ?> diff --git a/lead-confirm.php b/lead-confirm.php index 4a87812940..9c3c9810a7 100644 --- a/lead-confirm.php +++ b/lead-confirm.php @@ -98,4 +98,7 @@ if (isInstalled()) { } // All done here... +shutdown(); + +// ?> diff --git a/login.php b/login.php index f51eff956c..3fa280d270 100644 --- a/login.php +++ b/login.php @@ -68,4 +68,7 @@ if (isInstalled()) { } // Really all done here... ;-) +shutdown(); + +// ?> diff --git a/mailid.php b/mailid.php index 95b63187f6..561d51b9ea 100644 --- a/mailid.php +++ b/mailid.php @@ -221,5 +221,8 @@ if (isInstalled()) { LOAD_URL("install.php"); } +// Shutdown +shutdown(); + // ?> diff --git a/mailid_top.php b/mailid_top.php index fefa5fa4ed..f51f2ce1fa 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -363,4 +363,7 @@ if (isInstalled()) { } // Really all done here... ;-) +shutdown(); + +// ?> diff --git a/ref.php b/ref.php index 119078820b..b82e4f83e3 100644 --- a/ref.php +++ b/ref.php @@ -115,4 +115,7 @@ if (isInstalled()) { } // Really all done here... ;-) +shutdown(); + +// ?> diff --git a/show_bonus.php b/show_bonus.php index 2216280646..36eaec702b 100644 --- a/show_bonus.php +++ b/show_bonus.php @@ -142,4 +142,7 @@ LIMIT 1", } // Really all done here... ;-) +shutdown(); + +// ?> diff --git a/sponsor_confirm.php b/sponsor_confirm.php index db8bd87df8..86f976ad0f 100644 --- a/sponsor_confirm.php +++ b/sponsor_confirm.php @@ -71,4 +71,7 @@ if (isInstalled()) { } // Really all done here... ;-) +shutdown(); + +// ?> diff --git a/sponsor_ref.php b/sponsor_ref.php index 4a46280440..da8905c8bb 100644 --- a/sponsor_ref.php +++ b/sponsor_ref.php @@ -76,4 +76,7 @@ if (isInstalled()) { } // Really all done here... ;-) +shutdown(); + +// ?> diff --git a/surfbar.php b/surfbar.php index 4441627df8..119453ad9d 100644 --- a/surfbar.php +++ b/surfbar.php @@ -204,4 +204,7 @@ if (isInstalled()) { } // Really all done here... ;-) +shutdown(); + +// ?> diff --git a/view.php b/view.php index aa210ce3cf..797f6fe85b 100644 --- a/view.php +++ b/view.php @@ -75,5 +75,8 @@ if (((REQUEST_ISSET_GET(('user'))) || (REQUEST_ISSET_GET(('reseller')))) && (REQ LOAD_URL (URL."/index.php"); } -// END - if +// Shutdown +shutdown(); + +// ?>