'; $lang_from_http_accept = explode(',', $HTTP_ACCEPT_LANGUAGE); //echo $lang_from_http_accept[0].'
'; $locale = lang2locale($lang_from_http_accept[0]); if (substr($locale,0,2) != substr($lang_from_http_accept[0],0,2)) { //echo "Non trouvé, 2ème tentative"; $lang_from_http_accept = explode('-', $lang_from_http_accept[0]); //echo $lang_from_http_accept[0].'
'; $locale = lang2locale($lang_from_http_accept[0]); } //echo $locale.'
'; $localeshort=locale2lang($locale); } } // Définition de la langue : $results=putenv("LC_ALL=$locale.utf8"); if (!$results) { exit ('putenv failed'); } $results=putenv("LC_LANG=$locale.utf8"); if (!$results) { exit ('putenv failed'); } $results=putenv("LC_LANGUAGE=$locale.utf8"); if (!$results) { exit ('putenv failed'); } $results=setlocale(LC_ALL, "$locale.utf8"); if (!$results) { exit ('setlocale failed: locale function is not available on this platform, or the given local does not exist in this environment'); } bindtextdomain("messages", "./lang"); textdomain("messages"); /* / language */ 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'])); } // 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]; } $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); } } } } 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'); // Checksum $checksum = new Checksum(); $deleteFile = $checksum->deleteFile($config['uploadDir'].'/'.$id.'/'.$_GET['file']); //error_log('checksum>deleteFile : '.$config['uploadDir'].'/'.$id.'/'.$_GET['file']); //error_log('checksum>deleteFile return : '.json_encode($deleteFile)); if ($deleteFile != true) { exit("deleteFile : ".json_encode($deleteFile)); } // 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'); ?> <?= $config['shortTitle'] ?> : <?= $config['title'] ?>
$lang) { $flag=''; if ($localeshort == $langShort) { $flag=' drapeauActif'; } echo ''.$langShort.''; } ?>
'._('Maintenance').''; echo '

'.$config['maintenanceMsg'].'

'; } else { // signaler au mainteneur que le mode maintenance est à true if ($config['maintenanceMod'] == true) { echo '

'._('Mode Maintenance as true').'

'; } @include_once('./header-page.php'); $similarServicesLink=''; if ($config['similarServicesView']) { //~ $similarServicesLink='
//~ //~
'; $similarServicesLink='
'._('Similar services').' :
'; $similarServicesLink.= ''; $similarServicesLink.= '

'; $similarServicesLink.='
'; } $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'; } if ($passwordForm == true) { $action = 'password'; } $echoNewUploadPub = '
'._('Send / share your files').'
'; $echoNewUpload = '
'._('Expire').' :
'._('Add files...').'
Redirect to '.$config['baseUrl'].'/ in progress...
'. _('The total limit per upload is ').$config['maxUploadTotal'] .'
 
'._('The sharing will be accessible from').' :
'._('Options').' ⇂
'._('Options').' ↾

'._('Images resize').' :

'._('Protect with password').' :

'._('Delete after access').' :

'. _('The limit per file is ').$config['maxUploadPerFile'] .'

'. _('The total limit per upload is ').$config['maxUploadTotal'] .'

'; switch ($action) { case 'ErrorUploadDir': echo '
'; printf(_('Error: The directory (%s) is not writable, please contact the service administrator'), $config['uploadDir']); echo '
'; break; case 'password': echo '

'.$config['shortTitle'].' : '.$config['title'].'

'; echo $echoNewUploadPub; if (isset($_POST['password']) && $passwordInvalid == true) { echo '
'; echo _('Error: Incorrect password'); echo '
'; } echo '
'; echo '

'._('This file is protected by a password, thank you to indicate it below').'

'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo $echoNewUpload; break; case 'page': foreach ($config['htmlPages'] as $fileName => $name) { if ($_GET['name'] == $fileName) { $page['fileName'] = $fileName; $page['name'] = $name; } } if (empty($page['name'])) { echo '

