|
@@ -0,0 +1,431 @@
|
|
|
+<?php
|
|
|
+define('VERSION', '0.1');
|
|
|
+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');
|
|
|
+include('./lib/functions.php');
|
|
|
+
|
|
|
+if (isset($_GET['id'])){
|
|
|
+ $id = $_GET['id'];
|
|
|
+ if (!preg_match('/^[0-9]+-[0-9]{1,2}$/', $id)) {
|
|
|
+ exit('No Hack ID');
|
|
|
+ }
|
|
|
+} else {
|
|
|
+ $id = null;
|
|
|
+}
|
|
|
+
|
|
|
+if (convertHumain2octect($config['maxUploadPerFile']) > convertHumain2octect(ini_get('upload_max_filesize'))) {
|
|
|
+ exit(printf(_('In coherence with your configuration (config.yaml) you must increase the PHP configuration upload_max_filesize to %s'), $config['maxUploadPerFile']));
|
|
|
+}
|
|
|
+if (convertHumain2octect($config['maxUploadPerFile']) > convertHumain2octect(ini_get('post_max_size'))) {
|
|
|
+ exit(printf(_('In coherence with your configuration (config.yaml) you must increase the PHP configuration post_max_size to %s'), $config['maxUploadPerFile']));
|
|
|
+}
|
|
|
+if (convertHumain2octect($config['maxUploadNb']) > convertHumain2octect(ini_get('max_file_uploads'))) {
|
|
|
+ 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();
|
|
|
+}
|
|
|
+// 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++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($nbFile == 0) {
|
|
|
+ rrmdir($config['uploadDir'].'/'.$id.'/');
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // Si c'est le dossier
|
|
|
+ rrmdir($config['uploadDir'].'/'.$id.'/');
|
|
|
+ $nbFile = 0;
|
|
|
+ }
|
|
|
+ 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>
|
|
|
+ <head>
|
|
|
+ <meta charset="UTF-8" />
|
|
|
+ <title>Upload</title>
|
|
|
+ <script src="<?= $config['baseUrl'] ?>lib/jquery-3.1.0.min.js"></script>
|
|
|
+ <script>
|
|
|
+ var Config_baseUrl = '<?= $config['baseUrl'] ?>'
|
|
|
+ var Config_maxUploadPerFile = <?= convertHumain2octect($config['maxUploadPerFile']) ?>
|
|
|
+ var Config_maxUploadTotal = <?= convertHumain2octect($config['maxUploadTotal']) ?>
|
|
|
+ var Config_maxUploadNb = <?= $config['maxUploadNb'] ?>
|
|
|
+ var Config_mimeTypesConduct = '<?= $config['mimeTypesConduct'] ?>'
|
|
|
+ var Config_mimeTypes = ['helloWorld'<?php foreach ($config['mimeTypes'] as $mimeTypes) { echo ', \''.$mimeTypes.'\'' ; } ?>];
|
|
|
+ var Msg_errorFileSize = '<?php printf(_('this file exceeds the allowed size %s'), $config['maxUploadPerFile']) ?>';
|
|
|
+ var Msg_errorTotalSize = '<?php printf(_('The total size of the files exceeds the allowed size : %s'), $config['maxUploadTotal']) ?>';
|
|
|
+ var Msg_errorUploadNb = '<?php printf(_('You can not send more than %d files at a time'), $config['maxUploadNb']) ?>';
|
|
|
+ var Msg_errorFileType = '<?php printf(_('this type of file isn\\\'t allow')) ?>';
|
|
|
+ </script>
|
|
|
+ <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="/favicon-32x32.png">
|
|
|
+ <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
|
|
+ <link rel="manifest" href="/site.webmanifest">
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <div id="langues">
|
|
|
+ <a href="https://crwd.in/calcpvautonome"><img class="drapeau" src="./lib/trad.png" alt="Help to translate" /></a>
|
|
|
+ </div>
|
|
|
+ <div id="languesLegende" style="display: none"></div>
|
|
|
+ <div id="page-wrap">
|
|
|
+ <?php @include_once('./header-page.php'); ?>
|
|
|
+ <?php
|
|
|
+ $similarServicesLink='';
|
|
|
+ if ($config['similarServicesView']) {
|
|
|
+ $similarServicesLink='<div class="similarServices">
|
|
|
+ <div class="similarHref"><a href="#similarServices" id="similarServices">'._('Similar services').'</a></div>
|
|
|
+ <div class="similarLink">';
|
|
|
+ foreach ($config['similarServicesLink'] as $link) {
|
|
|
+ $similarServicesLink.=$link.' ';
|
|
|
+ }
|
|
|
+ $similarServicesLink.='</div>
|
|
|
+ </div>';
|
|
|
+ }
|
|
|
+ $uploadDirId=$config['uploadDir'].'/'.$id;
|
|
|
+ $action = null;
|
|
|
+ if (isset($_GET['action'])) {
|
|
|
+ $action = $_GET['action'];
|
|
|
+ }
|
|
|
+ if (!is_writable($config['uploadDir'])) {
|
|
|
+ $action = 'ErrorUploadDir';
|
|
|
+ }
|
|
|
+ if ($action == 'html' && !is_dir($config['uploadDir'].'/'.$id)) {
|
|
|
+ $action = '404';
|
|
|
+ }
|
|
|
+ if (!$config['htmlPages'] && $action == 'page') {
|
|
|
+ $action = '404';
|
|
|
+ }
|
|
|
+ $echoNewUpload = '<div class="newUpload"><a href="'.$config['baseUrl'].'"><img src="'.$config['baseUrl'].'/lib/upload.svg" /></a>
|
|
|
+ <a class="myFiles" href="'.$config['baseUrl'].'/My"><img src="'.$config['baseUrl'].'/lib/folder.svg" /></a>
|
|
|
+ '.$similarServicesLink.'</div>
|
|
|
+ <script>
|
|
|
+ if (localStorage.getItem(\'myFiles\')) {
|
|
|
+ $(\'.myFiles\').show();
|
|
|
+ }
|
|
|
+ </script>';
|
|
|
+ switch ($action) {
|
|
|
+ case 'ErrorUploadDir':
|
|
|
+ echo '<div class="highlight-1">';
|
|
|
+ printf(_('Error: The directory (%s) is not writable, please contact the service administrator'), $config['uploadDir']);
|
|
|
+ echo '</div>';
|
|
|
+ break;
|
|
|
+ case 'page':
|
|
|
+ foreach ($config['htmlPages'] as $fileName => $name) {
|
|
|
+ if ($_GET['name'] == $fileName) {
|
|
|
+ $page['fileName'] = $fileName;
|
|
|
+ $page['name'] = $name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (empty($page['name'])) {
|
|
|
+ echo '<p>'._('The requested page does not exist').'</p>';
|
|
|
+ } elseif (!is_file('htmlPages/'.$page['fileName'].'.html')) {
|
|
|
+ echo '<p>'._('The requested page does not exist').'</p>';
|
|
|
+ } else {
|
|
|
+ include('htmlPages/'.$page['fileName'].'.html');
|
|
|
+ }
|
|
|
+ echo $echoNewUpload;
|
|
|
+ break;
|
|
|
+ case 'html':
|
|
|
+ echo '<h1>'.$config['shortTitle'].' : '.$config['title'].'</h1>';
|
|
|
+ $expire=explode('-', $id);
|
|
|
+ $dateExpire=date('d/m/Y H:m', $expire[0]);
|
|
|
+ $dStart = new DateTime(date('Y-m-d', $expire[0]));
|
|
|
+ $dEnd = new DateTime(date('Y-m-d'));
|
|
|
+ $dDiff = $dStart->diff($dEnd);
|
|
|
+ $dayExpire = $dDiff->format('%a');
|
|
|
+ $classExpire ='';
|
|
|
+ if ($dayExpire < 2) {
|
|
|
+ $classExpire='verySpeedDownload';
|
|
|
+ }elseif ($dayExpire < 5) {
|
|
|
+ $classExpire='speedDownload';
|
|
|
+ }
|
|
|
+ printf('<p class="'.$classExpire.'">'._('These files will be automatically deleted on %s, ie in %d days').'</p>', $dateExpire, $dayExpire);
|
|
|
+ $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)) {
|
|
|
+ $filesInUploadDirId[]=$file;
|
|
|
+ $nbFile++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($nbFile == 0) {
|
|
|
+ echo '<p>'._('Error: Nothing to display').'</p>';
|
|
|
+ } elseif ($nbFile == 1) {
|
|
|
+ echo '<div class="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="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> <input class="copy read fileAll" name="read" type="text" value="'.$config['baseUrl'].$id.'/" readonly=""></div>';
|
|
|
+ echo '<div class="file fileAll dl input"><a href="'.$linkDownload.'" target="_blank"><img src="'.$config['baseUrl'].'/lib/download.svg"</a> /><input class="copy dl fileAll" name="dl" type="text" value="'.$linkDownload.'" readonly=""></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>';
|
|
|
+ }
|
|
|
+ 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> <input class="copy read file'.$idFile.'" name="read" type="text" value="'.$config['baseUrl'].$id.'/'.$fileInUploadDirId.'" readonly=""></div>';
|
|
|
+ echo '<div class="file file'.$idFile.' dl input"><a href="'.$linkDownload.'" target="_blank"><img src="'.$config['baseUrl'].'/lib/download.svg" /></a> <input class="copy dl file'.$idFile.'" name="dl" type="text" value="'.$linkDownload.'" readonly=""></div>';
|
|
|
+ echo '</div>';
|
|
|
+ $idFile++;
|
|
|
+ }
|
|
|
+ echo $echoNewUpload;
|
|
|
+ ?>
|
|
|
+ <script>
|
|
|
+ if (localStorage.getItem('myFiles')) {
|
|
|
+ var storageMyFiles = JSON.parse(localStorage.getItem('myFiles'));
|
|
|
+ if (storageMyFiles.items.filter(function(e) { return e.id === '<?= $id ?>'; }).length > 0) {
|
|
|
+ var searchWithId = storageMyFiles.items.filter(function(e) { return e.id === '<?= $id ?>'; })
|
|
|
+ var keyForThis = Object.values(searchWithId[0])[1];
|
|
|
+ $('.deleteAll').show();
|
|
|
+ $('.delete').show();
|
|
|
+ var links = $('.deleteLink');
|
|
|
+ for(var i = 0; i< links.length; i++){
|
|
|
+ var oldLink = links[i].href;
|
|
|
+ var newLink = oldLink.replace('KEYHERE', keyForThis);
|
|
|
+ links[i].href = newLink;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+ <?php
|
|
|
+ break;
|
|
|
+ case 'myFiles':
|
|
|
+ ?>
|
|
|
+ <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>
|
|
|
+ <script>
|
|
|
+ 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++) {
|
|
|
+ var idSplit=storageMyFiles.items[i].id.split("-");
|
|
|
+ var timestampNow = Number(new Date());
|
|
|
+ var timestampExpire = idSplit[0]*1000;
|
|
|
+ // 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';
|
|
|
+ var fileNotExpire=fileNotExpire+1;
|
|
|
+ // 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));
|
|
|
+ var tablePrepar = tablePrepar + '</table>';
|
|
|
+ $('#myFilesArea').html(tablePrepar);
|
|
|
+ } 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>');
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+ <?php
|
|
|
+ echo $echoNewUpload;
|
|
|
+ break;
|
|
|
+ case '403':
|
|
|
+ echo '<h1>'.$config['shortTitle'].' : 403 '._('Unauthorized access').'</h1>';
|
|
|
+ echo '<p>'._('Unauthorized access').'</p>';
|
|
|
+ echo $echoNewUpload;
|
|
|
+ break;
|
|
|
+ case '404':
|
|
|
+ echo '<h1>'.$config['shortTitle'].' : 404 '._('Not Found').'</h1>';
|
|
|
+ echo '<p>'._('This sharing does not exist, it has probably expired').'</p>';
|
|
|
+ echo $echoNewUpload;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+
|
|
|
+ ?>
|
|
|
+
|
|
|
+ <h1><?= $config['shortTitle'] ?> : <?= $config['title'] ?></h1>
|
|
|
+ <?php @include_once('./start-home.php'); ?>
|
|
|
+ <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="preUpload"></div>
|
|
|
+ <!-- For upload results -->
|
|
|
+ <div id="result"></div>
|
|
|
+
|
|
|
+ <div class="uploadArea">
|
|
|
+ <div id="uploadInput"><input type="file" id="files" name="files[]" multiple/></div>
|
|
|
+ <div class="newUpload"><img class="btn-upload" src="<?= $config['baseUrl'] ?>/lib/upload.svg" />
|
|
|
+ <a class="myFiles" href="<?= $config['baseUrl'] ?>/My"><img src="<?= $config['baseUrl'] ?>/lib/folder.svg" /></a>
|
|
|
+ <script>
|
|
|
+ if (localStorage.getItem('myFiles')) {
|
|
|
+ $('.myFiles').show();
|
|
|
+ }
|
|
|
+ </script></div>
|
|
|
+ <div><?= _('Expire') ?> : <select name="expire" id="expire">
|
|
|
+ <?php
|
|
|
+ foreach ($config['expireDay'] as $expireDay) {
|
|
|
+ if ($expireDay == $config['expireDayDefault']) {
|
|
|
+ echo '<option value="'.$expireDay.'" selected="selected">'.$expireDay.' '._('day').'</option>';
|
|
|
+ } else {
|
|
|
+ echo '<option value="'.$expireDay.'" >'.$expireDay.' '._('day').'</option>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ </select></div>
|
|
|
+ <div id="resizeForm"><?= _('Images resize') ?> : <select name="resize" id="resize">
|
|
|
+ <?php
|
|
|
+ foreach ($config['imageResize'] as $imageResize) {
|
|
|
+ $imageResizeName = $imageResize.'px';
|
|
|
+ if ($imageResize == 0) {
|
|
|
+ $imageResizeName = _('No resizing');
|
|
|
+ }
|
|
|
+ if ($imageResize == $config['imageResizeDefault']) {
|
|
|
+ echo '<option value="'.$imageResize.'" selected="selected">'.$imageResizeName.'</option>';
|
|
|
+ } else {
|
|
|
+ echo '<option value="'.$imageResize.'" >'.$imageResizeName.'</option>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ </select></div>
|
|
|
+ <div class="limit"><?php printf(_('The limit per file is %dM, and the total limit per upload is %dM'), $config['maxUploadPerFile'], $config['maxUploadTotal']); ?></div>
|
|
|
+ <?= $similarServicesLink ?>
|
|
|
+ </div>
|
|
|
+ <!-- For progress bars -->
|
|
|
+ <div class="progress"></div>
|
|
|
+ <?php
|
|
|
+ @include_once('./end-home.php');
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ <div id="footer">
|
|
|
+ <p class="footer_right"><?= _('By') ?> <a href="http://david.mercereau.info/">David Mercereau</a> (<a href="https://framagit.org/kepon/CalcPvAutonome"><?= _('Git repository') ?></a>)</p>
|
|
|
+ <p class="footer_left">file2link <?= _('version') ?> <?= VERSION ?> <?= _('is an open software licensed <a href="https://en.wikipedia.org/wiki/Beerware">Beerware</a>') ?></p>
|
|
|
+ <?php
|
|
|
+ if ($config['htmlPages']) {
|
|
|
+ echo '<p class="footer_htmlPages">';
|
|
|
+ foreach ($config['htmlPages'] as $fileName => $name) {
|
|
|
+ echo ' <a href="'.$config['baseUrl'].$fileName.'.html">'.$name.'</a> ';
|
|
|
+ }
|
|
|
+ echo '</p>';
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ </div>
|
|
|
+ <?= CheckUpdate(); ?>
|
|
|
+ <?php @include_once('./footer-page.php'); ?>
|
|
|
+ </div>
|
|
|
+ <div id="bg">
|
|
|
+ <img src="<?= $config['backgroundImage'] ?>" alt="">
|
|
|
+ </div>
|
|
|
+ </body>
|
|
|
+</html>
|
|
|
+<?php
|
|
|
+if ($config['expireCron'] == 'web') {
|
|
|
+ if (is_file($config['uploadDir'].'/.cronWeb')) {
|
|
|
+ if (file_get_contents($config['uploadDir'].'/.cronWeb')+$config['expireCronFreq'] < time()) {
|
|
|
+ cronExpire();
|
|
|
+ file_put_contents($config['uploadDir'].'/.cronWeb', time());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ file_put_contents($config['uploadDir'].'/.cronWeb', time());
|
|
|
+ }
|
|
|
+}
|
|
|
+@include_once('./footer.php');
|
|
|
+?>
|
|
|
+
|