This blob has been accessed 319 times via Git panel.
- <?php
- session_start();
- header("Cache-control: private");
- if (isset($_POST['back']) and !empty($_POST['back'])) {
- header("Location: index.php?entry={$_POST['back']}&show=videos");
- exit;
- }
- if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['show']) and !empty($_REQUEST['show'])) {
- $maj_d = strip_tags($_REQUEST['entry']);
- $maj_d = trim($maj_d);
- $maj_s = strip_tags($_REQUEST['show']);
- $maj_s = trim($maj_s);
- if (!file_exists("data/items/$maj_d") or !file_exists("media/$maj_d")) {
- exit;
- }
- if (!file_exists("data/items/$maj_d/media")) {
- mkdir("data/items/$maj_d/media");
- }
- if (!file_exists("data/items/$maj_d/media/videos")) {
- mkdir("data/items/$maj_d/media/videos");
- }
- if (!file_exists("data/items/$maj_d/media/videos/$maj_s")) {
- mkdir("data/items/$maj_d/media/videos/$maj_s");
- }
- if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != file_get_contents("data/username.txt"))) {
- if (!file_exists("data/items/$maj_d/media/videos/$maj_s/views.txt")) {
- $maj_views = "0";
- }
- else {
- $maj_views = file_get_contents("data/items/$maj_d/media/videos/$maj_s/views.txt");
- }
- $maj_views = $maj_views + 1;
- }
- if (isset($_POST['caption']) and isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == file_get_contents("data/username.txt"))) {
- if (!empty($_POST['caption'])) {
- $maj_caption = trim($_POST['caption']);
- $maj_caption = ucfirst($maj_caption);
- }
- else {
- if (file_exists("data/items/$maj_d/media/videos/$maj_s/caption.txt")) {
- unlink("data/items/$maj_d/media/videos/$maj_s/caption.txt");
- }
- }
- }
- include("css.php");
- echo "<style> .main, .menu { margin: 2px; border: 1px solid #dedede; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; -khtml-border-radius: 3px; -moz-box-shadow: 0 0 2px #dddddd; -webkit-box-shadow: 0 0 2px #dddddd; -khtml-box-shadow: 0 0 2px #dddddd; box-shadow: 0 0 2px #dddddd; padding: 1px; } .menu { float: left; } .info { font-size: 9px; } </style>";
- function format_bytes($bytes) {
- if ($bytes < 1024) return $bytes.' B';
- elseif ($bytes < 1048576) return round($bytes / 1024, 2).' KB';
- elseif ($bytes < 1073741824) return round($bytes / 1048576, 2).' MB';
- elseif ($bytes < 1099511627776) return round($bytes / 1073741824, 2).' GB';
- else return round($bytes / 1099511627776, 2).' TB';
- }
- $title = file_get_contents("data/items/$maj_d/title.txt");
- echo "<title>$title ($maj_s)</title>";
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\">";
- echo "<tr><td colspan=\"2\"><div style=\"margin: 5px;\"><a style=\"font-size: 14px;\" href=\".?entry=$maj_d\">$title</a></div></td></tr>";
- echo "<tr><td valign=\"top\">";
- echo "<div class=\"main\">";
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#ffffff\"><tr bgcolor=\"#ffffff\"><td>";
- echo "<video controls preload autoplay>";
- if (file_exists("media/$maj_d/videos/$maj_s.mp4")) {
- echo "<source src=\"media/$maj_d/videos/$maj_s.mp4\" type=\"video/mp4\">";
- }
- if (file_exists("media/$maj_d/videos/$maj_s.ogv")) {
- echo "<source src=\"media/$maj_d/videos/$maj_s.ogv\" type=\"video/ogg\">";
- }
- if (file_exists("media/$maj_d/videos/$maj_s.webm")) {
- echo "<source src=\"media/$maj_d/videos/$maj_s.webm\" type=\"video/webm\">";
- }
- echo "</video>";
- echo "</td></tr></table>";
- echo "</div>";
- echo "<div class=\"main\">";
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" width=\"100%\">";
- echo "<tr><td><a href=\"video.php?entry=$maj_d&show=$maj_s\">$maj_s</a></td><td align=\"right\">";
- if (file_exists("data/items/$maj_d/media/videos/$maj_s/views.txt")) {
- $maj_views = file_get_contents("data/items/$maj_d/media/videos/$maj_s/views.txt");
- if ($maj_views == 1) {
- echo "$maj_views view";
- }
- else {
- echo "$maj_views views";
- }
- }
- echo "</td></tr>";
- if (file_exists("data/items/$maj_d/media/videos/$maj_s/caption.txt")) {
- echo "<tr><td colspan=\"2\">";
- readfile("data/items/$maj_d/media/videos/$maj_s/caption.txt");
- echo "</td></tr>";
- }
- if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == file_get_contents("data/username.txt"))) {
- echo "<form method=\"post\"><input type=\"hidden\" name=\"entry\" value=\"$maj_d\"><input type=\"hidden\" name=\"show\" value=\"$maj_s\">";
- echo "<tr><td colspan=\"2\"><textarea autofocus required class=\"input\" style=\"width: 100%;\" name=\"caption\"></textarea></td></tr>";
- echo "<tr><td colspan=\"2\"><input type=\"submit\" class=\"click\" style=\"width: 100%;\" value=\"click here to update the caption\"></td></tr>";
- echo "</form>";
- }
- echo "</table>";
- echo "</div>";
- if (file_exists("data/fb.txt") and file_exists("data/items/$maj_d/fb.txt")) {
- if (isset($_SERVER['HTTPS'])) {
- $entry_url = "https://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), "/\\") . "/video.php?entry=$maj_d&show=$maj_s";
- }
- else {
- $entry_url = "http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), "/\\") . "/video.php?entry=$maj_d&show=$maj_s";
- }
- $entry_url = rawurlencode($entry_url);
- echo "<div style=\"margin: 2px;\"><iframe src=\"http://www.facebook.com/plugins/like.php?href=$entry_url&layout=standard&show_faces=true&width=320&action=like&colorscheme=light&height=80\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:320px; height:80px;\" allowTransparency=\"true\"></iframe></div>";
- }
- //echo "<form method=\"post\"><input type=\"hidden\" name=\"back\" value=\"$maj_d\"><input type=\"submit\" class=\"click\" style=\"width: 100%; margin: 1px;\" value=\"click here to go to the main entry\"></form>";
- echo "</td><td valign=\"top\">";
- // remove the code below once a suitable clean-up procedure is created in the video uploader
- $maj_videos = glob("media/$maj_d/videos/*");
- foreach ($maj_videos as $maj_video) {
- if (!preg_match("/\.mp4$/i",$maj_video) and !preg_match("/\.ogv$/i",$maj_video) and !preg_match("/\.webm$/i",$maj_video)) {
- unlink("$maj_video");
- }
- unset($maj_video);
- }
- unset($maj_videos);
- // remove the code above once a suitable clean-up procedure is created in the video uploader
- $maj_videos = glob("media/$maj_d/videos/*");
- $maj_videos = preg_replace("/\.mp4$/i","",$maj_videos);
- $maj_videos = preg_replace("/\.ogv$/i","",$maj_videos);
- $maj_videos = preg_replace("/\.webm$/i","",$maj_videos);
- $maj_videos = array_unique($maj_videos);
- sort($maj_videos);
- foreach ($maj_videos as $maj_video) {
- $maj_play = str_replace("media/$maj_d/videos/","",$maj_video);
- echo "<div class=\"menu\">";
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#ffffff\">";
- if ($maj_s == $maj_play) {
- echo "<tr bgcolor=\"#eeeeee\">";
- }
- else {
- echo "<tr bgcolor=\"#ffffff\">";
- }
- echo "<td>";
- echo "<a href=\"video.php?entry=$maj_d&show=$maj_play\">";
- echo "<video width=\"95\" height=\"71\" preload=\"meta\">";
- if (file_exists("$maj_video.mp4")) {
- echo "<source src=\"$maj_video.mp4\" type=\"video/mp4\">";
- }
- if (file_exists("$maj_video.ogv")) {
- echo "<source src=\"$maj_video.ogv\" type=\"video/ogg\">";
- }
- if (file_exists("$maj_video.webm")) {
- echo "<source src=\"$maj_video.webm\" type=\"video/webm\">";
- }
- echo "</video>";
- echo "</a>";
- echo "</td>";
- echo "<td valign=\"top\"><a href=\"video.php?entry=$maj_d&show=$maj_play\">$maj_play</a><font class=\"info\">";
- if (file_exists("data/items/$maj_d/media/videos/$maj_play/views.txt")) {
- $maj_views = file_get_contents("data/items/$maj_d/media/videos/$maj_play/views.txt");
- echo "<br>$maj_views ";
- if ($maj_views > 1) {
- echo "views";
- }
- else {
- echo "view";
- }
- }
- echo "<br>";
- if (file_exists("$maj_video.mp4")) {
- $maj_size = filesize("$maj_video.mp4");
- $maj_size = format_bytes($maj_size);
- echo "<br>MP4 ($maj_size)";
- }
- if (file_exists("$maj_video.ogv")) {
- $maj_size = filesize("$maj_video.ogv");
- $maj_size = format_bytes($maj_size);
- echo "<br>OGV ($maj_size)";
- }
- if (file_exists("$maj_video.webm")) {
- $maj_size = filesize("$maj_video.webm");
- $maj_size = format_bytes($maj_size);
- echo "<br>WEBM ($maj_size)";
- }
- echo "</font></td>";
- echo "</tr></table>";
- echo "</div>";
- unset($maj_video);
- }
- echo "</td></tr></table>";
- }
- ?>