Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3afa555
Catalan translation added
Jun 1, 2016
9d7b4d4
Merge pull request #47 from fercavi/master
marekrei Jul 2, 2016
ec5b1e0
Update Greek translation
ChriZathens Nov 3, 2016
310ff8c
French translation update
Taz8du29 Nov 26, 2016
187a941
Updated French translation
Taz8du29 Nov 26, 2016
806ba85
Merge pull request #58 from Taz8du29/master
marekrei Mar 12, 2017
85ac018
Merge pull request #56 from ChriZathens/ChriZathens-patch-1
marekrei Mar 12, 2017
043827f
Updated readme
marekrei Mar 5, 2018
13f8ca1
Make links downloadable
JonnyTech Mar 11, 2019
140a178
Greek language minor fixes
ChriZathens Apr 11, 2019
fce9d1b
Translations for Lituanian added
isness Dec 31, 2019
a68bcaa
Removed call to get_magic_quotes_gpc as it is not deprecated
marekrei Jan 3, 2024
4a61f3e
Merge pull request #75 from ChriZathens/patch-2
marekrei Jan 3, 2024
3c8d770
Merge pull request #79 from isness/lithuanian-lang
marekrei Jan 3, 2024
16ca7c9
Merge pull request #74 from JonnyTech/patch-1
marekrei Jan 3, 2024
2454548
Changing documentation message for force downloading
marekrei Jan 3, 2024
7c9d58d
Switching to natural comparison when comparing strings
marekrei Jan 3, 2024
c59b3ec
Switching to natural case-insensitive comparison when comparing strings
marekrei Jan 3, 2024
d017794
Updating version to 6.4.2
marekrei Jan 3, 2024
1807c61
Updating readme
marekrei Jan 3, 2024
50dc54e
Adding check for thumbnail location
marekrei Dec 2, 2024
2ac0908
Fixing missing global config variable
marekrei Dec 2, 2024
8fd2ed6
Fixing whitespace differences
marekrei Dec 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ License
----------------------------------
This software is distributed under The MIT License (MIT).

Copyright (c) 2015 Marek Rei
Copyright (c) 2023 Marek Rei

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
172 changes: 130 additions & 42 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Encode Explorer
*
* Author : Marek Rei (marek ät marekrei dot com)
* Version : 6.4.1
* Version : 6.4.2
* Homepage : encode-explorer.siineiolekala.net
*
*
Expand Down Expand Up @@ -73,6 +73,12 @@
//
$_CONFIG['open_in_new_window'] = false;

//
// When clicking on files, will the files be downloaded rather than opened? true/false
// Default: $_CONFIG['force_download'] = false;
//
$_CONFIG['force_download'] = false;

//
// How deep in subfolders will the script search for files?
// Set it larger than 0 to display the total used space.
Expand Down Expand Up @@ -341,6 +347,25 @@
"del" => "Изтриване",
"log_out" => "Изход"
);
//Catalan
$_TRANSLATIONS["ca"] = array(
"file_name" => "Nom d'arxiu",
"size" => "Mida",
"last_changed" => "Última modificació",
"total_used_space" => "Total espai emprat",
"free_space" => "Espai lliure",
"password" => "Paraula de pass",
"upload" => "Pujar arxiu",
"failed_upload" => "Error al pujar l'arxiu!",
"failed_move" => "Error al moure l'arxiu al directori seleccionat!",
"wrong_password" => "Paraula de pas incorrecta",
"make_directory" => "Crear directori",
"new_dir_failed" => "Error al crear el directori",
"chmod_dir_failed" => "Error al canviar els permisos del directori",
"unable_to_read_dir" => "No es possible llegir el directori",
"location" => "Traducció",
"root" => "Arrel"
);

