misuzu/public/news.php

32 lines
877 B
PHP
Raw Normal View History

2018-04-14 04:58:53 +02:00
<?php
namespace Misuzu;
require_once '../misuzu.php';
2018-04-14 04:58:53 +02:00
http_response_code(301);
$location = url('news-index');
2019-06-10 19:04:53 +02:00
if(!empty($_GET['n']) && is_string($_GET['n'])) {
$location = url('news-post', [
2019-03-18 23:02:30 +01:00
'post' => (int)$_GET['n'],
]);
2019-03-18 23:02:30 +01:00
}
$feedMode = trim($_SERVER['PATH_INFO'] ?? '', '/');
2019-03-18 23:02:30 +01:00
$categoryId = !empty($_GET['c']) && is_string($_GET['c']) ? (int)$_GET['c'] : 0;
$postId = !empty($_GET['p']) && is_string($_GET['p']) ? (int)$_GET['p'] : 0;
2018-04-14 04:58:53 +02:00
if(!empty($feedMode) && news_feed_supported($feedMode)) {
$location = empty($categoryId) ? url("news-feed-{$feedMode}") : url("news-category-feed-{$feedMode}", ['category' => $categoryId]);
2018-04-14 04:58:53 +02:00
}
2019-06-10 19:04:53 +02:00
if($postId > 0) {
$location = url('news-post', ['post' => $postId]);
}
2019-06-10 19:04:53 +02:00
if($categoryId > 0) {
$location = url('news-category', ['category' => $categoryId, 'page' => pagination_param('page')]);
2018-04-16 02:33:54 +02:00
}
2018-04-14 04:58:53 +02:00
redirect($location);