]> git.mxchange.org Git - mailer.git/commitdiff
Automatic deactivation of deprecated extensions added
authorRoland Häder <roland@mxchange.org>
Sat, 13 Dec 2008 02:12:56 +0000 (02:12 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 13 Dec 2008 02:12:56 +0000 (02:12 +0000)
14 files changed:
.gitattributes
inc/databases.php
inc/extensions.php
inc/extensions/ext-yoomedia.php
inc/language/de.php
inc/load_extensions.php
inc/modules/admin/overview-inc.php
inc/modules/admin/what-extensions.php
inc/mysql-manager.php
templates/de/emails/admin/admin_ext_deactivated.tpl [new file with mode: 0644]
templates/de/html/admin/admin_extensions.tpl
templates/de/html/admin/admin_extensions_row.tpl
templates/de/html/task/.htaccess [new file with mode: 0644]
templates/de/html/task/task_ext_deactivated.tpl [new file with mode: 0644]

index 0e1a50061c984737aa1d375afeee5ca5229c0741..2ac9cc3e6cf60852ae59485108be77871c8694a3 100644 (file)
@@ -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
index df2403e1c74cd4bb68e0f15362907526b660903f..d2292ed10f7dce6d91b2cc648506ec38ec88f2ac 100644 (file)
@@ -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);
index 0063ac099786760e5be62c34ecc80122314d61a3..68f89a1954b3e8689e59ace083a41de4d71f5117 100644 (file)
@@ -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.<br />\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 .= "<STRONG>v".$EXT_VER.":</STRONG><br />".$UPDATE_NOTES."<br /><br />\n";
                                        $UPDATE_NOTES = "";
-                               }
-                                elseif ($EXT_VER == "0.0")
-                               {
+                               } elseif ($EXT_VER == "0.0") {
                                        // Initial release
                                        $NOTES .= "<STRONG>v".$EXT_VER.":</STRONG><br />".INITIAL_RELEASE."<br /><br />\n";
-                               }
-                                else
-                               {
+                               } else {
                                        $NOTES .= "<STRONG>v".$EXT_VER.":</STRONG><br /><I>".NO_UPDATE_NOTES."</I><br /><br />\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);
+}
+
 //
 ?>
