This repository has been archived by the owner on Feb 17, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 56
/
index.php
executable file
·190 lines (156 loc) · 5.52 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?php
/////////////////////////////////////////////////////////////////////////
//
// This file is part of index.php
//
// Foobar 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.
//
// Foobar 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
//
/////////////////////////////////////////////////////////////////////////
//
// Website : http://php-pastebin.com/
// Contact : [email protected]
//
/////////////////////////////////////////////////////////////////////////
//
// Dev : Atmoner
// Website : http://atmoner.com
// Contact : [email protected]
// Twitter : @atmon3r
//
/////////////////////////////////////////////////////////////////////////
error_reporting(E_ERROR | E_PARSE);
define("IN_PASTE",true);
// This part can be removed after install
if (file_exists("install.php")) {
if (filesize("libs/db.php") === 0) {
header("location:install.php");
}
} // This part can be removed after install
$path = dirname(__FILE__);
require_once($path.'/libs/startup.php');
require_once($path.'/libs/lang/lang_'.$_SESSION['strLangue'].'.php');
require_once($path.'/libs/agent.class.php');
$agent = new Agent();
$userId = $startUp->isLogged();
if ($userId && isset($_COOKIE['tokenAdmin']))
$isAdmin = $startUp->checkAdmin($_COOKIE['tokenAdmin']);
else
$isAdmin = false;
$smarty->assign("Name",$conf['title']);
$smarty->assign("getConfigs",$conf);
$smarty->assign("getUserdata",$startUp->getUserdata());
$smarty->assign("footer",$startUp->addFooter());
$smarty->assign("userId",$userId);
$smarty->assign("userName",$startUp->session_username);
$smarty->assign("Admin",$isAdmin);
// Stats
$today = time() - (1 * 24 * 60 * 60);
$smarty->assign("getTotalpaste",$startUp->getTotalpaste());
$smarty->assign("getTotalpastetoday",$startUp->getTotalpaste($today));
$smarty->assign("getTotalusers",$startUp->getTotalusers());
$smarty->assign("lang",$lang);
$hook->add_side_block('defaultSearchbox','','',1);
$hook->add_side_block('defaultSidebar','','', 3);
// Javascript hook
$hook->addJs('Jquery','https://code.jquery.com/jquery-latest.min.js','','1');
// Css hook
$hook->addCss('Style','style.css','themes/'.$conf['theme'].'/style/','1');
// Main menu hook
$hook->addMenu('addPaste',$lang["newPaste"], 'add.html', 'newpost.png', '3');
$hook->addMenu('viewAllpastes',$lang["viewPastes"], 'last-pastes.html', 'dashboard.png', '4');
// Lang menu hook
$hook->addMenuLang('en',$lang["english"], '?strLangue=en', 'en.png', '3');
$hook->addMenuLang('fr',$lang["french"], '?strLangue=fr', 'fr.png', '4');
$hook->addMenuLang('ru',$lang["russe"], '?strLangue=ru', 'ru.png', '5');
$hook->addMenuLang('nl',$lang["dutch"], '?strLangue=nl', 'nl.png', '2');
// Usermenu hook
if (!$userId) {
$hook->addUserMenu('gestcp','','','', '4');
} else {
if (isset($_COOKIE['tokenAdmin'])) {
if ($isAdmin) {
$hook->addUserMenu('admincp','','','', '4');
}
}
$hook->addUserMenu('usercp','','','', '8');
}
if ($hook->hook_exist('action'))
$hook->execute_hook('action');
switch (isset($_GET["page"])?$_GET["page"]:""){
case 'admincp':
# admin panel
include 'pages/admincp/admincp.index.php';
break;
case 'paste':
# paste
include 'pages/paste.php';
$smarty->display('paste.html');
break;
case 'last-pastes':
# laste paste
include 'pages/last-pastes.php';
$smarty->display('last-pastes.html');
break;
case 'zone-login':
# login
include 'pages/login.php';
$smarty->display('login.html');
break;
case 'registration':
# registration
include 'pages/registration.php';
$smarty->display('registration.html');
break;
case 'account':
# account
include 'pages/account.php';
$smarty->display('account.html');
break;
case 'edit-account':
# account
include 'pages/edit.account.php';
$smarty->display('edit.account.html');
break;
case 'premium':
# account
include 'pages/premium.php';
$smarty->display('premium.html');
break;
case 'user':
# account
include 'pages/user.php';
$smarty->display('user.html');
break;
case 'logout':
# logout
include 'pages/logout.php';
break;
case 'error':
# error
$smarty->display('error.html');
break;
case '':
case 'add':
case 'index':
# index
include 'pages/main.php';
$smarty->display('index.html');
break;
default:
if ($hook->hook_exist('new_page'))
$hook->execute_hook('new_page');
else
$startUp->redirect($conf['baseurl'].'/');
break;
}