ob_start();
$Page = clone $this;
- $Page->handler = $Page->handler . $Page->path; // .= with explicit getter
- $Page->path = '';
- foreach ($params as $param) {
- if ($set = strpos($param, '=')) {
- $Page->place[ substr($param, 0, $set) ] = substr($param, $set + 1);
- }
- elseif (!empty($param)) {
- $Page->path .= '/'.$param;
+ if (is_array($params)) {
+ $Page->place += $params;
+ }
+ else {
+ foreach (explode(' ', $params) as $param) {
+ if ($set = strpos($param, '=')) {
+ $Page->place[ substr($param, 0, $set) ] = substr($param, $set + 1);
+ }
+ elseif (!empty($param)) {
+ $Page->place[] = $param;
+ }
}
}
- $Page->link .= $Page->path;
+
try {
include "widget/$name.php";
return ob_get_clean();
function ($sub) {
list ($placeholder, $name, $params) = $sub;
$html = $this->place[$name] ??
- $this->widget($name, explode(' ', $params));
+ $this->widget($name, $params);
if (empty($html) or $html[0] != '<') {
$html = "<span>$html</span>";
}
}
print "</ul>\n";
-print $Page->widget('nav', [
- "start=$nav[start]", "n=$nav[n]", "total=$nav[total]",
-]);
+print $Page->widget('nav', $nav);
$Page->place['maillist'] = ob_get_clean();
<?php
-if (empty($Page->path)) {
+if (empty($Page->place[0])) {
return;
}
-@list ($target, $interval) = explode('+', ltrim($Page->path, '/'));
+@list ($target, $interval) = explode('+', $Page->place[0]);
$target = new DateTime($target);
$now = new DateTime('NOW');
$next = $target->diff($now); # age
<?php
global $User;
+if (isset($Page->place[0])) {
+ $Page->link .= '/'.$Page->place[0];
+}
$cal = [];
foreach (glob("{$Page->link}/2*") as $url) {
$cal[$group][$date][$suffix] = $link;
}
}
+if (!$cal) {
+ return;
+}
$year = 3600 * 24 * 365; # seconds per year
$scale = 7; # em width per year
<?php
- $article = new ArchiveArticle($Page->path);
+ $article = new ArchiveArticle($Page->place[0]);
printf('<a href="%s">%s</a>', $article->link, $article->name);
if ($article->image) {
printf("\n\t".'<img class="right" src="/%s" />', $article->thumb('100x100'));
pclose($log);
$limit = $offset + $lines + 1; # assume one more
- $navoptions = ["start=$offset", "n=$pagesize", "total=$limit"];
- if ($Page->handler != 'login/commits') {
- $navoptions[] = 'link=login/commits';
- }
- print $Page->widget('nav', $navoptions);
+ print $Page->widget('nav', [
+ 'start' => $offset, 'n' => $pagesize, 'total' => $limit,
+ 'link' => $Page->link != 'login/commits' ? 'login/commits' : '',
+ ]);
}
<?php
$basepath = 'profile';
-if ($Page->path) $basepath .= '/.tags' . $Page->path;
+if (isset($Page->place[0])) {
+ $basepath .= '/.tags/' . $Page->place[0];
+}
$users = glob("$basepath/*/");
if (!$users) return;
}
}
-$articles = (ltrim($Page->path, '/') ?: 'nieuws');
+$articles = $Page->place[0] ?? 'nieuws';
if (strpos($articles, '/') === FALSE) {
if (@$Page->place['view'] === 'toc') {
print "<div>\n";
<?php
-$article = new ArchiveArticle(".{$Page->path}.html");
+$article = new ArchiveArticle("{$Page->place[0]}.html");
print $article->render();
}
}
$query = $Db->set('comments', [
- 'page' => $Page->handler,
+ 'page' => $Page->link,
'message' => $html,
'author' => $User->login,
]);
}
$cols = '*, (SELECT json_agg(journal.*) FROM journal WHERE comment_id = comments.id) AS journal';
-$query = $Db->query("SELECT $cols FROM comments WHERE page = ? ORDER BY created", [$Page->handler]);
+$query = $Db->query("SELECT $cols FROM comments WHERE page = ? ORDER BY created", [$Page->link]);
print '<ul class="replies">';
if ($User->login) {
print '<li>';
print '<form method="post" action="" enctype="multipart/form-data">';
- if (isset($Issue) and $User->admin("edit {$Page->handler}")) {
+ if (isset($Issue) and $User->admin("edit {$Page->link}")) {
print '<p>';
printf(
'<label for="%s">%s:</label> '
<?php
$limit = @$Page->place['limit'] ?: 10;
$path = ' '.escapeshellarg('*.html');
-$query = @$_REQUEST['q'] ?: $Page->path ?: $Page->handler;
+$query = @$_REQUEST['q'] ?: $Page->place[0] ?? $Page->link;
if (!trim($query, '/')) return;
<?php
# list article details
-$search = new PageSearch(ltrim($Page->path, '/') ?: '.');
+$search = new PageSearch($Page->place[0] ?? '.');
print '<ul class="replies">'."\n";
foreach ($search->files() as $ref => $sorted) {
- $Page->path = $ref;
+ $Page->place[0] = $ref;
print '<li>';
include 'linkref.php';
print "</li>\n";