nieuws: hide text after cover image in overviews
[minimedit.git] / nieuws.php
index 84a6172638cd446dc98a342f333497065bdfa9e4..2b0151da20f0de37f327e68c1d6af6503dd74ceb 100644 (file)
@@ -1,35 +1,22 @@
 <?php
-include 'nieuws.inc.php';
-
-@list ($year, $month, $page) = explode('/', trim($Args, '/'));
-
-if ($page) {
-       $edit = !empty($User['admin']) ? htmlspecialchars(@$_GET['edit']) : NULL;
-       print shownewsarticle($Args, FALSE, $edit);
-       return 1;
-}
-
-if ($year) {
-       ob_clean();
-       print "<h2>Nieuws $year</h2>\n\n";
-
-       print '<div id="news">'."\n\n";
-       shownews("$Page/$year/??", 100);
-       print "</div>\n\n";
-
-       return 1;
+include_once 'nieuws.inc.php';
+$articles = (ltrim($Args, '/') ?: 'nieuws');
+if (strpos($articles, '/') === FALSE) {
+       if (@$Place['view'] === 'toc') {
+               foreach (array_reverse(glob("$articles/2???")) as $page) {
+                       $year = basename($page, '.html');
+                       printf('<h3><a href="/%s">%s</a></h3>'."\n", $page, $year);
+                       printtoc($page);
+               }
+               return;
+       }
+       $articles .= '/????';
 }
 
-print '<div id="news">'."\n\n";
-
-foreach (array_reverse(glob("$Page/2???")) as $page) {
-       $year = basename($page, '.html');
-       printf('<h3><a href="/%s">%s</a></h3>'."\n", $page, $year);
-       printtoc("$page/??");
-}
-
-print "</div>\n\n";
-
-if (!empty($User['admin'])) {
-       print '<script src="/nieuws/edit.js"></script>'."\n";
+if (@$Place['view'] === 'toc') {
+       printtoc($articles);
+       return;
 }
+ob_start();
+shownews($articles, @$Place['n'] ?: 5);
+print getoutput();