From ad6b1626cb65625166344063a3bb849029bed920 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 20 Jul 2010 23:53:02 +0000 Subject: [PATCH] Now non-productive extensions cant be quick-registered any longer (but still installable through 'execute' button) --- .gitattributes | 1 + inc/extensions-functions.php | 35 +++++++++++++++++-- inc/language/de.php | 10 +++--- inc/modules/admin/overview-inc.php | 5 ++- inc/modules/admin/what-list_task.php | 5 ++- inc/wrapper-functions.php | 12 +++++++ .../html/admin/admin_list_task_ext2_rows.tpl | 23 ++++++++++++ 7 files changed, 82 insertions(+), 9 deletions(-) create mode 100644 templates/de/html/admin/admin_list_task_ext2_rows.tpl diff --git a/.gitattributes b/.gitattributes index e7b44ad04a..6f20fc49f0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1198,6 +1198,7 @@ templates/de/html/admin/admin_list_surfbar_urls.tpl -text svneol=unset#text/plai templates/de/html/admin/admin_list_surfbar_urls_row.tpl -text svneol=unset#text/plain templates/de/html/admin/admin_list_task.tpl -text svneol=unset#text/plain templates/de/html/admin/admin_list_task_delete.tpl -text svneol=unset#text/plain +templates/de/html/admin/admin_list_task_ext2_rows.tpl -text svneol=unset#text/plain templates/de/html/admin/admin_list_task_ext_rows.tpl -text svneol=unset#text/plain templates/de/html/admin/admin_list_task_rows.tpl -text svneol=unset#text/plain templates/de/html/admin/admin_list_transfer.tpl -text svneol=unset#text/plain diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index e755418acc..a7067ec005 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -58,6 +58,9 @@ function loadExtension ($ext_name, $ext_mode, $ext_ver = '', $dry_run = false) { // Set current extension name setCurrentExtensionName($ext_name); + // By default all extensions are in productive phase + enableExtensionProductive(); + if (!empty($ext_ver)) { // Set current extension version setCurrentExtensionVersion($ext_ver); @@ -1649,7 +1652,7 @@ function ifExtensionHasLanguageFile ($ext_name) { } // END - if // Put it in cache - $GLOBALS['cache_array']['extension']['ext_lang'][$ext_name] = 'Y'; + $GLOBALS['cache_array']['extension']['ext_lang'][$ext_name] = $readable; } // Return result @@ -1854,13 +1857,39 @@ function addSponsorMenuSql ($action, $what, $title, $active, $sort) { // Enables/disables productive mode for current extension (used only while // registration). function enableExtensionProductive ($isProductive = true) { + // Log debug message + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("ext_name=%s,isProductive=%d", getCurrentExtensionName(), intval($isProductive))); + + // Set it $GLOBALS['ext_productive'][getCurrentExtensionName()] = (bool) $isProductive; } // Checks wether the extension is in productive phase. If not set, development // phase (=false) is assumed. -function isExtensionProductive () { - return ((isset($GLOBALS['ext_productive'][getCurrentExtensionName()])) && ($GLOBALS['ext_productive'][getCurrentExtensionName()] === true)); +function isExtensionProductive ($ext_name = '') { + // Is the extension name empty? Then use current + if (empty($ext_name)) { + // Get current extension name + $ext_name = getCurrentExtensionName(); + } // END - if + + // Do we have cache? + if (!isset($GLOBALS['ext_is_productive'][$ext_name])) { + // Load extension only if not yet loaded + if (!isset($GLOBALS['ext_productive'][$ext_name])) { + // Load extension in test mode + loadExtension($ext_name, 'test'); + } // END - if + + // Determine it + $GLOBALS['ext_is_productive'][$ext_name] = ((isset($GLOBALS['ext_productive'][$ext_name])) && ($GLOBALS['ext_productive'][$ext_name] === true)); + } // END - if + + // Log debug message + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("ext_name=%s,isProductive=%s", $ext_name, intval($GLOBALS['ext_is_productive'][$ext_name]))); + + // Return result + return $GLOBALS['ext_is_productive'][$ext_name]; } // [EOF] diff --git a/inc/language/de.php b/inc/language/de.php index 7d6ba87703..2546dc003b 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -656,7 +656,7 @@ addMessages(array( 'ADMIN_ENTER_REDIRECT_URL' => "URL eingeben, wenn abgelehnt werden soll", 'MEMBER_NO_REFBANNER_FOUND' => "Es sind noch keine Werbebanner eingerichtet worden. Bitte verwenden Sie solange Ihren Referal-Link.", 'ADMIN_ID_404' => "ID %s nicht gefunden.", - 'ADMIN_ASSIGNED_ADMIN' => "Zugewiesener Admin-Login", + 'ADMIN_ASSIGNED_ADMIN' => "Zugewiesener Admin", 'ADMIN_MEMBER_UID' => "ID des Mitgliedes", 'ADMIN_TASK_TYPE' => "Aufgabenbereich", 'ADMIN_TASK_CREATED' => "Task erstellt", @@ -1112,6 +1112,8 @@ addMessages(array( 'ADMIN_EXTENSIONS_REMOVED' => "Es wurden %s Erweiterungen aus Ihrem {?mt_word?} entfernt.", 'ADMIN_WARNING_SQL_PATCHES_MISSING' => "Eine essentielle Erweiterung sql_patches ist noch nicht installiert. Bitte erledigen Sie dies bald, da Ihr {?mt_word?} sonst nicht funktioniert.", 'ADMIN_EXTENSION_IS_NON_PRODUCTIVE' => "Die von Ihnen ausgewählte Erweiterung %s ist noch nicht für den produktiven Betrieb freigegeben und befindet sich somit noch in der Entwicklung. Bitte nur verwenden, wenn Sie wissen, was Sie tun.", + 'ADMIN_EXTENSION_IS_NON_PRODUCTIVE_LINK' => "Enwickler-Version", + 'ADMIN_EXTENSION_IS_NON_PRODUCTIVE_LINK_TITLE' => "Diese Erweiterung sollten Sie nur installieren, wenn Sie daran mitentwickeln wollen. Produktiv ist diese nicht einsatzbereit.", 'ADMIN_ENTRIES_404' => "Es wurden keine Einträge gefunden.", 'DEBUG_REPORT_BUG_SUBJECT' => "[BUG!] Es wurde ein Bug im Script erkannt:", 'ADMIN_EXTENSION_ALWAYS_ACTIVE' => "Die Erweiterung %s kann nicht deaktiviert werden, da sie immer aktiv bleiben muss.", @@ -1154,9 +1156,9 @@ addMessages(array( // Admin task lines 'ADMIN_TASK_IS_MEMBER_SUPPORT' => "Support-Anfrage eines Mitgliedes", - 'ADMIN_TASK_IS_EXTENSION' => "Erweiterung-Management", - 'ADMIN_TASK_IS_EXTENSION_UPDATE' => "Erweiterung-Update", - 'ADMIN_TASK_IS_EXTENSION_DEACTIVATION' => "Erweiterung-Management", + 'ADMIN_TASK_IS_EXTENSION' => "Erweiterung-Installation", + 'ADMIN_TASK_IS_EXTENSION_UPDATE' => "Erweiterungsupdate", + 'ADMIN_TASK_IS_EXTENSION_DEACTIVATION' => "Erweiterung-Deaktivierung", // Filter sub-system 'FILTER_FAILED_ALREADY_INIT' => "Filter-System ist bereits initialisiert.", diff --git a/inc/modules/admin/overview-inc.php b/inc/modules/admin/overview-inc.php index e6019df0cf..62984ecaf5 100644 --- a/inc/modules/admin/overview-inc.php +++ b/inc/modules/admin/overview-inc.php @@ -447,9 +447,12 @@ LIMIT 1", $content['task_created'] = generateDateTime($content['task_created'], 2); // Do we have extension task? - if (($content['task_type'] == 'EXTENSION') && (isExtensionNameValid($content['infos'])) && (!isExtensionInstalled($content['infos']))) { + if ((isExtensionTask($content)) && (isExtensionProductive($content['infos']))) { // Load extension row template $OUT .= loadTemplate('admin_overview_list_ext_rows', true, $content); + } elseif ((isExtensionTask($content)) && (!isExtensionProductive($content['infos']))) { + // Load extension row template + $OUT .= loadTemplate('admin_overview_list_ext2_rows', true, $content); } else { // Load default row template $OUT .= loadTemplate('admin_overview_list_rows', true, $content); diff --git a/inc/modules/admin/what-list_task.php b/inc/modules/admin/what-list_task.php index f9884af24a..aba8d887a8 100644 --- a/inc/modules/admin/what-list_task.php +++ b/inc/modules/admin/what-list_task.php @@ -176,9 +176,12 @@ ORDER BY )); // Do we have an extension task? - if (($content['task_type'] == 'EXTENSION') && (isExtensionNameValid($content['infos'])) && (!isExtensionInstalled($content['infos']))) { + if ((isExtensionTask($content)) && (isExtensionProductive($content['infos']))) { // Load extension row template $OUT .= loadTemplate('admin_list_task_ext_rows', true, $content); + } elseif ((isExtensionTask($content)) && (!isExtensionProductive($content['infos']))) { + // Load extension row template + $OUT .= loadTemplate('admin_list_task_ext2_rows', true, $content); } else { // Load default row template $OUT .= loadTemplate('admin_list_task_rows', true, $content); diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 894c2f4d4e..b101e22c8f 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -1886,5 +1886,17 @@ function isDirectPaymentAllowed () { return $GLOBALS['is_direct_payment_allowed']; } +// Wrapper to check if current task is for extension (not update) +function isExtensionTask ($content) { + // Do we have cache? + if (!isset($GLOBALS['is_extension_task'][$content['task_type'] . '_' . $content['infos']])) { + // Determine it + $GLOBALS['is_extension_task'][$content['task_type'] . '_' . $content['infos']] = (($content['task_type'] == 'EXTENSION') && (isExtensionNameValid($content['infos'])) && (!isExtensionInstalled($content['infos']))); + } // END - if + + // Return cache + return $GLOBALS['is_extension_task'][$content['task_type'] . '_' . $content['infos']]; +} + // [EOF] ?> diff --git a/templates/de/html/admin/admin_list_task_ext2_rows.tpl b/templates/de/html/admin/admin_list_task_ext2_rows.tpl new file mode 100644 index 0000000000..4f2b5eef3c --- /dev/null +++ b/templates/de/html/admin/admin_list_task_ext2_rows.tpl @@ -0,0 +1,23 @@ + + + + + + {%pipe,generateAdminLink=$content[assigned_admin]%} + + + {--ADMIN_EXTENSION_IS_NON_PRODUCTIVE_LINK--} + + + {%pipe,fixEmptyContentToDashes=$content[infos]%} + + + $content[userid] + + + $content[task_type_msg] + + + $content[task_created] + + -- 2.39.5