[add] link for dl file
[add] add original title if personal title not exist
This commit is contained in:
parent
82eb63458b
commit
3f38ac2014
|
@ -121,9 +121,11 @@ if (!empty($listCurrentFile) && $ci['ac'] !== 'view') {
|
|||
}
|
||||
echo '</div>';
|
||||
if ($ci['ac'] === 'view' && !empty($listCurrentFile)) {
|
||||
$_SESSION['video'] = $videoInfo['hash'];
|
||||
if (!empty($videoInfo)) {
|
||||
if (empty($videoInfo['title'])) {
|
||||
$fullTitle = $videoInfo['originalTitle'];
|
||||
updateFileTitle($videoInfo['hash'],$fullTitle);
|
||||
} else {
|
||||
$fullTitle = $videoInfo['title'].' ('.$videoInfo['originalTitle'].')';
|
||||
}
|
||||
|
@ -180,13 +182,16 @@ if ($ci['ac'] === 'view' && !empty($listCurrentFile)) {
|
|||
} else {
|
||||
echo '';
|
||||
}
|
||||
echo '
|
||||
</td>
|
||||
echo '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Licence</th>
|
||||
<td>', $videoInfo['licence'], '</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Download</th>
|
||||
<td><a href="?bc=',$ci['bc'],'&dl=',$videoInfo['hash'],'">Download</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>';
|
||||
}
|
||||
|
|
39
index.php
39
index.php
|
@ -96,6 +96,28 @@ $GLOBALS[\'loginName\'][\'password\'] = \''.$GLOBALS['loginName']['password'].'\
|
|||
return $page;
|
||||
}
|
||||
|
||||
function sendVideo($bc, $file) {
|
||||
if ($file !== $_SESSION['video']) {
|
||||
return;
|
||||
}
|
||||
global $fullListFile;
|
||||
$path = chunk_split($bc, 8, '/');
|
||||
$fileName = html_entity_decode($fullListFile[$file]['title']);
|
||||
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Type: application/octet-stream');
|
||||
header("Content-Disposition: attachment; filename=\"$fileName\"");
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate');
|
||||
header('Pragma: public');
|
||||
header('Content-Length: '.filesize($GLOBALS['config']['VIDEODIR'].'/'.$path.$file.'.webm'));
|
||||
ob_clean();
|
||||
flush();
|
||||
readfile($path.$file);
|
||||
exit ;
|
||||
}
|
||||
|
||||
function checkSecure() {
|
||||
}
|
||||
|
||||
|
@ -161,9 +183,9 @@ function n_print($data, $name = '') {
|
|||
<fieldset style="border: 1px solid orange; padding: 5px;color:#1E1915; background-color: #fff;">';
|
||||
echo '
|
||||
<legend style="border:1px solid orange;padding: 1px;background-color:#eee;color:orange;">
|
||||
', basename($aBackTrace[0]['file']), ' ligne => ', $aBackTrace[0]['line'], '
|
||||
', basename($aBackTrace[0]['file']), ' ligne => ', $aBackTrace[0]['line'], '
|
||||
</legend>';
|
||||
echo '<pre style="color:#1E1915;">', htmlentities(print_r($data, 1)), '</pre>';
|
||||
echo '<pre style="color:#1E1915;">', htmlentities(print_r($data, 1)), '</pre>';
|
||||
echo '
|
||||
</fieldset>
|
||||
<br />';
|
||||
|
@ -226,6 +248,13 @@ function addVideo($ci, $fullListFile) {
|
|||
file_put_contents($GLOBALS['config']['LISTFILE'], "<?php\n\$fullListFile=".var_export($fullListFile, true).";\n?>");
|
||||
}
|
||||
|
||||
function updateFileTitle($hash, $title) {
|
||||
global $fullListFile;
|
||||
$fullListFile[$hash]['title'] = $title;
|
||||
chdir($_SERVER['DOCUMENT_ROOT']);
|
||||
file_put_contents($GLOBALS['config']['LISTFILE'], "<?php\n\$fullListFile=".var_export($fullListFile, true).";\n?>");
|
||||
}
|
||||
|
||||
function listCurrentDir($breadcrumb) {
|
||||
chdir($breadcrumb);
|
||||
return glob("*", GLOB_ONLYDIR);
|
||||
|
@ -301,7 +330,7 @@ if (!empty($ci['ac']) && $ci['ac'] === 'login' && !empty($ci['op']) && (int)$ci[
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($ci['ac'])) {
|
||||
if (isset($ci['ac']) && !empty($ci['ac'])) {
|
||||
if ($ci['ac'] === 'renDir' && !empty($ci['op']) && (int)$ci['op'] === 1) {
|
||||
verifToken($ci['token']);
|
||||
$renDir = renDir($ci['renDir'], $ci['bc'], $fullListDir);
|
||||
|
@ -320,6 +349,10 @@ if (!empty($ci['ac'])) {
|
|||
$addVideo = addVideo($ci, $fullListFile);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($ci['dl']) && !empty($ci['dl'])) {
|
||||
sendVideo($ci['bc'], $ci['dl']);
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="fr">
|
||||
|
|
Loading…
Reference in New Issue