This repository was archived by the owner on Mar 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
109 lines (87 loc) · 2.76 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
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
<?php
require 'config.php';
require 'constants.php';
require 'autoloader.php';
$default_actions = array(
'list' => array(
'name' => 'Lister'
),
/*'search' => array(
'name' => 'Rechercher'
),*/
'add' => array(
'name' => 'Ajouter'
),
/*'edit' => array(
'name' => 'Modifier'
),
'delete' => array(
'name' => 'Supprimer'
),*/
);
$g_modules = array(
'ranking' => array(
'name' => 'Classements',
'actions' => array(
'SD' => array('name' => 'Simple Dames'),
'SH' => array('name' => 'Simple Hommes'),
'DX' => array('name' => 'Double Mixte'),
'DD' => array('name' => 'Double Dames'),
'DH' => array('name' => 'Double Hommes'),
'all' => array('name' => 'Tous', 'hidden' => TRUE), // for printing only
)
),
'set' => array(
'name' => 'Sets',
'actions' => $default_actions,
),
'player' => array(
'name' => 'Joueurs',
'actions' => array(
'list' => array('name' => 'Lister'),
'add' => array('name' => 'Ajouter'),
'detail' => array('name' => 'Détails', 'hidden' => TRUE),
),
),
);
// remove magic quotes if necessary
if (get_magic_quotes_gpc()) {
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
while (list($key, $val) = each($process)) {
foreach ($val as $k => $v) {
unset($process[$key][$k]);
if (is_array($v)) {
$process[$key][stripslashes($k)] = $v;
$process[] = &$process[$key][stripslashes($k)];
} else {
$process[$key][stripslashes($k)] = stripslashes($v);
}
}
}
unset($process);
}
// processing page
Session::start();
Database::open();
// define current module
$modules_codes_list = array_keys($g_modules);
$g_current_module = $modules_codes_list[0];
if (isset($_GET['module']) && in_array($_GET['module'], $modules_codes_list))
$g_current_module = $_GET['module'];
// define current action
$g_actions = $g_modules[$g_current_module]['actions'];
$actions_codes_list = array_keys($g_actions);
$g_current_action = $actions_codes_list[0];
if (isset($_GET['action']) && in_array($_GET['action'], $actions_codes_list))
$g_current_action = $_GET['action'];
$g_method = $_SERVER['REQUEST_METHOD'];
if ($g_method == 'GET')
require 'header.php';
$filename_to_include = 'app/'.$g_current_module.'/'.$g_current_action.'_'.strtolower($g_method).'.php';
if (!file_exists($filename_to_include))
echo "<p class=\"error\">File '".$filename_to_include."' does not exists</p>";
else
require $filename_to_include;
if ($g_method == 'GET')
require 'footer.php';
Database::close();