From: Roland Häder Date: Wed, 28 Oct 2009 18:23:40 +0000 (+0000) Subject: Updates menu moved to ext-update, fixes for main menu entries where what is NULL X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=62d16e4fb404fff968bfe380995db15955dff524;p=mailer.git Updates menu moved to ext-update, fixes for main menu entries where what is NULL --- diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index d1db294f1d..bed7a9c3ce 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -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)); } diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index d2fe0192c5..6a364e4361 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -682,8 +682,8 @@ PRIMARY KEY (`filter_id`) // Update notes (these will be set as task text!) setExtensionUpdateNotes("Filter-Tabelle bereinigt um doppelte Einträge und Unique-Key auf filter_name und filter_function 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 diff --git a/inc/extensions/ext-update.php b/inc/extensions/ext-update.php index fcf30e7d41..72c76ec324 100644 --- a/inc/extensions/ext-update.php +++ b/inc/extensions/ext-update.php @@ -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üfen','Prüft, ob eine neue Version oder ein Patch auf dem Server exisitiert. Sie mü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 diff --git a/install/menu-de.sql b/install/menu-de.sql index 4bcd8a4d2b..71fa82f4c7 100644 --- a/install/menu-de.sql +++ b/install/menu-de.sql @@ -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öschen','Löschen Sie hierrüber E-Mails (sowohl Bonus- als auch Normal-Mails) aus Ihrem Mailtausch-System. Nur bei Normal-Mails: {?POINTS?} aus den unbestätigten Mails werden dem Werber wieder vergütet.','7'); -INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('misc','updates','Updates prüfen','Prüft, ob eine neue Version oder ein Patch auf dem Server exisitiert. Sie mü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öschen usw.','8'); INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','stats','Statistiken','7','Y','N'); diff --git a/install/menu-en.sql b/install/menu-en.sql index 4bcd8a4d2b..71fa82f4c7 100644 --- a/install/menu-en.sql +++ b/install/menu-en.sql @@ -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öschen','Löschen Sie hierrüber E-Mails (sowohl Bonus- als auch Normal-Mails) aus Ihrem Mailtausch-System. Nur bei Normal-Mails: {?POINTS?} aus den unbestätigten Mails werden dem Werber wieder vergütet.','7'); -INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('misc','updates','Updates prüfen','Prüft, ob eine neue Version oder ein Patch auf dem Server exisitiert. Sie mü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öschen usw.','8'); INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','stats','Statistiken','7','Y','N');