Compare commits

..

No commits in common. "58900e3d606dc5490a6c4ba06effe0eba77dee4a" and "8754b017b8c8bb8ef9eff6c6d5eece9a7f1d6abb" have entirely different histories.

View File

@ -6,7 +6,6 @@
define('HOME_PAGE', 'blog'); // Entry page (and link for logo) define('HOME_PAGE', 'blog'); // Entry page (and link for logo)
define('CACHE_POSTS_TTL', 3600); // Time to cache the posts list (1h) define('CACHE_POSTS_TTL', 3600); // Time to cache the posts list (1h)
define('POSTS_BASE', "/b/"); // Root directory of the posts (relative) define('POSTS_BASE', "/b/"); // Root directory of the posts (relative)
define('YT_PREVIEW', "/b/pimg-yt/"); // Directory containing local copies of the youtube thumbnails
define('POSTS_ROOT', $_SERVER['DOCUMENT_ROOT'] . POSTS_BASE); // Root directory of the posts (absolute) define('POSTS_ROOT', $_SERVER['DOCUMENT_ROOT'] . POSTS_BASE); // Root directory of the posts (absolute)
define('POSTS_PAGE_SIZE', 10); // Numbers of posts on a page define('POSTS_PAGE_SIZE', 10); // Numbers of posts on a page
@ -125,7 +124,6 @@
if ($matches) { if ($matches) {
$youtube['embed'] = "https://www.youtube.com/embed/" . $matches[1]; $youtube['embed'] = "https://www.youtube.com/embed/" . $matches[1];
$youtube['link'] = "https://www.youtube.com/watch?v=" . $matches[1]; $youtube['link'] = "https://www.youtube.com/watch?v=" . $matches[1];
$youtube['vid'] = $matches[1];
} }
echo '<videoframe><div class="videoframe" style="width:' . $width . 'px;height:' . $width*9/16 . 'px">'; echo '<videoframe><div class="videoframe" style="width:' . $width . 'px;height:' . $width*9/16 . 'px">';
@ -134,7 +132,7 @@
if (opted_in('y')) { if (opted_in('y')) {
echo '<iframe width="100%" height="100%" src="' . $url . '" frameborder="0" allowfullscreen></iframe>'; echo '<iframe width="100%" height="100%" src="' . $url . '" frameborder="0" allowfullscreen></iframe>';
} else { } else {
echo "<div style='width:100%;height:100%;background-color:black;background-image: url(" . YT_PREVIEW . $youtube['vid'] . ".jpg);background-size:contain;'><table border=0 style='height:100%;width:100%;backdrop-filter:blur(3px);background-color:rgba(0,0,0,0.55);text-shadow:1px 1px black;'><tr><td style='text-align:center;'>Embedded content has been disabled to protect your privacy.<br><br><br><strong><form action='' method='post'><input type='hidden' name='optin-once' value='y' /><input type='submit' value='Click here to load the videos on this site once,'/></form></strong><br><br><strong><a href='/?p=privacy-controls'>or click here to allow them permanently,</a><br><br><a href=\"" . $youtube['link'] . "\">" . "or click here to watch the video on YouTube:<br>" . $youtube['link'] . "</a></strong><br><br><br>Please note that, by enabling this video, data is transferred <br>to YouTube LLC, and is subject to their privacy policy.</td></tr></table></div>"; echo "<table border=0 style='height:100%;width:100%'><tr><td style='text-align:center;'>Embedded content has been disabled to protect your privacy.<br><br><br><strong><form action='' method='post'><input type='hidden' name='optin-once' value='y' /><input type='submit' value='Click here to load the videos on this site once,'/></form></strong><br><br><strong><a href='/?p=privacy-controls'>or click here to allow them permanently,</a><br><br><a href=\"" . $youtube['link'] . "\">" . "or click here to watch the video on YouTube:<br>" . $youtube['link'] . "</a></strong><br><br><br>Please note that by enabling this video, data is transferred <br>to YouTube LLC, and is subject to their privacy policy.</td></tr></table>";
} }
} else { } else {
// TODO: HTML5 video // TODO: HTML5 video
@ -156,11 +154,9 @@
*/ */
$meta['sources'] = array(); $meta['sources'] = array();
$counters['sources'] = 1; $counters['sources'] = 1;
function addSource($url, $text="") { function addSource($url) {
global $counters; global $counters;
global $meta; global $meta;
if ("$text" != "")
$text .= " ";
if (is_numeric($url)) { if (is_numeric($url)) {
echo "<a href=\"#src$url\">[" . $url . "]</a>"; echo "<a href=\"#src$url\">[" . $url . "]</a>";
return $url; return $url;
@ -170,14 +166,14 @@
$i = 1; $i = 1;
foreach ($meta['sources'] as $v) { foreach ($meta['sources'] as $v) {
if ($v == $url) { if ($v == $url) {
echo "<a href=\"$url\">" . $text . "[" . $i . "]</a>"; echo "<a href=\"#src$i\">[" . $i . "]</a>";
return $i; return $i;
} }
$i++; $i++;
} }
// If not found, then add // If not found, then add
$meta['sources'][$counters['sources']] = $url; $meta['sources'][$counters['sources']] = $url;
echo "<a href=\"$url\">" . $text . "[" . $counters['sources'] . "]</a>"; echo "<a href=\"#src$i\">[" . $counters['sources'] . "]</a>";
return $counters['sources']++; return $counters['sources']++;
} }
} }