From 961aad43d187c87aeb56e50daa0d5e0d08dc5e2e Mon Sep 17 00:00:00 2001 From: "Florian Aders (EleRas)" Date: Thu, 23 Jun 2011 10:30:59 +0200 Subject: [PATCH] Added first rework of webftp - module, please not, this still needs a hell lot of work, but anyway: fixes #819 Signed-off-by: Florian Aders (EleRas) --- images/Froxlor/icons/file.gif | Bin 0 -> 1094 bytes images/Froxlor/icons/folder.gif | Bin 0 -> 1131 bytes images/Froxlor/icons/link.gif | Bin 0 -> 748 bytes images/Froxlor/icons/parent.gif | Bin 0 -> 1146 bytes images/Froxlor/icons/rename.gif | Bin 0 -> 1146 bytes locales/de/LC_MESSAGES/default.mo | Bin 0 -> 5841 bytes locales/de/LC_MESSAGES/default.po | 357 ++++++ smarty.c | 159 +++ templates/Froxlor/index.tpl | 46 + templates/Froxlor/login/login_ftp.tpl | 41 + templates/Froxlor/webftp/webftp_edit.tpl | 33 + templates/Froxlor/webftp/webftp_edit_new.tpl | 34 + templates/Froxlor/webftp/webftp_main.tpl | 43 + .../Froxlor/webftp/webftp_main_additional.tpl | 80 ++ .../Froxlor/webftp/webftp_main_dir_row.tpl | 14 + .../Froxlor/webftp/webftp_main_file_row.tpl | 14 + .../Froxlor/webftp/webftp_main_header.tpl | 19 + .../Froxlor/webftp/webftp_main_link_row.tpl | 13 + .../Froxlor/webftp/webftp_main_multiple.tpl | 30 + .../Froxlor/webftp/webftp_main_prompt.tpl | 27 + .../Froxlor/webftp/webftp_main_rename.tpl | 20 + webftp.php | 1062 +++++++++++++++++ 22 files changed, 1992 insertions(+) create mode 100644 images/Froxlor/icons/file.gif create mode 100644 images/Froxlor/icons/folder.gif create mode 100644 images/Froxlor/icons/link.gif create mode 100644 images/Froxlor/icons/parent.gif create mode 100644 images/Froxlor/icons/rename.gif create mode 100644 locales/de/LC_MESSAGES/default.mo create mode 100644 locales/de/LC_MESSAGES/default.po create mode 100644 smarty.c create mode 100644 templates/Froxlor/index.tpl create mode 100644 templates/Froxlor/login/login_ftp.tpl create mode 100644 templates/Froxlor/webftp/webftp_edit.tpl create mode 100644 templates/Froxlor/webftp/webftp_edit_new.tpl create mode 100644 templates/Froxlor/webftp/webftp_main.tpl create mode 100644 templates/Froxlor/webftp/webftp_main_additional.tpl create mode 100644 templates/Froxlor/webftp/webftp_main_dir_row.tpl create mode 100644 templates/Froxlor/webftp/webftp_main_file_row.tpl create mode 100644 templates/Froxlor/webftp/webftp_main_header.tpl create mode 100644 templates/Froxlor/webftp/webftp_main_link_row.tpl create mode 100644 templates/Froxlor/webftp/webftp_main_multiple.tpl create mode 100644 templates/Froxlor/webftp/webftp_main_prompt.tpl create mode 100644 templates/Froxlor/webftp/webftp_main_rename.tpl create mode 100644 webftp.php diff --git a/images/Froxlor/icons/file.gif b/images/Froxlor/icons/file.gif new file mode 100644 index 0000000000000000000000000000000000000000..976fd11bd1888ce2d1d436666cff6eebb75aa872 GIT binary patch literal 1094 zcmcJO`%hbS7{&`SoVU0s8kibc7NY2)lK6uIXCh|e5)7Gc3&t!e65ST!7#Wv!av6?G zV1t1xOlEXYELYvI!{WfLY;Ea*QhGt?>HXfG!|Cmu-e}ABwfqsj`Q**}JU=`?J#W$B z58pZPRR$}A6=AUeU<&{NL;>OmqFb=J1tA1MfJg!u1n~q4CxA{sFaes6UC+L`s0mnAT90UsuMh0wj5@e;p6^Q8=umr&5NBRJm{b2Mb zZ!q{k?*pqhX7D1t7ip5x3mPwIJxJ>TEd>NY;1p;maJ${wjhKU=&2Hvj64o}5!5vy9 z!R|~-q;rSWB&Z0mIw>^)7CWtSgEEN=Hx#N7|tlxNs%V;K;u`hYVNJU+`3=1N~u&T@u~+? zx#yMCywZ1185An0d3i{pFg=jF=HwCK3ME`7=j2|QO!m+628LmGWa0Z#@}?X~Boe;Z zFA|AviAkYQ$i466&AM*QIA>;NMg^omAQ%y7`F#G=)YLDN`1ttv$k^SH(aCG0w(C4? z-w4j-ayf(A!NI|6Lz4Od=Y>93*N?omUeTpqX?yQpFKWZCp*ESAUH}KgFzt+?bUufuMf8T$mcDkmv>&!XM*|YWEoN7z9 zl=c72-p#Zf87wPn|91TLPq20ZOPpn?T2OF{Z@kN4hl+lF*!J`*;>^6%)HGIR!Dp#E zc3ZQb%lu%^Teo*A#!J7*@0ch{7fSon%cHLyznt}3*BiTb*9rNqN8aNfeXM}@Nl$C~ zM=w;A-c3nqF43CLRfv9QKKA(DKTjX}^r>S-2TNaV&zv2a#IvRB>fthJVW*(dhEDV7 z-jg|p$Gbj_1WQri0L)jZ+CTo#gazg+Qme(M2F`4z@h zH)JFJn)rI)$U%Kt)zMte{x7kcNA^9@|KiZ|Cj{-ev*G0%cfMU}wN&LC%6YR=-i(*E NoGK~fq@=J4{sRPp$~*u7 literal 0 HcmV?d00001 diff --git a/images/Froxlor/icons/folder.gif b/images/Froxlor/icons/folder.gif new file mode 100644 index 0000000000000000000000000000000000000000..648dfcd9f6364e30ab479b49240e4aab94b87a0b GIT binary patch literal 1131 zcmeH`+fQ3{0DupxRA8AvY(NxnESm=1%%U@6Y78UD*dADBGy*XKCXf*UH#SVon4?t2 zC{Q-rjdf5iwUlyO+qLzAwv-mIgF^4n7JGVK%SvlY3p>E+;b->lpWyfUy?x1d=4?UE zsR{x_fDi~$F{(bQGkOf_pt19=(9_U3XqC`yy2l;~`SNIR(XgZz-op@$YWSXA$FJ=5 zX*oA;E5V<$vuHrv#PjVUwtpO}4@V|G>k6Pw1~&J-Nh%&!Zf<)8O6v}%uix>oww?Nkv;JT4s-KJ}i?f&&UuZjV%ohMI&LDV-M@@TnM;8>7H!*ljoF7eTB#L_=5Us>#H z2ydE0lB?K4BWk1Dd@lVjy*~;g)yz;QWo*yT?6(R4@cUMmO}zF}Dsr8*Vs&Y!S2j^E z$0@8=GAY|3iF;lc-7@~oy~I#~qHBiDr&iq;1t%#`1Nf<#S-wXj2 zhZ^!Px|DpqXc%2?Z&hrg>%7wL@S1KC0QX+h%v=WU85#g8%zY;s7)GBk0eH3>RyK?Q zSWK@O-dZ=S!d`>%=Neet;hL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Froxlor/icons/parent.gif new file mode 100644 index 0000000000000000000000000000000000000000..33ad025318dd0a0209fad9d22c1587bc71ec7dda GIT binary patch literal 1146 zcmeH`|5K880LLFeZ#rhHm#^^q_E0SAeqAm9X3AMF7@tNk5&|MvRrb+5a3N@{Za zrxX%If=~!bIwSPTXb3l_oyT*V5Y2DAT&B6YbIoIHMD)wb;W0!|d7?o1Yy~N8a@Dq) zmh?ZjA*g>5c0O(mY)tD$h5y*5j$M$kIK8Kto3^&R$*#)m5@c=W_tSYWf*_c0U_#y4 zV?f<{c7p=6H9rUp7Q3blX6Y5%sAAnK3v4Wv2*8n|$xC%l$LcS3{WUV6@mL>LQYw6? z&ux@TJ(dn^h8q~Y;?k?IC+xf*fAz2GABpa&#un@&l9HyC+?)E8Eb*qUR9#nouV?L- zCbe(~osksgaDi+J1UBZd#cmy+y0Tz#j@8eq#ecWt&-Rx4y>iT4Ww6YhE9$@;0^qe$9ShcKfu<18}CF%4)i&gql^APCn*9}kj7H$0(=vMvx zT&t9AXk}yW_QE>gkzbzRW-VFS61ZztqxkZBqg5uI*FCa#=A&M-erk~^T74p>oxL>r zyot{-^IQe`fBzMT-UtpMK`<2if?j+A3I)*7u*gGki9B*uXiO%jZyyUE`E_jVdduP9 zgm(|HmUpuTqj7N5R$^oDJKM?M#c!c^s?%#??Swj`|@vEf4Xc_A57rMuStF!vSAVEg;2cQA%ZyjgoRSPCHK&DU@J%H-I{MD^ zrnlS0*(r>D*OPPk1unwv9mm@kUkx2Od#gBx_-1G(Kd6kp?Gwb!-ww+;*s+AxU3ZxB z0ETk2a9i#YcWZGR=r#T|e5Eh-^|$efIk2sttEzo6a{ae4M@d&$;WLgYr(> zxBX37_P=z}z1~CLzyJET>cBg@;`=w={6BK*hfU)TzbXG`Z+?>0efRXEzs8w&cOQRq z;L68MJ04W+{QvgjucrAA+{^Bn6h8B9dc5Jxr_==><}AK;=l;iuC;m)4@NxdSdpjUoyK487pvr64p8asId%Ae% z>(GYV(-z-u+5J7c=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*`ew@bNxV+j<_|Uq@?\n" +"Language-Team: The Froxlor team \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-KeywordsList: _;gettext;gettext_noop\n" +"X-Poedit-Basepath: /home/florian/froxlor\n" +"X-Poedit-Language: DE\n" +"X-Poedit-Country: Germany\n" +"X-Poedit-SearchPath-0: .\n" + +#: smarty.c:2 +msgid "Froxlor Server Management Panel" +msgstr "Froxlor Server Management Panel" + +#: smarty.c:5 +#: smarty.c:26 +#: smarty.c:41 +#: smarty.c:80 +msgid "Success" +msgstr "Erfolgreich" + +#: smarty.c:8 +#: smarty.c:29 +#: smarty.c:44 +#: smarty.c:83 +msgid "Error" +msgstr "Fehler" + +#: smarty.c:11 +msgid "Froxlor - WebFTP - Login" +msgstr "Froxlor - WebFTP - Login" + +#: smarty.c:14 +msgid "Username" +msgstr "Benutzername" + +#: smarty.c:17 +msgid "Password" +msgstr "Passwort" + +#: smarty.c:20 +msgid "Login" +msgstr "Login" + +#: smarty.c:23 +msgid "Editing" +msgstr "Bearbeiten" + +#: smarty.c:32 +#: smarty.c:50 +msgid "Save file" +msgstr "Datei speichern" + +#: smarty.c:35 +#: smarty.c:53 +msgid "Cancel" +msgstr "Abbrechen" + +#: smarty.c:38 +msgid "Creating a file in" +msgstr "Erstellt eine Datei in" + +#: smarty.c:47 +#: smarty.c:107 +msgid "Filename" +msgstr "Dateiname" + +#: smarty.c:56 +#: smarty.c:62 +#: smarty.c:71 +#: smarty.c:146 +msgid "Delete" +msgstr "Löschen" + +#: smarty.c:59 +#: smarty.c:65 +#: smarty.c:74 +msgid "Rename" +msgstr "Umbenennen" + +#: smarty.c:68 +msgid "Symbolic link to" +msgstr "Symlink nach" + +#: smarty.c:77 +msgid "Edit" +msgstr "Bearbeiten" + +#: smarty.c:86 +msgid "Basic operations" +msgstr "Standard Operationen" + +#: smarty.c:89 +msgid "Change dir" +msgstr "Verzeichnis wechseln" + +#: smarty.c:92 +msgid "Create dir" +msgstr "Verzeichnis erstellen" + +#: smarty.c:95 +msgid "Create new file in current directory" +msgstr "Neue Datei in aktuellem Verzeichnis erstellen" + +#: smarty.c:98 +msgid "Upload files" +msgstr "Dateien hochladen" + +#: smarty.c:101 +msgid "Upload file(s)" +msgstr "Datei(en) hochladen" + +#: smarty.c:104 +msgid "Rename / Move" +msgstr "Umbenennen / Verschieben" + +#: smarty.c:110 +msgid "Size" +msgstr "Größe" + +#: smarty.c:113 +msgid "Date" +msgstr "Datum" + +#: smarty.c:116 +msgid "Permissions" +msgstr "Berechtigungen" + +#: smarty.c:119 +msgid "User" +msgstr "Benutzer" + +#: smarty.c:122 +msgid "Group" +msgstr "Gruppe" + +#: smarty.c:125 +msgid "Options" +msgstr "Optionen" + +#: smarty.c:128 +msgid "Files" +msgstr "Dateien" + +#: smarty.c:131 +msgid "Complete filesize" +msgstr "Komplette Dateigröße" + +#: smarty.c:134 +msgid "Symlinks" +msgstr "Symlinks" + +#: smarty.c:137 +msgid "Directories" +msgstr "Verzeichnisse" + +#: smarty.c:140 +msgid "Complete directorysize" +msgstr "Komplette Verzeichnisgröße" + +#: smarty.c:143 +msgid "Selected file(s)" +msgstr "Markierte Datei(en)" + +#: smarty.c:149 +msgid "Change permission to" +msgstr "Berechtigungen ändern zu" + +#: smarty.c:152 +msgid "Move to" +msgstr "Verschieben nach" + +#: smarty.c:155 +msgid "Do it" +msgstr "Tu es" + +#: smarty.c:158 +msgid "the Froxlor Team" +msgstr "das Froxlor Team" + +#: webftp.php:333 +#: webftp.php:340 +#: webftp.php:420 +#, php-format +msgid "Directory change to '%1$s' failed!" +msgstr "Verzeichniswechsel nach '%1$s' fehlgeschlagen!" + +#: webftp.php:347 +#: webftp.php:359 +#: webftp.php:365 +#: webftp.php:416 +#, php-format +msgid "current folder = [%1$s]" +msgstr "aktuelles Verzeichnis = [%1$s]" + +#: webftp.php:461 +#, php-format +msgid "File '%1$s' is to big! (max. %2$u bytes)
" +msgstr "Datei '%1$s' ist zu groß! (max. %2$u Bytes)
" + +#: webftp.php:476 +#, php-format +msgid "
File '%1$s' couldn't be uploaded!" +msgstr "
Datei '%1$s' konnte nicht hochgeladen werden!" + +#: webftp.php:480 +#, php-format +msgid "
File '%1$s' was successfully uploaded!" +msgstr "
Datei '%1$s' wurde erfolgreich hochgeladen!" + +#: webftp.php:490 +#, php-format +msgid "
Directory '%1$s' deleted!" +msgstr "
Verzeichnis '%1$s' gelöscht!" + +#: webftp.php:494 +#, php-format +msgid "
Directory '%1$s' couldn't be deleted!" +msgstr "
Verzeichnis '%1$s' konnt nicht gelöscht werden!" + +#: webftp.php:500 +#: webftp.php:617 +#, php-format +msgid "
'%1$s' deleted!" +msgstr "
'%1$s' gelöscht!" + +#: webftp.php:504 +#: webftp.php:621 +#, php-format +msgid "
'%1$s' couldn't be deleted!" +msgstr "
'%1$s' konnt nicht gelöscht werden!" + +#: webftp.php:512 +#, php-format +msgid "'%1$s' renamed to '%2$s'" +msgstr "'%1$s' wurde umbenannt noch '%2$s'" + +#: webftp.php:516 +#, php-format +msgid "'%1$s' couldn't be renamed to '%2$s'!" +msgstr "'%1$s' konnt nicht nach '%2$s' umbenannt werden" + +#: webftp.php:521 +#, php-format +msgid "File '%1$s' rename/move to" +msgstr "Datei '%1$s' verschoben nach" + +#: webftp.php:527 +#, php-format +msgid "Directory '%1$s' created" +msgstr "Verzeichnis '%1$s' erstellt" + +#: webftp.php:531 +#, php-format +msgid "Directory '%1$s' couldn't be created!" +msgstr "Verzeichnis '%1$s' konnte nicht erstellt werden!" + +#: webftp.php:546 +#: webftp.php:577 +#, php-format +msgid "
The permission '%1$s' you entered is not valid!" +msgstr "
Die eingegebenen Berechtigungen '%1$s' sind nicht valide!" + +#: webftp.php:553 +#: webftp.php:588 +#, php-format +msgid "
The permission of '%1$s' is set to '%2$s'!" +msgstr "
Die Berechtigungen von '%1$s' wurden auf '%2$s' gesetzt!" + +#: webftp.php:557 +#: webftp.php:592 +#, php-format +msgid "
The permission of '%1$s' couldn't be set to '%2$s'!" +msgstr "
Die Berechtigungen für '%1$s' konnten nicht auf '%2$s' gesetzt werden " + +#: webftp.php:641 +#, php-format +msgid "
File '%1$s' moved" +msgstr "
Datei '%1$s' verschoben" + +#: webftp.php:645 +#, php-format +msgid "
File '%1$s' couldn't be moved" +msgstr "
Die Datei '%1$s' konnte nicht verschoben werden" + +#: webftp.php:652 +#, php-format +msgid "The directory '%1$s' doesn't exist" +msgstr "Das Verzeichnis '%1$s' existiert nicht" + +#: webftp.php:696 +#, php-format +msgid "File '%1$s' couldn't be downloaded!" +msgstr "Die Datei '%1$s' konnte nicht heruntergeladen werden!" + +#: webftp.php:733 +#, php-format +msgid "File '%1$s' couldn't be saved!" +msgstr "Die Datei '%1$s' konnte nicht gespeichert werden!" + +#: webftp.php:737 +#, php-format +msgid "File '%1$s' was saved succesfully!" +msgstr "Die Datei '%1$s' wurde erfolgreich gespeichert!" + +#: webftp.php:744 +#, php-format +msgid "Files with these extension can't be created/edited!" +msgstr "Dateien mit dieser Endung können nicht erstellt / bearbeitet werden!" + +#: webftp.php:752 +msgid "Please enter a filename!" +msgstr "Bitte einen Dateinamen eingeben!" + +#: webftp.php:902 +#, php-format +msgid "Connected to %1$s" +msgstr "Verbunden mit %1$s" + +#: webftp.php:921 +msgid "Do you really want to delete the selected files?" +msgstr "Sollen die markierten Dateien wirklich gelöscht werden?" + +#: webftp.php:925 +#, php-format +msgid "Do you really want to move the selected files to '%1$s'?" +msgstr "Sollen die markierten Dateien wirklich nach '%1$s' verschoben werden?" + +#: webftp.php:930 +#, php-format +msgid "Do you really want to set the permission of the selected files to '%1$s'?" +msgstr "Sollen die Berechtigungen der markierten Dateien wirklich auf '%1$s' geändert werden?" + +#: webftp.php:941 +msgid "Logout" +msgstr "Logout" + +#: webftp.php:943 +msgid "Switch to BINARY mode" +msgstr "Auf BINARY - Modus wechseln" + +#: webftp.php:945 +msgid "Switch to ASCII mode" +msgstr "Auf ASCII - Modus wechseln" + +#: webftp.php:947 +msgid "Main" +msgstr "Hauptmenü" + diff --git a/smarty.c b/smarty.c new file mode 100644 index 00000000..650af90b --- /dev/null +++ b/smarty.c @@ -0,0 +1,159 @@ +/* templates/Froxlor/login/login_ftp.tpl */ +gettext("Froxlor Server Management Panel"); + +/* templates/Froxlor/login/login_ftp.tpl */ +gettext("Success"); + +/* templates/Froxlor/login/login_ftp.tpl */ +gettext("Error"); + +/* templates/Froxlor/login/login_ftp.tpl */ +gettext("Froxlor - WebFTP - Login"); + +/* templates/Froxlor/login/login_ftp.tpl */ +gettext("Username"); + +/* templates/Froxlor/login/login_ftp.tpl */ +gettext("Password"); + +/* templates/Froxlor/login/login_ftp.tpl */ +gettext("Login"); + +/* templates/Froxlor/webftp/webftp_edit.tpl */ +gettext("Editing"); + +/* templates/Froxlor/webftp/webftp_edit.tpl */ +gettext("Success"); + +/* templates/Froxlor/webftp/webftp_edit.tpl */ +gettext("Error"); + +/* templates/Froxlor/webftp/webftp_edit.tpl */ +gettext("Save file"); + +/* templates/Froxlor/webftp/webftp_edit.tpl */ +gettext("Cancel"); + +/* templates/Froxlor/webftp/webftp_edit_new.tpl */ +gettext("Creating a file in"); + +/* templates/Froxlor/webftp/webftp_edit_new.tpl */ +gettext("Success"); + +/* templates/Froxlor/webftp/webftp_edit_new.tpl */ +gettext("Error"); + +/* templates/Froxlor/webftp/webftp_edit_new.tpl */ +gettext("Filename"); + +/* templates/Froxlor/webftp/webftp_edit_new.tpl */ +gettext("Save file"); + +/* templates/Froxlor/webftp/webftp_edit_new.tpl */ +gettext("Cancel"); + +/* templates/Froxlor/webftp/webftp_main_dir_row.tpl */ +gettext("Delete"); + +/* templates/Froxlor/webftp/webftp_main_dir_row.tpl */ +gettext("Rename"); + +/* templates/Froxlor/webftp/webftp_main_link_row.tpl */ +gettext("Delete"); + +/* templates/Froxlor/webftp/webftp_main_link_row.tpl */ +gettext("Rename"); + +/* templates/Froxlor/webftp/webftp_main_link_row.tpl */ +gettext("Symbolic link to"); + +/* templates/Froxlor/webftp/webftp_main_file_row.tpl */ +gettext("Delete"); + +/* templates/Froxlor/webftp/webftp_main_file_row.tpl */ +gettext("Rename"); + +/* templates/Froxlor/webftp/webftp_main_file_row.tpl */ +gettext("Edit"); + +/* templates/Froxlor/webftp/webftp_main_header.tpl */ +gettext("Success"); + +/* templates/Froxlor/webftp/webftp_main_header.tpl */ +gettext("Error"); + +/* templates/Froxlor/webftp/webftp_main_additional.tpl */ +gettext("Basic operations"); + +/* templates/Froxlor/webftp/webftp_main_additional.tpl */ +gettext("Change dir"); + +/* templates/Froxlor/webftp/webftp_main_additional.tpl */ +gettext("Create dir"); + +/* templates/Froxlor/webftp/webftp_main_additional.tpl */ +gettext("Create new file in current directory"); + +/* templates/Froxlor/webftp/webftp_main_additional.tpl */ +gettext("Upload files"); + +/* templates/Froxlor/webftp/webftp_main_additional.tpl */ +gettext("Upload file(s)"); + +/* templates/Froxlor/webftp/webftp_main_rename.tpl */ +gettext("Rename / Move"); + +/* templates/Froxlor/webftp/webftp_main.tpl */ +gettext("Filename"); + +/* templates/Froxlor/webftp/webftp_main.tpl */ +gettext("Size"); + +/* templates/Froxlor/webftp/webftp_main.tpl */ +gettext("Date"); + +/* templates/Froxlor/webftp/webftp_main.tpl */ +gettext("Permissions"); + +/* templates/Froxlor/webftp/webftp_main.tpl */ +gettext("User"); + +/* templates/Froxlor/webftp/webftp_main.tpl */ +gettext("Group"); + +/* templates/Froxlor/webftp/webftp_main.tpl */ +gettext("Options"); + +/* templates/Froxlor/webftp/webftp_main.tpl */ +gettext("Files"); + +/* templates/Froxlor/webftp/webftp_main.tpl */ +gettext("Complete filesize"); + +/* templates/Froxlor/webftp/webftp_main.tpl */ +gettext("Symlinks"); + +/* templates/Froxlor/webftp/webftp_main.tpl */ +gettext("Directories"); + +/* templates/Froxlor/webftp/webftp_main.tpl */ +gettext("Complete directorysize"); + +/* templates/Froxlor/webftp/webftp_main_multiple.tpl */ +gettext("Selected file(s)"); + +/* templates/Froxlor/webftp/webftp_main_multiple.tpl */ +gettext("Delete"); + +/* templates/Froxlor/webftp/webftp_main_multiple.tpl */ +gettext("Change permission to"); + +/* templates/Froxlor/webftp/webftp_main_multiple.tpl */ +gettext("Move to"); + +/* templates/Froxlor/webftp/webftp_main_multiple.tpl */ +gettext("Do it"); + +/* templates/Froxlor/index.tpl */ +gettext("the Froxlor Team"); + diff --git a/templates/Froxlor/index.tpl b/templates/Froxlor/index.tpl new file mode 100644 index 00000000..f7b7fcc2 --- /dev/null +++ b/templates/Froxlor/index.tpl @@ -0,0 +1,46 @@ + + + + + + {if $settings.panel.no_robots == 0} + + + {/if} + + + + + + {$title}Froxlor Server Management Panel + + + +{if $loggedin == 1} +
+
+

