define('SERVER_URL', "http://www.mxchange.org");
// Current SVN revision
-define('CURR_SVN_REVISION', "636");
+define('CURR_SVN_REVISION', "637");
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
die("Cannot load database abstraction layer! R.I.P.");
}
+// Remove this globally used variable
+unset($INC);
+
//
?>
$SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE what='config_cache' OR what='cache_stats' LIMIT 2";
// Unregister all filters
- UNREGISTER_FILTER('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE');
- UNREGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE');
- UNREGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE');
- UNREGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE');
+ UNREGISTER_FILTER('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', true);
+ UNREGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', true);
+ UNREGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', true);
+ UNREGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true);
UNREGISTER_FILTER('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE');
- UNREGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE');
- UNREGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE');
+ UNREGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true);
+ UNREGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true);
break;
case "activate": // Do stuff when admin activates this extension
case "0.2.1": // SQL queries for v0.2.1
// Register the new filter
- REGISTER_FILTER('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE');
- REGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE');
- REGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE');
- REGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE');
- REGISTER_FILTER('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE');
- REGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE');
- REGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE');
+ REGISTER_FILTER('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true);
+ REGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true);
+ REGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true);
+ REGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true);
+ REGISTER_FILTER('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true);
+ REGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true);
+ REGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true);
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Filter hinzugefügt für Erweiterungsmanagement.";
case "remove": // Do stuff when removing extension
// Drop theme table
- $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_themes";
+ $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_themes`";
// Delete admin menu
$SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE `action`='theme' LIMIT 4";
// Delete guest menu entries
$SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_guest_menu` WHERE action='themes' LIMIT 1";
- // Delete/update member menu entries
+ // Delete member menu entries
$SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE action='themes' OR `what`='themes' LIMIT 2";
break;
break;
case "0.0.7": // SQL queries for v0.0.7
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_themes ADD theme_name VARCHAR(255) NOT NULL DEFAULT ''";
-
// Update notes (these will be set as task text!)
- $UPDATE_NOTES = "Designname (von Menschen lesbar) hinzugefügt.";
+ $UPDATE_NOTES = "Ungültiges Update.";
break;
case "0.0.8": // SQL queries for v0.0.8
// Theme table
- $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_themes";
- $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_themes (
+ $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_themes`";
+ $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_themes` (
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
theme_path VARCHAR(255) NOT NULL DEFAULT '',
+theme_name VARCHAR(255) NOT NULL DEFAULT '',
theme_active ENUM('Y','N') NOT NULL DEFAULT 'N',
theme_ver VARCHAR(255) NOT NULL DEFAULT '0.0',
-PRIMARY KEY(`id`),
-UNIQUE KEY(`theme_path`),
-INDEX(`theme_active`),
-) TYPE=MyISAM";
+PRIMARY KEY (`id`),
+UNIQUE KEY (`theme_path`),
+INDEX (`theme_active`)
+) TYPE=MyISAM COMMENT='Themes'";
// Admin menu
$SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme', NULL, 'Themes','Verwalten Sie hier alle Designs (Themes) Ihres Mailtausch-Scriptes.', 8)";
}
// "Registers" a new filter function
-function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true) {
+function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true, $force = false) {
global $filters;
// Extend the filter function name
$filterFunction = sprintf("FILTER_%s", strtoupper($filterFunction));
// Is that filter already there?
- if (isset($filters[$filterName][$filterFunction])) {
+ if ((isset($filters[$filterName][$filterFunction])) && (!$force)) {
// Then abort here
if (!$silentAbort) {
ADD_FATAL(sprintf(FILTER_FAILED_ALREADY_ADDED, $filterFunction, $filterName));
}
// "Unregisters" a filter from the given chain
-function UNREGISTER_FILTER ($filterName, $filterFunction) {
+function UNREGISTER_FILTER ($filterName, $filterFunction, $force = false) {
global $filters;
+ // Extend the filter function name
+ $filterFunction = sprintf("FILTER_%s", strtoupper($filterFunction));
+
// Is that filter there?
- if (!isset($filters[$filterName][$filterFunction])) {
+ if ((!isset($filters[$filterName][$filterFunction])) && (!$force)) {
// Not found, so abort here
ADD_FATAL(sprintf(FILTER_FAILED_NOT_REMOVED, $filterFunction, $filterName));
return false;
if (EXT_IS_ACTIVE("theme")) {
// List all themes
- $SQLs[] = "SELECT id FROM "._MYSQL_PREFIX."_themes ORDER BY id";
+ $SQLs[] = "SELECT id FROM `"._MYSQL_PREFIX."_themes` ORDER BY id";
$WHATs[] = "theme_edit";
$DESCRs[] = TASK_ADMIN_LIST_THEME_ALL;
$TITLEs[] = TASK_ADMIN_LIST_THEME_ALL_TITLE;
// List active themes
- $SQLs[] = "SELECT id FROM "._MYSQL_PREFIX."_themes WHERE theme_active='Y' ORDER BY id";
+ $SQLs[] = "SELECT id FROM `"._MYSQL_PREFIX."_themes` WHERE theme_active='Y' ORDER BY id";
$WHATs[] = "theme_edit";
$DESCRs[] = TASK_ADMIN_LIST_THEME_ACTIVE;
$TITLEs[] = TASK_ADMIN_LIST_THEME_ACTIVE_TITLE;
if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
} elseif (GET_EXT_VERSION("cache") != "0.1.8") {
// Load version from database
- $result = SQL_QUERY_ESC("SELECT theme_ver FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT theme_ver FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' LIMIT 1",
array($name), __FILE__, __LINE__);
// Entry found?
if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
} elseif (GET_EXT_VERSION("cache") != "0.1.8") {
// Check if current theme is already imported or not
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT id FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' LIMIT 1",
array($name), __FILE__, __LINE__);
// Entry found?
if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
} elseif (GET_EXT_VERSION("cache") != "0.1.8") {
// Check if current theme is already imported or not
- $result = SQL_QUERY_ESC("SELECT theme_active FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT theme_active FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
array($name), __FILE__, __LINE__);
// Is the theme active and installed?
if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
} elseif (GET_EXT_VERSION("cache") != "0.1.8") {
// Check if current theme is already imported or not
- $result = SQL_QUERY_ESC("SELECT theme_name FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT theme_name FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
array($name), __FILE__, __LINE__);
// Load theme name
// Load all themes and their data
if (GET_EXT_VERSION("theme") >= "0.0.7") {
- $result = SQL_QUERY("SELECT id, theme_path, theme_active, theme_ver, theme_name FROM "._MYSQL_PREFIX."_themes ORDER BY id", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT id, theme_path, theme_active, theme_ver, theme_name FROM `"._MYSQL_PREFIX."_themes` ORDER BY id", __FILE__, __LINE__);
} else {
- $result = SQL_QUERY("SELECT id, theme_path, theme_active, theme_ver FROM "._MYSQL_PREFIX."_themes ORDER BY id", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT id, theme_path, theme_active, theme_ver FROM `"._MYSQL_PREFIX."_themes` ORDER BY id", __FILE__, __LINE__);
}
while ($data = SQL_FETCHARRAY($result)) {
// Add row to cache file
if (isset($_POST['status'])) {
// Change status
if ($_POST['active'][$id] == "Y") {
- $SQL = "UPDATE "._MYSQL_PREFIX."_themes SET theme_active='N' WHERE id='".$id."' LIMIT 1";
+ $SQL = "UPDATE `"._MYSQL_PREFIX."_themes` SET theme_active='N' WHERE id='".$id."' LIMIT 1";
} else {
- $SQL = "UPDATE "._MYSQL_PREFIX."_themes SET theme_active='Y' WHERE id='".$id."' LIMIT 1";
+ $SQL = "UPDATE `"._MYSQL_PREFIX."_themes` SET theme_active='Y' WHERE id='".$id."' LIMIT 1";
}
$OUT = ADMIN_THEMES_UPDATED;
} elseif (isset($_POST['del'])) {
// Delete themes
- $SQL = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_themes WHERE id='".$id."' LIMIT 1";
+ $SQL = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_themes` WHERE id='".$id."' LIMIT 1";
$OUT = ADMIN_THEMES_DELETED;
}
// Generate output lines for the template
$OUT = ""; $SW = 2;
-$result = SQL_QUERY("SELECT id, theme_path, theme_active, theme_ver, theme_name FROM "._MYSQL_PREFIX."_themes ORDER BY theme_path", __FILE__, __LINE__);
+$result = SQL_QUERY("SELECT id, theme_path, theme_active, theme_ver, theme_name FROM `"._MYSQL_PREFIX."_themes` ORDER BY theme_path", __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0)
{
while(list($id, $unix, $active, $ver, $name) = SQL_FETCHROW($result))
// Load all active designs (or all if admin)
$whereStatement = ""; $OUT = "";
if (!IS_ADMIN()) $whereStatement = " WHERE theme_active='Y'";
-$result_themes = SQL_QUERY("SELECT theme_path FROM "._MYSQL_PREFIX."_themes".$whereStatement, __FILE__, __LINE__);
+$result_themes = SQL_QUERY("SELECT theme_path FROM `"._MYSQL_PREFIX."_themes`".$whereStatement, __FILE__, __LINE__);
$num_themes = SQL_NUMROWS($result_themes);
if ($num_themes > 1) {
// Load all active designs (or all if admin)
$whereStatement = ""; $OUT = "";
if (!IS_ADMIN()) $whereStatement = " WHERE theme_active='Y'";
-$result_themes = SQL_QUERY("SELECT theme_path FROM "._MYSQL_PREFIX."_themes".$whereStatement, __FILE__, __LINE__);
+$result_themes = SQL_QUERY("SELECT theme_path FROM `"._MYSQL_PREFIX."_themes`".$whereStatement, __FILE__, __LINE__);
$num_themes = SQL_NUMROWS($result_themes);
if ($num_themes > 1) {
// Run daily reset
require_once(PATH."inc/check-reset.php");
+ // Create missing configuration file
+ if (!function_exists('GET_CURR_THEME')) {
+ // Load dummy theme functions
+ require_once(PATH."inc/theme-dummy.php");
+ } // END - if
+
// Load admin include file if he is admin
if (IS_ADMIN()) {
// Administrative functions
require_once(PATH."inc/databases.php");
require_once(PATH."inc/session.php");
+ // Create missing configuration file
+ if (!function_exists('GET_CURR_THEME')) {
+ // Load dummy theme functions
+ require_once(PATH."inc/theme-dummy.php");
+ } // END - if
+
// Check if we are in installation routine
$installPhp = basename($_SERVER['PHP_SELF']);
if (($installPhp != "install.php") && ($CSS != "1") && ($CSS != -1)) {
foreach ($EXT_CSS_FILES as $value) $STYLES[] = $value;
} // END - if
- // Create missing configuration file
- if (!function_exists('GET_CURR_THEME')) {
- // Load dummy theme functions
- require_once(PATH."inc/theme-dummy.php");
- } // END - if
-
// Output inclusion lines
foreach ($STYLES as $value) {
// Only include found CSS files (to reduce 404 requests)