2018-04-14 04:58:53 +02:00
|
|
|
<?php
|
2019-09-29 00:43:51 +02:00
|
|
|
namespace Misuzu;
|
|
|
|
|
2018-10-04 22:30:55 +02:00
|
|
|
require_once '../misuzu.php';
|
2018-04-14 04:58:53 +02:00
|
|
|
|
2019-05-28 22:07:20 +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'])) {
|
2019-05-28 22:07:20 +02:00
|
|
|
$location = url('news-post', [
|
2019-03-18 23:02:30 +01:00
|
|
|
'post' => (int)$_GET['n'],
|
2019-05-28 22:07:20 +02:00
|
|
|
]);
|
2019-03-18 23:02:30 +01:00
|
|
|
}
|
|
|
|
|
2019-04-12 23:37:59 +02: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
|
|
|
|
2019-12-12 01:42:28 +01:00
|
|
|
if(!empty($feedMode) && in_array($feedMode, ['rss', 'atom'])) {
|
2019-05-28 22:07:20 +02:00
|
|
|
$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) {
|
2019-05-28 22:07:20 +02:00
|
|
|
$location = url('news-post', ['post' => $postId]);
|
2019-05-28 22:01:02 +02:00
|
|
|
}
|
|
|
|
|
2019-06-10 19:04:53 +02:00
|
|
|
if($categoryId > 0) {
|
2019-12-06 02:04:10 +01:00
|
|
|
$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
|
|
|
|
2019-06-08 23:46:24 +02:00
|
|
|
redirect($location);
|