From adb34cea9c14bcac14030f8eb1e6ae2c3231c962 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 17 Nov 2009 02:44:47 +0000 Subject: [PATCH] Extension ext-repair extended, outdated calls DEBUG_LOG() fixed: - Extension ext-repair does now "repair", say check, for missing translation entries. This tool should be used by the translation maintainer to find all missing language strings. - Old calles of DEBUG_LOG() fixed to logDebugMessage() --- .gitattributes | 5 + inc/extensions/ext-active.php | 2 +- inc/extensions/ext-admins.php | 2 +- inc/extensions/ext-admintheme1.php | 2 +- inc/extensions/ext-admintheme_default.php | 2 +- inc/extensions/ext-autopurge.php | 2 +- inc/extensions/ext-autoreg.php | 2 +- inc/extensions/ext-bank.php | 2 +- inc/extensions/ext-beg.php | 2 +- inc/extensions/ext-birthday.php | 2 +- inc/extensions/ext-bonus.php | 2 +- inc/extensions/ext-booking.php | 2 +- inc/extensions/ext-cache.php | 2 +- inc/extensions/ext-country.php | 2 +- inc/extensions/ext-debug.php | 2 +- inc/extensions/ext-demo.php | 2 +- inc/extensions/ext-doubler.php | 2 +- inc/extensions/ext-events.php | 2 +- inc/extensions/ext-holiday.php | 2 +- inc/extensions/ext-html_mail.php | 2 +- inc/extensions/ext-imprint.php | 2 +- inc/extensions/ext-iso3166.php | 2 +- inc/extensions/ext-jackpot.php | 2 +- inc/extensions/ext-lead.php | 2 +- inc/extensions/ext-logs.php | 2 +- inc/extensions/ext-mailid.php | 2 +- inc/extensions/ext-maintenance.php | 2 +- inc/extensions/ext-mediadata.php | 2 +- inc/extensions/ext-menu.php | 2 +- inc/extensions/ext-mods.php | 2 +- inc/extensions/ext-mydata.php | 2 +- inc/extensions/ext-network.php | 2 +- inc/extensions/ext-newsletter.php | 2 +- inc/extensions/ext-nickname.php | 2 +- inc/extensions/ext-online.php | 2 +- inc/extensions/ext-optimize.php | 2 +- inc/extensions/ext-order.php | 2 +- inc/extensions/ext-other.php | 2 +- inc/extensions/ext-payout.php | 2 +- inc/extensions/ext-politician-stop.php | 2 +- inc/extensions/ext-primera.php | 2 +- inc/extensions/ext-profile.php | 2 +- inc/extensions/ext-rallye.php | 2 +- inc/extensions/ext-refback.php | 2 +- inc/extensions/ext-refsell.php | 2 +- inc/extensions/ext-register.php | 2 +- inc/extensions/ext-removeip.php | 2 +- inc/extensions/ext-repair.php | 15 +- inc/extensions/ext-rewrite.php | 2 +- inc/extensions/ext-safe.php | 2 +- inc/extensions/ext-seo.php | 2 +- inc/extensions/ext-sponsor.php | 2 +- inc/extensions/ext-sql_patches.php | 2 +- inc/extensions/ext-support.php | 2 +- inc/extensions/ext-surfbar.php | 2 +- inc/extensions/ext-task.php | 2 +- inc/extensions/ext-theme.php | 2 +- inc/extensions/ext-top10.php | 2 +- inc/extensions/ext-transfer.php | 2 +- inc/extensions/ext-uberwach.php | 2 +- inc/extensions/ext-update.php | 2 +- inc/extensions/ext-usage.php | 2 +- inc/extensions/ext-user.php | 2 +- inc/extensions/ext-wernis.php | 2 +- inc/extensions/ext-yoomedia.php | 2 +- inc/functions.php | 8 +- inc/language-functions.php | 137 ++++++++++++++--- inc/language/repair_de.php | 2 + inc/modules/admin/what-repair_lang.php | 144 ++++++++++++++++++ templates/de/html/admin/admin_repair_lang.tpl | 16 ++ .../html/admin/admin_repair_lang_row_404.tpl | 6 + .../admin/admin_repair_lang_row_compares.tpl | 5 + .../html/admin/admin_repair_lang_row_diff.tpl | 9 ++ 73 files changed, 386 insertions(+), 87 deletions(-) create mode 100644 inc/modules/admin/what-repair_lang.php create mode 100644 templates/de/html/admin/admin_repair_lang.tpl create mode 100644 templates/de/html/admin/admin_repair_lang_row_404.tpl create mode 100644 templates/de/html/admin/admin_repair_lang_row_compares.tpl create mode 100644 templates/de/html/admin/admin_repair_lang_row_diff.tpl diff --git a/.gitattributes b/.gitattributes index 957cbfa04b..49162ca513 100644 --- a/.gitattributes +++ b/.gitattributes @@ -463,6 +463,7 @@ inc/modules/admin/what-refbanner.php -text inc/modules/admin/what-repair_amnu.php -text inc/modules/admin/what-repair_cats.php -text inc/modules/admin/what-repair_gmnu.php -text +inc/modules/admin/what-repair_lang.php -text inc/modules/admin/what-repair_mmnu.php -text inc/modules/admin/what-send_bonus.php -text inc/modules/admin/what-send_newsletter.php -text @@ -1202,6 +1203,10 @@ templates/de/html/admin/admin_refbanner_edit.tpl -text templates/de/html/admin/admin_refbanner_edit_row.tpl -text templates/de/html/admin/admin_refbanner_row.tpl -text templates/de/html/admin/admin_reg_form.tpl -text +templates/de/html/admin/admin_repair_lang.tpl -text +templates/de/html/admin/admin_repair_lang_row_404.tpl -text +templates/de/html/admin/admin_repair_lang_row_compares.tpl -text +templates/de/html/admin/admin_repair_lang_row_diff.tpl -text templates/de/html/admin/admin_reset_pass_done.tpl -text templates/de/html/admin/admin_reset_password.tpl -text templates/de/html/admin/admin_reset_password_form.tpl -text diff --git a/inc/extensions/ext-active.php b/inc/extensions/ext-active.php index 44627a50c4..7a95bcfc7e 100644 --- a/inc/extensions/ext-active.php +++ b/inc/extensions/ext-active.php @@ -140,7 +140,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-admins.php b/inc/extensions/ext-admins.php index eb89aa7207..733922c5ff 100644 --- a/inc/extensions/ext-admins.php +++ b/inc/extensions/ext-admins.php @@ -321,7 +321,7 @@ PRIMARY KEY (id) break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } // END - switch diff --git a/inc/extensions/ext-admintheme1.php b/inc/extensions/ext-admintheme1.php index 651ad2df0d..690708f255 100644 --- a/inc/extensions/ext-admintheme1.php +++ b/inc/extensions/ext-admintheme1.php @@ -90,7 +90,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-admintheme_default.php b/inc/extensions/ext-admintheme_default.php index 5edd71109e..aaf78b82fc 100644 --- a/inc/extensions/ext-admintheme_default.php +++ b/inc/extensions/ext-admintheme_default.php @@ -90,7 +90,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-autopurge.php b/inc/extensions/ext-autopurge.php index f8781bb897..49cd3b9d0a 100644 --- a/inc/extensions/ext-autopurge.php +++ b/inc/extensions/ext-autopurge.php @@ -260,7 +260,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-autoreg.php b/inc/extensions/ext-autoreg.php index 3937c93ea5..72cd71f07f 100644 --- a/inc/extensions/ext-autoreg.php +++ b/inc/extensions/ext-autoreg.php @@ -88,7 +88,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } // END - switch diff --git a/inc/extensions/ext-bank.php b/inc/extensions/ext-bank.php index a464ee2b08..73b7551c13 100644 --- a/inc/extensions/ext-bank.php +++ b/inc/extensions/ext-bank.php @@ -196,7 +196,7 @@ UNIQUE (account_id, tan) break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-beg.php b/inc/extensions/ext-beg.php index 7bcc4bb74a..1a4db61260 100644 --- a/inc/extensions/ext-beg.php +++ b/inc/extensions/ext-beg.php @@ -277,7 +277,7 @@ PRIMARY KEY (id) break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-birthday.php b/inc/extensions/ext-birthday.php index bc62f14f62..d83aedbc72 100644 --- a/inc/extensions/ext-birthday.php +++ b/inc/extensions/ext-birthday.php @@ -198,7 +198,7 @@ CHANGE `birth_year` `birth_year` SMALLINT(4) UNSIGNED ZEROFILL NOT NULL DEFAULT break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index ef0873492b..d1b7ead347 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -581,7 +581,7 @@ WHERE `last_online` < ".$mark." ORDER BY `userid` ASC"); break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } // END - switch diff --git a/inc/extensions/ext-booking.php b/inc/extensions/ext-booking.php index 6c4ab65bee..2df2bfc5b1 100644 --- a/inc/extensions/ext-booking.php +++ b/inc/extensions/ext-booking.php @@ -120,7 +120,7 @@ PRIMARY KEY (`id`) break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-cache.php b/inc/extensions/ext-cache.php index ae81e6409f..91cbff0767 100644 --- a/inc/extensions/ext-cache.php +++ b/inc/extensions/ext-cache.php @@ -263,7 +263,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-country.php b/inc/extensions/ext-country.php index 6a33d7c23b..6877cd23ed 100644 --- a/inc/extensions/ext-country.php +++ b/inc/extensions/ext-country.php @@ -123,7 +123,7 @@ PRIMARY KEY (id) break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-debug.php b/inc/extensions/ext-debug.php index 7b626c069f..a6517cb961 100644 --- a/inc/extensions/ext-debug.php +++ b/inc/extensions/ext-debug.php @@ -181,7 +181,7 @@ PRIMARY KEY (`id`) break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-demo.php b/inc/extensions/ext-demo.php index 536e6415ac..29b6d38b0a 100644 --- a/inc/extensions/ext-demo.php +++ b/inc/extensions/ext-demo.php @@ -87,7 +87,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } // END - switch diff --git a/inc/extensions/ext-doubler.php b/inc/extensions/ext-doubler.php index f02a51e3a8..2559665326 100644 --- a/inc/extensions/ext-doubler.php +++ b/inc/extensions/ext-doubler.php @@ -243,7 +243,7 @@ PRIMARY KEY (id) break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-events.php b/inc/extensions/ext-events.php index 38187e40ac..9c2b43f4d5 100644 --- a/inc/extensions/ext-events.php +++ b/inc/extensions/ext-events.php @@ -89,7 +89,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } // END - switch diff --git a/inc/extensions/ext-holiday.php b/inc/extensions/ext-holiday.php index 277d9b3368..7373dac0b9 100644 --- a/inc/extensions/ext-holiday.php +++ b/inc/extensions/ext-holiday.php @@ -232,7 +232,7 @@ PRIMARY KEY (id) break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-html_mail.php b/inc/extensions/ext-html_mail.php index 1be1b97ab9..4ac826b753 100644 --- a/inc/extensions/ext-html_mail.php +++ b/inc/extensions/ext-html_mail.php @@ -169,7 +169,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } // END - switc diff --git a/inc/extensions/ext-imprint.php b/inc/extensions/ext-imprint.php index 2504d3101e..370cc6155c 100644 --- a/inc/extensions/ext-imprint.php +++ b/inc/extensions/ext-imprint.php @@ -119,7 +119,7 @@ PRIMARY KEY (`imprint_id`) break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } // END - switch diff --git a/inc/extensions/ext-iso3166.php b/inc/extensions/ext-iso3166.php index 2d3ccd5bf5..4ebb36da31 100644 --- a/inc/extensions/ext-iso3166.php +++ b/inc/extensions/ext-iso3166.php @@ -339,7 +339,7 @@ VALUES ('AD', 'Andorra', 'ext-iso3166'), break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-jackpot.php b/inc/extensions/ext-jackpot.php index 0c8ecb22c3..675197f236 100644 --- a/inc/extensions/ext-jackpot.php +++ b/inc/extensions/ext-jackpot.php @@ -88,7 +88,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } // END - switch diff --git a/inc/extensions/ext-lead.php b/inc/extensions/ext-lead.php index 4dafb665a3..26eaaf69e3 100644 --- a/inc/extensions/ext-lead.php +++ b/inc/extensions/ext-lead.php @@ -85,7 +85,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } // END - switch diff --git a/inc/extensions/ext-logs.php b/inc/extensions/ext-logs.php index 298cb80f75..c8e6d3d4c4 100644 --- a/inc/extensions/ext-logs.php +++ b/inc/extensions/ext-logs.php @@ -88,7 +88,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-mailid.php b/inc/extensions/ext-mailid.php index 69b9829583..d75c8a7906 100644 --- a/inc/extensions/ext-mailid.php +++ b/inc/extensions/ext-mailid.php @@ -242,7 +242,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-maintenance.php b/inc/extensions/ext-maintenance.php index 11e632d097..15decb690f 100644 --- a/inc/extensions/ext-maintenance.php +++ b/inc/extensions/ext-maintenance.php @@ -117,7 +117,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-mediadata.php b/inc/extensions/ext-mediadata.php index 8387f5a818..b7af7fa6ca 100644 --- a/inc/extensions/ext-mediadata.php +++ b/inc/extensions/ext-mediadata.php @@ -158,7 +158,7 @@ Bitte stellen Sie diesen derzeit manuell unter ext-menu konfliktieren"); break; + + case '0.1.7': // SQL queries for v0.1.7 + addAdminMenuSql('repair','repair_lang','Sprachsystem', 'Findet nicht übersetzte Sprachelemente in allen Scripten. Dies kann eventuell sehr lange dauern. Haben Sie bitte solange Geduld.',5); + + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Sprachdateien sind nun auch "reparierbar" - nicht durch das Script, das findet nur die nicht übersetzten Zeichenketten, sondern durch den Menschen."); + break; } // END - switch break; @@ -126,7 +133,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } // END - switch diff --git a/inc/extensions/ext-rewrite.php b/inc/extensions/ext-rewrite.php index f58835d42f..ebcecaa261 100644 --- a/inc/extensions/ext-rewrite.php +++ b/inc/extensions/ext-rewrite.php @@ -173,7 +173,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-safe.php b/inc/extensions/ext-safe.php index 383052a3ff..52115fe3af 100644 --- a/inc/extensions/ext-safe.php +++ b/inc/extensions/ext-safe.php @@ -89,7 +89,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-seo.php b/inc/extensions/ext-seo.php index 2ceb6309b6..c6330442d8 100644 --- a/inc/extensions/ext-seo.php +++ b/inc/extensions/ext-seo.php @@ -88,7 +88,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } // END - switch diff --git a/inc/extensions/ext-sponsor.php b/inc/extensions/ext-sponsor.php index bf6acb0a23..83398707be 100644 --- a/inc/extensions/ext-sponsor.php +++ b/inc/extensions/ext-sponsor.php @@ -429,7 +429,7 @@ PRIMARY KEY (`id`) break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index b9e699e5c3..93a02253f1 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -789,7 +789,7 @@ CHANGE `what` `what` VARCHAR(50) NULL DEFAULT NULL'); break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } // END - switch diff --git a/inc/extensions/ext-support.php b/inc/extensions/ext-support.php index 5b1862147c..ba7ba5f29d 100644 --- a/inc/extensions/ext-support.php +++ b/inc/extensions/ext-support.php @@ -137,7 +137,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } // END - switch diff --git a/inc/extensions/ext-surfbar.php b/inc/extensions/ext-surfbar.php index 59f2840a2d..93325f02dc 100644 --- a/inc/extensions/ext-surfbar.php +++ b/inc/extensions/ext-surfbar.php @@ -239,7 +239,7 @@ UNIQUE KEY `status_action` (`status`,`action`) break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } // END - switch diff --git a/inc/extensions/ext-task.php b/inc/extensions/ext-task.php index c3a8395205..e833c702d7 100644 --- a/inc/extensions/ext-task.php +++ b/inc/extensions/ext-task.php @@ -258,7 +258,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-theme.php b/inc/extensions/ext-theme.php index 2bd7f8182d..e0f8236a16 100644 --- a/inc/extensions/ext-theme.php +++ b/inc/extensions/ext-theme.php @@ -189,7 +189,7 @@ INDEX (`theme_active`) break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } // END - switch diff --git a/inc/extensions/ext-top10.php b/inc/extensions/ext-top10.php index f6d929daef..94a2ed82cf 100644 --- a/inc/extensions/ext-top10.php +++ b/inc/extensions/ext-top10.php @@ -145,7 +145,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-transfer.php b/inc/extensions/ext-transfer.php index c10bcfa830..4438034fe6 100644 --- a/inc/extensions/ext-transfer.php +++ b/inc/extensions/ext-transfer.php @@ -289,7 +289,7 @@ PRIMARY KEY (id) break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-uberwach.php b/inc/extensions/ext-uberwach.php index b7c1abc0a7..08e1b3f37d 100644 --- a/inc/extensions/ext-uberwach.php +++ b/inc/extensions/ext-uberwach.php @@ -94,7 +94,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } // END - switch diff --git a/inc/extensions/ext-update.php b/inc/extensions/ext-update.php index 1bb1f21453..0dca1a05b5 100644 --- a/inc/extensions/ext-update.php +++ b/inc/extensions/ext-update.php @@ -89,7 +89,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } // END - switch diff --git a/inc/extensions/ext-usage.php b/inc/extensions/ext-usage.php index 230400b291..cfbfd96afe 100644 --- a/inc/extensions/ext-usage.php +++ b/inc/extensions/ext-usage.php @@ -88,7 +88,7 @@ switch (getExtensionMode()) { break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-user.php b/inc/extensions/ext-user.php index 2e03a8c37c..7516653cfc 100644 --- a/inc/extensions/ext-user.php +++ b/inc/extensions/ext-user.php @@ -380,7 +380,7 @@ PRIMARY KEY (`id`) break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-wernis.php b/inc/extensions/ext-wernis.php index 167319f637..ba4c11ade0 100644 --- a/inc/extensions/ext-wernis.php +++ b/inc/extensions/ext-wernis.php @@ -150,7 +150,7 @@ PRIMARY KEY (id) break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/extensions/ext-yoomedia.php b/inc/extensions/ext-yoomedia.php index 420ab3cd5a..0766df1be0 100644 --- a/inc/extensions/ext-yoomedia.php +++ b/inc/extensions/ext-yoomedia.php @@ -146,7 +146,7 @@ UNIQUE `y_type` (`type`,`y_id`) break; default: // Unknown extension mode - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); break; } diff --git a/inc/functions.php b/inc/functions.php index 77065f95dc..3377256d43 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -3309,7 +3309,7 @@ function generateExtensionInactiveNotInstalledMessage ($ext_name) { // Reads a directory recursively by default and searches for files not matching // an exclusion pattern. You can now keep the exclusion pattern empty for reading // a whole directory. -function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $addBaseDir = true, $excludeArray = array(), $extension = '.php', $excludePattern = '@(\.|\.\.)$@', $recursive = true) { +function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $addBaseDir = true, $excludeArray = array(), $extension = '.php', $excludePattern = '@(\.|\.\.)$@', $recursive = true, $suffix = '') { // Add default entries we should exclude $excludeArray[] = '.'; $excludeArray[] = '..'; @@ -3361,6 +3361,10 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $ad // Skip this file //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "Invalid prefix in file " . $baseFile . ", prefix=" . $prefix); continue; + } elseif ((!empty($suffix)) && (substr($baseFile, -(strlen($suffix . $extension)), (strlen($suffix . $extension))) != $suffix . $extension)) { + // Skip wrong suffix as well + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "Invalid suffix in file " . $baseFile . ", suffix=" . $suffix); + continue; } elseif (!isFileReadable($FQFN)) { // Not readable so skip it //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "File " . $FQFN . " is not readable!"); @@ -3403,7 +3407,7 @@ function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $ad closedir($dirPointer); // Sort array - asort($files); + sort($files); // Return array with include files //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '- Left!'); diff --git a/inc/language-functions.php b/inc/language-functions.php index 906a78dc97..0de23e3d2d 100644 --- a/inc/language-functions.php +++ b/inc/language-functions.php @@ -50,7 +50,7 @@ function getMessage ($messageId) { // Is the language string found? if (isMessageIdValid($messageId)) { // Language array element found in small_letters - $return = $GLOBALS['messages'][$messageId]; + $return = $GLOBALS['messages'][getCurrentLanguage()][$messageId]; } else { // Missing language constant logDebugMessage(__FUNCTION__, __LINE__, sprintf("Missing message string %s detected.", $messageId)); @@ -62,25 +62,40 @@ function getMessage ($messageId) { // Init messages function initMessages () { - $GLOBALS['messages'] = array(); + $GLOBALS['messages'][getLanguage()] = array(); } -// Add message +// Add messages function addMessages ($messages) { // Merge both - $GLOBALS['messages'] = merge_array($GLOBALS['messages'], $messages); + $GLOBALS['messages'][getCurrentLanguage()] = merge_array($GLOBALS['messages'][getCurrentLanguage()], $messages); + + // Don't count them if we don't want it + if (isset($GLOBALS['count'])) return; + + // And count them + if (isset($GLOBALS['msg_count'][getCurrentLanguage()])) { + $GLOBALS['msg_count'][getCurrentLanguage()] += count($messages); + } else { + $GLOBALS['msg_count'][getCurrentLanguage()] = count($messages); + } } // Checks wether given message id is valid function isMessageIdValid ($messageId) { - return (isset($GLOBALS['messages'][$messageId])); + return (isset($GLOBALS['messages'][getCurrentLanguage()][$messageId])); } -// "Getter for current language +// Getter for current language function getCurrentLanguage () { return $GLOBALS['language']; } +// Setter for current language +function setCurrentLanguage ($language) { + $GLOBALS['language'] = (string) $language; +} + // "Getter" for language function getLanguage () { // Default is 'de'. DO NOT CHANGE THIS!!! @@ -89,22 +104,13 @@ function getLanguage () { // Set default return value to default language from config if (isConfigEntrySet('DEFAULT_LANG')) $ret = getConfig('DEFAULT_LANG'); - // Init variable - $lang = ''; - // Is the variable set if (isGetRequestElementSet('mx_lang')) { // Accept only first 2 chars - $lang = substr(getRequestElement('mx_lang'), 0, 2); + $ret = substr(getRequestElement('mx_lang'), 0, 2); } elseif (isset($GLOBALS['language'])) { // Use cached $ret = getCurrentLanguage(); - } elseif (!empty($lang)) { - // Check if main language file does exist - if (isIncludeReadable('inc/language/' . $lang . '.php')) { - // Okay found, so let's update cookies - setLanguage($lang); - } // END - if } elseif (isSessionVariableSet('mx_lang')) { // Return stored value from cookie $ret = getSession('mx_lang'); @@ -114,7 +120,7 @@ function getLanguage () { } // Cache entry - $GLOBALS['language'] = $ret; + setCurrentLanguage($ret); // Return value return $ret; @@ -213,9 +219,104 @@ function loadLanguageInclude ($ext_name = 'none') { loadIncludeOnce($languageInclude); } else { // Not readable! - DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Language file %s not found or readable.", $languageInclude)); + logDebugMessage(__FUNCTION__, __LINE__, sprintf("Language file %s not found or readable.", $languageInclude)); } } +// Getter for an array of valid languages with no except by default +function getValidLanguages ($except = '') { + // @TODO These are all valid languages, again hard-coded + $langs = array('de' => 'de', 'en' => 'en'); + + // Should we keep one out? + if (!empty($except)) { + // Remove this + unset($langs[$except]); + } // END - if + + // Return the array + return $langs; +} + +// Compares two language files +function ifLanguageFilesCompares ($source, $target, $targetLanguage) { + // Init differences + $GLOBALS['lang_diff'][$target] = array(); + $GLOBALS['lang_diff_count'][$target] = 0; + if (!isset($GLOBALS['lang_diff_count']['total'])) $GLOBALS['lang_diff_count']['total'] = 0; + + // *Does* match by default + $matches = true; + + // Is one not readable? + if (!isIncludeReadable($source)) { + // Please report this bug! + debug_report_bug(__FUNCTION__ . ': Source file ' . $source . ' is not readable.'); + } elseif (!isIncludeReadable($target)) { + // Please report this bug! + debug_report_bug(__FUNCTION__ . ': Target file ' . $target . ' is not readable.'); + } elseif ($targetLanguage == getCurrentLanguage()) { + // Must be different + debug_report_bug(__FUNCTION__ . ': Target language ' . $targetLanguage . ' is same as current.'); + } + + // Backup current messages/language + $backupLang = getCurrentLanguage(); + $messages[$backupLang] = $GLOBALS['messages'][$backupLang]; + $GLOBALS['messages'][$backupLang] = array(); + + // Both are readable so include current language file + $GLOBALS['count'] = false; + loadInclude($source); + $GLOBALS['msgs'][$source] = $GLOBALS['messages'][$backupLang]; + unset($GLOBALS['count']); + + // Set target language + setCurrentLanguage($targetLanguage); + + // Do we have an array? + if (!isset($GLOBALS['messages'][$targetLanguage])) { + // Then create it to avoid notice + $GLOBALS['messages'][$targetLanguage] = array(); + $GLOBALS['msg_count'][$targetLanguage] = 0; + } // END - if + + // Load target language file + loadInclude($target); + $GLOBALS['msgs'][$target] = $GLOBALS['messages'][$targetLanguage]; + + // Set backup back + setCurrentLanguage($backupLang); + $GLOBALS['messages'][$backupLang] = $messages[$backupLang]; + unset($messages[$backupLang]); + + // Do they mismatch? + if ((count($GLOBALS['msgs'][$source])) != (count($GLOBALS['msgs'][$target]))) { + // Does not match + $matches = false; + + // Check all differences + foreach ($GLOBALS['msgs'][$source] as $key => $value) { + // Don't we have it? + if (!isset($GLOBALS['msgs'][$target][$key])) { + // Then add is as difference + $GLOBALS['lang_diff'][$target][$key] = $value; + + // ... and count it + $GLOBALS['lang_diff_count'][$target]++; + $GLOBALS['lang_diff_count']['total']++; + } // END - if + } // END - foreach + } // END - if + + // Return result + return $matches; +} + +// Getter for getting difference of target file +function getLanguageComparisonDifference ($target) { + return $GLOBALS['lang_diff_count'][$target]; +} + // [EOF] ?> diff --git a/inc/language/repair_de.php b/inc/language/repair_de.php index 158a692986..ab7ac08c51 100644 --- a/inc/language/repair_de.php +++ b/inc/language/repair_de.php @@ -46,6 +46,8 @@ addMessages(array( 'ADMIN_REPAIR_CATS_NOTHING' => "Keine Kategorie-Auswahlenn gefunden! Vermutlich sind keine Mitglieder registriert?", 'ADMIN_REPAIR_ENTRIES_FIXED' => "Es wurden %s Einträge repariert.", 'ADMIN_REPAIR_NOTHING_FIXED' => "Es wurden keine Einträge repariert.", + 'ADMIN_REPAIR_LANGUAGE_TO_MUCH' => "Es sind mehr als 100 nicht existierende Elemente in der Zielsprachdatei gefunden worden.", + 'ADMIN_REPAIR_LANG_TITLE' => "Analyse an den Sprachdateien", )); // [EOF] diff --git a/inc/modules/admin/what-repair_lang.php b/inc/modules/admin/what-repair_lang.php new file mode 100644 index 0000000000..ab99a5ea15 --- /dev/null +++ b/inc/modules/admin/what-repair_lang.php @@ -0,0 +1,144 @@ + $langFile, + 'target' => basename($INC), + 'sw' => $SW, + ); + + // Compares, all fine + $OUT .= loadTemplate('admin_repair_lang_row_compares', true, $content); + } else { + // Generate difference output only if count is smaller/equals 100 entries + $diffContent = ''; + + // Prepare content + $content = array( + 'source' => $langFile, + 'target' => basename($INC), + 'diff_count' => translateComma(getLanguageComparisonDifference($INC)), + 'diff_content' => $diffContent, + 'sw' => $SW, + ); + + // Compares, all fine + $OUT .= loadTemplate('admin_repair_lang_row_diff', true, $content); + } + } else { + // Not readable, prepare content + $content = array( + 'file' => basename($INC), + 'lang' => $lang, + 'sw' => $SW, + ); + + // Load template + $OUT .= loadTemplate('admin_repair_lang_row_404', true, $content); + } + + // Switch color + $SW = 3 - $SW; + } // END - foreach +} // END - foreach + +// Preapre content +$content = array( + 'rows' => $OUT, + 'file_count' => translateComma(count($langFiles)), + 'total_diff' => translateComma($GLOBALS['lang_diff_count']['total']), + 'total_msgs' => translateComma($GLOBALS['msg_count'][getCurrentLanguage()]), +); + +// Load main template +loadTemplate('admin_repair_lang', false, $content); + +// [EOF] +?> diff --git a/templates/de/html/admin/admin_repair_lang.tpl b/templates/de/html/admin/admin_repair_lang.tpl new file mode 100644 index 0000000000..19cbc104ce --- /dev/null +++ b/templates/de/html/admin/admin_repair_lang.tpl @@ -0,0 +1,16 @@ +
+
+
+ {--ADMIN_REPAIR_LANG_TITLE--} +
+
+ $content[rows] +
+ +
+
diff --git a/templates/de/html/admin/admin_repair_lang_row_404.tpl b/templates/de/html/admin/admin_repair_lang_row_404.tpl new file mode 100644 index 0000000000..a73a75fe80 --- /dev/null +++ b/templates/de/html/admin/admin_repair_lang_row_404.tpl @@ -0,0 +1,6 @@ +
+
+ Das Sprachpaket $content[file] (Sprache: + $content[lang]) wurde nicht gefunden. +
+
diff --git a/templates/de/html/admin/admin_repair_lang_row_compares.tpl b/templates/de/html/admin/admin_repair_lang_row_compares.tpl new file mode 100644 index 0000000000..ba86d8e772 --- /dev/null +++ b/templates/de/html/admin/admin_repair_lang_row_compares.tpl @@ -0,0 +1,5 @@ +
+
+ Das Sprachpaket $content[target] hat genau so viele Einträge wie $content[source]. +
+
diff --git a/templates/de/html/admin/admin_repair_lang_row_diff.tpl b/templates/de/html/admin/admin_repair_lang_row_diff.tpl new file mode 100644 index 0000000000..abf4688e0b --- /dev/null +++ b/templates/de/html/admin/admin_repair_lang_row_diff.tpl @@ -0,0 +1,9 @@ +
+
+ Das Sprachpaket $content[target] hat $content[diff_count] Unterschiede zu $content[source]: +
+
+ Nicht gefundene Sprachelemente: + $content[diff_content] +
+
-- 2.39.5