Compare commits
No commits in common. "ff07893501cb63c5e92d93375742bd39ed9b849d" and "a60988f46805fbf3f8d31bb3e723830e4d3ae21e" have entirely different histories.
ff07893501
...
a60988f468
62
index.php
62
index.php
@ -9,7 +9,7 @@
|
|||||||
preg_match("/^[a-z0-9\-]*$/", $page, $matches); // SECURITY: Only lowercase a-z + numbers + -
|
preg_match("/^[a-z0-9\-]*$/", $page, $matches); // SECURITY: Only lowercase a-z + numbers + -
|
||||||
if (!$matches)
|
if (!$matches)
|
||||||
$page=HOME_PAGE;
|
$page=HOME_PAGE;
|
||||||
$page=substr($page, 0, 16); // SECURITY: Max 16 chars
|
$page=substr($page, 0, 12); // SECURITY: Max 12 chars
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$page=HOME_PAGE;
|
$page=HOME_PAGE;
|
||||||
@ -19,33 +19,7 @@
|
|||||||
$pageUrl="p/404.php";
|
$pageUrl="p/404.php";
|
||||||
$pageTitle = "Error 404";
|
$pageTitle = "Error 404";
|
||||||
}
|
}
|
||||||
|
// --- $page and $pageUrl are now SAFE TO USE
|
||||||
$optin = "";
|
|
||||||
if (isset($_GET['optin-once'])) {
|
|
||||||
$_COOKIE['opt-in'] = $_GET['optin-once'];
|
|
||||||
}
|
|
||||||
if (isset($_COOKIE['opt-in'])) {
|
|
||||||
$opt = $_COOKIE['opt-in'];
|
|
||||||
|
|
||||||
if (strlen($opt) <= 8) {
|
|
||||||
preg_match("/^[a-z0-9\-]*$/", $opt, $matches);
|
|
||||||
if ($matches) {
|
|
||||||
if (isset($_GET['optout'])) {
|
|
||||||
$opt = str_replace($_GET['optout'], '', $opt);
|
|
||||||
}
|
|
||||||
$optin = $opt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isset($_GET['optin'])) {
|
|
||||||
if ((strlen($_GET['optin']) == 1) && !opted_in($_GET['optin'])) {
|
|
||||||
$optin .= $_GET['optin'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isset($_GET['optout']) || isset($_GET['optin'])) {
|
|
||||||
setcookie('opt-in', $optin, strtotime("+1 year"));
|
|
||||||
}
|
|
||||||
// --- $page, $pageUrl and $optin are now SAFE TO USE
|
|
||||||
|
|
||||||
$htmlHead = "";
|
$htmlHead = "";
|
||||||
|
|
||||||
@ -74,16 +48,16 @@
|
|||||||
ob_start(function($output) {
|
ob_start(function($output) {
|
||||||
global $pageTitle;
|
global $pageTitle;
|
||||||
global $htmlHead;
|
global $htmlHead;
|
||||||
$output = '<!DOCTYPE html>
|
$output = '<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>' . $pageTitle . ($pageTitle == "" ? "" : " - ") . PAGE_NAME . '</title>
|
<title>' . $pageTitle . ($pageTitle == "" ? "" : " - ") . PAGE_NAME . '</title>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=700px, initial-scale=.5"><!-- or width=device-width -->
|
<meta name="viewport" content="width=700px, initial-scale=.5"><!-- or width=device-width -->
|
||||||
' . $htmlHead . '
|
' . $htmlHead . '
|
||||||
<link rel="stylesheet" type="text/css" href="/style.css" />
|
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||||
<link rel="stylesheet" type="text/css" href="/userstyle.css" />
|
<link rel="stylesheet" type="text/css" href="userstyle.css" />
|
||||||
</head>' . $output;
|
</head>' . $output;
|
||||||
return $output;
|
return $output;
|
||||||
});
|
});
|
||||||
?>
|
?>
|
||||||
@ -93,13 +67,13 @@
|
|||||||
This page has been generated by [Simpub CMS] which is open source software.
|
This page has been generated by [Simpub CMS] which is open source software.
|
||||||
You can find it here: https://git.notsyncing.net:8080/web/simpub
|
You can find it here: https://git.notsyncing.net:8080/web/simpub
|
||||||
-->
|
-->
|
||||||
<body>
|
<body>
|
||||||
<nav>
|
<nav>
|
||||||
<div id="navContainer">
|
<div id="navContainer">
|
||||||
<ul class="pagetitle"><li <?php echo $homesel; ?> style="float: left;"><a class="pagetitle" href="/"><?php echo PAGE_NAME; ?></a></li></ul>
|
<ul class="pagetitle"><li <?php echo $homesel; ?> style="float: left;"><a class="pagetitle" href="/"><?php echo PAGE_NAME; ?></a></li></ul>
|
||||||
<ul>
|
<ul>
|
||||||
<?php mkMenu(); ?>
|
<?php mkMenu(); ?>
|
||||||
<?php if (RSS_ENABLED) { ?>
|
<?php if (RSS_ENABLED) { ?>
|
||||||
<li style="float: right; margin: 10px;">
|
<li style="float: right; margin: 10px;">
|
||||||
<a href="/rss.php" title="RSS Feed" style="margin: 0px; padding: 0px; border: none;"><img src="/img/rss.svg" style="width:32px; height:32px;"></a>
|
<a href="/rss.php" title="RSS Feed" style="margin: 0px; padding: 0px; border: none;"><img src="/img/rss.svg" style="width:32px; height:32px;"></a>
|
||||||
</li>
|
</li>
|
||||||
@ -107,7 +81,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
<div id="contentContainer">
|
<div id="contentContainer">
|
||||||
<content>
|
<content>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<?php
|
<?php
|
||||||
@ -116,10 +90,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</content>
|
</content>
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
Copyright <?php echo PAGE_AUTHOR; ?><!-- and <a href="/?p=extcontent">others</a>--> | <a href="https://creativecommons.org/licenses/by-nc-sa/3.0/us/"><img style="position:relative;top:4px;opacity:0.75;" src="/img/cc-byncsa.png"></a> | <a href="/?p=contact#privacy">Privacy Policy</a> | <?php echo date("Y"); ?>
|
Copyright <?php echo PAGE_AUTHOR; ?><!-- and <a href="/?p=extcontent">others</a>--> | <a href="https://creativecommons.org/licenses/by-nc-sa/3.0/us/"><img style="position:relative;top:4px;opacity:0.75;" src="/img/cc-byncsa.png"></a> | <?php echo date("Y"); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
<?php
|
|
||||||
if (!isset($CMS_ACTIVE)) exit();
|
|
||||||
require_once "privacy-controls.php";
|
|
||||||
?>
|
|
@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
if (!isset($CMS_ACTIVE)) exit();
|
|
||||||
require_once "shared.php";
|
|
||||||
?>
|
|
||||||
|
|
||||||
<h1>Privacy Control Panel</h1>
|
|
||||||
<h2>What is this?</h2>
|
|
||||||
<p>
|
|
||||||
This page allows you to configure your privacy preferences for the site. For more information about our privacy policy, please click <a href="/?p=contact#privacy">here</a>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h2>External content</h2>
|
|
||||||
<p>
|
|
||||||
Here, you can allow the site to automatically load content from external sources. Please note that this means that the enabled sites are able to track your behavior, even when just visiting this site.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
These preferences are saved using a cookie with a validity period of one year. This means, after one year, you will have to refresh your consent.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<table border=1>
|
|
||||||
<tr><td>Content</td><td>Status</td><td>Change</td></tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong>Automatically load embedded YouTube videos</strong></td>
|
|
||||||
<?php
|
|
||||||
if (opted_in('y')) {
|
|
||||||
echo '<td style="color:orange;">Enabled</td><td><a href="/?p=privacy-controls&optout=y">opt out</a></td>';
|
|
||||||
} else {
|
|
||||||
echo '<td style="color:blue;">Disabled</td><td><a href="/?p=privacy-controls&optin=y">opt in</a></td>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</tr>
|
|
||||||
<table>
|
|
||||||
</p>
|
|
39
shared.php
39
shared.php
@ -29,21 +29,6 @@
|
|||||||
$blogDirs = array("2017");
|
$blogDirs = array("2017");
|
||||||
|
|
||||||
|
|
||||||
function opted_in($identifier) {
|
|
||||||
global $optin;
|
|
||||||
return (stripos($optin, $identifier) !== false);
|
|
||||||
}
|
|
||||||
|
|
||||||
function append_param($p) {
|
|
||||||
$url = $_SERVER['REQUEST_URI'];
|
|
||||||
if (stripos($url, "?") !== false)
|
|
||||||
$url .= "&";
|
|
||||||
else
|
|
||||||
$url .= "?";
|
|
||||||
$url .= $p;
|
|
||||||
return $url;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function will include an image as figure.
|
* This function will include an image as figure.
|
||||||
* returns : Number of the figure for later referencing.
|
* returns : Number of the figure for later referencing.
|
||||||
@ -116,29 +101,9 @@
|
|||||||
$counters['video'] = 1;
|
$counters['video'] = 1;
|
||||||
function includeVideo($url, $title="", $width=640) {
|
function includeVideo($url, $title="", $width=640) {
|
||||||
global $counters;
|
global $counters;
|
||||||
|
// TODO: HTML5 video
|
||||||
$vlink = "NULL";
|
|
||||||
preg_match("/.*youtube.com\/embed\/(.*)$/", $url, $matches);
|
|
||||||
if (!$matches)
|
|
||||||
preg_match("/.*youtube.com\/watch\?v=([^&]*).*$/", $url, $matches);
|
|
||||||
if ($matches) {
|
|
||||||
$youtube['embed'] = "https://www.youtube.com/embed/" . $matches[1];
|
|
||||||
$youtube['link'] = "https://www.youtube.com/watch?v=" . $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">';
|
||||||
|
echo '<iframe width="100%" height="100%" src="' . $url . '" frameborder="0" allowfullscreen></iframe>';
|
||||||
if (isset($youtube)) {
|
|
||||||
if (opted_in('y')) {
|
|
||||||
echo '<iframe width="100%" height="100%" src="' . $url . '" frameborder="0" allowfullscreen></iframe>';
|
|
||||||
} else {
|
|
||||||
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><a href='" . append_param("optin-once=y") . "'>Click here to load the videos on this site once,</a></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 {
|
|
||||||
// TODO: HTML5 video
|
|
||||||
echo "SERVER ERROR: Video format not supported.";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</div></videoframe>';
|
echo '</div></videoframe>';
|
||||||
if ($title != "") {
|
if ($title != "") {
|
||||||
echo '<vidcaption>Video ' . $counters['video'] . ". $title</vidcaption>";
|
echo '<vidcaption>Video ' . $counters['video'] . ". $title</vidcaption>";
|
||||||
|
Loading…
Reference in New Issue
Block a user