From: Roland Häder Date: Tue, 25 Nov 2008 14:49:57 +0000 (+0000) Subject: Several fixes and and improvements: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c14a130863bb037b00fceabd099a202eb4a5b2d8;p=mailer.git Several fixes and and improvements: - Several small fixes in extension files and other include files - extension ext-rewrite.zip now depends on Apache module 'rewrite' - Thanks to our user profi-conecpt for all his contributions! :-) --- diff --git a/inc/databases.php b/inc/databases.php index d25b6b5e20..896b6b9f85 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -114,7 +114,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "555"); +define('CURR_SVN_REVISION', "556"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/extensions.php b/inc/extensions.php index 722fa681cb..c4d7a8e0b1 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -41,6 +41,7 @@ if (!defined('__SECURITY')) { function EXTENSION_REGISTER ($ext_name, $id, $dry_run=false) { global $NOTES, $_CONFIG, $INC_POOL, $cacheInstance; + // We want to register an extension and registration status is by default "failed" (= false) $EXT_LOAD_MODE = "register"; $ret = false; $SQLs = array(); $INC_POOL = array(); @@ -48,6 +49,9 @@ function EXTENSION_REGISTER ($ext_name, $id, $dry_run=false) // This shall never do a non-admin user! if (!IS_ADMIN()) return false; + // By default we have no failtures + $EXT_REPORTS_FAILURE = true; + // Is this extension already installed? if (EXT_IS_ACTIVE($ext_name)) return false; @@ -164,6 +168,9 @@ function EXTENSION_REGISTER ($ext_name, $id, $dry_run=false) // Switch back to register mode $EXT_LOAD_MODE = "register"; + // Remains true if extension registration reports no failtures + $test = ($test && !$EXT_REPORTS_FAILTURE); + // Does everthing before wents ok? if ($test) { // "Dry-run-mode" activated? diff --git a/inc/extensions/ext-rallye.php b/inc/extensions/ext-rallye.php index c1c60df94b..ffd56fe511 100644 --- a/inc/extensions/ext-rallye.php +++ b/inc/extensions/ext-rallye.php @@ -103,8 +103,8 @@ case "remove": // Do stuff when removing extension $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_rallye_prices"; $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_rallye_users"; $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE action='rallye' LIMIT 4"; - $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_guest_menu WHERE what='rallye' LIMIT 1"; - $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE what='rallye' LIMIT 1"; + $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_guest_menu WHERE what='rallyes' LIMIT 1"; + $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE what='rallyes' LIMIT 1"; break; case "activate": // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-refback.php b/inc/extensions/ext-refback.php index 42d1672a5c..de8861e21c 100644 --- a/inc/extensions/ext-refback.php +++ b/inc/extensions/ext-refback.php @@ -76,7 +76,7 @@ case "remove": // Do stuff when removing extension case "activate": // Do stuff when admin activates this extension // SQL commands to run - $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='Y' locked='N' WHERE what='refback' LIMIT 1"; + $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='Y', locked='N' WHERE what='refback' LIMIT 1"; break; case "deactivate": // Do stuff when admin deactivates this extension diff --git a/inc/extensions/ext-rewrite.php b/inc/extensions/ext-rewrite.php index 909080785a..c440439df7 100644 --- a/inc/extensions/ext-rewrite.php +++ b/inc/extensions/ext-rewrite.php @@ -38,17 +38,23 @@ if (!defined('__SECURITY')) { } // Version number -$EXT_VERSION = "0.1.2"; +$EXT_VERSION = "0.1.3"; // Auto-set extension version if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION; // Version history array (add more with , "0.1" and so on) -$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2"); +$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2", "0.1.3"); switch ($EXT_LOAD_MODE) { case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called) + // Check if mod_rewrite is loadeded + if (!IF_APACHE_MODULE_LOADED('mod_rewrite')){ + $EXT_REPORTS_FAILURE = true; + ADD_FATAL(MOD_REWRITE_ERROR); + } // END - if + // SQL commands to run $SQLs[] = ""; break; @@ -59,6 +65,13 @@ case "remove": // Do stuff when removing extension break; case "activate": // Do stuff when admin activates this extension + // Check if mod_rewrite is loadeded + if (!IF_APACHE_MODULE_LOADED('mod_rewrite')) { + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_active='N' WHERE ext_name='rewrite' LIMIT 1", array(), __FILE__, __LINE__); + $EXT_REPORTS_FAILURE = true; + ADD_FATAL(MOD_REWRITE_ERROR); + } // END - if + // SQL commands to run $SQLs[] = ""; break; @@ -131,10 +144,24 @@ case "update": // Update an extension // Update notes (these will be set as task text!) $UPDATE_NOTES = "Abspeichern von Einstellungen repariert."; break; + case "0.1.3": + // Check if mod_rewrite is loadeded + if (!IF_APACHE_MODULE_LOADED('mod_rewrite')){ + $EXT_REPORTS_FAILURE = true; + //ADD_FATAL(MOD_REWRITE_ERROR); + } // END - if + $UPDATE_NOTES = "Es wird beim Registrieren und aktivieren geprüft, ob im Apache das Modul mod_rewrite geladen wurde. Wenn mod_rewrite nicht gefunden werden konnte, wird abgebrochen."; + break; } break; default: // Do stuff when extension is loaded + // Check if mod_rewrite is loadeded + if (!IF_APACHE_MODULE_LOADED('mod_rewrite')){ + $EXT_REPORTS_FAILURE = true; + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_active='N' WHERE ext_name='rewrite' LIMIT 1", array(), __FILE__, __LINE__); + if (!IS_ADMIN())ADD_FATAL(MOD_REWRITE_ERROR); + } // END - if break; } diff --git a/inc/functions.php b/inc/functions.php index 3f5f434e24..5c69d92b29 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2804,6 +2804,12 @@ function DESTROY_ADMIN_SESSION () { return @session_destroy(); } +// Checks if a given apache module is loaded +function IF_APACHE_MODULE_LOADED ($apacheModule) { + // Check it and return result + return (in_array($apacheModule, apache_get_modules())); +} + ////////////////////////////////////////////////// // // // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS // diff --git a/inc/language/de.php b/inc/language/de.php index 84daad99b5..c24661ff61 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -1194,6 +1194,7 @@ define('RAND_CONFIRMED', "Bestätigt f. Zufalls-Ref"); define('LOCK_REASON', "Sperrgrund"); define('LOCK_TIMESTAMP', "Sperrzeitpunkt"); define('EXTENSION', "Erweiterung"); +define('MOD_REWRITE_ERROR', "Sie müssen mod_rewrite in Apache aktiviert haben um die Erweiterung rewrite nutzen zu können."); define('MEMBER_MAIL_BONUS_CONFIRMED_ON', "Sie haben diese Bonusmail %s bestätigt."); define('MEMBER_MAIL_NORMAL_CONFIRMED_ON', "Sie haben diese Klickmail %s bestätigt."); diff --git a/inc/modules/admin/what-config_primera.php b/inc/modules/admin/what-config_primera.php index 60c7d541d2..873eea58e2 100644 --- a/inc/modules/admin/what-config_primera.php +++ b/inc/modules/admin/what-config_primera.php @@ -51,7 +51,7 @@ if (isset($_POST['ok'])) { unset($_POST['pass']); } // END - if - // Let's test the API first (hold your horses here, cowboy! Thanks. :) ) + // Let's test the API first (hold your horses here, cowboy! Thank you. :) ) if (PRIMERA_TEST_API()) { // Save settings ADMIN_SAVE_SETTINGS($_POST); diff --git a/inc/modules/admin/what-config_wernis.php b/inc/modules/admin/what-config_wernis.php index be8e48fe7f..887d56bc17 100644 --- a/inc/modules/admin/what-config_wernis.php +++ b/inc/modules/admin/what-config_wernis.php @@ -44,7 +44,7 @@ if (isset($_POST['ok'])) { // First merge temporarily the new API data into the current config $_CONFIG = array_merge($_CONFIG, $_POST); - // Let's test the API first (hold your horses here, cowboy! Thanks. :) ) + // Let's test the API first (hold your horses here, cowboy! Thank you. :) ) if (WERNIS_TEST_API()) { // Revert german commata foreach (array('payout_factor', 'withdraw_factor', 'payout_fee_percent', 'withdraw_fee_percent') as $revert) { diff --git a/inc/modules/guest/what-doubler.php b/inc/modules/guest/what-doubler.php index ccec7e3092..bb53c0656b 100644 --- a/inc/modules/guest/what-doubler.php +++ b/inc/modules/guest/what-doubler.php @@ -35,7 +35,7 @@ if (!defined('__SECURITY')) { $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; require($INC); -} elseif (!EXT_IS_ACTIVE("doubler")) +} elseif (!EXT_IS_ACTIVE("doubler")) { ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "doubler"); return; } diff --git a/inc/modules/index.php b/inc/modules/index.php index dcd2f45f01..e43f686935 100644 --- a/inc/modules/index.php +++ b/inc/modules/index.php @@ -48,6 +48,13 @@ LOAD_TEMPLATE("guest_header"); // Add message here if (!empty($_GET['msg'])) { + // Default extension is "unknown" + $ext = "unknown"; + + // Is extension given? + if (!empty($_GET['ext'])) $ext = SQL_ESCAPE($_GET['ext']); + + // Which message shall we output? switch ($_GET['msg']) { case CODE_LOGOUT_DONE : $msg = LOGOUT_DONE; break; case CODE_LOGOUT_FAILED : $msg = "".LOGOUT_FAILED.""; break; @@ -63,11 +70,6 @@ if (!empty($_GET['msg'])) { break; case CODE_EXTENSION_PROBLEM: - // Default extension is "unknown" - $ext = "unknown"; - - // Is extension given? - if (!empty($_GET['ext'])) $ext = SQL_ESCAPE($_GET['ext']); $msg = sprintf(EXTENSION_PROBLEM_EXT_INACTIVE, $ext); break; @@ -75,7 +77,7 @@ if (!empty($_GET['msg'])) { case CODE_BEG_SAME_AS_OWN : $msg = BEG_SAME_UID_AS_OWN; break; case CODE_LOGIN_FAILED : $msg = LOGIN_FAILED_GENERAL; break; default : $msg = UNKNOWN_MAILID_CODE_1.$_GET['msg'].UNKNOWN_MAILID_CODE_2; break; - } + } // END - switch // Load message template LOAD_TEMPLATE("message", false, $msg); diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index a700311bf3..9db7dff257 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -77,7 +77,7 @@ function __errorHandler ($errno, $errstr, $errfile, $errline) { // No debug extension found print("Please report this error at forum.mxchange.org:
");
 		debug_print_backtrace();
-		die("
Thanks for your help finding bugs."); + die("Thank you for your help finding bugs."); } }