- Mod gallery if images
- Passowrd for access
- Delete after first access OR define nb access (10, 20...)
- Bug Fix :
  - BUG day / days
  - BUG my files no work in html page
  - BUG delete file, but already in storage
- MyFiles Rewrite
This commit is contained in:
Root srvweb 2019-12-05 15:30:19 +01:00
parent cd2271ddcf
commit f9d7fac852
19 changed files with 754 additions and 209 deletions

View file

@ -1,15 +1,22 @@
Options -Indexes +FollowSymLinks -SymLinksIfOwnerMatch
RewriteEngine on
## Sécurité
RewriteRule ^([0-9]+-[0-9]{1,2})/.key-[0-9]{12}$ /index.php?action=403
RewriteRule ^files/([0-9]+-[0-9]{1,2})/.key-[0-9]{12} /index.php?action=403
#RewriteRule ^files/([0-9]+-[0-9]{1,2})/.key-[0-9]{12} /index.php?action=403
RewriteRule ^files/(.+) /index.php?action=403
RewriteRule ^(.+).key-[0-9]{12}$ /index.php?action=403
RewriteRule ^(.+).cfg$ /index.php?action=403
RewriteRule ^config.yaml$ index.php?action=403
RewriteRule ^cron.php$ index.php?action=403
## Rewrite
## Font pour lightgallery
RewriteRule ^fonts/(.+)$ lib/fonts/$1 [L]
## Rewrite app
# direct
RewriteRule ^([0-9]+-[0-9]{1,2})/(.+)$ files/$1/$2 [L]
RewriteRule ^([0-9]+-[0-9]{1,2})/(.+)$ index.php?action=read&id=$1&file=$2 [L]
# html page
RewriteRule ^gallery/([0-9]+-[0-9]{1,2})/ index.php?action=html&id=$1&gallery=1&%{QUERY_STRING} [L]
RewriteRule ^([0-9]+-[0-9]{1,2})/ index.php?action=html&id=$1&%{QUERY_STRING} [L]
# download force
RewriteRule ^dl/([0-9]+-[0-9]{1,2})/(.+)$ index.php?action=dl&id=$1&file=$2 [L]
@ -23,5 +30,7 @@ RewriteRule ^My$ index.php?action=myFiles&%{QUERY_STRING} [L]
# Pages
RewriteRule ^(.+)\.html$ index.php?action=page&name=$1&%{QUERY_STRING} [L]
# Error
RewriteRule ^404$ index.php?action=404
RewriteRule ^403$ index.php?action=403
ErrorDocument 404 /index.php?action=404
ErrorDocument 403 /index.php?action=403

View file

@ -21,7 +21,7 @@ Move config file :
Change paramètre in config.yaml Make sure the consistency between:
- *maxUploadPerFile* is similar to PHP config *upload_max_filesize* and *post_max_size*
- *maxUploadNb* is similar to PHP config *max_file_uploads*
Make sure the "files" directory is writable
### Crontab
@ -33,7 +33,7 @@ By default the expired files this deletes with visits to the homepage. But you c
In config.yaml change
expireCron: web
to
expireCron: cli
@ -41,16 +41,22 @@ to
## Changelog
- futur
- Passowrd for access
- drag and drop for upload
- limit by ip+cookies (sqlite) (limit abuse)
- delete after first access OR define nb access (10, 20...)
- BUG delete file, but already in storage
- BUG "day' / "days"
- crypt files
- Rendre l'upload progress plus jolie
- Ajout de fichier dans un répetoire déjà uploadé
- checkupdate en javascript plutôt
- captcha / anti bot
- "signaler un fichier"
- 0.2
- Mod "gallery" if images
- Passowrd for access
- Delete after first access OR define nb access (10, 20...)
- Bug Fix :
- BUG "day' / "days"
- BUG "my files" no work in html page
- BUG delete file, but already in storage
- MyFiles Rewrite
- 0.1 (16/10/2019)
- Configure with YAML file
- Submit a file upload service with temporary link (Direct link, force download link, download multiple after zip)

View file

@ -23,6 +23,9 @@ imageResize: # Propose resize images
- 1024
- 2048
- 4096
passwordUniqKey: uiphv7olXzvghRanRCxF # get random here : https://www.random.org/strings/?num=1&len=20&digits=on&upperalpha=on&loweralpha=on&unique=on&format=html&rnd=new
passwordTimeRemember: '+2 hours' # https://www.php.net/manual/fr/function.strtotime.php
deleteAfterAccessDefault: 1
imageResizeDefault : 1024
maxUploadPerFile: 30M # Exemple 100K, 30M, 12G
maxUploadTotal: 90M # Exemple 100K, 30M, 12G

494
index.php
View file

