-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcommentpost.php
More file actions
206 lines (203 loc) · 6.76 KB
/
Copy pathcommentpost.php
File metadata and controls
206 lines (203 loc) · 6.76 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
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
<?php
/*
* 12/12/2005 - 22:40:00 - Scout Web Portail - v 1.1.1
*
* commentpost.php v 1.1 - Gestion de l'enregistrement des commentaires postés par les membres du portail
* Fichier lié : galerie.php
* Copyright (C) 2005 ChMat
* http://www.scoutwebportail.org
*
* This file is part of Scout Web Portail.
*
* Scout Web Portail is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Scout Web Portail is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Scout Web Portail; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
/*
* Modifications v 1.1
* Externalisation du texte des mails
*/
include_once('connex.php');
include_once('fonc.php');
if ($user['niveau']['numniveau'] < 1)
{
header('Location: index.php?page=404');
exit;
}
if (is_numeric($_POST['g']) and is_numeric($_POST['p']))
{
$g = $_POST['g'];
$p = $_POST['p'];
$sql = "SELECT numgalerie FROM ".PREFIXE_TABLES."galerie, ".PREFIXE_TABLES."albums WHERE numgalerie = '$g' AND numalbum = '$g' AND posphoto = '$p'";
if ($res = send_sql($db, $sql))
{
if (mysql_num_rows($res) == 1)
{
if (!empty($_POST['commentaire']))
{
$commentaire = htmlentities($_POST['commentaire'], ENT_QUOTES);
$sql = "INSERT INTO ".PREFIXE_TABLES."commentaires (album, photo, auteur, commentaire, datecreation) values (".$g.", ".$p.", ".$user['num'].", '".$commentaire."', now())";
send_sql($db, $sql);
$sql = "UPDATE ".PREFIXE_TABLES."albums SET nbcomment = nbcomment + 1 WHERE numalbum = '".$g."' AND posphoto = '".$p."'";
send_sql($db, $sql);
header('Location: index.php?page=galerie&show='.$g.'&photo='.$p);
exit;
}
else
{
header('Location: index.php?page=galerie&show='.$g.'&photo='.$p);
exit;
}
}
else
{
header('Location: index.php?action=galerie&show=erreur&galerie='.$g.'&photo='.$p);
}
} // res = send_sql
else
{
header('Location: index.php?page=404');
exit;
}
}
else if ($_GET['do'] == 'mod' and is_numeric($_GET['n']) and $user['niveau']['numniveau'] > 2)
{
if (!defined('IN_SITE'))
{
?>
<?php echo '<'.'?xml version="1.0" encoding="iso-8859-1"?'.'>'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>Enregistrement des commentaires</title>
</head>
<body>
<?php
}
?>
<h1>Supprimer un commentaire de la galerie photo</h1>
<p align="center"><a href="<?php echo ($site['url_rewriting_actif'] == 1) ? 'galerie.htm' : 'index.php?page=galerie'; ?>">Retour à la Galerie</a></p>
<?php
if ($_GET['s'] == 2)
{
$sql = "SELECT album, photo FROM ".PREFIXE_TABLES."commentaires WHERE numcommentaire = '".$_GET['n']."'";
if ($res = send_sql($db, $sql))
{
if (mysql_num_rows($res) == 1)
{
$ligne = mysql_fetch_assoc($res);
$sql = "UPDATE ".PREFIXE_TABLES."albums SET nbcomment = nbcomment - 1 WHERE numalbum = '".$ligne['album']."' AND posphoto = '".$ligne['photo']."'";
send_sql($db, $sql);
$sql = "UPDATE ".PREFIXE_TABLES."commentaires SET commentairebanni = '1' WHERE numcommentaire = '".$_GET['n']."'";
send_sql($db, $sql);
log_this('Modération commentaire photo '.$_GET['n'].' dans la galerie', 'galerie');
?>
<div class="msg">
<p align="center" class="rmqbleu">Le commentaire a été supprimé.</p>
<p align="center"><a href="<?php echo urldecode($_GET['r']); ?>">Retour à la Photo</a></p>
</div>
<?php
}
else
{
?>
<div class="msg">
<p align="center" class="rmq">Aucun commentaire ne correspond aux données fournies.</p>
<p align="center"><a href="<?php echo urldecode($_GET['r']); ?>">Retour à la Photo</a></p>
</div>
<?php
}
}
else
{
?>
<div class="msg">
<p align="center" class="rmq">Erreur de connexion à la base de données.</p>
<p align="center"><a href="<?php echo urldecode($_GET['r']); ?>">Retour à la Photo</a></p>
</div>
<?php
}
}
else
{
?>
<div class="msg">
<p align="center" class="rmqbleu">Es-tu certain de vouloir supprimer ce commentaire ?</p>
<p align="center"><a href="index.php?page=commentpost&do=mod&s=2&n=<?php echo $_GET['n'].'&r='.urlencode($_GET['r']); ?>" class="bouton">Oui</a> <a href="<?php echo urldecode($_GET['r']); ?>" class="bouton">Non</a></p>
</div>
<?php
}
}
else if ($_GET['do'] == 'unmod' and is_numeric($_GET['n']) and $user['niveau']['numniveau'] == 5)
{
?>
<h1>Réactiver un commentaire de la galerie photo</h1>
<p align="center"><a href="<?php echo ($site['url_rewriting_actif'] == 1) ? 'galerie.htm' : 'index.php?page=galerie'; ?>">Retour à la Galerie</a></p>
<?php
if ($_GET['s'] == 2)
{
$sql = "SELECT album, photo FROM ".PREFIXE_TABLES."commentaires WHERE numcommentaire = '".$_GET['n']."'";
if ($res = send_sql($db, $sql))
{
if (mysql_num_rows($res) == 1)
{
$ligne = mysql_fetch_assoc($res);
$sql = "UPDATE ".PREFIXE_TABLES."albums SET nbcomment = nbcomment + 1 WHERE numalbum = '".$ligne['album']."' AND posphoto = '".$ligne['photo']."'";
send_sql($db, $sql);
$sql = "UPDATE ".PREFIXE_TABLES."commentaires SET commentairebanni = '0' WHERE numcommentaire = '".$_GET['n']."'";
send_sql($db, $sql);
?>
<div class="msg">
<p align="center" class="rmqbleu">Le commentaire a été réactivé.</p>
<p align="center"><a href="<?php echo urldecode($_GET['r']); ?>">Retour à la Photo</a></p>
</div>
<?php
}
else
{
?>
<div class="msg">
<p align="center" class="rmq">Aucun commentaire ne correspond aux données fournies.</p>
<p align="center"><a href="<?php echo urldecode($_GET['r']); ?>">Retour à la Photo</a></p>
</div>
<?php
}
}
else
{
?>
<div class="msg">
<p align="center" class="rmq">Erreur de connexion à la base de données.</p>
<p align="center"><a href="<?php echo urldecode($_GET['r']); ?>">Retour à la Photo</a></p>
</div>
<?php
}
}
else
{
?>
<div class="msg">
<p align="center" class="rmqbleu">Es-tu certain de vouloir réactiver ce commentaire ?</p>
<p align="center"><a href="index.php?page=commentpost&do=unmod&s=2&n=<?php echo $_GET['n'].'&r='.urlencode($_GET['r']); ?>" class="bouton">Oui</a> <a href="<?php echo urldecode($_GET['r']); ?>" class="bouton">Non</a></p>
</div>
<?php
}
}
else
{
header('Location: index.php?page=galerie&show=erreur&tada');
exit;
}
?>
</body>
</html>