'._('The requested page does not exist').'

'; } elseif (!is_file('htmlPages/'.$page['fileName'].'.html')) { echo '

'._('The requested page does not exist').'

'; } else { include('htmlPages/'.$page['fileName'].'.html'); } echo $echoNewUpload; break; case 'html': echo '

'.$config['shortTitle'].' : '.$config['title'].'

'; echo $echoNewUploadPub; $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('

'._('These files will be automatically deleted on %s, ie in %d days').'

', $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('

'._('These files will be automatically deleted in %d access').'

', $nbAccess); } $nbFile=0; $nbImageFile=0; foreach (scandir($uploadDirId) as $file) { if (is_file($uploadDirId.'/'.$file) && $file != $id.'.zip' && !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 '
'; if (isset($_GET['gallery'])) { echo ''._('View in list mode ').''; } else { echo ''._('View in gallery mode ').''; } echo '
'; } if ($nbFile == 0) { echo '

'._('Error: Nothing to display').'

'; } elseif ($nbFile == 1) { $linkDownload=$config['baseUrl'].$id.'/'; echo '
'; echo '
html
'; echo ''; echo '
'; echo '
'; } if (isset($_GET['gallery'])) { echo '
'; $idFile=0; foreach ($filesInUploadDirId as $fileInUploadDirId) { $pathInfo = pathinfo($uploadDirId.'/'.$fileInUploadDirId); $linkDownload=$config['baseUrl'].'dl/'.$id.'/'.$fileInUploadDirId; echo '
'; echo '
'; 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' , 330, 330); } if (is_file($pathInfo['dirname'].'/.'.$pathInfo['basename'].'.gallery.small')) { echo '
'; } else { echo '
'.$pathInfo['extension'].'
'; } } else { echo '
'.$pathInfo['extension'].'
'; } echo '
'; echo '
'; } echo '
'; } if ($nbFile > 1) { $linkDownload=$config['baseUrl'].$id.'.zip'; echo '
'; echo '
zip
'; echo ''; echo '
'; if ($nbImageFile == $nbFile) { echo '
'; } echo '
'; echo '
'; } if (!isset($_GET['gallery'])) { $idFile=0; echo '
'; foreach ($filesInUploadDirId as $fileInUploadDirId) { $pathInfo = pathinfo($uploadDirId.'/'.$fileInUploadDirId); $linkDownload=$config['baseUrl'].'dl/'.$id.'/'.$fileInUploadDirId; echo '
'; echo ''; echo '
'; 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 '
'; } else { echo '
'.$pathInfo['extension'].'
'; } } else { echo '
'.$pathInfo['extension'].'
'; } echo '
'; echo ''; echo '
'; echo ''._('Size').' : '.convertOctect2humain(filesize($pathInfo['dirname'].'/'.$pathInfo['basename'])).' '; echo ''._('Type').' : '.mime_content_type($pathInfo['dirname'].'/'.$pathInfo['basename']).' '; //echo ''._('Type').' : '.mime_content_type($pathInfo['dirname'].'/'.$pathInfo['basename']).' '; echo '
'; echo '
'; echo '
'; echo '
'; $idFile++; } echo '
'; } echo '

'._('Add files to this share').'

'; echo $echoNewUpload; echo '
'; ?>

:

free of rights (license Beerware) and free.') ?>

-
'.$config['shortTitle'].' : 403 '._('Unauthorized access').''; echo $echoNewUploadPub; echo '

'._('Unauthorized access').'

'; echo $echoNewUpload; break; case '404': echo '

'.$config['shortTitle'].' : 404 '._('Not Found').'

'; echo $echoNewUploadPub; echo '

'._('This sharing does not exist, it has probably expired').'

'; echo $echoNewUpload; break; default: ?>

:

free of rights (license Beerware) and free.') ?>