[add] count video in download queue

This commit is contained in:
Knah Tsaeb 2013-08-01 14:08:43 +02:00
parent 5d35d493e8
commit 3d9d30a889
7 changed files with 54 additions and 31 deletions

View File

@ -1,6 +0,0 @@
<?php
require 'inc/topMenu.php';
n_print($CONFIG);
?>

9
inc/admin.php Normal file
View File

@ -0,0 +1,9 @@
<?php
if ($_SESSION['log'] !== true) {
die ;
}
require 'inc/topMenu.php';
if (!empty($ci['ac']) && $ci['ac'] === 'viewQueue' && $_SESSION['log'] === true) {
$getQueue = getQueue();
echo 'You have ',$getQueue,' video in download queue.';
}

View File

@ -11,7 +11,7 @@ if (!empty($ci['ac']) && $ci['ac'] === 'login') {
<input type="hidden" name="op" value="2"/>
<input type="hidden" name="ac" value="login"/>
<input type="hidden" name="bc" value="'.$ci['bc'].'" />
<input type="hidden" name="token" value="', genToken(), '"/>
<input type="hidden" name="token" value="', $token, '"/>
<input type="submit" />
</fieldset>
</form>';
@ -25,7 +25,7 @@ if (!empty($ci['ac']) && $ci['ac'] === 'newDir') {
<input type="hidden" name="op" value="1"/>
<input type="hidden" name="ac" value="newDir" />
<input type="hidden" name="bc" value="'.$ci['bc'].'" />
<input type="hidden" name="token" value="', genToken(), '"/>
<input type="hidden" name="token" value="', $token, '"/>
<input type="submit"/>
</fieldset>
</form>';
@ -41,7 +41,7 @@ if (!empty($ci['ac']) && $ci['ac'] === 'renDir') {
<input type="hidden" name="op" value="1"/>
<input type="hidden" name="ac" value="renDir" />
<input type="hidden" name="bc" value="'.$ci['bc'].'" />
<input type="hidden" name="token" value="', genToken(), '"/>
<input type="hidden" name="token" value="', $token, '"/>
<input type="submit"/>
</fieldset>
</form>';
@ -66,7 +66,7 @@ if (!empty($ci['ac']) && $ci['ac'] === 'addVideo') {
<input type="hidden" name="op" value="1"/>
<input type="hidden" name="ac" value="addVideo" />
<input type="hidden" name="bc" value="'.$ci['bc'].'" />
<input type="hidden" name="token" value="', genToken(), '"/>
<input type="hidden" name="token" value="', $token, '"/>
<input type="submit"/>
</fieldset>
</form>';
@ -80,7 +80,7 @@ if (!empty($ci['ac']) && $ci['ac'] === 'addThumbnail') {
<input type="hidden" name="op" value="1"/>
<input type="hidden" name="ac" value="addThumbnail" />
<input type="hidden" name="bc" value="'.$ci['bc'].'" />
<input type="hidden" name="token" value="', genToken(), '"/>
<input type="hidden" name="token" value="', $token, '"/>
<input type="submit"/>
</fieldset>
</form>';
@ -137,7 +137,7 @@ if (!empty($listCurrentFile) && $ci['ac'] !== 'view') {
}
}
echo '</div>';
if ($ci['ac'] === 'view' && !empty($listCurrentFile)) {
if (!empty($ci['ac']) && $ci['ac'] === 'view' && !empty($listCurrentFile)) {
$_SESSION['video'] = $videoInfo['hash'];
if (!empty($videoInfo)) {
if (empty($videoInfo['title'])) {
@ -163,7 +163,6 @@ if ($ci['ac'] === 'view' && !empty($listCurrentFile)) {
echo '</video>';
}
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, '"><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>
@ -188,7 +187,7 @@ if ($ci['ac'] === 'view' && !empty($listCurrentFile)) {
</tr>
<tr>
<th>Url</th>
<td><a href="', htmlentities($videoInfo['url']), '">', $videoInfo['url'], '</a></td>
<td><a href="', htmlentities($videoInfo['url']), '">', $videoInfo['url'], '</a></td>
</tr>
<tr>
<th>Duration</th>
@ -201,7 +200,7 @@ if ($ci['ac'] === 'view' && !empty($listCurrentFile)) {
<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

@ -8,7 +8,7 @@
<label>Password (verification)</label>
<input type="password" name="passwordVerif" required/>
<input type="hidden" name="install" value="install"/>
<input type="hidden" name="token" value="<?php echo genToken(); ?>"/>
<input type="hidden" name="token" value="<?php echo $token; ?>"/>
<input type="submit" />
</fieldset>
</form>

View File

@ -1,15 +1,20 @@
<h1 id="title"><a href="index.php">SoViGall <span>Share your videos ..... in webm</span></a></h1>
<ul id="topMenu">
<?php
if ($_SESSION['log'] === true) {
echo '
<li><a href="?ac=newDir&amp;bc=', $ci['bc'], '">New directory</a></li>
<li><a href="?ac=renDir&amp;bc=', $ci['bc'], '">Rename directory</a></li>
<li><a href="?ac=addVideo&amp;bc=', $ci['bc'], '">Add video</a></li>
<li><a href="?ac=addThumbnail&amp;bc=', $ci['bc'], '">Add thumbnail</a></li>';
<ul class="topMenu">
<li><a href="?ac=viewQueue&amp;token=',$token,'">Download queue</a></li>
</ul>
<ul class="topMenu">
<li><a href="?ac=newDir&amp;bc=', $ci['bc'], '">New directory</a></li>
<li><a href="?ac=renDir&amp;bc=', $ci['bc'], '">Rename directory</a></li>
<li><a href="?ac=addVideo&amp;bc=', $ci['bc'], '">Add video</a></li>
<li><a href="?ac=addThumbnail&amp;bc=', $ci['bc'], '">Add thumbnail</a></li>
</ul>';
} else {
echo '<li><a href="?ac=login&amp;bc=', $ci['bc'], '">Login</a></li>';
echo '<ul class="topMenu">
<li><a href="?ac=login&amp;bc=', $ci['bc'], '">Login</a></li>
</ul>';
}
?>
</ul>
?>

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 />';
@ -251,6 +251,15 @@ function listCurrentDir($breadcrumb) {
return glob("*", GLOB_ONLYDIR);
}
function getQueue() {
$allHash = glob("tmp/*.hash");
if ($allHash) {
return count($allHash);
} else {
return '0';
}
}
function makeBreadcrumb($bc, $fullListDir) {
$bcToArray = str_split($bc, 8);
$nbBc = count($bcToArray);
@ -426,6 +435,13 @@ if (isset($ci['ac']) && !empty($ci['ac'])) {
}
$defineThumb = defineThumb($ci['bc'], $ci['file']);
}
if ($ci['ac'] === 'viewQueue') {
verifToken($ci['token']);
if ($_SESSION['log'] !== true) {
die('Tinker say : Pew Pew Pew Pew Pew Pew Pew Pew Pew Pew Pew Pew');
}
$page = 'admin';
}
}
?>
<!doctype html>
@ -437,6 +453,7 @@ if (isset($ci['ac']) && !empty($ci['ac'])) {
</head>
<body>
<?php
$token = genToken();
if (!isset($page) && empty($page)) {
require 'inc/content.php';
} else {

View File

@ -27,19 +27,18 @@ body {
vertical-align: middle;
}
#topMenu {
margin: 0px;
.topMenu {
margin: 0.5em 0;
padding: 0px;
display: inline-block;
border-radius: 0.2em;
}
#topMenu li {
.topMenu li {
display: inline-block;
padding: 0.3em;
}
#topMenu a {
.topMenu a {
text-decoration: none;
font-weight: bolder;
margin: 0;