| 954 |
florian |
1 |
<?php
|
|
|
2 |
// Get configuration
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
require_once ('tools/libs/class.plugins.php');
|
|
|
6 |
require_once ('tools/libs/lib.compat.php');
|
|
|
7 |
require_once ('tools/libs/lib.form.php');
|
|
|
8 |
require_once ('tools/libs/lib.files.php');
|
|
|
9 |
require_once ('tools/libs/lib.buffer.php');
|
|
|
10 |
require_once ('tools/libs/class.wiki.php');
|
|
|
11 |
|
|
|
12 |
function __($str) {
|
|
|
13 |
return $str;
|
|
|
14 |
}
|
|
|
15 |
|
|
|
16 |
if (!defined('DC_ECRIRE')) {
|
|
|
17 |
define('DC_ECRIRE','');
|
|
|
18 |
}
|
|
|
19 |
|
|
|
20 |
if (!defined('TOOLS_MANAGER')) {
|
|
|
21 |
define('TOOLS_MANAGER','TOOLS_MANAGER');
|
|
|
22 |
}
|
|
|
23 |
|
|
|
24 |
require_once ('tools/libs/Auth.php');
|
|
|
25 |
require_once ('tools/libs/Container.php');
|
|
|
26 |
|
|
|
27 |
class CustomAuthContainer extends Auth_Container
|
|
|
28 |
{
|
|
|
29 |
|
|
|
30 |
var $mysql_user;
|
|
|
31 |
var $mysql_password;
|
|
|
32 |
|
|
|
33 |
function CustomAuthContainer($mysql_user, $mysql_password )
|
|
|
34 |
{
|
|
|
35 |
$this->mysql_user=$mysql_user;
|
|
|
36 |
$this->mysql_password=$mysql_password;
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
function fetchData($username, $password)
|
|
|
40 |
{
|
|
|
41 |
if (($username == $this->mysql_user ) && ( $password == $this->mysql_password)) {
|
|
|
42 |
return true;
|
|
|
43 |
}
|
|
|
44 |
return false;
|
|
|
45 |
}
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
$auth_container = new CustomAuthContainer($wakkaConfig['mysql_user'],$wakkaConfig['mysql_password']);
|
|
|
50 |
|
|
|
51 |
$params = array(
|
|
|
52 |
"advancedsecurity" => "true"
|
|
|
53 |
);
|
|
|
54 |
|
|
|
55 |
|
|
|
56 |
$a = new Auth($auth_container,$params);
|
|
|
57 |
|
|
|
58 |
$a->start();
|
|
|
59 |
|
|
|
60 |
if ($_GET['tools_action'] == "logout" && $a->checkAuth()) {
|
|
|
61 |
$a->logout();
|
|
|
62 |
$a->start();
|
|
|
63 |
exit;
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
if($a->checkAuth()) {
|
|
|
68 |
|
|
|
69 |
}
|
|
|
70 |
else {
|
|
|
71 |
exit;
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
$plugins_root = 'tools/';
|
|
|
75 |
|
|
|
76 |
$plugins = new plugins($plugins_root);
|
|
|
77 |
$plugins->getPlugins(true);
|
|
|
78 |
$plugins_list = $plugins->getPluginsList();
|
|
|
79 |
|
|
|
80 |
$PLUGIN_HEAD = '';
|
|
|
81 |
$PLUGIN_BODY = '';
|
|
|
82 |
|
|
|
83 |
if ((!empty($_REQUEST['p']) && !empty($plugins_list[$_REQUEST['p']])
|
|
|
84 |
&& $plugins_list[$_REQUEST['p']]['active']))
|
|
|
85 |
{
|
|
|
86 |
$p = $_REQUEST['p'];
|
|
|
87 |
buffer::init();
|
|
|
88 |
include $plugins_root.$p.'/index.php';
|
|
|
89 |
$PLUGIN_BODY = buffer::getContent();
|
|
|
90 |
buffer::clean();
|
|
|
91 |
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
?>
|
|
|
95 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
|
96 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
|
97 |
|
|
|
98 |
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr">
|
|
|
99 |
<head>
|
|
|
100 |
<title>Configuration extension(s) de WikiNi</title>
|
|
|
101 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
|
|
|
102 |
</head>
|
|
|
103 |
|
|
|
104 |
<body>
|
|
|
105 |
|
|
|
106 |
|
|
|
107 |
<?php
|
|
|
108 |
|
|
|
109 |
$tools_url= "http://".$_SERVER["SERVER_NAME"].($_SERVER["SERVER_PORT"] != 80 ? ":".$_SERVER["SERVER_PORT"] : "").dirname($_SERVER["REQUEST_URI"]).'/tools.php';
|
|
|
110 |
|
|
|
111 |
echo '<a href="'.$tool_url.'?tools_action=logout">Déconnexion</a>';
|
|
|
112 |
|
|
|
113 |
|
|
|
114 |
if ($PLUGIN_HEAD != '')
|
|
|
115 |
{
|
|
|
116 |
echo '<h1>';
|
|
|
117 |
echo $PLUGIN_HEAD;
|
|
|
118 |
echo '</h1>';
|
|
|
119 |
}
|
|
|
120 |
|
|
|
121 |
if ($PLUGIN_BODY != '')
|
|
|
122 |
{
|
|
|
123 |
echo '<h1>';
|
|
|
124 |
echo '<a href="'.$tools_url.'">Retour à la liste des extensions actives</a>';
|
|
|
125 |
echo '</h1>';
|
|
|
126 |
echo $PLUGIN_BODY;
|
|
|
127 |
}
|
|
|
128 |
else
|
|
|
129 |
{
|
|
|
130 |
if (count($plugins_list) == 0)
|
|
|
131 |
{
|
|
|
132 |
echo '<p>Aucun outil n\'est disponible ou actif</p>';
|
|
|
133 |
}
|
|
|
134 |
else
|
|
|
135 |
{
|
|
|
136 |
|
|
|
137 |
# Tri des plugins par leur nom
|
|
|
138 |
uasort($plugins_list,create_function('$a,$b','return strcmp($a["label"],$b["label"]);'));
|
|
|
139 |
|
|
|
140 |
# Liste des plugins
|
|
|
141 |
echo '<h1>';
|
|
|
142 |
echo '<a href="'.$tools_url.'">Liste des extensions actives</a>';
|
|
|
143 |
echo '</h1>';
|
|
|
144 |
|
|
|
145 |
echo '<dl class="plugin-list">';
|
|
|
146 |
foreach ($plugins_list as $k => $v)
|
|
|
147 |
{
|
|
|
148 |
$plink = '<a href="tools.php?p='.$k.'">%s</a>';
|
|
|
149 |
$plabel = (!empty($v['label'])) ? $v['label'] : $v['name'];
|
|
|
150 |
|
|
|
151 |
echo '<dt>';
|
|
|
152 |
if (file_exists($plugins_root.$k.'/icon.png')) {
|
|
|
153 |
printf($plink,'<img alt="" src="tools/'.$k.'/icon.png" />');
|
|
|
154 |
echo ' ';
|
|
|
155 |
}
|
|
|
156 |
|
|
|
157 |
printf($plink,$plabel);
|
|
|
158 |
echo '</dt>';
|
|
|
159 |
|
|
|
160 |
echo '<dd>'.$v['desc'].'</dd>';
|
|
|
161 |
}
|
|
|
162 |
echo '</dl>';
|
|
|
163 |
}
|
|
|
164 |
}
|
|
|
165 |
?>
|
|
|
166 |
</body>
|
|
|
167 |
</html>
|