00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00286
00287
00288
00289
00290
00291
00292
00293
00294
00301 $hiddenFilesWildcards = Array("*.php", "*~");
00302
00307 $allowSubDirs = true;
00308
00315 $allowPHPDownloads = false;
00316
00317
00322 $useAutoThumbnails = true;
00323
00324
00333 $cacheThumbnails = true;
00334
00335
00336
00337
00338
00339
00340
00341
00347 $snifServer = $_SERVER['HTTP_HOST'];
00348
00349
00356 $snifDateFormat = 'd-m-y';
00357
00363 $hiddenFilesRegex = Array();
00364
00368 $useDescriptionsFrom = "descript.ion";
00369
00374 $separationString = "\t";
00375
00381 $useExternalImages = false;
00382
00389 $externalIcons = Array (
00390 "archive" => "",
00391 "binary" => "",
00392 "dirup" => "",
00393 "folder" => "",
00394 "HTML" => "",
00395 "image" => "",
00396 "text" => "",
00397 "unknown" => "",
00398 "download" => "",
00399 "asc" => "",
00400 "desc" => ""
00401 );
00402
00409 $externalStylesheet = "";
00410
00428 $externalConfig = "";
00429
00437 $descriptionFilenamesCaseSensitive = false;
00438
00444 $usePaging = 0;
00445
00453 $directDirectoryLinks = false;
00454
00460 $thumbnailHeight = 50;
00461 $thumbnailWidth = 150;
00462
00466 $useBackForDirUp = true;
00467
00484 $displayColumns = Array(
00485 "download",
00486 "icon",
00487 "name",
00488 "type",
00489 "size",
00490 "date",
00491 "description"
00492 );
00493
00498 $tableWidth100Percent = false;
00499
00506 $descriptionColumnWidth = 0;
00507
00512 $truncateLength = 30;
00513
00521 $protectDirsWithHtaccess = true;
00522
00530 $alwaysUseLanguage = "";
00531
00532
00533
00535
00536
00537 $languageStrings = Array(
00538 "en" => Array(
00539
00540
00541
00542 "Index of" => "",
00543 "name" => "",
00544 "type" => "",
00545 "size" => "",
00546 "date" => "",
00547 "description" => "",
00548 "DATEFORMAT" => $snifDateFormat,
00549 "folder" => "",
00550 "archive" => "",
00551 "image" => "",
00552 "text" => "",
00553 "HTML" => "",
00554 "unknown" => "",
00555 "valid" => "",
00556 "binary" => "",
00557 "dirup" => "",
00558 "download" => "",
00559 "asc" => "",
00560 "desc" => "",
00561 "[ back ]" => "",
00562 "1 item" => "",
00563 "%d items" => "",
00564 "%s is not a subdirectory of the current directory." => "",
00565 "File not found: %s" => "",
00566 "Illegal characters detected in URL, ignoring." => "",
00567 "Illegal path specified, ignoring." => "",
00568 "Bytes" => "",
00569 "B" => "",
00570 "KB" => "",
00571 "MB" => "",
00572 "GB" => "",
00573 "TB" => "",
00574 "pages" => "",
00575 "previous" => "",
00576 "next" => ""
00577 ),
00578
00579
00580 "br" => Array(
00581 "Index of" => "Ãndice de",
00582 "name" => "nome",
00583 "type" => "tipo",
00584 "size" => "tam.",
00585 "date" => "data",
00586 "description" => "descrição",
00587 "DATEFORMAT" => "d/m/y",
00588 "folder" => "diretório",
00589 "archive" => "arquivo",
00590 "image" => "imagem",
00591 "text" => "texto",
00592 "HTML" => "HTML",
00593 "unknown" => "desconhecido",
00594 "valid" => "validar",
00595 "binary" => "binário",
00596 "dirup" => "subir um nÃvel",
00597 "download" => "download",
00598 "asc" => "ascendente",
00599 "desc" => "descendente",
00600 "[ back ]" => "[ voltar ]",
00601 "1 item" => "1 item",
00602 "% items" => "%d itens",
00603 "%s is not a subdirectory of the current directory." => "%s não é um subdiretório da localização atual.",
00604 "File not found: %s" => "Arquivo não encontrado: %s",
00605 "Illegal characters detected in URL, ignoring." => "Ignorando caracteres ilegais da URL...",
00606 "Illegal path specified, ignoring." => "Ignorando o caminho ilegal especificado...",
00607 "Bytes" => "Bytes",
00608 "B" => "B",
00609 "KB" => "KB",
00610 "MB" => "MB",
00611 "GB" => "GB",
00612 "TB" => "TB",
00613 "pages" => "páginas",
00614 "previous" => "retornar",
00615 "next" => "avançar"
00616 ),
00617
00618
00619 "cz" => Array(
00620 "Index of" => "Vpis",
00621 "name" => "jmno",
00622 "type" => "typ",
00623 "size" => "velikost",
00624 "date" => "datum",
00625 "description" => "popis",
00626 "DATEFORMAT" => $snifDateFormat,
00627 "folder" => "adresr",
00628 "archive" => "archiv",
00629 "image" => "obrzek",
00630 "text" => "text",
00631 "HTML" => "html",
00632 "unknown" => "nezm",
00633 "valid" => "platn",
00634 "binary" => "binrn",
00635 "dirup" => "nahoru",
00636 "download" => "sthnout",
00637 "asc" => "sestupne",
00638 "desc" => "vzestupne",
00639 "[ back ]" => "[ zpet ]",
00640 "1 item" => "1 poloka",
00641 "%d items" => "%d poloky",
00642 "%s is not a subdirectory of the current directory." => "%s nen podaresr toho adresre",
00643 "File not found: %s" => "Soubor nenalezen: %s",
00644 "Illegal characters detected in URL, ignoring." => "Neplatn znaky v URL, preskakuju",
00645 "Illegal path specified, ignoring." => "Neplatn cesta, ignoruju",
00646 "Bytes" => "Bajtu",
00647 "B" => "B",
00648 "KB" => "KB",
00649 "MB" => "MB",
00650 "GB" => "GB",
00651 "TB" => "TB",
00652 "pages" => "strnky",
00653 "previous" => "predchoz",
00654 "next" => "nsledujc"
00655 ),
00656
00657 "de" => Array(
00658 "Index of" => "Inhalt von",
00659 "name" => "Name",
00660 "type" => "Typ",
00661 "size" => "Größe",
00662 "date" => "Datum",
00663 "DATEFORMAT" => "d.m.y",
00664 "description" => "Beschreibung",
00665 "folder" => "Verzeichnis",
00666 "archive" => "Archiv",
00667 "image" => "Bild",
00668 "text" => "Text-Datei",
00669 "HTML" => "HTML-Datei",
00670 "unknown" => "unbekannt",
00671 "valid" => "gültiges",
00672 "binary" => "Binärdatei",
00673 "dirup" => "Aufwärts",
00674 "download" => "Download",
00675 "asc" => "aufsteigend",
00676 "desc" => "absteigend",
00677 "[ back ]" => "[ aufwärts ]",
00678 "1 item" => "1 Eintrag",
00679 "%d items" => "%d Einträge",
00680 "%s is not a subdirectory of the current directory." => "%s ist kein Unterverzeichnis des momentanen Verzeichnisses.",
00681 "File not found: %s" => "Die Datei '%s' wurde konnte nicht gefunden werden.",
00682 "Illegal characters detected in URL, ignoring." => "Ungültige Zeichen in der URL wurden ignoriert.",
00683 "Illegal path specified, ignoring." => "Ein ungültiger Pfad in einem Parameter wurde bereinigt.",
00684 "Bytes" => "Bytes",
00685 "B" => "",
00686 "KB" => "",
00687 "MB" => "",
00688 "GB" => "",
00689 "TB" => "",
00690 "pages" => "Seiten",
00691 "previous" => "vorherige",
00692 "next" => "nächste"
00693 ),
00694
00695
00696 "dk" => Array(
00697 "Index of" => "Indholdet i ",
00698 "name" => "Navn",
00699 "type" => "Type",
00700 "size" => "strrelse",
00701 "date" => "Dato",
00702 "description" => "Beskrivelse",
00703 "DATEFORMAT" => "d-m-y",
00704 "folder" => "mappe",
00705 "archive" => "arkiv",
00706 "image" => "billede",
00707 "text" => "tekst",
00708 "HTML" => "HTML Dato",
00709 "unknown" => "Ukendt",
00710 "valid" => "Korrekt",
00711 "binary" => "Bionr",
00712 "dirup" => "En mappe tilbage",
00713 "download" => "Download",
00714 "asc" => "Vilkrlig Rkkeflge",
00715 "desc" => "Uvilkrlig",
00716 "[ back ]" => "[ Tilbage ]",
00717 "1 item" => "1 fil",
00718 "%d items" => "%d filer",
00719 "%s is not a subdirectory of the current directory." => "%s er ikke en undermappe, af nuvrende mappe",
00720 "File not found: %s" => "Filen er ikke fundet",
00721 "Illegal characters detected in URL, ignoring." => "Forkerte karakter opdaget i URL, Ignoreret ",
00722 "Illegal path specified, ignoring." => "Forkert mappe navn valgt, ignoreres",
00723 "Bytes" => "Bytes",
00724 "B" => "Bytes",
00725 "KB" => "Kilobytes",
00726 "MB" => "Megabytes",
00727 "GB" => "Gigabytes",
00728 "TB" => "Terabytes",
00729 "pages" => "Sider",
00730 "previous" => "Forrige",
00731 "next" => "Nste"
00732 ),
00733
00734
00735 "es" => Array(
00736 "Index of" => "Indice de",
00737 "name" => "nombre",
00738 "type" => "tipo",
00739 "size" => "tamaño",
00740 "date" => "fecha",
00741 "description" => "Descripción",
00742 "DATEFORMAT" => $snifDateFormat,
00743 "folder" => "directorio",
00744 "archive" => "archivo",
00745 "image" => "imagen",
00746 "text" => "texto",
00747 "HTML" => "HTML",
00748 "unknown" => "desconocido",
00749 "valid" => "valido",
00750 "binary" => "binario",
00751 "dirup" => "subir directorio",
00752 "download" => "descargar",
00753 "asc" => "ascendente",
00754 "desc" => "descendente",
00755 "[ back ]" => "[ atras ]",
00756 "1 item" => "1 objeto",
00757 "%d items" => "%d objetos",
00758 "%s is not a subdirectory of the current directory." => "%s no es un subdirectorio del directorio actual.",
00759 "File not found: %s" => "Archivo no encontrado: %s",
00760 "Illegal characters detected in URL, ignoring." => "Caractéres ilegales en la URL ha sido ignorados.",
00761 "Illegal path specified, ignoring." => "Ruta ilegal especificada ha sido ignorada",
00762 "Bytes" => "",
00763 "B" => "B",
00764 "KB" => "KB",
00765 "MB" => "MB",
00766 "GB" => "GB",
00767 "TB" => "TB",
00768 "pages" => "páginas",
00769 "previous" => "anterior",
00770 "next" => "siguiente"
00771 ),
00772
00773
00774 "fr" => Array(
00775 "Index of" => "Index de",
00776 "name" => "nom",
00777 "type" => "type",
00778 "size" => "taille",
00779 "date" => "date",
00780 "description" => "description",
00781 "DATEFORMAT" => "d-m-y",
00782 "folder" => "répertoire",
00783 "archive" => "archive",
00784 "image" => "image",
00785 "text" => "texte",
00786 "HTML" => "HTML",
00787 "unknown" => "inconnu",
00788 "valid" => "valide",
00789 "binary" => "binaire",
00790 "dirup" => "niveau supérieur",
00791 "download" => "télécharger",
00792 "asc" => "asc",
00793 "desc" => "desc",
00794 "[ back ]" => "[ niveau supérieur ]",
00795 "1 item" => "1 item",
00796 "%d items" => "%d items",
00797 "%s is not a subdirectory of the current directory." => "%s n 'est pas un sous-répertoire du répertoire courant",
00798 "File not found: %s" => "Fichier non trouv.: %s",
00799 "Illegal characters detected in URL, ignoring." => "Caractre illégal dans l'url, ignoré.",
00800 "Illegal path specified, ignoring." => "Chemin d'accs illégal, ignoré.",
00801 "Bytes" => "bytes",
00802 "B" => "b",
00803 "KB" => "Kb",
00804 "MB" => "Mb",
00805 "GB" => "Gb",
00806 "TB" => "Tb",
00807 "pages" => "pages",
00808 "previous" => "précédente",
00809 "next" => "suivante"
00810 ),
00811
00812
00813 "gr" => Array(
00814 "Index of" => "Περιεχόμενα του",
00815 "name" => "όνομα",
00816 "type" => "τύπος",
00817 "size" => "μέγεθος",
00818 "date" => "ημερομηνία",
00819 "description" => "περιγραφή",
00820 "DATEFORMAT" => "d-m-y",
00821 "folder" => "φάκελος",
00822 "archive" => "αρχείο",
00823 "image" => "εικόνα",
00824 "text" => "κείμενο",
00825 "HTML" => "HTML",
00826 "unknown" => "άγνωστο",
00827 "valid" => "έγκυρη",
00828 "binary" => "δυαδικό",
00829 "dirup" => "ένα επίπεδο επάνω",
00830 "download" => "κατέβασμα",
00831 "asc" => "αύξ",
00832 "desc" => "φθίν",
00833 "[ back ]" => "[ πίσω ]",
00834 "1 item" => "1 αντικείμενο",
00835 "%d items" => "%d αντικείμενα",
00836 "%s is not a subdirectory of the current directory." => "Το %s δεν είναι υποκατάλογος του τρέχοντος καταλόγου",
00837 "File not found: %s" => "Το αρχείο δεν βρέθηκε:%s",
00838 "Illegal characters detected in URL, ignoring." => "Μη επιτρεπτοί χαρακτήρες βρέθηκαν στο URL και θ' αγνοηθούν.",
00839 "Illegal path specified, ignoring." => "Μη επιτρεπτή διαδρομή καταλόγου. Αγνοήθηκε.",
00840 "Bytes" => "Bytes",
00841 "B" => "B",
00842 "KB" => "KB",
00843 "MB" => "MB",
00844 "GB" => "GB",
00845 "TB" => "TB",
00846 "pages" => "σελίδες",
00847 "previous" => "προηγούμενη",
00848 "next" => "επόμενη"
00849 ),
00850
00851
00852 "hu" => Array(
00853 "Index of" => "Könyvtár:",
00854 "name" => "név",
00855 "type" => "típus",
00856 "size" => "méret",
00857 "date" => "dátum",
00858 "description" => "leírás",
00859 "DATEFORMAT" => "y-m-d",
00860 "folder" => "alkönyvtár",
00861 "archive" => "archívum",
00862 "image" => "kép",
00863 "text" => "szöveg",
00864 "HTML" => "html",
00865 "unknown" => "ismeretlen",
00866 "valid" => "érvényes",
00867 "binary" => "bináris",
00868 "dirup" => "vissza a szülõkönyvtárba",
00869 "download" => "letöltés",
00870 "asc" => "növekvõ",
00871 "desc" => "csökkenõ",
00872 "[ back ]" => "[..]",
00873 "1 item" => "1 fájl",
00874 "%d items" => "%d fájl",
00875 "%s is not a subdirectory of the current directory." => "%d nem alkönyvtár",
00876 "File not found: %s" => "Fájl nem található",
00877 "Illegal characters detected in URL, ignoring." => "Érvénytelen karakterek az URL-ben, kihagyva.",
00878 "Illegal path specified, ignoring." => "Érvénytelen útvonalspecifikáció, kihagyva.",
00879 "Bytes" => "Bájt",
00880 "B" => "",
00881 "KB" => "",
00882 "MB" => "",
00883 "GB" => "",
00884 "TB" => "",
00885 "pages" => "oldal",
00886 "previous" => "elõzõ",
00887 "next" => "következõ"
00888 ),
00889
00890
00891 "it" => Array(
00892 "Index of" => "Contenuto di",
00893 "name" => "nome",
00894 "type" => "tipo",
00895 "size" => "dimensione",
00896 "date" => "data",
00897 "description" => "descrizione",
00898 "DATEFORMAT" => "d-m-y",
00899 "folder" => "cartella",
00900 "archive" => "archivio",
00901 "image" => "immagine",
00902 "text" => "testo",
00903 "HTML" => "HTML",
00904 "unknown" => "sconosciuto",
00905 "valid" => "valido",
00906 "binary" => "binario",
00907 "dirup" => "directory superiore",
00908 "download" => "download",
00909 "asc" => "ascendente",
00910 "desc" => "discendente",
00911 "[ back ]" => "[ indietro ]",
00912 "1 item" => "1 oggetto",
00913 "%d items" => "%d oggetti",
00914 "%s is not a subdirectory of the current directory." => "%s non è una sottocartella della cartella corrente.",
00915 "File not found: %s" => "File non trovato: %s",
00916 "Illegal characters detected in URL, ignoring." => "Caratteri non validi nell'URL ignorati.",
00917 "Illegal path specified, ignoring." => "Percorso specificato non valido ignorato.",
00918 "Bytes" => "Bytes",
00919 "B" => "Bytes",
00920 "KB" => "KB",
00921 "MB" => "MB",
00922 "GB" => "GB",
00923 "TB" => "TB",
00924 "pages" => "pagine",
00925 "previous" => "precedente",
00926 "next" => "seguente"
00927 ),
00928
00929
00930 "jp" => Array(
00931 "Index of" => "Index of",
00932 "name" => "ネーム",
00933 "type" => "タイプ",
00934 "size" => "サイズ",
00935 "date" => "日付",
00936 "description" => "記述",
00937 "DATEFORMAT" => "y/m/d",
00938 "folder" => "ディレクトリ",
00939 "archive" => "アーカイブ",
00940 "image" => "イメージ",
00941 "text" => "テキスト",
00942 "HTML" => "HTML",
00943 "unknown" => "不明",
00944 "valid" => "valid",
00945 "binary" => "バイナリ",
00946 "dirup" => "上のディレクトリへ移動",
00947 "download" => "ダウンロード",
00948 "asc" => "昇順でソート",
00949 "desc" => "降順でソート",
00950 "[ back ]" => "[ 戻る ]",
00951 "1 item" => "1 アイテム",
00952 "%d items" => "%d アイテム",
00953 "%s is not a subdirectory of the current directory." => "%sはカレントディレクトリのサブディレクトリではありません。",
00954 "File not found: %s" => "ファイルが見つかりません: %s",
00955 "Illegal characters detected in URL, ignoring." => "URLに不正な文字が検出されました、無視します。",
00956 "Illegal path specified, ignoring." => "不正なパスが指定されました、無視します。",
00957 "Bytes" => "Bytes",
00958 "B" => "Bytes",
00959 "KB" => "KB",
00960 "MB" => "MB",
00961 "GB" => "GB",
00962 "TB" => "TB",
00963 "pages" => "ページ",
00964 "previous" => "前へ",
00965 "next" => "次へ"
00966 ),
00967
00968
00969 "nl" => Array(
00970 "Index of" => "Inhoud van",
00971 "name" => "Naam",
00972 "type" => "Type",
00973 "size" => "Grootte",
00974 "date" => "Datum",
00975 "DATEFORMAT" => "d.m.y",
00976 "description" => "Beschrijving",
00977 "folder" => "Map",
00978 "archive" => "Archief",
00979 "image" => "Beeld",
00980 "text" => "Text",
00981 "HTML" => "HTML",
00982 "unknown" => "Onbekend",
00983 "valid" => "Geldig",
00984 "binary" => "Binary",
00985 "dirup" => "Onderliggende map",
00986 "download" => "Download",
00987 "asc" => "Oplopend",
00988 "desc" => "Aflopend",
00989 "[ back ]" => "[ Terug ]",
00990 "1 item" => "1 Onderdeel",
00991 "%d items" => "%d Onderdelen",
00992 "%s is not a subdirectory of the current directory." => "%s is geen submap van de huidige map.",
00993 "File not found: %s" => "Het bestand '%s' kon niet gevonden worden.",
00994 "Illegal characters detected in URL, ignoring." => "Ongeldige karakters gevonden in de URL, deze worden genegeerd.",
00995 "Illegal path specified, ignoring." => "Ongeldige locatie, deze locatie zal worden genegeerd.",
00996 "Bytes" => "",
00997 "B" => "",
00998 "KB" => "",
00999 "MB" => "",
01000 "GB" => "",
01001 "TB" => "",
01002 "pages" => "",
01003 "previous" => "",
01004 "next" => ""
01005 ),
01006
01007
01008 "no" => Array(
01009 "Index of" => "Innholdet i",
01010 "name" => "navn",
01011 "type" => "type",
01012 "size" => "størrelse",
01013 "date" => "dato",
01014 "description" => "beskrivelse",
01015 "DATEFORMAT" => "d-m-y",
01016 "folder" => "mappe",
01017 "archive" => "arkiv",
01018 "image" => "bilde",
01019 "text" => "tekst",
01020 "HTML" => "HTML",
01021 "unknown" => "ukjent",
01022 "valid" => "gyldig",
01023 "binary" => "binær",
01024 "dirup" => "opp en mappe",
01025 "download" => "last ned",
01026 "asc" => "stigende",
01027 "desc" => "synkende",
01028 "[ back ]" => "[ tilbake ]",
01029 "1 item" => "1 enhet",
01030 "%d items" => "%d enheter",
01031 "%s is not a subdirectory of the current directory." => "%s er ikke en mappe underlagt denne mappen",
01032 "File not found: %s" => "Kan ikke finne filen: %s",
01033 "Illegal characters detected in URL, ignoring." => "Ugyldige tegn er funnet i URL'en, utelater.",
01034 "Illegal path specified, ignoring." => "Ugyldig sti opgitt, utelater.",
01035 "Bytes" => "octets",
01036 "B" => "",
01037 "KB" => "",
01038 "MB" => "",
01039 "GB" => "",
01040 "TB" => "",
01041 "pages" => "sider",
01042 "previous" => "forrige side",
01043 "next" => "neste side"
01044 ),
01045
01046
01047 "pl" => Array(
01048 "Index of" => "Zawarto",
01049 "name" => "Nazwa",
01050 "type" => "Typ",
01051 "size" => "Rozmiar",
01052 "date" => "Data",
01053 "description" => "Miniatura",
01054 "DATEFORMAT" => "d-m-Y",
01055 "folder" => "Katalog",
01056 "archive" => "Archiwum",
01057 "image" => "Zobacz",
01058 "text" => "Tekst",
01059 "HTML" => "HTML",
01060 "unknown" => "Nieznany",
01061 "valid" => "Odpowiedni",
01062 "binary" => "Binarium",
01063 "dirup" => "Do gry",
01064 "download" => "Pobierz",
01065 "asc" => "ASCI",
01066 "desc" => "Opis",
01067 "[ back ]" => "[ Wstecz ]",
01068 "1 item" => "1 plik",
01069 "%d items" => "%d plikw",
01070 "%s is not a subdirectory of the current directory." => "%s nie jest podkatalogiem biecego katalogu.",
01071 "File not found: %s" => "Plik nie znaleziony: %s",
01072 "Illegal characters detected in URL, ignoring." => "Wystpi niepoprawny znak w kodzie HTML - zignorowany.",
01073 "Illegal path specified, ignoring." => "Niepoprawna cieka - zignorowana."
01074 ),
01075
01076
01077 "ru" => Array(
01078 "Index of" => "Содержимое",
01079 "name" => "Имя",
01080 "type" => "Тип",
01081 "size" => "Размер",
01082 "date" => "Дата",
01083 "description" => "Описание",
01084 "DATEFORMAT" => "d.m.y",
01085 "folder" => "директория",
01086 "archive" => "архив",
01087 "image" => "изображение",
01088 "text" => "текст",
01089 "HTML" => "HTML",
01090 "unknown" => "неизвестно",
01091 "valid" => "valid",
01092 "binary" => "бинарный",
01093 "dirup" => "Вверх",
01094 "download" => "Скачать",
01095 "asc" => "возрастание",
01096 "desc" => "убывание",
01097 "[ back ]" => "[ назад ]",
01098 "1 item" => "1 элемент",
01099 "%d items" => "элементов: %d",
01100
01101 "%s is not a subdirectory of the current directory." => "%s не найдена в текущей директории.",
01102 "File not found: %s" => "Файл не найден: %s",
01103 "Illegal characters detected in URL, ignoring." => "Неверные символы в URL, игнорируется.",
01104 "Illegal path specified, ignoring." => "Указан неверный путь, игнорируется.",
01105 "Bytes" => "байт",
01106 "B" => "B",
01107 "KB" => "kB",
01108 "MB" => "MB",
01109 "GB" => "GB",
01110 "TB" => "TB",
01111 "pages" => "страница",
01112 "previous" => "предыдущая",
01113 "next" => "следующая"
01114 ),
01115
01116
01117 "sv" => Array(
01118 "Index of" => "Förteckning över",
01119 "name" => "namn",
01120 "type" => "typ",
01121 "size" => "storlek",
01122 "date" => "datum",
01123 "DATEFORMAT" => "y-m-d",
01124 "description" => "beskrivning",
01125 "folder" => "mapp",
01126 "archive" => "arkiv",
01127 "image" => "bild",
01128 "text" => "textfil",
01129 "HTML" => "HTML-fil",
01130 "unknown" => "okänd",
01131 "valid" => "giltig",
01132 "binary" => "binärfil",
01133 "dirup" => "uppåt",
01134 "download" => "ladda ned",
01135 "asc" => "stigande",
01136 "desc" => "fallande",
01137 "[ back ]" => "[ bakåt ]",
01138 "1 item" =>
01139 "1 objekt",
01140 "%d items" => "%d objekt",
01141 "%s is not a subdirectory of the current directory." => "%s är inte en undermapp till aktuell mapp.",
01142 "File not found: %s" => "Filen '%s' hittades inte.",
01143 "Illegal characters detected in URL, ignoring." => "Ogiltiga tecken i URL:en, de ignoreras.",
01144 "Illegal path specified, ignoring." => "Ogiltig sökväg angiven, ignoreras.",
01145 "Bytes" => "byte",
01146 "B" => "B",
01147 "KB" => "kB",
01148 "MB" => "MB",
01149 "GB" => "GB",
01150 "TB" => "TB",
01151 "pages" => "sidor",
01152
01153
01154
01155 "previous" => "föregående",
01156 "next" => "nästa"
01157 )
01158 );
01159
01160
01161
01162
01163
01165
01166
01167
01168
01170
01171
01172 function translate($string) {
01173 GLOBAL $languageStrings, $alwaysUseLanguage;
01174 static $requestLanguage;
01175
01176 if ($requestLanguage=="") {
01177 $validLanguages = array_keys($languageStrings);
01178 if ($alwaysUseLanguage!="" && in_array($alwaysUseLanguage, $validLanguages)) {
01179 $requestLanguage = $alwaysUseLanguage;
01180 } else {
01181 if ($requestLanguage == "") {
01182 $acceptLanguages = explode(",", $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
01183 for ($i=0; $i<count($acceptLanguages) AND $requestLanguage==""; $i++) {
01184 $al = substr($acceptLanguages[$i],0,2);
01185 if (in_Array($al,$validLanguages)) {
01186 $requestLanguage = $al;
01187 }
01188 }
01189 if ($requestLanguage=="") {
01190 $requestLanguage = $validLanguages[0];
01191 }
01192 }
01193 }
01194 }
01195
01196 $stringTranslated = $languageStrings[$requestLanguage][$string];
01197 if ($stringTranslated!="") {
01198 return $stringTranslated;
01199 } else {
01200 return $string;
01201 }
01202 }
01203
01204
01205
01207
01208
01209
01210 error_reporting (E_ALL ^ E_NOTICE);
01211
01212 $displayError = Array();
01213
01214
01215 foreach($_GET AS $key => $value) {
01216 $_GET[$key] = strip_tags($value);
01217 if ($_GET[$key] != $value) {
01218 $displayError[] = translate("Illegal characters detected in URL, ignoring.");
01219 }
01220 if (!get_magic_quotes_gpc()) {
01221 $_GET[$key] = stripslashes($value);
01222 }
01223 }
01224
01225
01226
01227 if ($externalConfig!="") {
01228 include($externalConfig);
01229 }
01230
01231
01232
01233
01234 if (!$allowSubDirs) {
01235 $path = "";
01236 } else {
01237 $path = $_GET["path"];
01238
01239
01240 $path = safeDirectory($path);
01241 }
01242
01243
01244 if ($_GET["sort"]=="")
01245 $_GET["sort"] = "name";
01246
01247
01248 if ($_GET["order"]=="") {
01249 $_GET["order"] = "asc";
01250 } else {
01251 $_GET["order"] = strtolower($_GET["order"]);
01252 }
01253
01254
01255 if ($useDescriptionsFrom=="") {
01256 $index = array_search("description", $displayColumns);
01257 if ($index!==false && $index!==null) {
01258 unset($displayColumns[$index]);
01259 }
01260 }
01261
01262
01263 if ($useDescriptionsFrom!="") {
01264 $hiddenFilesWildcards[] = $useDescriptionsFrom;
01265 }
01266 if ($externalStylesheet!="") {
01267 $hiddenFilesWildcards[] = $externalStylesheet;
01268 }
01269 $hiddenFilesWildcards[] = ".";
01270 $hiddenFilesWildcards[] = basename($_SERVER["PHP_SELF"]);
01271
01272
01273 for ($i=0;$i<count($hiddenFilesWildcards);$i++) {
01274 $translate = Array(
01275 "." => "\\.",
01276 "*" => ".*",
01277 "?" => ".?",
01278 "+" => "\\+",
01279 "[" => "\\[",
01280 "]" => "\\]",
01281 "(" => "\\(",
01282 ")" => "\\)",
01283 "{" => "\\{",
01284 "}" => "\\}",
01285 "^" => "\\^",
01286 "\$" => "\\\$",
01287 "\\" => "\\\\",
01288 );
01289 $hiddenFilesRegex[] = "^".strtr($hiddenFilesWildcards[$i],$translate)."$";
01290 }
01291
01292 $hiddenFilesRegex[] = "^\\.[^.].*$";
01293 $hiddenFilesWholeRegex = "/".join("|",$hiddenFilesRegex)."/i";
01294
01295
01296
01297
01299
01300
01301
01302 if ($_GET["getimage"]!="") {
01303 $imagesEncoded = Array(
01304 "archive" => "R0lGODlhEAAQAJECAAAAAP///////wAAACH5BAEAAAIALAAAAAAQABAAAAI3lA+pxxgfUhNKPRAbhimu2kXiRUGeFwIlN47qdlnuarokbG46nV937UO9gDMHsMLAcSYU0GJSAAA7",
01305 "asc" => "R0lGODlhBQADAIABAN3d3f///yH5BAEAAAEALAAAAAAFAAMAAAIFTGAHuF0AOw==",
01306 "binary" => "R0lGODlhEAAQAJECAAAAAP///////wAAACH5BAEAAAIALAAAAAAQABAAAAI0lICZxgYBY0DNyfhAfROrxoVQBo5mpzFih5bsFLoX5iLYWK6xyur5ubPAbhPZrKhSKCmCAgA7",
01307 "desc" => "R0lGODlhBQADAIABAN3d3f///yH5BAEAAAEALAAAAAAFAAMAAAIFhB0XC1sAOw==",
01308 "dirup" => "R0lGODlhEAAQAJECAAAAAP///////wAAACH5BAEAAAIALAAAAAAQABAAAAIulI+JwKAJggzuiThl2wbnT3WZN4oaA1bYRobXCLpkq5nnVr9xqe85C2xYhkRFAQA7",
01309 "folder" => "R0lGODlhEAAQAJECAAAAAP///////wAAACH5BAEAAAIALAAAAAAQABAAAAIplI+JwKAJggzuiThl2wbnT3UgWHmjJp5Tqa5py7bhJc/mWW46Z/V+UgAAOw==",
01310 "HTML" => "R0lGODlhEAAQAKIHABsb/2ho/4CA/0BA/zY2/wAAAP///////yH5BAEAAAcALAAAAAAQABAAAANEeFfcrVAVQ6thUdo6S57b9UBgSHmkyUWlMAzCmlKxAZ9s5Q5AjWqGwIAS8OVsNYJxJgDwXrHfQoVLEa7Y6+Wokjq+owQAOw==",
01311 "image" => "R0lGODlhEAAQAKIEAK6urmRkZAAAAP///////wAAAAAAAAAAACH5BAEAAAQALAAAAAAQABAAAANCSCTcrVCJQetgUdo6RZ7b9UBgSHnkAKwscEZTy74pG9zuBavA7dOanu+H0gyGxN0RGdClKEjgwvKTlkzFhWOLISQAADs=",
01312 "text" => "R0lGODlhEAAQAJECAAAAAP///////wAAACH5BAEAAAIALAAAAAAQABAAAAI0lICZxgYBY0DNyfhAfXcuxnWQBnoKMjXZ6qUlFroWLJHzGNtHnat87cOhRkGRbGc8npakAgA7",
01313 "download" => "R0lGODlhBwAQAIABAAAAAP///yH5BAEAAAEALAAAAAAHABAAAAISjI+pywb6UkQzgHsPls3h2gUFADs=",
01314 "blank" => "R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",
01315 "unknown" => "R0lGODlhEAAQAJECAAAAAP///////wAAACH5BAEAAAIALAAAAAAQABAAAAI1lICZxgYBY0DNyfhAfXcuxnkI1nCjB2lgappld6qWdE4vFtprR+4sffv1ZjwdkSc7KJYUQQEAOw=="
01316 );
01317 $imageDataEnc = $imagesEncoded[$_GET["getimage"]];
01318 if ($imageDataEnc) {
01319 $maxAge = 31536000;
01320 doConditionalGet($_GET["getimage"], gmmktime(1,0,0,1,1,2004));
01321 $imageDataRaw = base64_decode($imageDataEnc);
01322 Header("Content-Type: image/gif");
01323 Header("Content-Length: ".strlen($imageDataRaw));
01324 Header("Cache-Control: public, max-age=$maxAge, must-revalidate");
01325 Header("Expires: ".createHTTPDate(time()+$maxAge));
01326 echo $imageDataRaw;
01327 }
01328
01329 die();
01330 }
01331
01332
01333 if ($_GET["thumbnail"]!="") {
01334 GLOBAL $thumbnailHeight, $cacheThumbnails;
01335 $thumbnailCacheSubdir = ".snifthumbs";
01336
01337 $file = safeDirectory(urldecode($_GET["thumbnail"]));
01338 doConditionalGet($_GET["thumbnail"],filemtime($file));
01339
01340 $thumbDir = dirname($file)."/".$thumbnailCacheSubdir;
01341 $thumbFile = $thumbDir."/".basename($file);
01342 if ($cacheThumbnails) {
01343 if (file_exists($thumbDir)) {
01344 if (!is_dir($thumbDir)) {
01345 $cacheThumbnails = false;
01346 }
01347 } else {
01348 if (@mkdir($thumbDir)) {
01349 chmod($thumbDir, "0777");
01350 } else {
01351 $cacheThumbnails = false;
01352 }
01353 }
01354 if (file_exists($thumbFile)) {
01355 if (filemtime($thumbFile)>=filemtime($file)) {
01356 Header("Location: ".dirname($_SERVER["PHP_SELF"])."/".$thumbFile);
01357 die();
01358 }
01359 }
01360 }
01361 $contentType = "";
01362 $extension = strtolower(substr(strrchr($file, "."), 1));
01363 switch ($extension) {
01364 case "gif": $src = imagecreatefromgif($file); $contentType="image/gif"; break;
01365 case "jpg":
01366 case "jpeg": $src = imagecreatefromjpeg($file); $contentType="image/jpeg"; break;
01367 case "png": $src = imagecreatefrompng($file); $contentType="image/png"; break;
01368 default: die(); break;
01369 }
01370 $srcWidth = imagesx($src);
01371 $srcHeight = imagesy($src);
01372 $srcAspectRatio = $srcWidth / $srcHeight;
01373
01374 $maxAge = 3600;
01375 Header("Cache-Control: public, max-age=$maxAge, must-revalidate");
01376 Header("Expires: ".createHTTPDate(time()+$maxAge));
01377
01378 if ($srcHeight<=$thumbnailHeight AND $srcWidth<=$thumbnailWidth) {
01379 Header("Content-Type: $contentType");
01380 readfile($file);
01381 } else {
01382 if ($srcWidth > $srcHeight) {
01383 $thumbWidth = $thumbnailWidth;
01384 $thumbHeight = $thumbWidth / $srcAspectRatio;
01385 } else {
01386 $thumbHeight = $thumbnailHeight;
01387 $thumbWidth = $thumbHeight * $srcAspectRatio;
01388 }
01389 if (function_exists('imagecreatetruecolor')) {
01390 $thumb = imagecreatetruecolor($thumbWidth, $thumbHeight);
01391 } else {
01392 $thumb = imagecreate($thumbWidth, $thumbHeight);
01393 }
01394 imagecopyresampled($thumb, $src, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $srcWidth, $srcHeight);
01395 Header("Content-Type: image/jpeg");
01396 if ($cacheThumbnails) {
01397 imagejpeg($thumb, $thumbFile);
01398 chmod($thumbFile, "0777");
01399 readfile($thumbFile);
01400 } else {
01401 imagejpeg($thumb);
01402 }
01403 }
01404 die();
01405 }
01406
01407
01408 if ($_GET["download"]!="") {
01409 $download = stripslashes($_GET["download"]);
01410 $filename = safeDirectory($path.rawurldecode($download));
01411 if (
01412 !file_exists($filename)
01413 OR fileIsHidden($filename)
01414 OR (substr(strtolower($filename), -4)==".php" AND !$allowPHPDownloads)) {
01415
01416 Header("HTTP/1.0 404 Not Found");
01417 $displayError[] = sprintf(translate("File not found: %s"), $filename);
01418 } else {
01419
01420 Header("Content-Length: ".filesize($filename));
01421 Header("Content-Type: application/x-download");
01422 Header("Content-Disposition: attachment; filename=\"".rawurlencode($download)."\"");
01423 readfile($filename);
01424 die();
01425 }
01426 }
01427
01428
01429
01430
01432
01433
01434
01435 function createHTTPDate($time) {
01436 return gmdate("D, d M Y H:i:s", $time)." GMT";
01437 }
01438
01439
01440
01441 function doConditionalGet($file, $timestamp) {
01442 $last_modified = createHTTPDate($timestamp);
01443 $etag = '"'.md5($file.$last_modified).'"';
01444
01445 Header("Last-Modified: $last_modified");
01446 Header("ETag: $etag");
01447
01448 $if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ?
01449 stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']) :
01450 false;
01451 $if_none_match = isset($_SERVER['HTTP_IF_NONE_MATCH']) ?
01452 stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) :
01453 false;
01454 if (!$if_modified_since && !$if_none_match) {
01455 return;
01456 }
01457
01458 if ($if_none_match && $if_none_match != $etag) {
01459 return;
01460 }
01461 if ($if_modified_since && $if_modified_since != $last_modified) {
01462 return;
01463 }
01464
01465 Header('HTTP/1.0 304 Not Modified');
01466 die();
01467 }
01468
01469
01470 function safeDirectory($path) {
01471 GLOBAL $displayError;
01472 $result = $path;
01473 if (strpos($path,"..")!==false)
01474 $result = "";
01475 if (substr($path,0,1)=="/") {
01476 $result = "";
01477 }
01478 if ($result!=$path) {
01479 $displayError[] = translate("Illegal path specified, ignoring.");
01480 }
01481 return $result;
01482 }
01483
01484
01488 function niceSize($size) {
01489 define("SIZESTEP", 1024.0);
01490 static $sizeUnits = Array();
01491 if (count($sizeUnits)==0) {
01492 $sizeUnits[] = " ".translate("B");
01493 $sizeUnits[] = translate("KB");
01494 $sizeUnits[] = translate("MB");
01495 $sizeUnits[] = translate("GB");
01496 $sizeUnits[] = translate("TB");
01497 }
01498
01499 if ($size==="")
01500 return "";
01501
01502 $unitIndex = 0;
01503 while ($size>SIZESTEP) {
01504 $size = $size / SIZESTEP;
01505 $unitIndex++;
01506 }
01507
01508 if ($unitIndex==0) {
01509 return number_format($size, 0)." ".$sizeUnits[$unitIndex];
01510 } else {
01511 return number_format($size, 1, ".", ",")." ".$sizeUnits[$unitIndex];
01512 }
01513 }
01514
01518 function myCompare($arrA, $arrB, $caseSensitive=false) {
01519 $a = $arrA[$_GET["sort"]];
01520 $b = $arrB[$_GET["sort"]];
01521
01522
01523 if ($arrA["isBack"]) return -1;
01524 if ($arrB["isBack"]) return 1;
01525
01526 if ($arrA["isDirectory"]!=$arrB["isDirectory"]) {
01527 $result = $arrB["isDirectory"]-$arrA["isDirectory"];
01528 } else if ($arrA["isDirectory"] && $arrB["isDirectory"] && ($_GET["sort"]=="type" || $_GET["sort"]=="size")) {
01529 $result = 0;
01530 } else {
01531 if (is_string($a) OR is_string($b)) {
01532 if (!$caseSensitive) {
01533 $a = strtoupper($a);
01534 $b = strtoupper($b);
01535 }
01536 $result = strcoll($a,$b);
01537 } else {
01538 $result = $a-$b;
01539 }
01540 }
01541
01542 if (strtolower($_GET["order"])=="desc") {
01543 return -$result;
01544 } else {
01545 return $result;
01546 }
01547 }
01548
01549
01555 function myEncode($path, $filename) {
01556
01557
01558
01559
01560
01561
01562 return $path.rawurlencode($filename);
01563 }
01564
01565
01569 function getNewSortURL($newSort) {
01570 GLOBAL $path;
01571 $base = $_SERVER["PHP_SELF"];
01572 $url = $base."?sort=$newSort";
01573 if ($newSort==$_GET["sort"]) {
01574 if ($_GET["order"]=="asc" OR $_GET["order"]=="") {
01575 $url.= "&order=desc";
01576 }
01577 }
01578 if ($path!="") {
01579 $url.= "&path=$path";
01580 }
01581 return $url;
01582 }
01583
01587 function getFileType($fileInfo) {
01588
01589 $extension = $fileInfo["type"];
01590 static $fileTypes = Array(
01591 "HTML" => Array("html","htm"),
01592 "image" => Array("gif","jpg","jpeg","png","tif","tiff","bmp","art"),
01593 "text" => Array("asp","c","cfg","cpp","css","csv","conf","cue","diz","h","inf","ini","java","js","log","nfo","php","phps","pl","py","rdf","rss","rtf","sql","txt","vbs","xml"),
01594
01595
01596 "binary" => Array("asf","au","avi","bin","class","divx","doc","exe","mov","mpg","mpeg","mp3","ogg","ogm","pdf","ppt","ps","rm","swf","wmf","wmv","xls"),
01597
01598 "archive" => Array("ace","arc","bz2","cab","gz","lha","jar","rar","sit","tar","tbz2","tgz","z","zip","zoo")
01599 );
01600 static $extensions = null;
01601
01602 if ($extensions==null) {
01603 $extensions = Array();
01604 foreach($fileTypes AS $keyType => $value) {
01605 foreach($value AS $ext) $extensions[$ext] = $keyType;
01606 }
01607 }
01608
01609 if ($fileInfo["isDirectory"]) {
01610 if ($fileInfo["isBack"]) {
01611 return "dirup";
01612 } else {
01613 return "folder";
01614 }
01615 }
01616
01617 $type = $extensions[strtolower($extension)];
01618 if ($type=="") {
01619 return "unknown";
01620 } else {
01621 return $type;
01622 }
01623 }
01624
01625 function getIcon($fileType) {
01626 GLOBAL $useExternalImages, $externalIcons;
01627 if ($useExternalImages && $externalIcons[$fileType]!="") {
01628 return $externalIcons[$fileType];
01629 } else {
01630 return $_SERVER["PHP_SELF"]."?getimage=$fileType";
01631 }
01632 }
01633
01634 function dirContainsHtAccess($dirname) {
01635 if(is_dir($dirname)) {
01636 if ($dirname=="." || $dirname=="..") return false;
01637 $d = dir($dirname);
01638 while($f = $d->read()) {
01639 if ($f==".htaccess")
01640 return true;
01641 }
01642 }
01643 return false;
01644 }
01645
01646
01647 function fileIsHidden($filename) {
01648 GLOBAL $hiddenFilesWholeRegex,$protectDirsWithHtaccess;
01649
01650 if (is_dir($filename) && $protectDirsWithHtaccess) {
01651 if (!($filename=="." || $filename=="..")) {
01652 $d = dir($filename);
01653 while($f = $d->read()) {
01654 if ($f==".htaccess")
01655 return true;
01656 }
01657 }
01658 }
01659 return preg_match($hiddenFilesWholeRegex,$filename);
01660 }
01661
01662
01663 function getVersion($filename) {
01664 $version = "–";
01665 $contents = file_get_contents($filename);
01666 $no_matches = preg_match("/Id: (\S+) (\d+.\d+)/i", $contents, $matches);
01667 if ($no_matches>0) $version = $matches[2];
01668 return $version;
01669 }
01670
01671
01675 function getDescription($filename) {
01676 GLOBAL $descriptions, $descriptionFilenamesCaseSensitive;
01677
01678 if (!$descriptionFilenamesCaseSensitive) {
01679 $filename = strtolower($filename);
01680 }
01681 return $descriptions[$filename];
01682 }
01683
01684 function getPageLink($startNumber, $linkText, $linkTitle="") {
01685 GLOBAL $snifServer, $path;
01686 $url = "http://".$snifServer.$_SERVER["PHP_SELF"]."?path=".$path."&sort=".$_GET["sort"]."&order=".$_GET["order"]."&start=".$startNumber;
01687 if ($linkTitle!="") {
01688 $titleAttribute = " title=\"$linkTitle\"";
01689 } else {
01690 $titleAttribute = "";
01691 }
01692 return "<a href=\"$url\"$titleAttribute>$linkText</a> ";
01693 }
01694
01695 function getPagingHeader() {
01696 GLOBAL $pageStart, $usePaging, $pagingNumberOfPages, $pagingActualPage, $pageNumber, $files;
01697 static $displayPages = Array();
01698 if (count($displayPages)==0) {
01699 $displayPages[] = 0;
01700 for ($i=$pagingActualPage-1; $i<$pagingActualPage+3; $i++) {
01701 if ($i>=0 && $i<$pagingNumberOfPages) {
01702 $displayPages[] = $i;
01703 }
01704 }
01705 $displayPages[] = $pagingNumberOfPages-1;
01706 $displayPages = array_unique($displayPages);
01707 }
01708
01709 $header = translate("pages")." ";
01710 if ($pageStart>0) {
01711 $header.= getPageLink($pageStart-$usePaging, "«", translate("previous"));
01712 }
01713 if ($pageStart+$usePaging<count($files)) {
01714 $header.= getPageLink($pageStart+$usePaging, "»", translate("next"));
01715 }
01716 foreach($displayPages as $i => $pageNumber) {
01717 if ($pageNumber-$displayPages[$i-1] > 1) {
01718 $header.= ".. ";
01719 }
01720 if ($pageNumber==$pagingActualPage) {
01721 $header.= "<span class=\"snWhite\">".($pageNumber+1)." </span>";
01722 } else {
01723 $header.= getPageLink($pageNumber*$usePaging, $pageNumber+1);
01724 }
01725 }
01726
01727 return $header;
01728 }
01729
01730 function getPathLink($directory) {
01731 GLOBAL $directDirectoryLinks;
01732 if ($directDirectoryLinks) {
01733 return $directory."/";
01734 } else {
01735 return $_SERVER["PHP_SELF"]."?path=".urlEncode($directory)."/";
01736 }
01737 }
01738
01751 function iTrunc($string, $length) {
01752 if ($length==0) {
01753 return $string;
01754 }
01755 if (strlen($string)<=$length) {
01756 return $string;
01757 }
01758
01759 $pos = strrpos($string,".");
01760 if ($pos>=$length-4) {
01761 $string = substr($string,0,$length-4);
01762 $pos = strrpos($string,".");
01763 }
01764 if ($pos>=$length*0.4) {
01765 return substr($string,0,$pos+1)."...";
01766 }
01767
01768 $pos = strrpos($string," ");
01769 if ($pos>=$length-4) {
01770 $string = substr($string,0,$length-4);
01771 $pos = strrpos($string," ");
01772 }
01773 if ($pos>=$length*0.4) {
01774 return substr($string,0,$pos)."...";
01775 }
01776
01777 return substr($string,0,$length-4)."...";
01778 }
01779
01780
01781 function getDirSize($dirname) {
01782 $dir = dir($dirname);
01783 $fileCount = 0;
01784 while ($filename = $dir->read()) {
01785 if (!fileIsHidden($dirname."/".$filename))
01786 $fileCount++;
01787 }
01788 return $fileCount-2;
01789 }
01790
01791
01792
01794
01795
01796
01797
01798 if ($path!="") {
01799 $hidden = fileIsHidden(substr($path,0,-1));
01800 if ($hidden || !@chdir($path)) {
01801 $displayError[] = sprintf(translate("%s is not a subdirectory of the current directory."), $path);
01802 $path = "";
01803 }
01804 }
01805 $dir = dir(".");
01806
01807
01808 $descriptions = Array();
01809 if ($useDescriptionsFrom!="") {
01810 $descriptionsFile = @file($useDescriptionsFrom);
01811 if ($descriptionsFile!==false) {
01812 for ($i=0;$i<count($descriptionsFile);$i++) {
01813 $d = explode($separationString,$descriptionsFile[$i]);
01814 if (!$descriptionFilenamesCaseSensitive) {
01815 $d[0] = strtolower($d[0]);
01816 }
01817 $descriptions[$d[0]] = htmlentities(join($separationString, array_slice($d, 1)));
01818 }
01819 }
01820 }
01821
01822
01823 $files = Array();
01824 while($entry = $dir->read()) {
01825
01826 if (fileIsHidden($entry))
01827 continue;
01828
01829
01830 if (!$allowSubDirs AND is_dir($entry))
01831 continue;
01832
01833 $f = Array();
01834
01835 $f["name"] = $entry;
01836 $f["isDownloadable"] = (substr(strtolower($entry), -4)!=".php") || $allowPHPDownloads;
01837 $f["isDirectory"] = is_dir($entry);
01838 $fDate = @filemtime($entry);
01839 $f["date"] = $fDate;
01840 $f["fullDate"] = date("r", $fDate);
01841 $f["shortDate"] = date(translate("DATEFORMAT"), $fDate);
01842
01843
01844 $f["description"] = getDescription($entry);
01845 if ($f["isDirectory"]) {
01846 $f["type"] = "<DIR>";
01847 $f["size"] = "";
01848 $f["niceSize"] = "";
01849
01850
01851 if ($entry=="..") {
01852
01853 $pathArr = explode("/",$path);
01854 $link = implode("/",array_slice($pathArr,0,count($pathArr)-2));
01855
01856
01857 if ($link=="") {
01858
01859 if ($path=="")
01860 continue;
01861 $f["link"] = $_SERVER["PHP_SELF"];
01862 } else {
01863 $link.= "/";
01864 $f["link"] = $_SERVER["PHP_SELF"]."?path=".urlEncode($link);
01865 }
01866 $f["isBack"] = true;
01867 if ($useBackForDirUp) {
01868 $f["displayName"] = translate("[ back ]");
01869 }
01870 } else {
01871 $filesInDir = getDirSize($entry);
01872 if ($filesInDir==1) {
01873 $f["niceSize"] = translate("1 item");
01874 } else {
01875 $f["niceSize"] = sprintf(translate("%d items"),$filesInDir);
01876 }
01877 $f["link"] = getPathLink($path.$entry);
01878 }
01879 } else {
01880 if (is_link($entry)) {
01881 $linkTarget = readlink($entry);
01882 $pi = pathinfo($linkTarget);
01883 $scriptDir = dirname($_SERVER["SCRIPT_FILENAME"]);
01884 if (strpos($pi["dirname"], $scriptDir)===0) {
01885 $f["type"] = "<LINK>";
01886
01887 $f["date"] = filemtime($linkTarget);
01888 $f["link"] = $path.urlencode(substr($linkTarget, strlen($scriptDir)+1));
01889 } else {
01890
01891 continue;
01892 }
01893 } else {
01894 $fSize = @filesize($entry);
01895 $f["size"] = $fSize;
01896 $f["fullSize"] = number_format($fSize,0,".",",");
01897 $f["niceSize"] = nicesize($fSize);
01898 $pi = pathinfo($entry);
01899 $f["type"] = $pi["extension"];
01900 $f["link"] = myEncode($path,$entry);
01901 if (in_array("cvsversion", $displayColumns)) {
01902 $f["cvsversion"] = getVersion($entry);
01903 }
01904 }
01905 }
01906 if (!$f["isBack"]) {
01907 $f["displayName"] = htmlentities(iTrunc($f["name"], $truncateLength));
01908 }
01909 $f["filetype"] = getFileType($f);
01910 $f["icon"] = getIcon($f["filetype"]);
01911 if ($useAutoThumbnails && $f["filetype"]=="image") {
01912 $f["thumbnail"] = "<a href=\"".urldecode($f["link"])."\"><img src=\"".$PHP_SELF."?thumbnail=".urlencode($path.$f["name"])."\" style=\"text-align: left;\" alt=\"\"/></a>";
01913 }
01914
01915 $files[] = $f;
01916 }
01917
01918 usort($files, "myCompare");
01919
01920
01921 $pagingInEffect = $usePaging>0 && count($files)>$usePaging;
01922 if ($usePaging>0) {
01923 $pageStart = $_GET["start"];
01924 if ($pageStart=="" || $pageStart<0 || $pageStart>count($files))
01925 $pageStart = 0;
01926 $pagingActualPage = floor($pageStart / $usePaging);
01927 $pagingNumberOfPages = ceil(count($files) / $usePaging);
01928 } else {
01929 $pageStart = 0;
01930 $usePaging = count($files);
01931 }
01932 $pageEnd = min(count($files),$pageStart+$usePaging);
01933
01934
01935
01936
01938
01939
01940 $columns = count($displayColumns);
01941
01942 Header("Content-Type: text/html; charset=UTF-8");
01943 echo "<?php xml version=\"1.0\" encoding=\"UTF-8\"?>";
01944 ?>
01945
01946 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
01947 <html xmlns="http://www.w3.org/1999/xhtml">
01948 <head>
01949 <title><?php echo translate("Index of")." ".htmlentities(dirname($_SERVER["PHP_SELF"])."/".$path);?></title>
01950 <?php
01951 if ($externalStylesheet!="") {
01952 ?>
01953 <link rel="stylesheet" type="text/css" href="<?php echo $externalStylesheet?>" />
01954 <?php
01955 }
01956 ?>
01957 <style type="text/css">
01958
01959
01960 <?php
01961 if ($externalStylesheet=="") {
01962 ?>
01963 body.snif {
01964 background: #ffffff;
01965 }
01966 table.snif {
01967 border: 1px solid #444444;
01968 }
01969 td.snDir {
01970 color: #ffffff;
01971 background-color: #000000;
01972 }
01973 td.snDir a {
01974 color:white;
01975 }
01976 tr.snHeading, td.snHeading, td.snHeading a {
01977 color: #dddddd;
01978 background-color: #444444;
01979 }
01980 tr.snF td a {
01981 color: #000000;
01982 }
01983 tr.snF td a:hover, a.snif:hover {
01984 background-color: #bbbbee;
01985 }
01986 tr.snEven {
01987 background-color: #eeeeee;
01988 }
01989 tr.snOdd {
01990 background-color: #dddddd;
01991 }
01992 tr.snF td {
01993 color: #444444;
01994 }
01995 .snCopyright * {
01996 color: #bbbbbb;
01997 }
01998 .snWhite {
01999 color: white;
02000 }
02001 <?php
02002 }
02003 ?>
02004
02005
02006 .snif * {
02007 font-family: Tahoma, Sans-Serif;
02008 font-size: 10pt;
02009 }
02010 .snif a, a.snif {
02011 text-decoration: none;
02012 }
02013 .snif a:hover, a.snif:hover {
02014 text-decoration: underline;
02015 }
02016 .snCopyright * {
02017 font-size: 8pt;
02018 }
02019 .snifSmaller {
02020 font-weight: normal;
02021 font-size: 8pt;
02022 }
02023 td.snDir {
02024 font-weight: bold;
02025 }
02026 tr.snHeading, td.snHeading, td.snHeading a {
02027 font-weight: bold;
02028 }
02029
02030
02031
02032 table.snif {
02033 <?php
02034 if ($tableWidth100Percent) {
02035 echo "width:100%;";
02036 }
02037 ?>
02038 }
02039 table.snif td {
02040 padding-left: 10px;
02041 padding-right: 10px;
02042 }
02043 table.snif td.littlepadding {
02044 padding-left: 4px;
02045 padding-right: 0px;
02046 }
02047 td.snDir {
02048 padding-top: 3px;
02049 padding-bottom: 3px;
02050 }
02051 tr.snHeading, td.snHeading, td.snHeading a {
02052 padding-top: 3px;
02053 padding-bottom: 3px;
02054 }
02055 tr.snF td {
02056 padding-top: 2px;
02057 padding-bottom: 2px;
02058 vertical-align: top;
02059 padding-left: 10px;
02060 padding-right: 10px;
02061 white-space: nowrap;
02062 }
02063 .snif img {
02064 border:none;
02065 }
02066 .snW {
02067 white-space: normal;
02068 }
02069 </style>
02070 </head>
02071 <body class="snif">
02072 <?php
02073 if (count($displayError)>0) {
02074 foreach($displayError AS $error) {
02075 echo "<b style=\"color:red\">$error</b><br/>";
02076 }
02077 echo "<br/>";
02078 }
02079 ?>
02080 <table cellpadding="0" cellspacing="0" class="snif">
02081 <tr>
02082 <td class="snDir" colspan="<?php echo count($displayColumns)?>">
02083 <?php
02084 $baseDirname = $snifServer.htmlentities(dirname($_SERVER["PHP_SELF"]));
02085 $pathToSnif = explode("/",$baseDirname);
02086 echo "http://".join("/",array_slice($pathToSnif, 0, -1))."/";
02087 echo "<a href=\"".dirname($_SERVER["PHP_SELF"])."/\">".join("/",array_slice($pathToSnif, -1))."</a>";
02088 $pathArr = explode("/",$path);
02089 for ($i=0; $i<count($pathArr)-1; $i++) {
02090 $dirLink = getPathLink(join("/",array_slice($pathArr, 0, $i+1)));
02091 echo "/<a href=\"$dirLink\">".htmlentities($pathArr[$i])."</a>";
02092 }
02093 ?><br/>
02094 <span class="snifSmaller"><?php echo $descriptions["."];?></span>
02095 </td>
02096 </tr>
02097 <?php
02098 if ($pagingInEffect) {
02099 ?>
02100 <tr class="snHeading">
02101 <td class="snHeading" colspan="<?php echo count($displayColumns)?>">
02102 <?php
02103 echo getPagingHeader();
02104 ?>
02105 </td>
02106 </tr>
02107 <?php
02108 }
02109 ?>
02110 <tr class="snHeading">
02111 <?php
02112 foreach($displayColumns AS $column) {
02113 switch ($column) {
02114 case "download":
02115 ?>
02116 <td class="snHeading littlepadding"> </td>
02117 <?php
02118 break;
02119 case "icon":
02120 ?>
02121 <td class="snHeading littlepadding"> </td>
02122 <?php
02123 break;
02124 case "name":
02125 ?>
02126 <td class="snHeading">
02127 <!--<img src="<?php echo $PHP_SELF?>?getimage=blank" alt="" width="30" height="16" style="vertical-align:middle;"/>--><a href="<?php echo getNewSortURL("name");?>"><?php echo translate("name");?></a>
02128 <?php
02129 $sort = $_GET["sort"];
02130 if ($sort=="name")
02131 echo "<img src=\"".getIcon($_GET["order"])."\" width=\"5\" height=\"3\" style=\"vertical-align:middle;\" alt=\"".translate($_GET["order"])."\"/>";
02132 ?>
02133 </td>
02134 <?php
02135 break;
02136 case "type":
02137 ?>
02138 <td class="snHeading">
02139 <a href="<?php echo getNewSortURL("type");?>"><?php echo translate("type");?></a>
02140 <?php
02141 if ($sort=="type")
02142 echo "<img src=\"".getIcon($_GET["order"])."\" width=\"5\" height=\"3\" style=\"vertical-align:middle;\" alt=\"".translate($_GET["order"])."\"/>";
02143 ?>
02144 </td>
02145 <?php
02146 break;
02147 case "size":
02148 ?>
02149 <td class="snHeading" align="right">
02150 <?php
02151 if ($sort=="size")
02152 echo "<img src=\"".getIcon($_GET["order"])."\" width=\"5\" height=\"3\" style=\"vertical-align:middle;\" alt=\"".translate($_GET["order"])."\"/>";
02153 ?>
02154 <a href="<?php echo getNewSortURL("size");?>"><?php echo translate("size");?></a>
02155 </td>
02156 <?php
02157 break;
02158 case "date":
02159 ?>
02160 <td class="snHeading">
02161 <a href="<?php echo getNewSortURL("date");?>"><?php echo translate("date");?></a>
02162 <?php
02163 if ($sort=="date")
02164 echo "<img src=\"".getIcon($_GET["order"])."\" width=\"5\" height=\"3\" style=\"vertical-align:20%;\" alt=\"".translate($_GET["order"])."\"/>";
02165 ?>
02166 </td>
02167 <?php
02168 break;
02169 case "description":
02170 ?>
02171 <td class="snHeading"<?php if ($descriptionColumnWidth>0) echo " style=\"width:".$descriptionColumnWidth."px;\"";?>><?php echo translate("description");?></td>
02172 <?php
02173 break;
02174 case "cvsversion":
02175 ?>
02176 <td class="snHeading"><?php echo translate("CVS");?></td>
02177 <?php
02178 break;
02179 }
02180 }
02181 ?>
02182 </tr>
02183 <?php
02184 for ($i=$pageStart;$i<$pageEnd;$i++) {
02185 ?>
02186 <tr class="snF <?php echo ($i%2==0) ? "snEven" : "snOdd"?>">
02187 <?php
02188 foreach($displayColumns AS $column) {
02189 switch ($column) {
02190 case "download":
02191 echo "<td class=\"littlepadding\">";
02192 if ($files[$i]["isDirectory"] OR !$files[$i]["isDownloadable"]) {
02193 ?>
02194 <img src="<?php echo $PHP_SELF?>?getimage=blank" alt="" width="7" height="16" style="vertical-align:middle;"/>
02195 <?php
02196 } else {
02197 ?>
02198 <a href="<?php echo $PHP_SELF?>?path=<?php echo rawurlencode($path)?>&download=<?php echo rawurlencode($files[$i]["name"]);?>"><img src="<?php echo getIcon("download")?>" alt="<?php echo translate("download");?>" title="<?php echo translate("download");?>" width="7" height="16" style="vertical-align:middle;"/></a>
02199 <?php
02200 }
02201 echo "</td>";
02202 break;
02203 case "icon":
02204 echo "<td class=\"littlepadding\">";
02205 ?>
02206 <a href="<?php echo $files[$i]["link"];?>" title="<?php echo htmlentities($files[$i]["name"]);?>"><img src="<?php echo $files[$i]["icon"]?>" alt="" title="<?php echo translate($files[$i]["filetype"])?>" width="16" height="16" style="vertical-align:middle;"/></a>
02207 <?php
02208 echo "</td>";
02209 break;
02210 case "name":
02211 echo "<td>";
02212 ?><a href="<?php echo $files[$i]["link"];?>" title="<?php echo htmlentities($files[$i]["name"]);?>"><?php
02213 echo $files[$i]["displayName"]." </a>";
02214 echo "</td>";
02215 break;
02216
02217 case "type":
02218 echo "<td>";
02219 echo $files[$i]["type"];
02220 echo "</td>";
02221 break;
02222
02223 case "size":
02224 echo "<td align=\"right\">";
02225 if ($files[$i]["fullSize"]!="") echo " <span title=\"".$files[$i]["fullSize"]." ".translate("Bytes")."\">";
02226 echo $files[$i]["niceSize"];
02227 if ($files[$i]["fullSize"]!="") echo " </span>";
02228 echo "</td>";
02229 break;
02230
02231 case "date":
02232 echo "<td>";
02233 echo "<span title=\"".$files[$i]["fullDate"]."\">".$files[$i]["shortDate"]."</span>";
02234 echo "</td>";
02235 break;
02236
02237 case "description":
02238 ?><td class="snW" style="white-space: normal;">
02239 <?php
02240 if ($files[$i]["filetype"]=="image") {
02241 echo $files[$i]["thumbnail"];
02242 }
02243 ?>
02244 <?php echo $files[$i]["description"];?>
02245 </td><?php
02246 break;
02247
02248 case "cvsversion":
02249 echo "<td>";
02250 echo $files[$i]["cvsversion"];
02251 echo "</td>";
02252 break;
02253 }
02254 }
02255 ?>
02256 </tr><?php
02257 }
02258 if ($pagingInEffect) {
02259 ?>
02260 <tr class="snHeading">
02261 <td class="snHeading" colspan="<?php echo $columns?>">
02262 <?php
02263 echo getPagingHeader();
02264 ?>
02265 </td>
02266 </tr>
02267 <?php
02268 }
02269 ?>
02270 </table>
02271 <div class="snCopyright">
02272 <br/>
02273 <a href="http://www.bitfolge.de/snif">
02274 snif 1.5.2
02275 © 2003-04 Kai Blankenhorn</a><br/>
02276 <a href="http://validator.w3.org/check/referer"><?php echo translate("valid");?> XHTML 1.1</a>
02277 <a href="http://jigsaw.w3.org/css-validator/check/referer"><?php echo translate("valid");?> CSS 2</a>
02278 </div>
02279 </body>
02280 </html>