This repository has been archived on 2024-06-26. You can view files and clone it, but cannot push or open issues or pull requests.
sakura/routes.php

196 lines
4.4 KiB
PHP
Raw Normal View History

2016-01-30 00:18:23 +00:00
<?php
/*
* Router paths
*/
// Define namespace
namespace Sakura;
2016-01-30 13:25:18 +00:00
// Meta pages
2016-02-14 22:46:07 +00:00
Router::get('/', 'Meta@index', 'main.index');
Router::get('/faq', 'Meta@faq', 'main.faq');
Router::get('/search', 'Meta@search', 'main.search');
Router::get('/p/{id}', 'Meta@infoPage', 'main.infopage');
2016-01-30 13:25:18 +00:00
2016-02-05 12:26:31 +00:00
// Auth
2016-02-14 22:46:07 +00:00
Router::get('/login', 'Auth@login', 'auth.login');
2016-02-05 12:26:31 +00:00
2016-01-30 13:25:18 +00:00
// News
2016-02-14 22:46:07 +00:00
Router::get('/news', 'Meta@news', 'news.index');
Router::get('/news/{category}', 'Meta@news', 'news.category');
Router::get('/news/{category}/{id}', 'Meta@news', 'news.post');
2016-01-30 13:25:18 +00:00
// Forum
2016-02-14 22:46:07 +00:00
Router::get('/forum', 'Forums@index', 'forums.index');
Router::get('/forum/{id}', 'Forums@forum', 'forums.forum');
2016-02-04 20:56:40 +00:00
// Members
2016-02-15 21:20:46 +00:00
Router::get('/members', 'User@members', 'members.index');
2016-02-14 22:46:07 +00:00
Router::get('/members/{rank}', 'User@members', 'members.rank');
2016-02-04 20:56:40 +00:00
// User
2016-02-14 22:46:07 +00:00
Router::get('/u/{id}', 'User@profile', 'user.profile');
2016-02-15 21:20:46 +00:00
Router::get('/u/{id}/header', 'Files@header', 'user.header');
// Files
Router::get('/a/{id}', 'Files@avatar', 'file.avatar');
Router::get('/bg/{id}', 'Files@background', 'file.background');
2016-01-30 13:25:18 +00:00
2016-02-13 13:36:21 +00:00
// Premium
2016-02-14 22:46:07 +00:00
Router::get('/support', 'Premium@index', 'premium.index');
Router::get('/support/tracker', 'Premium@tracker', 'premium.tracker');
2016-02-13 13:36:21 +00:00
2016-02-15 21:20:46 +00:00
// Management
/*
* General
* - Dashboard
* - Info pages (possibly deprecate with wiki)
* Configuration
* - General
* - Files
* - User
* - Mail
* Forums
* - Manage
* - Settings
* Comments
* - Manage
* Users
* - Manage users
* - Manage ranks
* - Profile fields
* - Option fields
* - Bans and restrictions
* - Warnings
* Permissions
* - Site
* - Management
* - Forum
* Logs
* - Actions
* - Management
* - Errors
*/
2016-01-30 13:25:18 +00:00
// Redirections
Router::any('/index.php', function () {
// Info pages
if (isset($_REQUEST['p'])) {
header('Location: /p/' . $_REQUEST['p']);
return;
}
// Forum index
if (isset($_REQUEST['forum']) && $_REQUEST['forum']) {
header('Location: /forum');
return;
}
// Site index
header('Location: /');
});
Router::any('/news.php', function () {
// Category + post
if (isset($_REQUEST['cat']) && isset($_REQUEST['id'])) {
header('Location: /news/' . $_REQUEST['cat'] . '/'. $_REQUEST['id']);
return;
}
// Category
if (isset($_REQUEST['cat'])) {
header('Location: /news/' . $_REQUEST['cat']);
return;
}
// Post in the main category
if (isset($_REQUEST['id'])) {
header('Location: /news/' . $_REQUEST['id']);
return;
}
// All posts in main category
header('Location: /news');
});
2016-02-04 20:56:40 +00:00
Router::any('/profile.php', function () {
// Redirect to the profile
if (isset($_REQUEST['u'])) {
header('Location: /u/' . $_REQUEST['u']);
return;
}
// Redirect to index
header('Location: /');
});
Router::any('/members.php', function () {
// Append sort
$append = isset($_REQUEST['sort']) ? '?sort=' . $_REQUEST['sort'] : '';
// Redirect to the profile
if (isset($_REQUEST['rank'])) {
header('Location: /members/' . $_REQUEST['rank'] . $append);
return;
}
// Redirect to index
header('Location: /members/' . $append);
});
Router::any('/viewforum.php', function () {
// Redirect to the profile
if (isset($_REQUEST['f'])) {
$req = [];
foreach ($_REQUEST as $k => $v) {
if ($k == 'f') {
continue;
}
$req[] = $k . '=' . $v;
}
header('Location: /forum/' . $_REQUEST['f'] . ($req ? '?' . implode('&', $req) : ''));
return;
}
// Redirect to index
header('Location: /forum/');
});
2016-02-13 13:36:21 +00:00
Router::any('/support.php', function () {
if (isset($_GET['tracker'])) {
header('Location: /support/tracker');
return;
}
header('Location: /support');
});
2016-02-15 21:20:46 +00:00
Router::any('/imageserve.php', function () {
// Category + post
if (isset($_REQUEST['u']) && isset($_REQUEST['m'])) {
switch ($_REQUEST['m']) {
case 'avatar':
header('Location: /a/' . $_REQUEST['u']);
return;
case 'background':
header('Location: /bg/' . $_REQUEST['u']);
return;
case 'header':
header('Location: /u/' . $_REQUEST['u'] . '/header');
return;
}
}
header('Location: /bg/0');
});
2016-01-30 13:25:18 +00:00
Router::any('/faq.php', function () {
header('Location: /faq');
});
Router::any('/search.php', function () {
header('Location: /search');
});