Froxlor Server Management Panel

+
+ Froxlor Server Management Panel +
+ + +{/if} + +{if $loggedin} +
+{else} +
+{/if} +{$body} +
+
+ Froxlor + {if ($settings.admin.show_version_login == '1' && $loggedin == 0) || ($settings.admin.show_version_footer == '1' && $loggedin == 1)} + {$version}{$branding} + {/if} + © 2009-{$current_year} by {t}the Froxlor Team{/t} + +
+ + diff --git a/templates/Froxlor/login/login_ftp.tpl b/templates/Froxlor/login/login_ftp.tpl new file mode 100644 index 00000000..0a84945d --- /dev/null +++ b/templates/Froxlor/login/login_ftp.tpl @@ -0,0 +1,41 @@ + \ No newline at end of file diff --git a/templates/Froxlor/webftp/webftp_edit.tpl b/templates/Froxlor/webftp/webftp_edit.tpl new file mode 100644 index 00000000..59dc2905 --- /dev/null +++ b/templates/Froxlor/webftp/webftp_edit.tpl @@ -0,0 +1,33 @@ +
+
+

+   + {t}Editing{/t}: {$currentDir}/{$file} ({$mode}) +

+
+ {if isset($successmessage)} +
+
{t}Success{/t}
+
{$successmessage}
+
+ {/if} + {if isset($errormessage)} +
+
{t}Error{/t}
+
{$errormessage}
+
+ {/if} +
+
+ + + + + + +
+ + +
+
+
\ No newline at end of file diff --git a/templates/Froxlor/webftp/webftp_edit_new.tpl b/templates/Froxlor/webftp/webftp_edit_new.tpl new file mode 100644 index 00000000..927f4a5f --- /dev/null +++ b/templates/Froxlor/webftp/webftp_edit_new.tpl @@ -0,0 +1,34 @@ +
+
+

