]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-extensions.php
Updated copyright notice as there are changes in this year
[mailer.git] / inc / modules / admin / what-extensions.php
index 42530629b253d92ed4524007b1912c8e2dd577c2..af439d78c36529520ced37b279243b29008437b2 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -43,12 +43,12 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 // Add description as navigation point
 addYouAreHereLink('admin', __FILE__);
 
-// Normally we want the overview of all registered extensions
+// By default generate overview of all installed extensions
 $do = 'overview';
 
 if (isGetRequestElementSet('register_ext')) {
        // We are about to register a new extension
-       $do = 'register';
+       $do = 'setup';
        $taskId = determineExtensionTaskId(getRequestElement('register_ext'));
 
        // The id comes from task management and it is - of course - *not* the extension's name!
@@ -73,7 +73,11 @@ if (isGetRequestElementSet('register_ext')) {
 
                        // Update database
                        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_active`='%s' WHERE `id`=%s AND `ext_active`='%s' LIMIT 1",
-                               array($active, bigintval($ext_id), $ext_active), __FILE__, __LINE__);
+                               array(
+                                       $active,
+                                       bigintval($ext_id),
+                                       $ext_active
+                               ), __FILE__, __LINE__);
 
                        // Run embeded SQL commands
                        doExtensionSqls($ext_id, getExtensionMode());
@@ -82,9 +86,9 @@ if (isGetRequestElementSet('register_ext')) {
 
        // Redirect to prevent missing cache in js.php
        redirectToUrl('modules.php?module=admin&what=extensions&changed=' . countPostSelection());
-} elseif (((isFormSent('edit')) || (isPostRequestElementSet('modify'))) && (ifPostContainsSelections()) && (!isDemoModeActive())) {
+} elseif (((isFormSent('edit')) || (isPostRequestElementSet('do_edit'))) && (ifPostContainsSelections()) && (!isDemoModeActive())) {
        // Change settings like CSS file load
-       if (isPostRequestElementSet('modify')) {
+       if (isPostRequestElementSet('do_edit')) {
                // Change entries
                $cache_update = '0';
                foreach (postRequestElement('sel') as $ext_id => $sel) {
@@ -235,7 +239,7 @@ if (isGetRequestElementSet('register_ext')) {
        redirectToUrl('modules.php?module=admin&what=extensions&removed=' . countPostSelection());
 } elseif ((isGetRequestElementSet('do')) && (!isDemoModeActive())) {
        // Other things to do
-       $do = SQL_ESCAPE(secureString(getRequestElement('do')));
+       $do = getRequestElement('do');
 } elseif (isGetRequestElementSet('do')) {
        // Demo mode active!
        $do = 'demo';
@@ -269,7 +273,7 @@ if (isGetRequestElementSet('register_ext')) {
 // Shall we display active/inactive extensions?
 $where = '';
 if (isGetRequestElementSet('active')) {
-       $where = sprintf("WHERE `ext_active`='%s'", SQL_ESCAPE(secureString(getRequestElement('active'))));
+       $where = sprintf("WHERE `ext_active`='%s'", SQL_ESCAPE(getRequestElement('active')));
 } // END - if
 
 // Case selection
@@ -277,7 +281,7 @@ switch ($do) {
        case 'overview': // List all registered extensions
                if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) {
                        // Load extension data with CSS informations
-                       $result = SQL_QUERY("SELECT
+                       $result = SQL_QUERY('SELECT
        `id` AS `ext_id`,
        `ext_name`,
        `ext_active`,
@@ -285,21 +289,21 @@ switch ($do) {
        `ext_version`
 FROM
        `{?_MYSQL_PREFIX?}_extensions`
-".$where."
+' . $where . '
 ORDER BY
-       `ext_name` ASC", __FILE__, __LINE__);
+       `ext_name` ASC', __FILE__, __LINE__);
                } else {
                        // Load extension data without CSS informations
-                       $result = SQL_QUERY("SELECT
+                       $result = SQL_QUERY('SELECT
        `id` AS `ext_id`,
        `ext_name`,
        `ext_active`,
        `ext_version`
 FROM
        `{?_MYSQL_PREFIX?}_extensions`
-".$where."
+' . $where . '
 ORDER BY
-       `ext_name` ASC", __FILE__, __LINE__);
+       `ext_name` ASC', __FILE__, __LINE__);
                }
 
                // Are there some entries?
@@ -331,12 +335,12 @@ ORDER BY
                }
                break;
 
-       case 'register': // Register new extension
+       case 'setup': // Setup new extension
                // Are there some tasks?
                $numTasks = countSumTotalData(getCurrentAdminId(), 'task_system', 'id', 'assigned_admin', TRUE, "AND `task_type`='EXTENSION'");
 
                // Is the id number valid and the task was found?
-               if (($taskId > 0) && ($numTasks > 0)) {
+               if ((isValidId($taskId)) && ($numTasks > 0)) {
                        // 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($taskId)), __FILE__, __LINE__);
@@ -363,11 +367,8 @@ ORDER BY
                                                if (isExtensionActive('cache')) {
                                                        // Remove cache file (will be auto-created again!)
                                                        foreach (array('config', 'extension', 'filter', 'modules') as $cache) {
-                                                               // Is the cache file there?
-                                                               if ($GLOBALS['cache_instance']->loadCacheFile($cache)) {
-                                                                       // Remove cache file
-                                                                       $GLOBALS['cache_instance']->removeCacheFile();
-                                                               } // END - if
+                                                               // Rebuild cache file
+                                                               rebuildCache($cache);
                                                        } // END - foreach
                                                } // END - if