From cf949839e7b0f00f4fc277c23a8b9960e25f97df Mon Sep 17 00:00:00 2001 From: yujinbing Date: Mon, 24 Jul 2023 09:06:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=B8=8A=E4=B8=80=E7=89=88?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/head.php | 3 +- admin/sou.php | 19 +- admin/visitor.php | 2 - include/IP/index.php | 3196 +++++++++++++++++++++++++++++++++++- include/tj.php | 2 +- site/baidu_api.php | 3 +- template/default/index.php | 7 +- 7 files changed, 3183 insertions(+), 49 deletions(-) diff --git a/admin/head.php b/admin/head.php index 39bf8af..2932ae4 100644 --- a/admin/head.php +++ b/admin/head.php @@ -50,7 +50,8 @@ if($applyrows>0) { - + +
  • 退出登录
  • diff --git a/admin/sou.php b/admin/sou.php index de51554..baf9e83 100644 --- a/admin/sou.php +++ b/admin/sou.php @@ -99,6 +99,11 @@ echo '

    修改搜索引擎


    注意:当前仅支持搜索词作为末尾,例如:https://www.baidu.com/s?word=搜索内容
    如果使用GET请求搜索,搜索词不处于末尾,如https://www.baidu.com/s?wd=搜索词&ie=UTF-8可将搜索词参数调换到末尾,如https://www.baidu.com/s?ie=UTF-8&wd=搜索词多个GET参数用以&分隔
    如果搜索词不在末尾且非GET请求,如https://xxx.com/s/搜索词.html类似情况,可用PHP页面定制搜索接口查看教程
    +
    + +例:百度搜索 https://www.baidu.com百度搜索 +
    +

    注:百度搜索的电脑端和手机端不会自适应,需要手动设置手机端,如https://m.baidu.com/s?word=
    如果你添加的搜索区分手机端和PC端,则需要手动设置。一般情况下留空即可
    @@ -140,18 +145,19 @@ $name=$_POST['name']; $alias=$_POST['alias']; $hint=$_POST['hint']; $link=$_POST['link']; +$homepage=$_POST['homepage']; $waplink=$_POST['waplink']; $color=$_POST['color']; $icon=$_POST['icon']; if($_POST['st']==true){$st=1;}else{$st=0;} $sou_order = $sousrows+1; -if (empty($name) && empty($alias)&& empty($hint) && empty($link) && empty($color) && empty($icon)){ +if (empty($name) && empty($alias)&& empty($hint) && empty($link)&& empty($homepage) && empty($color) && empty($icon)){ echo ''; } else { -$sql="INSERT INTO `lylme_sou` (`sou_id`, `sou_alias`, `sou_name`, `sou_hint`, `sou_color`, `sou_link`, `sou_waplink`, `sou_icon`, `sou_st`, `sou_order`) VALUES -(NULL, '".$alias."', '".$name."', '".$hint."', '".$color."', '".$link."', '".$waplink."', '".$icon."', '".$st."', '".$sou_order."'); +$sql="INSERT INTO `lylme_sou` (`sou_id`, `sou_alias`, `sou_name`, `sou_hint`, `sou_color`, `sou_link`, `sou_homepage`, `sou_waplink`, `sou_icon`, `sou_st`, `sou_order`) VALUES +(NULL, '".$alias."', '".$name."', '".$hint."', '".$color."', '".$link."','".$homepage."', '".$waplink."', '".$icon."', '".$st."', '".$sou_order."'); "; if($DB->query($sql)){ @@ -171,6 +177,7 @@ $name=$_POST['name']; $alias=$_POST['alias']; $hint=$_POST['hint']; $link=$_POST['link']; +$homepage=$_POST['homepage']; $waplink=$_POST['waplink']; $color=$_POST['color']; $icon=$_POST['icon']; @@ -181,7 +188,7 @@ if (empty($name) && empty($alias)&& empty($hint) && empty($link) && empty($color echo ''; } else { -$sql="UPDATE `lylme_sou` SET `sou_alias` = '".$alias."', `sou_name` = '".$name."', `sou_hint` = '".$hint."', `sou_color` = '".$color."', `sou_link` = '".$link."', `sou_waplink` = '".$waplink."', `sou_icon` = '".$icon."', `sou_st` = '".$st."', `sou_order` = '".$order."' WHERE `lylme_sou`.`sou_id` = ".$id.";"; +$sql="UPDATE `lylme_sou` SET `sou_alias` = '".$alias."', `sou_name` = '".$name."', `sou_hint` = '".$hint."', `sou_color` = '".$color."', `sou_link` = '".$link."',`sou_homepage` = '".$homepage."', `sou_waplink` = '".$waplink."', `sou_icon` = '".$icon."', `sou_st` = '".$st."', `sou_order` = '".$order."' WHERE `lylme_sou`.`sou_id` = ".$id.";"; if($DB->query($sql)) @@ -203,14 +210,14 @@ else { echo '
    系统共有 '.$sousrows.' 个搜索引擎
    新增搜索引擎
    - + '; $rs=$DB->query("SELECT * FROM `lylme_sou` ORDER BY `lylme_sou`.`sou_order` ASC"); while($res = $DB->fetch($rs)) { -echo '
    排序权重名称别名地址状态操作
    排序权重名称别名地址主页状态操作
    '.$res['sou_order'].''.$res['sou_name'].''.$res['sou_alias'].''.$res['sou_link'].''; +echo '
    '.$res['sou_order'].''.$res['sou_name'].''.$res['sou_alias'].''.$res['sou_link'].''.$res['sou_homepage'].''; if($res['sou_st'] == 1){echo '开启';}else{echo '关闭';} diff --git a/admin/visitor.php b/admin/visitor.php index f6c9c72..dcb5197 100644 --- a/admin/visitor.php +++ b/admin/visitor.php @@ -26,8 +26,6 @@ else { echo file_get_contents($iptxt); } ?> - - diff --git a/include/IP/index.php b/include/IP/index.php index d741a13..ac73de4 100644 --- a/include/IP/index.php +++ b/include/IP/index.php @@ -1,36 +1,3164 @@ - - - - - 本站访问记录 - <?php echo explode("-", $conf['title'])[0];?> - - - - - - - -
    -

    本站访问记录:

    -404'); - echo file_get_contents($iptxt); -} -?> - -
    +4GB), enable this for correct +// file size calculation. +// Default: $_CONFIG['large_files'] = false; +// +$_CONFIG['large_files'] = false; + +// +// The session name, which is used as a cookie name. +// Change this to something original if you have multiple copies in the same space +// and wish to keep their authentication separate. +// The value can contain only letters and numbers. For example: MYSESSION1 +// More info at: http://www.php.net/manual/en/function.session-name.php +// Default: $_CONFIG['session_name'] = ""; +// +$_CONFIG['session_name'] = ""; + +/***************************************************************************/ +/* TÕLKED */ +/* */ +/* TRANSLATIONS. */ +/***************************************************************************/ + +$_TRANSLATIONS = array(); + +// Albanian +$_TRANSLATIONS["al"] = array( + "file_name" => "Emri Skedarit", + "size" => "Madhësia", + "last_changed" => "Ndryshuar", + "total_used_space" => "Memorija e përdorur total", + "free_space" => "Memorija e lirë", + "password" => "Fjalëkalimi", + "upload" => "Ngarko skedarë", + "failed_upload" => "Ngarkimi i skedarit dështoi!", + "failed_move" => "Lëvizja e skedarit në udhëzuesin e saktë deshtoi!", + "wrong_password" => "Fjalëkalimi i Gabuar!!", + "make_directory" => "New dir", + "new_dir_failed" => "Failed to create directory", + "chmod_dir_failed" => "Failed to change directory rights", + "unable_to_read_dir" => "Unable to read directory", + "location" => "Location", + "root" => "Root" +); + +// Czech +$_TRANSLATIONS["cz"] = array( + "file_name" => "Název souboru", + "size" => "Velikost", + "last_changed" => "Změněno", + "total_used_space" => "Obsazený prostor", + "free_space" => "Volný prostor", + "password" => "Heslo", + "upload" => "Nahrát", + "failed_upload" => "Nahrávání se nezdařilo!", + "failed_move" => "Přesun souboru do určeného adresáře se nezdařil!", + "wrong_password" => "Chybné heslo", + "make_directory" => "Nový adresář", + "new_dir_failed" => "Vytvoření adresáře se nezdařilo", + "chmod_dir_failed" => "Změna práv adresáře se nezdařila", + "unable_to_read_dir" => "Chyba při čtení adresáře", + "location" => "Umístění", + "root" => "Kořenový adresář", + "log_file_permission_error" => "Skript nemá oprávnění k zápisu do souboru protokolu.", + "upload_not_allowed" => "Konfigurační skript neumožňuje nahrávání v tomto adresáři.", + "upload_dir_not_writable" => "Tento adresář nemá oprávnění k zápisu.", + "mobile_version" => "Zobrazení pro mobil", + "standard_version" => "Standardní zobrazení", + "page_load_time" => "Stránka nahrána za %.2f ms", + "wrong_pass" => "Špatné uživatelské jméno nebo heslo", + "username" => "Uživatelské jméno", + "log_in" => "Přihlásit se", + "upload_type_not_allowed" => "Tento typ souboru není povolen pro nahrávání.", + "del" => "Smazat", + "log_out" => "Odhlásit se" +); + +// Dutch +$_TRANSLATIONS["nl"] = array( + "file_name" => "Bestandsnaam", + "size" => "Omvang", + "last_changed" => "Laatst gewijzigd", + "total_used_space" => "Totaal gebruikte ruimte", + "free_space" => "Beschikbaar", + "password" => "Wachtwoord", + "upload" => "Upload", + "failed_upload" => "Fout bij uploaden van bestand!", + "failed_move" => "Fout bij het verplaatsen van tijdelijk uploadbestand!", + "wrong_password" => "Fout wachtwoord!", + "make_directory" => "Nieuwe folder", + "new_dir_failed" => "Fout bij aanmaken folder!", + "chmod_dir_failed" => "Rechten konden niet gewijzigd worden!", + "unable_to_read_dir" => "Niet mogelijk om directorie te lezen", + "location" => "Locatie", + "root" => "Root", + "log_file_permission_error" => "Script heeft geen toegang tot het logbestand.", + "upload_not_allowed" => "Uploaden van bestanden is niet toegestaan.", + "upload_dir_not_writable" => "Het is niet toegestaan in deze directorie bestanden te plaatsen.", + "mobile_version" => "Mobiele weergave", + "standard_version" => "Standaard weergave", + "page_load_time" => "Pagina geladen in %.2f ms", + "wrong_pass" => "Foutieve gebruikersnaam of wachtwoord", + "username" => "Gebruikersnaam", + "log_in" => "Inloggen", + "upload_type_not_allowed" => "Dit type bestand is niet toegestaan.", + "del" => "Verwijder", // short for Delete + "log_out" => "Uitloggen" +); + +// 中文 +$_TRANSLATIONS["cn"] = array( + "file_name" => "文件名", + "size" => "大小", + "last_changed" => "上次更改", + "total_used_space" => "总已用空间", + "free_space" => "剩余空间", + "password" => "密码", + "upload" => "上传", + "failed_upload" => "上传失败", + "failed_move" => "移动失败", + "wrong_password" => "密码错误", + "make_directory" => "生成目录", + "new_dir_failed" => "新目录失败", + "chmod_dir_failed" => "chmod目录失败", + "unable_to_read_dir" => "无法读取目录", + "location" => "位置", + "root" => "根目录", + "log_file_permission_error" => "脚本没有写入日志文件的权限。", + "upload_not_allowed" => "The script configuration does not allow uploading in this directory.", + "upload_dir_not_writable" => "脚本配置不允许在此目录中上载。", + "mobile_version" => "切换手机浏览", + "standard_version" => "切换标准浏览", + "page_load_time" => "页面加载时间 %.2f 毫秒", + "username" => "用户名", + "log_in" => "登录", + "upload_type_not_allowed" => "不允许上载此文件类型。", + "del" => "删除", + "log_out" => "注销登录" +); +// English +$_TRANSLATIONS["en"] = array( + "file_name" => "File name", + "size" => "Size", + "last_changed" => "Last updated", + "total_used_space" => "Total space used", + "free_space" => "Free space", + "password" => "Password", + "upload" => "Upload", + "failed_upload" => "Failed to upload the file!", + "failed_move" => "Failed to move the file into the right directory!", + "wrong_password" => "Wrong password", + "make_directory" => "New directory", + "new_dir_failed" => "Failed to create directory", + "chmod_dir_failed" => "Failed to change directory rights", + "unable_to_read_dir" => "Unable to read directory", + "location" => "Location", + "root" => "Root", + "log_file_permission_error" => "The script does not have permissions to write the log file.", + "upload_not_allowed" => "The script configuration does not allow uploading in this directory.", + "upload_dir_not_writable" => "This directory does not have write permissions.", + "mobile_version" => "Mobile view", + "standard_version" => "Standard view", + "page_load_time" => "Page loaded in %.2f ms", + "wrong_pass" => "Wrong username or password", + "username" => "Username", + "log_in" => "Log in", + "upload_type_not_allowed" => "This file type is not allowed for uploading.", + "del" => "Delete", + "log_out" => "Log out" +); + +// Estonian +$_TRANSLATIONS["et"] = array( + "file_name" => "Faili nimi", + "size" => "Suurus", + "last_changed" => "Viimati muudetud", + "total_used_space" => "Kokku kasutatud", + "free_space" => "Vaba ruumi", + "password" => "Parool", + "upload" => "Uploadi", + "failed_upload" => "Faili ei õnnestunud serverisse laadida!", + "failed_move" => "Faili ei õnnestunud õigesse kausta liigutada!", + "wrong_password" => "Vale parool", + "make_directory" => "Uus kaust", + "new_dir_failed" => "Kausta loomine ebaõnnestus", + "chmod_dir_failed" => "Kausta õiguste muutmine ebaõnnestus", + "unable_to_read_dir" => "Unable to read directory", + "location" => "Asukoht", + "root" => "Peakaust" +); + +// Finnish +$_TRANSLATIONS["fi"] = array( + "file_name" => "Tiedoston nimi", + "size" => "Koko", + "last_changed" => "Muokattu", + "total_used_space" => "Yhteenlaskettu koko", + "free_space" => "Vapaa tila", + "password" => "Salasana", + "upload" => "Lisää tiedosto", + "failed_upload" => "Tiedoston lisäys epäonnistui!", + "failed_move" => "Tiedoston siirto kansioon epäonnistui!", + "wrong_password" => "Väärä salasana", + "make_directory" => "Uusi kansio", + "new_dir_failed" => "Uuden kansion luonti epäonnistui!", + "chmod_dir_failed" => "Kansion käyttäjäoikeuksien muuttaminen epäonnistui!", + "unable_to_read_dir" => "Kansion sisältöä ei voi lukea.", + "location" => "Paikka", + "root" => "Juurihakemisto", + "log_file_permission_error" => "Ohjelman ei ole sallittu kirjoittaa lokiin.", + "upload_not_allowed" => "Ohjelman asetukset eivät salli tiedoston lisäämistä tähän kansioon.", + "upload_dir_not_writable" => "Kansioon tallentaminen epäonnistui.", + "mobile_version" => "Mobiilinäkymä", + "standard_version" => "Tavallinen näkymä", + "page_load_time" => "Sivu ladattu %.2f ms:ssa", + "wrong_pass" => "Väärä käyttäjätunnus tai salasana", + "username" => "Käyttäjätunnus", + "log_in" => "Kirjaudu sisään", + "log_out" => "Kirjaudu ulos", + "upload_type_not_allowed" => "Tämän tiedostotyypin lisääminen on estetty.", + "del" => "Poista" +); + +// French +$_TRANSLATIONS["fr"] = array( + "file_name" => "Nom de fichier", + "size" => "Taille", + "last_changed" => "Ajouté", + "total_used_space" => "Espace total utilisé", + "free_space" => "Espace libre", + "password" => "Mot de passe", + "upload" => "Envoyer un fichier", + "failed_upload" => "Erreur lors de l'envoi", + "failed_move" => "Erreur lors du changement de dossier", + "wrong_password" => "Mauvais mot de passe", + "make_directory" => "Nouveau dossier", + "new_dir_failed" => "Erreur lors de la création du dossier", + "chmod_dir_failed" => "Impossible de changer les permissions du dossier", + "unable_to_read_dir" => "Impossible de lire le dossier", + "location" => "Localisation", + "root" => "Racine", + "log_file_permission_error" => "Le script ne possède pas les permissions pour écrire un fichier d'enregistrement.", + "upload_not_allowed" => "La configuration actuelle ne permet de déposer un fichier dans ce dossier.", + "upload_dir_not_writable" => "Ce dossier ne possède pas les permissions en écriture.", + "mobile_version" => "Vue mobile", + "standard_version" => "Vue standard", + "page_load_time" => "Page chargée en %.2f ms", + "wrong_pass" => "Identifiant ou mot de passe incorrect", + "username" => "Identifiant", + "log_in" => "Connexion", + "upload_type_not_allowed" => "Ce format de fichier n'est pas autorisé.", + "del" => "Effacer", + "log_out" => "Déconnexion" +); + +// German +$_TRANSLATIONS["de"] = array( + "file_name" => "Dateiname", + "size" => "Größe", + "last_changed" => "Letzte Änderung", + "total_used_space" => "Benutzter Speicherplatz", + "free_space" => "Freier Speicherplatz", + "password" => "Passwort", + "upload" => "Upload", + "failed_upload" => "Upload ist fehlgeschlagen!", + "failed_move" => "Verschieben der Datei ist fehlgeschlagen!", + "wrong_password" => "Falsches Passwort", + "make_directory" => "Neuer Ordner", + "new_dir_failed" => "Erstellen des Ordners fehlgeschlagen", + "chmod_dir_failed" => "Veränderung der Zugriffsrechte des Ordners fehlgeschlagen", + "unable_to_read_dir" => "Ordner konnte nicht gelesen werden", + "location" => "Ort", + "root" => "Wurzelverzeichnis", + "log_file_permission_error" => "Das Script kann wegen fehlenden Berechtigungen keine Log Datei schreiben.", + "upload_not_allowed" => "Die Scriptkonfiguration erlaubt kein Hochladen in dieses Verzeichnis.", + "upload_dir_not_writable" => "Dieser Ordner besitzt keine Schreibrechte.", + "mobile_version" => "Mobile Ansicht", + "standard_version" => "Normale Ansicht", + "page_load_time" => "Die Seite wurde in %.2f ms geladen", + "wrong_pass" => "Benutzername oder Kennwort falsch", + "username" => "Benutzername", + "log_in" => "Einloggen", + "upload_type_not_allowed" => "Dieser Dateityp darf nicht hochgeladen werden.", + "del" => "Entfernen", + "log_out" => "Ausloggen" +); + +// Greek +$_TRANSLATIONS["el"] = array( + "file_name" => "Όνομα αρχείου", + "size" => "Μέγεθος", + "last_changed" => "Τροποποιημένο", + "total_used_space" => "Χρησιμοποιημένος χώρος", + "free_space" => "Ελεύθερος χώρος", + "password" => "Εισάγεται κωδικό", + "upload" => "Φόρτωση", + "failed_upload" => "Αποτυχία φόρτωσης αρχείου!", + "failed_move" => "Αποτυχία μεταφοράς αρχείου στον κατάλληλο φάκελο!", + "wrong_password" => "Λάθος κωδικός", + "make_directory" => "Δημιουργία νέου φακέλου", + "new_dir_failed" => "Αποτυχία δημιουργίας νέου φακέλου", + "chmod_dir_failed" => "Αποτυχία τροποποίησης δικαιωμάτων φακέλου", + "unable_to_read_dir" => "Unable to read directory", + "location" => "Location", + "root" => "Root" +); + +// Hungarian +$_TRANSLATIONS["hu"] = array( + "file_name" => "Fájl név", + "size" => "Méret", + "last_changed" => "Utolsó módosítás", + "total_used_space" => "Összes elfoglalt terület", + "free_space" => "Szabad terület", + "password" => "Jelszó", + "upload" => "Feltöltés", + "failed_upload" => "A fájl feltöltése nem sikerült!", + "failed_move" => "A fájl mozgatása nem sikerült!", + "wrong_password" => "Hibás jelszó", + "make_directory" => "Új mappa", + "new_dir_failed" => "A mappa létrehozása nem sikerült", + "chmod_dir_failed" => "A mappa jogainak megváltoztatása nem sikerült", + "unable_to_read_dir" => "A mappa nem olvasható", + "location" => "Hely", + "root" => "Gyökér", + "log_file_permission_error" => "A log fájl írása jogosultsági okok miatt nem sikerült.", + "upload_not_allowed" => "Ebbe a mappába a feltöltés nem engedélyezett.", + "upload_dir_not_writable" => "A mappa nem írható.", + "mobile_version" => "Mobil nézet", + "standard_version" => "Web nézet", + "page_load_time" => "Letöltési id? %.2f ms", + "wrong_pass" => "Rossz felhasználónév vagy jelszó", + "username" => "Felhasználónév", + "log_in" => "Belépés", + "upload_type_not_allowed" => "A fájltípus feltöltése tiltott." +); + +// Italian +$_TRANSLATIONS["it"] = array( + "file_name" => "Nome file", + "size" => "Dimensione", + "last_changed" => "Ultima modifica", + "total_used_space" => "Totale spazio usato", + "free_space" => "Spazio disponibile", + "password" => "Parola chiave", + "upload" => "Caricamento file", + "failed_upload" => "Caricamento del file fallito!", + "failed_move" => "Spostamento del file nella cartella fallito!", + "wrong_password" => "Password sbagliata", + "make_directory" => "Nuova cartella", + "new_dir_failed" => "Creazione cartella fallita!", + "chmod_dir_failed" => "Modifica dei permessi della cartella fallita!", + "unable_to_read_dir" => "Non abilitato a leggere la cartella", + "location" => "Posizione", + "root" => "Indice", + "log_file_permission_error" => "Lo script non ha i permessi per scrivere il file di log.", + "upload_not_allowed" => "La configurazione dello script non permette l'upload in questa cartella.", + "upload_dir_not_writable" => "Questa cartella non ha i permessi di scrittura.", + "mobile_version" => "Visualizzazione Mobile", + "standard_version" => "Visualizzazione Standard", + "page_load_time" => "Page aperta in %.2f min", + "wrong_pass" => "Username o password errati", + "username" => "Username", + "log_in" => "Log in", + "upload_type_not_allowed" => "Questo formato di file non è abilitato per l'upload.", + "del" => "Cancella", // short for Delete + "log_out" => "Esci" +); + +// Norwegian +$_TRANSLATIONS["no"] = array( + "file_name" => "Navn", + "size" => "Størrelse", + "last_changed" => "Endret", + "total_used_space" => "Brukt plass", + "free_space" => "Resterende plass", + "password" => "Passord", + "upload" => "Last opp", + "failed_upload" => "Opplasting gikk galt", + "failed_move" => "Kunne ikke flytte objektet", + "wrong_password" => "Feil passord", + "make_directory" => "Ny mappe", + "new_dir_failed" => "Kunne ikke lage ny mappe", + "chmod_dir_failed" => "Kunne ikke endre rettigheter", + "unable_to_read_dir" => "Kunne ikke lese mappen", + "location" => "Område", + "root" => "Rot" +); + +//Polish +$_TRANSLATIONS["pl"] = array( + "file_name" => "Nazwa Pliku", + "size" => "Rozmiar", + "last_changed" => "Data Zmiany", + "total_used_space" => "Total used space", + "free_space" => "Wolnego obszaru", + "password" => "Haslo", + "upload" => "Przeslij", + "failed_upload" => "Przeslanie pliku nie powiodlo sie", + "failed_move" => "Przenosienie pliku nie powidlo sie!", + "wrong_password" => "Niepoprawne haslo", + "make_directory" => "Nowy folder", + "new_dir_failed" => "Blad podczas tworzenia nowego foldera", + "chmod_dir_failed" => "Blad podczas zmiany uprawnienia foldera", + "unable_to_read_dir" => "Odczytanie foldera nie powiodlo sie", + "location" => "Miejsce", + "root" => "Root", + "log_file_permission_error" => "Brak uprawnien aby utowrzyc dziennik dzialan.", + "upload_not_allowed" => "Konfiguracja zabrania przeslanie pliku do tego foldera.", + "upload_dir_not_writable" => "Nie mozna zapisac pliku do tego foldera.", + "mobile_version" => "Wersja Mobile", + "standard_version" => "Widok standardowy", + "page_load_time" => "Zaladowano w %.2f ms", + "wrong_pass" => "Nie poprawna nazwa uzytkownika lub hasla", + "username" => "Uzytkownik", + "log_in" => "Zaloguj sie", + "upload_type_not_allowed" => "Ten rodazaj pliku jest zabrioniony." +); + +// Portuguese (Brazil) +$_TRANSLATIONS["pt_BR"] = array( + "file_name" => "Nome do arquivo", + "size" => "Tamanho", + "last_changed" => "Modificado em", + "total_used_space" => "Total de espaço utilizado", + "free_space" => "Espaço livre", + "password" => "Senha", + "upload" => "Enviar", + "failed_upload" => "Falha ao enviar o arquivo!", + "failed_move" => "Falha ao mover o arquivo para o diretório correto!", + "wrong_password" => "Senha errada", + "make_directory" => "Nova pasta", + "new_dir_failed" => "Falha ao criar diretório", + "chmod_dir_failed" => "Falha ao mudar os privilégios do diretório", + "unable_to_read_dir" => "Não foi possível ler o diretório", + "location" => "Localização", + "root" => "Raíz", + "log_file_permission_error" => "O script não tem permissão para escrever o arquivo de log.", + "upload_not_allowed" => "A configuração do script não permite envios neste diretório.", + "upload_dir_not_writable" => "Não há permissão para escrita neste diretório.", + "mobile_version" => "Versão Móvel", + "standard_version" => "Versão Padrão", + "page_load_time" => "Página carregada em %.2f ms", + "wrong_pass" => "Nome de usuário ou senha errados", + "username" => "Nome de Usuário", + "log_in" => "Log in", + "upload_type_not_allowed" => "Não é permitido envio de arquivos deste tipo.", + "del" => "Deletar", + "log_out" => "Log out" +); + +// Portuguese (Portugal) +$_TRANSLATIONS["pt_PT"] = array( + "file_name" => "Nome do ficheiro", + "size" => "Tamanho", + "last_changed" => "Modificado em", + "total_used_space" => "Total de espaço utilizado", + "free_space" => "Espaço livre", + "password" => "Palavra-passe", + "upload" => "Enviar", + "failed_upload" => "Falha ao enviar o ficheiro!", + "failed_move" => "Falha ao mover o ficheiro para a pasta correcta!", + "wrong_password" => "Palavra-passe errada", + "make_directory" => "Nova pasta", + "new_dir_failed" => "Falha ao criar pasta", + "chmod_dir_failed" => "Falha ao mudar os privilégios da pasta", + "unable_to_read_dir" => "Não foi possível ler a pasta", + "location" => "Localização", + "root" => "Raíz", + "log_file_permission_error" => "O script não tem permissão para escrever o ficheiro de log.", + "upload_not_allowed" => "A configuração do script não permite envios para esta pasta.", + "upload_dir_not_writable" => "Não há permissão para escrita nesta pasta.", + "mobile_version" => "Versão Móvel", + "standard_version" => "Versão Padrão", + "page_load_time" => "Página carregada em %.2f ms", + "wrong_pass" => "Nome de utilizador ou palavra-passe incorrectos", + "username" => "Nome de utilizador", + "log_in" => "Entrar", + "upload_type_not_allowed" => "Não é permitido o envio de ficheiros deste tipo.", + "del" => "Apagar", + "log_out" => "Sair" +); + +// Romanian +$_TRANSLATIONS["ro"] = array( + "file_name" => "Nume fisier", + "size" => "Marime", + "last_changed" => "Ultima modificare", + "total_used_space" => "Spatiu total utilizat", + "free_space" => "Spatiu disponibil", + "password" => "Parola", + "upload" => "Incarcare fisier", + "failed_upload" => "Incarcarea fisierului a esuat!", + "failed_move" => "Mutarea fisierului in alt director a esuat!", + "wrong_password" => "Parol gresita!", + "make_directory" => "Director nou", + "new_dir_failed" => "Eroare la crearea directorului", + "chmod_dir_failed" => "Eroare la modificarea drepturilor pe director", + "unable_to_read_dir" => "Nu s-a putut citi directorul", + "location" => "Locatie", + "root" => "Root" +); + +// Russian +$_TRANSLATIONS["ru"] = array( + "file_name" => "Имя файла", + "size" => "Размер", + "last_changed" => "Последнее изменение", + "total_used_space" => "Всего использовано", + "free_space" => "Свободно", + "password" => "Пароль", + "upload" => "Загрузка", + "failed_upload" => "Не удалось загрузить файл!", + "failed_move" => "Не удалось переместить файл в нужную папку!", + "wrong_password" => "Неверный пароль", + "make_directory" => "Новая папка", + "new_dir_failed" => "Не удалось создать папку", + "chmod_dir_failed" => "Не удалось изменить права доступа к папке", + "unable_to_read_dir" => "Не возможно прочитать папку", + "location" => "Расположение", + "root" => "Корневая папка", + "log_file_permission_error" => "Скрипт не имеет прав для записи лога файла.", + "upload_not_allowed" => "Загрузка в эту папку запрещена в настройках скрипта", + "upload_dir_not_writable" => "В эту папку запрещена запись", + "mobile_version" => "Мобильный вид", + "standard_version" => "Обычный вид", + "page_load_time" => "Страница загружена за %.2f мс.", + "wrong_pass" => "Неверное имя пользователя или пароль", + "username" => "Имя пользователя", + "log_in" => "Войти", + "upload_type_not_allowed" => "Этот тип файла запрещено загружать", + "del" => "удалить", + "log_out" => "выйти" +); + +// Slovensky +$_TRANSLATIONS["sk"] = array( + "file_name" => "Meno súboru", + "size" => "Veľkosť", + "last_changed" => "Posledná zmena", + "total_used_space" => "Použité miesto celkom", + "free_space" => "Voľné miesto", + "password" => "Heslo", + "upload" => "Nahranie súborov", + "failed_upload" => "Chyba nahrávania súboru!", + "failed_move" => "Nepodarilo sa presunúť súbor do vybraného adresára!", + "wrong_password" => "Neplatné heslo!", + "make_directory" => "Nový priečinok", + "new_dir_failed" => "Nepodarilo sa vytvoriť adresár!", + "chmod_dir_failed" => "Nepodarilo sa zmeniť práva adresára!", + "unable_to_read_dir" => "Nemôžem čítať adresár", + "location" => "Umiestnenie", + "root" => "Domov" +); + +// Spanish +$_TRANSLATIONS["es"] = array( + "file_name" => "Nombre de archivo", + "size" => "Medida", + "last_changed" => "Ultima modificación", + "total_used_space" => "Total espacio usado", + "free_space" => "Espacio libre", + "password" => "Contraseña", + "upload" => "Subir el archivo", + "failed_upload" => "Error al subir el archivo!", + "failed_move" => "Error al mover el archivo al directorio seleccionado!", + "wrong_password" => "Contraseña incorrecta", + "make_directory" => "Crear directorio", + "new_dir_failed" => "Error al crear el directorio", + "chmod_dir_failed" => "Error al cambiar los derechos de directorio", + "unable_to_read_dir" => "No es posible leer el directorio", + "location" => "Localización", + "root" => "Raíz" +); + +// Swedish +$_TRANSLATIONS["sv"] = array( + "file_name" => "Filnamn", + "size" => "Storlek", + "last_changed" => "Senast andrad", + "total_used_space" => "Totalt upptaget utrymme", + "free_space" => "Ledigt utrymme", + "password" => "Losenord", + "upload" => "Ladda upp", + "failed_upload" => "Fel vid uppladdning av fil!", + "failed_move" => "Fel vid flytt av fil till mapp!", + "wrong_password" => "Fel losenord", + "make_directory" => "Ny mapp", + "new_dir_failed" => "Fel vid skapande av mapp", + "chmod_dir_failed" => "Fel vid andring av mappens egenskaper", + "unable_to_read_dir" => "Kan inte lasa den filen", + "location" => "Plats", + "root" => "Hem" +); + +// Turkish +$_TRANSLATIONS["tr"] = array( + "file_name" => "Dosya ismi", + "size" => "Boyut", + "last_changed" => "gecmis", + "total_used_space" => "Toplam dosya boyutu", + "free_space" => "Bos alan", + "password" => "Sifre", + "upload" => "Yükleyen", + "failed_upload" => "Hatali dosya yüklemesi!", + "failed_move" => "Hatali dosya tasimasi!", + "wrong_password" => "Yeniden sifre", + "make_directory" => "Yeni dosya", + "new_dir_failed" => "Dosya olusturalamadi", + "chmod_dir_failed" => "Dosya ayari deqistirelemedi", + "unable_to_read_dir" => "Unable to read directory", + "location" => "Location", + "root" => "Root" +); + +// Esperanto +$_TRANSLATIONS["eo"] = array( + "file_name" => "Dosiernomo", + "size" => "Grando", + "last_changed" => "Lasta ŝanĝo", + "total_used_space" => "Uzata spaco", + "free_space" => "Disponebla spaco", + "password" => "pasvorto", + "upload" => "Alŝuto", + "failed_upload" => "Alŝuto malsukcesis!", + "failed_move" => "Movo de la dosiero malsukcesis!", + "wrong_password" => "Malĝusta pasvorto", + "make_directory" => "Nova dosierujo", + "new_dir_failed" => "Kreado de dosierujo malsukcesis", + "chmod_dir_failed" => "Ŝanĝo de dosierujaj rajtoj malsukcesis", + "unable_to_read_dir" => "Dosierujo ne estas legebla", + "location" => "Loko", + "root" => "Radiko", + "log_file_permission_error" => "La skripto ne rajtas skribi la protokolan dosieron.", + "upload_not_allowed" => "La skripto malpermesas alŝuti en ĉi tiun dosierujon.", + "upload_dir_not_writable" => "Ĉi tiu dosierujo ne rajtigas skribadon.", + "mobile_version" => "Vido por mobilaj iloj", + "standard_version" => "Defaŭlta vido", + "page_load_time" => "Paĝo ŝarĝita en %.2f ms", + "wrong_pass" => "Malĝusta salutnomo aŭ pasvorto", + "username" => "Salutnomo", + "log_in" => "Ensaluto", + "upload_type_not_allowed" => "Alŝuto estas malpermesita por ĉi tiu dosiertipo.", + "del" => "For", // short for Delete + "log_out" => "Adiaŭo" +); + +/***************************************************************************/ +/* CSS FOR TWEAKING THE DESIGN */ +/***************************************************************************/ + + +function css() +{ +?> + + + 0 && isset($_IMAGES[$_GET['img']])) + print base64_decode($_IMAGES[$_GET['img']]); + else + print base64_decode($_IMAGES["unknown"]); + } + return true; + } + else if(isset($_GET['thumb'])) + { + if(strlen($_GET['thumb']) > 0 && EncodeExplorer::getConfig('thumbnails') == true) + { + ImageServer::showThumbnail($_GET['thumb']); + } + return true; + } + return false; + } + + public static function isEnabledPdf() + { + if(class_exists("Imagick")) + return true; + return false; + } + + public static function openPdf($file) + { + if(!ImageServer::isEnabledPdf()) + return null; + + $im = new Imagick($file.'[0]'); + $im->setImageFormat( "png" ); + $str = $im->getImageBlob(); + $im2 = imagecreatefromstring($str); + return $im2; + } + + // + // Creates and returns a thumbnail image object from an image file + // + public static function createThumbnail($file) + { + if(is_int(EncodeExplorer::getConfig('thumbnails_width'))) + $max_width = EncodeExplorer::getConfig('thumbnails_width'); + else + $max_width = 200; + + if(is_int(EncodeExplorer::getConfig('thumbnails_height'))) + $max_height = EncodeExplorer::getConfig('thumbnails_height'); + else + $max_height = 200; + + if(File::isPdfFile($file)) + $image = ImageServer::openPdf($file); + else + $image = ImageServer::openImage($file); + if($image == null) + return; + + imagealphablending($image, true); + imagesavealpha($image, true); + + $width = imagesx($image); + $height = imagesy($image); + + $new_width = $max_width; + $new_height = $max_height; + if(($width/$height) > ($new_width/$new_height)) + $new_height = $new_width * ($height / $width); + else + $new_width = $new_height * ($width / $height); + + if($new_width >= $width && $new_height >= $height) + { + $new_width = $width; + $new_height = $height; + } + + $new_image = ImageCreateTrueColor($new_width, $new_height); + imagealphablending($new_image, true); + imagesavealpha($new_image, true); + $trans_colour = imagecolorallocatealpha($new_image, 0, 0, 0, 127); + imagefill($new_image, 0, 0, $trans_colour); + + imagecopyResampled ($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); + + return $new_image; + } + + // + // Function for displaying the thumbnail. + // Includes attempts at cacheing it so that generation is minimised. + // + public static function showThumbnail($file) + { + if(filemtime($file) < filemtime($_SERVER['SCRIPT_FILENAME'])) + $mtime = gmdate('r', filemtime($_SERVER['SCRIPT_FILENAME'])); + else + $mtime = gmdate('r', filemtime($file)); + + $etag = md5($mtime.$file); + + if ((isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $mtime) + || (isset($_SERVER['HTTP_IF_NONE_MATCH']) && str_replace('"', '', stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])) == $etag)) + { + header('HTTP/1.1 304 Not Modified'); + return; + } + else + { + header('ETag: "'.$etag.'"'); + header('Last-Modified: '.$mtime); + header('Content-Type: image/png'); + $image = ImageServer::createThumbnail($file); + imagepng($image); + } + } + + // + // A helping function for opening different types of image files + // + public static function openImage ($file) + { + $size = getimagesize($file); + switch($size["mime"]) + { + case "image/jpeg": + $im = imagecreatefromjpeg($file); + break; + case "image/gif": + $im = imagecreatefromgif($file); + break; + case "image/png": + $im = imagecreatefrompng($file); + break; + default: + $im=null; + break; + } + return $im; + } +} + +// +// The class for logging user activity +// +class Logger +{ + public static function log($message) + { + global $encodeExplorer; + if(strlen(EncodeExplorer::getConfig('log_file')) > 0) + { + if(Location::isFileWritable(EncodeExplorer::getConfig('log_file'))) + { + $message = "[" . date("Y-m-d h:i:s", mktime()) . "] ".$message." (".$_SERVER["HTTP_USER_AGENT"].")\n"; + error_log($message, 3, EncodeExplorer::getConfig('log_file')); + } + else + $encodeExplorer->setErrorString("log_file_permission_error"); + } + } + + public static function logAccess($path, $isDir) + { + $message = $_SERVER['REMOTE_ADDR']." ".GateKeeper::getUserName()." accessed "; + $message .= $isDir?"dir":"file"; + $message .= " ".$path; + Logger::log($message); + } + + public static function logQuery() + { + if(isset($_POST['log']) && strlen($_POST['log']) > 0) + { + Logger::logAccess($_POST['log'], false); + return true; + } + else + return false; + } + + public static function logCreation($path, $isDir) + { + $message = $_SERVER['REMOTE_ADDR']." ".GateKeeper::getUserName()." created "; + $message .= $isDir?"dir":"file"; + $message .= " ".$path; + Logger::log($message); + } + + public static function emailNotification($path, $isFile) + { + if(strlen(EncodeExplorer::getConfig('upload_email')) > 0) + { + $message = "This is a message to let you know that ".GateKeeper::getUserName()." "; + $message .= ($isFile?"uploaded a new file":"created a new directory")." in Encode Explorer.\n\n"; + $message .= "Path : ".$path."\n"; + $message .= "IP : ".$_SERVER['REMOTE_ADDR']."\n"; + mail(EncodeExplorer::getConfig('upload_email'), "Upload notification", $message); + } + } +} + +// +// The class controls logging in and authentication +// +class GateKeeper +{ + public static function init() + { + global $encodeExplorer; + if(strlen(EncodeExplorer::getConfig("session_name")) > 0) + session_name(EncodeExplorer::getConfig("session_name")); + + if(count(EncodeExplorer::getConfig("users")) > 0) + session_start(); + else + return; + + if(isset($_GET['logout'])) + { + $_SESSION['ee_user_name'] = null; + $_SESSION['ee_user_pass'] = null; + } + + if(isset($_POST['user_pass']) && strlen($_POST['user_pass']) > 0) + { + if(GateKeeper::isUser((isset($_POST['user_name'])?$_POST['user_name']:""), $_POST['user_pass'])) + { + $_SESSION['ee_user_name'] = isset($_POST['user_name'])?$_POST['user_name']:""; + $_SESSION['ee_user_pass'] = $_POST['user_pass']; + + $addr = $_SERVER['PHP_SELF']; + $param = ''; + + if(isset($_GET['m'])) + $param .= (strlen($param) == 0 ? '?m' : '&m'); + + if(isset($_GET['s'])) + $param .= (strlen($param) == 0 ? '?s' : '&s'); + + if(isset($_GET['dir']) && strlen($_GET['dir']) > 0) + { + $param .= (strlen($param) == 0 ? '?dir=' : '&dir='); + $param .= urlencode($_GET['dir']); + } + header( "Location: ".$addr.$param); + } + else + $encodeExplorer->setErrorString("wrong_pass"); + } + } + + public static function isUser($userName, $userPass) + { + foreach(EncodeExplorer::getConfig("users") as $user) + { + if($user[1] == $userPass) + { + if(strlen($userName) == 0 || $userName == $user[0]) + { + return true; + } + } + } + return false; + } + + public static function isLoginRequired() + { + if(EncodeExplorer::getConfig("require_login") == false){ + return false; + } + return true; + } + + public static function isUserLoggedIn() + { + if(isset($_SESSION['ee_user_name'], $_SESSION['ee_user_pass'])) + { + if(GateKeeper::isUser($_SESSION['ee_user_name'], $_SESSION['ee_user_pass'])) + return true; + } + return false; + } + + public static function isAccessAllowed() + { + if(!GateKeeper::isLoginRequired() || GateKeeper::isUserLoggedIn()) + return true; + return false; + } + + public static function isUploadAllowed(){ + if(EncodeExplorer::getConfig("upload_enable") == true && GateKeeper::isUserLoggedIn() == true && GateKeeper::getUserStatus() == "admin") + return true; + return false; + } + + public static function isNewdirAllowed(){ + if(EncodeExplorer::getConfig("newdir_enable") == true && GateKeeper::isUserLoggedIn() == true && GateKeeper::getUserStatus() == "admin") + return true; + return false; + } + + public static function isDeleteAllowed(){ + if(EncodeExplorer::getConfig("delete_enable") == true && GateKeeper::isUserLoggedIn() == true && GateKeeper::getUserStatus() == "admin") + return true; + return false; + } + + public static function getUserStatus(){ + if(GateKeeper::isUserLoggedIn() == true && EncodeExplorer::getConfig("users") != null && is_array(EncodeExplorer::getConfig("users"))){ + foreach(EncodeExplorer::getConfig("users") as $user){ + if($user[0] != null && $user[0] == $_SESSION['ee_user_name']) + return $user[2]; + } + } + return null; + } + + public static function getUserName() + { + if(GateKeeper::isUserLoggedIn() == true && isset($_SESSION['ee_user_name']) && strlen($_SESSION['ee_user_name']) > 0) + return $_SESSION['ee_user_name']; + if(isset($_SERVER["REMOTE_USER"]) && strlen($_SERVER["REMOTE_USER"]) > 0) + return $_SERVER["REMOTE_USER"]; + if(isset($_SERVER['PHP_AUTH_USER']) && strlen($_SERVER['PHP_AUTH_USER']) > 0) + return $_SERVER['PHP_AUTH_USER']; + return "an anonymous user"; + } + + public static function showLoginBox(){ + if(!GateKeeper::isUserLoggedIn() && count(EncodeExplorer::getConfig("users")) > 0) + return true; + return false; + } +} + +// +// The class for any kind of file managing (new folder, upload, etc). +// +class FileManager +{ + /* Obsolete code + function checkPassword($inputPassword) + { + global $encodeExplorer; + if(strlen(EncodeExplorer::getConfig("upload_password")) > 0 && $inputPassword == EncodeExplorer::getConfig("upload_password")) + { + return true; + } + else + { + $encodeExplorer->setErrorString("wrong_password"); + return false; + } + } + */ + function newFolder($location, $dirname) + { + global $encodeExplorer; + if(strlen($dirname) > 0) + { + $forbidden = array(".", "/", "\\"); + for($i = 0; $i < count($forbidden); $i++) + { + $dirname = str_replace($forbidden[$i], "", $dirname); + } + + if(!$location->uploadAllowed()) + { + // The system configuration does not allow uploading here + $encodeExplorer->setErrorString("upload_not_allowed"); + } + else if(!$location->isWritable()) + { + // The target directory is not writable + $encodeExplorer->setErrorString("upload_dir_not_writable"); + } + else if(!mkdir($location->getDir(true, false, false, 0).$dirname, EncodeExplorer::getConfig("new_dir_mode"))) + { + // Error creating a new directory + $encodeExplorer->setErrorString("new_dir_failed"); + } + else if(!chmod($location->getDir(true, false, false, 0).$dirname, EncodeExplorer::getConfig("new_dir_mode"))) + { + // Error applying chmod + $encodeExplorer->setErrorString("chmod_dir_failed"); + } + else + { + // Directory successfully created, sending e-mail notification + Logger::logCreation($location->getDir(true, false, false, 0).$dirname, true); + Logger::emailNotification($location->getDir(true, false, false, 0).$dirname, false); + } + } + } + + function uploadFile($location, $userfile) + { + global $encodeExplorer; + $name = basename($userfile['name']); + if(get_magic_quotes_gpc()) + $name = stripslashes($name); + + $upload_dir = $location->getFullPath(); + $upload_file = $upload_dir . $name; + + if(function_exists("finfo_open") && function_exists("finfo_file")) + $mime_type = File::getFileMime($userfile['tmp_name']); + else + $mime_type = $userfile['type']; + + $extension = File::getFileExtension($userfile['name']); + + if(!$location->uploadAllowed()) + { + $encodeExplorer->setErrorString("upload_not_allowed"); + } + else if(!$location->isWritable()) + { + $encodeExplorer->setErrorString("upload_dir_not_writable"); + } + else if(!is_uploaded_file($userfile['tmp_name'])) + { + $encodeExplorer->setErrorString("failed_upload"); + } + else if(is_array(EncodeExplorer::getConfig("upload_allow_type")) && count(EncodeExplorer::getConfig("upload_allow_type")) > 0 && !in_array($mime_type, EncodeExplorer::getConfig("upload_allow_type"))) + { + $encodeExplorer->setErrorString("upload_type_not_allowed"); + } + else if(is_array(EncodeExplorer::getConfig("upload_reject_extension")) && count(EncodeExplorer::getConfig("upload_reject_extension")) > 0 && in_array($extension, EncodeExplorer::getConfig("upload_reject_extension"))) + { + $encodeExplorer->setErrorString("upload_type_not_allowed"); + } + else if(!@move_uploaded_file($userfile['tmp_name'], $upload_file)) + { + $encodeExplorer->setErrorString("failed_move"); + } + else + { + chmod($upload_file, EncodeExplorer::getConfig("upload_file_mode")); + Logger::logCreation($location->getDir(true, false, false, 0).$name, false); + Logger::emailNotification($location->getDir(true, false, false, 0).$name, true); + } + } + + public static function delete_dir($dir) { + if (is_dir($dir)) { + $objects = scandir($dir); + foreach ($objects as $object) { + if ($object != "." && $object != "..") { + if (filetype($dir."/".$object) == "dir") + FileManager::delete_dir($dir."/".$object); + else + unlink($dir."/".$object); + } + } + reset($objects); + rmdir($dir); + } + } + + public static function delete_file($file){ + if(is_file($file)){ + unlink($file); + } + } + + // + // The main function, checks if the user wants to perform any supported operations + // + function run($location) + { + if(isset($_POST['userdir']) && strlen($_POST['userdir']) > 0){ + if($location->uploadAllowed() && GateKeeper::isUserLoggedIn() && GateKeeper::isAccessAllowed() && GateKeeper::isNewdirAllowed()){ + $this->newFolder($location, $_POST['userdir']); + } + } + + if(isset($_FILES['userfile']['name']) && strlen($_FILES['userfile']['name']) > 0){ + if($location->uploadAllowed() && GateKeeper::isUserLoggedIn() && GateKeeper::isAccessAllowed() && GateKeeper::isUploadAllowed()){ + $this->uploadFile($location, $_FILES['userfile']); + } + } + + if(isset($_GET['del'])){ + if(GateKeeper::isUserLoggedIn() && GateKeeper::isAccessAllowed() && GateKeeper::isDeleteAllowed()){ + $split_path = Location::splitPath($_GET['del']); + $path = ""; + for($i = 0; $i < count($split_path); $i++){ + $path .= $split_path[$i]; + if($i + 1 < count($split_path)) + $path .= "/"; + } + if($path == "" || $path == "/" || $path == "\\" || $path == ".") + return; + + if(is_dir($path)) + FileManager::delete_dir($path); + else if(is_file($path)) + FileManager::delete_file($path); + } + } + } +} + +// +// Dir class holds the information about one directory in the list +// +class Dir +{ + var $name; + var $location; + + // + // Constructor + // + function Dir($name, $location) + { + $this->name = $name; + $this->location = $location; + } + + function getName() + { + return $this->name; + } + + function getNameHtml() + { + return htmlspecialchars($this->name); + } + + function getNameEncoded() + { + return rawurlencode($this->name); + } + + // + // Debugging output + // + function debug() + { + print("Dir name (htmlspecialchars): ".$this->getName()."\n"); + print("Dir location: ".$this->location->getDir(true, false, false, 0)."\n"); + } +} + +// +// File class holds the information about one file in the list +// +class File +{ + var $name; + var $location; + var $size; + //var $extension; + var $type; + var $modTime; + + // + // Constructor + // + function File($name, $location) + { + $this->name = $name; + $this->location = $location; + + $this->type = File::getFileType($this->location->getDir(true, false, false, 0).$this->getName()); + $this->size = File::getFileSize($this->location->getDir(true, false, false, 0).$this->getName()); + $this->modTime = filemtime($this->location->getDir(true, false, false, 0).$this->getName()); + } + + function getName() + { + return $this->name; + } + + function getNameEncoded() + { + return rawurlencode($this->name); + } + + function getNameHtml() + { + return htmlspecialchars($this->name); + } + + function getSize() + { + return $this->size; + } + + function getType() + { + return $this->type; + } + + function getModTime() + { + return $this->modTime; + } + + // + // Determine the size of a file + // + public static function getFileSize($file) + { + $sizeInBytes = filesize($file); + + // If filesize() fails (with larger files), try to get the size from unix command line. + if (EncodeExplorer::getConfig("large_files") == true || !$sizeInBytes || $sizeInBytes < 0) { + $sizeInBytes=exec("ls -l '$file' | awk '{print $5}'"); + } + return $sizeInBytes; + } + + public static function getFileType($filepath) + { + /* + * This extracts the information from the file contents. + * Unfortunately it doesn't properly detect the difference between text-based file types. + * + $mime_type = File::getMimeType($filepath); + $mime_type_chunks = explode("/", $mime_type, 2); + $type = $mime_type_chunks[1]; + */ + return File::getFileExtension($filepath); + } + + public static function getFileMime($filepath) + { + $fhandle = finfo_open(FILEINFO_MIME); + $mime_type = finfo_file($fhandle, $filepath); + $mime_type_chunks = preg_split('/\s+/', $mime_type); + $mime_type = $mime_type_chunks[0]; + $mime_type_chunks = explode(";", $mime_type); + $mime_type = $mime_type_chunks[0]; + return $mime_type; + } + + public static function getFileExtension($filepath) + { + return strtolower(pathinfo($filepath, PATHINFO_EXTENSION)); + } + + // + // Debugging output + // + function debug() + { + print("File name: ".$this->getName()."\n"); + print("File location: ".$this->location->getDir(true, false, false, 0)."\n"); + print("File size: ".$this->size."\n"); + print("File modTime: ".$this->modTime."\n"); + } + + function isImage() + { + $type = $this->getType(); + if($type == "png" || $type == "jpg" || $type == "gif" || $type == "jpeg") + return true; + return false; + } + + function isPdf() + { + if(strtolower($this->getType()) == "pdf") + return true; + return false; + } + + public static function isPdfFile($file) + { + if(File::getFileType($file) == "pdf") + return true; + return false; + } + + function isValidForThumb() + { + if($this->isImage() || ($this->isPdf() && ImageServer::isEnabledPdf())) + return true; + return false; + } +} + +class Location +{ + var $path; + + // + // Split a file path into array elements + // + public static function splitPath($dir) + { + $dir = stripslashes($dir); + $path1 = preg_split("/[\\\\\/]+/", $dir); + $path2 = array(); + for($i = 0; $i < count($path1); $i++) + { + if($path1[$i] == ".." || $path1[$i] == "." || $path1[$i] == "") + continue; + $path2[] = $path1[$i]; + } + return $path2; + } + + // + // Get the current directory. + // Options: Include the prefix ("./"); URL-encode the string; HTML-encode the string; return directory n-levels up + // + function getDir($prefix, $encoded, $html, $up) + { + $dir = ""; + if($prefix == true) + $dir .= "./"; + for($i = 0; $i < ((count($this->path) >= $up && $up > 0)?count($this->path)-$up:count($this->path)); $i++) + { + $temp = $this->path[$i]; + if($encoded) + $temp = rawurlencode($temp); + if($html) + $temp = htmlspecialchars($temp); + $dir .= $temp."/"; + } + return $dir; + } + + function getPathLink($i, $html) + { + if($html) + return htmlspecialchars($this->path[$i]); + else + return $this->path[$i]; + } + + function getFullPath() + { + return (strlen(EncodeExplorer::getConfig('basedir')) > 0?EncodeExplorer::getConfig('basedir'):dirname($_SERVER['SCRIPT_FILENAME']))."/".$this->getDir(true, false, false, 0); + } + + // + // Debugging output + // + function debug() + { + print_r($this->path); + print("Dir with prefix: ".$this->getDir(true, false, false, 0)."\n"); + print("Dir without prefix: ".$this->getDir(false, false, false, 0)."\n"); + print("Upper dir with prefix: ".$this->getDir(true, false, false, 1)."\n"); + print("Upper dir without prefix: ".$this->getDir(false, false, false, 1)."\n"); + } + + + // + // Set the current directory + // + function init() + { + if(!isset($_GET['dir']) || strlen($_GET['dir']) == 0) + { + $this->path = $this->splitPath(EncodeExplorer::getConfig('starting_dir')); + } + else + { + $this->path = $this->splitPath($_GET['dir']); + } + } + + // + // Checks if the current directory is below the input path + // + function isSubDir($checkPath) + { + for($i = 0; $i < count($this->path); $i++) + { + if(strcmp($this->getDir(true, false, false, $i), $checkPath) == 0) + return true; + } + return false; + } + + // + // Check if uploading is allowed into the current directory, based on the configuration + // + function uploadAllowed() + { + if(EncodeExplorer::getConfig('upload_enable') != true) + return false; + if(EncodeExplorer::getConfig('upload_dirs') == null || count(EncodeExplorer::getConfig('upload_dirs')) == 0) + return true; + + $upload_dirs = EncodeExplorer::getConfig('upload_dirs'); + for($i = 0; $i < count($upload_dirs); $i++) + { + if($this->isSubDir($upload_dirs[$i])) + return true; + } + return false; + } + + function isWritable() + { + return is_writable($this->getDir(true, false, false, 0)); + } + + public static function isDirWritable($dir) + { + return is_writable($dir); + } + + public static function isFileWritable($file) + { + if(file_exists($file)) + { + if(is_writable($file)) + return true; + else + return false; + } + else if(Location::isDirWritable(dirname($file))) + return true; + else + return false; + } +} + +class EncodeExplorer +{ + var $location; + var $dirs; + var $files; + var $sort_by; + var $sort_as; + var $mobile; + var $logging; + var $spaceUsed; + var $lang; + + // + // Determine sorting, calculate space. + // + function init() + { + $this->sort_by = ""; + $this->sort_as = ""; + if(isset($_GET["sort_by"], $_GET["sort_as"])) + { + if($_GET["sort_by"] == "name" || $_GET["sort_by"] == "size" || $_GET["sort_by"] == "mod") + if($_GET["sort_as"] == "asc" || $_GET["sort_as"] == "desc") + { + $this->sort_by = $_GET["sort_by"]; + $this->sort_as = $_GET["sort_as"]; + } + } + if(strlen($this->sort_by) <= 0 || strlen($this->sort_as) <= 0) + { + $this->sort_by = "name"; + $this->sort_as = "desc"; + } + + + global $_TRANSLATIONS; + if(isset($_GET['lang'], $_TRANSLATIONS[$_GET['lang']])) + $this->lang = $_GET['lang']; + else + $this->lang = EncodeExplorer::getConfig("lang"); + + $this->mobile = false; + if(EncodeExplorer::getConfig("mobile_enabled") == true) + { + if((EncodeExplorer::getConfig("mobile_default") == true || isset($_GET['m'])) && !isset($_GET['s'])) + $this->mobile = true; + } + + $this->logging = false; + if(EncodeExplorer::getConfig("log_file") != null && strlen(EncodeExplorer::getConfig("log_file")) > 0) + $this->logging = true; + } + + // + // Read the file list from the directory + // + function readDir() + { + global $encodeExplorer; + // + // Reading the data of files and directories + // + if($open_dir = @opendir($this->location->getFullPath())) + { + $this->dirs = array(); + $this->files = array(); + while ($object = readdir($open_dir)) + { + if($object != "." && $object != "..") + { + if(is_dir($this->location->getDir(true, false, false, 0)."/".$object)) + { + if(!in_array($object, EncodeExplorer::getConfig('hidden_dirs'))) + $this->dirs[] = new Dir($object, $this->location); + } + else if(!in_array($object, EncodeExplorer::getConfig('hidden_files'))) + $this->files[] = new File($object, $this->location); + } + } + closedir($open_dir); + } + else + { + $encodeExplorer->setErrorString("unable_to_read_dir");; + } + } + + // + // A recursive function for calculating the total used space + // + function sum_dir($start_dir, $ignore_files, $levels = 1) + { + if ($dir = opendir($start_dir)) + { + $total = 0; + while ((($file = readdir($dir)) !== false)) + { + if (!in_array($file, $ignore_files)) + { + if ((is_dir($start_dir . '/' . $file)) && ($levels - 1 >= 0)) + { + $total += $this->sum_dir($start_dir . '/' . $file, $ignore_files, $levels-1); + } + elseif (is_file($start_dir . '/' . $file)) + { + $total += File::getFileSize($start_dir . '/' . $file) / 1024; + } + } + } + + closedir($dir); + return $total; + } + } + + function calculateSpace() + { + if(EncodeExplorer::getConfig('calculate_space_level') <= 0) + return; + $ignore_files = array('..', '.'); + $start_dir = getcwd(); + $spaceUsed = $this->sum_dir($start_dir, $ignore_files, EncodeExplorer::getConfig('calculate_space_level')); + $this->spaceUsed = round($spaceUsed/1024, 3); + } + + function sort() + { + if(is_array($this->files)){ + usort($this->files, "EncodeExplorer::cmp_".$this->sort_by); + if($this->sort_as == "desc") + $this->files = array_reverse($this->files); + } + + if(is_array($this->dirs)){ + usort($this->dirs, "EncodeExplorer::cmp_name"); + if($this->sort_by == "name" && $this->sort_as == "desc") + $this->dirs = array_reverse($this->dirs); + } + } + + function makeArrow($sort_by) + { + if($this->sort_by == $sort_by && $this->sort_as == "asc") + { + $sort_as = "desc"; + $img = "arrow_up"; + } + else + { + $sort_as = "asc"; + $img = "arrow_down"; + } + + if($sort_by == "name") + $text = $this->getString("file_name"); + else if($sort_by == "size") + $text = $this->getString("size"); + else if($sort_by == "mod") + $text = $this->getString("last_changed"); + + return "makeLink(false, false, $sort_by, $sort_as, null, $this->location->getDir(false, true, false, 0))."\"> + $text \"".$sort_as."\""; + } + + function makeLink($switchVersion, $logout, $sort_by, $sort_as, $delete, $dir) + { + $link = "?"; + if($switchVersion == true && EncodeExplorer::getConfig("mobile_enabled") == true) + { + if($this->mobile == false) + $link .= "m&"; + else + $link .= "s&"; + } + else if($this->mobile == true && EncodeExplorer::getConfig("mobile_enabled") == true && EncodeExplorer::getConfig("mobile_default") == false) + $link .= "m&"; + else if($this->mobile == false && EncodeExplorer::getConfig("mobile_enabled") == true && EncodeExplorer::getConfig("mobile_default") == true) + $link .= "s&"; + + if($logout == true) + { + $link .= "logout"; + return $link; + } + + if(isset($this->lang) && $this->lang != EncodeExplorer::getConfig("lang")) + $link .= "lang=".$this->lang."&"; + + if($sort_by != null && strlen($sort_by) > 0) + $link .= "sort_by=".$sort_by."&"; + + if($sort_as != null && strlen($sort_as) > 0) + $link .= "sort_as=".$sort_as."&"; + + $link .= "dir=".$dir; + if($delete != null) + $link .= "&del=".$delete; + return $link; + } + + function makeIcon($l) + { + $l = strtolower($l); + return "?img=".$l; + } + + function formatModTime($time) + { + $timeformat = "d.m.y H:i:s"; + if(EncodeExplorer::getConfig("time_format") != null && strlen(EncodeExplorer::getConfig("time_format")) > 0) + $timeformat = EncodeExplorer::getConfig("time_format"); + return date($timeformat, $time); + } + + function formatSize($size) + { + $sizes = Array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'); + $y = $sizes[0]; + for ($i = 1; (($i < count($sizes)) && ($size >= 1024)); $i++) + { + $size = $size / 1024; + $y = $sizes[$i]; + } + return round($size, 2)." ".$y; + } + + // + // Debugging output + // + function debug() + { + print("Explorer location: ".$this->location->getDir(true, false, false, 0)."\n"); + for($i = 0; $i < count($this->dirs); $i++) + $this->dirs[$i]->output(); + for($i = 0; $i < count($this->files); $i++) + $this->files[$i]->output(); + } + + // + // Comparison functions for sorting. + // + + public static function cmp_name($b, $a) + { + return strcasecmp($a->name, $b->name); + } + + public static function cmp_size($a, $b) + { + return ($a->size - $b->size); + } + + public static function cmp_mod($b, $a) + { + return ($a->modTime - $b->modTime); + } + + // + // The function for getting a translated string. + // Falls back to english if the correct language is missing something. + // + public static function getLangString($stringName, $lang) + { + global $_TRANSLATIONS; + if(isset($_TRANSLATIONS[$lang]) && is_array($_TRANSLATIONS[$lang]) + && isset($_TRANSLATIONS[$lang][$stringName])) + return $_TRANSLATIONS[$lang][$stringName]; + else if(isset($_TRANSLATIONS["en"]))// && is_array($_TRANSLATIONS["en"]) + //&& isset($_TRANSLATIONS["en"][$stringName])) + return $_TRANSLATIONS["en"][$stringName]; + else + return "Translation error"; + } + + function getString($stringName) + { + return EncodeExplorer::getLangString($stringName, $this->lang); + } + + // + // The function for getting configuration values + // + public static function getConfig($name) + { + global $_CONFIG; + if(isset($_CONFIG, $_CONFIG[$name])) + return $_CONFIG[$name]; + return null; + } + + public static function setError($message) + { + global $_ERROR; + if(isset($_ERROR) && strlen($_ERROR) > 0) + ;// keep the first error and discard the rest + else + $_ERROR = $message; + } + + function setErrorString($stringName) + { + EncodeExplorer::setError($this->getString($stringName)); + } + + // + // Main function, activating tasks + // + function run($location) + { + $this->location = $location; + $this->calculateSpace(); + $this->readDir(); + $this->sort(); + $this->outputHtml(); + } + + public function printLoginBox() + { + ?> +
    +
    " method="post"> + 0){ + $require_username = true; + break; + } + } + if($require_username) + { + ?> +
    +
    + +
    +
    +
    " class="button" />
    +
    +
    + + + + + + + + +getConfig('log_file') != null && strlen($this->getConfig('log_file')) > 0) + || ($this->getConfig('thumbnails') != null && $this->getConfig('thumbnails') == true && $this->mobile == false) + || (GateKeeper::isDeleteAllowed())) +{ +?> + + + +<?php if(EncodeExplorer::getConfig('main_title') != null) print EncodeExplorer::getConfig('main_title'); ?> + +"> + 0) +{ + print "
    ".$_ERROR."
    "; +} +?> +
    + +
    + "> + 0 && $this->mobile == false) +{ + $secondary_titles = EncodeExplorer::getConfig("secondary_titles"); + print "
    ".$secondary_titles[array_rand($secondary_titles)]."
    \n"; +} +?> +
    +printLoginBox(); +} +else +{ +if($this->mobile == false && EncodeExplorer::getConfig("show_path") == true) +{ +?> + + + + + +mobile == false) +{ +?> + + + + + + mobile == false && GateKeeper::isDeleteAllowed()){?> + + + + + + + + +dirs) +{ + foreach ($this->dirs as $dir) + { + $row_style = ($row ? "one" : "two"); + print "\n"; + print "\n"; + print "\n"; + if($this->mobile == false && GateKeeper::isDeleteAllowed()){ + print ""; + } + print "\n"; + $row =! $row; + } +} + +// +// Now the files +// +if($this->files) +{ + $count = 0; + foreach ($this->files as $file) + { + $row_style = ($row ? "one" : "two"); + print "files)?" last":"")."\">\n"; + print "\n"; + print "\n"; + if($this->mobile != true) + { + print "\n"; + print "\n"; + } + if($this->mobile == false && GateKeeper::isDeleteAllowed()){ + print ""; + } + print "\n"; + $row =! $row; + } +} + + +// +// The files and folders have been displayed +// +?> + +
    makeArrow("name");?>makeArrow("size"); ?>makeArrow("mod"); ?>
    dir + .. +
    \"dir\"mobile == true?2:3)."\">\n"; + print "makeLink(false, false, null, null, null, $this->location->getDir(false, true, false, 0).$dir->getNameEncoded())."\" class=\"item dir\">"; + print $dir->getNameHtml(); + print "\n"; + print "getName())."\" href=\"".$this->makeLink(false, false, null, null, $this->location->getDir(false, true, false, 0).$dir->getNameEncoded(), $this->location->getDir(false, true, false, 0))."\">\"Delete\"
    \"".$file-getType()."\" src=\"".$this->makeIcon($file->getType())."\" />\n"; + print "\t\tlocation->getDir(false, true, false, 0).$file->getNameEncoded()."\""; + if(EncodeExplorer::getConfig('open_in_new_window') == true) + print "target=\"_blank\""; + print " class=\"item file"; + if($file->isValidForThumb()) + print " thumb"; + print "\">"; + print $file->getNameHtml(); + if($this->mobile == true) + { + print "".$this->formatSize($file->getSize()).""; + } + print "\n"; + print "".$this->formatSize($file->getSize())."".$this->formatModTime($file->getModTime())." + getName())."\" href=\"".$this->makeLink(false, false, null, null, $this->location->getDir(false, true, false, 0).$file->getNameEncoded(), $this->location->getDir(false, true, false, 0))."\"> + \"Delete\" + +
    + + +
    + + + +
    +
    + getString("username"); ?>: + + getString("password"); ?>: + + " /> +
    +
    +
    + +location->uploadAllowed() && (GateKeeper::isUploadAllowed() || GateKeeper::isNewdirAllowed())) +{ +?> + +
    +
    + +
    + + " /> +
    + +
    + + " class="upload_sumbit" /> +
    + +
    +
    +
    + + + +
    +makeLink(false, true, null, null, null, "")."\">".$this->getString("log_out")." | "; + +if(EncodeExplorer::getConfig("mobile_enabled") == true) +{ + print "makeLink(true, false, null, null, null, $this->location->getDir(false, true, false, 0))."\">\n"; + print ($this->mobile == true)?$this->getString("standard_version"):$this->getString("mobile_version")."\n"; + print " | \n"; +} +if(GateKeeper::isAccessAllowed() && $this->getConfig("calculate_space_level") > 0 && $this->mobile == false) +{ + print $this->getString("total_used_space").": ".$this->spaceUsed." MB | "; +} +if($this->mobile == false && $this->getConfig("show_load_time") == true) +{ + printf($this->getString("page_load_time")." | ", (microtime(TRUE) - $_START_TIME)*1000); +} +?> +Encode Explorer
    + - \ No newline at end of file + + +init(); + +GateKeeper::init(); + +if(!ImageServer::showImage() && !Logger::logQuery()) +{ + $location = new Location(); + $location->init(); + if(GateKeeper::isAccessAllowed()) + { + Logger::logAccess($location->getDir(true, false, false, 0), true); + $fileManager = new FileManager(); + $fileManager->run($location); + } + $encodeExplorer->run($location); +} +?> diff --git a/include/tj.php b/include/tj.php index c34dc1e..3562758 100644 --- a/include/tj.php +++ b/include/tj.php @@ -54,7 +54,7 @@ $time = date("Y-m-d H:i:s");//$time把访问时间记录下来 如果向把具 $date = date("Y-m-d"); //注意Y要是英文半角哦 $ip = $_SERVER["REMOTE_ADDR"];//$ip记录访问者IP -$save = "
  • IP:".$ip." "." 访问时间:".$time."
  • \n";//把上面两个结合并添加空格 +$save = "
  • IP:".$ip." "." time:".$time."
  • \n";//把上面两个结合并添加空格 //不想要空格可以删除$save中的." " //echo $save;//echo 保存 file_put_contents("include/IP/"."IP_".$date.".txt",$save,FILE_APPEND);//通过$save保存至txt文档 diff --git a/site/baidu_api.php b/site/baidu_api.php index a6c1699..f2c678e 100644 --- a/site/baidu_api.php +++ b/site/baidu_api.php @@ -8,8 +8,9 @@ ** 获取推送接口:https://ziyuan.baidu.com/linksubmit/index ** 修改$api为自己的推送接口地址 -*/ $api = 'http://data.zz.baidu.com/urls?site=https://hao.lylme.com&token=xxxxxxxx'; +*/ +$api = 'http://data.zz.baidu.com/urls?site=www.yujinbing.cn&token=bpzAEx2rOpXRpb7L'; //以下内容无需修改 include_once("../include/common.php"); diff --git a/template/default/index.php b/template/default/index.php index 68fb751..66a3374 100644 --- a/template/default/index.php +++ b/template/default/index.php @@ -109,12 +109,11 @@ while ($soulist = $DB->fetch($soulists)) { } echo '"data-placeholder="' . $soulist["sou_hint"] . '"> - + '; } }