+   + {t}Creating a file in{/t}: {$currentDir} ({$mode}) +

+
+ {if isset($successmessage)} +
+
{t}Success{/t}
+
{$successmessage}
+
+ {/if} + {if isset($errormessage)} +
+
{t}Error{/t}
+
{$errormessage}
+
+ {/if} +
+
+ + + + + +
+ {t}Filename{/t}: + + + +
+
+
\ No newline at end of file diff --git a/templates/Froxlor/webftp/webftp_main.tpl b/templates/Froxlor/webftp/webftp_main.tpl new file mode 100644 index 00000000..7aeb5959 --- /dev/null +++ b/templates/Froxlor/webftp/webftp_main.tpl @@ -0,0 +1,43 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + {$output_dir} + {$output_link} + {$output_file} + + + + + + +
  {t}Filename{/t}{t}Size{/t}{t}Date{/t}{t}Permissions{/t}{t}User{/t}{t}Group{/t}{t}Options{/t}
  + + + .. +
+ {t}Files{/t}: {$countArray.file}; {t}Complete filesize{/t}: {$countArray.filesize}; {t}Symlinks{/t}: {$countArray.link}; {t}Directories{/t}: {$countArray.dir}; {t}Complete directorysize{/t}: {$countArray.dirsize} +
+
+
diff --git a/templates/Froxlor/webftp/webftp_main_additional.tpl b/templates/Froxlor/webftp/webftp_main_additional.tpl new file mode 100644 index 00000000..2c6702f5 --- /dev/null +++ b/templates/Froxlor/webftp/webftp_main_additional.tpl @@ -0,0 +1,80 @@ +
+
+

