[add] admin can delete video

This commit is contained in:
Knah Tsaeb 2013-07-31 12:27:58 +02:00
parent df7bb53581
commit 0e68b3f1eb
7 changed files with 1159 additions and 8 deletions

555
images/delete.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

555
images/useThumbnail.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -165,7 +165,8 @@ if ($ci['ac'] === 'view' && !empty($listCurrentFile)) {
if ($_SESSION['log'] === true) {
$token = genToken();
echo '<div id="toolbar">
<a href="?ac=view&amp;op=3&amp;bc=', $ci['bc'], '&amp;file=', $ci['file'], '&amp;token=', $token, '">Use this thumbnail for folder thumbnail</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;op=4&amp;bc=', $ci['bc'], '&amp;file=', $ci['file'], '&amp;token=', $token, '"><img src="images/delete.svg" alt="Delete this video" title="Delete this video"/></a>
</div>';
}
echo '<table>

View File

@ -161,9 +161,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 +226,19 @@ function addVideo($ci, $fullListFile) {
file_put_contents($GLOBALS['config']['LISTFILE'], "<?php\n\$fullListFile=".var_export($fullListFile, true).";\n?>");
}
function deleteVideo($bc, $file) {
$path = $GLOBALS['config']['VIDEODIR'].'/'.chunk_split($bc, 8, '/');
$pathAndFile = $path.$file;
if (file_exists($pathAndFile) && !is_dir($pathAndFile) && $file === $_SESSION['video'].'.jpg') {
$listFile = (glob($path.$_SESSION['video']."*"));
foreach ($listFile as $value) {
unlink($value);
}
} else {
return 'Error, cannot delete this file.';
}
}
function updateFileTitle($hash, $title) {
global $fullListFile;
$fullListFile[$hash]['title'] = $title;
@ -399,6 +412,13 @@ if (isset($ci['ac']) && !empty($ci['ac'])) {
verifToken($ci['token']);
$addThumbnail = addThumbnail($ci['bc']);
}
if ($ci['ac'] === 'view' && !empty($ci['op']) && (int)$ci['op'] === 4) {
verifToken($ci['token']);
if ($_SESSION['log'] !== true) {
die('Tinker say : You can keep your magic, I have laser beams! ');
}
$deleteVideo = deleteVideo($ci['bc'], $ci['file']);
}
if ($ci['ac'] === 'view' && !empty($ci['op']) && (int)$ci['op'] === 3) {
verifToken($ci['token']);
if ($_SESSION['log'] !== true) {

View File

@ -42,7 +42,7 @@ body {
margin: 0;
padding: 0.4em;
border-radius: 0.2em;
background-color: #000;
background-color: #141414;
}
#breadcrumb {
@ -78,7 +78,7 @@ body {
}
.dir, .video {
background-image: url("folder.svg");
background-image: url("images/folder.svg");
background-repeat: no-repeat;
background-size: 48px;
position: absolute;
@ -89,11 +89,11 @@ body {
}
.video {
background-image: url("video.svg");
background-image: url("images/video.svg");
}
.fulldir {
background-image: url("folder.svg");
background-image: url("images/folder.svg");
background-position: center center;
background-repeat: no-repeat;
background-size: auto 170px;
@ -112,17 +112,24 @@ body {
#viewFile table {
width: 60%;
margin: 0 auto;
border : 0.4em solid #2c2c2c;
padding:0;
border-radius:0.2em;
border-collapse: collapse;
}
#viewFile table tr:nth-child(even) {
background-color: #332A23;
background-color: #2c2c2c;
}
#viewFile th {
padding: 0.3em 0.4em 0.3em 0.3em;
text-align: right;
min-width: 30%;
}
#viewFile td {
padding: 0.3em 0.3em 0.3em 0.4em;
text-align: left;
}
@ -146,4 +153,17 @@ input[type="file"] {
video {
width: 55%;
}
#toolbar {
border-radius: 0.2em;
background-color: #141414;
width: auto;
margin: 0 auto 1.1em auto;
height : 2.3em;
}
#toolbar img {
height:2em;
width : 2em;
}