Bläddra i källkod

Fixing translations

svalavuo 6 dagar sedan
förälder
incheckning
20540324e9
6 ändrade filer med 64 tillägg och 6 borttagningar
  1. 3 3
      admin/login.php
  2. 32 0
      includes/config.php
  3. 2 3
      includes/translation.php
  4. 2 0
      languages/en.php
  5. 3 0
      languages/fi.php
  6. 22 0
      test_switcher.php

+ 3 - 3
admin/login.php

@@ -60,9 +60,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
             
             <?php if (LDAP_ENABLED): ?>
                 <div class="auth-info">
-                    <p class="ldap-notice">
-                        <strong><?php echo t('admin_login_ldap_enabled'); ?></strong><br>
-                        <?php echo t('admin_login_ldap_notice'); ?>
+                    <p class="auth-notice">
+                        <strong><?php echo t('admin_login_mixed_auth'); ?></strong><br>
+                        <?php echo t('admin_login_mixed_auth_notice'); ?>
                     </p>
                 </div>
             <?php endif; ?>

+ 32 - 0
includes/config.php

@@ -0,0 +1,32 @@
+<?php
+/**
+ * Site Configuration
+ */
+
+// Database settings
+define('DB_HOST', 'localhost');
+define('DB_NAME', 'website');
+define('DB_USER', 'root');
+define('DB_PASS', '');
+
+// Site settings
+define('SITE_TITLE', 'Publication System');
+define('DEFAULT_LANGUAGE', 'en');
+
+// LDAP settings
+define('LDAP_ENABLED', false);
+define('LDAP_HOST', 'localhost');
+define('LDAP_PORT', 389);
+define('LDAP_BASE_DN', 'dc=example,dc=com');
+define('LDAP_BIND_DN', 'cn=admin,dc=example,dc=com');
+define('LDAP_BIND_PASS', '');
+define('LDAP_USER_FILTER', '(objectClass=person)');
+
+// Security settings
+define('SESSION_LIFETIME', 3600); // 1 hour
+define('PASSWORD_MIN_LENGTH', 8);
+
+// Error reporting
+error_reporting(E_ALL);
+ini_set('display_errors', 1);
+?>

+ 2 - 3
includes/translation.php

@@ -120,9 +120,8 @@ class Translation {
         $switcher .= '<span class="language-label">' . $this->translate('language') . ':</span>';
         
         foreach ($this->supportedLanguages as $code => $name) {
-            $url = $currentPath;
-            $separator = strpos($url, '?') !== false ? '&' : '?';
-            $switcherUrl = $url . $separator . 'lang=' . $code;
+            $separator = strpos($currentPath, '?') !== false ? '&' : '?';
+            $switcherUrl = $currentPath . $separator . 'lang=' . $code;
             
             $class = $code === $this->currentLanguage ? 'active' : '';
             $switcher .= '<a href="' . htmlspecialchars($switcherUrl) . '" class="language-link ' . $class . '">' . $name . '</a>';

+ 2 - 0
languages/en.php

@@ -203,6 +203,8 @@ return [
     'admin_login_error_invalid' => 'Invalid username or password',
     'admin_login_ldap_enabled' => 'LDAP Authentication Enabled',
     'admin_login_ldap_notice' => 'Please login with your directory credentials.',
+    'admin_login_mixed_auth' => 'Mixed Authentication Enabled',
+    'admin_login_mixed_auth_notice' => 'Both local accounts and LDAP directory authentication are supported. Login with your preferred method.',
     'admin_login_username' => 'Username:',
     'admin_login_username_ldap' => 'Directory Username:',
     'admin_login_username_placeholder' => 'Enter username',

+ 3 - 0
languages/fi.php

@@ -39,6 +39,7 @@ return [
     'nav_dashboard' => 'Kojelauta',
     'nav_publications' => 'Julkaisut',
     'nav_ldap_users' => 'LDAP-käyttäjät',
+    'nav_users' => 'Käyttäjähallinta',
     
     // Public Site
     'site_title' => 'Verkkojulkaisujärjestelmä',
@@ -203,6 +204,8 @@ return [
     'admin_login_error_invalid' => 'Virheellinen käyttäjätunnus tai salasana',
     'admin_login_ldap_enabled' => 'LDAP-todennus käytössä',
     'admin_login_ldap_notice' => 'Kirjaudu sisään hakemistunnuksillasi.',
+    'admin_login_mixed_auth' => 'Sekatodennus käytössä',
+    'admin_login_mixed_auth_notice' => 'Sekä paikalliset tilit että LDAP-hakemistotodennus ovat tuettuja. Kirjaudu sisään haluamallasi tavalla.',
     'admin_login_username' => 'Käyttäjätunnus:',
     'admin_login_username_ldap' => 'Hakemiskäyttäjätunnus:',
     'admin_login_username_placeholder' => 'Syötä käyttäjätunnus',

+ 22 - 0
test_switcher.php

@@ -0,0 +1,22 @@
+<?php
+session_start();
+require_once 'includes/config.php';
+require_once 'includes/translation.php';
+
+$translation = Translation::getInstance();
+
+echo "Current language: " . $translation->getCurrentLanguage() . "\n";
+echo "Supported languages: " . implode(', ', array_keys($translation->getSupportedLanguages())) . "\n\n";
+
+echo "Language switcher HTML:\n";
+echo $translation->getLanguageSwitcher('test.php') . "\n\n";
+
+// Test URL generation
+echo "Testing URL generation:\n";
+foreach (['en', 'fi'] as $lang) {
+    $url = 'test.php';
+    $separator = strpos($url, '?') !== false ? '&' : '?';
+    $switcherUrl = $url . $separator . 'lang=' . $lang;
+    echo "Language $lang: $switcherUrl\n";
+}
+?>