]> git.mxchange.org Git - mailer.git/commitdiff
Extension ext-sql_patches continued:
authorRoland Häder <roland@mxchange.org>
Sat, 3 Nov 2012 21:41:44 +0000 (21:41 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 3 Nov 2012 21:41:44 +0000 (21:41 +0000)
- Logging of wrong SERVER_NAME values added (admin menu not yet)
- Fix for missing array element 'default' in admin-inc.php

inc/extensions/ext-sql_patches.php
inc/filters.php
inc/http-functions.php
inc/modules/admin/admin-inc.php

index fa54c1efa23883a30fc248a1f17dd424e431b9dd..e495e91c0351543051b9fb4b5cc900edc043f090 100644 (file)
@@ -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&auml;ge in <strong>{?_MYSQL_PREFIX?}_points_data</strong> hinzugef&uuml;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 <strong>SERVER_NAME</strong> Eintr&auml;gen hinzugef&uuml;gt.");
+                               break;
                } // END - switch
                break;
 
index d2981c0f11d2400fa0c66c0a0eda2ea2b9e630e3..d512328709ea3dba65facf19dad983b1885fe1fc 100644 (file)
@@ -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
index 4b59018c634cf90109c6cbc5907d97f5944bb80e..317ba55e83d1599c86c31cec6240d7e0496616d4 100644 (file)
@@ -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]
 ?>
index ae2c3ff311dc06cd91ba1e872296c8ead7800063..a6a660a17cb99cbbdc8a17f4db88ead94777ed0b 100644 (file)
@@ -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