<?php
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2007                                            */
/* http://www.php-maximus.org                                           */
/* dev@php-maximus.org                                                  */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
/* Portage Coppermine Photo Gallery                                     */
/************************************************************************/
$title = _SELECTLANGUAGE;
starttable('100%', 'Any Content~~ Customized:  '.$title);

echo "<tr><td><table class='tableb' width='100%'><tr>
      <td align='center' valign='top'>";

    global $currentlang;
    $content = "<font class='content'>"._SELECTGUILANG."<br />";
    $langdir = dir("language");
    while($func=$langdir->read()) {
        if(substr($func, 0, 5) == "lang-") {
                $menulist .= "$func ";
        }
    }
    closedir($langdir->handle);
    $menulist = explode(" ", $menulist);
    sort($menulist);
    for ($i=0; $i < sizeof($menulist); $i++) {
        if($menulist[$i]!="") {
            $tl = ereg_replace("lang-","",$menulist[$i]);
            $tl = ereg_replace(".php","",$tl);
            $altlang = ucfirst($tl);
            $content .= "<a href=\"{$_SERVER[PHP_SELF]}?{$_SERVER[QUERY_STRING]}&newlang=$tl\">";
            $imge = "images/language/flag-$tl.png";
            if (file_exists($imge)){
            $content .= "<img src=\"$imge\" align=\"middle\" border=\"0\" alt=\"$altlang\" title=\"$altlang\" hspace=\"3\" vspace=\"3\" />";
            } else {
            $content .= "$altlang";
            }
            $content .= "</a> ";
        }
    }
    Max_OpenTable();
    echo "<p align=\"center\">$content</p>";
    Max_CloseTable();
    echo "/td></tr></table></tr></td>";

endtable();
