function getdir($directory, $config) { if ($dir = opendir($directory)) { while ($file = readdir($dir)) { if ($file != "." && $file != ".." && $file[0] != '.' && $file != "help") { if (GetServerLanguageFile($config) == $file) { echo "<option value='" . $file . "' SELECTED>" . $file . "</option>"; } else { echo "<option value='" . $file . "'>" . $file . "</option>"; } } } closedir($dir); } }
function GetLanguageList($name, $config) { echo "<select name='" . $name . "'>"; // Open the language directory $dir = "./includes/languages/"; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { //check if the selected item is a file if (filetype($dir . $file) == "file") { //open the file and look for the language definition key (IDS_LANGUAGE_PACK) $Text = "Error"; // Open the language file an get the contents $lines = file($dir . $file); $strTag = "IDS_LANGUAGE_PACK"; // Search for the key for ($x = 1; $x <= sizeof($lines); $x++) { if (preg_match("/\\b" . $strTag . "\\b/i", $lines[$x - 1])) { // We found the key list($Key, $strText, $junk) = preg_split("/\\|\\|/", $lines[$x - 1], 3); $Text = trim($strText); // Exit loop break; } } $lines = ""; if ($Text != "Error") { echo "<option value='{$file}'"; if (GetServerLanguageFile($config) == $file) { echo " selected "; } echo ">" . $Text . "</option>"; } } } closedir($dh); } } echo "</select>"; }