forked from photo/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.php
130 lines (113 loc) · 5.73 KB
/
routes.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
require $configObj->get('paths')->libraries . '/routes-api.php';
/*
* Home page, optionally redirects if the theme doesn't have a front.php
*/
getRoute()->get('/', array('GeneralController', 'home'));
if($configObj->get('site')->maintenance == 1)
getRoute()->get('/maintenance', array('GeneralController', 'maintenance'));
/*
* General pages like robots.txt
*/
$routeObj->get('/robots.txt', array('GeneralController', 'robots')); // robots.txt
$routeObj->options('/.*', array('GeneralController', 'options')); // OPTIONS call
/*
* Action endpoints
* All action endpoints follow the same convention.
* Everything in []'s are optional
* /action/{id}[/{additional}]
*/
$routeObj->post('/action/([a-zA-Z0-9]+)/(photo)/create', array('ActionController', 'create')); // post an action (/action/{id}/{type}/create)
/*
* Manage endpoints
* /manage
*/
$routeObj->get('/manage', array('ManageController', 'home')); // redirect to /manage/photos
$routeObj->get('/manage/photos', array('ManageController', 'photos'));
$routeObj->get('/manage/albums', array('ManageController', 'albums'));
$routeObj->get('/manage/apps', array('ManageController', 'apps'));
$routeObj->get('/manage/apps/callback', array('ManageController', 'appsCallback'));
$routeObj->get('/manage/features', array('ManageController', 'features')); // redirect to /manage/settings
$routeObj->get('/manage/settings', array('ManageController', 'settings'));
$routeObj->post('/manage/settings', array('ManageController', 'settingsPost'));
$routeObj->get('/manage/groups', array('ManageController', 'groups'));
$routeObj->get('/manage/password/reset/([a-z0-9]{32})', array('ManageController', 'passwordReset'));
/*
* Album endpoints
* All album endpoints follow the same convention.
* Everything in []'s are optional
* /album[s][/:id]/{action}
*/
getRoute()->get('/albums/list', array('AlbumController', 'list_')); // retrieve activities (/albums/list)
/*
* Photo endpoints
* All photo endpoints follow the same convention.
* Everything in []'s are optional
* /photo/{id}[/{additional}]
*/
$routeObj->get('/photo/([a-zA-Z0-9]+)/edit', array('PhotoController', 'edit')); // edit form for a photo (/photo/{id}/edit)
$routeObj->get('/photo/([a-zA-Z0-9]+)/create/([a-z0-9]+)/([0-9]+)x([0-9]+)x?(.*).jpg', array('PhotoController', 'create')); // create a version of a photo (/photo/create/{id}/{options}.jpg)
$routeObj->get('/photo/([a-zA-Z0-9]+)/download', array('PhotoController', 'download')); // download a high resolution version of a photo (/photo/create/{id}/{options}.jpg)
$routeObj->get('/photo/([a-zA-Z0-9]+)/?(.+)?/view', array('PhotoController', 'view')); // view a photo (/photo/{id}[/{options}])/view
$routeObj->get('/p/([a-zA-Z0-9]+)/?(.+)?', array('PhotoController', 'view')); // (shortcut for photo/view) view a photo (/p/{id}[/{options}])
$routeObj->post('/photo/([a-zA-Z0-9]+)/update', array('PhotoController', 'update')); // update a photo (/photo/{id}/update
$routeObj->post('/photo/upload', array('PhotoController', 'uploadPost')); // upload a photo
$routeObj->get('/photos/upload', array('PhotoController', 'upload')); // view the upload photo form
$routeObj->get('/photos/?(.+)?/list', array('PhotoController', 'list_')); // view all photos / optionally filter (/photos[/{options})]/list
/*
* Resource mapping endpoints
* All shortener endpoints follow the same convention.
* Everything in []'s are optional
* /s[/{id}]/{action}
*/
// the optional trailing slash is because the twitter popup appends it to the url automatically
$routeObj->get('/?v?1?/s/([a-z0-9]+)/?', array('ResourceMapController', 'render'), EpiApi::external); // create a resource map (/s/{id}/view.json)
/*
* Tag endpoints
* All tag endpoints follow the same convention.
* Everything in []'s are optional
* /tag[s][/{id}/]{action}
*/
$routeObj->get('/tags/list', array('TagController', 'list_')); // view tags
/*
* User endpoints
* All user endpoints follow the same convention.
* Everything in []'s are optional
* /user/{action}
*/
$routeObj->get('/user/login', array('UserController', 'login')); // logout
$routeObj->get('/user/logout', array('UserController', 'logout')); // logout
/*
* Webhook endpoints follow the same convention.
* Everything in []'s are optional
* /webhook[s][/{id}]/{action}
*/
$routeObj->post('/?1?/webhook/subscribe', array('WebhookController', 'subscribe'));
/*
* OAuth endpoints
* All oauth endpoints follow the same convention.
* /v{version}/oauth/{action}
*/
$routeObj->get('/v[1-2]/oauth/authorize', array('OAuthController', 'authorize'));
$routeObj->post('/v[1-2]/oauth/authorize', array('OAuthController', 'authorizePost'));
$routeObj->post('/v[1-2]/oauth/token/access', array('OAuthController', 'tokenAccess'));
$routeObj->get('/v[1-2]/oauth/token/access', array('OAuthController', 'tokenAccess'));
$routeObj->post('/v[1-2]/oauth/token/request', array('OAuthController', 'tokenRequest'));
$routeObj->get('/v[1-2]/oauth/test', array('OAuthController', 'test'));
$routeObj->get('/v[1-2]/oauth/flow', array('OAuthController', 'flow'));
/*
* Map API to route through to map adapter
*/
$routeObj->get('/map/([0-9.-]+)/([0-9.-]+)/([0-9]+)/([0-9]+x[0-9]+)/(.+)/map.png', array('MapController', 'render')); // /map/;lat/:lon/:zoom/:size/:type/map.jpg
/*
* Asset endpoints
* All asset endpoints follow the same convention.
* Everything in []'s are optional
* /assets/cache/:version/:type/:file[,:file]
*/
$routeObj->get('/assets/.*/stylesheets/lessc', array('AssetsController', 'lessc'));
$routeObj->get('/assets/cache/([^/]+)/(js|css)/(c|m)(/.+)', array('AssetsController', 'get'));
$routeObj->get('/assets/versioned/[^/]+/(.+)', array('AssetsController', 'staticAsset'));
if($runUpgrade)
require $configObj->get('paths')->libraries . '/routes-upgrade.php';
require $configObj->get('paths')->libraries . '/routes-error.php';