]> git.mxchange.org Git - mailer.git/commitdiff
Module-related code moved, deprecated templates deleted, internals stats are now...
authorRoland Häder <roland@mxchange.org>
Wed, 30 Jun 2010 23:51:59 +0000 (23:51 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 30 Jun 2010 23:51:59 +0000 (23:51 +0000)
- Internal statistics can now be turned of to gain a little more performance
- Module-related functions moved to module-functions.php
- Deprecated templates removed
- TODOs.txt updated

18 files changed:
.gitattributes
DOCS/TODOs.txt
inc/config-global.php
inc/extensions-functions.php
inc/extensions/ext-other.php
inc/language/cache_de.php
inc/language/other_de.php
inc/module-functions.php [new file with mode: 0644]
inc/modules/admin/what-cache_stats.php
inc/modules/admin/what-config_other.php
inc/mysql-manager.php
inc/stats-functions.php
templates/de/emails/admin/admin_ext_deactivated.tpl [deleted file]
templates/de/html/admin/admin_config_other.tpl
templates/de/html/admin/admin_ext_notes.tpl [deleted file]
templates/de/html/admin/admin_ext_reg_form.tpl [deleted file]
templates/de/html/admin/admin_ext_sql_row.tpl [deleted file]
templates/de/html/admin/admin_ext_sql_table.tpl [deleted file]

index 4e2830af1791eed672614e292e130587a7c36849..c14e589a676ccb9573684e1414489833c090a659 100644 (file)
@@ -723,7 +723,6 @@ 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_extension_deactivated.tpl -text
 templates/de/emails/admin/admin_holiday_deactivated.tpl -text
 templates/de/emails/admin/admin_holiday_request.tpl -text
@@ -1047,10 +1046,6 @@ templates/de/html/admin/admin_email_archiv.tpl -text
 templates/de/html/admin/admin_email_archiv_row.tpl -text
 templates/de/html/admin/admin_email_nav_row.tpl -text
 templates/de/html/admin/admin_expert_settings_form.tpl -text
-templates/de/html/admin/admin_ext_notes.tpl -text
-templates/de/html/admin/admin_ext_reg_form.tpl -text
-templates/de/html/admin/admin_ext_sql_row.tpl -text
-templates/de/html/admin/admin_ext_sql_table.tpl -text
 templates/de/html/admin/admin_extension_notes.tpl -text
 templates/de/html/admin/admin_extension_reg_form.tpl -text
 templates/de/html/admin/admin_extension_sql_row.tpl -text
index e5559cdabffb8b06e587cc30b9b7cefdbdbacb1b..bb3611baebc84de49a1d115ff8bcda605f09a014 100644 (file)
@@ -88,6 +88,8 @@
 ./inc/libs/yoomedia_functions.php:116: $response = YOOMEDIA_QUERY_API('out_textmail.php', true); // @TODO Ask Yoo!Media for test script
 ./inc/load_config.php:77:      // @TODO Rewrite them to avoid this else block
 ./inc/loader/load_cache-extension.php:13: * @TODO Rewrite this whole file to load_cache-extensions.php           *
+./inc/module-functions.php:197:                        // @TODO Nothing helped???
+./inc/module-functions.php:232:                        // @TODO Rewrite this to a filter
 ./inc/modules/admin/admin-inc.php:261:         // @TODO Rewrite this to $content = SQL_FETCHARRAY()
 ./inc/modules/admin/admin-inc.php:266:                         // @TODO ACL is 'allow'... hmmm
 ./inc/modules/admin/admin-inc.php:332:                                 // @TODO Rewrite this to $content = SQL_FETCHARRAY()
 ./inc/modules/member/what-unconfirmed.php:143: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
 ./inc/modules/order.php:76:            // @TODO Unused: 2,4
 ./inc/monthly/monthly_bonus.php:69:    // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1629:                  // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
-./inc/mysql-manager.php:1729:  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:2109:                  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:2153:// @TODO Fix inconsistency between last_module and getWhat()
-./inc/mysql-manager.php:229:                   // @TODO Nothing helped???
-./inc/mysql-manager.php:264:                   // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:589:   // @TODO Try to rewrite this to one or more functions
-./inc/mysql-manager.php:94:// @TODO Can we cache this?
+./inc/mysql-manager.php:1410:                  // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
+./inc/mysql-manager.php:1510:  // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1890:                  // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1934:// @TODO Fix inconsistency between last_module and getWhat()
+./inc/mysql-manager.php:370:   // @TODO Try to rewrite this to one or more functions
+./inc/mysql-manager.php:46:// @TODO Can we cache this?
 ./inc/reset/reset_beg.php:51:// @TODO This should be converted in a daily beg rallye
 ./inc/reset/reset_birthday.php:91:                     // @TODO 4 is hard-coded here, should we move it out in config?
 ./inc/revision-functions.php:153:// @TODO Please describe this function
 ./templates/de/html/surfbar/surfbar_frame_textlinks.tpl:5:             <!-- @TODO These are static lines and should be replaced by a filter (see ext-sponsor) //-->
 ### ### DEPRECATION FOLLOWS: ### ###
 ./inc/modules/admin/admin-inc.php:439:// @DEPRECATED
-./templates/de/emails/admin/admin_ext_deactivated.tpl:1:<!-- @DEPRECATED //-->
-./templates/de/html/admin/admin_ext_notes.tpl:1:<!-- @DEPRECATED //-->
-./templates/de/html/admin/admin_ext_reg_form.tpl:1:<!-- @DEPRECATED //-->
-./templates/de/html/admin/admin_ext_sql_row.tpl:1:<!-- @DEPRECATED //-->
-./templates/de/html/admin/admin_ext_sql_table.tpl:1:<!-- @DEPRECATED //-->
 ### ### template-warnings.log follows: ### ###
 Warning: Not parsing JavaScript templates/de/html/js/js_order_send.tpl.
 Warning: Not parsing JavaScript templates/de/html/js/js_cookies_disabled.tpl.
index dc5edaaacb5f98831bc7991d2486b5ac0acf1204..50e9548c9e17f1fc0e2a7fb7adbebe2b0ec41b0b 100644 (file)
@@ -56,7 +56,7 @@ error_reporting(E_ALL | E_STRICT);
 $PATH = str_replace("\\", '/', substr(dirname(__FILE__), 0, -3));
 
 // Some very important function includes
-foreach (array('config','wrapper','template','inc','stats') as $inc) {
+foreach (array('config','wrapper','template','module','inc','stats') as $inc) {
        include($PATH . 'inc/' . $inc . '-functions.php');
 } // END - foreach
 
@@ -91,8 +91,8 @@ setConfigEntry('COPY', 'Copyright &copy; 2003 - 2009, by Roland H&auml;der,<br /
 // CFG: CACHE-PATH
 setConfigEntry('CACHE_PATH', getConfig('PATH') . 'inc/cache/');
 
-// CFG: STATS-ENABLED (temporary tables, if your database crashs all is gone)
-setConfigEntry('STATS_ENABLED', 'Y');
+// CFG: STATS-ENABLED (This setting is overwritten by ext-other; at least version 0.2.6)
+setConfigEntry('stats_enabled', 'Y');
 
 // GLOBAL: DEBUG-TEMPLATE-CACHE
 setConfigEntry('DEBUG_TEMPLATE_CACHE', 'N');
index 109b30f1d282eb4704cc630e91db582d1a01091f..44a8ea04f1435c2b91450384b8e4cecb2818f7b2 100644 (file)
@@ -1017,57 +1017,6 @@ function createExtensionDeactivationTask ($ext_name) {
        return $taskId;
 }
 
-// Checks if the module has a menu
-function ifModuleHasMenu ($mod, $forceDb = false) {
-       // All is false by default
-       $ret = false;
-
-       // Extension installed and newer than or has version 0.1.2?
-       if (isExtensionInstalledAndNewer('cache', '0.1.2')) {
-               // Cache version is okay, so let's check the cache!
-               if (isset($GLOBALS['cache_array']['modules']['has_menu'][$mod])) {
-                       // Check module cache and count hit
-                       $ret = ($GLOBALS['cache_array']['modules']['has_menu'][$mod] == 'Y');
-                       incrementStatsEntry('cache_hits');
-               } elseif (isset($GLOBALS['cache_array']['extension']['ext_menu'][$mod])) {
-                       // Check cache and count hit
-                       $ret = ($GLOBALS['cache_array']['extension']['ext_menu'][$mod] == 'Y');
-                       incrementStatsEntry('cache_hits');
-               } else {
-                       // Admin/guest/member/sponsor modules have always a menu!
-                       $ret = in_array($mod, array('admin', 'index', 'login', 'sponsor'));
-               }
-       } elseif ((isExtensionInstalledAndNewer('sql_patches', '0.3.6')) && ((!isExtensionActive('cache')) || ($forceDb === true))) {
-               // Check database for entry
-               $result = SQL_QUERY_ESC("SELECT `has_menu` FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module`='%s' LIMIT 1",
-                       array($mod), __FUNCTION__, __LINE__);
-
-               // Entry found?
-               if (SQL_NUMROWS($result) == 1) {
-                       // Load "has_menu" column
-                       $data = SQL_FETCHARRAY($result);
-
-                       // Fake cache... ;-)
-                       $GLOBALS['cache_array']['extension']['ext_menu'][$mod] = $data['has_menu'];
-
-                       // Does it have a menu?
-                       $ret = ($data['has_menu'] == 'Y');
-               } // END  - if
-
-               // Free memory
-               SQL_FREERESULT($result);
-       } elseif (!isExtensionInstalled('sql_patches')) {
-               // No sql_patches installed, so maybe in admin/guest/member/sponsor area or no admin registered?
-               $ret = in_array($mod, array('admin', 'index', 'login', 'sponsor')); // Then there is a menu!
-       } else {
-               // Unsupported state!
-               logDebugMessage(__FUNCTION__, __LINE__, 'This should never be reached.');
-       }
-
-       // Return status
-       return $ret;
-}
-
 // Determines the task id for given extension
 function determineExtensionTaskId ($ext_name) {
        // Default is not found
index 71541b5723d3ae48292c17d57d3fd3b136cf5035..3732e2187293fececaa6fbe5a165a70c4588c3d7 100644 (file)
@@ -43,10 +43,10 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Version number
-setThisExtensionVersion('0.2.5');
+setThisExtensionVersion('0.2.6');
 
 // Version history array (add more with , '0.1.0' and so on)
-setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5'));
+setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6'));
 
 // Keep this extension always active!
 setExtensionAlwaysActive('Y');
@@ -229,7 +229,14 @@ switch (getExtensionMode()) {
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Codel&auml;nge aus tables.sql rausgeholt.");
                                break;
-               }
+
+                       case '0.2.6': // SQL queries for v0.2.5
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `stats_enabled` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Interne Statistiken sind nun abschaltbar (kann Performance bringen).");
+                               break;
+               } // END - switch
                break;
 
        case 'modify': // When the extension got modified
index d67156c2e74b9c0a2c9c2bd0864cbfff35b0dee6..0b92b79a2c2d861a0f59acd96636b2a97a20e542 100644 (file)
@@ -51,18 +51,6 @@ addMessages(array(
        'ADMIN_CACHE_PERCENTS' => "Prozentual (*)",
        'ADMIN_CACHE_NOTES' => "(*): Sollten bei Ihnen die Prozente unter 50&#37; liegen und Sie nicht vor September 2008 das Script *neu* installiert haben, so ist dies kein Grund zur Besorgnis. Im Normalfall sollten die Prozente seit eigenen Revisionen im September 2008 (R300+) &uuml;ber 50&#37; liegen.",
        'ADMIN_TOTAL_HITS' => "Gesamtzugriffe",
-       'ADMIN_CONFIG_CACHE_SETTINGS' => "Caching-Einstellung",
-       'ADMIN_CACHE_ADMINS' => "Soll der Zugriff auf die Tabelle <strong>{?_MYSQL_PREFIX?}_admins</strong> beschleunigt werden?",
-       'ADMIN_CACHE_ACLS' => "Soll der Zugriff auf die Tabelle <strong>{?_MYSQL_PREFIX?}_admins_acls</strong> beschleunigt werden?",
-       'ADMIN_CACHE_EXTS' => "Soll der Zugriff auf die Tabelle <strong>{?_MYSQL_PREFIX?}_extensions</strong> beschleunigt werden?",
-       'ADMIN_CACHE_CONFIG' => "Soll der Zugriff auf die Tabelle <strong>{?_MYSQL_PREFIX?}_config</strong> beschleunigt werden?",
-       'ADMIN_CACHE_MODREG' => "Soll der Zugriff auf die Tabelle <strong>{?_MYSQL_PREFIX?}_mod_reg</strong> beschleunigt werden?",
-       'ADMIN_CACHE_REFDEPTH' => "Soll der Zugriff auf die Tabelle <strong>{?_MYSQL_PREFIX?}_refdepths</strong> beschleunigt werden?",
-       'ADMIN_CACHE_REFSYS' => "Soll der Zugriff auf die Tabelle <strong>{?_MYSQL_PREFIX?}_refsystem</strong> beschleunigt werden?",
-       'ADMIN_CACHE_FILTER' => "Soll der Zugriff auf die Tabelle <strong>{?_MYSQL_PREFIX?}_filter</strong> beschleunigt werden?",
-       'ADMIN_CACHE_THEMES' => "Soll der Zugriff auf die Tabelle <strong>{?_MYSQL_PREFIX?}_themes</strong> beschleunigt werden?",
-       'ADMIN_CACHE_ADMIN_MENU' => "Soll der Aufbau des Administratormen&uuml;s beschleunigt werden (EXPERIMENTELL!)?",
-       'ADMIN_CACHE_PATH' => "Relativer Pfad f&uuml;r alle Cache-Dateien zum Pfad <strong>inc</strong>",
        'ADMIN_CACHE_DB_STATS_DEACTIVATED' => "Datenbank-/Cache-Statistiken sind deaktiviert. Dies ist gut f&uuml;r die Performance.",
 ));
 
index 04dd2424cc8512c095bc55bb9c29fbb68221b2cd..ede1378b61aa3f53965d32ba3da1af0df17e5d08 100644 (file)
@@ -85,7 +85,9 @@ addMessages(array(
        'ADMIN_OPTION_SHOW_POINTS_UNCONFIRMED' => "{?POINTS?} in unbest&auml;tige Mails im Mitgliedsbereich anzeigen?",
        'ADMIN_OPTION_MINIMUM_AGE' => "Ab welchem Mindestalter d&uuml;rfen sich Ihre Mitglieder anmelden?",
        'ADMIN_SQL_SETTINGS' => "SQL-Einstellungen",
-       'ADMIN_DISPLAY_DEBUG_SQLS' => "Sollen die SQL-Abfragen zu Debug-Zwecken angezeigt werden? Keines Ihrer Mitglieder sehen diese.",
+       'ADMIN_DISPLAY_DEBUG_SQLS' => "Sollen die SQL-Abfragen f&uuml;r Administratoren zu Debug-Zwecken angezeigt werden?.  Das Einschalten dieser Einstellung kann enorme Performanceverluste bedeuten.",
+       'ADMIN_STATS_SETTINGS' => "Interne Statistik Einstellungen",
+       'ADMIN_CONFIG_STATS_ENABLED' => "Sollen die internen Statistiken eingeschaltet sein? Das Abschalten dieser Statistiken kann etwas Performance bringen, ist aber f&uuml;r Performancemessungen vorraussetzend.",
 ));
 
 // [EOF]
diff --git a/inc/module-functions.php b/inc/module-functions.php
new file mode 100644 (file)
index 0000000..98eb9c1
--- /dev/null
@@ -0,0 +1,316 @@
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL                                Start: 07/01/2010 *
+ * ===================                          Last change: 07/01/2010 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : module-functions.php                             *
+ * -------------------------------------------------------------------- *
+ * Short description : All MySQL-related functions                      *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Alle MySQL-Relevanten Funktionen                 *
+ * -------------------------------------------------------------------- *
+ * $Revision:: 1910                                                   $ *
+ * $Date:: 2010-06-29 06:00:23 +0200 (Tue, 29 Jun 2010)               $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author:: quix0r                                                   $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
+ * For more information visit: http://www.mxchange.org                  *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+       die();
+} // END - if
+
+// "Getter" for module title
+function getModuleTitle ($module) {
+       // Init variables
+       $data['title'] = '';
+       $result = false;
+
+       // Is the script installed?
+       if (isInstalled()) {
+               // Check if cache is valid
+               if ((isExtensionInstalledAndNewer('cache', '0.1.2')) && (isset($GLOBALS['cache_array']['modules']['module'])) && (in_array($module, $GLOBALS['cache_array']['modules']['module']))) {
+                       // Load from cache
+                       $data['title'] = $GLOBALS['cache_array']['modules']['title'][$module];
+
+                       // Update cache hits
+                       incrementStatsEntry('cache_hits');
+               } elseif (!isExtensionActive('cache')) {
+                       // Load from database
+                       $result = SQL_QUERY_ESC("SELECT `title` FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module`='%s' LIMIT 1",
+                               array($module), __FUNCTION__, __LINE__);
+
+                       // Is the entry there?
+                       if (SQL_NUMROWS($result)) {
+                               // Get the title from database
+                               $data = SQL_FETCHARRAY($result);
+                       } // END - if
+
+                       // Free the result
+                       SQL_FREERESULT($result);
+               }
+       } // END - if
+
+       // Trim name
+       $data['title'] = trim($data['title']);
+
+       // Still no luck or empty title?
+       if (empty($data['title'])) {
+               // No name found
+               $data['title'] = getMaskedMessage('UNKNOWN_MODULE_DETECTED', $module);
+               if ((is_resource($result)) && (SQL_HASZERONUMS($result))) {
+                       // Add module to database
+                       $dummy = checkModulePermissions($module);
+               } // END - if
+       } // END - if
+
+       // Return name
+       return $data['title'];
+}
+
+// Check validity of a given module name (no file extension)
+function checkModulePermissions ($module = '') {
+       // Is it empty (default), then take the current one
+       if (empty($module)) $module = getModule();
+
+       // Do we have cache?
+       if (isset($GLOBALS['module_status'][$module])) {
+               // Then use it
+               return $GLOBALS['module_status'][$module];
+       } // END - if
+
+       // Filter module name (names with low chars and underlines are fine!)
+       $module = preg_replace('/[^a-z_]/', '', $module);
+
+       // Check for prefix is a extension...
+       $modSplit = explode('_', $module);
+       $extension = ''; $module_chk = $module;
+       //* DEBUG: */ debugOutput(__LINE__.'*'.count($modSplit).'/'.$module.'*');
+       if (count($modSplit) == 2) {
+               // Okay, there is a seperator (_) in the name so is the first part a module?
+               //* DEBUG: */ debugOutput(__LINE__.'*'.$modSplit[0].'*');
+               if (isExtensionActive($modSplit[0])) {
+                       // The prefix is an extension's name, so let's set it
+                       $extension = $modSplit[0]; $module = $modSplit[1];
+               } // END - if
+       } // END - if
+
+       // Major error in module registry is the default
+       $ret = 'major';
+
+       // Check if script is installed if not return a 'done' to prevent some errors
+       if ((isInstallationPhase()) || (!isAdminRegistered())) {
+               // Not installed or no admin registered or in installation phase
+               return 'done';
+       } // END - if
+
+       // Init data array
+       $data = array(
+               'locked'     => 'Y',
+               'hidden'     => 'N',
+               'admin_only' => 'N',
+               'mem_only'   => 'N'
+       );
+
+       // By default nothing is found
+       $found  = false;
+
+       // Check if cache is latest version
+       if (isExtensionInstalledAndNewer('cache', '0.1.2')) {
+               // Is the cache there?
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using cache.');
+               if (isset($GLOBALS['cache_array']['modules']['locked'][$module_chk])) {
+                       // Check cache
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cache found.');
+                       $data['locked']     = $GLOBALS['cache_array']['modules']['locked'][$module_chk];
+                       $data['hidden']     = $GLOBALS['cache_array']['modules']['hidden'][$module_chk];
+                       $data['admin_only'] = $GLOBALS['cache_array']['modules']['admin_only'][$module_chk];
+                       $data['mem_only']   = $GLOBALS['cache_array']['modules']['mem_only'][$module_chk];
+
+                       // Update cache hits
+                       incrementStatsEntry('cache_hits');
+                       $found = true;
+               } else {
+                       // No, then we have to update it!
+                       $ret = 'cache_miss';
+               }
+       } elseif (!isExtensionActive('cache')) {
+               // Check for module in database
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using database.');
+               $result = SQL_QUERY_ESC("SELECT `locked`, `hidden`, `admin_only`, `mem_only` FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module`='%s' LIMIT 1",
+                       array($module_chk), __FUNCTION__, __LINE__);
+               if (SQL_NUMROWS($result) == 1) {
+                       // Read data
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Entry found.');
+                       $data = SQL_FETCHARRAY($result);
+                       $found = true;
+               } elseif (isDebugModeEnabled()) {
+                       // Debug message only in debug-mode...
+                       logDebugMessage(__FUNCTION__, __LINE__, 'Module ' . $module_chk . ' not found!');
+               }
+
+               // Free result
+               SQL_FREERESULT($result);
+       }
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret=' . $ret);
+
+       // Is the module found?
+       if ($found === true) {
+               // Check returned values against current access permissions
+               //
+               //  Admin access                   ----- Guest access -----                                     --- Guest   or   member? ---
+               if ((isAdmin()) || (($data['locked'] != 'Y') && ($data['admin_only'] != 'Y') && (($data['mem_only'] != 'Y') || (isMember())))) {
+                       // If you are admin you are welcome for everything!
+                       $ret = 'done';
+               } elseif ($data['locked'] == 'Y') {
+                       // Module is locked
+                       $ret = 'locked';
+               } elseif (($data['mem_only'] == 'Y') && (!isMember())) {
+                       // You have to login first!
+                       $ret = 'mem_only';
+               } elseif (($data['admin_only'] == 'Y') && (!isAdmin())) {
+                       // Only the Admin is allowed to enter this module!
+                       $ret = 'admin_only';
+               } else {
+                       // @TODO Nothing helped???
+                       logDebugMessage(__FUNCTION__, __LINE__, sprintf("ret=%s,locked=%s,admin=%s,mem=%s",
+                               $ret,
+                               $data['locked'],
+                               $data['admin_only'],
+                               $data['mem_only']
+                       ));
+               }
+       } // END - if
+
+       // Still no luck or not found?
+       if (($found === false) && (!isExtensionActive('cache')) && ($ret != 'done'))  {
+               //              ----- Legacy module -----                                               ---- Module in base folder  ----                       --- Module with extension's name ---
+               if ((isIncludeReadable(sprintf("inc/modules/%s.php", $module))) || (isIncludeReadable(sprintf("%s.php", $module))) || (isIncludeReadable(sprintf("%s/%s.php", $extension, $module)))) {
+                       // Data is missing so we add it
+                       if (isExtensionInstalledAndNewer('sql_patches', '0.3.6')) {
+                               // Since 0.3.6 we have a has_menu column, this took me a half hour
+                               // to find a loop here... *sigh*
+                               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_mod_reg`
+(`module`, `locked`, `hidden`, `mem_only`, `admin_only`, `has_menu`) VALUES
+('%s','Y','N','N','N','N')", array($module_chk), __FUNCTION__, __LINE__);
+                       } else {
+                               // Wrong/missing sql_patches!
+                               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_mod_reg`
+(`module`, `locked`, `hidden`, `mem_only`, `admin_only`) VALUES
+('%s','Y','N','N','N')", array($module_chk), __FUNCTION__, __LINE__);
+                       }
+
+                       // Everthing is fine?
+                       if (SQL_AFFECTEDROWS() < 1) {
+                               // Something bad happend!
+                               return 'major';
+                       } // END - if
+
+                       // Destroy cache here
+                       // @TODO Rewrite this to a filter
+                       if ((getOutputMode() == '0') || (getOutputMode() == -1)) rebuildCache('modules', 'modules');
+
+                       // And reload data
+                       unset($GLOBALS['module_status'][$module]);
+                       $ret = checkModulePermissions($module_chk);
+               } else {
+                       // Module not found we don't add it to the database
+                       $ret = '404';
+               }
+       } elseif (($ret == 'cache_miss') && (getOutputMode() == '0')) {
+               // Rebuild the cache files
+               rebuildCache('modules', 'modules');
+       } elseif ($found === false) {
+               // Problem with module detected
+               logDebugMessage(__FUNCTION__, __LINE__, sprintf("Problem in module %s detected. ret=%s, locked=%s, hidden=%s, mem=%s, admin=%s, output_mode=%s",
+                       $module,
+                       $ret,
+                       $data['locked'],
+                       $data['hidden'],
+                       $data['mem_only'],
+                       $data['admin_only'],
+                       getOutputMode()
+               ));
+       }
+
+       // Return the value
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret=' . $ret);
+       $GLOBALS['module_status'][$module] = $ret;
+       return $ret;
+}
+
+// Checks if the module has a menu
+function ifModuleHasMenu ($mod, $forceDb = false) {
+       // All is false by default
+       $ret = false;
+
+       // Extension installed and newer than or has version 0.1.2?
+       if (isExtensionInstalledAndNewer('cache', '0.1.2')) {
+               // Cache version is okay, so let's check the cache!
+               if (isset($GLOBALS['cache_array']['modules']['has_menu'][$mod])) {
+                       // Check module cache and count hit
+                       $ret = ($GLOBALS['cache_array']['modules']['has_menu'][$mod] == 'Y');
+                       incrementStatsEntry('cache_hits');
+               } elseif (isset($GLOBALS['cache_array']['extension']['ext_menu'][$mod])) {
+                       // Check cache and count hit
+                       $ret = ($GLOBALS['cache_array']['extension']['ext_menu'][$mod] == 'Y');
+                       incrementStatsEntry('cache_hits');
+               } else {
+                       // Admin/guest/member/sponsor modules have always a menu!
+                       $ret = in_array($mod, array('admin', 'index', 'login', 'sponsor'));
+               }
+       } elseif ((isExtensionInstalledAndNewer('sql_patches', '0.3.6')) && ((!isExtensionActive('cache')) || ($forceDb === true))) {
+               // Check database for entry
+               $result = SQL_QUERY_ESC("SELECT `has_menu` FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module`='%s' LIMIT 1",
+                       array($mod), __FUNCTION__, __LINE__);
+
+               // Entry found?
+               if (SQL_NUMROWS($result) == 1) {
+                       // Load "has_menu" column
+                       $data = SQL_FETCHARRAY($result);
+
+                       // Fake cache... ;-)
+                       $GLOBALS['cache_array']['extension']['ext_menu'][$mod] = $data['has_menu'];
+
+                       // Does it have a menu?
+                       $ret = ($data['has_menu'] == 'Y');
+               } // END  - if
+
+               // Free memory
+               SQL_FREERESULT($result);
+       } elseif (!isExtensionInstalled('sql_patches')) {
+               // No sql_patches installed, so maybe in admin/guest/member/sponsor area or no admin registered?
+               $ret = in_array($mod, array('admin', 'index', 'login', 'sponsor')); // Then there is a menu!
+       } else {
+               // Unsupported state!
+               logDebugMessage(__FUNCTION__, __LINE__, 'This should never be reached.');
+       }
+
+       // Return status
+       return $ret;
+}
+
+// [EOF]
+?>
index aafc8a74846f01398577e9fa69e6ca4cbdc6d4ca..cfcd33e1f1ae477ae6e59a8e5bea3ce166f1521b 100644 (file)
@@ -46,7 +46,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 addMenuDescription('admin', __FILE__);
 
 // Activated?
-if (getConfig('STATS_ENABLED') == 'Y') {
+if (ifStatsAreEnabled()) {
        // Prepare data for the template
        $content['db_hits']    = getStatsEntry('db_hits');
        $content['cache_hits'] = getStatsEntry('cache_hits');
index 811ea2a5973aa95ae8350b13d1dbc9ff23a7f441..4af2d9f5bc4e02e31733684045c1e3086fd3d299 100644 (file)
@@ -87,7 +87,7 @@ if (isFormSent()) {
        $content['profile_reupdate'] = createTimeSelections(getConfig('resend_profile_update') , 'resend_profile_update', 'MWD');
 
        // Prepare more Y/N selections
-       foreach(array('show_points_unconfirmed','show_timings','youre_here','member_menu','guest_menu','order_multi_page','autosend_active','send_prof_update','admin_notify','display_debug_sqls') as $entry) {
+       foreach(array('show_points_unconfirmed','show_timings','youre_here','member_menu','guest_menu','order_multi_page','autosend_active','send_prof_update','admin_notify','display_debug_sqls','stats_enabled') as $entry) {
                $content[$entry . '_y'] = '';
                $content[$entry . '_n'] = '';
                $content[$entry . '_' . strtolower(getConfig($entry))] = ' checked="checked"';
index ac33024157fe66bd8571ab9c771c204517f1512e..65ff7e9f968a8e7a8b491ecaec50d01de667d812 100644 (file)
@@ -42,54 +42,6 @@ if (!defined('__SECURITY')) {
        die();
 } // END - if
 
-// "Getter" for module title
-function getModuleTitle ($module) {
-       // Init variables
-       $data['title'] = '';
-       $result = false;
-
-       // Is the script installed?
-       if (isInstalled()) {
-               // Check if cache is valid
-               if ((isExtensionInstalledAndNewer('cache', '0.1.2')) && (isset($GLOBALS['cache_array']['modules']['module'])) && (in_array($module, $GLOBALS['cache_array']['modules']['module']))) {
-                       // Load from cache
-                       $data['title'] = $GLOBALS['cache_array']['modules']['title'][$module];
-
-                       // Update cache hits
-                       incrementStatsEntry('cache_hits');
-               } elseif (!isExtensionActive('cache')) {
-                       // Load from database
-                       $result = SQL_QUERY_ESC("SELECT `title` FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module`='%s' LIMIT 1",
-                               array($module), __FUNCTION__, __LINE__);
-
-                       // Is the entry there?
-                       if (SQL_NUMROWS($result)) {
-                               // Get the title from database
-                               $data = SQL_FETCHARRAY($result);
-                       } // END - if
-
-                       // Free the result
-                       SQL_FREERESULT($result);
-               }
-       } // END - if
-
-       // Trim name
-       $data['title'] = trim($data['title']);
-
-       // Still no luck or empty title?
-       if (empty($data['title'])) {
-               // No name found
-               $data['title'] = getMaskedMessage('UNKNOWN_MODULE_DETECTED', $module);
-               if ((is_resource($result)) && (SQL_HASZERONUMS($result))) {
-                       // Add module to database
-                       $dummy = checkModulePermissions($module);
-               } // END - if
-       } // END - if
-
-       // Return name
-       return $data['title'];
-}
-
 // "Getter" for module description
 // @TODO Can we cache this?
 function getTitleFromMenu ($mode, $what, $column = 'what', $ADD='') {
@@ -122,177 +74,6 @@ function getTitleFromMenu ($mode, $what, $column = 'what', $ADD='') {
        return $data['title'];
 }
 
-// Check validity of a given module name (no file extension)
-function checkModulePermissions ($module = '') {
-       // Is it empty (default), then take the current one
-       if (empty($module)) $module = getModule();
-
-       // Do we have cache?
-       if (isset($GLOBALS['module_status'][$module])) {
-               // Then use it
-               return $GLOBALS['module_status'][$module];
-       } // END - if
-
-       // Filter module name (names with low chars and underlines are fine!)
-       $module = preg_replace('/[^a-z_]/', '', $module);
-
-       // Check for prefix is a extension...
-       $modSplit = explode('_', $module);
-       $extension = ''; $module_chk = $module;
-       //* DEBUG: */ debugOutput(__LINE__.'*'.count($modSplit).'/'.$module.'*');
-       if (count($modSplit) == 2) {
-               // Okay, there is a seperator (_) in the name so is the first part a module?
-               //* DEBUG: */ debugOutput(__LINE__.'*'.$modSplit[0].'*');
-               if (isExtensionActive($modSplit[0])) {
-                       // The prefix is an extension's name, so let's set it
-                       $extension = $modSplit[0]; $module = $modSplit[1];
-               } // END - if
-       } // END - if
-
-       // Major error in module registry is the default
-       $ret = 'major';
-
-       // Check if script is installed if not return a 'done' to prevent some errors
-       if ((isInstallationPhase()) || (!isAdminRegistered())) {
-               // Not installed or no admin registered or in installation phase
-               return 'done';
-       } // END - if
-
-       // Init data array
-       $data = array(
-               'locked'     => 'Y',
-               'hidden'     => 'N',
-               'admin_only' => 'N',
-               'mem_only'   => 'N'
-       );
-
-       // By default nothing is found
-       $found  = false;
-
-       // Check if cache is latest version
-       if (isExtensionInstalledAndNewer('cache', '0.1.2')) {
-               // Is the cache there?
-               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using cache.');
-               if (isset($GLOBALS['cache_array']['modules']['locked'][$module_chk])) {
-                       // Check cache
-                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cache found.');
-                       $data['locked']     = $GLOBALS['cache_array']['modules']['locked'][$module_chk];
-                       $data['hidden']     = $GLOBALS['cache_array']['modules']['hidden'][$module_chk];
-                       $data['admin_only'] = $GLOBALS['cache_array']['modules']['admin_only'][$module_chk];
-                       $data['mem_only']   = $GLOBALS['cache_array']['modules']['mem_only'][$module_chk];
-
-                       // Update cache hits
-                       incrementStatsEntry('cache_hits');
-                       $found = true;
-               } else {
-                       // No, then we have to update it!
-                       $ret = 'cache_miss';
-               }
-       } elseif (!isExtensionActive('cache')) {
-               // Check for module in database
-               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Using database.');
-               $result = SQL_QUERY_ESC("SELECT `locked`, `hidden`, `admin_only`, `mem_only` FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module`='%s' LIMIT 1",
-                       array($module_chk), __FUNCTION__, __LINE__);
-               if (SQL_NUMROWS($result) == 1) {
-                       // Read data
-                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Entry found.');
-                       $data = SQL_FETCHARRAY($result);
-                       $found = true;
-               } elseif (isDebugModeEnabled()) {
-                       // Debug message only in debug-mode...
-                       logDebugMessage(__FUNCTION__, __LINE__, 'Module ' . $module_chk . ' not found!');
-               }
-
-               // Free result
-               SQL_FREERESULT($result);
-       }
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret=' . $ret);
-
-       // Is the module found?
-       if ($found === true) {
-               // Check returned values against current access permissions
-               //
-               //  Admin access                   ----- Guest access -----                                     --- Guest   or   member? ---
-               if ((isAdmin()) || (($data['locked'] != 'Y') && ($data['admin_only'] != 'Y') && (($data['mem_only'] != 'Y') || (isMember())))) {
-                       // If you are admin you are welcome for everything!
-                       $ret = 'done';
-               } elseif ($data['locked'] == 'Y') {
-                       // Module is locked
-                       $ret = 'locked';
-               } elseif (($data['mem_only'] == 'Y') && (!isMember())) {
-                       // You have to login first!
-                       $ret = 'mem_only';
-               } elseif (($data['admin_only'] == 'Y') && (!isAdmin())) {
-                       // Only the Admin is allowed to enter this module!
-                       $ret = 'admin_only';
-               } else {
-                       // @TODO Nothing helped???
-                       logDebugMessage(__FUNCTION__, __LINE__, sprintf("ret=%s,locked=%s,admin=%s,mem=%s",
-                               $ret,
-                               $data['locked'],
-                               $data['admin_only'],
-                               $data['mem_only']
-                       ));
-               }
-       } // END - if
-
-       // Still no luck or not found?
-       if (($found === false) && (!isExtensionActive('cache')) && ($ret != 'done'))  {
-               //              ----- Legacy module -----                                               ---- Module in base folder  ----                       --- Module with extension's name ---
-               if ((isIncludeReadable(sprintf("inc/modules/%s.php", $module))) || (isIncludeReadable(sprintf("%s.php", $module))) || (isIncludeReadable(sprintf("%s/%s.php", $extension, $module)))) {
-                       // Data is missing so we add it
-                       if (isExtensionInstalledAndNewer('sql_patches', '0.3.6')) {
-                               // Since 0.3.6 we have a has_menu column, this took me a half hour
-                               // to find a loop here... *sigh*
-                               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_mod_reg`
-(`module`, `locked`, `hidden`, `mem_only`, `admin_only`, `has_menu`) VALUES
-('%s','Y','N','N','N','N')", array($module_chk), __FUNCTION__, __LINE__);
-                       } else {
-                               // Wrong/missing sql_patches!
-                               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_mod_reg`
-(`module`, `locked`, `hidden`, `mem_only`, `admin_only`) VALUES
-('%s','Y','N','N','N')", array($module_chk), __FUNCTION__, __LINE__);
-                       }
-
-                       // Everthing is fine?
-                       if (SQL_AFFECTEDROWS() < 1) {
-                               // Something bad happend!
-                               return 'major';
-                       } // END - if
-
-                       // Destroy cache here
-                       // @TODO Rewrite this to a filter
-                       if ((getOutputMode() == '0') || (getOutputMode() == -1)) rebuildCache('modules', 'modules');
-
-                       // And reload data
-                       unset($GLOBALS['module_status'][$module]);
-                       $ret = checkModulePermissions($module_chk);
-               } else {
-                       // Module not found we don't add it to the database
-                       $ret = '404';
-               }
-       } elseif (($ret == 'cache_miss') && (getOutputMode() == '0')) {
-               // Rebuild the cache files
-               rebuildCache('modules', 'modules');
-       } elseif ($found === false) {
-               // Problem with module detected
-               logDebugMessage(__FUNCTION__, __LINE__, sprintf("Problem in module %s detected. ret=%s, locked=%s, hidden=%s, mem=%s, admin=%s, output_mode=%s",
-                       $module,
-                       $ret,
-                       $data['locked'],
-                       $data['hidden'],
-                       $data['mem_only'],
-                       $data['admin_only'],
-                       getOutputMode()
-               ));
-       }
-
-       // Return the value
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ret=' . $ret);
-       $GLOBALS['module_status'][$module] = $ret;
-       return $ret;
-}
-
 // Add menu description pending on given file name (without path!)
 function addMenuDescription ($accessLevel, $FQFN, $return = false) {
        // Use only filename of the FQFN...
index 338f3b833adab7d1920438ea6c89e070d8c4b6a3..3982c3b6110bdf2393a5cb803368c663b0abc628 100644 (file)
@@ -45,7 +45,7 @@ if (!defined('__SECURITY')) {
 // Init stats system
 function initStatsSystem () {
        // Is stats cache loaded?
-       if ((!isset($GLOBALS['stats_loaded'])) && (getConfig('STATS_ENABLED') == 'Y')) {
+       if ((!isset($GLOBALS['stats_loaded'])) && (ifStatsAreEnabled())) {
                // Init statistics array
                $GLOBALS['stats'] = array();
 
@@ -66,7 +66,7 @@ function isStatsEntrySet ($entry) {
 // Increments a statistics entry
 function incrementStatsEntry ($entry, $amount=1) {
        // Do we have stats enabled?
-       if (getConfig('STATS_ENABLED') != 'Y') return;
+       if (getConfig('stats_enabled') != 'Y') return;
 
        // Is it there?
        if (isStatsEntrySet($entry)) {
@@ -174,11 +174,25 @@ function writeStatsTable () {
 // Filter for flushing statistics
 function FILTER_FLUSH_STATS () {
        // Now do we have stats?
-       if ((isset($GLOBALS['stats'])) && (!isInstallationPhase()) && (getConfig('STATS_ENABLED') == 'Y')) {
+       if ((isset($GLOBALS['stats'])) && (!isInstallationPhase()) && (ifStatsAreEnabled())) {
                // Write statistics to temporary table
                writeStatsTable();
        } // END - if
 }
 
+// Check wether stats are enabled
+function ifStatsAreEnabled () {
+       logDebugMessage(__FUNCTION__, __LINE__, 'CALLED!');
+
+       // Do we have cache?
+       if (!isset($GLOBALS['stats_enabled'])) {
+               // Then determine it
+               $GLOBALS['stats_enabled'] = (getConfig('stats_enabled') == 'Y');
+       } // END - if
+
+       // Return cached value
+       return $GLOBALS['stats_enabled'];
+}
+
 // [EOF]
 ?>
diff --git a/templates/de/emails/admin/admin_ext_deactivated.tpl b/templates/de/emails/admin/admin_ext_deactivated.tpl
deleted file mode 100644 (file)
index 11f5d85..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- @DEPRECATED //-->
index 8d4c9a801dedece7e7c09548283d5ff5da47fdb4..d50bcd3a0576b8e4507125f03fe3ba18fec37d3d 100644 (file)
        </tr>
 
        <tr>
-               <td class="bottom" align="right">{--ADMIN_DISPLAY_DEBUG_SQLS--}:</td>
+               <td class="bottom" align="right">{--ADMIN_DISPLAY_DEBUG_SQLS--}</td>
                <td class="bottom" align="center">
                        <input type="radio" name="display_debug_sqls" value="Y"$content[display_debug_sqls_y] /> {--YES--}<br />
                        <input type="radio" name="display_debug_sqls" value="N"$content[display_debug_sqls_n] /> {--NO--}
                </td>
        </tr>
 
+       <tr>
+               <td colspan="2" align="center" class="admin_title bottom">
+                       <strong>{--ADMIN_STATS_SETTINGS--}</strong>
+               </td>
+       </tr>
+
+       <tr>
+               <td class="bottom" align="right">{--ADMIN_CONFIG_STATS_ENABLED--}</td>
+               <td class="bottom" align="center">
+                       <input type="radio" name="stats_enabled" value="Y"$content[stats_enabled_y] /> {--YES--}<br />
+                       <input type="radio" name="stats_enabled" value="N"$content[stats_enabled_n] /> {--NO--}
+               </td>
+       </tr>
+
        <tr>
                <td colspan="2" align="center" class="admin_title">
                        <input type="reset" class="admin_reset" value="{--CLEAR_FORM--}" />
diff --git a/templates/de/html/admin/admin_ext_notes.tpl b/templates/de/html/admin/admin_ext_notes.tpl
deleted file mode 100644 (file)
index 11f5d85..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- @DEPRECATED //-->
diff --git a/templates/de/html/admin/admin_ext_reg_form.tpl b/templates/de/html/admin/admin_ext_reg_form.tpl
deleted file mode 100644 (file)
index 11f5d85..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- @DEPRECATED //-->
diff --git a/templates/de/html/admin/admin_ext_sql_row.tpl b/templates/de/html/admin/admin_ext_sql_row.tpl
deleted file mode 100644 (file)
index 11f5d85..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- @DEPRECATED //-->
diff --git a/templates/de/html/admin/admin_ext_sql_table.tpl b/templates/de/html/admin/admin_ext_sql_table.tpl
deleted file mode 100644 (file)
index 11f5d85..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<!-- @DEPRECATED //-->