From c43f0841702583774a712d8913bbb92b37dbb10e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 13 Dec 2008 02:12:56 +0000 Subject: [PATCH] Automatic deactivation of deprecated extensions added --- .gitattributes | 3 + inc/databases.php | 2 +- inc/extensions.php | 148 ++++++++++++++---- inc/extensions/ext-yoomedia.php | 7 +- inc/language/de.php | 12 +- inc/load_extensions.php | 3 +- inc/modules/admin/overview-inc.php | 20 +-- inc/modules/admin/what-extensions.php | 67 ++++---- inc/mysql-manager.php | 52 ------ .../de/emails/admin/admin_ext_deactivated.tpl | 10 ++ templates/de/html/admin/admin_extensions.tpl | 33 ++-- .../de/html/admin/admin_extensions_row.tpl | 3 - templates/de/html/task/.htaccess | 1 + .../de/html/task/task_ext_deactivated.tpl | 6 + 14 files changed, 218 insertions(+), 149 deletions(-) create mode 100644 templates/de/emails/admin/admin_ext_deactivated.tpl create mode 100644 templates/de/html/task/.htaccess create mode 100644 templates/de/html/task/task_ext_deactivated.tpl diff --git a/.gitattributes b/.gitattributes index 0e1a50061c..2ac9cc3e6c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -636,6 +636,7 @@ templates/de/emails/admin/admin_autopurge_turbo.tpl -text templates/de/emails/admin/admin_autopurge_unconfirmed.tpl -text templates/de/emails/admin/admin_del_surfbar_urls.tpl -text templates/de/emails/admin/admin_edit_surfbar_urls.tpl -text +templates/de/emails/admin/admin_ext_deactivated.tpl -text templates/de/emails/admin/admin_holiday_deactivated.tpl -text templates/de/emails/admin/admin_holiday_request.tpl -text templates/de/emails/admin/admin_holiday_unlock.tpl -text @@ -1495,6 +1496,8 @@ templates/de/html/surfbar/surfbar_frame_top.tpl -text templates/de/html/surfbar/surfbar_frameset.tpl -text templates/de/html/surfbar/surfbar_start_banner.tpl -text templates/de/html/surfbar/surfbar_stopped.tpl -text +templates/de/html/task/.htaccess -text +templates/de/html/task/task_ext_deactivated.tpl -text templates/de/html/theme_one.tpl -text templates/de/html/theme_select_box.tpl -text templates/de/html/theme_select_form.tpl -text diff --git a/inc/databases.php b/inc/databases.php index df2403e1c7..d2292ed10f 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -114,7 +114,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // Current SVN revision -define('CURR_SVN_REVISION', "625"); +define('CURR_SVN_REVISION', "626"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/extensions.php b/inc/extensions.php index 0063ac0997..68f89a1954 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -37,8 +37,8 @@ if (!defined('__SECURITY')) { require($INC); } -// Load the extension and maybe found language and function files -function LOAD_EXTENSION ($ext_name) { +// Load the extension and maybe found language and function files. +function LOAD_EXTENSION ($ext_name, $EXT_LOAD_MODE = "") { global $EXT_LOADED, $_CONFIG, $CSS, $cacheMode; // Is the extension already loaded? @@ -81,13 +81,22 @@ function LOAD_EXTENSION ($ext_name) { require($funcsInclude); } // END - if - // Set extension load mode to nothing (default) - $EXT_LOAD_MODE = ""; + // Extensions are not deprecated by default + $EXT_DEPRECATED = "N"; // Include the extension file //* DEBUG: */ echo "Extension loaded.
\n"; require($extInclude); + // Is this extension deprecated? + if ($EXT_DEPRECATED == "Y") { + // Deactivate the extension + DEACTIVATE_EXTENSION($ext_name); + + // Abort here + return false; + } // END - if + // Mark it as loaded $EXT_LOADED[$ext_name] = true; @@ -267,7 +276,7 @@ function EXTENSION_REGISTER ($ext_name, $id, $dry_run=false) { } // END - if // Register extension - $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_extensions (ext_name, ext_active, ext_version) VALUES ('%s','%s','%s','%s')", + $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_extensions (ext_name, ext_active, ext_version) VALUES ('%s','%s','%s')", array($ext_name, $EXT_ALWAYS_ACTIVE, $EXT_VERSION), __FILE__, __LINE__); // Update task management @@ -478,8 +487,7 @@ function GET_EXT_VERSION ($ext_name) { return $ret; } // -function EXTENSION_UPDATE($file, $ext, $EXT_VER, $dry_run=false) -{ +function EXTENSION_UPDATE($file, $ext, $EXT_VER, $dry_run=false) { // This shall never do a non-admin user! global $cacheInstance, $_CONFIG, $NOTES; @@ -501,15 +509,13 @@ function EXTENSION_UPDATE($file, $ext, $EXT_VER, $dry_run=false) } // Check if version is updated - if ((($EXT_VERSION != $EXT_VER) || ($dry_run)) && (is_array($EXT_VER_HISTORY))) - { + if ((($EXT_VERSION != $EXT_VER) || ($dry_run)) && (is_array($EXT_VER_HISTORY))) { // Search for starting point $start = array_search($EXT_VER, $EXT_VER_HISTORY); $NOTES = ""; // And load SQL queries in order of version history - for ($idx = ($start + 1); $idx < sizeof($EXT_VER_HISTORY); $idx++) - { + for ($idx = ($start + 1); $idx < sizeof($EXT_VER_HISTORY); $idx++) { // Remove old SQLs array to prevent possible bugs if (!$dry_run) { unset($SQLs); $SQLs = array(); } @@ -520,25 +526,19 @@ function EXTENSION_UPDATE($file, $ext, $EXT_VER, $dry_run=false) include(PATH."inc/extensions/".$file); // Add notes - if ($_CONFIG['verbose_sql'] == "Y") - { + if ($_CONFIG['verbose_sql'] == "Y") { $EXT_VER = $EXT_VER_HISTORY[$idx]; - if (!empty($UPDATE_NOTES)) - { + if (!empty($UPDATE_NOTES)) { // Update notes found $NOTES .= "v".$EXT_VER.":
".$UPDATE_NOTES."