{t}Basic operations{/t}

+ + + + + + + + + + +
+ + + + + + +
+
+ + + + + +
+
+
+ + + + + +
+
+
+
+

{t}Upload files{/t}

+
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+
+
\ No newline at end of file diff --git a/templates/Froxlor/webftp/webftp_main_dir_row.tpl b/templates/Froxlor/webftp/webftp_main_dir_row.tpl new file mode 100644 index 00000000..9523a0c3 --- /dev/null +++ b/templates/Froxlor/webftp/webftp_main_dir_row.tpl @@ -0,0 +1,14 @@ + + + + {$myDir.name} + {$myDir.size} + {$myDir.date} + {$myDir.perms} + {$myDir.user} + {$myDir.group} + {t}Delete{/t} + {t}Rename{/t} +   +   + diff --git a/templates/Froxlor/webftp/webftp_main_file_row.tpl b/templates/Froxlor/webftp/webftp_main_file_row.tpl new file mode 100644 index 00000000..fd293229 --- /dev/null +++ b/templates/Froxlor/webftp/webftp_main_file_row.tpl @@ -0,0 +1,14 @@ + + + + {$myDir.name} + {$myDir.size} + {$myDir.date} + {$myDir.perms} + {$myDir.user} + {$myDir.group} + {t}Delete{/t} + {t}Rename{/t} + {if $editable}{t}Edit{/t}{/if} +   + \ No newline at end of file diff --git a/templates/Froxlor/webftp/webftp_main_header.tpl b/templates/Froxlor/webftp/webftp_main_header.tpl new file mode 100644 index 00000000..f2c50ab1 --- /dev/null +++ b/templates/Froxlor/webftp/webftp_main_header.tpl @@ -0,0 +1,19 @@ +
+
+

+   + {$connected_to} ({$mode}) +

