aboutsummaryrefslogtreecommitdiff
path: root/app/class/routes.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2018-11-12 11:11:58 +0100
committervincent-peugnet <v.peugnet@free.fr>2018-11-12 11:11:58 +0100
commit89b05effb2eb45382762fcfcfae2373b7754caa7 (patch)
treede7a5298f1ef7a095c4b99e684c80b9152c686b1 /app/class/routes.php
parenta64af357ff41a61f5248e2052274315b390e979c (diff)
downloadwcms-89b05effb2eb45382762fcfcfae2373b7754caa7.tar.gz
wcms-89b05effb2eb45382762fcfcfae2373b7754caa7.zip
url-cleaning-redirect-correct-id
Diffstat (limited to 'app/class/routes.php')
-rw-r--r--app/class/routes.php24
1 files changed, 15 insertions, 9 deletions
diff --git a/app/class/routes.php b/app/class/routes.php
index 89f82e6..71b75d6 100644
--- a/app/class/routes.php
+++ b/app/class/routes.php
@@ -12,16 +12,17 @@ class Routes
if(!empty(Config::basepath())) {
$router->setBasePath(DIRECTORY_SEPARATOR . Config::basepath());
}
+ $router->addMatchTypes(array('cid' => '[a-zA-Z0-9-_+,\'!%@&.$€=\(\|\)]+'));
$router->addRoutes([
['GET|POST', '/', 'Backrouter#run', 'backrouter'],
- ['GET', '/[a:art]/', 'Controllerart#read', 'artread/'],
- ['GET', '/[a:art]', 'Controllerart#read', 'artread'],
- ['GET', '/[a:art]/add', 'Controllerart#add', 'artadd'],
- ['GET', '/[a:art]/edit', 'Controllerart#edit', 'artedit'],
- ['GET', '/[a:art]/log', 'Controllerart#log', 'artlog'],
- ['POST', '/[a:art]/edit', 'Controllerart#update', 'artupdate'],
- ['GET', '/[a:art]/delete', 'Controllerart#confirmdelete', 'artconfirmdelete'],
- ['POST', '/[a:art]/delete', 'Controllerart#delete', 'artdelete'],
+ ['GET', '/[cid:art]/', 'Controllerart#read', 'artread/'],
+ ['GET', '/[cid:art]', 'Controllerart#read', 'artread'],
+ ['GET', '/[cid:art]/add', 'Controllerart#add', 'artadd'],
+ ['GET', '/[cid:art]/edit', 'Controllerart#edit', 'artedit'],
+ ['GET', '/[cid:art]/log', 'Controllerart#log', 'artlog'],
+ ['POST', '/[cid:art]/edit', 'Controllerart#update', 'artupdate'],
+ ['GET', '/[cid:art]/delete', 'Controllerart#confirmdelete', 'artconfirmdelete'],
+ ['POST', '/[cid:art]/delete', 'Controllerart#delete', 'artdelete'],
]);
$match = $router->match();
@@ -36,7 +37,12 @@ class Routes
}
//404
else {
- header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');
+ if(!empty(Config::route404())) {
+ $controller = new Controller($router);
+ $controller->routedirect('artread/', ['art' => Config::route404()]);
+ } else {
+ header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');
+ }
}
}
} \ No newline at end of file