\n"; $UPDATE_NOTES = ""; - } - elseif ($EXT_VER == "0.0") - { + } elseif ($EXT_VER == "0.0") { // Initial release $NOTES .= "v".$EXT_VER.":
".INITIAL_RELEASE."

\n"; - } - else - { + } else { $NOTES .= "v".$EXT_VER.":
".NO_UPDATE_NOTES."

\n"; } - } + } // END - if // In real-mode execute any existing includes if ((!$dry_run) && (count($INC_POOL) > 0)) { @@ -570,10 +570,9 @@ function EXTENSION_UPDATE($file, $ext, $EXT_VER, $dry_run=false) // Remove SQLs if extension is not installed $SQLs = array(); } - } + } // END - for - if (!$dry_run) - { + if (!$dry_run) { // In normal mode insert task and update extension's version... $ext_subj = "[UPDATE-".$ext."-".$EXT_VERSION.":] ".ADMIN_UPDATE_EXT_SUBJ; @@ -682,7 +681,7 @@ function GET_EXT_ID($name) { } elseif (!EXT_IS_ACTIVE("cache")) { // Load from database $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1", - array($name), __FILE__, __LINE__); + array($name), __FILE__, __LINE__); list($ret) = SQL_FETCHROW($result); SQL_FREERESULT($result); } @@ -692,7 +691,7 @@ function GET_EXT_ID($name) { } // Activate given extension -function ACTIVATE_EXTENSION($ext_name) { +function ACTIVATE_EXTENSION ($ext_name) { // Activate the extension $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_active='Y' WHERE ext_name='%s' LIMIT 1", array($ext_name), __FILE__, __LINE__); @@ -704,6 +703,25 @@ function ACTIVATE_EXTENSION($ext_name) { } // END - if } +// Deactivate given extension +function DEACTIVATE_EXTENSION($ext_name) { + // Activate the extension + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_active='N' WHERE ext_name='%s' LIMIT 1", + array($ext_name), __FILE__, __LINE__); + + // Extension has been activated? + if (SQL_AFFECTEDROWS() == 1) { + // Then run all queries + EXTENSION_RUN_SQLS(GET_EXT_ID($ext_name), "deactivate"); + + // Create new task + CREATE_EXTENSION_DEACTIVATION_TASK($ext_name); + + // Notify the admin + SEND_ADMIN_NOTIFICATION(ADMIN_SUBJECT_EXTENSION_DEACTIVATED, "admin_ext_deactivated", array('ext_name' => $ext_name)); + } // END - if +} + // Checks wether the extension is older than given function EXT_VERSION_IS_OLDER ($ext_name, $ext_ver) { // Get current extension version @@ -716,5 +734,81 @@ function EXT_VERSION_IS_OLDER ($ext_name, $ext_ver) { // Now compare both and return the result return ($currVersion < $ext_ver); } + +// Creates a new task for updated extension +function CREATE_EXTENSION_UPDATE_TASK ($admin_id, $subject, $notes) { + // Check if task is not there + $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE subject='%s' LIMIT 1", + array($subject), __FILE__, __LINE__); + if (SQL_NUMROWS($result) == 0) { + // Task not created so it's a brand-new extension which we need to register and create a task for! + $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, userid, status, task_type, subject, text, task_created) VALUES ('%s','0','NEW','EXTENSION_UPDATE','%s','%s', UNIX_TIMESTAMP())", + array($admin_id, $subject, $notes), __FILE__, __LINE__); + } // END - if + + // Free memory + SQL_FREERESULT($result); +} + +// Creates a new task for newly installed extension +function CREATE_NEW_EXTENSION_TASK ($admin_id, $subject, $ext) { + // Not installed and do we have created a task for the admin? + $result = SQL_QUERY_ESC("SELECT `id` FROM `"._MYSQL_PREFIX."_task_system` WHERE `subject` LIKE '%s%%' LIMIT 1", + array($subject), __FILE__, __LINE__); + if ((SQL_NUMROWS($result) == 0) && (GET_EXT_VERSION($ext) == "")) { + // Template file + $tpl = sprintf("%stemplates/%s/html/ext/ext_%s.tpl", + PATH, + GET_LANGUAGE(), + $ext + ); + + // Load text for task + if (FILE_READABLE($tpl)) { + // Load extension's own text template (HTML!) + $msg = LOAD_TEMPLATE("ext_".$ext, true); + } else { + // Load default message + $msg = LOAD_TEMPLATE("admin_new_ext", "", 0); + } + + // Task not created so it's a brand-new extension which we need to register and create a task for! + $result_insert = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, userid, status, task_type, subject, text, task_created) +VALUES (%s,0,'NEW','EXTENSION','%s','%s',UNIX_TIMESTAMP())", + array( + $admin_id, + $subject, + addslashes($msg), + ), __FILE__, __LINE__, true, false + ); + } // END - if + + // Free memory + SQL_FREERESULT($result); +} + +// Creates a task for automatically deactivated (deprecated) extension +function CREATE_EXTENSION_DEACTIVATION_TASK ($ext) { + // Create subject line + $subject = sprintf("[%s:] %s", $ext, TASK_SUBJ_EXTENSION_DEACTIVATED); + + // Not installed and do we have created a task for the admin? + $result = SQL_QUERY_ESC("SELECT `id` FROM `"._MYSQL_PREFIX."_task_system` WHERE `subject` = '%s' LIMIT 1", + array($subject), __FILE__, __LINE__); + if ((SQL_NUMROWS($result) == 0) && (GET_EXT_VERSION($ext) != "")) { + // Task not created so add it + $result_insert = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, userid, status, task_type, subject, text, task_created) +VALUES (0,0,'NEW','EXTENSION_DEACTIVATION','%s','%s',UNIX_TIMESTAMP())", + array( + $subject, + addslashes(LOAD_TEMPLATE("task_ext_deactivated", true, $ext)), + ), __FILE__, __LINE__, true, false + ); + } // END - if + + // Free memory + SQL_FREERESULT($result); +} + // ?> diff --git a/inc/extensions/ext-yoomedia.php b/inc/extensions/ext-yoomedia.php index 92c7cb5c20..4fad3694a8 100644 --- a/inc/extensions/ext-yoomedia.php +++ b/inc/extensions/ext-yoomedia.php @@ -47,11 +47,8 @@ if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION; // Version history array (add more with , "0.1" and so on) $EXT_VER_HISTORY = array("0.0"); -/* -print "
";
-debug_print_backtrace();
-print "
";
-*/
+// This extension is deprecated!
+$EXT_DEPRECATED = "Y";
 
 switch ($EXT_LOAD_MODE)
 {
diff --git a/inc/language/de.php b/inc/language/de.php
index 592553fc82..cdede86176 100644
--- a/inc/language/de.php
+++ b/inc/language/de.php
@@ -709,7 +709,6 @@ define('ADMIN_MEMBER_UID', "ID des Mitgliedes");
 define('ADMIN_TASK_TYPE', "Aufgabenbereich");
 define('ADMIN_TASK_CREATED', "Task erstellt");
 define('ADMIN_NO_ADMIN_ASSIGNED', "Kein Admin-Login zugewiesen!");
-define('ADMIN_TASK_IS_MEMBER_SUPPORT', "Support-Anfrage eines Mitgliedes");
 define('ADMIN_UNKNOWN_TASK_TYPE_1', "Unbekannter Task-Typ ");
 define('ADMIN_UNKNOWN_TASK_TYPE_2', " im Task ");
 define('ADMIN_UNKNOWN_TASK_TYPE_3', " erkannt!");
@@ -761,7 +760,6 @@ $MONTH_DESCR = array(
 );
 //
 define('ADMIN_IS_SYSTEM_TASK', "System-Task");
-define('ADMIN_TASK_IS_EXTENSION', "Erweiterung-Management");
 define('ADMIN_NEW_EXT_SUBJ', "Neue Erweiterung gefunden");
 define('ADMIN_TASK_SUBJECT', "Aufgabenbetreff");
 define('ADMIN_TASK_TEXT', "Aufgabentext");
@@ -773,6 +771,7 @@ define('ADMIN_REG_FAILED_ID_404', "Registrierung fehlgeschlagen: Erweiterung-ID
 define('ADMIN_REG_FAILED_404', "Registrierung fehlgeschlagen: Erweiterung nicht auffindbar!");
 define('ADMIN_REG_FAILED_ASSIGED', "Registrierung fehlgeschlagen: Sie sind nicht zugewiesen oder Task ist veraltet!");
 define('ADMIN_REG_FAILED_ALREADY', "Registrierung fehlgeschlagen: Erweiterun bereits installiert.");
+define('ADMIN_REG_FAILED_DEPRECATED', "Registrierung fehlgeschlagen: Erweiterung ist veraltet.");
 define('ADMIN_NO_EXTENSION_REGISTERED', "Derzeit haben Sie keine Erweiterung in Ihrem {!MT_WORD!} registriert.");
 define('ADMIN_EXTENSION_REGISTERED', "Erweiterung wurde in Ihrem {!MT_WORD!} registriert.");
 define('ADMIN_EXT_ALREADY_REGISTERED', "Erweiterung bereits registriert!");
@@ -818,7 +817,6 @@ define('ADMIN_EXT_ALREADY_INSTALLED_1', "Alle ");
 define('ADMIN_EXT_ALREADY_INSTALLED_2', " gefundenen Erweiterungen sind bereits installiert!");
 define('ADMIN_EXT_NOTHING_FOUND', "Keine Erweiterungen auf dem Server gefunden!");
 define('ADMIN_EXT_VERSION', "Version");
-define('ADMIN_TASK_IS_EXTENSION_UPDATE', "Erweiterung-Update");
 define('ADMIN_EXTENSION_UPDATED', "Erweiterung aktualisiert!");
 define('ADMIN_UPDATE_EXT_SUBJ', "Erweiterung-Update installiert");
 define('MEMBER_ORDER_PAGE1_INTRO', "Mailbuchung - Schritt 1 von 4: PLZ eingeben");
@@ -1194,6 +1192,8 @@ define('LOCK_TIMESTAMP', "Sperrzeitpunkt");
 define('EXTENSION', "Erweiterung");
 define('MOD_REWRITE_ERROR', "Sie müssen mod_rewrite in Apache aktiviert haben um die Erweiterung rewrite nutzen zu können.");
 define('ADMIN_BUILD_STATUS_HANDLER', "Status-Handler");
+define('TASK_SUBJ_EXTENSION_DEACTIVATED', "Erweiterung deaktiviert");
+define('ADMIN_SUBJECT_EXTENSION_DEACTIVATED', "Automatische Deaktivierung einer Erweiterung");
 
 define('MEMBER_MAIL_BONUS_CONFIRMED_ON', "Sie haben diese Bonusmail %s bestätigt.");
 define('MEMBER_MAIL_NORMAL_CONFIRMED_ON', "Sie haben diese Klickmail %s bestätigt.");
@@ -1227,5 +1227,11 @@ define('ADMIN_LIST_STATUS_LOCKED_ACCOUNTS', "Alle gesperrten Mitglieder-Accounts
 define('ADMIN_LIST_STATUS_CONFIRMED_ACCOUNTS', "Alle bestätigten Mitglieder-Accounts auflisten");
 define('ADMIN_LIST_MODE_NOREFS_ACCOUNTS', "Alle Mitglieder-Accounts ohne Referrals auflisten");
 
+// Admin task lines
+define('ADMIN_TASK_IS_MEMBER_SUPPORT', "Support-Anfrage eines Mitgliedes");
+define('ADMIN_TASK_IS_EXTENSION', "Erweiterung-Management");
+define('ADMIN_TASK_IS_EXTENSION_UPDATE', "Erweiterung-Update");
+define('ADMIN_TASK_IS_EXTENSION_DEACTIVATION', "Erweiterung-Management");
+
 //
 ?>
diff --git a/inc/load_extensions.php b/inc/load_extensions.php
index 166aab7a83..fbc9d61047 100644
--- a/inc/load_extensions.php
+++ b/inc/load_extensions.php
@@ -94,7 +94,8 @@ if ($cacheMode == "load") {
 		// Cache file is damaged so kill it
 		$cacheInstance->destroyCacheFile();
 
-		// Skip any further execution
+		// Retry it
+		require(__FILE__);
 		return;
 	} // END -  if
 
diff --git a/inc/modules/admin/overview-inc.php b/inc/modules/admin/overview-inc.php
index cfbd6efc5f..9e1e3193cb 100644
--- a/inc/modules/admin/overview-inc.php
+++ b/inc/modules/admin/overview-inc.php
@@ -42,7 +42,7 @@ function OUTPUT_STANDARD_OVERVIEW(&$result_tasks) {
 
 	// First check for solved and not assigned tasks and assign them to current admin
 	$result_task = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET assigned_admin='%s' WHERE assigned_admin < 1 AND status != 'NEW'",
-	 array(GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
+		array(GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
 
 	// We currently don't want to install an extension so let's find out if we need...
 	$EXT_LOAD_MODE = "register";
@@ -74,7 +74,7 @@ function OUTPUT_STANDARD_OVERVIEW(&$result_tasks) {
 			} elseif (!EXT_IS_ACTIVE("cache")) {
 				// Load data from database
 				$result = SQL_QUERY_ESC("SELECT id, ext_version FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
-				 array($ext), __FILE__, __LINE__);
+					array($ext), __FILE__, __LINE__);
 			}
 
 			// Is the extension not yet installed?
@@ -82,11 +82,11 @@ function OUTPUT_STANDARD_OVERVIEW(&$result_tasks) {
 				// Generate subject line
 				$ext_subj = sprintf("[%s:]", $ext);
 
-				// Create a task for newly installed extension
-				CREATE_NEW_EXTENSION_TASK(GET_ADMIN_ID(get_session('admin_login')), $ext_subj, $ext);
-
 				// We maybe want to install an extension so let's test-drive it...
-				include(PATH."inc/extensions/".$file);
+				if (LOAD_EXTENSION($ext, $EXT_LOAD_MODE)) {
+					// Create a task for newly installed extension
+					CREATE_NEW_EXTENSION_TASK(GET_ADMIN_ID(get_session('admin_login')), $ext_subj, $ext);
+				} // END - if
 			} else {
 				// Maybe we want to update?
 				if ((empty($cacheArray['extensions']['ext_version'][$ext])) && (SQL_NUMROWS($result) == 1)) {
@@ -117,7 +117,7 @@ function OUTPUT_STANDARD_OVERVIEW(&$result_tasks) {
 FROM "._MYSQL_PREFIX."_task_system
 WHERE assigned_admin='%s' OR (assigned_admin='0' AND status='NEW')
 ORDER BY userid DESC, task_type DESC, subject, task_created DESC",
-	 array(GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
+		array(GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
 
 	if (SQL_NUMROWS($result_tasks) > 0) {
 		// New jobs found!
@@ -139,7 +139,7 @@ function OUTPUT_SELECTED_TASKS($_POST, $result_tasks) {
 		$OUT = ""; $SW = 2;
 		foreach ($_POST['task'] as $id => $sel) {
 			$result_task = SQL_QUERY_ESC("SELECT id, userid, task_type, subject, text, task_created, status, assigned_admin FROM "._MYSQL_PREFIX."_task_system WHERE id=%s AND (assigned_admin='%s' OR (assigned_admin='0' AND status='NEW')) LIMIT 1",
-			 array(bigintval($id), GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
+				array(bigintval($id), GET_ADMIN_ID(get_session('admin_login'))), __FILE__, __LINE__);
 			if (SQL_NUMROWS($result_task) == 1) {
 				// Task is valid...
 				list($tid, $uid, $type, $subj, $text, $created, $status, $aid) = SQL_FETCHROW($result_task);
@@ -148,7 +148,7 @@ function OUTPUT_SELECTED_TASKS($_POST, $result_tasks) {
 				if ($aid == "0") {
 					// Assgin current admin to unassgigned task
 					$result_assign = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET assigned_admin='%s' WHERE id=%s LIMIT 1",
-					 array(GET_ADMIN_ID(get_session('admin_login')), bigintval($tid)), __FILE__, __LINE__);
+						array(GET_ADMIN_ID(get_session('admin_login')), bigintval($tid)), __FILE__, __LINE__);
 				} // END - if
 
 				$ADD = "";
@@ -191,7 +191,7 @@ function OUTPUT_SELECTED_TASKS($_POST, $result_tasks) {
 						// Set title
 						$title = ADMIN_SQLS_EXECUTED_ON_REGISTER;
 					} elseif ($type == "EXTENSION_UPDATE") {
-						// Load SQL commands for update (already done!)
+						// Prepare extension name and version
 						$ext_name = substr($ext_name, 7);
 						$ext_name = substr($ext_name, 0, strpos($ext_name, "-"));
 						$test = "[UPDATE-".$ext_name."-";
diff --git a/inc/modules/admin/what-extensions.php b/inc/modules/admin/what-extensions.php
index b8a940ff95..d75af2b14c 100644
--- a/inc/modules/admin/what-extensions.php
+++ b/inc/modules/admin/what-extensions.php
@@ -228,13 +228,13 @@ switch ($do) {
 case "overview": // List all registered extensions
 	if (GET_EXT_VERSION("sql_patches") >= "0.0.6") {
 		// Load extension data with CSS informations
-		$result = SQL_QUERY("SELECT id, ext_name, ext_active, ext_has_css, ext_version
+		$result = SQL_QUERY("SELECT id AS ext_id, ext_name, ext_active, ext_has_css AS ext_css, ext_version
 FROM "._MYSQL_PREFIX."_extensions
 ".$where."
 ORDER BY ext_name", __FILE__, __LINE__);
 	} else {
 		// Load extension data without CSS informations
-		$result = SQL_QUERY("SELECT id, ext_name, ext_active, id, ext_version
+		$result = SQL_QUERY("SELECT id AS ext_id, ext_name, ext_active, id, ext_version
 FROM "._MYSQL_PREFIX."_extensions
 ".$where."
 ORDER BY ext_name", __FILE__, __LINE__);
@@ -244,20 +244,19 @@ ORDER BY ext_name", __FILE__, __LINE__);
 	if (SQL_NUMROWS($result) > 0) {
 		// Extensions are registered
 		$SW = 2; $OUT = "";
-		while (list($id, $name, $lang, $active, $css, $ver) = SQL_FETCHROW($result)) {
+		while ($content = SQL_FETCHARRAY($result)) {
 			$CSS = "---";
-			if (GET_EXT_VERSION("sql_patches") >= "0.0.6") $CSS = TRANSLATE_YESNO($css);
+			if (GET_EXT_VERSION("sql_patches") >= "0.0.6") $CSS = TRANSLATE_YESNO($content['ext_css']);
 
 			// Prepare data for the row template
 			$content = array(
 				'sw'      => $SW,
-				'id'      => $id,
-				'name'    => $name,
-				'active'  => TRANSLATE_YESNO($active),
-				'act_val' => $active,
-				'lang'    => $lang,
+				'id'      => $content['ext_id'],
+				'name'    => $content['ext_name'],
+				'active'  => TRANSLATE_YESNO($content['ext_active']),
+				'act_val' => $content['ext_active'],
 				'css'     => $CSS,
-				'ver'     => $ver,
+				'ver'     => $content['ext_version'],
 			);
 
 			// Load row template and switch color
@@ -281,7 +280,7 @@ ORDER BY ext_name", __FILE__, __LINE__);
 
 case "register": // Register new extension
 	$result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE assigned_admin='%s' AND task_type='EXTENSION' LIMIT 1",
-	 array(bigintval(GET_ADMIN_ID(get_session('admin_login')))), __FILE__, __LINE__);
+		array(bigintval(GET_ADMIN_ID(get_session('admin_login')))), __FILE__, __LINE__);
 	$task_found = SQL_NUMROWS($result);
 
 	// Free result
@@ -291,7 +290,7 @@ case "register": // Register new extension
 	if (($id > 0) && ($task_found == 1)) {
 		// ID is valid so begin with registration, we first want to it's real name from task management (subject column)
 		$result = SQL_QUERY_ESC("SELECT subject FROM "._MYSQL_PREFIX."_task_system WHERE id=%s LIMIT 1",
-		 array(bigintval($id)), __FILE__, __LINE__);
+			array(bigintval($id)), __FILE__, __LINE__);
 		list($subj) = SQL_FETCHROW($result);
 		SQL_FREERESULT($result);
 
@@ -301,25 +300,35 @@ case "register": // Register new extension
 			// Extract extension's name from subject...
 			$ext_name = trim(substr($subj, 1, strpos($subj, ":") - 1));
 
-			// ... so we can finally register and load it in registration mode
-			$status = EXTENSION_REGISTER($ext_name, $id);
-			if ($status == true) {
-				// Extension was found and successfully registered
-				LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_EXTENSION_REGISTERED);
-
-				// Do we need to update cache file?
-				if ((EXT_IS_ACTIVE("cache")) && ($cacheMode != "no")) {
-					// Remove cache file (will be auto-created again!)
-					if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile();
-					if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
-					if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
-				} // END - if
-			} elseif (GET_EXT_VERSION($ext_name) != "") {
-				// Motify the admin that we have a problem here...
-				LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_REG_FAILED_ALREADY);
+			// Test the extension for deprecation
+			$EXT_DEPRECATED = "N"; $EXT_LOAD_MODE = "";
+			include(PATH."inc/extensions/ext-".$ext_name.".php");
+
+			// Is the extension deprecated?
+			if ($EXT_DEPRECATED == "N") {
+				// ... so we can finally register and load it in registration mode
+				$status = EXTENSION_REGISTER($ext_name, $id);
+				if ($status == true) {
+					// Extension was found and successfully registered
+					LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_EXTENSION_REGISTERED);
+
+					// Do we need to update cache file?
+					if ((EXT_IS_ACTIVE("cache")) && ($cacheMode != "no")) {
+						// Remove cache file (will be auto-created again!)
+						if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile();
+						if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
+						if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
+					} // END - if
+				} elseif (GET_EXT_VERSION($ext_name) != "") {
+					// Notify the admin that we have a problem here...
+					LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_REG_FAILED_ALREADY);
+				} else {
+					// Notify the admin that we have a problem here...
+					LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_REG_FAILED_404);
+				}
 			} else {
 				// Motify the admin that we have a problem here...
-				LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_REG_FAILED_404);
+				LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_REG_FAILED_DEPRECATED);
 			}
 		} else {
 			// Extension was not found in task management
diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php
index 39a7f86b4d..39da8f2203 100644
--- a/inc/mysql-manager.php
+++ b/inc/mysql-manager.php
@@ -1909,58 +1909,6 @@ function UPDATE_CONFIG ($entries, $values, $updateMode="") {
 	REBUILD_CACHE("config", "config");
 }
 
-// Creates a new task for updated extension
-function CREATE_EXTENSION_UPDATE_TASK ($admin_id, $subject, $notes) {
-	// Check if task is not there
-	$result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE subject='%s' LIMIT 1",
-		array($subject), __FILE__, __LINE__);
-	if (SQL_NUMROWS($result) == 0) {
-		// Task not created so it's a brand-new extension which we need to register and create a task for!
-		$result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, userid, status, task_type, subject, text, task_created) VALUES ('%s','0','NEW','EXTENSION_UPDATE','%s','%s', UNIX_TIMESTAMP())",
-			array($admin_id, $subject, $notes), __FILE__, __LINE__);
-	} // END - if
-
-	// Free memory
-	SQL_FREERESULT($result);
-}
-
-// Creates a new task for newly installed extension
-function CREATE_NEW_EXTENSION_TASK ($admin_id, $subject, $ext) {
-	// Not installed and do we have created a task for the admin?
-	$result = SQL_QUERY_ESC("SELECT `id` FROM `"._MYSQL_PREFIX."_task_system` WHERE `subject` LIKE '%s%%' LIMIT 1",
-		array($subject), __FILE__, __LINE__);
-	if ((SQL_NUMROWS($result) == 0) && (GET_EXT_VERSION($ext) == "")) {
-		// Template file
-		$tpl = sprintf("%stemplates/%s/html/ext/ext_%s.tpl",
-			PATH,
-			GET_LANGUAGE(),
-			$ext
-		);
-
-		// Load text for task
-		if (FILE_READABLE($tpl)) {
-			// Load extension's own text template (HTML!)
-			$msg = LOAD_TEMPLATE("ext_".$ext, true);
-		} else {
-			// Load default message
-			$msg = LOAD_TEMPLATE("admin_new_ext", "", 0);
-		}
-
-		// Task not created so it's a brand-new extension which we need to register and create a task for!
-		$result_insert = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, userid, status, task_type, subject, text, task_created)
-VALUES (%s,0,'NEW','EXTENSION','%s','%s',UNIX_TIMESTAMP())",
-			array(
-				$admin_id,
-				$subject,
-				SQL_ESCAPE($msg),
-			),  __FILE__, __LINE__, true, false
-		);
-	} // END - if
-
-	// Free memory
-	SQL_FREERESULT($result);
-}
-
 // Prepares an SQL statement part for HTML mail and/or holiday depency
 function PREPARE_SQL_HTML_HOLIDAY ($mode) {
 	// Exclude no users by default
diff --git a/templates/de/emails/admin/admin_ext_deactivated.tpl b/templates/de/emails/admin/admin_ext_deactivated.tpl
new file mode 100644
index 0000000000..bb4f120ae2
--- /dev/null
+++ b/templates/de/emails/admin/admin_ext_deactivated.tpl
@@ -0,0 +1,10 @@
+{--HELLO_ADMIN--},
+
+es wurde soeben die Erweiterung $content[ext_name] automatisch deaktiviert, da sie als veraltet markiert ist.
+
+Bitte deinstallieren Sie bald diese Erweiterung. Sie wird von mxchange.org nicht mehr unterstützt.
+
+Mit freundlichem Gruss,
+  Ihr {!MAIN_TITLE!} Team
+
+{!URL!}/login.php ({!WEBMASTER!})
diff --git a/templates/de/html/admin/admin_extensions.tpl b/templates/de/html/admin/admin_extensions.tpl
index 37d1690737..ecb48420aa 100644
--- a/templates/de/html/admin/admin_extensions.tpl
+++ b/templates/de/html/admin/admin_extensions.tpl
@@ -1,28 +1,25 @@
-
- + +
- - - - - - - + + + + + {!__EXT_ROWS!} - +
{--ADMIN_REGISTERED_EXTENSIONS--} + + {--ADMIN_REGISTERED_EXTENSIONS--}
{--ID_SELECT--}{--ADMIN_EXT_NAME--}{--ADMIN_EXT_LANG--}{--ADMIN_EXT_CSSFILE--}{--ADMIN_EXT_ACTIVE--}{--ADMIN_EXT_VERSION--}{--ID_SELECT--}{--ADMIN_EXT_NAME--}{--ADMIN_EXT_CSSFILE--}{--ADMIN_EXT_ACTIVE--}{--ADMIN_EXT_VERSION--}
diff --git a/templates/de/html/admin/admin_extensions_row.tpl b/templates/de/html/admin/admin_extensions_row.tpl index d8b98cb15d..f5a02140c7 100644 --- a/templates/de/html/admin/admin_extensions_row.tpl +++ b/templates/de/html/admin/admin_extensions_row.tpl @@ -5,9 +5,6 @@   $content[name] - -   $content[lang] - $content[css] diff --git a/templates/de/html/task/.htaccess b/templates/de/html/task/.htaccess new file mode 100644 index 0000000000..03688ee918 --- /dev/null +++ b/templates/de/html/task/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/templates/de/html/task/task_ext_deactivated.tpl b/templates/de/html/task/task_ext_deactivated.tpl new file mode 100644 index 0000000000..1c07db6649 --- /dev/null +++ b/templates/de/html/task/task_ext_deactivated.tpl @@ -0,0 +1,6 @@ +Es wurde die Erweiterung $content in Ihrem {!MT_WORD!} +automatisch deaktiviert, da sie veraltet ist und bald von mxchange.org nicht +mehr unterstützt wird. Bitte schauen Sie in den +Forenankündigungen nach, ob bereits ein Eintrag zu der deaktivierten +Erweiterung existiert. Dort sollte immer eine Ersatzerweiterung angegeben sein. -- 2.39.2