43 lines
2.0 KiB
PHP
43 lines
2.0 KiB
PHP
<?php
|
|
|
|
return (function() {
|
|
require_once 'lib/files.php';
|
|
|
|
$files_collections = array_map(fn(FilesCollection $fn) => $fn->value, FilesCollection::cases());
|
|
$coll_with_folder_support = [FilesCollection::WilliamFriedman->value, FilesCollection::Baconiana->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/{'.implode(',', $coll_with_folder_support).'}/(\d+)/' => 'collection collection=${1} 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,errors}/' => '${1}',
|
|
'admin/{auth,actions}-log/' => '${1}_log',
|
|
'admin/uploads/{edit_note,delete}/(\d+)/' => 'upload_${1} id=$(1)'
|
|
]
|
|
];
|
|
|
|
return $routes;
|
|
})();
|