42 lines
1.8 KiB
PHP
42 lines
1.8 KiB
PHP
<?php
|
|
|
|
return (function() {
|
|
require_once 'lib/files.php';
|
|
$files_collections = array_map(fn(FilesCollection $fn) => $fn->value, FilesCollection::cases());
|
|
|
|
$wff = FilesCollection::WilliamFriedman->value;
|
|
|
|
$routes = [
|
|
'Main' => [
|
|
'/' => 'index',
|
|
'{about,contacts}/' => 'about',
|
|
'feed.rss' => 'rss',
|
|
'([a-z0-9-]+)/' => 'page name=$(1)',
|
|
'articles/' => 'articles',
|
|
'articles/([a-z0-9-]+)/' => 'post name=$(1)',
|
|
],
|
|
'Files' => [
|
|
'files/' => 'files',
|
|
'files/(\d+)/' => 'folder folder_id=$(1)',
|
|
'files/{'.implode(',', $files_collections).'}/' => 'collection collection=${1}',
|
|
'files/'.$wff.'/(\d+)/' => 'collection collection='.$wff.' folder_id=$(1)',
|
|
],
|
|
'Services' => [
|
|
'robots.txt' => 'robots_txt',
|
|
],
|
|
'Admin' => [
|
|
'admin/' => 'index',
|
|
'admin/{login,logout,log}/' => '${1}',
|
|
'([a-z0-9-]+)/{delete,edit}/' => 'page_${1} short_name=$(1)',
|
|
'([a-z0-9-]+)/create/' => 'page_add short_name=$(1)',
|
|
'articles/write/' => 'post_add',
|
|
'articles/([a-z0-9-]+)/{delete,edit}/' => 'post_${1} short_name=$(1)',
|
|
'admin/markdown-preview.ajax' => 'ajax_md_preview',
|
|
'admin/{uploads}/' => '${1}',
|
|
'admin/uploads/{edit_note,delete}/(\d+)/' => 'upload_${1} id=$(1)'
|
|
]
|
|
];
|
|
|
|
return $routes;
|
|
})();
|