- print shownewsarticle($Page.$Args, FALSE, $edit);
-
- if ($replyform) {
- print '<h3>Reacties</h3>'."\n";
- $pagelink = $Page.$Args;
-
- if ($_POST) {
- try {
- @mkdir($pagelink);
- $target = $pagelink.'/'.date('YmdHis').':'.$User['name'].'.txt';
- $written = file_put_contents($target, $_POST['reply']);
- if ($written === FALSE) {
- throw new Exception('Fout bij opslaan');
- }
- $_POST['reply'] = NULL;
- }
- catch (Exception $e) {
- print '<p class=warn>Antwoord niet opgeslagen.</p>'."\n\n";
- }
+ $article = new ArchiveArticle("$Page$Args.html");
+ $Place['title'] = $edit ?: $article->title;
+ $Place[1] = ' <small class="date">'.$article->date.'</small>';
+ print preg_replace('{(?<=<h2>)(.*?)(?=</h2>)}', ($edit ?: '\1').' [[1]]', ob_get_clean());
+ if ($article->file and $article->image) {
+ $Place['image'] = "/".$article->thumb('600x');
+ }
+ if (!empty($User['admin'])) {
+ $taglist = [];
+ foreach (glob("$Page/.tags/*") as $tagpath) {
+ $tagname = pathinfo($tagpath, PATHINFO_BASENAME);
+ $tagvalue = file_exists("$tagpath/$year-$page.html");
+ $tagtarget = is_writable($tagpath);
+ $taglist[] = sprintf(
+ '<input type="checkbox" name="%s" value="%s" id="%s"%s%s />' .
+ '<label for="%3$s"> %s</label>',
+ "tags[$tagname]", $tagname, "tag-$tagname",
+ $tagvalue ? ' checked' : '',
+ ' disabled',
+ ucfirst($tagname)
+ );