utt/www/down.php

93 lines
3.2 KiB
PHP
Raw Normal View History

<?php
require_once 'locale.php';
require_once 'cmn_frame.php';
$archiwa = array('utt' => array(),
'utt-dict' => array()
);
$dn = "files/";
if ($dh = opendir($dn)) {
while (($file = readdir($dh)) !== false) {
if(true == is_file($dn.$file)) {
if(preg_match('/^utt\-dict\-.+?\.(.+)$/', $file, $dopasowania)) {
$arch_type = $dopasowania[1];
if(! array_key_exists($arch_type, $archiwa['utt-dict'])) {
$archiwa['utt-dict'][$arch_type] = array();
}
$archiwa['utt-dict'][$arch_type][] = $file;
}
else if(preg_match('/^utt\-\d.+?\.(.+)$/', $file, $dopasowania)) {
$arch_type = $dopasowania[1];
if(! array_key_exists($arch_type, $archiwa['utt'])) {
$archiwa['utt'][$arch_type] = array();
}
$archiwa['utt'][$arch_type][] = $file;
}
} // if is file
} // while
closedir($dh);
} // if opendir
//print_r($archiwa);
$title = '<title>UAM Text Tools - '.DOWNLOAD_SELECTFILE_PAGE_TITLE."</title>\n";
$content = "<p>".DOWNLOAD_SELECTFILE_CAPTION.":</p>\n";
$content .= '<table class="distribution" width="100%">';
# aplikacja
$content .= '<tr class="product"><td>'.DOWNLOAD_SELECTFILE_APP_CAPTION."</td></tr>\n";
$content .= '<tr><td>';
if(count(array_keys($archiwa['utt'])) > 0) {
$content .= '<table class="app" width="100%">';
$content .= "\n";
foreach (array_keys($archiwa['utt']) as $dist_type) {
$content .= '<tr><td class="dist_type">'.DOWNLOAD_SELECTFILE_DISTRIBUTION_TYPE." $dist_type</td><td>&nbsp;</td></tr>\n";
$content .= "<tr><td colspan='2'>\n<table width='100%'>";
$arr = $archiwa['utt'][$dist_type];
rsort($arr);
foreach($arr as $app) {
$content .= "<tr>\n<td class=\"dist_item\">\n";
$content .= "<a href=\"down_form.php?filename=".$app."\">";
$content .= "<img src=\"im/down.jpg\" border=\"0\" />";
$content .= $app."</a> (".(filesize($dn.$app)/1024)." KB)\n";
$content .= "</td></tr>\n";
}
$content .= "</table>\n</td></tr>\n";
}
$content .= "</table>\n";
}
else {
$content .= DOWNLOAD_SELECTFILE_NO_FILE."\n";
}
# slowniki
$content .= '<tr class="product"><td>'.DOWNLOAD_SELECTFILE_DICT_CAPTION."</td></tr>\n";
$content .= '<tr><td>';
if(count(array_keys($archiwa['utt-dict'])) > 0) {
$content .= '<table class="dict" width="100%">';
$content .= "\n";
foreach (array_keys($archiwa['utt-dict']) as $dist_type) {
$content .= '<tr><td class="dist_type">'.DOWNLOAD_SELECTFILE_DISTRIBUTION_TYPE." $dist_type</td><td>&nbsp;</td></tr>\n";
$content .= "<tr><td colspan='2'>\n<table width='100%'>";
$arr = $archiwa['utt-dict'][$dist_type];
rsort($arr);
foreach($arr as $dict) {
$content .= "<tr>\n<td class=\"dist_item\">\n";
$content .= "<a href=\"down_form.php?filename=".$dict."\">";
$content .= "<img src=\"im/down.jpg\" border=\"0\" />";
$content .= $dict."</a> (".(filesize($dn.$dict)/1024)." KB)\n";
$content .= "</td></tr>\n";
}
$content .= "</table>\n</td></tr>\n";
}
$content .= "</table>\n";
}
else {
$content .= DOWNLOAD_SELECTFILE_NO_FILE."\n";
}
$content .= '</td></tr></table>';
$content .= "\n";
getMainPage($title, $content);
?>