177 lines
5.6 KiB
PHP
177 lines
5.6 KiB
PHP
<?php
|
|
|
|
#todo n_print(chunk_split($text,8,'/'));
|
|
|
|
require 'inc/topMenu.php';
|
|
if (!empty($ci['ac']) && $ci['ac'] === 'login') {
|
|
echo '<form action="?" method="post">
|
|
<fieldset>
|
|
<legend>Login</login>
|
|
<label>Login</label>
|
|
<input type="text" name="loginName" required/>
|
|
<label>Password</label>
|
|
<input type="password" name="loginPass" required/>
|
|
<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="submit" />
|
|
</fieldset>
|
|
</form>';
|
|
}
|
|
|
|
if (!empty($ci['ac']) && $ci['ac'] === 'newDir') {
|
|
if (!empty($ci['op']) && (int)$ci['op'] === 1) {
|
|
verifToken($ci['token']);
|
|
$addDir = addDir($ci['newDir'], $ci['bc'], $fullListDir);
|
|
} else {
|
|
echo '<form action="?" method="post">
|
|
<fieldset>
|
|
<legend>
|
|
New directory
|
|
</legend>
|
|
<label>Name</label>
|
|
<input type="text" name="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="submit"/>
|
|
</fieldset>
|
|
</form>';
|
|
}
|
|
}
|
|
if (!empty($ci['ac']) && $ci['ac'] === 'addVideo') {
|
|
if (!empty($ci['op']) && (int)$ci['op'] === 1) {
|
|
verifToken($ci['token']);
|
|
$addVideo = addVideo($ci, $fullListFile);
|
|
} else {
|
|
echo '<form action="?" method="post">
|
|
<fieldset>
|
|
<legend>
|
|
New video
|
|
</legend>
|
|
<label>Url</label>
|
|
<input type="url" name="url" />
|
|
<label>Name</label>
|
|
<input type="text" name="name"/>
|
|
<label>Description</label>
|
|
<textarea></textarea>
|
|
<label>Via</label>
|
|
<input type="url" name="via" />
|
|
<label>Licence</label>
|
|
<select name="licence">
|
|
<option>CC-NC</option>
|
|
</select>
|
|
<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="submit"/>
|
|
</fieldset>
|
|
</form>';
|
|
}
|
|
}
|
|
if (!empty($ci['ac']) && $ci['ac'] === 'view') {
|
|
if (!empty($ci['op']) && (int)$ci['op'] === 1) {
|
|
verifToken($ci['token']);
|
|
} else {
|
|
$videoInfo = getVideoInfo($ci['file'], $ci['bc'], $fullListFile);
|
|
}
|
|
}
|
|
if (empty($ci['bc'])) {
|
|
$path = 'videos/';
|
|
} else {
|
|
$splitBc = chunk_split($ci['bc'], 8, '/');
|
|
$path = 'videos/'.$splitBc;
|
|
$breadcrumb = makeBreadcrumb($ci['bc'], $fullListDir);
|
|
$nbBread = count($breadcrumb);
|
|
}
|
|
|
|
$listCurrentDir = listCurrentDir($path);
|
|
$listCurrentFile = listVideo($path);
|
|
echo '<div id="breadcrumb">';
|
|
$i = 1;
|
|
echo '<a href="?">Home</a> >>';
|
|
if (!empty($breadcrumb)) {
|
|
foreach ($breadcrumb as $key => $value) {
|
|
if ($i === $nbBread) {
|
|
echo $value;
|
|
} else {
|
|
echo '<a href="?bc=', $key, '">', $value, '</a> >> ';
|
|
}
|
|
$i++;
|
|
}
|
|
}
|
|
|
|
echo '</div>';
|
|
echo '<div id="listFile">';
|
|
if (!empty($listCurrentDir)) {
|
|
foreach ($listCurrentDir as $value) {
|
|
if (file_exists($value.'.folder')) {
|
|
echo '<a href="?bc=', $ci['bc'].$value, '"><img alt="', $path.$value, '" src="', $path.$value, '.folder" />', $fullListDir[$value], '</a> ';
|
|
} else {
|
|
echo '<a href="?bc=', $ci['bc'].$value, '">', $fullListDir[$value], '</a> ';
|
|
}
|
|
}
|
|
}
|
|
if (!empty($listCurrentFile) && $ci['ac'] !== 'view') {
|
|
foreach ($listCurrentFile as $value) {
|
|
echo '<a href="?bc=', $ci['bc'], '&file=', $value, '&ac=view"><img alt="', $path.$value, '" src="', $path.$value, '" />', $fullListFile[str_replace('.jpg', '', $value)]['title'], '</a>';
|
|
}
|
|
}
|
|
|
|
if ($ci['ac'] === 'view' && !empty($listCurrentFile)) {
|
|
if (!empty($videoInfo)) {
|
|
echo '<div id="viewFile">';
|
|
echo '<h2>', $videoInfo['title'], ' (', $videoInfo['originalTitle'], ')</h2>';
|
|
echo '<video width="400" controls="controls" poster="', $path.$videoInfo['hash'], '.jpg">';
|
|
echo '<source src="', $path.$videoInfo['hash'], '.webm" type="video/webm" />';
|
|
echo '
|
|
<object type="application/x-shockwave-flash" data="lib/flowplayer-3.2.1.swf" width="640" height="360">
|
|
<param name="movie" value="lib/flowplayer-3.2.1.swf" />
|
|
<param name="allowFullScreen" value="true" />
|
|
<param name="wmode" value="transparent" />
|
|
<param name="flashVars" value="config={\'playlist\':[\'', $path.$videoInfo['hash'], '.jpg\',{\'url\':\'', $path.$videoInfo['hash'], '.webm', '\'autoPlay\':false}]}" />
|
|
<img alt="Preview" src="', $path.$videoInfo['hash'], '.jpg" width="640" height="360" title="No video playback capabilities, please download the video below" />
|
|
</object>';
|
|
echo 'Oops your browser can\'t play webm video. Try a modern browser. Look <a href="http://browsehappy.com/">browsehappy.com</a> for list.';
|
|
echo '</video>';
|
|
}
|
|
|
|
echo '<table>
|
|
<tr>
|
|
<th>Title</th>
|
|
<td>', $videoInfo['title'], ' (', $videoInfo['originalTitle'], ')</td>
|
|
</tr>
|
|
<tr>
|
|
<th>Description</th>
|
|
<td>', $videoInfo['desc'], '</td
|
|
</tr>
|
|
<tr>
|
|
<th>Original description</th>
|
|
<td>', $videoInfo['originalDesc'], '</td
|
|
</tr>
|
|
<tr>
|
|
<tr>
|
|
<th>Url</th>
|
|
<td>', $videoInfo['url'], '</td
|
|
</tr>
|
|
<tr>
|
|
<th>Date</th>
|
|
<td>', $videoInfo['uploadDate'], '</td
|
|
</tr>
|
|
<tr>
|
|
<th>Via</th>
|
|
<td>', $videoInfo['via'], '</td
|
|
</tr>
|
|
<tr>
|
|
<th>Licence</th>
|
|
<td>', $videoInfo['licence'], '</td
|
|
</tr>
|
|
</table>
|
|
</div>';
|
|
}
|
|
echo '</div>';
|
|
?>
|