-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathindex.php
30 lines (27 loc) · 936 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
include(__DIR__ . '/webdata/init.inc.php');
class MyDispatcher extends Pix_Controller_Dispatcher
{
public function dispatch($path)
{
if ($path == '/swagger.json') {
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
readfile(__DIR__ . '/webdata/swagger.json');
exit;
}
if (preg_match('#^/id/\d+$#', $path)) {
return array('index', 'show');
} elseif (preg_match('#^/fund/#', $path)) {
return array('index', 'fund');
} elseif (preg_match('#^/branch/#', $path)) {
return array('index', 'branch');
} elseif (preg_match('#^/name/#', $path)) {
return array('index', 'name');
}
return null;
}
}
Pix_Controller::addDispatcher(new MyDispatcher);
Pix_Controller::addCommonHelpers();
Pix_Controller::dispatch(__DIR__ . '/webdata/');