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
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
./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.
$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
// 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');
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
} // 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');
// Update notes (these will be set as task text!)
setExtensionUpdateNotes("Codelä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
'ADMIN_CACHE_PERCENTS' => "Prozentual (*)",
'ADMIN_CACHE_NOTES' => "(*): Sollten bei Ihnen die Prozente unter 50% 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+) über 50% 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üs beschleunigt werden (EXPERIMENTELL!)?",
- 'ADMIN_CACHE_PATH' => "Relativer Pfad für alle Cache-Dateien zum Pfad <strong>inc</strong>",
'ADMIN_CACHE_DB_STATS_DEACTIVATED' => "Datenbank-/Cache-Statistiken sind deaktiviert. Dies ist gut für die Performance.",
));
'ADMIN_OPTION_SHOW_POINTS_UNCONFIRMED' => "{?POINTS?} in unbestätige Mails im Mitgliedsbereich anzeigen?",
'ADMIN_OPTION_MINIMUM_AGE' => "Ab welchem Mindestalter dü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ü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ür Performancemessungen vorraussetzend.",
));
// [EOF]
--- /dev/null
+<?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]
+?>
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');
$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"';
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='') {
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...
// 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();
// 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)) {
// 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]
?>
+++ /dev/null
-<!-- @DEPRECATED //-->
</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--}" />
+++ /dev/null
-<!-- @DEPRECATED //-->
+++ /dev/null
-<!-- @DEPRECATED //-->
+++ /dev/null
-<!-- @DEPRECATED //-->
+++ /dev/null
-<!-- @DEPRECATED //-->