Files
larablog/routes/legacy.php
T
ak 263b98b218 Initial baseline: LaraBlog core with plugin commerce surface.
Captures the current working tree after theme slots, ArticleAccess, and the payment / paid-content plugins so subsequent work has a reviewable git history.
2026-08-12 01:15:38 +08:00

70 lines
3.7 KiB
PHP

<?php
use App\Http\Controllers\AttachmentController;
use App\Http\Controllers\AuthController;
use App\Http\Controllers\BlogController;
use App\Http\Controllers\CommentController;
use App\Http\Controllers\LegacyGoneController;
use App\Http\Controllers\SeoController;
use Illuminate\Support\Facades\Route;
Route::get('/', [BlogController::class, 'index'])->name('home');
Route::match(['get', 'post'], '/show-{id}.shtml', [BlogController::class, 'show'])->whereNumber('id');
Route::match(['get', 'post'], '/show-{id}-{page}.shtml', [BlogController::class, 'show'])->whereNumber('id')->whereNumber('page');
Route::get('/category-{cid}.shtml', [BlogController::class, 'category'])->whereNumber('cid');
Route::get('/category-{cid}-{page}.shtml', [BlogController::class, 'category'])->whereNumber('cid')->whereNumber('page');
Route::get('/archives.shtml', fn () => app(BlogController::class)->archives(request(), 'all'));
Route::get('/archives-{date}.shtml', [BlogController::class, 'archives'])->where('date', '\d{6}');
Route::get('/archives-{date}-{page}.shtml', [BlogController::class, 'archives'])->where('date', '\d{6}')->whereNumber('page');
Route::get('/tagslist.shtml', [BlogController::class, 'tagsList']);
Route::get('/tagslist-{page}.shtml', [BlogController::class, 'tagsList'])->whereNumber('page');
Route::get('/tag/{name}', [BlogController::class, 'tag'])->name('tag.show');
Route::get('/comments.shtml', [BlogController::class, 'comments']);
Route::get('/comments-{page}.shtml', [BlogController::class, 'comments'])->whereNumber('page');
Route::get('/search.shtml', [BlogController::class, 'search']);
Route::get('/search-{page}.shtml', [BlogController::class, 'search'])->whereNumber('page');
// Legacy sablog clients POST without Laravel CSRF; forms in themes still include @csrf.
Route::match(['get', 'post'], '/post.php', function () {
$action = request()->input('action', request()->query('action'));
return match ($action) {
'addcomment' => app(CommentController::class)->store(request()),
'search' => app(BlogController::class)->search(request()),
'dologin' => app(AuthController::class)->login(request()),
'register' => app(AuthController::class)->register(request()),
'modpro' => app(AuthController::class)->updateProfile(request()),
'logout' => app(AuthController::class)->logout(request()),
default => abort(404),
};
})->withoutMiddleware([\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class]);
Route::get('/links.shtml', [BlogController::class, 'links']);
Route::get('/login.shtml', [AuthController::class, 'showLogin'])->name('login');
Route::get('/reg.shtml', [AuthController::class, 'showRegister']);
Route::get('/rss.xml', [SeoController::class, 'rss']);
Route::get('/rss.php', [SeoController::class, 'rss']);
Route::get('/sitemap.xml', [SeoController::class, 'sitemap']);
Route::get('/sitemap.php', [SeoController::class, 'sitemap']);
Route::get('/llms.txt', [SeoController::class, 'llms']);
Route::get('/robots.txt', [SeoController::class, 'robots']);
Route::get('/attachment.php', [AttachmentController::class, 'byId']);
Route::get('/attachments/{path}', [AttachmentController::class, 'byPath'])->where('path', '.*');
Route::any('/tburl.php', LegacyGoneController::class)
->withoutMiddleware([\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class]);
Route::any('/trackback.php', LegacyGoneController::class)
->withoutMiddleware([\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class]);
// Old sablog PHP admin paths (do not shadow Filament /admin panel).
Route::any('/admin/{path}.php', LegacyGoneController::class)->where('path', '.*');
Route::any('/admincp.php', LegacyGoneController::class);
Route::any('/wap/{path?}', LegacyGoneController::class)->where('path', '.*');