-
Notifications
You must be signed in to change notification settings - Fork 0
/
router.php
63 lines (49 loc) · 2.73 KB
/
router.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
<?php
/***********************************************************************************/
/* (C) 2020 - Skyfallen */
/* Skyfallen Secure Forms Developed by */
/* The Skyfallen Company */
/* */
/* File Since: SFR-301009 */
/* This file is handles all url requests and redirects them. */
/***********************************************************************************/
// Check if our ABSPATH is defined
defined("SSF_ABSPATH") or die("Don't mess!");
// Start routing all urls
// Redirects for the login page
include_once SSF_ABSPATH."/views/login.php";
SSF_Router::routePage("/","redirect_to_login");
SSF_Router::routePage("accounts/login","render_login");
SSF_Router::routePage("accounts/register","render_register");
SSF_Router::routePage("accounts/logout","do_logout");
// Redirects for the user's panel
include_once SSF_ABSPATH."/views/userpage.php";
SSF_Router::routePage("accounts/dashboard","render_dashboard",true,"redirect_to_login");
SSF_Router::routePage("accounts/dashboard/newform","render_page_new_form",true,"redirect_to_login");
SSF_Router::routePrefix("forms/delete","render_page_delete_form",true,true,"redirect_to_login");
// Redirects for the form editor
include_once SSF_ABSPATH."/views/form_editor.php";
SSF_Router::routePrefix("forms/edit","render_form_editor",true,true,"redirect_to_login");
// Redirects for the form editor
include_once SSF_ABSPATH."/views/form_responses.php";
SSF_Router::routePrefix("forms/responses","render_form_responses",true,true,"redirect_to_login");
// Redirects for the form renderer
include_once SSF_ABSPATH."/views/form_view.php";
SSF_Router::routePrefix("form","render_form",true);
// Redirects for the JS API
include_once SSF_ABSPATH."/SSF_Includes/ssf_js_api.php";
SSF_Router::routePrefix("jsapi","handle_js_api",true,true,"redirect_to_login");
// Redirects for the Respond API
include_once SSF_ABSPATH."/SSF_Includes/respond_api.php";
SSF_Router::routePage("respond","handle_respond_api");
// Redirects for the Software Update Page
include_once SSF_ABSPATH."/views/updates_page.php";
SSF_Router::routePage("updates","render_updates_page",true,"redirect_to_login");
// Redirects for the Excel Export
include_once SSF_ABSPATH."/SSF_Includes/excelExport.php";
SSF_Router::routePrefix("forms/exportResponses","exportExcel",true,true,"redirect_to_login");
// If nothing was routed, display 404
if(!defined("ROUTED")){
// Include the 404 Page.
include_once SSF_ABSPATH."/SSF_Includes/404.php";
}