// Czech
$_TRANSLATIONS["cz"] = array(
Expand Down Expand Up @@ -494,32 +519,32 @@
$_TRANSLATIONS["fr"] = array(
"file_name" => "Nom de fichier",
"size" => "Taille",
"last_changed" => "Ajouté",
"total_used_space" => "Espace total utilisé",
"last_changed" => "Modifié le",
"total_used_space" => "Espace total utilisé",
"free_space" => "Espace libre",
"password" => "Mot de passe",
"upload" => "Envoyer un fichier",
"upload" => "Ajouter",
"failed_upload" => "Erreur lors de l'envoi",
"failed_move" => "Erreur lors du changement de dossier",
"wrong_password" => "Mauvais mot de passe",
"failed_move" => "Erreur lors du déplacement",
"wrong_password" => "Identifiant ou mot de passe incorrect",
"make_directory" => "Nouveau dossier",
"new_dir_failed" => "Erreur lors de la création du dossier",
"new_dir_failed" => "Erreur lors de la création du dossier",
"chmod_dir_failed" => "Impossible de changer les permissions du dossier",
"unable_to_read_dir" => "Impossible de lire le dossier",
"location" => "Localisation",
"root" => "Racine",
"log_file_permission_error" => "Le script ne possède pas les permissions pour écrire un fichier d'enregistrement.",
"upload_not_allowed" => "La configuration actuelle ne permet de déposer un fichier dans ce dossier.",
"upload_dir_not_writable" => "Ce dossier ne possède pas les permissions en écriture.",
"mobile_version" => "Vue mobile",
"standard_version" => "Vue standard",
"log_file_permission_error" => "Le script n'a pas la permission d'écrire dans le fichier de logs.",
"upload_not_allowed" => "La configuration du script ne permet pas d'ajouter un fichier ici.",
"upload_dir_not_writable" => "Ce dossier ne possède pas de permission en écriture.",
"mobile_version" => "Version mobile",
"standard_version" => "Version standard",
"page_load_time" => "Page chargée en %.2f ms",
"wrong_pass" => "Identifiant ou mot de passe incorrect",
"username" => "Identifiant",
"log_in" => "Connexion",
"upload_type_not_allowed" => "Ce format de fichier n'est pas autorisé.",
"del" => "Effacer",
"log_out" => "Déconnexion"
"upload_type_not_allowed" => "L'envoi de ce type de fichier n'est pas permis.",
"del" => "Supprimer",
"log_out" => "Déconnexion"
);

// German
Expand Down Expand Up @@ -558,20 +583,33 @@
$_TRANSLATIONS["el"] = array(
"file_name" => "Όνομα αρχείου",
"size" => "Μέγεθος",
"last_changed" => "Τροποποιημένο",
"last_changed" => "Τελευταία τροποποίηση",
"total_used_space" => "Χρησιμοποιημένος χώρος",
"free_space" => "Ελεύθερος χώρος",
"password" => "Εισάγεται κωδικό",
"password" => "Κωδικός",
"upload" => "Φόρτωση",
"failed_upload" => "Αποτυχία φόρτωσης αρχείου!",
"failed_move" => "Αποτυχία μεταφοράς αρχείου στον κατάλληλο φάκελο!",
"wrong_password" => "Λάθος κωδικός",
"make_directory" => "Δημιουργία νέου φακέλου",
"new_dir_failed" => "Αποτυχία δημιουργίας νέου φακέλου",
"make_directory" => "Νέος Φάκελος",
"new_dir_failed" => "Αποτυχία δημιουργίας φακέλου",
"chmod_dir_failed" => "Αποτυχία τροποποίησης δικαιωμάτων φακέλου",
"unable_to_read_dir" => "Unable to read directory",
"location" => "Location",
"root" => "Root"
"unable_to_read_dir" => "Αδυναμία ανάγνωσης φακέλου",
"location" => "Τοποθεσία",
"root" => "Ριζικός φάκελος",
"log_file_permission_error" => "Το πρόγραμμα δεν έχει δικαιώματα εγγραφής στο αρχείο καταγραφής.",
"upload_not_allowed" => "Οι ρυθμίσεις του προγράμματος δεν επιτρέπουν φόρτωση αρχείων σε αυτό τον φάκελο.",
"upload_dir_not_writable" => "Αυτός ο φάκελος δεν έχει δικαιώματα για εγγραφή.",
"mobile_version" => "Φορητή προβολή",
"standard_version" => "Τυπική προβολή",
"page_load_time" => "Η σελίδα φορτώθηκε σε %.2f ms",
"wrong_pass" => "Λάθος όνομα χρήστη ή κωδικός πρόσβασης",
"username" => "Όνομα χρήστη",
"log_in" => "Σύνδεση",
"upload_type_not_allowed" => "Αυτός ο τύπος αρχείου δεν επιτρέπεται να φορτωθεί.",
"del" => "Διαγραφή",
"log_out" => "Αποσύνδεση"

);

// Spanish
Expand Down Expand Up @@ -732,6 +770,38 @@
"log_out" => "로그아웃"
);

