/
index.php
335 lines (293 loc) · 11 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
<?php
//chemin jusqu'au fichier de conf de WampServer
$wampConfFile = '../wampmanager.conf';
//chemin jusqu'aux fichiers alias
$aliasDir = '../alias/';
// on charge le fichier de conf locale
if (!is_file($wampConfFile))
die ('Unable to open WampServer\'s config file, please change path in index.php file');
//require $wampConfFile;
$fp = fopen($wampConfFile,'r');
$wampConfFileContents = fread ($fp, filesize ($wampConfFile));
fclose ($fp);
//on rs les versions des applis
preg_match('|phpVersion = (.*)\n|',$wampConfFileContents,$result);
$phpVersion = str_replace('"','',$result[1]);
preg_match('|apacheVersion = (.*)\n|',$wampConfFileContents,$result);
$apacheVersion = str_replace('"','',$result[1]);
preg_match('|mysqlVersion = (.*)\n|',$wampConfFileContents,$result);
$mysqlVersion = str_replace('"','',$result[1]);
preg_match('|wampserverVersion = (.*)\n|',$wampConfFileContents,$result);
$wampserverVersion = str_replace('"','',$result[1]);
// repertoires gnorer dans les projets
$projectsListIgnore = array ('.','..', '.git', '_pwi');
// textes
$langues = array(
'en' => array(
'langue' => 'English',
'autreLangue' => 'Version Française',
'autreLangueLien' => 'fr',
'titreHtml' => 'WAMPSERVER Homepage',
'titreConf' => 'Server Configuration',
'versa' => 'Apache Version :',
'php' => 'PHP',
'versp' => 'Version',
'confp' => 'Php.ini location',
'versm' => 'MySQL Version :',
'phpExt' => 'Loaded Extensions : ',
'titrePage' => 'Tools',
'txtProjet' => 'Your Projects',
'txtNoProjet' => 'No projects yet.<br />To create a new one, just create a directory in \'www\'.',
'txtAlias' => 'Your Aliases',
'txtNoAlias' => 'No Alias yet.<br />To create a new one, use the WAMPSERVER menu.',
'faq' => 'http://www.en.wampserver.com/faq.php'
),
'fr' => array(
'langue' => 'Fran?s',
'autreLangue' => 'English Version',
'autreLangueLien' => 'en',
'titreHtml' => 'Accueil WAMPSERVER',
'titreConf' => 'Configuration Serveur',
'versa' => 'Version de Apache:',
'php' => 'PHP',
'versp' => 'Version',
'confp' => 'Emplacement php.ini',
'versm' => 'Version de MySQL :',
'phpExt' => 'Extensions Chargées : ',
'titrePage' => 'Outils',
'txtProjet' => 'Vos Projets',
'txtNoProjet' => 'Aucun projet.<br /> Pour en ajouter un nouveau, créez simplement un répertoire dans \'www\'.',
'txtAlias' => 'Vos Alias',
'txtNoAlias' => 'Aucun alias.<br /> Pour en ajouter un nouveau, utilisez le menu de WAMPSERVER.',
'faq' => 'http://www.wampserver.com/faq.php',
)
);
$px_langues = array(
'en' => array(
'txtFooter' => 'Wamp Index <a href="http://www.pixel-cookers.com">Pixel Cookers</a> Theme'
),
'fr' => array(
'txtFooter' => 'Thème Index Wamp <a href="http://www.pixel-cookers.com">Pixel Cookers</a>'
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b20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo1ODg0QkM3NUZB
MDhFMDExODkyQ0U2NkE5ODVBM0Q2OSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo1ODg0QkM3
NUZBMDhFMDExODkyQ0U2NkE5ODVBM0Q2OSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRG
PiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PiUukzAAAAHHSURBVHja5FfRccIwDLVz
/W+7QdggbJBM0HQCwg+/LRNwTJDymx9ggmYDsgEZwRuUDVI5ET1XyE5CuIa76k7ABVtPluQnRVZV
JcYST4woD85/ZRbC5wxUf/sdbZagBehGVAvlNM+GXWYaaIugQ+QDdA1OnLqByyyAzwPo042iqyMx
BwdKN7jMNODREWKFyonv2KdPPqERoDlPGQMKQ7drPWPjfAy6Inb080/QiK/2Js8JMacBpzWwzGIs
QFdxhujkFMNtSkj3m1ftjTnxEg0f0XNXAYb1mmatwFPSFM1s4NTwuUp18QU9CiyonWj2rhkHWXAK
kNeh7gdMQ5wzRdnKcAo9DwZcsRBtqL70qm7Ior3B/5zbI0IKrvv8mxarhXSsXtrY8m5OfjB+F5SN
BkhKrpi8635uaxAvkO9HpgZSB/v57f2cFpEQzz+UeZ28Yvq+bMXpkb5rSgwLc+Z5Fylwb+y68x4p
MlNW2CLnPUmnrE/d7F1dOGXJ+Qb0neQqre9ptZiAscTI38ng7YTQ8g6Budlg75pktkxPV9idctss
1mGYOKciupsxatQB8pJkmkUTpgCvHZ0jDtg+t4/60vAf3tVGBf8WYAC3Rq8Ub3mHyQAAAABJRU5E
rkJggg==
EOFILE;
//affichage du phpinfo
if (isset($_GET['phpinfo']))
{
phpinfo();
exit();
}
//affichage des images
if (isset($_GET['img']))
{
switch ($_GET['img'])
{
case 'favicon' :
header("Content-type: image/x-icon");
echo base64_decode($favicon);
exit();
}
}
// D?nition de la langue et des textes
if (isset ($_GET['lang']))
{
$langue = $_GET['lang'];
}
elseif (isset ($_SERVER['HTTP_ACCEPT_LANGUAGE']) AND preg_match("/^fr/", $_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
$langue = 'fr';
}
else
{
$langue = 'en';
}
//initialisation
$aliasContents = '';
// recuperation des alias
if (is_dir($aliasDir))
{
$handle=opendir($aliasDir);
while ($file = readdir($handle))
{
if (is_file($aliasDir.$file) && strstr($file, '.conf'))
{
$msg = '';
$aliasContents .= '<li><a href="'.str_replace('.conf','',$file).'/"><i class="icon-bookmark"></i> '.str_replace('.conf','',$file).'</a></li>';
}
}
closedir($handle);
}
if (!isset($aliasContents))
$aliasContents = $langues[$langue]['txtNoAlias'];
// recuperation des projets
$handle=opendir(".");
$projectContents = '';
while ($file = readdir($handle))
{
if (is_dir($file) && !in_array($file,$projectsListIgnore))
{
$projectContents .= '<li><a href="'.$file.'"><i class="icon-folder-open"></i> '.$file.'</a></li>';
}
}
closedir($handle);
if (!isset($projectContents))
$projectContents = $langues[$langue]['txtNoProjet'];
//initialisation
$phpExtContents = '';
// recuperation des extensions PHP
$loaded_extensions = get_loaded_extensions();
foreach ($loaded_extensions as $extension)
$phpExtContents .= "<li><i class='icon-th-large'></i> ${extension}</li>";
$php_ini_location = php_ini_loaded_file();
$pageContents = <<< EOPAGE
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html lang="en" xml:lang="en">
<head>
<title>{$langues[$langue]['titreHtml']}</title>
<meta http-equiv="Content-Type" content="txt/html; charset=utf-8" />
<link href="_pwi/css/bootstrap.css" rel="stylesheet">
<link href="_pwi/css/bootstrap-responsive.css" rel="stylesheet">
<link href="_pwi/css/docs.css" rel="stylesheet">
<style>
.projects {
color: #ccc;
}
.projects a, .aliases a, .tools a {
-webkit-transition: 0.2s ease;
-moz-transition: 0.2s ease;
-ms-transition: 0.2s ease;
-o-transition: 0.2s ease;
-webkit-border-radius: 2px;
border-radius: 2px;
transition: 0.2s ease;
display: block;
font-size: 16px;
padding: 2px 0 2px 3px;
}
.projects a:hover, .aliases a:hover, .tools a:hover {
background: #222;
color: #44CCFF;
text-decoration: none;
}
</style>
<link rel="shortcut icon" href="index.php?img=favicon" type="image/ico" />
</head>
<body style="background: url('_pwi/img/stressed_linen.png')">
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="./index.html">WAMP</a>
<div class="nav-collapse collapse">
<ul class="nav pull-right">
<li class="divider-vertical"></li>
<li><a href="?lang={$langues[$langue]['autreLangueLien']}">{$langues[$langue]['autreLangue']}</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Version ${wampserverVersion} <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="http://www.wampserver.com">WampServer</a></li>
<li><a href="http://www.wampserver.com/en/donations.php">Donate</a></li>
<li><a href="http://www.alterway.fr">Alter Way</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="span4">
<h2>{$langues[$langue]['txtProjet']}</h2>
<ul class="projects unstyled">
$projectContents
</ul>
</div>
<div class="span4">
<h2>{$langues[$langue]['txtAlias']}</h2>
<ul class="aliases unstyled">
${aliasContents}
</ul>
</div>
<div class="span4">
<h2>{$langues[$langue]['titrePage']}</h2>
<ul class="tools unstyled">
<li><a href="?phpinfo=1"><i class="icon-wrench"></i> phpinfo()</a></li>
<li><a href="phpmyadmin/"><i class="icon-wrench"></i> phpmyadmin</a></li>
</ul>
</div>
</div>
<br clear="all" />
<h2> {$langues[$langue]['titreConf']} </h2>
<div class="well">
<dl class="content" style="margin-top: 0;">
<dt>{$langues[$langue]['versa']}</dt>
<dd>${apacheVersion} </dd>
<dt>{$langues[$langue]['php']}</dt>
<dd><b>{$langues[$langue]['versp']}</b> : ${phpVersion} <br />
<b>{$langues[$langue]['confp']}</b> : ${php_ini_location}
</dd>
<dt>{$langues[$langue]['versm']}</dt>
<dd>${mysqlVersion} </dd>
<dt>{$langues[$langue]['phpExt']}</dt>
<dd>
<ul class="the-icons clearfix">
${phpExtContents}
</ul>
</dd>
<dt>User agent</dt>
<dd>{$_SERVER['HTTP_USER_AGENT']}</dd>
</dl>
</div>
</div>
<footer class="footer">
<div class="container">
<ul class="footer-links">
<li class="pull-right">{$px_langues[$langue]['txtFooter']}</li>
<li class="pull-right"><iframe src="http://ghbtns.com/github-btn.html?user=pixel-cookers&repo=wamp-index-theme&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" width="110px" height="20px"></iframe></li>
<li><a href="http://{$_SERVER['REMOTE_ADDR']}">{$_SERVER['REMOTE_ADDR']}</a></li>
</ul>
</div>
</footer>
<script src="_pwi/js/jquery.min.js"></script>
<script src="_pwi/js/bootstrap.min.js"></script>
</body>
</html>
EOPAGE;
echo $pageContents;
?>