home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 April / PCWorld_2005-04_cd.bin / akce / web / phpnuke / PHP-Nuke-7.5.exe / html / blocks / block-Languages.php < prev    next >
PHP Script  |  2004-01-29  |  3KB  |  65 lines

  1. <?php
  2.  
  3. /************************************************************************/
  4. /* PHP-NUKE: Web Portal System                                          */
  5. /* ===========================                                          */
  6. /*                                                                      */
  7. /* Copyright (c) 2002 by Francisco Burzi                                */
  8. /* http://phpnuke.org                                                   */
  9. /*                                                                      */
  10. /* This program is free software. You can redistribute it and/or modify */
  11. /* it under the terms of the GNU General Public License as published by */
  12. /* the Free Software Foundation; either version 2 of the License.       */
  13. /************************************************************************/
  14.  
  15. if (eregi("block-Languages.php", $_SERVER['PHP_SELF'])) {
  16.     Header("Location: index.php");
  17.     die();
  18. }
  19.  
  20. global $useflags, $currentlang;
  21.  
  22. if ($useflags == 1) {
  23.     $content = "<center><font class=\"content\">"._SELECTGUILANG."<br><br>";
  24.     $langdir = dir("language");
  25.     while($func=$langdir->read()) {
  26.     if(substr($func, 0, 5) == "lang-") {
  27.         $menulist .= "$func ";
  28.     }
  29.     }
  30.     closedir($langdir->handle);
  31.     $menulist = explode(" ", $menulist);
  32.     sort($menulist);
  33.     for ($i=0; $i < sizeof($menulist); $i++) {
  34.     if($menulist[$i]!="") {
  35.         $tl = ereg_replace("lang-","",$menulist[$i]);
  36.         $tl = ereg_replace(".php","",$tl);
  37.         $altlang = ucfirst($tl);
  38.         $content .= "<a href=\"index.php?newlang=$tl\"><img src=\"images/language/flag-$tl.png\" border=\"0\" alt=\"$altlang\" title=\"$altlang\" hspace=\"3\" vspace=\"3\"></a> ";
  39.     }
  40.     }
  41.     $content .= "</font></center>";
  42. } else {
  43.     $content = "<center><font class=\"content\">"._SELECTGUILANG."<br><br></font>";
  44.     $content .= "<form action=\"index.php\" method=\"get\"><select name=\"newlanguage\" onChange=\"top.location.href=this.options[this.selectedIndex].value\">";
  45.     $handle=opendir('language');
  46.     while ($file = readdir($handle)) {
  47.     if (preg_match("/^lang\-(.+)\.php/", $file, $matches)) {
  48.         $langFound = $matches[1];
  49.         $languageslist .= "$langFound ";
  50.     }
  51.     }
  52.     closedir($handle);
  53.     $languageslist = explode(" ", $languageslist);
  54.     sort($languageslist);
  55.     for ($i=0; $i < sizeof($languageslist); $i++) {
  56.     if($languageslist[$i]!="") {
  57.         $content .= "<option value=\"index.php?newlang=$languageslist[$i]\" ";
  58.         if($languageslist[$i]==$currentlang) $content .= " selected";
  59.         $content .= ">".ucfirst($languageslist[$i])."</option>\n";
  60.     }
  61.     }
  62.     $content .= "</select></form></center>";
  63. }
  64.  
  65. ?>