-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModuleScan.php
More file actions
98 lines (85 loc) · 2.69 KB
/
ModuleScan.php
File metadata and controls
98 lines (85 loc) · 2.69 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
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
<!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="fr" >
<?php
date_default_timezone_set('Europe/Paris');
header( 'content-type: text/html; charset=utf-8' );
require 'sites/default/settings.php';
$database = $databases['default']['default']['database'];
$hote = $databases['default']['default']['host'];
$db_user = $databases['default']['default']['username'];
$db_mdp = $databases['default']['default']['password'];
$titre = 'Liste des Modules Drupal du site -->'.$database;
$req_commune = 'SELECT * FROM system WHERE type="module" ORDER BY ';
if (isset($_GET['ordre'])){
if ($_GET['ordre']=='status'){
$requete = $req_commune.'!status, name';
}
if ($_GET['ordre']=='chemin'){
$requete = 'SELECT * FROM system ORDER BY filename';
}
} else {
$requete = $req_commune.' name';
}
echo $requete;
?>
<head>
<title><?php echo $titre; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<style type="text/css">
table { border: solid 2px; }
tr { border: solid 2px; }
/**td { border: solid 2px; }**/
.centre { text-align: center; }
.titre_tab{ font-style: bold ; ;}
a { text-decoration: none; color: blue }
a:visited { text-decoration: none; color: blue }
a:hover { text-decoration: none; color: red; }
</style>
<?php
#### connection à la base de données
try
{ // On se connecte à MySQL
$bdd = new PDO('mysql:host='.$hote.';dbname='.$database, $db_user, $db_mdp);
}
catch(Exception $e)
{ // En cas d'erreur, on affiche un message et on arrête tout
die('Erreur de connection MySQL : '.$e->getMessage());
}
$reponse = $bdd->query($requete);
echo '<h5>'.$titre.'</h5>';
?>
<table>
<tr>
<td class="titre_tab">Nbr</td>
<td class="titre_tab"><a href="ModuleScan.php">Nom du module</a></td>
<td class="titre_tab" align="center"><a href="ModuleScan.php?ordre=status">Status</a></td>
<td class="titre_tab" align="center"><a href="ModuleScan.php?ordre=chemin">Chemin</a></td>
</tr>
<tr>
<?php
$i = 1;
while ($donnees = $reponse->fetch())
{
if ($donnees['status']=='1'){ //compte les modules actifs
$affichage .= '<td>'.$i.'</td>';
}else{
$affichage .= '<td></td>';
}
$affichage .= '<td>'.$donnees['name'].'</td>';
$affichage .= '<td class="centre">'.$donnees['status'].'</td>';
$affichage .= '<td>'.$donnees['filename'].'</td>';
$affichage .= '</tr>';
if ($donnees['status']=='1'){
$i++;
}
}
$reponse->closeCursor();
$affichage .= '</table>';
## Affichage
echo $affichage;
/*
echo '<pre>';
echo '</pre>';
*/
?>