-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroup.php
119 lines (103 loc) · 4.31 KB
/
group.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
<?php
/**
* group.php Fichier de gestion des groupes
* @package Gestion MOD
* @author Kal Nightmare
* @update xaviernuma - 2015
* @link http://www.ogsteam.fr/
*/
if (!defined('IN_SPYOGAME'))
{
die("Hacking attempt");
}
$s_html = '';
// Code HTML pour la création de groupe
$s_html .= '<form method="post" action="index.php?action=gestion&subaction=new_group">';
$s_html .= '<br>';
$s_html .= '<table class="og-table og-little-table">';
$s_html .= '<thead>';
$s_html .= '<tr>';
$s_html .= '<th colspan="2">Nouveau groupe</th>';
$s_html .= '</tr>';
$s_html .= '<tr>';
$s_html .= '<th>Nom</th>';
$s_html .= '<th>Admin</th>';
$s_html .= '</tr>';
$s_html .= '</thead>';
$s_html .= '<tbody>';
$s_html .= '<tr>';
$s_html .= '<td><input type="text" name="new_group" size="100" maxlength="250"></td>';
$s_html .= '<td><input type="checkbox" name="admin" value="" /></td>';
$s_html .= '</tr>';
$s_html .= '<tr><td colspan="3"><input class="og-button" type="submit" value="Nouveau Groupe" /></td></tr>';
$s_html .= '</tbody>';
$s_html .= '</table>';
$s_html .= '</form>';
$ta_liste_groupes = f_lister_les_groupes();
$n_groupes = count($ta_liste_groupes);
// Code HTML pour la modification de groupe
if($n_groupes > 0) // Si il n'y a pas de groupe de créé, on n'affiche pas le tableau des groupes existant
{
$s_html .= '<script type="text/javascript">';
$s_html .= 'function f_submit(num_group, nom_group, admin, ordre)';
$s_html .= '{';
$s_html .= 'document.getElementById(\'admin\').value = 0;';
$s_html .= 'for (var i=0; i<document.getElementsByName(admin).length;i++)';
$s_html .= '{';
$s_html .= 'if (document.getElementsByName(admin)[i].checked)';
$s_html .= '{';
$s_html .= 'document.getElementById(\'admin\').value = 1;';
$s_html .= '}';
$s_html .= '}';
$s_html .= 'document.getElementById(\'num_group\').value = num_group;';
$s_html .= 'document.getElementById(\'nom_group\').value = document.getElementById(nom_group).value;';
$s_html .= 'document.getElementById(\'ordre\').value = ordre;';
$s_html .= 'document.getElementById(\'form_modification_mod\').submit();';
$s_html .= '}';
$s_html .= '</script>';
$s_html .= '<table class="og-table og-little-table">';
$s_html .= '<thead>';
// Si il n'y a qu'un seul groupe, on fait attention à l'orthographe...
if($n_groupes == 1)
{
$s_html .= '<tr><th colspan="4" >Groupe existant</th></tr>';
}
else
{
$s_html .= '<tr><th colspan="4" >Groupes existants</th></tr>';
}
$s_html .= '<tr>';
$s_html .= '<th>Nom</th>';
$s_html .= '<th>Admin</th>';
$s_html .= '<th colspan="2"></th>';
$s_html .= '</tr>';
$s_html .= '</thead>';
$s_html .= '<tbody>';
for ($i = 0 ; $i < count($ta_liste_groupes) ; $i++)
{
$s_html .= '<tr>';
$s_html .= '<td><input type="text" name="nom_group'.$i.'" id="nom_group'.$i.'" style="width:500px;" maxlength="250" value="'.htmlentities(f_nom_du_groupe($ta_liste_groupes[$i]['Nom'])).'" /></td>';
if ($ta_liste_groupes[$i]['admin'] == '1' )
{
$s_html .= '<td><input type="checkbox" name="admin'.$i.'" value="" checked="checked" /></td>';
}
else
{
$s_html .= '<td><input type="checkbox" name="admin'.$i.'" value="" /></td>';
}
$s_html .= '<td><input class="og-button" type="button" onclick="javascript:f_submit(\''.$ta_liste_groupes[$i]['Num'].'\', \'nom_group'.$i.'\', \'admin'.$i.'\',\'Renommer Groupe\');" name="ordre" value="Renommer Groupe" /></td>';
$s_html .= '<td><input class="og-button og-button-danger" type="button" onclick="javascript:f_submit(\''.$ta_liste_groupes[$i]['Num'].'\', \'nom_group'.$i.'\', \'admin'.$i.'\',\'Supprimer Groupe\');" name="ordre" value="Supprimer Groupe" /></td>';
$s_html .= '</tr>';
}
$s_html .= '</tbody>';
$s_html .= '</table>';
$s_html .= '<form id="form_modification_mod" method="post" action="index.php?action=gestion&subaction=action_group">';
$s_html .= '<input type="hidden" name="num_group" id="num_group" value="" />';
$s_html .= '<input type="hidden" name="ordre" id="ordre" value="" />';
$s_html .= '<input type="hidden" name="admin" id="admin" value="" />';
$s_html .= '<input type="hidden" name="nom_group" id="nom_group" value="" />';
$s_html .= '</form>';
}
$s_html .= f_aide_html();
echo $s_html;
?>