-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
85 lines (73 loc) · 1.91 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
<?php
require_once 'config.php';
require 'init.php';
$title = '';
$selfPath = '';
$uri = $_SERVER['REQUEST_URI'];
function D($var, $exit = 0)
{
print '<div style="background-color: #ffffff; padding: 3px; z-index: 1000;"><pre style="text-align: left; font: normal 10px Courier; color: #000000;">';
if ( is_array($var) || is_object($var) ) print_r($var);
else var_dump($var);
print '</pre></div>';
if ( $exit ) exit;
}
switch (True) {
case preg_match('#^/$#', $uri):
$tpl = 'containers/container';
$title = 'News_portal';
$selfPath .= 'containers/container';
break;
case preg_match('#^/account/login#', $uri):
exit_if(true);
require 'controller/login.php';
$tpl = 'account/login';
$title = 'login';
$selfPath .= 'account/login';
break;
case preg_match('#^/account/register#', $uri):
exit_if(true);
require 'controller/register.php';
$tpl = 'account/register';
$title = 'register';
$selfPath .= 'account/register';
break;
case preg_match('#^/account/logout#', $uri):
require 'controller/logout.php';
break;
case preg_match('#^/documents#', $uri):
$selfPath .= 'documents';
$title = 'List news';
require 'controller/documents.php';
$tpl = 'documents';
break;
case preg_match('#^/document/\d+#', $uri):
$selfPath .= '/document/';
$title = '';
require 'controller/document.php';
$tpl = 'document';
break;
case preg_match('#^/document/add#', $uri):
$title = 'New document';
$selfPath .= '/document/add';
require 'controller/add.php';
$tpl = 'add';
break;
case preg_match('#^/document/edit#', $uri):
require 'controller/add.php';
$tpl = 'add';
$title = 'edit';
$selfPath .= '/document/edit';
break;
case preg_match('#^/document/remove#', $uri):
require 'controller/remove.php';
break;
default:
$tpl = '404';
$title = '404';
$selfPath .= '404';
break;
}
$data['title'] = $title;
$data['selfPath'] = $selfPath;
render_content($tpl, $data);