4in1_ws_web/routes.php

39 lines
1.7 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)',
],
'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;
})();