| 1 | <?php |
|---|
| 2 | require_once 'locale.php'; |
|---|
| 3 | require_once 'cmn_frame.php'; |
|---|
| 4 | |
|---|
| 5 | $archiwa = array('utt' => array(), |
|---|
| 6 | 'utt-dict' => array() |
|---|
| 7 | ); |
|---|
| 8 | |
|---|
| 9 | $dn = "files/"; |
|---|
| 10 | if ($dh = opendir($dn)) { |
|---|
| 11 | while (($file = readdir($dh)) !== false) { |
|---|
| 12 | if(true == is_file($dn.$file)) { |
|---|
| 13 | if(preg_match('/^utt\-dict\-.+?\.(.+)$/', $file, $dopasowania)) { |
|---|
| 14 | $arch_type = $dopasowania[1]; |
|---|
| 15 | if(! array_key_exists($arch_type, $archiwa['utt-dict'])) { |
|---|
| 16 | $archiwa['utt-dict'][$arch_type] = array(); |
|---|
| 17 | } |
|---|
| 18 | $archiwa['utt-dict'][$arch_type][] = $file; |
|---|
| 19 | } |
|---|
| 20 | else if(preg_match('/^utt\-\d.+?\.(.+)$/', $file, $dopasowania)) { |
|---|
| 21 | $arch_type = $dopasowania[1]; |
|---|
| 22 | if(! array_key_exists($arch_type, $archiwa['utt'])) { |
|---|
| 23 | $archiwa['utt'][$arch_type] = array(); |
|---|
| 24 | } |
|---|
| 25 | $archiwa['utt'][$arch_type][] = $file; |
|---|
| 26 | } |
|---|
| 27 | } // if is file |
|---|
| 28 | } // while |
|---|
| 29 | closedir($dh); |
|---|
| 30 | } // if opendir |
|---|
| 31 | //print_r($archiwa); |
|---|
| 32 | |
|---|
| 33 | $title = '<title>UAM Text Tools - '.DOWNLOAD_SELECTFILE_PAGE_TITLE."</title>\n"; |
|---|
| 34 | |
|---|
| 35 | $content = "<p>".DOWNLOAD_SELECTFILE_CAPTION.":</p>\n"; |
|---|
| 36 | $content .= '<table class="distribution" width="100%">'; |
|---|
| 37 | # aplikacja |
|---|
| 38 | $content .= '<tr class="product"><td>'.DOWNLOAD_SELECTFILE_APP_CAPTION."</td></tr>\n"; |
|---|
| 39 | $content .= '<tr><td>'; |
|---|
| 40 | if(count(array_keys($archiwa['utt'])) > 0) { |
|---|
| 41 | $content .= '<table class="app" width="100%">'; |
|---|
| 42 | $content .= "\n"; |
|---|
| 43 | foreach (array_keys($archiwa['utt']) as $dist_type) { |
|---|
| 44 | $content .= '<tr><td class="dist_type">'.DOWNLOAD_SELECTFILE_DISTRIBUTION_TYPE." $dist_type</td><td> </td></tr>\n"; |
|---|
| 45 | $content .= "<tr><td colspan='2'>\n<table width='100%'>"; |
|---|
| 46 | $arr = $archiwa['utt'][$dist_type]; |
|---|
| 47 | rsort($arr); |
|---|
| 48 | foreach($arr as $app) { |
|---|
| 49 | $content .= "<tr>\n<td class=\"dist_item\">\n"; |
|---|
| 50 | $content .= "<a href=\"down_form.php?filename=".$app."\">"; |
|---|
| 51 | $content .= "<img src=\"im/down.jpg\" border=\"0\" />"; |
|---|
| 52 | $content .= $app."</a> (".(filesize($dn.$app)/1024)." KB)\n"; |
|---|
| 53 | $content .= "</td></tr>\n"; |
|---|
| 54 | } |
|---|
| 55 | $content .= "</table>\n</td></tr>\n"; |
|---|
| 56 | } |
|---|
| 57 | $content .= "</table>\n"; |
|---|
| 58 | } |
|---|
| 59 | else { |
|---|
| 60 | $content .= DOWNLOAD_SELECTFILE_NO_FILE."\n"; |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | # slowniki |
|---|
| 64 | $content .= '<tr class="product"><td>'.DOWNLOAD_SELECTFILE_DICT_CAPTION."</td></tr>\n"; |
|---|
| 65 | $content .= '<tr><td>'; |
|---|
| 66 | if(count(array_keys($archiwa['utt-dict'])) > 0) { |
|---|
| 67 | $content .= '<table class="dict" width="100%">'; |
|---|
| 68 | $content .= "\n"; |
|---|
| 69 | foreach (array_keys($archiwa['utt-dict']) as $dist_type) { |
|---|
| 70 | $content .= '<tr><td class="dist_type">'.DOWNLOAD_SELECTFILE_DISTRIBUTION_TYPE." $dist_type</td><td> </td></tr>\n"; |
|---|
| 71 | $content .= "<tr><td colspan='2'>\n<table width='100%'>"; |
|---|
| 72 | $arr = $archiwa['utt-dict'][$dist_type]; |
|---|
| 73 | rsort($arr); |
|---|
| 74 | foreach($arr as $dict) { |
|---|
| 75 | $content .= "<tr>\n<td class=\"dist_item\">\n"; |
|---|
| 76 | $content .= "<a href=\"down_form.php?filename=".$dict."\">"; |
|---|
| 77 | $content .= "<img src=\"im/down.jpg\" border=\"0\" />"; |
|---|
| 78 | $content .= $dict."</a> (".(filesize($dn.$dict)/1024)." KB)\n"; |
|---|
| 79 | $content .= "</td></tr>\n"; |
|---|
| 80 | } |
|---|
| 81 | $content .= "</table>\n</td></tr>\n"; |
|---|
| 82 | } |
|---|
| 83 | $content .= "</table>\n"; |
|---|
| 84 | } |
|---|
| 85 | else { |
|---|
| 86 | $content .= DOWNLOAD_SELECTFILE_NO_FILE."\n"; |
|---|
| 87 | } |
|---|
| 88 | $content .= '</td></tr></table>'; |
|---|
| 89 | $content .= "\n"; |
|---|
| 90 | |
|---|
| 91 | getMainPage($title, $content); |
|---|
| 92 | ?> |
|---|