+
+ {if isset($successmessage)} +
+
{t}Success{/t}
+
{$successmessage}
+
+ {/if} + {if isset($errormessage)} +
+
{t}Error{/t}
+
{$errormessage}
+
+ {/if} diff --git a/templates/Froxlor/webftp/webftp_main_link_row.tpl b/templates/Froxlor/webftp/webftp_main_link_row.tpl new file mode 100644 index 00000000..2c17a24b --- /dev/null +++ b/templates/Froxlor/webftp/webftp_main_link_row.tpl @@ -0,0 +1,13 @@ + + + + {$myDir.name} + {$myDir.size} + {$myDir.date} + {$myDir.perms} + {$myDir.user} + {$myDir.group} + {t}Delete{/t} + {t}Rename{/t} + {t}Symbolic link to{/t}: {$myDir.target}  + \ No newline at end of file diff --git a/templates/Froxlor/webftp/webftp_main_multiple.tpl b/templates/Froxlor/webftp/webftp_main_multiple.tpl new file mode 100644 index 00000000..f0200bfa --- /dev/null +++ b/templates/Froxlor/webftp/webftp_main_multiple.tpl @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + +
{t}Selected file(s){/t}:
+ {t}Delete{/t} +
+ + {t}Change permission to{/t} +
+ + {t}Move to{/t} +
+ +
+ +
+
\ No newline at end of file diff --git a/templates/Froxlor/webftp/webftp_main_prompt.tpl b/templates/Froxlor/webftp/webftp_main_prompt.tpl new file mode 100644 index 00000000..6b3f93c5 --- /dev/null +++ b/templates/Froxlor/webftp/webftp_main_prompt.tpl @@ -0,0 +1,27 @@ + + + + + + + + + + + + +
{$action_text}
+   + + + +
+
+ \ No newline at end of file diff --git a/templates/Froxlor/webftp/webftp_main_rename.tpl b/templates/Froxlor/webftp/webftp_main_rename.tpl new file mode 100644 index 00000000..4f95f5c1 --- /dev/null +++ b/templates/Froxlor/webftp/webftp_main_rename.tpl @@ -0,0 +1,20 @@ + + + + + + + + +
+ + + + + {$rename_text} + + + + +
+
diff --git a/webftp.php b/webftp.php new file mode 100644 index 00000000..8f97ba79 --- /dev/null +++ b/webftp.php @@ -0,0 +1,1062 @@ + (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package WebFTP + * + */ +// Konfiguration +// Server to connect to: +$server = 'localhost'; + +// Temporary directory on the server (need write permissions) +$downloadDir = "/tmp/"; + +// Which file extensions indicate files allowed to be edited +// Either simple extension or regex +$editFileExtensions = array("php[34]?$","sh$","txt$","[ps]?htm[l]?$","tpl$","pl","cgi","^ht[acespwd]+$"); +// Are files without extension allowed to be edited? +$editFileNoExtension = true; +// Which FTP - mode should be used by default? +$default_mode = "FTP_BINARY"; +// Max. uploadsize (0 = unlimited) +$MAX_FILE_SIZE = 1907300; + +header("Content-Type: text/html; charset=utf-8"); + +// prevent Froxlor pages from being cached +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Pragma: no-cache"); +header('Last-Modified: ' . gmdate( 'D, d M Y H:i:s \G\M\T', time())); +header('Expires: ' . gmdate( 'D, d M Y H:i:s \G\M\T', time())); + +// Prevent inline - JS to be executed (i.e. XSS) in browsers which support this, +// Inline-JS is no longer allowed and used +// See: http://people.mozilla.org/~bsterne/content-security-policy/index.html +header("X-Content-Security-Policy: allow 'self'; frame-ancestors 'none'"); + +// Don't allow to load Froxlor in an iframe to prevent i.e. clickjacking +header('X-Frame-Options: DENY'); + +// If Froxlor was called via HTTPS -> enforce it for the next time +if(isset( $_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off' )) +{ + header('Strict-Transport-Security: max-age=500'); +} + +// Internet Explorer shall not guess the Content-Type, see: +// http://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx +header('X-Content-Type-Options: nosniff' ); + +// ensure that default timezone is set +if(function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get")) +{ + @date_default_timezone_set(@date_default_timezone_get()); +} + +// Load the database - connection parameters +if(!file_exists('./lib/userdata.inc.php')) +{ + $config_hint = file_get_contents('./templates/Froxlor/misc/configurehint.tpl'); + die($config_hint); +} + +if(!is_readable('./lib/userdata.inc.php')) +{ + die('You have to make the file "./lib/userdata.inc.php" readable for the http-process!'); +} + +require ('./lib/userdata.inc.php'); + +if(!isset($sql) || !is_array($sql)) +{ + $config_hint = file_get_contents('./templates/Froxlor/misc/configurehint.tpl'); + die($config_hint); +} + +if(!function_exists("ftp_connect")) +{ + die('No FTP support'); +} + +// Create the database - connection +$db = new mysqli($sql['host'], $sql['user'], $sql['password'], $sql['db']); +unset($sql); +if ($db->connect_error) +{ + die('Connect Error (' . $db->connect_errno . ') ' . $db->connect_error); +} + +$settings = array(); +// Let's get the theme we need +if ($result = $db->query("SELECT `value` FROM `panel_settings` WHERE `varname` = 'default_theme'")) +{ + list($settings['panel']['default_theme']) = $result->fetch_array(); +} +else +{ + // Default will be Froxlor ;) + $settings['panel']['default_theme'] = 'Froxlor'; +} + +# Set the language +setLocale(LC_ALL,'en_US.utf8'); +bindtextdomain('default','./locales/'); +textdomain('default'); +if ($handle = opendir('./locales/')) +{ + $files = array(); + while(false!==($file = readdir($handle))) + { + if (is_dir('./locales/' . $file) && !preg_match('/^\.\.?$/', $file)) + { + $files[] = $file; + } + } + closedir($handle); + sort($files); + $available_languages = array(); + foreach($files as $f) + { + $available_languages[] = $f; + } +} +else +{ + echo 'error: missing language files'; + exit; +} + +$ls = array(); +if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) +{ + $_SERVER['HTTP_ACCEPT_LANGUAGE'] = ''; +} + +$langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); +foreach($langs as $lang) +{ + if (in_array(preg_replace('/;.*/','',trim($lang)), $available_languages)) + { + $selected_language = preg_replace('/;.*/','',trim($lang)); + break; + } +} +if(!isset($selected_language)) +{ + $selected_language = 'en'; +} + +if(!setLocale(LC_ALL, $selected_language)) +{ + preg_match_all("/[^|\w]".$selected_language.'.*/',`locale -a`,$matches); + if(!count($matches[0])) + { + die('no locale info for "'.$selected_language.'"'); + } + $selected_language = trim($matches[0][0]); + foreach($matches[0] as $m) + { + if(preg_match('/utf8/', $m)) + { + $selected_language = trim($m); + break; + } + } + setLocale(LC_ALL, $selected_language); +} + +# Initialize Smarty +include('./lib/classes/Smarty/Smarty.class.php'); +$smarty = new Smarty; + +$smarty->template_dir = './templates/' . $settings['panel']['default_theme'] . '/'; +$smarty->compile_dir = './templates_c/'; +$smarty->cache_dir = './cache/'; + +$settings['admin']['show_version_login'] = 0; +if ($result = $db->query("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'admin' AND `varname` = 'show_version_login'")) +{ + list($settings['admin']['show_version_login']) = $result->fetch_array(); +} +$settings['admin']['show_version_footer'] = 0; +if ($result = $db->query("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'admin' AND `varname` = 'show_version_footer'")) +{ + list($settings['admin']['show_version_footer']) = $result->fetch_array(); +} +$settings['panel']['no_robots'] = 0; +if ($result = $db->query("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'panel' AND `varname` = 'no_robots'")) +{ + list($settings['panel']['no_robots']) = $result->fetch_array(); +} + +// We don't need the database anymore +$db->close(); +unset($db); + +# Activate gettext for smarty; +define('HAVE_GETTEXT', true); +require ('./lib/functions/smarty_plugins/gettext-prefilter.php'); +# Set default options for template +$image_path = 'images/'.$settings['panel']['default_theme']; +$header_logo = $image_path.'/logo.png'; +if(file_exists($image_path.'/logo_custom.png')) +{ + $header_logo = $image_path.'/logo_custom.png'; +} +$smarty->assign('header_logo', $header_logo); +$smarty->assign('settings', $settings); +$smarty->assign('loggedin', 0); +$smarty->assign('current_year', date('Y')); +$smarty->assign('image_folder', $image_path); +$smarty->assign('title', 'WebFTP - '); + +# Let's start the program +session_start(); +$s = session_id(); + +if (isset($_GET['logoff']) || isset($_POST['logoff'])) +{ + unset($_SESSION['server'],$_SESSION['user'],$_SESSION['password']); + session_destroy(); + $body = $smarty->fetch('login/login_ftp.tpl'); +} +elseif ((!empty($_POST['loginname']) && !empty($_POST['password'])) || (!empty($_SESSION['user']) && !empty($_SESSION['password']) && !empty($_SESSION['server']))) +{ + if(empty($_SESSION['server'])) + { + $_SESSION['server'] = $server; + } + if(empty($_SESSION['user'])) + { + $_SESSION['user'] = $_POST['loginname']; + } + if(empty($_SESSION['password'])) + { + $_SESSION['password'] = $_POST['password']; + } + + $connection = ftp_connect($_SESSION['server']); + $loggedOn = ftp_login($connection, $_SESSION['user'], $_SESSION['password']); + $systype = ftp_systype($connection); + $pasv = ftp_pasv($connection, false); + + // Mode setzen + if(isset($_POST['mode'])) + { + $mode = $_POST['mode']; + $_SESSION['mode'] = $mode; + } + elseif(isset($_GET['mode'])) + { + $mode = $_GET['mode']; + $_SESSION['mode'] = $mode; + } + elseif(isset($_SESSION['mode'])) + { + $mode = $_SESSION['mode']; + } + else + { + $mode = $default_mode; + $_SESSION['mode'] = $default_mode; + } + $smarty->assign('mode', $mode); + + if(isset($_POST['file']) && is_array($_POST['file'])) + { + $file = $_POST['file']; + if(get_magic_quotes_gpc()) + { + foreach($_POST['file'] as $key => $val) + { + $_POST['file'][$key] = stripslashes($val); + } + foreach($_POST as $key => $val) + { + $_POST[$key] = stripslashes($val); + } + foreach($_GET as $key => $val) + { + $_GET[$key] = stripslashes($val); + } + } + } + else + { + if(get_magic_quotes_gpc()) + { + foreach($_POST as $key => $val) + { + $_POST[$key] = stripslashes($val); + } + foreach($_GET as $key => $val) + { + $_GET[$key] = stripslashes($val); + } + } + if(isset($_POST['file'])) + { + $file = $_POST['file']; + $smarty->assign('file', $file); + } + elseif(isset($_GET['file'])) + { + $file = $_GET['file']; + $smarty->assign('file', $file); + } + //$file = htmlentities($file); + } + + if(isset($_POST['action'])) + { + $action = $_POST['action']; + } + elseif(isset($_GET['action'])) + { + $action = $_GET['action']; + } + else + { + $action = ''; + } + + if ($loggedOn) + { + $smarty->assign('loggedin', true); + + if (isset($_POST['currentDir'])) + { + if (!@ftp_chdir($connection, html_entity_decode($_POST['currentDir']))) + { + $smarty->assign('errormessage', sprintf(_('Directory change to \'%1$s\' failed!'), $file)); + } + } + elseif (isset($_GET['currentDir'])) + { + if(!@ftp_chdir($connection, html_entity_decode($_GET['currentDir']))) + { + $smarty->assign('errormessage', sprintf(_('Directory change to \'%1$s\' failed!'), $file)); + } + } + + $currentDir = htmlentities(str_replace("\"\"","\"", ftp_pwd($connection))); + + $smarty->assign('currentDir', $currentDir); + $smarty->assign('curdir', sprintf(_('current folder = [%1$s]'), $currentDir)); + + // was soll gemacht werden + $errormessage = ''; + $successmessage = ''; + switch ($action) + { + case "cd": // Ordner wechseln + //First try : normal directory + if(@ftp_chdir($connection, html_entity_decode($currentDir) . "/" . html_entity_decode($file))) + { + $currentDir = htmlentities(str_replace("\"\"","\"", @ftp_pwd($connection))); + $smarty->assign('curdir', sprintf(_('current folder = [%1$s]'), $currentDir)); + $smarty->assign('currentDir', $currentDir); + } + elseif(@ftp_chdir($connection, html_entity_decode($file))) + { // symbolischer Link + $currentDir = htmlentities(str_replace("\"\"","\"", @ftp_pwd($connection))); + $smarty->assign('curdir', sprintf(_('current folder = [%1$s]'), $currentDir)); + $smarty->assign('currentDir', $currentDir); + } + else + { // link zu einer Datei, abrufen... + header("Content-disposition: filename=$file"); + header("Content-type: application/octetstream"); + header("Pragma: no-cache"); + header("Expires: 0"); + + // original Dateiname + $filearray = explode("/",$file); + $file = $filearray[sizeof($filearray)-1]; + $msg = $file; + + // Datei vom FTP temporär speichern + $fp = fopen($downloadDir . killslashes(html_entity_decode($file))."_".$s, "w"); + if($mode == "FTP_ASCII") + { + $downloadStatus = @ftp_fget($connection,$fp, html_entity_decode($file),FTP_ASCII); + } + elseif($mode == "FTP_BINARY") + { + $downloadStatus = @ftp_fget($connection,$fp, html_entity_decode($file),FTP_BINARY); + } + + if(!$downloadStatus) + { + fclose($fp); + exit; + } + fclose($fp); + // temporäre Datei lesen und ausgeben + $data = file($downloadDir . killslashes(html_entity_decode($file))."_".$s); + /*$i=0; + while ($data[$i] != ""){ + echo $data[$i]; + $i++; + }*/ + foreach($data as $outData) + { + echo $outData; + } + unlink($downloadDir . killslashes(html_entity_decode($file))."_".$s); + exit; + } + break; + case "cddirect": + if(@ftp_chdir($connection, $file)) + { + $currentDir = htmlentities(str_replace("\"\"","\"",@ftp_pwd($connection))); + $smarty->assign('curdir', sprintf(_('current folder = [%1$s]'), $currentDir)); + } + else + { + $errormessage = sprintf(_('Directory change to \'%1$s\' failed!'), $file); + } + break; + case "get": // Datei dwonload + header("Content-disposition: filename=".killslashes(html_entity_decode($file))); + header("Content-type: application/octetstream"); + header("Pragma: no-cache"); + header("Expires: 0"); + // Datei vom FTP temporär speichern + $fp = fopen($downloadDir . killslashes(html_entity_decode($file))."_".$s, "w"); + if($mode == "FTP_ASCII") + { + $downloadStatus = ftp_fget($connection,$fp, html_entity_decode($file),FTP_ASCII); + } + elseif($mode == "FTP_BINARY") + { + $downloadStatus = ftp_fget($connection,$fp, html_entity_decode($file),FTP_BINARY); + } + fclose($fp); + + // temporäre Datei lesen und ausgeben + $data = file($downloadDir . killslashes(html_entity_decode($file))."_".$s); + //print_r($data); + /*$i=0; + while ($data[$i] != "") + { + echo $data[$i]; + $i++; + }*/ + foreach($data as $outData) + { + echo $outData; + } + unlink($downloadDir . killslashes(html_entity_decode($file))."_".$s); + exit; + break; + case "put": // Datei hochladen + foreach($_FILES as $myFile => $dummyvar) + { + if(file_exists($_FILES[$myFile]['tmp_name']) && ($_FILES[$myFile]['size'] > $MAX_FILE_SIZE && $MAX_FILE_SIZE!=0)) + { + $errormessage .= sprintf(_('File \'%1$s\' is to big! (max. %2$u bytes)
'), $_FILES[$myFile]['name'], $MAX_FILE_SIZE); + } + elseif(file_exists($_FILES[$myFile]['tmp_name'])) + { + if($mode == "FTP_ASCII") + { + $uploadStatus = ftp_put($connection, html_entity_decode($currentDir) . "/" . $_FILES[$myFile]['name'], $_FILES[$myFile]['tmp_name'], FTP_ASCII); + } + elseif($mode == "FTP_BINARY") + { + $uploadStatus = ftp_put($connection, html_entity_decode($currentDir) . "/" . $_FILES[$myFile]['name'], $_FILES[$myFile]['tmp_name'], FTP_BINARY); + } + + if(!$uploadStatus) + { + $errormessage .= sprintf(_('
File \'%1$s\' couldn\'t be uploaded!'), $_FILES[$myFile]['name']); + } + else + { + $successmessage .= sprintf(_('
File \'%1$s\' was successfully uploaded!'), $_FILES[$myFile]['name']); + } + + unlink($_FILES[$myFile]['tmp_name']); + } + } + break; + case "deldir": // Ordner löschen + if(ftp_rmdir($connection, html_entity_decode($file))) + { + $successmessage = sprintf(_('
Directory \'%1$s\' deleted!'), $file); + } + else + { + $errormessage = sprintf(_('
Directory \'%1$s\' couldn\'t be deleted!'), $file); + } + break; + case "delfile": // Datei löschen + if (@ftp_delete($connection, $file)) + { + $successmessage = sprintf(_('
\'%1$s\' deleted!'), $file); + } + else + { + $errormessage = sprintf(_('
\'%1$s\' couldn\'t be deleted!'), $file); + } + break; + case "rename": // Datei umbennenen + if($_POST['op']=="do") + { + if (@ftp_rename($connection, $file, $_POST['file2'])) + { + $successmessage = sprintf(_('\'%1$s\' renamed to \'%2$s\''), $file, $_POST['file2']); + } + else + { + $errormessage = sprintf(_('\'%1$s\' couldn\'t be renamed to \'%2$s\'!'), $file, $_POST['file2']); + } + } + elseif($_GET['op']=="show") + { + $smarty->assign('rename_text', sprintf(_('File \'%1$s\' rename/move to'), $file)); + } + break; + case "createdir": // neuen Ordner erstellen + if(@ftp_mkdir($connection, $file)) + { + $successmessage = sprintf(_('Directory \'%1$s\' created'), $file); + } + else + { + $errormessage = sprintf(_('Directory \'%1$s\' couldn\'t be created!'), $file); + } + break; + case "chmod": // Berechtigungen setzen + $wrongchmod = false; + $split = preg_split('//', $_POST['file2'], -1, PREG_SPLIT_NO_EMPTY); + foreach($split as $char) + { + if ($char < 0 || $char > 7) + { + $wrongchmod = true; + } + } + if ($wrongchmod || strlen($_POST['chmod']) > 3) + { + $errormessage = sprintf(_('
The permission \'%1$s\' you entered is not valid!'), $_POST['file2']); + } + else + { + $command = "chmod {$_POST['file2']} {$_POST['file']}"; + if(!$wrongchmod && ftp_site($connection,$command)) + { + $successmessage = sprintf(_('
The permission of \'%1$s\' is set to \'%2$s\'!'), $file, $_POST['file2']); + } + else + { + $errormessage = sprintf(_('
The permission of \'%1$s\' couldn\'t be set to \'%2$s\'!'), $file, $_POST['file2']); + } + } + break; + case "multiple": // merhfachaktionen + if(isset($_POST['yes']) && $_POST['yes']!="" && !isset($_POST['no'])) + { + if ($_POST['op']=="chmod") + { + $wrongchmod = false; + $split = preg_split('//', $_POST['chmod'], -1, PREG_SPLIT_NO_EMPTY); + foreach($split as $char) + { + if($char<0||$char>7) + { + $wrongchmod = true; + } + } + if($wrongchmod || strlen($_POST['chmod'])>3) + { + $errormessage .= sprintf(_('
The permission \'%1$s\' you entered is not valid!'), $_POST['file2']); + } + else + { + if(is_array($file)) + { + foreach ($file as $myID => $myName) + { + $command = "chmod $_POST[chmod] ".$myName; + if (ftp_site($connection,$command)) + { + $successmessage .= sprintf(_('
The permission of \'%1$s\' is set to \'%2$s\'!'), $myName, $_POST['chmod']); + } + else + { + $errormessage .= sprintf(_('
The permission of \'%1$s\' couldn\'t be set to \'%2$s\'!'), $myName, $_POST['chmod']); + } + } + } + } + } + elseif($_POST['op']=="delete") + { + if(is_array($file)) + { + foreach ($file as $myID => $myName) + { + if(ftp_chdir($connection, $myName)) + { + ftp_chdir($connection, html_entity_decode($currentDir)); + $del_status = ftp_rmdir($connection, html_entity_decode($myName)); + } + else + { + ftp_chdir($connection, html_entity_decode($currentDir)); + $del_status = ftp_delete($connection, $myName); + } + + if($del_status) + { + $successmessage .= sprintf(_('
\'%1$s\' deleted!'), $myName); + } + else + { + $errormessage .= sprintf(_('
\'%1$s\' couldn\'t be deleted!'), $myName); + } + } + } + } + elseif($_POST['op']=="move") + { + if(ftp_chdir($connection, $_POST['move_to'])) + { + ftp_chdir($connection, html_entity_decode($currentDir)); + if(substr($_POST['move_to'],-1)!="/") + { + $_POST['move_to'] .= "/"; + } + if(is_array($file)) + { + foreach ($file as $myID => $myName) + { + if(ftp_rename($connection, $myName,$_POST['move_to'].$myName)) + { + $successmessage .= sprintf(_('
File \'%1$s\' moved'), $myName); + } + else + { + $errormessage .= sprintf(_('
File \'%1$s\' couldn\'t be moved'), $myName); + } + } + } + } + else + { + $errormessage = sprintf(_('The directory \'%1$s\' doesn\'t exist'), $_POST['move_to']); + } + } + } + break; + case "edit": + $extarray = explode(".", $file); + $extension = $extarray[sizeof($extarray)-1]; + $editAble = false; + foreach($editFileExtensions as $regex) + { + if(preg_match("/$regex/i", $extension)) + { + $editAble = true; + break; + } + } + if($extension == $file && $editFileNoExtension) + { + $editAble = true; + } + + if($editAble) + { + if ((isset($_GET['op']) && $_GET['op'] == "open") || (isset($_POST['op']) && $_POST['op'] == "open")) + {//datei auslesen und im Browser anzeigen + // original Dateiname + $filearray = explode("/",$file); + $file = $filearray[sizeof($filearray)-1]; + + // Datei vom FTP temporär speichern + $fp = fopen($downloadDir . killslashes(html_entity_decode($file)) . "_" . $s, "w"); + if($mode == "FTP_BINARY") + { + $downloadStatus = ftp_fget($connection, $fp, html_entity_decode($file),FTP_BINARY); + } + else + { + $downloadStatus = ftp_fget($connection, $fp, html_entity_decode($file),FTP_ASCII); + } + + if(!$downloadStatus) + { + fclose($fp); + $errormessage = sprintf(_('File \'%1$s\' couldn\'t be downloaded!'), $file); + $myFileContent = ''; + } + else + { + fclose($fp); + // temporäre Datei lesen und ausgeben + $myFileContent = htmlentities(implode("",file($downloadDir . killslashes(html_entity_decode($file))."_".$s))); + } + $smarty->assign('myFileContent', $myFileContent); + unlink($downloadDir . killslashes(html_entity_decode($file))."_".$s); + } + elseif ((isset($_GET['op']) && $_GET['op'] == "save") || (isset($_POST['op']) && $_POST['op'] == "save")) + {// datei speichern + $fp = fopen($downloadDir . killslashes(html_entity_decode($file))."_".$s, "w"); + if ((isset($_GET['op']) && $_GET['op'] != "new") && (isset($_POST['op']) && $_POST['op'] != "new")) + { + fputs($fp, $_POST['fileContent'], strlen($_POST['fileContent'])); + } + else + { + fputs($fp, html_entity_decode($_POST['fileContent']), strlen(html_entity_decode($_POST['fileContent']))); + } + fclose($fp); + + $uploadStatus = false; + if($mode == "FTP_BINARY") + { + $uploadStatus = ftp_put($connection, html_entity_decode($currentDir). "/" . html_entity_decode($file), $downloadDir . killslashes(html_entity_decode($file))."_".$s, FTP_BINARY); + } + else + { + $uploadStatus = ftp_put($connection, html_entity_decode($currentDir). "/" . html_entity_decode($file), $downloadDir . killslashes(html_entity_decode($file))."_".$s, FTP_ASCII); + } + + if(!$uploadStatus) + { + $errormessage = sprintf(_('File \'%1$s\' couldn\'t be saved!'), $file); + } + else + { + $successmessage = sprintf(_('File \'%1$s\' was saved succesfully!'), $file); + } + unlink($downloadDir . killslashes(html_entity_decode($file))."_".$s); + } + } + else + { + $errormessage = sprintf(_('Files with these extension can\'t be created/edited!'), $file); + } + + if((isset($_GET['op']) && $_GET['op'] != "new") && (isset($_POST['op']) && $_POST['op'] != "new")) + { + if($file == "") + { + $editAble = false; + $errormessage = _('Please enter a filename!'); + } + } + break; + case "mode": + if($_GET['mode'] == "FTP_BINARY") + { + $mode = "FTP_BINARY"; + $_SESSION['mode'] = "FTP_BINARY"; + } + else + { + $mode = "FTP_ASCII"; + $_SESSION['mode'] = "FTP_ASCII"; + } + $smarty->assign('mode', $mode); + break; + } + + if (strlen($errormessage) > 0) + { + $smarty->assign('errormessage', $errormessage); + } + if (strlen($successmessage) > 0) + { + $smarty->assign('successmessage', $successmessage); + } + + if ($action == "edit" && ((isset($_GET['op']) && $_GET['op'] == "open") || (isset($_POST['op']) && $_POST['op'] == "open"))) + { + $file = htmlentities($file); + $smarty->assign('file', $file); + $body = $smarty->fetch('webftp/webftp_edit.tpl'); + } + elseif ($action == "edit" && ((isset($_GET['op']) && $_GET['op'] == "new") || (isset($_POST['op']) && $_POST['op'] == "new"))) + { + $file = htmlentities($file); + $smarty->assign('file', $file); + $body = $smarty->fetch('webftp/webftp_edit_new.tpl'); + } + else + { + $list = Array(); + $list = ftp_rawlist($connection, "-a ./"); + + $countArray = array("dir" => 0, "dirsize" => 0, "file" => 0, "filesize" => 0, "link" => 0); + $list = parse_ftp_rawlist($list, $systype); + if (!isset($file)) + { + $file = ""; + } + if (is_array($list)) + { + // Ordner + $output_dir = ''; + foreach($list as $myDir) + { + if ($myDir["is_dir"] == 1) + { + $countArray['dir']++; + $countArray['dirsize'] += $myDir['size']; + $fileAction = "cd"; + $fileName = $myDir["name"]; + if(is_array($file) && val_in_array($fileName, $file)) + { + $smarty->assign('checked', 'checked'); + $smarty->assign('checked_color', "bgcolor=\"".$marked_color."\""); + } + else + { + $smarty->assign('checked', ""); + $smarty->assign('checked_color', ""); + } + $smarty->assign('myDir', $myDir); + $output_dir .= $smarty->fetch('webftp/webftp_main_dir_row.tpl'); + } + } + + // Links + $output_link = ''; + foreach($list as $myDir) + { + if ($myDir["is_link"] == 1) + { + $countArray['link']++; + $fileAction = "cd"; + $fileName = $myDir["target"]; + if (is_array($file) && val_in_array($fileName, $file)) + { + $smarty->assign('checked', 'checked'); + $smarty->assign('checked_color', "bgcolor=\"".$marked_color."\""); + } + else + { + $smarty->assign('checked', ""); + $smarty->assign('checked_color', ""); + } + $smarty->assign('myDir', $myDir); + $output_link .= $smarty->fetch('webftp/webftp_main_link_row.tpl'); + } + } + + // Dateien + $output_file = ''; + foreach($list as $myDir) + { + if ($myDir["is_link"] != 1 && $myDir["is_dir"] != 1) + { + $countArray['file']++; + $countArray['filesize'] += $myDir['size']; + $fileAction = "get"; + $fileName = $myDir["name"]; + if (is_array($file) && val_in_array($fileName, $file)) + { + $smarty->assign('checked', 'checked'); + $smarty->assign('checked_color', "bgcolor=\"".$marked_color."\""); + } + else + { + $smarty->assign('checked', ""); + $smarty->assign('checked_color', ""); + } + // prüfen ob die datei bearbeitbar ist + $extarray = explode(".",$fileName); + $extension = $extarray[sizeof($extarray)-1]; + $smarty->assign('editable', false); + foreach($editFileExtensions as $regex) + { + if(preg_match("/$regex/i", $extension)) + { + $smarty->assign('editable', true); + break; + } + } + if($extension == $fileName && $editFileNoExtension) + { + $smarty->assign('editable', true); + } + $smarty->assign('myDir', $myDir); + $output_file .= $smarty->fetch('webftp/webftp_main_file_row.tpl'); + } + } + } + + if(!is_array($file)) + { + $file = htmlentities($file); + $smarty->assign('file', $file); + } + + $smarty->assign('connected_to', sprintf(_('Connected to %1$s'), $_SESSION['server'])); + + $body = $smarty->fetch('webftp/webftp_main_header.tpl'); + $body .= $smarty->fetch('webftp/webftp_main_additional.tpl'); + + if($action == "rename" && $_GET['op']=="show") + { + $body .= $smarty->fetch('webftp/webftp_main_rename'); + } + $smarty->assign('output_dir', $output_dir); + $smarty->assign('output_link', $output_link); + $smarty->assign('output_file', $output_file); + $smarty->assign('countArray', $countArray); + $body .= $smarty->fetch('webftp/webftp_main.tpl'); + + if ($action == "multiple" && (!isset($_POST['yes']) || $_POST['yes']=="") && (!isset($_POST['no']) || $_POST['no']=="")) + { + if($_POST['op']=="delete") + { + $smarty->assign('action_text', _('Do you really want to delete the selected files?')); + } + elseif($_POST['op']=="move") + { + $smarty->assign('action_text', sprintf(_('Do you really want to move the selected files to \'%1$s\'?'), $_POST['move_to'])); + $smarty->assign('move_to', $_POST['move_to']); + } + elseif($_POST['op']=="chmod") + { + $smarty->assign('action_text', sprintf(_('Do you really want to set the permission of the selected files to \'%1$s\'?'), $_POST['chmod'])); + $smarty->assign('chmod', $_POST['chmod']); + } + $smarty->assign('op', $_POST['op']); + $body .= $smarty->fetch('webftp/webftp_main_prompt'); + } + else + { + $body .= $smarty->fetch('webftp/webftp_main_multiple.tpl'); + } + } + $smarty->assign('completeLink', '' . _('Logout') . ''); + $navlinks = $smarty->fetch('navigation_link.tpl'); + $smarty->assign('completeLink', '' . _('Switch to BINARY mode') . ''); + $navlinks .= $smarty->fetch('navigation_link.tpl'); + $smarty->assign('completeLink', '' . _('Switch to ASCII mode') . ''); + $navlinks .= $smarty->fetch('navigation_link.tpl'); + $smarty->assign('completeLink', _('Main')); + $smarty->assign('navigation_links', $navlinks); + $smarty->assign('navigation', $smarty->fetch('navigation_element.tpl')); + } + else + { + $body = $smarty->fetch('login/login_ftp.tpl'); + } +} +else +{ + $body = $smarty->fetch('login/login_ftp.tpl'); +} + +$smarty->assign('body', $body); +$smarty->display('index.tpl'); + +/** + * Functions + * This should all be checked if still necessary + */ +function killslashes($input) +{ + return str_replace("\\","",str_replace('\'','',str_replace("\"","",$input))); +} + +function parse_ftp_rawlist($list, $type = "UNIX") +{ + if ($type == "UNIX") + { + $regexp = "/([-ldrswx]{10})[ ]+([0-9]+)[ ]+([-A-Z0-9_]+)[ ]+([-A-Z0-9_]+)[ ]+([0-9]+)[ ]+([A-Z]{3}[ ]+[0-9]{1,2}[ ]+[0-9:]{4,5})[ ]+(.*)/i"; + $i = 0; + foreach ($list as $line) + { + $is_dir = $is_link = FALSE; + if (preg_match($regexp, $line, $regs)) + { + if (!preg_match("/^[\.]{2}/i", $regs[7]) && $regs[7]!=".") + { + $i++; + if (preg_match("/^[d]/i", $regs[1])) + { + $is_dir = TRUE; + } + elseif (preg_match("/^[l]/i", $regs[1])) + { + $is_link = TRUE; + list($regs[7], $target) = explode(" -> ", $regs[7]); + } + $files[$i] = array ( + "is_dir" => $is_dir, + "name" => htmlentities($regs[7]), + "perms" => $regs[1], + "num" => $regs[2], + "user" => $regs[3], + "group" => $regs[4], + "size" => $regs[5], + "date" => $regs[6], + "is_link" => $is_link, + ); + if (isset($target)) + { + $files[$i]['target'] = $target; + unset ($target); + } + } + } + } + } + else + { + $regexp = "/([0-9\-]{8})[ ]+([0-9:]{5}[APM]{2})[ ]+([0-9|]+)[ ]+(.*)/i"; + foreach ($list as $line) + { + $is_dir = false; + //print $line . "
\n"; + if (preg_match($regexp, $line, $regs)) + { + if (!preg_match("/^[.]/i", $regs[4])) + { + if($regs[3] == "") + { + $is_dir = true; + $regs[3] = ''; + } + $i++; + $files[$i] = array ( + "is_dir" => $is_dir, + "name" => htmlentities($regs[4]), + "date" => $regs[1], + "time" => $regs[2], + "size" => $regs[3], + "is_link" => 0, + "target" => "", + "num" => "" + ); + } + } + } + } + + if ( is_array($files) AND count($files) > 0) + { + asort($files); + //natcasesort($files); + reset($files); + } + return $files; +} \ No newline at end of file