wh_table.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?php
  2. //////////////////////////////////////////////////////////////////////////
  3. //
  4. // WikiHiero - A PHP convert from text using "Manual for the encoding of
  5. // hieroglyphic texts for computer input" syntax to HTML entities (table and
  6. // images).
  7. //
  8. // Copyright (C) 2004 Guillaume Blanchard (Aoineko)
  9. //
  10. // This program is free software; you can redistribute it and/or
  11. // modify it under the terms of the GNU General Public License
  12. // as published by the Free Software Foundation; either version 2
  13. // of the License, or any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program; if not, write to the Free Software
  22. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  23. //
  24. //////////////////////////////////////////////////////////////////////////
  25. require "wh_language.php";
  26. require "wikihiero.php";
  27. #
  28. # Initialization
  29. #
  30. # Fixme ! webRequest :)
  31. if(array_key_exists("table", $_GET)) {
  32. $table = $_GET["table"];
  33. } else {
  34. $table = "All";
  35. }
  36. if(array_key_exists("lang", $_GET)) {
  37. $lang = $_GET["lang"];
  38. } else {
  39. $lang = "fr";
  40. }
  41. function WH_Text( $index ) {
  42. global $wh_language;
  43. global $lang;
  44. if(isset($wh_language[$index])) {
  45. if(isset($wh_language[$index][$lang])) {
  46. return $wh_language[$index][$lang];
  47. } else {
  48. return $wh_language[$index]["en"];
  49. }
  50. }
  51. return '';
  52. }
  53. ?>
  54. <html lang=<?php echo htmlspecialchars($lang); ?>>
  55. <head>
  56. <title><?php echo htmlspecialchars($table)." - ".WH_Text($table); ?> - WikiHiero</title>
  57. <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
  58. <link rel="shortcut icon" href="/favicon.ico">
  59. </head>
  60. <body bgcolor="#DDDDDD">
  61. <?php
  62. echo "<b>" . htmlspecialchars( $table ) . "</b> - ".WH_Text($table)."<br /><br />";
  63. if($dh = opendir(WH_IMG_DIR)) {
  64. while(($file = readdir($dh)) !== false) {
  65. if($table == "All")
  66. {
  67. $code = WH_GetCode($file);
  68. if(in_array($code, $wh_phonemes))
  69. echo "<img src=\"".htmlspecialchars( WH_IMG_DIR.$file ) . "\" " .
  70. "title=\"" . htmlspecialchars( $code ) . " [".
  71. htmlspecialchars( array_search($code, $wh_phonemes) ) . "]\">\n";
  72. else
  73. echo "<img src=\"".htmlspecialchars( WH_IMG_DIR.$file ) . "\" title=\"" .
  74. htmlspecialchars( $code ) . "\">\n";
  75. }
  76. else if($table == "Phoneme")
  77. {
  78. $code = WH_GetCode($file);
  79. if(in_array($code, $wh_phonemes))
  80. echo "<img src=\"".htmlspecialchars( WH_IMG_DIR.$file ) . "\" " .
  81. "title=\"" . htmlspecialchars( $code ) . " [".
  82. htmlspecialchars( array_search($code, $wh_phonemes) )."]\">\n";
  83. }
  84. else if($table == "Aa")
  85. {
  86. $code = WH_GetCode($file);
  87. if((substr($code, 0, 2) == $table) && ctype_digit($code[2]))
  88. {
  89. if(in_array($code, $wh_phonemes))
  90. echo "<img src=\"".htmlspecialchars( WH_IMG_DIR.$file) . "\" title=\"" .
  91. htmlspecialchars( $code ) . " [".
  92. htmlspecialchars( array_search($code, $wh_phonemes) )."]\">\n";
  93. else
  94. echo "<img src=\"".htmlspecialchars( WH_IMG_DIR.$file ) . "\" title=\"" .
  95. htmlspecialchars( $code ) . "\">\n";
  96. }
  97. }
  98. else
  99. {
  100. $code = WH_GetCode($file);
  101. if(($code[0] == $table) && ctype_digit($code[1]))
  102. {
  103. if(in_array($code, $wh_phonemes))
  104. echo "<img src=\"".htmlspecialchars( WH_IMG_DIR.$file ) . "\" title=\"" .
  105. htmlspecialchars( $code ) . "[".
  106. htmlspecialchars( array_search($code, $wh_phonemes) )."]\">\n";
  107. else
  108. echo "<img src=\"".htmlspecialchars( WH_IMG_DIR.$file ). "\" title=\"" .
  109. htmlspecialchars( $code ) . "\">\n";
  110. }
  111. }
  112. }
  113. closedir($dh);
  114. }
  115. ?>
  116. </body>
  117. </html>