- 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";
- }
+if ($page and !is_numeric($page)) {
+ $edit = $User && $User->admin('news') ? htmlspecialchars(@$_GET['edit']) : NULL;
+ if ($edit) {
+ $Article->title = $edit;
+ }
+ $Place[1] = ' <small class="date">'.$Article->date.'</small>';
+ print preg_replace('{(?<=<h2>)(.*?)(?=</h2>)}', ($edit ?: '\1').' [[1]]', ob_get_clean());
+ if ($User and $User->admin('news')) {
+ $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)
+ );