// Lithuanian
$_TRANSLATIONS["lt"] = array(
"file_name" => "Pavadinimas",
"size" => "Dydis",
"last_changed" => "Paskutiniai pakeitimai",
"total_used_space" => "Visa naudojama vieta",
"free_space" => "Laisva vieta",
"password" => "Slaptažodis",
"upload" => "Įkelti",
"failed_upload" => "Įkėlimas nepavyko",
"failed_move" => "Failo perkėlimas nepavyko",
"wrong_password" => "Klaidingas slaptažodis",
"make_directory" => "Kurti aplanką",
"new_dir_failed" => "Aplanko sukurti nepavyko",
"chmod_dir_failed" => "Privilegijų keitimas nepavyko",
"unable_to_read_dir" => "Nepavyko atverti aplanko",
"location" => "Vieta",
"root" => "Šakninis",
"log_file_permission_error" => "Šis skriptas neturi teisių rašyti log failo.",
"upload_not_allowed" => "Šis skriptas neleidžia failų įklimo į šį aplanką.",
"upload_dir_not_writable" => "Neturite teisių rašyti į šį aplanką.",
"mobile_version" => "Versija mobiliesiems",
"standard_version" => "Paprasta versija",
"page_load_time" => "Puslapis įkeltas per %.2f ms",
"wrong_pass" => "Klaidingas vartotojo vardas ar slaptažodis",
"username" => "Vartotojo vardas",
"log_in" => "Prisijungti",
"upload_type_not_allowed" => "Šio tipo failų įkelti negalima.",
"del" => "Trinti", // short for Delete
"log_out" => "Atsijungti"
);

// Norwegian
$_TRANSLATIONS["no"] = array(
"file_name" => "Navn",
Expand Down Expand Up @@ -1758,6 +1828,9 @@ public static function openPdf($file)
if(!ImageServer::isEnabledPdf())
return null;

if(!ImageServer::isAllowedToOpenPath($file))
return null;

$im = new Imagick($file.'[0]');
$im->setImageFormat( "png" );
$str = $im->getImageBlob();
Expand Down Expand Up @@ -1845,30 +1918,43 @@ public static function showThumbnail($file)
imagepng($image);
}
}

public static function isAllowedToOpenPath($file)
{
global $_CONFIG;
if(realpath($file) && str_starts_with(realpath($file), realpath($_CONFIG['starting_dir'])))
return true;
return false;
}

//
// A helping function for opening different types of image files
//
public static function openImage ($file)
{
$size = getimagesize($file);
switch($size["mime"])
{
case "image/jpeg":
$im = imagecreatefromjpeg($file);
break;
case "image/gif":
$im = imagecreatefromgif($file);
break;
case "image/png":
$im = imagecreatefrompng($file);
break;
default:
$im=null;
break;
}
if(!ImageServer::isAllowedToOpenPath($file))
return null;

$im = null;
$size = getimagesize($file);
switch($size["mime"])
{
case "image/jpeg":
$im = imagecreatefromjpeg($file);
break;
case "image/gif":
$im = imagecreatefromgif($file);
break;
case "image/png":
$im = imagecreatefrompng($file);
break;
default:
$im = null;
break;
}
return $im;
}

}

//
Expand Down Expand Up @@ -2131,8 +2217,6 @@ function uploadFile($location, $userfile)
{
global $encodeExplorer;
$name = basename($userfile['name']);
if(get_magic_quotes_gpc())
$name = stripslashes($name);

$upload_dir = $location->getFullPath();
$upload_file = $upload_dir . $name;
Expand Down Expand Up @@ -2809,7 +2893,7 @@ function debug()

public static function cmp_name($a, $b)
{
return strcasecmp($a->name, $b->name);
return strnatcasecmp($a->name, $b->name);
}

public static function cmp_size($a, $b)
Expand Down Expand Up @@ -3137,7 +3221,11 @@ function(){
print " class=\"item file";
if($file->isValidForThumb())
print " thumb";
print "\">";
print "\"";
print " ".EncodeExplorer::getConfig('force_download');
if(EncodeExplorer::getConfig('force_download') == true)
print " download";
print ">";
print $file->getNameHtml();
if($this->mobile == true)
{
Expand Down