index 92c7cb5c20d6e3ec9215cf034549d8365e579c81..4fad3694a8bd508eebc9c77ca16779104be0ffc1 100644 (file)
@@ -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 "<pre>";
-debug_print_backtrace();
-print "<pre>";
-*/
+// This extension is deprecated!
+$EXT_DEPRECATED = "Y";
 
 switch ($EXT_LOAD_MODE)
 {
index 592553fc82a26c5a2aac4846c5e22e90ee8d42f0..cdede861769763078cd90b2c716e7d877d3b1323 100644 (file)
@@ -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 <strong>");
 define('ADMIN_UNKNOWN_TASK_TYPE_2', "</strong> im Task <strong>");
 define('ADMIN_UNKNOWN_TASK_TYPE_3', "</strong> 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 <strong><U>");
 define('ADMIN_EXT_ALREADY_INSTALLED_2', "</U></strong> 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&uuml;ssen mod_rewrite in Apache aktiviert haben um die Erweiterung rewrite nutzen zu k&ouml;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 <span class=\"data\">%s</span> best&auml;tigt.");
 define('MEMBER_MAIL_NORMAL_CONFIRMED_ON', "Sie haben diese Klickmail <span class=\"data\">%s</span> best&auml;tigt.");
@@ -1227,5 +1227,11 @@ define('ADMIN_LIST_STATUS_LOCKED_ACCOUNTS', "Alle gesperrten Mitglieder-Accounts
 define('ADMIN_LIST_STATUS_CONFIRMED_ACCOUNTS', "Alle best&auml;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");
+
 //
 ?>
index 166aab7a833bb21a3ff1f05edb52a02c888c4832..fbc9d61047ebe46019d24b99d8a7827a28a13c2f 100644 (file)
@@ -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
 
index cfbd6efc5fcfe36926f622234d007dc4e6920133..9e1e3193cb4f071dfa3afddf9663e00e9b885cfb 100644 (file)
@@ -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."-";
index b8a940ff951ca4dc155ca4274fdb5ee4d89d1b2b..d75af2b14c8d7a5f3335d82f919f377ebcad03ca 100644 (file)
@@ -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
index 39a7f86b4d60380dca84b185cb05dfceb0db87c1..39da8f2203a27fa9d7c66a114fdc03f01bb1ecad 100644 (file)
@@ -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 (file)
index 0000000..bb4f120
--- /dev/null
@@ -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&uuml;tzt.
+
+Mit freundlichem Gruss,
+  Ihr {!MAIN_TITLE!} Team
+
+{!URL!}/login.php ({!WEBMASTER!})
index 37d169073730747fb2dfabfa0fba7f320b30b8f9..ecb48420aaaf4f6b6cff15fb49e1b76f8cabbb58 100644 (file)
@@ -1,28 +1,25 @@
-<FORM action="{!URL!}/modules.php?module=admin&amp;what=extensions"
-       method="POST" style="margin-bottom: 0px">
-<TABLE border="0" cellspacing="0" cellpadding="0" width="590"
-       align="center" class="admin_table dashed">
+<FORM action="{!URL!}/modules.php?module=admin&amp;what=extensions" method="POST" style="margin-bottom: 0px">
+<TABLE border="0" cellspacing="0" cellpadding="0" width="510" align="center" class="admin_table dashed">
        <TR>
-               <TD colspan="6" align="center" class="admin_title" height="30"><STRONG>{--ADMIN_REGISTERED_EXTENSIONS--}</STRONG>
+               <TD colspan="5" align="center" class="admin_title" height="30">
+                       <STRONG>{--ADMIN_REGISTERED_EXTENSIONS--}</STRONG>
                </TD>
        </TR>
        <TR>
-               <TD align="center" class="admin_title bottom2 right2" width="30"><STRONG>{--ID_SELECT--}</STRONG></TD>
-               <TD align="center" class="admin_title bottom2 right2" width="240"><STRONG>{--ADMIN_EXT_NAME--}</STRONG></TD>
-               <TD align="center" class="admin_title bottom2 right2" width="240"><STRONG>{--ADMIN_EXT_LANG--}</STRONG></TD>
-               <TD align="center" class="admin_title bottom2 right2" width="80"><STRONG>{--ADMIN_EXT_CSSFILE--}</STRONG></TD>
-               <TD align="center" class="admin_title bottom2 right2" width="80"><STRONG>{--ADMIN_EXT_ACTIVE--}</STRONG></TD>
-               <TD align="center" class="admin_title bottom2" width="80"><STRONG>{--ADMIN_EXT_VERSION--}</STRONG></TD>
+               <TD align="center" class="admin_title bottom2 right2" width="40"><STRONG>{--ID_SELECT--}</STRONG></TD>
+               <TD align="center" class="admin_title bottom2 right2" width="200"><STRONG>{--ADMIN_EXT_NAME--}</STRONG></TD>
+               <TD align="center" class="admin_title bottom2 right2" width="90"><STRONG>{--ADMIN_EXT_CSSFILE--}</STRONG></TD>
+               <TD align="center" class="admin_title bottom2 right2" width="90"><STRONG>{--ADMIN_EXT_ACTIVE--}</STRONG></TD>
+               <TD align="center" class="admin_title bottom2" width="90"><STRONG>{--ADMIN_EXT_VERSION--}</STRONG></TD>
        </TR>
        {!__EXT_ROWS!}
        <TR>
-               <TD colspan="6" class="admin_footer"><INPUT
-                       type="reset" class="admin_reset" value="{--UNDO_SELECTIONS--}" />
-               <INPUT type="submit" name="change" class="admin_submit"
-                       value="{--ADMIN_DE_ACTIVATE--}" /> <INPUT type="submit"
-                       name="edit" class="admin_submit" value="{--ADMIN_EDIT--}" />
-               <INPUT type="submit" name="delete" class="admin_delete"
-                       value="{--ADMIN_DELETE_ENTRIES--}" /></TD>
+               <TD colspan="5" class="admin_footer">
+                       <INPUT type="reset" class="admin_reset" value="{--UNDO_SELECTIONS--}" />
+                       <INPUT type="submit" name="change" class="admin_submit" value="{--ADMIN_DE_ACTIVATE--}" />
+                       <INPUT type="submit" name="edit" class="admin_submit" value="{--ADMIN_EDIT--}" />
+                       <INPUT type="submit" name="delete" class="admin_delete" value="{--ADMIN_DELETE_ENTRIES--}" />
+               </TD>
        </TR>
 </TABLE>
 </FORM>
index d8b98cb15dc4a8cb6a331e667657cf56b6ee0cb8..f5a02140c75c9339dc8491533f0cb65357336540 100644 (file)
@@ -5,9 +5,6 @@
        <TD class="switch_sw$content[sw] bottom2 right2">
                &nbsp;&nbsp;$content[name]
        </TD>
-       <TD class="switch_sw$content[sw] bottom2 right2">
-               &nbsp;&nbsp;$content[lang]
-       </TD>
        <TD class="switch_sw$content[sw] bottom2 right2" align="center">
                $content[css]
        </TD>
diff --git a/templates/de/html/task/.htaccess b/templates/de/html/task/.htaccess
new file mode 100644 (file)
index 0000000..03688ee
--- /dev/null
@@ -0,0 +1 @@
+Deny from all\r
diff --git a/templates/de/html/task/task_ext_deactivated.tpl b/templates/de/html/task/task_ext_deactivated.tpl
new file mode 100644 (file)
index 0000000..1c07db6
--- /dev/null
@@ -0,0 +1,6 @@
+Es wurde die Erweiterung <strong>$content</strong> in Ihrem {!MT_WORD!}
+automatisch deaktiviert, da sie veraltet ist und bald von mxchange.org nicht
+mehr unterst&uuml;tzt wird. Bitte schauen Sie in <a
+ href="" title="Direktlink zu den Forenank&uuml;ndigungen" target="_blank">den
+Forenank&uuml;ndigungen</a> nach, ob bereits ein Eintrag zu der deaktivierten
+Erweiterung existiert. Dort sollte immer eine Ersatzerweiterung angegeben sein.