]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-extensions.php
Bug fixed. See #106
[mailer.git] / inc / modules / admin / what-extensions.php
index 7bab8cf7d26a7867a20f1df33db9feab39675d19..6c55680ac2395048f65f52718cdec72c5cdea4d9 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Erweiterungen-Management                         *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision:: 856                                                    $ *
+ * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009)              $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author:: stelzi                                                   $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
@@ -43,7 +48,7 @@ ADD_DESCR("admin", __FILE__);
 // Normally we want the overview of all registered extensions
 $do = "overview";
 $SEL = 0;
-if (REQUEST_ISSET_POST(('sel'))) $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
+if (REQUEST_ISSET_POST('sel')) $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
 
 if (REQUEST_ISSET_GET(('reg_ext'))) {
        // We are about to register a new extension
@@ -66,7 +71,7 @@ if (REQUEST_ISSET_GET(('reg_ext'))) {
                        EXTENSION_RUN_SQLS($ext_id, $EXT_LOAD_MODE);
                }
        }
-} elseif (((REQUEST_ISSET_POST(('edit'))) || (REQUEST_ISSET_POST(('modify')))) && ($SEL > 0) && (!IS_DEMO())) {
+} elseif (((REQUEST_ISSET_POST('edit')) || (REQUEST_ISSET_POST(('modify')))) && ($SEL > 0) && (!IS_DEMO())) {
        // Change settings like CSS file load
        if (REQUEST_ISSET_POST(('modify'))) {
                // Change entries
@@ -77,9 +82,14 @@ if (REQUEST_ISSET_GET(('reg_ext'))) {
 
                        // Change this extension?
                        if ($sel == 1) {
-                               // Update extension's record
+                               // Load mode is modify
+                               $EXT_LOAD_MODE = "modify";
+
+                               // Get entry for 'active'
                                $active = REQUEST_POST('active', $ext_id);
-                               if (GET_EXT_VERSION("sql_patches") >= "0.0.6")  {
+
+                               // Update extension's record
+                               if (GET_EXT_VERSION("sql_patches") >= "0.0.6") {
                                        // Update also CSS column when extensions sql_patches is newer or exact v0.0.6
                                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_extensions` SET ext_has_css='%s', ext_active='%s' WHERE id=%s LIMIT 1",
                                                array(REQUEST_POST('css', $ext_id), $active, $ext_id), __FILE__, __LINE__);
@@ -148,10 +158,10 @@ if (REQUEST_ISSET_GET(('reg_ext'))) {
        }
 } elseif ((REQUEST_ISSET_POST(('delete'))) && ($SEL > 0) && (!IS_DEMO())) {
        // List extensions and when verbose is enabled SQL statements which will be executed
-       $SW = 2; $OUT = "";
+       $OUT = ""; $SW = 2;
        foreach (REQUEST_POST('sel') as $ext_id => $sel) {
                // Init variables
-               $VERBOSE_OUT = ""; $SQLs = array();
+               $VERBOSE_OUT = ""; INIT_SQLS();
 
                // Secure id number
                $ext_id = bigintval($ext_id);
@@ -161,9 +171,9 @@ if (REQUEST_ISSET_GET(('reg_ext'))) {
 
                if (getConfig('verbose_sql') == "Y") {
                        // Load SQL commands in remove mode
-                       if (LOAD_EXTENSION($ext_name, "remove", "", true, $SQLs)) {
+                       if (LOAD_EXTENSION($ext_name, "remove", "", true)) {
                                // Generate extra table with loaded SQL commands
-                               $VERBOSE_OUT = EXTENSION_VERBOSE_TABLE($SQLs);
+                               $VERBOSE_OUT = EXTENSION_VERBOSE_TABLE();
                        } // END - if
                } // END - if
 
@@ -195,7 +205,7 @@ if (REQUEST_ISSET_GET(('reg_ext'))) {
                // Is this extension selected?
                if ($active == 1) {
                        // Run any assigned removal filters
-                       RUN_FILTER('extension_remove', GET_EXT_NAME($ext_id));
+                       runFilterChain('extension_remove', GET_EXT_NAME($ext_id));
 
                        // Run embeded SQL commands
                        EXTENSION_RUN_SQLS($ext_id, "remove");
@@ -235,7 +245,7 @@ ORDER BY ext_name", __FILE__, __LINE__);
        // Are there some entries?
        if (SQL_NUMROWS($result) > 0) {
                // Extensions are registered
-               $SW = 2; $OUT = "";
+               $OUT = ""; $SW = 2;
                while ($content = SQL_FETCHARRAY($result)) {
                        // Prepare CSS selection output
                        $cssSelection = "---";
@@ -294,14 +304,12 @@ case "register": // Register new extension
                        $ext_name = trim(substr($subj, 1, strpos($subj, ":") - 1));
 
                        // Test the extension for deprecation
-                       global $EXT_DEPRECATED;
                        LOAD_EXTENSION($ext_name, "test");
 
                        // Is the extension deprecated?
-                       if ($EXT_DEPRECATED == "N") {
+                       if (EXT_GET_DEPRECATED() == "N") {
                                // ... so we can finally register and load it in registration mode
-                               $status = EXTENSION_REGISTER($ext_name, $ext_id);
-                               if ($status == true) {
+                               if (EXTENSION_REGISTER($ext_name, $ext_id)) {
                                        // Extension was found and successfully registered
                                        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_EXTENSION_REGISTERED'));
 
@@ -319,18 +327,18 @@ case "register": // Register new extension
                                        }
 
                                        // Do we need to update cache file?
-                                       if ((EXT_IS_ACTIVE("cache")) && ($GLOBALS['cacheMode'] != "no")) {
+                                       if ((EXT_IS_ACTIVE("cache")) && ($GLOBALS['cache_mode'] != "no")) {
                                                // Remove cache file (will be auto-created again!)
                                                if ($GLOBALS['cache_instance']->loadCacheFile("config")) $GLOBALS['cache_instance']->destroyCacheFile();
                                                if ($GLOBALS['cache_instance']->loadCacheFile("extensions", true)) $GLOBALS['cache_instance']->destroyCacheFile();
-                                               if ($GLOBALS['cache_instance']->loadCacheFile("mod_reg")) $GLOBALS['cache_instance']->destroyCacheFile();
+                                               if ($GLOBALS['cache_instance']->loadCacheFile("modreg")) $GLOBALS['cache_instance']->destroyCacheFile();
                                        } // END - if
                                } elseif (GET_EXT_VERSION($ext_name) != "") {
                                        // Notify the admin that we have a problem here...
                                        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_REG_FAILED_ALREADY'));
                                } else {
                                        // Notify the admin that we have a problem here...
-                                       LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_REG_FAILED_404'));
+                                       LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('ADMIN_REG_FAILED_404'), $ext_name));
                                }
                        } else {
                                // Motify the admin that we have a problem here...