C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\webboard\admin\bwords.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
<?php
/* $Id: bwords.php,v 1.1.1.1 2002/10/28 19:13:49 pbaecher Exp $ */
/*
          ThWboard - PHP/MySQL Bulletin Board System
        ==============================================
            (c) 2000, 2001 by
               Paul Baecher         <paul@thewall.de>
               Felix Gonschorek   <funner@thewall.de>

          download the latest version:
            http://www.thwboard.de

          This  program 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.

        ==============================================

*/

include "common.inc.php";
tb_header();

print 
'<b>Badwords Protection</b><br><br>';

if( 
$action == "FormAction" && isset($UpdateRegistry) )
{
    
query("UPDATE ".$pref."registry SET keyvalue='".$usebwordprot."' WHERE keyname='usebwordprot'");
    if( 
mysql_error() )
    {
        print 
'A problem occured while saving the configuration data, configuration has NOT been saved!';
    }
    else
    {
        print 
'Configuration saved!<br><a href="bwords.php?session='.$session.'">Back to the badwords overview</a>';
    }
}
else if( 
$action == "FormAction" && isset($mass_delete) )
{
    if( !isset(
$a_todelete) )
    {
        print 
'No data selected!<br><a href="bwords.php?session='.$session.'">Back to the badwords overview</a>';
    }
    else
    {
        print 
'Do you want to delete the following badwords?<br>';
        print 
'<form name="form1" method="post" action="bwords.php">';
        print 
'<table border="0" bgcolor="#ffffff" cellpadding="2" cellspacing="1">';
        print 
'<tr>';
        print 
'<td><font face="Arial"><i>badword</i></font></td><td><font face="Arial"><i>spare word</i></font></td>';
        print 
'</tr>';
        
$r_bword query("SELECT banword, modword FROM ".$pref."bannedwords WHERE wordid IN (".implode(","$a_todelete).")");
        if( 
mysql_num_rows($r_bword) != )
        {
            while( 
$eintrag mysql_fetch_array($r_bword) )
            {
                print 
'<tr><td bgcolor="#E5E5E5">'.htmlspecialchars($eintrag['banword']).'</td>';
                print 
'<td bgcolor="#E5E5E5">'.htmlspecialchars($eintrag['modword']).'</td>';
                print 
'</tr>';
            }
            print 
'</table>';
            print 
'<br>';
            print 
'<input type="hidden" name="deletevalues" value="'.implode(","$a_todelete).'">';
            print 
'<input type="hidden" name="session" value="'.$session.'">';
            print 
'<input type="hidden" name="action" value="FormAction">';
            print 
'<input type="submit" name="confirmDelete" value="Delete &raquo;">';
            print 
'</form>';
        }
        else
        {
            print 
'<tr><td colspan="4" bgcolor="#E5E5E5" align="center"><i>No data selected!</i></td></tr>';
            print 
'</table>';
            print 
'<br>';
            print 
'<input type="button" disabled name="confirmDelete" value="Delete &raquo;">';
        }
    }
}
else if( 
$action == "FormAction" && isset($AddEntry) )
{
    print 
'Add new word:';
    print 
'<br>';
    print 
'<form action="bwords.php" name="Form1" method="post">';
    print 
'<table border="0" bgcolor="#ffffff" cellpadding="2" cellspacing="1">';
    print 
'<tr><td bgcolor="#E5E5E5">Zu sperrendes Wort:</td><td bgcolor="#F2F2F2"><input type="text" name="banword"></td></tr>';
    print 
'<tr><td bgcolor="#E5E5E5">Ersatzwort:</td><td bgcolor="#F2F2F2"><input type="text" name="modword"></td></tr>';
    print 
'</table>';
    print 
'<br>';
    print 
'<input type="hidden" name="session" value="'.$session.'">';
    print 
'<input type="hidden" name="action" value="FormAction">';
    print 
'<input type="submit" name="AddEntryConfirm" value="Add &raquo;">';
    print 
'</form>';
}
else if( 
$action == "FormAction" && isset($AddEntryConfirm) )
{
    if( !isset(
$banword) || $banword == "" )
    {
        print 
'No word to add! Please enter a badword.';
    }
    else
    {
        print 
'Following term will be saved:<br>';
        print 
'<table border="0" bgcolor="#ffffff" collpadding="2" cellspacing="1">';
        print 
'<tr><td><font face="Arial"><i>bannedword</i></font></td><td><font face="Arial"><i>spare word</i></font></td></tr>';
        print 
'<tr><td bgcolor="#E5E5E5">'.$banword.'</td><td bgcolor="#E5E5E5">'.$modword.'</td></tr>';
        print 
'</table>';
        print 
'<br>';
        
mysql_query("INSERT INTO ".$pref."bannedwords (banword, modword) VALUES ('".$banword."', '".$modword."')");
        if( !
mysql_error() )
        {
            print 
'Term added.<br><a href="bwords.php?session='.$session.'">Back to the badwords overview</a>';
        }
        else
        {
            print 
'Term could not be added, maybe already in database?<br><a href="bwords.php?session='.$session.'">Back to the badwords overview</a>';
        }
    }
}
else if( 
$action == "FormAction" && isset($confirmDelete) )
{
    
query("DELETE FROM ".$pref."bannedwords WHERE wordid IN (".$deletevalues.")");
    print 
'The entries have been deleted.<br>';
    
$r_bwords query("SELECT wordid FROM ".$pref."bannedwords");
    if( 
mysql_num_rows($r_bwords) < )
    {
        
query("UPDATE ".$pref."registry SET keyvalue='0' WHERE keyname='usebwordprot'");
        if( 
mysql_error() )
        {
            print 
'A problem occured while saving the configuration data, configuration has NOT been saved!';
        }
        else
        {
            print 
'There are no more data entries. Badwords protection disabled.<br><a href="bwords.php?session='.$session.'">Zur&uuml;ck zur &Uuml;bersicht</a>';
        }
    }
    
mysql_free_result($r_bwords);
}
else if( 
$action == "FormAction" && isset($EditConfirm) )
{
    
query("UPDATE ".$pref."bannedwords SET modword = '".$value."' WHERE wordid=".$wordid);
    if( 
mysql_error() )
    {
        print 
'An error occured, the term could not been updated!';
    }
    else
    {
        print 
'Badword has successful been updated.';
    }
}
else if( 
$action == "EditEntry" )
{
    
$r_result query("SELECT banword, modword FROM ".$pref."bannedwords WHERE wordid=".$value);
    if( 
mysql_num_rows($r_result) != )
    {
        
$result mysql_fetch_array($r_result);
        print 
'The following badword is to be edited. Only the spare word can be modified.<br>';
        print 
'<form name="form1" method="post" action="bwords.php">';
        print 
'<table border="0" bgcolor="#ffffff" cellpadding="2" cellspacing="1">';
        print 
'<tr>';
        print 
'<td bgcolor="#E5E5E5">badword:</td><td bgcolor="#F2F2F2">'.$result['banword'].'</td></tr>';
        print 
'<td bgcolor="#E5E5E5">spare word:</td><td bgcolor="#F2F2F2"><input type="text" name="value" value="'.$result['modword'].'"></td></tr>';
        print 
'</table>';
        print 
'<br>';
        print 
'<input type="hidden" name="session" value="'.$session.'">';
        print 
'<input type="hidden" name="action" value="FormAction">';
        print 
'<input type="hidden" name="wordid" value="'.$value.'">';
        print 
'<input type="submit" name="EditConfirm" value="Modify &raquo;">';
        print 
'</form>';
    }
}
else if( 
$action == "DelEntry" )
{
    print 
'Do you want to delete the following badword?<br>';
    print 
'<form name="form1" method="post" action="bwords.php">';
    print 
'<table border="0" bgcolor="#ffffff" cellpadding="2" cellspacing="1">';
    print 
'<tr>';
    print 
'<td><font face="Arial"><i>badword</i></font></td><td><font face="Arial"><i>spare word</i></font></td>';
    print 
'</tr>';
    
$r_bword query("SELECT banword, modword FROM ".$pref."bannedwords WHERE wordid=".$value." LIMIT 1");
    if( 
mysql_num_rows($r_bword) == )
    {
        
$eintrag mysql_fetch_array($r_bword);
        print 
'<tr><td bgcolor="#E5E5E5">'.htmlspecialchars($eintrag['banword']).'</td>';
        print 
'<td bgcolor="#E5E5E5">'.htmlspecialchars($eintrag['modword']).'</td>';
        print 
'</tr></table>';
        print 
'<br>';
        print 
'<input type="hidden" name="deletevalues" value="'.$value.'">';
        print 
'<input type="hidden" name="session" value="'.$session.'">';
        print 
'<input type="hidden" name="action" value="FormAction">';
        print 
'<input type="submit" name="confirmDelete" value="Delete &raquo;">';
        print 
'</form>';
    }
    else
    {
        print 
'<tr><td colspan="4" bgcolor="#E5E5E5" align="center"><i>No badword has been provided. No action performed.</i></td></tr>';
        print 
'</table>';
        print 
'<br>';
        print 
'<input type="button" disabled name="confirmDelete" value="Delete &raquo;">';
        print 
'</form>';
    }
}
else if( !isset(
$action) || $action == "ListBWords" )
{
    print 
'<script language="JavaScript">
    function SelectAll()
  {
    for (var i=0;i<document.form1.elements.length;i++)
    {
      var e = document.form1.elements[i];
      var boolValue = document.form1.selectall.checked;
      if (e.name != "selectall" && e.name != "session" && e.name != "action" && e.name != "mass_delete" && e.name != "AddEntry")
      {
        e.checked = boolValue;
      }
    }
  }</script>'
;
    print 
'<form name="form1" method="post" action="bwords.php">';
    print 
'<table border="0" bgcolor="#ffffff" cellpadding="2" cellspacing="1">';
    print 
'<tr>';
    print 
'<td><font face="Arial"><i>Badwords protection applies to</i></font></td></tr>';
    print 
'<tr><td bgcolor="#E5E5E5">';
    print 
'<input type="radio" name="usebwordprot" value="0"'.($config['usebwordprot'] == 'checked' '').'>None (disabled)</option><br>';
    print 
'<input type="radio" name="usebwordprot" value="1"'.($config['usebwordprot'] == 'checked' '').'>Only in thread titles</option><br>';
    print 
'<input type="radio" name="usebwordprot" value="2"'.($config['usebwordprot'] == 'checked' '').'>Only in posts</option><br>';
    print 
'<input type="radio" name="usebwordprot" value="3"'.($config['usebwordprot'] == 'checked' '').'>Both in thread titles and posts</option>';
    print 
'</td></tr>';
    print 
'<tr><td bgcolor="#F5F5F5" align="center">';
    print 
'<input type="hidden" name="session" value="'.$session.'">';
    print 
'<input type="hidden" name="action" value="FormAction">';
    print 
'<input type="submit" name="UpdateRegistry" value="save configuration &raquo;">';
    print 
'</td></tr></table>';
    print 
'</form>';
    print 
'<br>';
    print 
'<form name="form1" method="post" action="bwords.php">';
    print 
'<table border="0" bgcolor="#ffffff" cellpadding="2" cellspacing="1">';
    print 
'<tr>';
    print 
'<td> </td><td><font face="Arial"><i>badword</i></font></td><td><font face="Arial"><i>spare word</i></font></td><td> </td>';
    print 
'</tr>';
    
    
$r_bwords query("SELECT wordid, banword, modword FROM ".$pref."bannedwords ORDER BY wordid");
    if( 
mysql_num_rows($r_bwords) < )
    {
        print 
'<tr><td colspan="4" bgcolor="#E5E5E5" align="center"><i>no badwords.</i></td></tr>';
        print 
'<tr><td><input type="checkbox" readonly="readonly" disabled name="selectall" onclick="SelectAll()"></td><td colspan="3" color="#C0C0C0">Select All</td></tr>';
        print 
'</table>';
        print 
'<br>';
        print 
'<input type="hidden" name="session" value="'.$session.'">';
        print 
'<input type="hidden" name="action" value="FormAction">';
        print 
'<input type="button" name="mass_delete" readonly="readonly" disabled value="Delete selected">';
        print 
'<input type="submit" name="AddEntry" value="Add new word">';
        print 
'</form>';
    }
    else
    {
        
$i 0;
        while( 
$eintrag mysql_fetch_array($r_bwords) )
        {
            print 
'<tr>';
            print 
'<td bgcolor="'.($i == '#E5E5E5' '#F2F2F2').'" align="center"><input type="checkbox" name="a_todelete[]" value="'.$eintrag['wordid'].'"></td>';
            print 
'<td bgcolor="'.($i == '#E5E5E5' '#F2F2F2').'">'.htmlspecialchars($eintrag['banword']).'</td>';
            print 
'<td bgcolor="'.($i == '#E5E5E5' '#F2F2F2').'">'.htmlspecialchars($eintrag['modword']).'</td>';
            print 
'<td bgcolor="'.($i == '#E5E5E5' '#F2F2F2').'"><a href="bwords.php?action=EditEntry&value='.$eintrag['wordid'].'&session='.$session.'">Edit</a> |';
            print 
' <a href="bwords.php?action=DelEntry&value='.$eintrag['wordid'].'&session='.$session.'">Delete</a></td>';
            print 
'</tr>';
            
$i++;
        }
    
mysql_free_result($r_bwords);
    print 
'<tr><td><input type="checkbox" name="selectall" onclick="return SelectAll()"></td><td colspan="3">Select All</td></tr>';
    print 
'</table>';
    print 
'<br>';
    print 
'<input type="hidden" name="session" value="'.$session.'">';
    print 
'<input type="hidden" name="action" value="FormAction">';
    print 
'<input type="submit" name="mass_delete" value="Delete selected">';
    print 
' <input type="submit" name="AddEntry" value="Add new word">';
    print 
'</form>';
    }
}
else
{
    print 
'<font color="#FF0000"><b>False parameter string! No Option called.</b></font>';
}

tb_footer();
?>