This commit has been accessed 592 times via Git panel.
commit a50966c0b0632309683ba7a8c0aed063eb564819
tree 5457969e9f8c77fa9ca08ca03a37cedad2a6e9a4
parent 0781e4fc8c0d3d40c3085feccf114ad1fa441dde
author Engels Antonio <engels@majcms.org> 1294539192 +0800
committer Engels Antonio <engels@majcms.org> 1294539192 +0800
Holiday release backlog commit
diff --git a/index.php b/index.php
index bc018bc..5483763 100644
--- a/index.php
+++ b/index.php
@@ -2581,7 +2581,7 @@ foreach ($maj_disp as $maj_d) {
$entry_url = rawurlencode($entry_url);
- echo "<br><br><iframe src=\"http://www.facebook.com/plugins/like.php?href=$entry_url&layout=standard&show_faces=false&width=513&action=like&colorscheme=light&height=23\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:513px; height:23px;\" allowTransparency=\"true\"></iframe>";
+ echo "<br><br><iframe src=\"http://www.facebook.com/plugins/like.php?href=$entry_url&layout=standard&show_faces=false&width=513&action=like&colorscheme=light&height=25\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:513px; height:25px;\" allowTransparency=\"true\"></iframe>";
}
if (isset($maj_d_text_b)) {
@@ -2716,10 +2716,10 @@ foreach ($maj_disp as $maj_d) {
$maj_views_value = file_get_contents("data/items/$maj_d/views.txt");
if ($maj_views_value == 1) {
- echo " ( $maj_views_value view ) ";
+ echo " ($maj_views_value view) ";
}
elseif ($maj_views_value > 1) {
- echo " ( $maj_views_value views ) ";
+ echo " ($maj_views_value views) ";
}
else {
echo " ";
@@ -2782,15 +2782,102 @@ foreach ($maj_disp as $maj_d) {
$maj_album_views_value = file_get_contents("data/items/$maj_d/album/views.txt");
if ($maj_album_views_value == 1) {
- echo " ( $maj_album_views_value view ) ";
+ echo " ($maj_album_views_value view) ";
}
elseif ($maj_album_views_value > 1) {
- echo " ( $maj_album_views_value views ) ";
+ echo " ($maj_album_views_value views) ";
}
else {
echo " ";
}
+ if (file_exists("media/$maj_d/videos")) {
+
+ if (isset($maj_req_entry) and !empty($maj_req_entry) and isset($maj_req_show) and !empty($maj_req_show) and ($maj_req_show == videos)) {
+
+ 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 ((!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $maj_login_username))) {
+
+ if (!file_exists("data/items/$maj_d/media/videos/views.txt")) {
+ $maj_videos_views_value = 0;
+ }
+ else {
+ $maj_videos_views_value = file_get_contents("data/items/$maj_d/media/videos/views.txt");
+ }
+
+ $maj_videos_views_value = $maj_videos_views_value + 1;
+
+ $maj_fp_videos_views_txt = fopen("data/items/$maj_d/media/videos/views.txt","w");
+ fwrite($maj_fp_videos_views_txt,$maj_videos_views_value);
+ fclose($maj_fp_videos_views_txt);
+ }
+ }
+
+ // 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);
+
+ $maj_videos_count = count($maj_videos);
+
+ if ($maj_videos_count > 0) {
+
+ echo " | <a href=\"index.php?entry=$maj_d&show=videos\" class=\"status\">$maj_videos_count ";
+
+ if ($maj_videos_count == 1) {
+ echo "video";
+ }
+ else {
+ echo "videos";
+ }
+
+ echo "</a>";
+
+ if (file_exists("data/items/$maj_d/media/videos/views.txt")) {
+
+ $maj_videos_views = file_get_contents("data/items/$maj_d/media/videos/views.txt");
+
+ if ($maj_videos_views > 0) {
+
+ echo " ($maj_videos_views ";
+
+ if ($maj_videos_views == 1) {
+ echo "view";
+ }
+ else {
+ echo "views";
+ }
+ echo ")";
+ }
+ }
+ }
+ }
+
if (!file_exists("data/items/$maj_d/filedrop/files")) {
echo " ";
}
@@ -2847,10 +2934,10 @@ foreach ($maj_disp as $maj_d) {
$maj_filedrop_views_value = file_get_contents("data/items/$maj_d/filedrop/views.txt");
if ($maj_filedrop_views_value == 1) {
- echo " ( $maj_filedrop_views_value view ) ";
+ echo " ($maj_filedrop_views_value view) ";
}
elseif ($maj_filedrop_views_value > 1) {
- echo " ( $maj_filedrop_views_value views ) ";
+ echo " ($maj_filedrop_views_value views) ";
}
else {
echo " ";
@@ -2874,10 +2961,10 @@ foreach ($maj_disp as $maj_d) {
$maj_pdf_views_value = file_get_contents("data/items/$maj_d/pdf/count/views.txt");
if ($maj_pdf_views_value == 1) {
- echo " ( $maj_pdf_views_value view ) ";
+ echo " ($maj_pdf_views_value view) ";
}
elseif ($maj_pdf_views_value > 1) {
- echo " ( $maj_pdf_views_value views ) ";
+ echo " ($maj_pdf_views_value views) ";
}
else {
echo " ";
@@ -3090,8 +3177,8 @@ foreach ($maj_disp as $maj_d) {
$maj_current_image_size = getimagesize($maj_current_image);
$maj_current_width = $maj_current_image_size[0];
$maj_current_height = $maj_current_image_size[1];
- $maj_max_width = 98;
- $maj_max_height = 73;
+ $maj_max_width = 95;
+ $maj_max_height = 71;
if (($maj_current_width > $maj_max_width) || ($maj_current_height > $maj_max_height)) {
@@ -3167,6 +3254,45 @@ foreach ($maj_disp as $maj_d) {
echo '</td></tr></table>';
}
+
+ if (file_exists("media/$maj_d/videos") and (file_exists("data/items/$maj_d/auto-videos.txt") or (isset($maj_req_entry) and !empty($maj_req_entry) and isset($maj_req_show) and !empty($maj_req_show) and ($maj_req_show == videos)))) {
+
+ echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"$maj_wmain\"><tr><td>";
+
+ echo '<div class="panel_title">Videos</div>';
+ echo '<div class="panel_body">';
+
+ if (file_exists("data/items/$maj_d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $maj_login_username)) and (!isset($_REQUEST['passwd']) or ($maj_crypt_passwd != $maj_passwd))) {
+ echo "This entry is password protected. If you know the magic word, click <a href=passwd.php?entry=$maj_d&show=videos>here</a> to enter it.";
+ }
+ else {
+ foreach ($maj_videos as $maj_video) {
+
+ $maj_video_show = str_replace("media/$maj_d/videos/","",$maj_video);
+
+ echo "<a href=\"video.php?entry=$maj_d&show=$maj_video_show\">";
+ echo "<video width=\"95\" height=\"71\" preload=\"meta\" style=\"margin: 2px;\">";
+
+ 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>";
+
+ unset($maj_video);
+ }
+ }
+ echo "</div></td></tr></table>";
+ }
if (isset($maj_req_entry) and !empty($maj_req_entry) and isset($maj_req_show) and !empty($maj_req_show) and ($maj_req_show == filedrop) and file_exists("data/items/$maj_d/filedrop/files")) {
diff --git a/passwd.php b/passwd.php
index b2dabd6..205e9fa 100644
--- a/passwd.php
+++ b/passwd.php
@@ -82,6 +82,10 @@ if (isset($_REQUEST['show']) and ($_REQUEST['show'] == pdf)) {
echo "&show=pdf";
}
+if (isset($_REQUEST['show']) and ($_REQUEST['show'] == videos)) {
+ echo "&show=videos";
+}
+
?>" method="post">
<input autocomplete=off class=input type=password name=passwd>
<input class=input type=submit value=submit>
diff --git a/rel.txt b/rel.txt
index 4bd2876..b33f126 100644
--- a/rel.txt
+++ b/rel.txt
@@ -1 +1 @@
-201011300755
+201012142034
diff --git a/video.php b/video.php
new file mode 100644
index 0000000..a609783
--- /dev/null
+++ b/video.php
@@ -0,0 +1,274 @@
+<?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;
+
+ $maj_views_txt = fopen("data/items/$maj_d/media/videos/$maj_s/views.txt","w");
+ fwrite($maj_views_txt,$maj_views);
+ fclose($maj_views_txt);
+ }
+
+ 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);
+
+ $maj_caption_txt = fopen("data/items/$maj_d/media/videos/$maj_s/caption.txt","w");
+ fwrite($maj_caption_txt,$maj_caption);
+ fclose($maj_caption_txt);
+ }
+ 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; } </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\"><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 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>";
+
+ 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 "<font style=\"font-size: 9px;\"><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>";
+}
+
+?>
tree 5457969e9f8c77fa9ca08ca03a37cedad2a6e9a4
parent 0781e4fc8c0d3d40c3085feccf114ad1fa441dde
author Engels Antonio <engels@majcms.org> 1294539192 +0800
committer Engels Antonio <engels@majcms.org> 1294539192 +0800
Holiday release backlog commit
diff --git a/index.php b/index.php
index bc018bc..5483763 100644
--- a/index.php
+++ b/index.php
@@ -2581,7 +2581,7 @@ foreach ($maj_disp as $maj_d) {
$entry_url = rawurlencode($entry_url);
- echo "<br><br><iframe src=\"http://www.facebook.com/plugins/like.php?href=$entry_url&layout=standard&show_faces=false&width=513&action=like&colorscheme=light&height=23\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:513px; height:23px;\" allowTransparency=\"true\"></iframe>";
+ echo "<br><br><iframe src=\"http://www.facebook.com/plugins/like.php?href=$entry_url&layout=standard&show_faces=false&width=513&action=like&colorscheme=light&height=25\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:513px; height:25px;\" allowTransparency=\"true\"></iframe>";
}
if (isset($maj_d_text_b)) {
@@ -2716,10 +2716,10 @@ foreach ($maj_disp as $maj_d) {
$maj_views_value = file_get_contents("data/items/$maj_d/views.txt");
if ($maj_views_value == 1) {
- echo " ( $maj_views_value view ) ";
+ echo " ($maj_views_value view) ";
}
elseif ($maj_views_value > 1) {
- echo " ( $maj_views_value views ) ";
+ echo " ($maj_views_value views) ";
}
else {
echo " ";
@@ -2782,15 +2782,102 @@ foreach ($maj_disp as $maj_d) {
$maj_album_views_value = file_get_contents("data/items/$maj_d/album/views.txt");
if ($maj_album_views_value == 1) {
- echo " ( $maj_album_views_value view ) ";
+ echo " ($maj_album_views_value view) ";
}
elseif ($maj_album_views_value > 1) {
- echo " ( $maj_album_views_value views ) ";
+ echo " ($maj_album_views_value views) ";
}
else {
echo " ";
}
+ if (file_exists("media/$maj_d/videos")) {
+
+ if (isset($maj_req_entry) and !empty($maj_req_entry) and isset($maj_req_show) and !empty($maj_req_show) and ($maj_req_show == videos)) {
+
+ 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 ((!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $maj_login_username))) {
+
+ if (!file_exists("data/items/$maj_d/media/videos/views.txt")) {
+ $maj_videos_views_value = 0;
+ }
+ else {
+ $maj_videos_views_value = file_get_contents("data/items/$maj_d/media/videos/views.txt");
+ }
+
+ $maj_videos_views_value = $maj_videos_views_value + 1;
+
+ $maj_fp_videos_views_txt = fopen("data/items/$maj_d/media/videos/views.txt","w");
+ fwrite($maj_fp_videos_views_txt,$maj_videos_views_value);
+ fclose($maj_fp_videos_views_txt);
+ }
+ }
+
+ // 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);
+
+ $maj_videos_count = count($maj_videos);
+
+ if ($maj_videos_count > 0) {
+
+ echo " | <a href=\"index.php?entry=$maj_d&show=videos\" class=\"status\">$maj_videos_count ";
+
+ if ($maj_videos_count == 1) {
+ echo "video";
+ }
+ else {
+ echo "videos";
+ }
+
+ echo "</a>";
+
+ if (file_exists("data/items/$maj_d/media/videos/views.txt")) {
+
+ $maj_videos_views = file_get_contents("data/items/$maj_d/media/videos/views.txt");
+
+ if ($maj_videos_views > 0) {
+
+ echo " ($maj_videos_views ";
+
+ if ($maj_videos_views == 1) {
+ echo "view";
+ }
+ else {
+ echo "views";
+ }
+ echo ")";
+ }
+ }
+ }
+ }
+
if (!file_exists("data/items/$maj_d/filedrop/files")) {
echo " ";
}
@@ -2847,10 +2934,10 @@ foreach ($maj_disp as $maj_d) {
$maj_filedrop_views_value = file_get_contents("data/items/$maj_d/filedrop/views.txt");
if ($maj_filedrop_views_value == 1) {
- echo " ( $maj_filedrop_views_value view ) ";
+ echo " ($maj_filedrop_views_value view) ";
}
elseif ($maj_filedrop_views_value > 1) {
- echo " ( $maj_filedrop_views_value views ) ";
+ echo " ($maj_filedrop_views_value views) ";
}
else {
echo " ";
@@ -2874,10 +2961,10 @@ foreach ($maj_disp as $maj_d) {
$maj_pdf_views_value = file_get_contents("data/items/$maj_d/pdf/count/views.txt");
if ($maj_pdf_views_value == 1) {
- echo " ( $maj_pdf_views_value view ) ";
+ echo " ($maj_pdf_views_value view) ";
}
elseif ($maj_pdf_views_value > 1) {
- echo " ( $maj_pdf_views_value views ) ";
+ echo " ($maj_pdf_views_value views) ";
}
else {
echo " ";
@@ -3090,8 +3177,8 @@ foreach ($maj_disp as $maj_d) {
$maj_current_image_size = getimagesize($maj_current_image);
$maj_current_width = $maj_current_image_size[0];
$maj_current_height = $maj_current_image_size[1];
- $maj_max_width = 98;
- $maj_max_height = 73;
+ $maj_max_width = 95;
+ $maj_max_height = 71;
if (($maj_current_width > $maj_max_width) || ($maj_current_height > $maj_max_height)) {
@@ -3167,6 +3254,45 @@ foreach ($maj_disp as $maj_d) {
echo '</td></tr></table>';
}
+
+ if (file_exists("media/$maj_d/videos") and (file_exists("data/items/$maj_d/auto-videos.txt") or (isset($maj_req_entry) and !empty($maj_req_entry) and isset($maj_req_show) and !empty($maj_req_show) and ($maj_req_show == videos)))) {
+
+ echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"$maj_wmain\"><tr><td>";
+
+ echo '<div class="panel_title">Videos</div>';
+ echo '<div class="panel_body">';
+
+ if (file_exists("data/items/$maj_d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $maj_login_username)) and (!isset($_REQUEST['passwd']) or ($maj_crypt_passwd != $maj_passwd))) {
+ echo "This entry is password protected. If you know the magic word, click <a href=passwd.php?entry=$maj_d&show=videos>here</a> to enter it.";
+ }
+ else {
+ foreach ($maj_videos as $maj_video) {
+
+ $maj_video_show = str_replace("media/$maj_d/videos/","",$maj_video);
+
+ echo "<a href=\"video.php?entry=$maj_d&show=$maj_video_show\">";
+ echo "<video width=\"95\" height=\"71\" preload=\"meta\" style=\"margin: 2px;\">";
+
+ 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>";
+
+ unset($maj_video);
+ }
+ }
+ echo "</div></td></tr></table>";
+ }
if (isset($maj_req_entry) and !empty($maj_req_entry) and isset($maj_req_show) and !empty($maj_req_show) and ($maj_req_show == filedrop) and file_exists("data/items/$maj_d/filedrop/files")) {
diff --git a/passwd.php b/passwd.php
index b2dabd6..205e9fa 100644
--- a/passwd.php
+++ b/passwd.php
@@ -82,6 +82,10 @@ if (isset($_REQUEST['show']) and ($_REQUEST['show'] == pdf)) {
echo "&show=pdf";
}
+if (isset($_REQUEST['show']) and ($_REQUEST['show'] == videos)) {
+ echo "&show=videos";
+}
+
?>" method="post">
<input autocomplete=off class=input type=password name=passwd>
<input class=input type=submit value=submit>
diff --git a/rel.txt b/rel.txt
index 4bd2876..b33f126 100644
--- a/rel.txt
+++ b/rel.txt
@@ -1 +1 @@
-201011300755
+201012142034
diff --git a/video.php b/video.php
new file mode 100644
index 0000000..a609783
--- /dev/null
+++ b/video.php
@@ -0,0 +1,274 @@
+<?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;
+
+ $maj_views_txt = fopen("data/items/$maj_d/media/videos/$maj_s/views.txt","w");
+ fwrite($maj_views_txt,$maj_views);
+ fclose($maj_views_txt);
+ }
+
+ 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);
+
+ $maj_caption_txt = fopen("data/items/$maj_d/media/videos/$maj_s/caption.txt","w");
+ fwrite($maj_caption_txt,$maj_caption);
+ fclose($maj_caption_txt);
+ }
+ 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; } </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\"><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 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>";
+
+ 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 "<font style=\"font-size: 9px;\"><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>";
+}
+
+?>