Updates menu moved to ext-update, fixes for main menu entries where what is NULL
authorRoland Häder <roland@mxchange.org>
Wed, 28 Oct 2009 18:23:40 +0000 (18:23 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 28 Oct 2009 18:23:40 +0000 (18:23 +0000)
inc/extensions-functions.php
inc/extensions/ext-sql_patches.php
inc/extensions/ext-update.php
install/menu-de.sql
install/menu-en.sql

index d1db294f1d097927d2b1925a5de3585e6e45db46..bed7a9c3ce66c1e0186c4284a981d8a6154ca9e4 100644 (file)
@@ -1580,18 +1580,29 @@ function isExtensionFunctionFileReadable ($ext_name) {
 function addAdminMenuSql ($action, $what, $title, $descr, $sort) {
        // Now check if this menu is there
        if (!isMenuActionValid('admin', $action, $what)) {
-               // Not found, so construct it
-               $sql = sprintf("INSERT INTO {?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr',`sort`) VALUES('%s','%s','%s','%s',%s)",
-                       $action,
-                       $what,
-                       $title,
-                       $descr,
-                       bigintval($sort)
-               );
+               // Is what null?
+               if (is_null($what)) {
+                       // Add main menu
+                       $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES('%s',NULL,'%s','%s',%s)",
+                               $action,
+                               $title,
+                               $descr,
+                               bigintval($sort)
+                       );
+               } else {
+                       // Add sub menu
+                       $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES('%s','%s','%s','%s',%s)",
+                               $action,
+                               $what,
+                               $title,
+                               $descr,
+                               bigintval($sort)
+                       );
+               }
 
                // Add it to the queue
                addExtensionSql($sql);
-       } else {
+       } elseif (isDebugModeEnabled()) {
                // Double menus should be located and fixed!
                logDebugMessage(__FUNCTION__, __LINE__, sprintf("Double admin menu action=%s, what=%s detected.", $action, $what));
        }
@@ -1601,19 +1612,31 @@ function addAdminMenuSql ($action, $what, $title, $descr, $sort) {
 function addGuestMenuSql ($action, $what, $title, $visible, $locked, $sort) {
        // Now check if this menu is there
        if (!isMenuActionValid('guest', $action, $what)) {
-               // Not found, so construct it
-               $sql = sprintf("INSERT INTO {?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s','%s','%s','%s','%s',%s)",
-                       $action,
-                       $what,
-                       $title,
-                       $visible,
-                       $locked,
-                       bigintval($sort)
-               );
+               // Is what null?
+               if (is_null($what)) {
+                       // Add main menu
+                       $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s',NULL,'%s','%s','%s',%s)",
+                               $action,
+                               $title,
+                               $visible,
+                               $locked,
+                               bigintval($sort)
+                       );
+               } else {
+                       // Add sub menu
+                       $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s','%s','%s','%s','%s',%s)",
+                               $action,
+                               $what,
+                               $title,
+                               $visible,
+                               $locked,
+                               bigintval($sort)
+                       );
+               }
 
                // Add it to the queue
                addExtensionSql($sql);
-       } else {
+       } elseif (isDebugModeEnabled()) {
                // Double menus should be located and fixed!
                logDebugMessage(__FUNCTION__, __LINE__, sprintf("Double guest menu action=%s, what=%s detected.", $action, $what));
        }
@@ -1623,19 +1646,31 @@ function addGuestMenuSql ($action, $what, $title, $visible, $locked, $sort) {
 function addMemberMenuSql ($action, $what, $title, $visible, $locked, $sort) {
        // Now check if this menu is there
        if (!isMenuActionValid('member', $action, $what)) {
-               // Not found, so construct it
-               $sql = sprintf("INSERT INTO {?_MYSQL_PREFIX?}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s','%s','%s','%s','%s',%s)",
-                       $action,
-                       $what,
-                       $title,
-                       $visible,
-                       $locked,
-                       bigintval($sort)
-               );
+               // Is what null?
+               if (is_null($what)) {
+                       // Add main menu
+                       $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s',NULL,'%s','%s','%s',%s)",
+                               $action,
+                               $title,
+                               $visible,
+                               $locked,
+                               bigintval($sort)
+                       );
+               } else {
+                       // Add sub menu
+                       $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES('%s','%s','%s','%s','%s',%s)",
+                               $action,
+                               $what,
+                               $title,
+                               $visible,
+                               $locked,
+                               bigintval($sort)
+                       );
+               }
 
                // Add it to the queue
                addExtensionSql($sql);
-       } else {
+       } elseif (isDebugModeEnabled()) {
                // Double menus should be located and fixed!
                logDebugMessage(__FUNCTION__, __LINE__, sprintf("Double member menu action=%s, what=%s detected.", $action, $what));
        }
@@ -1645,18 +1680,29 @@ function addMemberMenuSql ($action, $what, $title, $visible, $locked, $sort) {
 function addSponsorMenuSql ($action, $what, $title, $active, $sort) {
        // Now check if this menu is there, if no ext-sponsor is installed all is not yet added
        if ((!isExtensionInstalled('sponsor')) || (!isMenuActionValid('sponsor', $action, $what))) {
-               // Not found, so construct it
-               $sql = sprintf("INSERT INTO {?_MYSQL_PREFIX?}_sponsor_menu` (`action`,`what`,`title`,`active`,`sort`) VALUES('%s','%s','%s','%s',%s)",
-                       $action,
-                       $what,
-                       $title,
-                       $active,
-                       bigintval($sort)
-               );
+               // Is what null?
+               if (is_null($what)) {
+                       // Add main menu
+                       $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_sponsor_menu` (`action`,`what`,`title`,`active`,`sort`) VALUES('%s',NULL,'%s','%s',%s)",
+                               $action,
+                               $title,
+                               $active,
+                               bigintval($sort)
+                       );
+               } else {
+                       // Add sub menu
+                       $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_sponsor_menu` (`action`,`what`,`title`,`active`,`sort`) VALUES('%s','%s','%s','%s',%s)",
+                               $action,
+                               $what,
+                               $title,
+                               $active,
+                               bigintval($sort)
+                       );
+               }
 
                // Add it to the queue
                addExtensionSql($sql);
-       } else {
+       } elseif (isDebugModeEnabled()) {
                // Double menus should be located and fixed!
                logDebugMessage(__FUNCTION__, __LINE__, sprintf("Double sponsor menu action=%s, what=%s detected.", $action, $what));
        }
index d2fe0192c5cac7b5851fd976a44f84444684b463..6a364e43612e18959f5e4ade0eb24636f9c0d6c1 100644 (file)
@@ -682,8 +682,8 @@ PRIMARY KEY (`filter_id`)
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Filter-Tabelle bereinigt um doppelte Eintr&auml;ge und Unique-Key auf <em>filter_name</em> und <em>filter_function</em> zusammen gesetzt.");
 
-                               // Include special filte
-                               loadIncludeOnce('inc/fix_filters.php');
+                               // Add special fix include to fix filters
+                               addIncludeToPool('extension', 'inc/fix_filters.php');
                                break;
 
                        case '0.6.4': // SQL queries for v0.6.4
@@ -722,11 +722,8 @@ PRIMARY KEY (`filter_id`)
                        // Maybe need setup of secret key!
                        loadIncludeOnce('inc/gen_sql_patches.php');
 
-                       // @TODO Rewrite this to a filter!
+                       // @TODO Rewrite this to a filter
                        if ((isExtensionInstalledAndNewer('cache', '0.1.2')) && (isCacheInstanceValid())) {
-                               // Remove extensions and mod_reg cache file
-                               loadIncludeOnce('inc/libs/cache_functions.php');
-
                                // Destroy some cache files
                                if ($GLOBALS['cache_instance']->loadCacheFile('extension')) $GLOBALS['cache_instance']->removeCacheFile();
                                if ($GLOBALS['cache_instance']->loadCacheFile('modules'))   $GLOBALS['cache_instance']->removeCacheFile();
@@ -745,7 +742,7 @@ PRIMARY KEY (`filter_id`)
                                updateConfiguration('file_hash', '');
 
                                // Cannot read secret file!
-                               app_die(__FILE__, __LINE__, "Cannot read secret file! Please try to reload");
+                               app_die(__FILE__, __LINE__, 'Cannot read secret file! Please try to reload.');
                        }
                } // END - if
 
index fcf30e7d41d8dff87bce0249f77cdf3079c429d0..72c76ec32415170044f93b55b7865d7f8620d06f 100644 (file)
@@ -50,6 +50,7 @@ setExtensionVersionHistory(array('0.0'));
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
                // SQL commands to run
+               addAdminMenuSql('misc','updates','Updates pr&uuml;fen','Pr&uuml;ft, ob eine neue Version oder ein Patch auf dem Server exisitiert. Sie m&uuml;ssen dann die Patches/Updates selber herunterladen und einspielen. Dabei werden keine Daten von Ihrer Installation an uns gesendet!',8);
                break;
 
        case 'remove': // Do stuff when removing extension
index 4bcd8a4d2b96a7294577058bfbbffc581ca8e380..71fa82f4c76d01b6320e9319a401bbe71970bdc1 100644 (file)
@@ -84,7 +84,6 @@ INSERT INTO `{?_MYSQL_PREFIX?}_payments` VALUES (5,50,50.000,'Klick-Mail 50 Sek.
 
 INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('email','email_archiv','E-Mail Archiv','Sehen Sie sich hier bereits gesendete Mails an.','6');
 INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('email','del_email','E-Mail l&ouml;schen','L&ouml;schen Sie hierr&uuml;ber E-Mails (sowohl Bonus- als auch Normal-Mails) aus Ihrem Mailtausch-System. <strong>Nur bei Normal-Mails:</strong> {?POINTS?} aus den unbest&auml;tigten Mails werden dem Werber wieder verg&uuml;tet.','7');
-INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('misc','updates','Updates pr&uuml;fen','Pr&uuml;ft, ob eine neue Version oder ein Patch auf dem Server exisitiert. Sie m&uuml;ssen dann die Patches/Updates selber herunterladen und einspielen. Dabei werden keine Daten von Ihrer Installation an uns gesendet!','8');
 INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('misc','extensions','Erweiterungen','Erweiterungen installieren, updaten, sperren, l&ouml;schen usw.','8');
 
 INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','stats','Statistiken','7','Y','N');
index 4bcd8a4d2b96a7294577058bfbbffc581ca8e380..71fa82f4c76d01b6320e9319a401bbe71970bdc1 100644 (file)
@@ -84,7 +84,6 @@ INSERT INTO `{?_MYSQL_PREFIX?}_payments` VALUES (5,50,50.000,'Klick-Mail 50 Sek.
 
 INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('email','email_archiv','E-Mail Archiv','Sehen Sie sich hier bereits gesendete Mails an.','6');
 INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('email','del_email','E-Mail l&ouml;schen','L&ouml;schen Sie hierr&uuml;ber E-Mails (sowohl Bonus- als auch Normal-Mails) aus Ihrem Mailtausch-System. <strong>Nur bei Normal-Mails:</strong> {?POINTS?} aus den unbest&auml;tigten Mails werden dem Werber wieder verg&uuml;tet.','7');
-INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('misc','updates','Updates pr&uuml;fen','Pr&uuml;ft, ob eine neue Version oder ein Patch auf dem Server exisitiert. Sie m&uuml;ssen dann die Patches/Updates selber herunterladen und einspielen. Dabei werden keine Daten von Ihrer Installation an uns gesendet!','8');
 INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('misc','extensions','Erweiterungen','Erweiterungen installieren, updaten, sperren, l&ouml;schen usw.','8');
 
 INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','stats','Statistiken','7','Y','N');