-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtools.php
More file actions
70 lines (63 loc) · 2.9 KB
/
tools.php
File metadata and controls
70 lines (63 loc) · 2.9 KB
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
<?php
require_once 'libs/lib.php';
require_once get_mode() . '.config.php';
if (!init_app()) {
die("<div class=\"error_msg\">Non-logged in users cannot access this page directly. You need to be <a href=\"" . get_page_url('home') . "\">logged in</a> first.</div>");
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>KB Editor Tools
<?php
if (!empty($_REQUEST['script'])) {
echo ': ' . $_REQUEST['script'];
}
?></title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/flick/jquery-ui.css" type="text/css" />
<?php
include_jquery('corner');
include_jquery('form');
include_css('general.css');
include_css('stats.css');
include_css('messages.css');
include_css('tools.css');
include_js('general.js');
include_js('ajax.js');
?>
</head>
<body>
<div style="background-color:white; text-align: left; width: 800px; margin: auto; padding: 20px;">
<?php
try {
ini_set('display_errors', true);
if (!empty($_SESSION['user']) && !$_SESSION['user']->isEditor()) {
die('Editors only');
}
define('EDITOR_MODE', true);
print_r($_REQUEST);
if (empty($_REQUEST['script'])) {
echo '<ul>';
if ($handle = opendir('tools')) {
while (($file = readdir($handle)) !== false) {
if (substr($file, -4) == '.php' && filetype('tools/' . $file) !== 'dir') {
echo '<li><a href="' . APP_URL . 'tools/' . substr($file, 0, -4) . '/">' . substr($file,
0, -4) . '</a></li>' . PHP_EOL;
}
}
closedir($handle);
}
echo '</ul>';
} else {
echo 'loading: ' . $_REQUEST['script'] . "\n\n<br/><br/>";
require 'tools/' . str_replace(['.', '/'], '', $_REQUEST['script']) . '.php';
}
} catch (Exception $e) {
log_error('Uncaught Exception in ' . __FILE__ . ': ' . $e->getMessage(), true, true);
}
?>
</div>
</body>
</html>