From: Roland Häder <roland@mxchange.org>
Date: Tue, 20 Jul 2010 23:53:02 +0000 (+0000)
Subject: Now non-productive extensions cant be quick-registered any longer (but still installa... 
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ad6b1626cb65625166344063a3bb849029bed920;p=mailer.git

Now non-productive extensions cant be quick-registered any longer (but still installable through 'execute' button)
---

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 <span class=\"data\">%s</span> 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 <span class=\"data\">%s</span> Erweiterungen aus Ihrem {?mt_word?} entfernt.",
 	'ADMIN_WARNING_SQL_PATCHES_MISSING' => "Eine essentielle Erweiterung <span=\"data\">sql_patches</span> 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&auml;hlte Erweiterung <span=\"data\">%s</span> ist noch nicht f&uuml;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&auml;ge gefunden.",
 	'DEBUG_REPORT_BUG_SUBJECT' => "[BUG!] Es wurde ein Bug im Script erkannt:",
 	'ADMIN_EXTENSION_ALWAYS_ACTIVE' => "Die Erweiterung <span class=\"data\">%s</span> 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 @@
+<tr>
+	<td class="{%template,ColorSwitch%} bottom right" align="center">
+		<input type="checkbox" class="admin_normal" title="{--ID_SELECT--} $content[id]" name="sel[$content[id]]" value="1" />
+	</td>
+	<td class="{%template,ColorSwitch%} bottom right" align="center">
+		{%pipe,generateAdminLink=$content[assigned_admin]%}
+	</td>
+	<td class="{%template,ColorSwitch%} bottom right" align="center">
+		<em style="cursor:help" class="admin_note" title="{--ADMIN_EXTENSION_IS_NON_PRODUCTIVE_LINK_TITLE--}">{--ADMIN_EXTENSION_IS_NON_PRODUCTIVE_LINK--}</em>
+	</td>
+	<td class="{%template,ColorSwitch%} bottom right" align="center">
+		{%pipe,fixEmptyContentToDashes=$content[infos]%}
+	</td>
+	<td class="{%template,ColorSwitch%} bottom right" align="center">
+		$content[userid]
+	</td>
+	<td class="{%template,ColorSwitch%} bottom right" align="center">
+		$content[task_type_msg]
+	</td>
+	<td class="{%template,ColorSwitch%} bottom" align="center">
+		$content[task_created]
+	</td>
+</tr>