-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.php
58 lines (50 loc) · 2.04 KB
/
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
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
<?php
/**
* Package Name: Stripe Pad
* File Description: Index.php
*
* @author Beto Ayesa <beto.phpninja@gmail.com>
* @version 1.0.0
* @package StripePad
* @license GPL3
* @link https://github.com/natzar/stripe-pad
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This file is part of Stripe Pad.
*
* Stripe Pad is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* Stripe Pad is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Stripe Pad. If not, see <https://www.gnu.org/licenses/>.
*/
# Load Environment
include_once dirname(__FILE__) . '/core/sp-load.php'; //
include_once CORE_PATH . 'sp-core.php';
# Load Custom App
include_once APP_PATH . "App.php";
# Sanitize 'p' parameter to prevent injection
# $actionName = filter_input(INPUT_GET, 'p', FILTER_SANITIZE_STRING);
# Deprecated PHP 8
$actionName = isset($_GET['p']) ?? preg_replace('/[^a-zA-Z0-9_]/', '', $_GET['p']);
if (!$actionName) {
$actionName = 'index'; // Default action
}
# Include app/App.php that extends core/sp-core.php
$App = new App();
# Url = Method = Does the url exist?
if (!is_callable(array('App', $actionName))) {
$App->view->error404();
} else {
$App->$actionName();
}