[add] video can be re-download

This commit is contained in:
Knah Tsaeb 2015-01-30 15:09:21 +01:00
parent 17659173e3
commit c83f4b2388
3 changed files with 557 additions and 9 deletions

534
images/reload.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -141,7 +141,7 @@ if (!empty($breadcrumb)) {
}
echo '</div>';
if (isset($_SESSION['cutFile']) && !empty($_SESSION['cutFile'])) {
echo '<div class="paste"><a href="?bc=', $ci['bc'], '&amp;op=paste&amp;token=', $token, '"><img src="images/paste.svg" alt="Paste here" title="Paste here"/>', substr($fullListFile[$_SESSION['cutFile']]['title'], 0, 22), '...</a></div>';
echo '<div class="paste"><a href="?bc=', $ci['bc'], '&amp;op=paste&amp;token=', $token, '"><img src="images/paste.svg" alt="Paste here" title="Paste here"/>', substr($fullListFile[$_SESSION['cutFile']]['title'], 0, 22), '...</a></div>';
}
if (empty($listCurrentDir) && empty($listCurrentFile)) {
if ($ci['ac'] === 'confDelDir' && isLog()) {
@ -230,6 +230,7 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) {
<a href="?ac=view&amp;bc=', $ci['bc'], '&amp;file=', $ci['file'], '&amp;token=', $token, '&amp;op=cutVideo"><img src="images/cut.svg" alt="Cut this video" title="Cut this video"/></a>
<a href="?ac=view&amp;op=3&amp;bc=', $ci['bc'], '&amp;file=', $ci['file'], '&amp;token=', $token, '"><img src="images/useThumbnail.svg" alt="Use this thumbnail for folder thumbnail" title="Use this thumbnail for folder thumbnail"/></a>
<a href="?ac=view&amp;bc=', $ci['bc'], '&amp;file=', $ci['file'], '&amp;token=', $token, '&amp;op=confDelVideo"><img src="images/delete.svg" alt="Delete this video" title="Delete this video"/></a>
<a href="?ac=view&amp;bc=', $ci['bc'], '&amp;file=', $ci['file'], '&amp;token=', $token, '&amp;op=reDownload"><img src="images/reload.svg" alt="Re-download" title="Re-download"/></a>
</div>';
}
if ($GLOBALS['config']['DOWNLOAD_METHOD'] === 'xsendfile' || $GLOBALS['config']['DOWNLOAD_METHOD'] === 'php') {
@ -267,13 +268,13 @@ if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) {
<td>', $videoInfo['size'], '</td>
<tr>
<th>Publish date</th>
<td>', date("d m Y", strtotime($videoInfo['uploadDate'])), '</td>
<td>', date("d m Y", strtotime($videoInfo['uploadDate'])), '</td>
</tr>
<tr>
<th>Via</th>
<td>';
if (!empty($videoInfo['via'])) {
echo '<a href="', htmlentities($videoInfo['via']), '">', $videoInfo['via'], '</a>';
echo '<a href="', htmlentities($videoInfo['via']), '">', $videoInfo['via'], '</a>';
} else {
echo '';
}

View File

@ -277,9 +277,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 />';
@ -348,7 +348,7 @@ function addVideo($ci, $fullListFile) {
} else {
$path = '';
}
if(isset($ci['ddl']) && (int)$ci['ddl'] === 1){
if (isset($ci['ddl']) && (int)$ci['ddl'] === 1) {
$ddl = 1;
} else {
$ddl = 0;
@ -365,6 +365,12 @@ function addVideo($ci, $fullListFile) {
file_put_contents($GLOBALS['config']['LISTFILE'], "<?php\n\$fullListFile=".var_export($fullListFile, true).";\n?>");
}
function redownloadVideo($bc, $file){
$path = $GLOBALS['config']['VIDEODIR'].'/'.chunk_split($bc, 8, '/');
$pathAndFile = $path.$file;
rename($pathAndFile.'.hash', $GLOBALS['config']['TMPDIR'].'/'.$file.'.hash');
}
function deleteVideo($bc, $file) {
$path = $GLOBALS['config']['VIDEODIR'].'/'.chunk_split($bc, 8, '/');
$pathAndFile = $path.$file;
@ -486,7 +492,7 @@ function makeRss($breadcrumb, $fullListFile) {
<link>http://'.$_SERVER['HTTP_HOST'].'</link>';
foreach ($allFile as $value) {
$oriValues = $value;
$hash = substr(str_replace('.webm','',$oriValues),-10, 10);
$hash = substr(str_replace('.webm', '', $oriValues), -10, 10);
$rss .= '
<item>
<title>'.html_entity_decode($fullListFile[$hash]['title'], ENT_QUOTES, "UTF-8").'</title>
@ -522,8 +528,8 @@ function getVideoInfo($file, $dir, $fullListFile) {
$size = $jsonSize[0].'x'.$jsonSize[1];
$time = gmdate('H\hi\ms\s', $jsonInfo -> duration);
$uploadDate = htmlentities($jsonInfo -> upload_date, ENT_QUOTES, "UTF-8");
if(empty($uploadDate)){
$uploadDate = gmdate ("Ymd", filemtime($GLOBALS['config']['VIDEODIR']."/".$path.$file.".webm"));
if (empty($uploadDate)) {
$uploadDate = gmdate("Ymd", filemtime($GLOBALS['config']['VIDEODIR']."/".$path.$file.".webm"));
}
$info = array(
'hash' => $file,
@ -788,6 +794,13 @@ if (isset($ci['ac']) && !empty($ci['ac'])) {
die('Tinker say : Blinded you, with Science! ');
}
cutVideo($ci['bc'], $ci['file']);
}
if ($ci['ac'] === 'view' && !empty($ci['op']) && $ci['op'] === 'reDownload') {
verifToken($ci['token']);
if (!isLog()) {
die('Tinker say : Blinded you, with Science! ');
}
reDownloadVideo($ci['bc'], $ci['file']);
}
if ($ci['ac'] === 'viewQueue' || $ci['ac'] === 'clearCache') {
verifToken($ci['token']);