@ -1,9 +1,11 @@
<?php
define('VERSION', '0.1');
define('VERSION', '0.2');
if (!is_readable('./config.yaml')) {
exit('Error: The configuration file is not present, move config.yaml.default to config.yaml');
}
$config = yaml_parse_file('./config.yaml');
if (($config = yaml_parse_file('./config.yaml')) == false) {
exit('config.yaml syntax error, check with : http://www.yamllint.com/');
}
include('./lib/functions.php');
if (isset($_GET['id'])){
@ -72,88 +74,123 @@ if (convertHumain2octect($config['maxUploadNb']) > convertHumain2octect(ini_get(
exit(printf(_('In coherence with your configuration (config.yaml) you must increase the PHP configuration max_file_uploads to %s'), $config['maxUploadNb']));
}
// ZIP ou DL
if (isset($_GET['action']) && ($_GET['action'] == 'zip' || $_GET['action'] == 'dl')) {
$uploadDirId=$config['uploadDir'].'/'.$id.'/';
if ($_GET['action'] == 'zip') {
genZip($id);
$filename = $id.'.zip';
$contentType='application/zip';
} elseif ($_GET['action'] == 'dl') {
$filename = $_GET['file'];
$contentType=mime_content_type($uploadDirId.$filename);
}
// HTTP Headers File Downloads
// https://perishablepress.com/press/2010/11/17/http-headers-file-downloads/
// http headers for zip downloads
if (headers_sent()) {
echo 'HTTP header already sent';
} else {
if (!is_file($uploadDirId.$filename)) {
header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found');
echo 'File not found';
} else if (!is_readable($uploadDirId.$filename)) {
header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden');
echo 'File not readable';
} else {
header($_SERVER['SERVER_PROTOCOL'].' 200 OK');
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: ".$contentType);
header("Content-Disposition: attachment; filename=\"".$filename."\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($uploadDirId.$filename));
@readfile($uploadDirId.$filename);
}
}
exit();
// Password
$passwordEnter=false;
if (isset($_POST['password'])) {
//session_start();
setcookie("password".$id,base64_encode($config['passwordUniqKey'].$_POST['password']),strtotime( $config['passwordTimeRemember'] ), '/');
$passwordEnter=base64_encode($config['passwordUniqKey'].$_POST['password']);
} elseif (isset($_COOKIE['password'.$id])) {
$passwordEnter=$_COOKIE['password'.$id];
}
@include_once('./header.php');
// Del
if (isset($_GET['action']) && $_GET['action'] == 'del') {
echo $config['uploadDir'].'/'.$id.'/.key-'.$_GET['key'];
print_r($_GET);
if (! is_file($config['uploadDir'].'/'.$id.'/.key-'.$_GET['key']))
exit('No hack 5 - delete not Unauthorized');
// Si c'est juste un fichier
if (isset($_GET['file'])) {
@unlink($config['uploadDir'].'/'.$id.'/'.$_GET['file']);
@unlink($config['uploadDir'].'/'.$id.'/.'.$_GET['file'].'.small');
// Si c'est le dernire, on supprime le tout
$uploadDirId = $config['uploadDir'].'/'.$id.'/';
$nbFile=0;
foreach (scandir($uploadDirId) as $file) {
if (is_file($uploadDirId.'/'.$file)
&& $file != $id.'.zip'
&& !preg_match('/^.key-[0-9]{12}$/', $file)
&& !preg_match('/^\.(.+)\.small$/', $file)) {
$nbFile++;
$uploadDirId=$config['uploadDir'].'/'.$id.'/';
$passwordInvalid=false;
$passwordForm=false;
if (is_file($uploadDirId.'/.password.cfg') && $passwordEnter != false) {
$countPasswordChar = strlen(base64_decode($passwordEnter))-strlen($config['passwordUniqKey']);
$password = substr(base64_decode($passwordEnter), -$countPasswordChar);
if (password_verify($config['passwordUniqKey'].$password, file_get_contents($uploadDirId.'/.password.cfg'))) {
$passwordForm=false;
} else {
$passwordForm=true;
$passwordInvalid=true;
}
} elseif (is_file($uploadDirId.'/.password.cfg')) {
$passwordForm=true;
}
if ($passwordForm == false) {
// ZIP, READ ou DL
if (isset($_GET['action']) && ($_GET['action'] == 'zip' || $_GET['action'] == 'dl' || $_GET['action'] == 'read')) {
if ($_GET['action'] == 'zip') {
genZip($id);
$filename = $id.'.zip';
$contentType='application/zip';
} elseif ($_GET['action'] == 'dl' || $_GET['action'] == 'read') {
$filename = $_GET['file'];
$contentType=mime_content_type($uploadDirId.$filename);
}
// HTTP Headers File Downloads
// https://perishablepress.com/press/2010/11/17/http-headers-file-downloads/
// http headers for zip downloads
if (headers_sent()) {
echo 'HTTP header already sent';
} else {
if (!is_file($uploadDirId.$filename)) {
header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found');
header('Location: '.$config['baseUrl'].'404');
} else if (!is_readable($uploadDirId.$filename)) {
header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden');
header('Location: '.$config['baseUrl'].'403');
} else {
header($_SERVER['SERVER_PROTOCOL'].' 200 OK');
header("Pragma: public");
if ($_GET['action'] != 'read') {
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=\"".$filename."\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($uploadDirId.$filename));
}
header("Content-Type: ".$contentType);
@readfile($uploadDirId.$filename);
// Access count
if (!preg_match('/^\.(.+)\.small$/', $filename) && is_file($uploadDirId.'/.access.cfg')) {
$nbAccess = file_get_contents($uploadDirId.'/.access.cfg')-1;
file_put_contents($uploadDirId.'/.access.cfg', $nbAccess);
if (! $nbAccess > 0) {
rrmdir($uploadDirId);
}
}
}
}
if ($nbFile == 0) {
rrmdir($config['uploadDir'].'/'.$id.'/');
}
} else {
// Si c'est le dossier
rrmdir($config['uploadDir'].'/'.$id.'/');
$nbFile = 0;
exit();
}
if ($nbFile == 0) {
header('Status: 301 Moved Permanently', false, 301);
header('Location: '.$config['baseUrl']);
} else {
header('Status: 301 Moved Permanently', false, 301);
header('Location: '.$config['baseUrl'].'/'.$id.'/');
}
exit();
}
// Del
if (isset($_GET['action']) && $_GET['action'] == 'del') {
//echo $config['uploadDir'].'/'.$id.'/.key-'.$_GET['key'];
//print_r($_GET);
if (! is_file($config['uploadDir'].'/'.$id.'/.key-'.$_GET['key'].'.cfg'))
exit('No hack 5 - delete not Unauthorized');
// Si c'est juste un fichier
if (isset($_GET['file'])) {
@unlink($config['uploadDir'].'/'.$id.'/'.$_GET['file']);
@unlink($config['uploadDir'].'/'.$id.'/.'.$_GET['file'].'.small');
// Si c'est le dernire, on supprime le tout
$uploadDirId = $config['uploadDir'].'/'.$id.'/';
$nbFile=0;
foreach (scandir($uploadDirId) as $file) {
if (is_file($uploadDirId.'/'.$file)
&& $file != $id.'.zip'
&& !preg_match('/^\.(.+)\.cfg$/', $file)
&& !preg_match('/^\.(.+)\.small$/', $file)) {
$nbFile++;
}
}
if ($nbFile == 0) {
rrmdir($config['uploadDir'].'/'.$id.'/');
}
} else {
// Si c'est le dossier
rrmdir($config['uploadDir'].'/'.$id.'/');
$nbFile = 0;
}
@include_once('./header.php');
if ($nbFile == 0) {
header('Status: 301 Moved Permanently', false, 301);
header('Location: '.$config['baseUrl']);
} else {
header('Status: 301 Moved Permanently', false, 301);
header('Location: '.$config['baseUrl'].'/'.$id.'/');
}
exit();
}
}
@include_once('./header.php');
?>
<!DOCTYPE html>
<html>
@ -176,13 +213,14 @@ if (isset($_GET['action']) && $_GET['action'] == 'del') {
<script src="<?= $config['baseUrl'] ?>lib/upload.js"></script>
<link rel="stylesheet" href="<?= $config['baseUrl'] ?>lib/style.css" />
<link rel="stylesheet" href="<?= $config['baseUrl'] ?>lib/css-file-icons.css" />
<link rel="apple-touch-icon" sizes="180x180" href="<?= $config['baseUrl'] ?>/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="<?= $config['baseUrl'] ?>/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="<?= $config['baseUrl'] ?>/favicon-16x16.png">
<link rel="manifest" href="<?= $config['baseUrl'] ?>/site.webmanifest">
<link rel="stylesheet" href="<?= $config['baseUrl'] ?>lib/jquery-ui.min.css">
<link rel="stylesheet" href="<?= $config['baseUrl'] ?>lib/lightgallery.min.css">
<script src="<?= $config['baseUrl'] ?>lib/jquery-ui.min.js"></script>
<script src="<?= $config['baseUrl'] ?>lib/lightgallery.min.js"></script>
<script>
$( function() {
$( document ).tooltip();
@ -190,9 +228,9 @@ if (isset($_GET['action']) && $_GET['action'] == 'del') {
</script>
</head>
<body>
<div id="langues">
<?php
ksort($lang_ini);
foreach($langueEtLocalDispo as $langShort=>$lang) {
$flag='';
@ -204,8 +242,8 @@ if (isset($_GET['action']) && $_GET['action'] == 'del') {
?>
</div>
<div id="languesLegende" style="display: none"></div>
<div id="page-wrap">
<?php
<div id="page-wrap">
<?php
if ($config['maintenanceMod'] == true && $config['mainteneurIp'] != $_SERVER['REMOTE_ADDR']) {
echo '<h1>'._('Maintenance').'</h2>';
echo '<p>'.$config['maintenanceMsg'].'</p>';
@ -242,8 +280,11 @@ if (isset($_GET['action']) && $_GET['action'] == 'del') {
if (!$config['htmlPages'] && $action == 'page') {
$action = '404';
}
if ($passwordForm == true) {
$action = 'password';
}
$echoNewUpload = '<div class="newUpload"><a href="'.$config['baseUrl'].'" rel="tooltip" class="bulles" title="'._('Send a new file').'"><img src="'.$config['baseUrl'].'/lib/upload.svg" /></a>
<a rel="tooltip" class="bulles myFiles" title="'._('See the files already sent').' href="'.$config['baseUrl'].'/My"><img src="'.$config['baseUrl'].'/lib/folder.svg" /></a>
<a rel="tooltip" class="bulles myFiles" title="'._('See the files already sent').'" href="'.$config['baseUrl'].'/My"><img src="'.$config['baseUrl'].'/lib/folder.svg" /></a>
'.$similarServicesLink.'</div>
<script>
if (localStorage.getItem(\'myFiles\')) {
@ -256,6 +297,22 @@ if (isset($_GET['action']) && $_GET['action'] == 'del') {
printf(_('Error: The directory (%s) is not writable, please contact the service administrator'), $config['uploadDir']);
echo '</div>';
break;
case 'password':
echo '<h1>'.$config['shortTitle'].' : '.$config['title'].'</h1>';
if (isset($_POST['password']) && $passwordInvalid == true) {
echo '<div class="highlight-1">';
echo _('Error: Incorrect password');
echo '</div>';
}
echo '<div class="passwordForm">';
echo '<p>'._('This file is protected by a password, thank you to indicate it below').'</p>';
echo '<div><form action="#" method="post">';
echo '<input type="password" name="password" />';
echo '<input type="submit" />';
echo '</form></div>';
echo '</div>';
echo $echoNewUpload;
break;
case 'page':
foreach ($config['htmlPages'] as $fileName => $name) {
if ($_GET['name'] == $fileName) {
@ -287,67 +344,136 @@ if (isset($_GET['action']) && $_GET['action'] == 'del') {
$classExpire='speedDownload';
}
printf('<p class="'.$classExpire.'">'._('These files will be automatically deleted on %s, ie in %d days').'</p>', $dateExpire, $dayExpire);
if (is_file($uploadDirId.'/.access.cfg') ) {
$nbAccess = file_get_contents($uploadDirId.'/.access.cfg');
if ($nbAccess < 3) {
$classExpireAccess='verySpeedDownload';
}elseif ($nbAccess < 6) {
$classExpireAccess='speedDownload';
}
printf('<p class="'.$classExpireAccess.'">'._('These files will be automatically deleted in %d access').'</p>', $nbAccess);
}
$nbFile=0;
$nbImageFile=0;
foreach (scandir($uploadDirId) as $file) {
if (is_file($uploadDirId.'/'.$file)
&& $file != $id.'.zip'
&& !preg_match('/^.key-[0-9]{12}$/', $file)
&& !preg_match('/^\.(.+)\.cfg$/', $file)
&& !preg_match('/^\.(.+)\.small$/', $file)) {
$filesInUploadDirId[]=$file;
$nbFile++;
if (preg_match('/^image\/(png|jpeg|gif)$/', mime_content_type($uploadDirId.'/'.$file))) {
$nbImageFile++;
}
}
}
if ($nbImageFile == $nbFile) {
echo '<div id="viewMod">';
if (isset($_GET['gallery'])) {
echo '<a href="'.$config['baseUrl'].$id.'/">'._('View in list mode ').'</a>';
} else {
echo '<a href="'.$config['baseUrl'].'gallery/'.$id.'/">'._('View in gallery mode ').'</a>';
}
echo '</div>';
}
if ($nbFile == 0) {
echo '<p>'._('Error: Nothing to display').'</p>';
} elseif ($nbFile == 1) {
echo '<div class="fileGlobal fileJust1 file-ext-html" >';
$linkDownload=$config['baseUrl'].$id.'/';
echo '<div class="viewNormal fileGlobal fileJust1 file-ext-html" >';
echo '<div class="file fileJust1 icone" onclick="location.href=\''.$linkDownload.'\'"><div class="fi fi-html fi-size"><div class="fi-content">html</div></div></div>';
echo '<div class="file fileJust1 name"><a href="'.$linkDownload.'" target="_blank">'._('This page').'</a></div>';
echo '<div class="file fileJust1 read input"><a href="'.$config['baseUrl'].$id.'/" target="_blank"><img src="'.$config['baseUrl'].'/lib/eye.svg" /></a> <input class="copy read fileAll" name="read" type="text" value="'.$config['baseUrl'].$id.'/" readonly=""></div>';
echo '</div>';
} elseif ($nbFile > 1) {
$linkDownload=$config['baseUrl'].$id.'.zip';
echo '<div class="fileGlobal fileAll file-ext-zip" >';
echo '<div class="file fileAll icone" onclick="location.href=\''.$linkDownload.'\'"><div class="fi fi-zip fi-size-lg"><div class="fi-content">zip</div></div></div>';
echo '<div class="file fileAll name"><a href="'.$linkDownload.'" target="_blank">'._('All').'</a> - <a class="delete deleteLink" href="'.$config['baseUrl'].'del/'.$id.'/KEYHERE/"><img width="15" src="'.$config['baseUrl'].'/lib/trash.svg" /> '._('Delete all (permanently)').'</a></div>';
echo '<div class="file fileAll read input"><a href="'.$config['baseUrl'].$id.'/" target="_blank"><img src="'.$config['baseUrl'].'/lib/eye.svg" /></a> <a rel="tooltip" class="bulles" title="'._('Click to copy the link to the clipboard').'"><input class="copy read fileAll" name="read" type="text" value="'.$config['baseUrl'].$id.'/" readonly=""></a></div>';
echo '<div class="file fileAll dl input"><a href="'.$linkDownload.'" target="_blank"><img src="'.$config['baseUrl'].'/lib/download.svg" /></a> <a rel="tooltip" class="bulles" title="'._('Click to copy the link to the clipboard').'"><input class="copy dl fileAll" name="dl" type="text" value="'.$linkDownload.'" readonly=""></a></div>';
}
if (isset($_GET['gallery'])) {
echo '<div id="lightgalleryGallery">';
$idFile=0;
foreach ($filesInUploadDirId as $fileInUploadDirId) {
$pathInfo = pathinfo($uploadDirId.'/'.$fileInUploadDirId);
$linkDownload=$config['baseUrl'].'dl/'.$id.'/'.$fileInUploadDirId;
echo '<div class="viewGallery file'.$idFile.' file-ext-'.$pathInfo['extension'].'" >';
echo '<div style="float: left; border: 1px solid #C6C6C6;" class="file file'.$idFile.' icone">';
if (preg_match('/^image\/(png|jpeg|gif)$/', mime_content_type($pathInfo['dirname'].'/'.$pathInfo['basename']))) {
if (!is_file($pathInfo['dirname'].'/.'.$pathInfo['basename'].'.gallery.small')) {
resize_image($pathInfo['dirname'].'/'.$pathInfo['basename'], $pathInfo['dirname'].'/.'.$pathInfo['basename'].'.gallery.small' , 250, 250);
}
if (is_file($pathInfo['dirname'].'/.'.$pathInfo['basename'].'.gallery.small')) {
echo '<div class="item" data-src="'.$config['baseUrl'].$id.'/'.$fileInUploadDirId.'"><img width="250" src="'.$config['baseUrl'].$id.'/.'.$pathInfo['basename'].'.gallery.small" /></a></div>';
} else {
echo '<a href="'.$linkDownload.'" target="_blank"><div class="fi fi-'.$pathInfo['extension'].' fi-size-xl"><div class="fi-content">'.$pathInfo['extension'].'</div></div></a>';
}
} else {
echo '<a href="'.$linkDownload.'" target="_blank"><div class="fi fi-'.$pathInfo['extension'].' fi-size-xl"><div class="fi-content">'.$pathInfo['extension'].'</div></div></a>';
}
echo '</div>';
echo '</div>';
}
echo '</div>';
}
$idFile=0;
foreach ($filesInUploadDirId as $fileInUploadDirId) {
$pathInfo = pathinfo($uploadDirId.'/'.$fileInUploadDirId);
$linkDownload=$config['baseUrl'].'dl/'.$id.'/'.$fileInUploadDirId;
echo '<div class="fileGlobal file'.$idFile.' file-ext-'.$pathInfo['extension'].'" >';
echo '<div class="file file'.$idFile.' icone delete"><a href="'.$config['baseUrl'].'del/'.$id.'/KEYHERE/'.$pathInfo['basename'].'" class="deleteLink"><img src="'.$config['baseUrl'].'/lib/trash.svg" /></a></div>';
echo '<div class="file file'.$idFile.' icone" onclick="location.href=\''.$linkDownload.'\'">';
if (preg_match('/^image\/(png|jpeg|gif)$/', mime_content_type($pathInfo['dirname'].'/'.$pathInfo['basename']))) {
if (!is_file($pathInfo['dirname'].'/.'.$pathInfo['basename'].'.small')) {
resize_image($pathInfo['dirname'].'/'.$pathInfo['basename'], $pathInfo['dirname'].'/.'.$pathInfo['basename'].'.small' , 60, 60);
}
if (is_file($pathInfo['dirname'].'/.'.$pathInfo['basename'].'.small')) {
echo '<img width="55" src="'.$config['baseUrl'].$config['uploadDir'].'/'.$id.'/.'.$pathInfo['basename'].'.small" />';
} else {
echo '<div class="fi fi-'.$pathInfo['extension'].' fi-size-lg"><div class="fi-content">'.$pathInfo['extension'].'</div></div>';
}
} else {
echo '<div class="fi fi-'.$pathInfo['extension'].' fi-size-lg"><div class="fi-content">'.$pathInfo['extension'].'</div></div>';
if ($nbFile > 1) {
$linkDownload=$config['baseUrl'].$id.'.zip';
echo '<div style="clear : both" class="fileGlobal fileAll file-ext-zip" >';
echo '<div class="file fileAll icone" onclick="location.href=\''.$linkDownload.'\'"><div class="fi fi-zip fi-size-lg"><div class="fi-content">zip</div></div></div>';
echo '<div class="file fileAll name"><a href="'.$linkDownload.'" target="_blank">'._('All').'</a><a class="delete deleteLinkAll bulles" rel="tooltip" title="'._('Delete all (permanently)').'" href="'.$config['baseUrl'].'del/'.$id.'/KEYHERE/"> - <img width="15" src="'.$config['baseUrl'].'/lib/trash.svg" /></a></div>';
echo '<div class="file fileAll read input"><a href="'.$config['baseUrl'].$id.'/"><img src="'.$config['baseUrl'].'/lib/eye.svg" /></a> <a rel="tooltip" class="bulles" title="'._('Click to copy the link to the clipboard').'"><input class="copy read fileAll" name="read" type="text" value="'.$config['baseUrl'].$id.'/" readonly=""></a></div>';
if ($nbImageFile == $nbFile) {
echo '<div class="file fileAll read input"><a href="'.$config['baseUrl'].'gallery/'.$id.'/"><img src="'.$config['baseUrl'].'/lib/gallery.svg" /></a> <a rel="tooltip" class="bulles" title="'._('Click to copy the link to the clipboard').'"><input class="copy read fileAll" name="read" type="text" value="'.$config['baseUrl'].'gallery/'.$id.'/" readonly=""></a></div>';
}
echo '</div>';
echo '<div class="file file'.$idFile.' name"><a href="'.$linkDownload.'" target="_blank">'.truncate($fileInUploadDirId, 40, '...', true).'</a></div>';
echo '<div class="file file'.$idFile.' info">';
echo '<span class="size file'.$idFile.'">'._('Size').' : '.convertOctect2humain(filesize($pathInfo['dirname'].'/'.$pathInfo['basename'])).'</span> ';
echo '<span class="type file'.$idFile.'">'._('Type').' : '.mime_content_type($pathInfo['dirname'].'/'.$pathInfo['basename']).'</span> ';
//echo '<span class="size">'._('Type').' : '.mime_content_type($pathInfo['dirname'].'/'.$pathInfo['basename']).'</span> ';
echo '</div>';
echo '<div class="file file'.$idFile.' read input"><a href="'.$config['baseUrl'].$id.'/'.$fileInUploadDirId.'" target="_blank"><img src="'.$config['baseUrl'].'/lib/eye.svg" /></a> <a rel="tooltip" class="bulles" title="'._('Click to copy the link to the clipboard').'"><input class="copy read file'.$idFile.'" name="read" type="text" value="'.$config['baseUrl'].$id.'/'.$fileInUploadDirId.'"></a></div>';
echo '<div class="file file'.$idFile.' dl input"><a href="'.$linkDownload.'" target="_blank"><img src="'.$config['baseUrl'].'/lib/download.svg" /></a> <a rel="tooltip" class="bulles" title="'._('Click to copy the link to the clipboard').'"><input class="copy dl file'.$idFile.'" name="dl" type="text" value="'.$linkDownload.'" readonly=""></a></div>';
echo '<div class="file fileAll dl input"><a href="'.$linkDownload.'"><img src="'.$config['baseUrl'].'/lib/download.svg" /></a> <a rel="tooltip" class="bulles" title="'._('Click to copy the link to the clipboard').'"><input class="copy dl fileAll" name="dl" type="text" value="'.$linkDownload.'" readonly=""></a></div>';
echo '</div>';
}
if (!isset($_GET['gallery'])) {
$idFile=0;
echo '<div id="lightgalleryNormal">';
foreach ($filesInUploadDirId as $fileInUploadDirId) {
$pathInfo = pathinfo($uploadDirId.'/'.$fileInUploadDirId);
$linkDownload=$config['baseUrl'].'dl/'.$id.'/'.$fileInUploadDirId;
echo '<div class="viewNormal fileGlobal file'.$idFile.' file-ext-'.$pathInfo['extension'].'" >';
echo '<div class="file file'.$idFile.' icone delete"><a href="'.$config['baseUrl'].'del/'.$id.'/KEYHERE/'.$pathInfo['basename'].'" class="deleteLink"><img src="'.$config['baseUrl'].'/lib/trash.svg" /></a></div>';
echo '<div class="file file'.$idFile.' icone">';
if (preg_match('/^image\/(png|jpeg|gif)$/', mime_content_type($pathInfo['dirname'].'/'.$pathInfo['basename']))) {
if (!is_file($pathInfo['dirname'].'/.'.$pathInfo['basename'].'.small')) {
resize_image($pathInfo['dirname'].'/'.$pathInfo['basename'], $pathInfo['dirname'].'/.'.$pathInfo['basename'].'.small' , 60, 60);
}
if (is_file($pathInfo['dirname'].'/.'.$pathInfo['basename'].'.small')) {
echo '<div class="item" data-src="'.$config['baseUrl'].$id.'/'.$fileInUploadDirId.'"><img width="55" src="'.$config['baseUrl'].$id.'/.'.$pathInfo['basename'].'.small" /></a></div>';
} else {
echo '<a href="'.$linkDownload.'" target="_blank"><div class="fi fi-'.$pathInfo['extension'].' fi-size-lg"><div class="fi-content">'.$pathInfo['extension'].'</div></div></a>';
}
} else {
echo '<a href="'.$linkDownload.'" target="_blank"><div class="fi fi-'.$pathInfo['extension'].' fi-size-lg"><div class="fi-content">'.$pathInfo['extension'].'</div></div></a>';
}
echo '</div>';
echo '<div class="file file'.$idFile.' name"><a href="'.$linkDownload.'" target="_blank">'.truncate($fileInUploadDirId, 40, '...', true).'</a></div>';
echo '<div class="file file'.$idFile.' info">';
echo '<span class="size file'.$idFile.'">'._('Size').' : '.convertOctect2humain(filesize($pathInfo['dirname'].'/'.$pathInfo['basename'])).'</span> ';
echo '<span class="type file'.$idFile.'">'._('Type').' : '.mime_content_type($pathInfo['dirname'].'/'.$pathInfo['basename']).'</span> ';
//echo '<span class="size">'._('Type').' : '.mime_content_type($pathInfo['dirname'].'/'.$pathInfo['basename']).'</span> ';
echo '</div>';
echo '<div class="file file'.$idFile.' read input"><a href="'.$config['baseUrl'].$id.'/'.$fileInUploadDirId.'" target="_blank"><img src="'.$config['baseUrl'].'/lib/eye.svg" /></a> <a rel="tooltip" class="bulles" title="'._('Click to copy the link to the clipboard').'"><input class="copy read file'.$idFile.'" name="read" type="text" value="'.$config['baseUrl'].$id.'/'.$fileInUploadDirId.'"></a></div>';
echo '<div class="file file'.$idFile.' dl input"><a href="'.$linkDownload.'" target="_blank"><img src="'.$config['baseUrl'].'/lib/download.svg" /></a> <a rel="tooltip" class="bulles" title="'._('Click to copy the link to the clipboard').'"><input class="copy dl file'.$idFile.'" name="dl" type="text" value="'.$linkDownload.'" readonly=""></a></div>';
echo '</div>';
$idFile++;
}
echo '</div>';
$idFile++;
}
echo $echoNewUpload;
?>
<script>
<script type="text/javascript">
$(document).ready(function() {
// lightgallery
// https://github.com/sachinchoolur/lightGallery
$("#lightgalleryNormal").lightGallery({
selector: '.item'
});
$("#lightgalleryGallery").lightGallery({
selector: '.item'
});
});
// Affiche les bouton de suppression si c'est le poste qui a uploadé
if (localStorage.getItem('myFiles')) {
var storageMyFiles = JSON.parse(localStorage.getItem('myFiles'));
if (storageMyFiles.items.filter(function(e) { return e.id === '<?= $id ?>'; }).length > 0) {
@ -361,8 +487,77 @@ if (isset($_GET['action']) && $_GET['action'] == 'del') {
var newLink = oldLink.replace('KEYHERE', keyForThis);
links[i].href = newLink;
}
var links = $('.deleteLinkAll');
for(var i = 0; i< links.length; i++){
var oldLink = links[i].href;
var newLink = oldLink.replace('KEYHERE', keyForThis);
links[i].href = newLink;
}
}
}
function deleteLast(href) {
var hrefSplit = href.split('\/');
var id = false;
var key = false;
for (var i = 0; i < hrefSplit.length; i++) {
var regexTimestamp = RegExp('^[0-9]+-[0-9]{1,2}$');
console.log(hrefSplit[i]);
if (regexTimestamp.test(hrefSplit[i])) {
id=hrefSplit[i];
}
if (parseInt(hrefSplit[i]) >= 100000000000 && parseInt(hrefSplit[i]) <= 999999999999) {
key=hrefSplit[i];
}
}
if (id != false && key != false && localStorage.getItem('myFiles')) {
var storageMyFiles = JSON.parse(localStorage.getItem('myFiles'));
var newData = {items: []};
for (var i = 0; i < storageMyFiles.items.length; i++) {
var idSplit=storageMyFiles.items[i].id.split("-");
var timestampNow = Number(new Date());
var timestampExpire = idSplit[0]*1000;
// Ne pas afficher les expiré
// Et si ce n'est pas celui qu'on efface
if (timestampNow < timestampExpire
&& storageMyFiles.items[i].id != id
&& storageMyFiles.items[i].key != key) {
// On update le maintient dans le stroage
newData.items.push(
{id: storageMyFiles.items[i].id, key: storageMyFiles.items[i].key}
);
}
}
// Ecriture du storage
localStorage.setItem('myFiles', JSON.stringify(newData));
}
}
$(".deleteLinkAll").on('click',function(){
if (confirm("<?= _('Are you sure you want to delete everything?') ?>")) {
deleteLast(this.href);
return true;
} else {
return false;
}
});
$(".deleteLink").on('click',function(){
if (confirm("<?= _('Are you sure you want to delete it?') ?>")) {
<?php
// Si c'est le dernier, on supprime l'enregistrement localStorage
if ($nbFile == 1) {
echo "deleteLast(this.href);";
}
?>
return true;
} else {
return false;
}
});
<?php
// $nbFile
?>
</script>
<?php
break;
@ -370,11 +565,19 @@ if (isset($_GET['action']) && $_GET['action'] == 'del') {
?>
<h1><?= $config['shortTitle'] ?> : <?= _('My files') ?></h1>
<p><?= _('Online file sharing service <a href="https://en.wikipedia.org/wiki/Open_source">free of rights</a> (license <a href="https://en.wikipedia.org/wiki/Beerware">Beerware</a>) and free.') ?></p>
<div id="myFilesArea"></div>
<table id="myFilesTab">
<tr><th> - </th><th><?= _('Nb of files') ?></th><th><?= _('Creation date ') ?></th><th><?= _('Expiration date') ?></th><th><?= _('Size') ?></th><th><?= _('Remaining access') ?></th><th><?= _('Password') ?></th><th><?= _('Link') ?></th></tr>
</table>
<script>
function sleep(milliseconds) {
const date = Date.now();
let currentDate = null;
do {
currentDate = Date.now();
} while (currentDate - date < milliseconds);
}
var fileNotExpire=0;
if (localStorage.getItem('myFiles')) {
var tablePrepar = '<table><tr><th>Id</th><th><?= _('Expire') ?></th><th><?= _('Link') ?></th></tr>';
var storageMyFiles = JSON.parse(localStorage.getItem('myFiles'));
var newData = {items: []};
for (var i = 0; i < storageMyFiles.items.length; i++) {
@ -384,24 +587,33 @@ if (isset($_GET['action']) && $_GET['action'] == 'del') {
// Ne pas afficher les expiré
if (timestampNow < timestampExpire) {
var dateExpire = new Date(idSplit[0]* 1000).toDateString();
var tablePrepar = tablePrepar + '<tr class="myFiles1"><td>'+storageMyFiles.items[i].id+'</td><td>'+dateExpire+'</td><td><a href="<?= $config['baseUrl'] ?>'+storageMyFiles.items[i].id+'/" target="_blank"><?= $config['baseUrl'] ?>'+storageMyFiles.items[i].id+'/</a></td></tr>\n';
$.ajax({
url : 'my.php',
type : 'POST',
dataType : 'html',
data : 'id=' + storageMyFiles.items[i].id + '&dateExpire=' + dateExpire,
success : function(code_html, statut){
$('#myFilesTab>tbody:last').append(code_html);
},
error : function(resultat, statut, erreur){
//console.log(resultat + statut + erreur)
},
});
var fileNotExpire=fileNotExpire+1;
// On update le maintient dans le stroage
newData.items.push(
{id: storageMyFiles.items[i].id, key: storageMyFiles.items[i].key}
);
{id: storageMyFiles.items[i].id, key: storageMyFiles.items[i].key}
);
}
}
// Ecriture du storage
localStorage.setItem('myFiles', JSON.stringify(newData));
var tablePrepar = tablePrepar + '</table>';
$('#myFilesArea').html(tablePrepar);
}else if (fileNotExpire == 0) {
$('#myFilesTab>tbody:last').append('<tr><td colspan="6" class="error myFiles0"><?= _('All your files have expired.') ?></td></tr>');
} else {
$('#myFilesArea').html('<span class="error myFiles0"><?= _('No files, maybe all of them have expired.') ?></span>');
}
if (fileNotExpire == 0) {
$('#myFilesArea').html('<span class="error myFiles0"><?= _('All your files have expired.') ?></span>');
$('#myFilesTab>tbody:last').append('<tr><td colspan="6" class="error myFiles0"><?= _('No files, maybe all of them have expired.') ?></td></tr>');
}
</script>
<?php
echo $echoNewUpload;
@ -439,14 +651,25 @@ if (isset($_GET['action']) && $_GET['action'] == 'del') {
<div><?= _('Expire') ?> : <select name="expire" id="expire">
<?php
foreach ($config['expireDay'] as $expireDay) {
$dayOrDays=_('days');
if ($expireDay == 1) {
$dayOrDays=_('day');
}
if ($expireDay == $config['expireDayDefault']) {
echo '<option value="'.$expireDay.'" selected="selected">'.$expireDay.' '._('day').'</option>';
echo '<option value="'.$expireDay.'" selected="selected">'.$expireDay.' '.$dayOrDays.'</option>';
} else {
echo '<option value="'.$expireDay.'" >'.$expireDay.' '._('day').'</option>';
echo '<option value="'.$expireDay.'" >'.$expireDay.' '.$dayOrDays.'</option>';
}
}
?>
</select></div>
<a id="uploadOptionsLinkShow" class="uploadOptionsLink"><?= _('Options') ?> &#8642;</a>
<div id="uploadOptions">
<a id="uploadOptionsLinkHide" class="uploadOptionsLink"><?= _('Options') ?> &#8638;</a>
<p><input type="checkbox" name="passwordCheckbox" id="passwordCheckbox" /><?= _('Protect with password') ?><span id="passwordForm"> : <br /><input type="password" name="password" id="password" autocomplete="off" /></span></p>
<p id="uploadOptionAccess"><input type="checkbox" name="accessCheckbox" id="accessCheckbox" /><?= _('Delete after access') ?><span id="accessForm"> : <br /><input title="<?= _('Number of accesses before deletion (1 minimum)') ?> "type="number" min="1" max="999999" step="1" name="access" id="access" value="<?= $config['deleteAfterAccessDefault'] ?>" /></span></p>
</div>
<div id="resizeForm"><?= _('Images resize') ?> : <select name="resize" id="resize">
<?php
foreach ($config['imageResize'] as $imageResize) {
@ -533,5 +756,6 @@ if ($config['expireCron'] == 'web') {
}
}
@include_once('./footer.php');
?>

Binary file not shown.

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-11-20 01:37+0100\n"
"POT-Creation-Date: 2019-12-05 14:57+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,212 +17,305 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: cron.php:7
#: cron.php:8
msgid "Start the command in the file2link directory"
msgstr ""
#: cron.php:10
#: cron.php:11
msgid "Completed"
msgstr ""
#: cron.php:12
#: cron.php:13
msgid "expireCron is not at \"cli\" mod (in config.yaml)"
msgstr ""
#: functions.php:111
#: functions.php:93
msgid "Expired"
msgstr ""
#: index.php:66
#: index.php:68
#, php-format
msgid ""
"In coherence with your configuration (config.yaml) you must increase the PHP "
"configuration upload_max_filesize to %s"
msgstr ""
#: index.php:69
#: index.php:71
#, php-format
msgid ""
"In coherence with your configuration (config.yaml) you must increase the PHP "
"configuration post_max_size to %s"
msgstr ""
#: index.php:72
#: index.php:74
#, php-format
msgid ""
"In coherence with your configuration (config.yaml) you must increase the PHP "
"configuration max_file_uploads to %s"
msgstr ""
#: index.php:171 upload.php:43
#: index.php:208 upload.php:59
#, php-format
msgid "this file exceeds the allowed size %s"
msgstr ""
#: index.php:172
#: index.php:209
#, php-format
msgid "The total size of the files exceeds the allowed size : %s"
msgstr ""
#: index.php:173
#: index.php:210
#, php-format
msgid "You can not send more than %d files at a time"
msgstr ""
#: index.php:174
#: index.php:211
#, php-format
msgid "this type of file isn\\'t allow"
msgstr ""
#: index.php:210
#: index.php:248
msgid "Maintenance"
msgstr ""
#: index.php:216
#: index.php:254
msgid "Mode Maintenance as true"
msgstr ""
#: index.php:223
#: index.php:261
msgid "Similar services"
msgstr ""
#: index.php:245
#: index.php:286
msgid "Send a new file"
msgstr ""
#: index.php:246
#: index.php:287 index.php:645
msgid "See the files already sent"
msgstr ""
#: index.php:256
#: index.php:297
#, php-format
msgid ""
"Error: The directory (%s) is not writable, please contact the service "
"administrator"
msgstr ""
#: index.php:267 index.php:269
#: index.php:304
msgid "Error: Incorrect password"
msgstr ""
#: index.php:308
msgid "This file is protected by a password, thank you to indicate it below"
msgstr ""
#: index.php:324 index.php:326
msgid "The requested page does not exist"
msgstr ""
#: index.php:289
#: index.php:346
#, php-format
msgid "These files will be automatically deleted on %s, ie in %d days"
msgstr ""
#: index.php:301
#: index.php:354
#, php-format
msgid "These files will be automatically deleted in %d access"
msgstr ""
#: index.php:373
msgid "View in list mode "
msgstr ""
#: index.php:375
msgid "View in gallery mode "
msgstr ""
#: index.php:380
msgid "Error: Nothing to display"
msgstr ""
#: index.php:305
#: index.php:385
msgid "This page"
msgstr ""
#: index.php:312
#: index.php:420
msgid "All"
msgstr ""
#: index.php:312
#: index.php:420
msgid "Delete all (permanently)"
msgstr ""
#: index.php:313 index.php:314 index.php:343 index.php:344
#: index.php:421 index.php:423 index.php:425 index.php:456 index.php:457
msgid "Click to copy the link to the clipboard"
msgstr ""
#: index.php:339
#: index.php:452 index.php:569
msgid "Size"
msgstr ""
#: index.php:340
#: index.php:453
msgid "Type"
msgstr ""
#: index.php:371
#: index.php:537
msgid "Are you sure you want to delete everything?"
msgstr ""
#: index.php:545
msgid "Are you sure you want to delete it?"
msgstr ""
#: index.php:566
msgid "My files"
msgstr ""
#: index.php:372 index.php:425
#: index.php:567 index.php:637
msgid ""
"Online file sharing service <a href=\"https://en.wikipedia.org/wiki/"
"Open_source\">free of rights</a> (license <a href=\"https://en.wikipedia.org/"
"wiki/Beerware\">Beerware</a>) and free."
msgstr ""
#: index.php:377 index.php:439
msgid "Expire"
#: index.php:569
msgid "Nb of files"
msgstr ""
#: index.php:377
#: index.php:569
msgid "Creation date "
msgstr ""
#: index.php:569
msgid "Expiration date"
msgstr ""
#: index.php:569
msgid "Remaining access"
msgstr ""
#: index.php:569
msgid "Password"
msgstr ""
#: index.php:569 my.php:64
msgid "Link"
msgstr ""
#: index.php:400
msgid "No files, maybe all of them have expired."
msgstr ""
#: index.php:403
#: index.php:612
msgid "All your files have expired."
msgstr ""
#: index.php:410 index.php:411
#: index.php:614
msgid "No files, maybe all of them have expired."
msgstr ""
#: index.php:622 index.php:623
msgid "Unauthorized access"
msgstr ""
#: index.php:415
#: index.php:627
msgid "Not Found"
msgstr ""
#: index.php:416
#: index.php:628
msgid "This sharing does not exist, it has probably expired"
msgstr ""
#: index.php:443 index.php:445
#: index.php:643
msgid "Choose one or more files"
msgstr ""
#: index.php:644
msgid "Send file"
msgstr ""
#: index.php:651
msgid "Expire"
msgstr ""
#: index.php:654
msgid "days"
msgstr ""
#: index.php:656
msgid "day"
msgstr ""
#: index.php:450
#: index.php:666 index.php:668
msgid "Options"
msgstr ""
#: index.php:669
msgid "Protect with password"
msgstr ""
#: index.php:670
msgid "Delete after access"
msgstr ""
#: index.php:670
msgid "Number of accesses before deletion (1 minimum)"
msgstr ""
#: index.php:673
msgid "Images resize"
msgstr ""
#: index.php:455
#: index.php:678
msgid "No resizing"
msgstr ""
#: index.php:465
#: index.php:688
#, php-format
msgid "The limit per file is %dM, and the total limit per upload is %dM"
msgstr ""
#: index.php:475
#: index.php:698
msgid "By"
msgstr ""
#: index.php:475
#: index.php:698
msgid "Git repository"
msgstr ""
#: index.php:476
#: index.php:699
msgid "version"
msgstr ""
#: index.php:476
#: index.php:699
msgid ""
"is an open software licensed <a href=\"https://en.wikipedia.org/wiki/Beerware"
"\">Beerware</a>"
msgstr ""
#: upload.php:37
#: my.php:42
msgid "Multi"
msgstr ""
#: my.php:57
msgid "Unlimited"
msgstr ""
#: my.php:60
msgid "Yes"
msgstr ""
#: my.php:62
msgid "No"
msgstr ""
#: upload.php:53
#, php-format
msgid "this type of file isn't allow"
msgstr ""
#: upload.php:49
#: upload.php:65
#, php-format
msgid "The total size of the files exceeds the allowed size %s"
msgstr ""
#: upload.php:71
#: upload.php:87
#, php-format
msgid "Unknown error"
msgstr ""

5
lang/note.txt Normal file
View file

@ -0,0 +1,5 @@
cp lib/functions.php .
xgettext *.php -o lang/messages.pot --from-code="UTF-8"
msgmerge --no-wrap -N lang/fr/LC_MESSAGES/messages.po lang/messages.pot
msgmerge --no-wrap -N lang/fr/LC_MESSAGES/messages.po lang/messages.pot > lang/fr/LC_MESSAGES/messages.mo
rm functions.php

BIN
lib/fonts/lg.eot Normal file

Binary file not shown.

47
lib/fonts/lg.svg Normal file
View file

@ -0,0 +1,47 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>
<json>
<![CDATA[
{
"fontFamily": "lg",
"majorVersion": 1,
"minorVersion": 0,
"fontURL": "https://github.com/sachinchoolur/lightGallery",
"copyright": "sachin",
"license": "MLT",
"licenseURL": "http://opensource.org/licenses/MIT",
"version": "Version 1.0",
"fontId": "lg",
"psName": "lg",
"subFamily": "Regular",
"fullName": "lg",
"description": "Font generated by IcoMoon."
}
]]>
</json>
</metadata>
<defs>
<font id="lg" horiz-adv-x="1024">
<font-face units-per-em="1024" ascent="960" descent="-64" />
<missing-glyph horiz-adv-x="1024" />
<glyph unicode="&#x20;" horiz-adv-x="512" d="" />
<glyph unicode="&#xe01a;" glyph-name="pause_circle_outline" data-tags="pause_circle_outline" d="M554 256.667v340h86v-340h-86zM512 84.667q140 0 241 101t101 241-101 241-241 101-241-101-101-241 101-241 241-101zM512 852.667q176 0 301-125t125-301-125-301-301-125-301 125-125 301 125 301 301 125zM384 256.667v340h86v-340h-86z" />
<glyph unicode="&#xe01d;" glyph-name="play_circle_outline" data-tags="play_circle_outline" d="M512 84.667q140 0 241 101t101 241-101 241-241 101-241-101-101-241 101-241 241-101zM512 852.667q176 0 301-125t125-301-125-301-301-125-301 125-125 301 125 301 301 125zM426 234.667v384l256-192z" />
<glyph unicode="&#xe033;" glyph-name="stack-2" data-tags="stack-2" d="M384 853.334h426.667q53 0 90.5-37.5t37.5-90.5v-426.667q0-53-37.5-90.5t-90.5-37.5h-426.667q-53 0-90.5 37.5t-37.5 90.5v426.667q0 53 37.5 90.5t90.5 37.5zM170.667 675.334v-547.333q0-17.667 12.5-30.167t30.167-12.5h547.333q-13.333-37.667-46.333-61.5t-74.333-23.833h-426.667q-53 0-90.5 37.5t-37.5 90.5v426.667q0 41.333 23.833 74.333t61.5 46.333zM810.667 768h-426.667q-17.667 0-30.167-12.5t-12.5-30.167v-426.667q0-17.667 12.5-30.167t30.167-12.5h426.667q17.667 0 30.167 12.5t12.5 30.167v426.667q0 17.667-12.5 30.167t-30.167 12.5z" />
<glyph unicode="&#xe070;" glyph-name="clear" data-tags="clear" d="M810 664.667l-238-238 238-238-60-60-238 238-238-238-60 60 238 238-238 238 60 60 238-238 238 238z" />
<glyph unicode="&#xe094;" glyph-name="arrow-left" data-tags="arrow-left" d="M426.667 768q17.667 0 30.167-12.5t12.5-30.167q0-18-12.667-30.333l-225.667-225.667h665q17.667 0 30.167-12.5t12.5-30.167-12.5-30.167-30.167-12.5h-665l225.667-225.667q12.667-12.333 12.667-30.333 0-17.667-12.5-30.167t-30.167-12.5q-18 0-30.333 12.333l-298.667 298.667q-12.333 13-12.333 30.333t12.333 30.333l298.667 298.667q12.667 12.333 30.333 12.333z" />
<glyph unicode="&#xe095;" glyph-name="arrow-right" data-tags="arrow-right" d="M597.333 768q18 0 30.333-12.333l298.667-298.667q12.333-12.333 12.333-30.333t-12.333-30.333l-298.667-298.667q-12.333-12.333-30.333-12.333-18.333 0-30.5 12.167t-12.167 30.5q0 18 12.333 30.333l226 225.667h-665q-17.667 0-30.167 12.5t-12.5 30.167 12.5 30.167 30.167 12.5h665l-226 225.667q-12.333 12.333-12.333 30.333 0 18.333 12.167 30.5t30.5 12.167z" />
<glyph unicode="&#xe0f2;" glyph-name="vertical_align_bottom" data-tags="vertical_align_bottom" d="M170 128.667h684v-86h-684v86zM682 384.667l-170-172-170 172h128v426h84v-426h128z" />
<glyph unicode="&#xe1ff;" glyph-name="apps" data-tags="apps" d="M682 84.667v172h172v-172h-172zM682 340.667v172h172v-172h-172zM426 596.667v172h172v-172h-172zM682 768.667h172v-172h-172v172zM426 340.667v172h172v-172h-172zM170 340.667v172h172v-172h-172zM170 84.667v172h172v-172h-172zM426 84.667v172h172v-172h-172zM170 596.667v172h172v-172h-172z" />
<glyph unicode="&#xe20c;" glyph-name="fullscreen" data-tags="fullscreen" d="M598 724.667h212v-212h-84v128h-128v84zM726 212.667v128h84v-212h-212v84h128zM214 512.667v212h212v-84h-128v-128h-84zM298 340.667v-128h128v-84h-212v212h84z" />
<glyph unicode="&#xe20d;" glyph-name="fullscreen_exit" data-tags="fullscreen_exit" d="M682 596.667h128v-84h-212v212h84v-128zM598 128.667v212h212v-84h-128v-128h-84zM342 596.667v128h84v-212h-212v84h128zM214 256.667v84h212v-212h-84v128h-128z" />
<glyph unicode="&#xe311;" glyph-name="zoom_in" data-tags="zoom_in" d="M512 512.667h-86v-86h-42v86h-86v42h86v86h42v-86h86v-42zM406 340.667q80 0 136 56t56 136-56 136-136 56-136-56-56-136 56-136 136-56zM662 340.667l212-212-64-64-212 212v34l-12 12q-76-66-180-66-116 0-197 80t-81 196 81 197 197 81 196-81 80-197q0-104-66-180l12-12h34z" />
<glyph unicode="&#xe312;" glyph-name="zoom_out" data-tags="zoom_out" d="M298 554.667h214v-42h-214v42zM406 340.667q80 0 136 56t56 136-56 136-136 56-136-56-56-136 56-136 136-56zM662 340.667l212-212-64-64-212 212v34l-12 12q-76-66-180-66-116 0-197 80t-81 196 81 197 197 81 196-81 80-197q0-104-66-180l12-12h34z" />
<glyph unicode="&#xe80d;" glyph-name="share" data-tags="share" d="M768 252.667c68 0 124-56 124-124s-56-126-124-126-124 58-124 126c0 10 0 20 2 28l-302 176c-24-22-54-34-88-34-70 0-128 58-128 128s58 128 128 128c34 0 64-12 88-34l300 174c-2 10-4 20-4 30 0 70 58 128 128 128s128-58 128-128-58-128-128-128c-34 0-64 14-88 36l-300-176c2-10 4-20 4-30s-2-20-4-30l304-176c22 20 52 32 84 32z" />
<glyph unicode="&#xe901;" glyph-name="facebook-with-circle" data-tags="facebook-with-circle" d="M512 952.32c-271.462 0-491.52-220.058-491.52-491.52s220.058-491.52 491.52-491.52 491.52 220.058 491.52 491.52-220.058 491.52-491.52 491.52zM628.429 612.659h-73.882c-8.755 0-18.483-11.52-18.483-26.829v-53.35h92.416l-13.978-76.083h-78.438v-228.403h-87.194v228.403h-79.104v76.083h79.104v44.749c0 64.205 44.544 116.378 105.677 116.378h73.882v-80.947z" />
<glyph unicode="&#xe902;" glyph-name="google-with-circle" data-tags="google+-with-circle" d="M512 952.32c-271.462 0-491.52-220.058-491.52-491.52s220.058-491.52 491.52-491.52 491.52 220.058 491.52 491.52-220.058 491.52-491.52 491.52zM483.686 249.805c-30.874-15.002-64.102-16.589-76.954-16.589-2.458 0-3.84 0-3.84 0s-1.178 0-2.765 0c-20.070 0-119.962 4.608-119.962 95.59 0 89.395 108.8 96.41 142.131 96.41h0.87c-19.251 25.702-15.258 51.61-15.258 51.61-1.69-0.102-4.147-0.205-7.168-0.205-12.544 0-36.762 1.997-57.549 15.411-25.498 16.384-38.4 44.288-38.4 82.893 0 109.107 119.142 113.51 120.32 113.613h118.989v-2.611c0-13.312-23.91-15.923-40.192-18.125-5.53-0.819-16.64-1.894-19.763-3.482 30.157-16.128 35.021-41.421 35.021-79.104 0-42.906-16.794-65.587-34.611-81.51-11.059-9.882-19.712-17.613-19.712-28.006 0-10.189 11.878-20.582 25.702-32.717 22.579-19.917 53.555-47.002 53.555-92.723 0-47.258-20.326-81.050-60.416-100.454zM742.4 460.8h-76.8v-76.8h-51.2v76.8h-76.8v51.2h76.8v76.8h51.2v-76.8h76.8v-51.2zM421.018 401.92c-2.662 0-5.325-0.102-8.038-0.307-22.733-1.69-43.725-10.189-58.88-24.013-15.053-13.619-22.733-30.822-21.658-48.179 2.304-36.403 41.37-57.702 88.832-54.323 46.694 3.379 77.824 30.31 75.571 66.714-2.15 34.202-31.898 60.109-75.827 60.109zM465.766 599.808c-12.39 43.52-32.358 56.422-63.386 56.422-3.328 0-6.707-0.512-9.933-1.382-13.466-3.84-24.166-15.053-30.106-31.744-6.093-16.896-6.451-34.509-1.229-54.579 9.472-35.891 34.97-61.901 60.672-61.901 3.379 0 6.758 0.41 9.933 1.382 28.109 7.885 45.722 50.79 34.048 91.802z" />
<glyph unicode="&#xe903;" glyph-name="pinterest-with-circle" data-tags="pinterest-with-circle" d="M512 952.32c-271.462 0-491.52-220.058-491.52-491.52s220.058-491.52 491.52-491.52 491.52 220.058 491.52 491.52-220.058 491.52-491.52 491.52zM545.638 344.32c-31.539 2.406-44.749 18.022-69.427 32.973-13.568-71.219-30.157-139.52-79.309-175.206-15.206 107.725 22.221 188.518 39.629 274.381-29.645 49.92 3.533 150.323 66.099 125.645 76.954-30.515-66.662-185.6 29.747-205.005 100.659-20.173 141.773 174.694 79.36 237.978-90.214 91.494-262.502 2.099-241.306-128.87 5.12-32 38.246-41.728 13.21-85.914-57.702 12.8-74.957 58.317-72.704 118.989 3.533 99.328 89.242 168.909 175.155 178.483 108.698 12.083 210.688-39.885 224.819-142.182 15.821-115.405-49.101-240.282-165.274-231.27z" />
<glyph unicode="&#xe904;" glyph-name="twitter-with-circle" data-tags="twitter-with-circle" d="M512 952.32c-271.462 0-491.52-220.058-491.52-491.52s220.058-491.52 491.52-491.52 491.52 220.058 491.52 491.52-220.058 491.52-491.52 491.52zM711.936 549.683c0.205-4.198 0.256-8.397 0.256-12.493 0-128-97.331-275.507-275.405-275.507-54.682 0-105.574 15.974-148.378 43.52 7.526-0.922 15.258-1.28 23.091-1.28 45.363 0 87.091 15.411 120.218 41.421-42.342 0.819-78.080 28.774-90.419 67.174 5.888-1.075 11.93-1.69 18.176-1.69 8.806 0 17.408 1.178 25.498 3.379-44.288 8.909-77.67 48.026-77.67 94.925v1.178c13.056-7.219 28.006-11.622 43.878-12.134-26.010 17.408-43.059 47.002-43.059 80.64 0 17.715 4.762 34.406 13.107 48.691 47.77-58.573 119.040-97.075 199.526-101.222-1.69 7.117-2.509 14.49-2.509 22.118 0 53.402 43.315 96.819 96.819 96.819 27.802 0 52.992-11.776 70.656-30.618 22.067 4.403 42.752 12.39 61.44 23.501-7.219-22.579-22.528-41.574-42.547-53.606 19.61 2.406 38.246 7.578 55.603 15.309-12.954-19.405-29.389-36.506-48.282-50.125z" />
</font></defs></svg>

After

Width:  |  Height:  |  Size: 8.6 KiB

BIN
lib/fonts/lg.ttf Normal file

Binary file not shown.

BIN
lib/fonts/lg.woff Normal file

Binary file not shown.

View file

@ -59,7 +59,7 @@ function genZip($id) {
}
foreach (scandir($uploadDirId) as $file) {
if (is_file($uploadDirId.'/'.$file)
&& !preg_match('/^.key-[0-9]{12}$/', $file)
&& !preg_match('/^\.(.+)\.cfg$/', $file)
&& !preg_match('/^\.(.+)\.small$/', $file)) {
$zip->addFile($uploadDirId.'/'.$file,$file);
}

1
lib/gallery.svg Normal file
View file

@ -0,0 +1 @@
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="images" class="svg-inline--fa fa-images fa-w-18" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M480 416v16c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V176c0-26.51 21.49-48 48-48h16v208c0 44.112 35.888 80 80 80h336zm96-80V80c0-26.51-21.49-48-48-48H144c-26.51 0-48 21.49-48 48v256c0 26.51 21.49 48 48 48h384c26.51 0 48-21.49 48-48zM256 128c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-96 144l55.515-55.515c4.686-4.686 12.284-4.686 16.971 0L272 256l135.515-135.515c4.686-4.686 12.284-4.686 16.971 0L512 208v112H160v-48z"></path></svg>

After

Width:  |  Height:  |  Size: 685 B

1
lib/lightgallery.min.css vendored Normal file

File diff suppressed because one or more lines are too long

4
lib/lightgallery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -135,6 +135,13 @@ progress {
color: #FFA500;
font-weight: bold;
}
#viewMod {
text-align:center;
padding: 5px;
}
#viewMod a {
text-decoration: none;
}
.fileGlobal {
padding-top: 10px;
}
@ -168,7 +175,8 @@ progress {
float: left;
width: 25px;
}
.file.delete {
.file.delete,
.deleteAll {
width: 15px;
float: right;
}
@ -182,11 +190,28 @@ input.copy {
padding: 4px;
cursor: copy;
}
#accessForm,
#passwordForm,
#uploadOptions,
.delete,
.deleteAll,
.myFiles {
display: none;
}
.passwordForm {
text-align:center;
}
#myFilesTab {
width: 100%;
}
#myFilesTab td {
text-align: center;
cursor: pointer;
}
.uploadOptionsLink {
color: #07396A;
text-decoration: none;
}
.newUpload {
text-align: center;
margin: 10px;

View file

@ -21,7 +21,7 @@ $(function () {
* @param file
* @param item
*/
function uploadFile(item, file, expire, random, resize, key) {
function uploadFile(item, file, expire, random, resize, key, password, access) {
// Add progress bar
$('.progress').show();
@ -46,6 +46,8 @@ $(function () {
formData.append('expire', expire);
formData.append('resize', resize);
formData.append('key', key);
formData.append('password', password);
formData.append('access', access);
// File to call
request.open('post', 'upload.php');
@ -68,10 +70,17 @@ $(function () {
var files = $('#files')[0].files;
var expire = Math.floor(Date.now() / 1000 + $('#expire').val() * 86400);
var random = Math.floor(Math.random() * Math.floor(99));
var password = false
if ($('#passwordCheckbox').is(':checked')) {
password=$('#password').val();
}
var access = false
if ($('#accessCheckbox').is(':checked')) {
access=$('#access').val();
}
// Check size and mime
var fileAlreadyUploadSizeTotal = 0;
for (var i = 0; i < files.length; i++) {
for (var i = 0; i < files.length; i++) {
// Size
fileAlreadyUploadSizeTotal = fileAlreadyUploadSizeTotal + document.getElementById("files").files[i].size;
if (document.getElementById("files").files[i].size > Config_maxUploadPerFile) {
@ -115,7 +124,7 @@ $(function () {
);
localStorage.setItem('myFiles', JSON.stringify(data));
}
uploadFile(i, files[i], expire, random, $('#resize').val(), keyGen);
uploadFile(i, files[i], expire, random, $('#resize').val(), keyGen, password, access);
}
}
}
@ -135,8 +144,8 @@ $(function () {
document.body.removeChild( textArea );
}
$('.btn-upload').on('click', upload);
$('.btn-upload').on('click', upload);
$( "#similarServices" ).click(function() {
$('.similarHref').hide();
$('.similarLink').show();
@ -157,8 +166,42 @@ $(function () {
$('#resizeForm').show();
}
}
if (this.files.length == 1) {
$('#uploadOptionAccess').show();
} else {
$('#uploadOptionAccess').hide();
$("#accessCheckbox"). prop("checked", false);
$("#accessForm"). hide();
}
});
$("#passwordCheckbox").on('change',function(){
if( $('#passwordCheckbox').is(':checked') ){
$('#passwordForm').show();
} else {
$('#passwordForm').hide();
}
});
$("#accessCheckbox").on('change',function(){
if( $('#accessCheckbox').is(':checked') ){
$('#accessForm').show();
} else {
$('#accessForm').hide();
}
});
$("#uploadOptionsLinkShow").on('click',function(){
$('#uploadOptions').show();
$('#uploadOptionsLinkShow').hide();
});
$("#uploadOptionsLinkHide").on('click',function(){
$('#uploadOptions').hide();
$('#uploadOptionsLinkShow').show();
});
});

68
my.php Normal file
View file

@ -0,0 +1,68 @@
<?php
if (!isset($_POST['id']) or !isset($_POST['dateExpire'])) {
exit('No hack 1');
}
$id = $_POST['id'];
if (!preg_match('/^[0-9]+-[0-9]{1,2}$/', $id)) {
exit('No Hack ID');
}
$idSplit = explode('-', $id);
$config = yaml_parse_file('./config.yaml');
include('./lib/functions.php');
$uploadDirId=$config['uploadDir'].'/'.$id;
if (is_dir($uploadDirId)) {
$nbFile=0;
$contentType = null;
$contentTypeMultiple = false;
$filesSize=0;
foreach (scandir($uploadDirId) as $file) {
if (is_file($uploadDirId.'/'.$file)
&& $file != $id.'.zip'
&& !preg_match('/^\.(.+)\.cfg$/', $file)
&& !preg_match('/^\.(.+)\.small$/', $file)) {
$nbFile++;
$filesSize=filesize($uploadDirId.'/'.$file)+$filesSize;
$contentTypeNew=mime_content_type($uploadDirId.'/'.$file);
if ($contentType == null) {
$contentType = $contentTypeNew;
} elseif ($contentType != $contentTypeNew) {
$contentTypeMultiple = true;
}
}
}
echo '<tr onclick="location.href=\''.$config['baseUrl'].'/'.$id.'/'.'\'">';
if ($contentTypeMultiple) {
echo '<td><div class="fi fi-size-xs fi-any">
<div class="fi-content">'._('Multi').'</div>
</div></td>';
} else {
$contentTypeSplit = explode('/', $contentType);
echo '<td><div class="fi fi-size-xs fi-'.$contentTypeSplit[1].'">
<div class="fi-content">'.$contentTypeSplit[1].'</div>
</div></td>';
}
echo '<td>'.$nbFile.'</td>';
echo '<td>'.date("Y/m/d", filectime($uploadDirId)).'</td>';
echo '<td>'.date("Y/m/d", $idSplit[0]).'</td>';
echo '<td>'.convertOctect2humain($filesSize).'</td>';
if (is_file($uploadDirId.'/.access.cfg') ) {
echo '<td>'.file_get_contents($uploadDirId.'/.access.cfg').'</td>';
}else{
echo '<td>'._('Unlimited').'</td>';
}
if (is_file($uploadDirId.'/.password.cfg') ) {
echo '<td> '._('Yes').' </td>';
}else{
echo '<td> '._('No').' </td>';
}
echo '<td><a href="'.$config['baseUrl'].'/'.$id.'/'.'">'._('Link').'</a></td>';
echo '</tr>';
}
?>

View file

@ -3,7 +3,12 @@
if (!isset($_POST['expire']) or !isset($_POST['item']) or !isset($_POST['key']) or !isset($_FILES) or !isset($_POST['random'])) {
exit('No hack 1');
}
//~ echo $_POST['access'];
//~ if ($_POST['password'] != 'false') {
//~ echo "post password";
//~ exit($_POST['password']);
//~ }
//~ exit($_POST['access']);
$config = yaml_parse_file('./config.yaml');
include('./lib/functions.php');
@ -29,9 +34,20 @@ if (!is_dir($uploadDir)) {
}
}
}
if (!is_file($uploadDir.'/.key-'.$_POST['key'])) {
touch($uploadDir.'/.key-'.$_POST['key']);
if (!is_file($uploadDir.'/.key-'.$_POST['key'].'.cfg')) {
touch($uploadDir.'/.key-'.$_POST['key'].'.cfg');
}
if ($_POST['access'] != 'false' && preg_match('/^[0-9]+$/', $_POST['access'])) {
if (!is_file($uploadDir.'/.access.cfg')) {
file_put_contents($uploadDir.'/.access.cfg', $_POST['access']);
}
}
if ($_POST['password'] != 'false') {
if (!is_file($uploadDir.'/.password.cfg')) {
file_put_contents($uploadDir.'/.password.cfg', password_hash($config['passwordUniqKey'].$_POST['password'], PASSWORD_DEFAULT));
}
}
if (!checkMimeTypes($_FILES['file']['type'])) {
printf('<div class="highlight-1">'._('this type of file isn\'t allow').'</div>');