[add] logout link

[add] absolute path for new video add
[add] breadcrumb in admin page
This commit is contained in:
Knah Tsaeb 2013-08-13 10:03:40 +02:00
parent f49dec12fa
commit 4b6da04484
3 changed files with 45 additions and 7 deletions

View File

@ -13,4 +13,38 @@ if (!empty($ci['ac']) && $ci['ac'] === 'clearCache' && $_SESSION['log'] === true
} else {
echo 'Error on delete cache.';
}
}
}
if (empty($ci['bc'])) {
$path = $GLOBALS['config']['VIDEODIR'].'/';
} else {
$splitBc = chunk_split($ci['bc'], 8, '/');
$path = $GLOBALS['config']['VIDEODIR'].'/'.$splitBc;
$breadcrumb = makeBreadcrumb($ci['bc'], $fullListDir);
$nbBread = count($breadcrumb);
}
$listCurrentDir = listCurrentDir($path);
$listCurrentFile = listVideo($path);
if (!empty($listCurrentFile) && count($listCurrentFile) > 1 && $ci['ac'] !== 'view') {
echo '<div id="sort">
<ul>
<li><a href="?bc=', $ci['bc'], '&amp;sort=date">Date</a></li>
<li><a href="?bc=', $ci['bc'], '&amp;sort=name">Name</a></li>
</ul>
</div>';
}
echo '<div id="breadcrumb">';
$i = 1;
echo '<a href="?">Home</a> >>';
if (!empty($breadcrumb)) {
foreach ($breadcrumb as $key => $value) {
if ($i === $nbBread) {
echo '<a href="?bc=', $key, '">', $value, '</a>';
} else {
echo '<a href="?bc=', $key, '">', $value, '</a> >> ';
}
$i++;
}
}
echo '</div>';

View File

@ -4,10 +4,11 @@
if ($_SESSION['log'] === true) {
echo '
<ul class="topMenu">
<li><a href="?ac=viewQueue&amp;token=',$token,'">Download queue</a></li>
<li><a href="?ac=clearCache&amp;token=',$token,'">Clear cache</a></li>
<li><a href="?ac=viewQueue&amp;bc=',$ci['bc'],'&amp;token=',$token,'">Download queue</a></li>
<li><a href="?ac=clearCache&amp;bc=',$ci['bc'],'&amp;token=',$token,'">Clear cache</a></li>
<li><a href="?ac=export&amp;bc=',$ci['bc'],'&amp;token=',$token,'">Export current dir</a></li>
<li><a href="?ac=importDirForm&amp;bc=',$ci['bc'],'&amp;token=',$token,'">Import dir here</a></li>
<li><a href="?ac=logout&amp;bc=',$ci['bc'],'&amp;token=',$token,'">Logout</a></li>
</ul>
<ul class="topMenu">
<li><a href="?ac=newDir&amp;bc=', $ci['bc'], '">New directory</a></li>

View File

@ -134,6 +134,7 @@ Options -Indexes';
}
function logout() {
session_unset();
}
function getCurrentDir($bc) {
@ -237,7 +238,6 @@ function importDir($bc, $fullListDir, $fullListFile) {
'licence' => $value['licence'],
'uploadDateSort' => $value['uploadDateSort']
);
$url = escapeshellcmd($value['url']);
$data = $key.' '.$url.' '.$_SERVER['DOCUMENT_ROOT'].'/'.$GLOBALS['config']['VIDEODIR'].'/'.$path.$file['hash']."\n";
file_put_contents($GLOBALS['config']['TMPDIR'].'/'.$key.'.hash', $data);
@ -285,9 +285,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 />';
@ -352,7 +352,7 @@ function addVideo($ci, $fullListFile) {
$nameHash = substr(sha1($ci['name'].$ci['url']), 0, 10);
$url = escapeshellcmd($ci['url']);
$path = chunk_split($ci['bc'], 8, '/');
$data = $nameHash.' '.$url.' '.$path."\n";
$data = $nameHash.' '.$url.' '.$_SERVER['DOCUMENT_ROOT'].'/'.$GLOBALS['config']['VIDEODIR'].'/'.$path."\n";
file_put_contents($GLOBALS['config']['TMPDIR'].'/'.$nameHash.'.hash', $data);
$fullListFile[$nameHash] = array(
'title' => $ci['name'],
@ -749,6 +749,9 @@ if ($ci['ac'] === 'importDir' && $ci['op'] === '1') {
}
importDir($ci['bc'], $fullListDir, $fullListFile);
}
if ($ci['ac'] === 'logout') {
logout();
}
?>
<!doctype html>
<html lang="fr">