From: Roland Häder Date: Sat, 3 Nov 2012 21:41:44 +0000 (+0000) Subject: Extension ext-sql_patches continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;ds=sidebyside;h=e4b7f0c779ffca9c9317a18b303a0f7714e96176;hp=93b1321862eb860e600e796dc290e2be27fb97fa;p=mailer.git Extension ext-sql_patches continued: - Logging of wrong SERVER_NAME values added (admin menu not yet) - Fix for missing array element 'default' in admin-inc.php --- diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index fa54c1efa2..e495e91c03 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -41,10 +41,10 @@ if (!defined('__SECURITY')) { } // END - if // Version number -setThisExtensionVersion('0.9.0'); +setThisExtensionVersion('0.9.1'); // Version history array (add more with , '0.0.1' and so on) -setExtensionVersionHistory(array('0.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', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.5', '0.7.6', '0.7.7', '0.7.8', '0.7.9', '0.8.0', '0.8.1', '0.8.2', '0.8.3', '0.8.4', '0.8.5', '0.8.6', '0.8.7', '0.8.8', '0.8.9', '0.9.0')); +setExtensionVersionHistory(array('0.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', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.5', '0.7.6', '0.7.7', '0.7.8', '0.7.9', '0.8.0', '0.8.1', '0.8.2', '0.8.3', '0.8.4', '0.8.5', '0.8.6', '0.8.7', '0.8.8', '0.8.9', '0.9.0', '0.9.1')); // Keep this extension always active! setExtensionAlwaysActive('Y'); @@ -61,6 +61,7 @@ switch (getExtensionMode()) { addDropTableSql('admin_menu_las_data'); addDropTableSql('admin_las_stats'); addDropTableSql('dns_cache'); + addDropTableSql('server_name_log'); // Delete admin menu entries addExtensionSql("DELETE LOW_PRIORITY FROM @@ -932,6 +933,19 @@ INDEX (`history_last_used` DESC)", // Update notes (these will be set as task text!) setExtensionUpdateNotes("Filter zum Initialisieren von ext-sql_patches registriert und Einträge in {?_MYSQL_PREFIX?}_points_data hinzugefügt."); break; + + case '0.9.1': // SQL queries for v0.9.1 + addAdminMenuSql('misc', 'list_server_name', 'Verkehrte Domains auflisten', 'Listet alle als verkehrt erkannten Domains auf.', 4); + addCreateTableSql('server_name_log', " +`server_name_id` BIGINT (20) NOT NULL AUTO_INCREMENT, +`server_name` VARCHAR (255) NOT NULL DEFAULT 'invalid', +`server_name_added` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +PRIMARY_KEY (`server_name_id`) +", 'Logging of wrong SERVER_NAME'); + + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Loggen von falschen SERVER_NAME Einträgen hinzugefügt."); + break; } // END - switch break; diff --git a/inc/filters.php b/inc/filters.php index d2981c0f11..d512328709 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -1323,6 +1323,9 @@ function FILTER_REDIRECT_WRONG_SERVER_NAME ($filterData) { // Is the configured URL same as SERVER_NAME? if (extractHostnameFromUrl($url) != detectServerName()) { + // Log all attempts + logWrongServerNameRedirect(); + // Then redirect to configured URL redirectToRequestUri(); } // END - if diff --git a/inc/http-functions.php b/inc/http-functions.php index 4b59018c63..317ba55e83 100644 --- a/inc/http-functions.php +++ b/inc/http-functions.php @@ -857,5 +857,15 @@ function getContentType () { return $GLOBALS['content_type']; } +// Logs wrong SERVER_NAME attempts +function logWrongServerNameRedirect () { + // Is ext-sql_patches at least version 0.9.1? + if (isExtensionInstalledAndNewer('sql_patches', '0.9.1')) { + // Then log it away + SQL_QUERY("INSERT INTO `{?_MYSQL_PREFIX?}_server_name_log` (`server_name`) VALUES('{%pipe,detectServerName%}')", + __FUNCTION__, __LINE__); + } // END - if +} + // [EOF] ?> diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index ae2c3ff311..a6a660a17c 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -442,6 +442,15 @@ ORDER BY // Load all entries while ($content = SQL_FETCHARRAY($result)) { + // Default is none + $content['default'] = ''; + + // Is the id the same? + if ($content['id'] == $adminId) { + // Set this as default + $content['default'] = ' selected="selected"'; + } // END - if + // Add the entry $OUT .= loadTemplate('select_admins_option', TRUE, $content); } // END - if