misuzu/public/news.php

30 lines
861 B
PHP
Raw Normal View History

2018-04-14 02:58:53 +00:00
<?php
require_once '../misuzu.php';
2018-04-14 02:58:53 +00:00
http_response_code(301);
$location = url('news-index');
2019-03-18 22:02:30 +00:00
if (!empty($_GET['n']) && is_string($_GET['n'])) {
$location = url('news-post', [
2019-03-18 22:02:30 +00:00
'post' => (int)$_GET['n'],
]);
2019-03-18 22:02:30 +00:00
}
$feedMode = trim($_SERVER['PATH_INFO'] ?? '', '/');
2019-03-18 22:02:30 +00: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 02:58:53 +00: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 02:58:53 +00:00
}
if ($postId > 0) {
$location = url('news-post', ['post' => $postId]);
}
if ($categoryId > 0) {
$location = url('news-category', ['category' => $categoryId, 'page' => pagination_param('page')]);
2018-04-16 00:33:54 +00:00
}
2018-04-14 02:58:53 +00:00
redirect($location);