define('SERVER_URL', "http://www.mxchange.org");
// Current SVN revision
-define('CURR_SVN_REVISION', "652");
+define('CURR_SVN_REVISION', "653");
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
// Registeres an extension and possible update depencies
function EXTENSION_REGISTER ($ext_name, $task_id, $dry_run = false, $logout = true) {
- global $UPDATE_NOTES, $_CONFIG, $INC_POOL, $cacheInstance;
+ global $UPDATE_NOTES, $INC_POOL, $cacheInstance;
global $EXT_VER_HISTORY, $NOTES, $EXT_ALWAYS_ACTIVE, $EXT_VERSION;
- global $EXT_UPDATE_DEPENDS;
+ global $EXT_UPDATE_DEPENDS, $SQLs;
// This shall never do a non-admin user!
if (!IS_ADMIN()) return false;
// Run SQL queries for given extension id
// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
function EXTENSION_RUN_SQLS ($ext_id, $load_mode) {
- global $cacheInstance, $_CONFIG;
+ global $cacheInstance, $SQLs;
// This shall never do a non-admin user!
if (!IS_ADMIN()) return false;
// Updates a given extension with current extension version to latest version
function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) {
// This shall never do a non-admin user!
- global $cacheInstance, $_CONFIG, $UPDATE_NOTES, $NOTES, $EXT_VER_HISTORY;
+ global $cacheInstance, $UPDATE_NOTES, $NOTES, $EXT_VER_HISTORY;
global $EXT_UPDATE_DEPENDS, $EXT_VERSION, $INC_POOL, $cacheArray;
// Init arrays
// Output verbose SQL table for extension
function EXTENSION_VERBOSE_TABLE ($queries = array(), $title = ADMIN_SQLS_EXECUTED_ON_REMOVAL, $dashed = "", $switch = false, $width = "100%") {
- global $_CONFIG, $SQLs;
+ global $SQLs;
// Are there some queries in $queries?
if (count($queries) > 0) {
$SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins DROP default_acl";
// Remove filters
- UNREGISTER_FILTER('sql_admin_extra_data', 'ADD_EXTRA_SQL_DATA', true, !$dry_run);
+ UNREGISTER_FILTER('sql_admin_extra_data', 'ADD_EXTRA_SQL_DATA', true, $dry_run);
break;
case "activate": // Do stuff when admin activates this extension
$EXT_UPDATE_DEPENDS = "sql_patches";
// Add filters
- REGISTER_FILTER('sql_admin_extra_data', 'ADD_EXTRA_SQL_DATA', false, true, !$dry_run);
+ REGISTER_FILTER('sql_admin_extra_data', 'ADD_EXTRA_SQL_DATA', false, true, $dry_run);
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Filter hinzugefügt und ist von <strong>sql_patches</strong> abhängig.";
$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', true, !$dry_run);
- UNREGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', true, !$dry_run);
- UNREGISTER_FILTER('post_extension_installed', 'CACHE_PURGE_ADMIN_MENU', true, !$dry_run);
- UNREGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', true, !$dry_run);
- UNREGISTER_FILTER('post_extension_run_sql', 'CACHE_PURGE_ADMIN_MENU', true, !$dry_run);
- UNREGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, !$dry_run);
- UNREGISTER_FILTER('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, !$dry_run);
- UNREGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, !$dry_run);
- UNREGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, !$dry_run);
- UNREGISTER_FILTER('extension_remove', 'CACHE_DESTROY_ALL', true, !$dry_run);
+ UNREGISTER_FILTER('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', true, $dry_run);
+ UNREGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', true, $dry_run);
+ UNREGISTER_FILTER('post_extension_installed', 'CACHE_PURGE_ADMIN_MENU', true, $dry_run);
+ UNREGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', true, $dry_run);
+ UNREGISTER_FILTER('post_extension_run_sql', 'CACHE_PURGE_ADMIN_MENU', true, $dry_run);
+ UNREGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, $dry_run);
+ UNREGISTER_FILTER('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, $dry_run);
+ UNREGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, $dry_run);
+ UNREGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', true, $dry_run);
+ UNREGISTER_FILTER('extension_remove', 'CACHE_DESTROY_ALL', true, $dry_run);
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', false, true, !$dry_run);
- REGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, !$dry_run);
- REGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, !$dry_run);
- REGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, !$dry_run);
- REGISTER_FILTER('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, !$dry_run);
- REGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, !$dry_run);
- REGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, !$dry_run);
- REGISTER_FILTER('extension_remove', 'CACHE_DESTROY_ALL', false, true, !$dry_run);
+ REGISTER_FILTER('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, $dry_run);
+ REGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, $dry_run);
+ REGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE', false, true, $dry_run);
+ REGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, $dry_run);
+ REGISTER_FILTER('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, $dry_run);
+ REGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, $dry_run);
+ REGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE', false, true, $dry_run);
+ REGISTER_FILTER('extension_remove', 'CACHE_DESTROY_ALL', false, true, $dry_run);
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Filter für Erweiterungsmanagement hinzugefügt.";
case "0.2.2": // SQL queries for v0.2.2
// Register the new filter
- REGISTER_FILTER('post_extension_installed', 'CACHE_PURGE_ADMIN_MENU', false, true, !$dry_run);
- REGISTER_FILTER('post_extension_run_sql', 'CACHE_PURGE_ADMIN_MENU', false, true, !$dry_run);
+ REGISTER_FILTER('post_extension_installed', 'CACHE_PURGE_ADMIN_MENU', false, true, $dry_run);
+ REGISTER_FILTER('post_extension_run_sql', 'CACHE_PURGE_ADMIN_MENU', false, true, $dry_run);
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Weitere Filter hinzugefügt.";
$SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','holiday','Urlaubsschaltung','4','Y','Y')";
// Add admin menus
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (action, what, title, sort, descr) VALUES ('holiday', NULL, 'Urlaubsmanagement','4','Hier können Sie Urlaubsschaltungen Ihrer Mitglieder auflisten oder auch wieder aufheben.')";
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (action, what, title, sort, descr) VALUES ('holiday','list_holiday','Auflisten','1','Alle Urlaubsschaltungen auflisten.')";
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (action, what, title, sort, descr) VALUES ('holiday','del_holiday','Urlaub beenden','2','Urlaubsschaltungen aufheben. Geben Sie bitte mehr als nur "Verstoss gegen unsere AGBs" ein!')";
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (action, what, title, sort, descr) VALUES ('holiday','config_holiday','Einstellungen','3','Maximale Tage für Urlaub usw. einstellen.')";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('holiday', NULL, 'Urlaubsmanagement','4','Hier können Sie Urlaubsschaltungen Ihrer Mitglieder auflisten oder auch wieder aufheben.')";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('holiday','list_holiday','Auflisten','1','Alle Urlaubsschaltungen auflisten.')";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('holiday','del_holiday','Urlaub beenden','2','Urlaubsschaltungen aufheben. Geben Sie bitte mehr als nur "Verstoss gegen unsere AGBs" ein!')";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('holiday','config_holiday','Einstellungen','3','Maximale Tage für Urlaub usw. einstellen.')";
// Remove 0 max mails per day
$SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_max_receive WHERE value='0' LIMIT 1";
$SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_guest_menu` WHERE action='online' LIMIT 1";
// Unregister filter
- UNREGISTER_FILTER('init', 'UPDATE_ONLINE_LIST', true, !$dry_run);
+ UNREGISTER_FILTER('init', 'UPDATE_ONLINE_LIST', true, $dry_run);
break;
case "activate": // Do stuff when admin activates this extension
$SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_guest_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('online',NULL,'Jetzt Online','2','Y','N')";
// Register filter
- REGISTER_FILTER('init', 'UPDATE_ONLINE_LIST', false, true, !$dry_run);
+ REGISTER_FILTER('init', 'UPDATE_ONLINE_LIST', false, true, $dry_run);
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Hinzufügen des Menüpunktes "Jetzt Online" wird nun von dieser Erweiterung erledigt. Filter hinzugefügt.";
{
case "0.1": // SQL queries for v0.1
$SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD order_max_full ENUM('ORDER','MAX') NOT NULL DEFAULT 'MAX'";
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (action, what, title, sort, descr) VALUES ('setup','config_order','Mailbuchungsseite','7','Einstellungen am Mailbuchungsformular.')";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('setup','config_order','Mailbuchungsseite','7','Einstellungen am Mailbuchungsformular.')";
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Maximale Mailbuchungen sind nun vom maximalen Empfang abhägig.";
case "0.1.1": // SQL queries for v0.1.1
$SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE what='config_order' LIMIT 1";
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (action, what, title, sort, descr) VALUES ('setup','config_order','Mailbuchungsseite','7','Einstellungen am Mailbuchungsformular.')";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('setup','config_order','Mailbuchungsseite','7','Einstellungen am Mailbuchungsformular.')";
$SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD mail_orders BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
// Update notes (these will be set as task text!)
$SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE what='rallyes' LIMIT 1";
// Unregister filter
- UNREGISTER_FILTER('extra_autopurge', 'RALLYE_EXTRA_AUTOPURGE', true, !$dry_run);
+ UNREGISTER_FILTER('extra_autopurge', 'RALLYE_EXTRA_AUTOPURGE', true, $dry_run);
break;
case "activate": // Do stuff when admin activates this extension
$EXT_UPDATE_DEPENDS = "sql_patches";
// Register filter
- REGISTER_FILTER('extra_autopurge', 'RALLYE_EXTRA_AUTOPURGE', false, true, !$dry_run);
+ REGISTER_FILTER('extra_autopurge', 'RALLYE_EXTRA_AUTOPURGE', false, true, $dry_run);
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Filter hinzugefügt und ist von <strong>sql_patches</strong> abhängig.";
$SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE what='config_removeip' LIMIT 1";
// Remove filters
- UNREGISTER_FILTER('post_youhere_line', 'ADD_ANONYMITY_NOTICE', true, !$dry_run);
+ UNREGISTER_FILTER('post_youhere_line', 'ADD_ANONYMITY_NOTICE', true, $dry_run);
break;
case "activate": // Do stuff when admin activates this extension
$EXT_UPDATE_DEPENDS = "sql_patches";
// Add filters
- REGISTER_FILTER('post_youhere_line', 'ADD_ANONYMITY_NOTICE', false, true, !$dry_run);
+ REGISTER_FILTER('post_youhere_line', 'ADD_ANONYMITY_NOTICE', false, true, $dry_run);
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Filter hinzugefügt und ist von <strong>sql_patches</strong> abhängig.";
{
case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
// SQL commands to run
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (action, what, title, sort, descr) VALUES ('repair', NULL, 'Reperaturen','7','Repariert u.a. die Kategorie-Auswahlen der Mitglieder usw.')";
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (action, what, title, sort, descr) VALUES ('repair','repair_cats','Kategorieauswahlen','1','Repariert die Kategorieauswahlen Ihrer Mitglieder.')";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('repair', NULL, 'Reperaturen','7','Repariert u.a. die Kategorie-Auswahlen der Mitglieder usw.')";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('repair','repair_cats','Kategorieauswahlen','1','Repariert die Kategorieauswahlen Ihrer Mitglieder.')";
break;
case "remove": // Do stuff when removing extension
switch ($EXT_VER)
{
case "0.1": // SQL queries for v0.1
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (action, what, title, sort, descr) VALUES ('repair','repair_amenu','Admin-Menü', 2, 'Repariert die Gewichtung des Admin-Menü-Systems')";
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (action, what, title, sort, descr) VALUES ('repair','repair_gmenu','Gast-Menü', 3, 'Repariert die Gewichtung des Gäste-Menü-Systems')";
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (action, what, title, sort, descr) VALUES ('repair','repair_mmenu','Mitglied-Menü', 4, 'Repariert die Gewichtung des Mitglieder-Menü-Systems')";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('repair','repair_amenu','Admin-Menü', 2, 'Repariert die Gewichtung des Admin-Menü-Systems')";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('repair','repair_gmenu','Gast-Menü', 3, 'Repariert die Gewichtung des Gäste-Menü-Systems')";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('repair','repair_mmenu','Mitglied-Menü', 4, 'Repariert die Gewichtung des Mitglieder-Menü-Systems')";
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Fügt ein Menüpunkt zur Reperatur der Gewichtung des Admin-Menüs hinzu.";
{
case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
// SQL commands to run
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (action, what, title, sort, descr) VALUES ('task', NULL, 'Aufgaben-Management','1','Erweitertes Aufgaben-Management zur leichten verwaltung der vom System erzeugten Aufgaben.')";
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (action, what, title, sort, descr) VALUES ('task','list_task','Aufgaben auflisten','1','Alle Ihnen zugewiesenen Aufgaben auflisten (keine Updates).')";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('task', NULL, 'Aufgaben-Management','1','Erweitertes Aufgaben-Management zur leichten verwaltung der vom System erzeugten Aufgaben.')";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('task','list_task','Aufgaben auflisten','1','Alle Ihnen zugewiesenen Aufgaben auflisten (keine Updates).')";
$SQLs[] = "UPDATE "._MYSQL_PREFIX."_task_system SET status='SOLVED' WHERE status='CLOSED'";
// Enable CSS file?
}
// "Registers" a new filter function
-function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true, $force = false, $add = true) {
+function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true, $force = false, $dry_run = false) {
global $filters, $counter;
// Extend the filter function name
} // END - if
// Shall we add it?
- if ($add) {
+ if (!$dry_run) {
// Simply add it to the array
$filters[$filterName][$filterFunction] = "Y";
$counter[$filterName][$filterFunction] = 0;
}
// "Unregisters" a filter from the given chain
-function UNREGISTER_FILTER ($filterName, $filterFunction, $force = false, $remove = true) {
+function UNREGISTER_FILTER ($filterName, $filterFunction, $force = false, $dry_run = false) {
global $filters, $counter, $loadedFilters;
// Extend the filter function name only if not loaded from database
} // END - if
// Shall we remove? (default, not while just showing an extension removal)
- if ($remove) {
+ if (!$dry_run) {
// Mark for filter removal
$filters[$filterName][$filterFunction] = "R";
unset($counter[$filterName][$filterFunction]);
// Remove cache
if (EXT_IS_ACTIVE("cache")) {
- if ($cacheInstance->loadCacheFile("admins")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("extensions")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("refdepths")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("refsystem")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("themes")) $cacheInstance->destroyCacheFile();
+ if ($cacheInstance->loadCacheFile("admins")) $cacheInstance->destroyCacheFile();
+ if ($cacheInstance->loadCacheFile("admins_acls")) $cacheInstance->destroyCacheFile();
+ if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile();
+ if ($cacheInstance->loadCacheFile("extensions")) $cacheInstance->destroyCacheFile();
+ if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
+ if ($cacheInstance->loadCacheFile("refdepths")) $cacheInstance->destroyCacheFile();
+ if ($cacheInstance->loadCacheFile("refsystem")) $cacheInstance->destroyCacheFile();
+ if ($cacheInstance->loadCacheFile("themes")) $cacheInstance->destroyCacheFile();
} // END - if
}