git.shiar.nl
/
minimedit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
10c5940
)
page: replace output caching by article object
author
Mischa POSLAWSKY
<perl@shiar.org>
Thu, 24 Oct 2019 21:49:46 +0000
(23:49 +0200)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Sat, 9 Nov 2019 06:08:13 +0000
(07:08 +0100)
14 files changed:
edit/foto/cover/index.php
patch
|
blob
|
history
edit/index.php
patch
|
blob
|
history
edit/nieuws/tag/index.php
patch
|
blob
|
history
edit/page/index.php
patch
|
blob
|
history
foto/index.php
patch
|
blob
|
history
login/admin/index.php
patch
|
blob
|
history
login/edit/index.php
patch
|
blob
|
history
login/index.php
patch
|
blob
|
history
login/post/index.php
patch
|
blob
|
history
nieuws/feed/index.php
patch
|
blob
|
history
nieuws/index.php
patch
|
blob
|
history
page.php
patch
|
blob
|
history
sitemap.xml/index.php
patch
|
blob
|
history
thumb/index.php
patch
|
blob
|
history
diff --git
a/edit/foto/cover/index.php
b/edit/foto/cover/index.php
index 3ae5dcf99f6e0d4e251eff101c1b0c20b6b4662a..ab86a2f8e71e1abb02e7de640dd932a11f3df7b8 100644
(file)
--- a/
edit/foto/cover/index.php
+++ b/
edit/foto/cover/index.php
@@
-1,6
+1,4
@@
<?php
<?php
-ob_clean();
-
if (!$User or !$User->admin('foto')) {
http_response_code(403);
print "Beheerrechten verplicht voor instellen van covers\n";
if (!$User or !$User->admin('foto')) {
http_response_code(403);
print "Beheerrechten verplicht voor instellen van covers\n";
@@
-31,3
+29,4
@@
if (isset($_GET['img'])) {
$album = pathinfo($rootdir);
header("Location: /{$album['dirname']}#{$album['basename']}");
http_response_code(302);
$album = pathinfo($rootdir);
header("Location: /{$album['dirname']}#{$album['basename']}");
http_response_code(302);
+exit;
diff --git
a/edit/index.php
b/edit/index.php
index a6a64a2cb08e4c21b48184a3ba889ef917bdc800..922db803654274bc575929155f2455074fab5505 100644
(file)
--- a/
edit/index.php
+++ b/
edit/index.php
@@
-1,3
+1,2
@@
<?php
<?php
-ob_clean();
abort("aanpasdienst onbekend", '404 unknown');
abort("aanpasdienst onbekend", '404 unknown');
diff --git
a/edit/nieuws/tag/index.php
b/edit/nieuws/tag/index.php
index 01a385c0c1175b987204b1f7fcb8bb6960824d75..c65b81ebd810cf54d70093d7c57029d8bb888bd4 100644
(file)
--- a/
edit/nieuws/tag/index.php
+++ b/
edit/nieuws/tag/index.php
@@
-1,6
+1,4
@@
<?php
<?php
-ob_clean();
-
if (!$User or !$User->admin('news'))
abort("geen beheersrechten", '401 unauthorised');
if (!$User or !$User->admin('news'))
abort("geen beheersrechten", '401 unauthorised');
diff --git
a/edit/page/index.php
b/edit/page/index.php
index 32564ab299d39b345f48b9e0a148ed04f33cbece..086c7531c56683381713bf213fafb915127cae2e 100644
(file)
--- a/
edit/page/index.php
+++ b/
edit/page/index.php
@@
-1,6
+1,4
@@
<?php
<?php
-ob_clean();
-
if (!$User or !$User->admin("edit $Page$Args"))
abort("geen beheersrechten", '401 unauthorised');
if (!$User or !$User->admin("edit $Page$Args"))
abort("geen beheersrechten", '401 unauthorised');
diff --git
a/foto/index.php
b/foto/index.php
index 550e7a3e674870ecf7909aba100a53ccc9fadf57..d3e989873ca9c3491f9875c864b6e1ca5c4e8531 100644
(file)
--- a/
foto/index.php
+++ b/
foto/index.php
@@
-1,6
+1,4
@@
<?php
<?php
-$intro = ob_get_clean();
-
$rootdir = $Page . $Args;
if ($User and $User->admin('foto')) {
$rootdir = $Page . $Args;
if ($User and $User->admin('foto')) {
@@
-30,7
+28,9
@@
foreach ($nav as $i => $linktitle) {
print $title;
print "</h2>\n\n";
print $title;
print "</h2>\n\n";
-print $intro;
+if (isset($Article->raw)) {
+ print $Article->raw; # page intro
+}
function showthumb($path)
{
function showthumb($path)
{
@@
-89,3
+89,5
@@
if ($imgs = glob("$rootdir/*.jpg")) {
include 'foto/album.inc.php';
}
include 'foto/album.inc.php';
}
+
+return;
diff --git
a/login/admin/index.php
b/login/admin/index.php
index 28f513d8a3e506f28af95c4525f9d2d95d83818a..eb8a8773d19d2aebdc31a371bd861f5e9499d561 100644
(file)
--- a/
login/admin/index.php
+++ b/
login/admin/index.php
@@
-1,6
+1,5
@@
<?php
if (!$User or !$User->admin('site')) {
<?php
if (!$User or !$User->admin('site')) {
- ob_clean();
http_response_code(403);
?>
<h2>Verboden toegang</h2>
http_response_code(403);
?>
<h2>Verboden toegang</h2>
diff --git
a/login/edit/index.php
b/login/edit/index.php
index 23e6da46acbe95321ec956197853e5867cb1ca16..c56109fbd53df0992d186019fba7fc5e3d53d127 100644
(file)
--- a/
login/edit/index.php
+++ b/
login/edit/index.php
@@
-1,6
+1,6
@@
<?php
if ($Args) {
<?php
if ($Args) {
- ob_clean();
$Place['user'] = ltrim($Args, '/');
include 'login/edit/index.html';
$Place['user'] = ltrim($Args, '/');
include 'login/edit/index.html';
+ return;
}
}
diff --git
a/login/index.php
b/login/index.php
index 5cfbdedf8d322d00fd171a1436e48a238a6812f4..66cb0c943c485edd8fe58ea9a7e6a8ebcfe7d091 100644
(file)
--- a/
login/index.php
+++ b/
login/index.php
@@
-36,7
+36,6
@@
elseif (isset($_GET['logout'])) {
}
if (empty($User)) {
}
if (empty($User)) {
- ob_clean();
require_once 'login/form.inc.php';
$Place['warn'] = $message;
$Article->title = 'Inloggen';
require_once 'login/form.inc.php';
$Place['warn'] = $message;
$Article->title = 'Inloggen';
@@
-47,18
+46,21
@@
if (empty($User)) {
$Article->title .= ' voor ' . $target->title;
}
}
$Article->title .= ' voor ' . $target->title;
}
}
- return
TRUE
;
+ return;
}
if (isset($_REQUEST['goto'])) {
}
if (isset($_REQUEST['goto'])) {
- ob_clean();
$target = ltrim($_REQUEST['goto'], '/');
header("Location: /$target");
http_response_code(302);
exit;
}
$target = ltrim($_REQUEST['goto'], '/');
header("Location: /$target");
http_response_code(302);
exit;
}
+if (isset($Article->raw)) {
+ print $Article->raw;
+}
if (empty($Args) and $User and $User->admin) {
include_once 'login/admin.html';
}
if (empty($Args) and $User and $User->admin) {
include_once 'login/admin.html';
}
+return;
diff --git
a/login/post/index.php
b/login/post/index.php
index e491e357b53c10090a8abef52ca2ab22441dc823..9578d3cc01d8ba41c175ac18ac0e8f2f5c24bb71 100644
(file)
--- a/
login/post/index.php
+++ b/
login/post/index.php
@@
-1,6
+1,4
@@
<?php
<?php
-$body = ob_get_clean();
-
if ($User->admin('user') and $username = @$_REQUEST['login']) {
try {
$user = new User("profile/$username");
if ($User->admin('user') and $username = @$_REQUEST['login']) {
try {
$user = new User("profile/$username");
@@
-28,4
+26,3
@@
else {
}
print '<p class="nav right"><a href="javascript:window.print()">Print</a></p>'."\n";
}
print '<p class="nav right"><a href="javascript:window.print()">Print</a></p>'."\n";
-print $body;
diff --git
a/nieuws/feed/index.php
b/nieuws/feed/index.php
index 66855b149e88e1c8dfaf130bae47eebcf2c3217b..00fa7ea3dcb585c642caee99ee2e85c7e9ae5230 100644
(file)
--- a/
nieuws/feed/index.php
+++ b/
nieuws/feed/index.php
@@
-1,5
+1,4
@@
<?php
<?php
-ob_clean();
header('Content-Type: application/atom+xml; charset=utf-8');
print '<?xml version="1.0" encoding="utf-8"?>';
$siteref = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST'];
header('Content-Type: application/atom+xml; charset=utf-8');
print '<?xml version="1.0" encoding="utf-8"?>';
$siteref = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST'];
diff --git
a/nieuws/index.php
b/nieuws/index.php
index 3a50265955977b618d71c73c28cf5afea7151a01..53dff0de76e24400c906372abc61bd8ce0f4f55c 100644
(file)
--- a/
nieuws/index.php
+++ b/
nieuws/index.php
@@
-14,7
+14,7
@@
if ($page and !is_numeric($page)) {
if ($Article->dateparts) {
$Place[1] = ' <small class="date">'.$Article->date.'</small>';
}
if ($Article->dateparts) {
$Place[1] = ' <small class="date">'.$Article->date.'</small>';
}
- print preg_replace('{(?<=<h2>)(.*?)(?=</h2>)}', ($edit ?: '\1').' [[1]]',
ob_get_clean()
);
+ print preg_replace('{(?<=<h2>)(.*?)(?=</h2>)}', ($edit ?: '\1').' [[1]]',
$Article->raw
);
if ($User and $User->admin('news')) {
$taglist = [];
foreach (glob("$Page/.tags/*") as $tagpath) {
if ($User and $User->admin('news')) {
$taglist = [];
foreach (glob("$Page/.tags/*") as $tagpath) {
@@
-39,11
+39,10
@@
if ($page and !is_numeric($page)) {
if ($replyform) {
print placeholder_include('reply');
}
if ($replyform) {
print placeholder_include('reply');
}
- return
1
;
+ return;
}
if ($year) {
}
if ($year) {
- ob_clean();
$match = $Page;
$title = "Nieuws";
if (is_numeric($year) and $year > 999) {
$match = $Page;
$title = "Nieuws";
if (is_numeric($year) and $year > 999) {
@@
-65,5
+64,5
@@
if ($year) {
print "<h2>$title</h2>\n\n";
print placeholder_include('nieuws', [$match]);
print "<h2>$title</h2>\n\n";
print placeholder_include('nieuws', [$match]);
- return
1
;
+ return;
}
}
diff --git
a/page.php
b/page.php
index f5e9749cbeac10837f6d9bf0fb923c5a4234114d..f02544bd0b06dbd7add643d19a17e02bbdca69c2 100644
(file)
--- a/
page.php
+++ b/
page.php
@@
-163,42
+163,33
@@
elseif ($User and $User->admin("edit $Page$Args")) {
$staticpage = (file_exists("$Page/template.inc.html") ? "$Page/template.inc.html" : 'template.inc.html');
}
$staticpage = (file_exists("$Page/template.inc.html") ? "$Page/template.inc.html" : 'template.inc.html');
}
-#
load static
contents
+#
prepare page
contents
require_once('article.inc.php');
$Article = new ArchiveArticle($staticpage);
ob_start(); # page body
require_once('article.inc.php');
$Article = new ArchiveArticle($staticpage);
ob_start(); # page body
-ob_start(); # inner html
-print '<div class="static">'."\n\n";
-
-$found = FALSE;
-if (isset($Article->raw)) {
- print $Article->raw;
- $found = 1;
-}
-
-print "</div>\n\n";
-
-# execute dynamic code
-
-$Place = [];
-
-if ($Page) {
- $found |= require "./$Page/index.php";
-}
-
-$Place += [
+$Place = [
'user' => $User ? $User->login : '',
'url' => htmlspecialchars($_SERVER['REQUEST_URI']),
];
'user' => $User ? $User->login : '',
'url' => htmlspecialchars($_SERVER['REQUEST_URI']),
];
-# global html
+if (isset($Article->raw)) {
+ $Article->raw = '<div class="static">'."\n\n".$Article->raw."</div>\n\n";
+}
-if (!$found) {
- # no resulting output
- http_response_code(404);
- @require '404.inc.html';
+# output dynamic and/or static html
+
+if (!$Page or require("./$Page/index.php")) {
+ # static contents
+ if (isset($Article->raw)) {
+ print $Article->raw;
+ }
+ else {
+ # no resulting output
+ http_response_code(404);
+ @require '404.inc.html';
+ }
}
include_once 'page.inc.php';
}
include_once 'page.inc.php';
diff --git
a/sitemap.xml/index.php
b/sitemap.xml/index.php
index f0f928bd5c4db75e9e4fdfb2d9187a0b8a14afdc..0e68218fc972a001a6f4abf9d8603c0425bbd9dd 100644
(file)
--- a/
sitemap.xml/index.php
+++ b/
sitemap.xml/index.php
@@
-1,5
+1,4
@@
<?php
<?php
-ob_clean();
header('Content-Type: application/atom+xml; charset=utf-8');
print '<?xml version="1.0" encoding="utf-8"?>';
$siteref = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST'];
header('Content-Type: application/atom+xml; charset=utf-8');
print '<?xml version="1.0" encoding="utf-8"?>';
$siteref = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST'];
diff --git
a/thumb/index.php
b/thumb/index.php
index b4f6091f5005ec405e433504ebb1f98d098cbb36..4549b44e6ab67385c52d6168da8b8b529ea16fe4 100644
(file)
--- a/
thumb/index.php
+++ b/
thumb/index.php
@@
-1,6
+1,4
@@
<?php
<?php
-ob_clean();
-
list ($size, $imgpath) = explode('/', ltrim($Args, '/'), 2);
$imgpath = preg_replace('{^(?=[0-9]+/)}', 'data/', $imgpath, 1);
list ($size, $imgpath) = explode('/', ltrim($Args, '/'), 2);
$imgpath = preg_replace('{^(?=[0-9]+/)}', 'data/', $imgpath, 1);