/
index.php
135 lines (101 loc) · 5.07 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
define('MY_CMS', 'CMS');
require './routes.php';
require './app/config/db.php';
require './app/config/sh_config.php';
require STATUS_404;
session_start();
if(isset($_GET['action']) && $_GET['action'] == 'register' ) {
require CTL_REGISTER;
register($_POST['username'], $_POST['fullname'], $_POST['password'], $_POST['dob'], $_POST['mail'], $_POST['reapeatpassword'], $_POST['register']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'login') {
require CTL_LOGIN;
login($_POST['username'], $_POST['password'], $_POST['login']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'logout') {
require CTL_LOGOUT;
logout();
} elseif (isset($_GET['action']) && $_GET['action'] == 'changepass') {
require CTL_USER;
changepass($_POST['oldpassword'], $_POST['newpassword'], $_POST['repeatnewpassword'], $_POST['changepass']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'profile_id') {
require CTL_USER;
profile_by_id($_GET['id']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'profile') {
require CTL_USER;
profile();
} elseif (isset($_GET['action']) && $_GET['action'] == 'editprofile') {
require CTL_USER;
editprofile($_POST['fullname'], $_POST['mail'], $_POST['dob'], $_POST['img'], $_POST['bio'], $_POST['linkedin'], $_POST['github'], $_POST['twitter'], $_POST['instagram'], $_POST['facebook'], $_POST['editprofile']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'posts' && isset($_SESSION['username'])) {
require CTL_POSTS;
ctl_posts();
} elseif (isset($_GET['action']) && $_GET['action'] == 'post' && isset($_GET['id'])) {
require CTL_POSTS;
ctl_posts_by_id($_GET['id']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'deletepost' && isset($_GET['id'])) {
require CTL_POSTS;
delete_post($_GET['id']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'editpost' && isset($_GET['id'])) {
require CTL_POSTS;
edit_post($_GET['id'], $_POST['title'], $_POST['content'], $_POST['image'], $_POST['tags']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'pdf' && isset($_GET['id'])) {
require CTL_POSTS;
ctl_posts_by_id_pdf($_GET['id']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'reporter_panel' && isset($_GET['view'])) {
require CTL_REPORTER;
reporter_panel();
} elseif (isset($_GET['action']) && $_GET['action'] == 'reporter_panel' && isset($_GET['create_post'])) {
require CTL_REPORTER;
create_post($_POST['title'], $_POST['tags'], $_POST['content'], $_POST['image'], $_POST['category']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'reporter_panel' && isset($_GET['create_category'])) {
require CTL_REPORTER;
create_category($_POST['category_name'], $_POST['description'], $_POST['image']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'reporters_profile') {
require CTL_REPORTER;
reporters_profile();
} elseif (isset($_GET['action']) && $_GET['action'] == 'apanel') {
require CTL_ADMINS;
admin_panel();
} elseif (isset($_GET['action']) && $_GET['action'] == 'setuser') {
require CTL_ADMINS;
if (isset($_GET['admin'])) {
set_user($_GET['id'], ADMIN_LEVEL);
} elseif (isset($_GET['reporter'])) {
set_user($_GET['id'], 5);
} elseif (isset($_GET['user'])) {
set_user($_GET['id'], 0);
}
} elseif (isset($_GET['action']) && $_GET['action'] == 'apanel' && isset($_GET['deleteuser'])) {
require CTL_ADMINS;
delete_user($_GET['id']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'apanel_download' && isset($_GET['dir']) && isset($_GET['file'])) {
require CTL_ADMINS;
download_file($_GET['dir'], $_GET['file']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'apanel_fs_delete' && isset($_GET['file'])) {
require CTL_ADMINS;
delete_file($_GET['dir'], $_GET['file']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'apanel_fs_delete_folder') {
require CTL_ADMINS;
delete_folder($_GET['dir'], $_GET['folder']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'apanel_fs_download_folder') {
require CTL_ADMINS;
download_folder($_GET['dir'], $_GET['folder']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'saveprivate') {
require CTL_USER;
save_private($_POST['showEmail'], $_POST['showDob'], $_POST['showFullname'], $_POST['showBio'], $_POST['showSocial'], $_POST['sendNotifications']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'categories') {
require CTL_POSTS;
categories();
} elseif (isset($_GET['action']) && $_GET['action'] == 'posts_category') {
require CTL_POSTS;
posts_category($_GET['id']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'posts_category_edit') {
require CTL_POSTS;
posts_category_edit($_GET['id'], $_POST['name'], $_POST['description'], $_POST['image']);
} elseif (isset($_GET['action']) && $_GET['action'] == 'posts_delete_category') {
require CTL_POSTS;
posts_category_delete($_GET['id']);
} else { //Si no existe GET o POST -> muestra la pagina principal
require CTL_MAIN;
start_app();
}