Verzeichnisstruktur phpBB-3.0.0


Veröffentlicht
12.12.2007

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

lang_duplicates.php

Zuletzt modifiziert: 09.10.2024, 12:50 - Dateigröße: 3.16 KiB


 001  <html>
 002      <head>
 003          <title>Duplicate Language Keys</title>
 004      </head>
 005      <body>
 006  <?php
 007  //
 008  // Security message:
 009  //
 010  // This script is potentially dangerous.
 011  // Remove or comment the next line (die(".... ) to enable this script.
 012  // Do NOT FORGET to either remove this script or disable it after you have used it.
 013  //
 014  die("Please read the first lines of this script for instructions on how to enable it");
 015   
 016  // -------------------------------------------------------------
 017  //
 018  // $Id$
 019  //
 020  // @copyright (c) 2005 phpBB Group 
 021  // @license http://opensource.org/licenses/gpl-license.php GNU Public License 
 022  // 
 023  // -------------------------------------------------------------
 024  // Thanks to arod-1
 025   
 026  define('IN_PHPBB', 1);
 027  $phpEx = substr(strrchr(__FILE__, '.'), 1);
 028  $phpbb_root_path='./../';
 029  include($phpbb_root_path . 'common.'.$phpEx);
 030   
 031  $mode = request_var('mode', '');
 032   
 033  $modules = find_modules($phpbb_root_path . 'language/en');
 034   
 035  $kkeys = $keys = array();
 036  $langdir = dirname(__FILE__);
 037   
 038  if (isset($lang))
 039  {
 040      unset($lang);
 041  }
 042   
 043  foreach($modules as $module)
 044  {
 045      require_once("$langdir$module");
 046      if (isset($lang))
 047      {
 048          $kkeys[$module] = $lang;
 049          $keys[] = $module;
 050          unset($lang);
 051      }
 052  }
 053   
 054  $equal = $case = $diff = 0;
 055  $output = array();
 056   
 057  while ($module = array_shift($keys))
 058  {
 059      $keys_1 = array_keys($kkeys[$module]);
 060   
 061      foreach ($keys as $other_module)
 062      {
 063          $keys_2 = array_keys($kkeys[$other_module]);
 064   
 065          foreach(array_intersect($keys_1, $keys_2) as $dup)
 066          {
 067              if ($kkeys[$module][$dup] == $kkeys[$other_module][$dup])
 068              {
 069                  $compare = "Equal";
 070                  $equal++;
 071              }
 072              else if (strcasecmp($kkeys[$module][$dup], $kkeys[$other_module][$dup]) == 0)
 073              {
 074                  $compare = "Differ in case";
 075                  $case++;
 076              }
 077              else
 078              {
 079                  $compare = "'{$kkeys[$module][$dup]}' - '{$kkeys[$other_module][$dup]}'";
 080                  $diff++;
 081              }
 082   
 083              $color = '';
 084              if ((basename($module) == "common.$phpEx") || (basename($other_module) == "common.$phpEx"))
 085              {
 086                  $color = ' style="color:#B00000;"';
 087              }
 088   
 089              switch ($mode)
 090              {
 091                  case 'module':
 092                      $output[$module][] = "<tr$color><td>" . ((isset($output[$module])) ? '&nbsp;' : "<b>$module</b>" ) . "</td><td>$dup</td><td>$other_module</td><td>$compare</td></tr>";
 093                  break;
 094   
 095                  default:
 096                      $output[$dup][] = "<tr$color><td><b>$dup</b></td><td>$module</td><td>$other_module</td><td>$compare</td></tr>";
 097                  break;
 098              }
 099          }
 100      }
 101  }//var_dump($output);
 102   
 103  echo "<p><a href=\"lang_duplicates.php\">By Key</a> <a href=\"lang_duplicates.php?mode=module\">By Module</a></p><p>Equal: <b>$equal</b>, Differ in case only: $case, differ in content: $diff</p>";
 104  switch ($mode)
 105  {
 106      case 'module':
 107          echo "<table cellpadding=\"4\"><tr><th>Key</th><th>First File</th><th>Second File</th><th>Difference</th></tr>";
 108          foreach ($output as $module => $html)
 109          {
 110              echo implode('', $html);
 111          }
 112      break;
 113   
 114      default:
 115          ksort($output);
 116          echo "<table cellpadding=\"4\"><tr><th>File</th><th>Key</th><th>Conflicting File</th><th>Difference</th></tr>";
 117          foreach ($output as $dup)
 118          {
 119              echo implode('', $dup);
 120          }
 121      break;
 122  }
 123   
 124  echo "</table>";
 125   
 126   
 127  function find_modules($dirname)
 128  {
 129      $list = glob("$dirname/*.php");
 130   
 131      foreach(glob("$dirname/*", GLOB_ONLYDIR) as $name)
 132      {
 133          $list =  array_merge($list, find_modules($name));
 134      }
 135      return $list;
 136  }
 137   
 138  ?>
 139      </body>
 140  </html>