forked from OGSteam/mod-attaques
-
Notifications
You must be signed in to change notification settings - Fork 0
/
attack_include.php
executable file
·138 lines (118 loc) · 4.82 KB
/
attack_include.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
<?php
/**
* Fonctions du modules
* @package Attaques
* @author Vérité - réécrit par ericc
* @link http://www.ogsteam.fr
* @version : 0.8a
* dernière modification : 28 Dec 2007
*/
//-------------------------------------------------------------------------------------------------------------------
// Renvoi 1 si l'utilisateur est admin, coadmin ou manager
function IsUserAdmin ()
{
global $user_data;
if ($user_data["user_admin"] == 1 || $user_data["user_coadmin"] == 1 || $user_data["management_user"] == 1) return 1; else return 0;
}
//-------------------------------------------------------------------------------------------------------------------
/**
* Mod Configs: Add or updates a configuration option for the mod
* @param string $param Name of the parameter
* @param integer $user_id Id of the user
* @param string $value Value of the parameter
* @return array returns true if the parameter is correctly saved. false in other cases.
*/
function mod_set_user_option($user_id, $param, $value)
{
global $db;
if (!check_var($param, "Text")) {
redirection("index.php?action=message&id_message=errordata&info");
}
if (!check_var($user_id, "Num")) {
redirection("index.php?action=message&id_message=errordata&info");
}
$query = "REPLACE INTO `" . TABLE_MOD_USER_CFG . "`(`mod`, `user_id`, `config`, `value`) VALUES('Attaques' ," . $user_id . ", '" . $param . "' , '" . $value ."')";
$result = $db->sql_query($query);
return $result;
}
/**
* Mod Configs: Add or updates a configuration option for the mod
* @param integer $user_id Id of the user
* @param string $param Name of the parameter
* @return array returns true if the parameter is correctly saved. false in other cases.
*/
function mod_get_user_option( $user_id,$param)
{
global $db;
if (!check_var($param, "Text")) {
redirection("index.php?action=message&id_message=errordata&info");
}
if (!check_var($user_id, "Num")) {
redirection("index.php?action=message&id_message=errordata&info");
}
$query = "SELECT `value` FROM `" . TABLE_MOD_USER_CFG . "` WHERE `mod`='Attaques' and `user_id`=" . $user_id ." and `config`='" . $param . "'";
$result = $db->sql_query($query);
$user_config = $db->sql_fetch_row($result);
$user_config = $user_config['value'];
return $user_config;
}
/**
* Mod Configs: Deletes a parameter for a mod and a user
* @param string $param Name of the parameter
* @param $user_id
* @return void returns true if the parameter is correctly saved. false in other cases.
*/
function mod_del_user_option($user_id , $param)
{
global $db;
if (!check_var($param, "Text")) {
redirection("index.php?action=message&id_message=errordata&info");
}
if (!check_var($user_id, "Num")) {
redirection("index.php?action=message&id_message=errordata&info");
}
$query = "DELETE FROM `" . TABLE_MOD_USER_CFG . "` WHERE `mod`='Attaques' and `user_id`=" . $user_id ." and `config`=". $param;
$result = $db->sql_query($query);
}
// Création du menu
/**
* @param $pub_page
*/
function menu ($pub_page)
{
global $pages;
// Definition des pages du module
$i = -1;
$pages['fichier'][++$i] = 'attaques';
$pages['texte'][$i] = ' Attaques ';
$pages['admin'][$i] = 0;
$pages['fichier'][++$i] = 'recyclages';
$pages['texte'][$i] = ' Recyclages ';
$pages['admin'][$i] = 0;
$pages['fichier'][++$i] = 'bilan';
$pages['texte'][$i] = ' Bilan ';
$pages['admin'][$i] = 0;
$pages['fichier'][++$i] = 'bbcode';
$pages['texte'][$i] = ' Espace BBCode ';
$pages['admin'][$i] = 0;
$pages['fichier'][++$i] = 'archive';
$pages['texte'][$i] = ' Espace Archives ';
$pages['admin'][$i] = 0;
$pages['fichier'][++$i] = 'statistiques';
$pages['texte'][$i] = ' Statistiques ';
$pages['admin'][$i] = 0;
$pages['fichier'][++$i] = 'config';
$pages['texte'][$i] = ' Config ';
$pages['admin'][$i] = 0;
$pages['fichier'][++$i] = 'admin';
$pages['texte'][$i] = 'Admin';
$pages['admin'][$i] = 1;
//Construction du menu
echo " <table><tr align='center'>";
for ($i = 0; $i < count($pages['fichier']); $i++) if (($pages['admin'][$i] && IsUserAdmin()) || (!$pages['admin'][$i])) if ($pub_page != $pages['fichier'][$i]) {
echo "\t<td class='c' width='150' onclick=\"window.location = 'index.php?action=attaques&page=" . $pages['fichier'][$i] . "';\">";
echo "<a style='cursor:pointer'><span style=\"color: lime; \">" . $pages['texte'][$i] . "</span></a></td>";
} else
echo "\t<th width='150'><a>" . $pages['texte'][$i] . "</a></th>";
echo "\t\t</tr>\n\t\t</table>";
}