-
Notifications
You must be signed in to change notification settings - Fork 0
/
tools.php
168 lines (130 loc) · 3.58 KB
/
tools.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
<?php
// Get configuration
define("WAKKA_VERSION", "0.1.1");
define("WIKINI_VERSION", "0.5.0");
require_once ('tools/libs/class.plugins.php');
require_once ('tools/libs/lib.compat.php');
require_once ('tools/libs/lib.form.php');
require_once ('tools/libs/lib.files.php');
require_once ('tools/libs/lib.buffer.php');
require_once ('tools/libs/class.wiki.php');
include 'includes/i18n.inc.php';
function __($str) {
return $str;
}
if (!defined('DC_ECRIRE')) {
define('DC_ECRIRE','');
}
if (!defined('TOOLS_MANAGER')) {
define('TOOLS_MANAGER','TOOLS_MANAGER');
}
require_once ('tools/libs/Auth.php');
require_once ('tools/libs/Auth/Container.php');
class CustomAuthContainer extends Auth_Container
{
var $mysql_user;
var $mysql_password;
function CustomAuthContainer($mysql_user, $mysql_password )
{
$this->mysql_user=$mysql_user;
$this->mysql_password=$mysql_password;
}
function fetchData($username, $password, $isChallengeResponse = false)
{
if (($username == $this->mysql_user ) && ( $password == $this->mysql_password)) {
return true;
}
return false;
}
}
$auth_container = new CustomAuthContainer($wakkaConfig['mysql_user'],$wakkaConfig['mysql_password']);
$params = array(
"advancedsecurity" => "true"
);
$a = new Auth($auth_container,$params);
$a->start();
if (isset($_GET['tools_action']) && $_GET['tools_action'] == "logout" && $a->checkAuth()) {
$a->logout();
$a->start();
exit;
}
if($a->checkAuth()) {
}
else {
exit;
}
$plugins_root = 'tools/';
$plugins = new plugins($plugins_root);
$plugins->getPlugins(true);
$plugins_list = $plugins->getPluginsList();
$PLUGIN_HEAD = '';
$PLUGIN_BODY = '';
if ((!empty($_REQUEST['p']) && !empty($plugins_list[$_REQUEST['p']])
&& $plugins_list[$_REQUEST['p']]['active']))
{
$p = $_REQUEST['p'];
$buffer = new buffer();
$buffer->init();
include $plugins_root.$p.'/index.php';
$PLUGIN_BODY = $buffer->getContent();
$buffer->clean();
}
?>
<!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" lang="fr" xml:lang="fr">
<head>
<title><?php echo _t('YESWIKI_TOOLS_CONFIG'); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
</head>
<body>
<?php
$tools_url= "http://".$_SERVER["SERVER_NAME"].($_SERVER["SERVER_PORT"] != 80 ? ":".$_SERVER["SERVER_PORT"] : "").dirname($_SERVER["REQUEST_URI"]).'/tools.php';
echo '<a href="'.$tools_url.'?tools_action=logout">'._t('DISCONNECT').'</a>';
if ($PLUGIN_HEAD != '')
{
echo '<h1>';
echo $PLUGIN_HEAD;
echo '</h1>';
}
if ($PLUGIN_BODY != '')
{
echo '<h1>';
echo '<a href="'.$tools_url.'">'._t('RETURN_TO_EXTENSION_LIST').'</a>';
echo '</h1>';
echo $PLUGIN_BODY;
}
else
{
if (count($plugins_list) == 0)
{
echo '<p>'._t('NO_TOOL_AVAILABLE').'</p>';
}
else
{
# Tri des plugins par leur nom
uasort($plugins_list,create_function('$a,$b','return strcmp($a["label"],$b["label"]);'));
# Liste des plugins
echo '<h1>';
echo '<a href="'.$tools_url.'">'._t('LIST_OF_ACTIVE_TOOLS').'</a>';
echo '</h1>';
echo '<dl class="plugin-list">';
foreach ($plugins_list as $k => $v)
{
$plink = '<a href="tools.php?p='.$k.'">%s</a>';
$plabel = (!empty($v['label'])) ? $v['label'] : $v['name'];
echo '<dt>';
if (file_exists($plugins_root.$k.'/icon.png')) {
printf($plink,'<img alt="" src="tools/'.$k.'/icon.png" />');
echo ' ';
}
printf($plink,$plabel);
echo '</dt>';
echo '<dd>'.$v['desc'].'</dd>';
}
echo '</dl>';
}
}
?>
</body>
</html>