diff --git a/images/Froxlor/icons/file.gif b/images/Froxlor/icons/file.gif new file mode 100644 index 00000000..976fd11b Binary files /dev/null and b/images/Froxlor/icons/file.gif differ diff --git a/images/Froxlor/icons/folder.gif b/images/Froxlor/icons/folder.gif new file mode 100644 index 00000000..648dfcd9 Binary files /dev/null and b/images/Froxlor/icons/folder.gif differ diff --git a/images/Froxlor/icons/link.gif b/images/Froxlor/icons/link.gif new file mode 100644 index 00000000..7640489a Binary files /dev/null and b/images/Froxlor/icons/link.gif differ diff --git a/images/Froxlor/icons/parent.gif b/images/Froxlor/icons/parent.gif new file mode 100644 index 00000000..33ad0253 Binary files /dev/null and b/images/Froxlor/icons/parent.gif differ diff --git a/images/Froxlor/icons/rename.gif b/images/Froxlor/icons/rename.gif new file mode 100644 index 00000000..eb0971f0 Binary files /dev/null and b/images/Froxlor/icons/rename.gif differ diff --git a/locales/de/LC_MESSAGES/default.mo b/locales/de/LC_MESSAGES/default.mo new file mode 100644 index 00000000..0ae70eb2 Binary files /dev/null and b/locales/de/LC_MESSAGES/default.mo differ diff --git a/locales/de/LC_MESSAGES/default.po b/locales/de/LC_MESSAGES/default.po new file mode 100644 index 00000000..9353ebed --- /dev/null +++ b/locales/de/LC_MESSAGES/default.po @@ -0,0 +1,357 @@ +msgid "" +msgstr "" +"Project-Id-Version: Froxlor\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2011-06-23 10:05+0100\n" +"PO-Revision-Date: 2011-06-23 10:11+0100\n" +"Last-Translator: Florian Aders \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