C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\webboard\edit.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
<?php
/* $Id: edit.php,v 1.1.1.1 2002/10/28 19:13:46 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 "./inc/header.inc.php";

function 
is_firstpost($threadid$postid)
{
    global 
$pref;
    
$r_post thwb_query("SELECT postid FROM $pref"."post WHERE threadid='$threadid' ORDER BY posttime ASC");
    
$post mysql_fetch_array($r_post);
    
    if( 
$post['postid'] == $postid )
        return 
1;
    else
        return 
0;
}

// http://www.securiteam.com/securitynews/5FP0C204KE.html
$newpost['posttext'] = $HTTP_POST_VARS['newpost']['posttext'];
$navpath .= 'Post editieren';
if( 
$g_user['userid'] == )
{
    
message("Fehler""Nur registrierte/eingeloggte Benutzer k&ouml;nnen Beitr&#xE4;ge editieren!");
}

if( 
$thread['threadclosed'] == )
{
    if( !
$P->has_permissionP_EDITCLOSED ) )
    {
        
message('Fehler''Dieser Thread ist leider geschlossen. Es k&ouml;nnen keine Beitr&auml;ge mehr editiert
 werden.'
);
    }
}

$r_post thwb_query("SELECT postid, posttext, userid, threadid, postcode, postsmilies, postemailnotify, posttime FROM ".$pref."post WHERE postid='$post[postid]'");
$post mysql_fetch_array($r_post);

$post['threadtopic'] = htmlspecialchars($thread['threadtopic']);
$post['posttext'] = htmlspecialchars($post['posttext']);

// First Post of Thread ?
// dp: dieser weg ist besser als via time-vergleich
$firstpost is_firstpost($thread['threadid'], $post['postid']);

if( 
$firstpost && $P->has_permissionP_EDITTOPIC) )
{
    
$post['printtopic'] = '<input class="tbinput" type="text" name="newpost[posttopic]" size="50" value="'.$post['threadtopic'].'" maxlength="75">';

else
{
    
$post['printtopic'] = "$post[threadtopic]";
}

if( (
$post['userid'] == $g_user['userid'] && $P->has_permissionP_EDIT )) || $P->has_permissionP_OEDIT ) )
{
    if( 
$config['editlimit'] && !$P->has_permissionP_NOEDITLIMIT ) && ($post['posttime'] + $config['editlimit']) < time() )
    {
        
message('Fehler''Sie k&ouml;nnen diesen Post nicht mehr editieren. (Zeitlimit &#xFC;berschritten)');
    }

    if( !isset(
$Submit) )
    {
        if( 
$post['postcode'] )
        {
            
$codechecked ' checked';
        }
        else
        {
            
$codechecked '';
        }
        
        if( 
$post['postsmilies'] )
        {
            
$smilieschecked ' checked';
        }
        else
        {
            
$smilieschecked '';
        }
        
        if( 
$post['postemailnotify'] )
        {
            
$mailchecked ' checked';
        }
        else
        {
            
$mailchecked '';
        }
        
        if( 
$config['smilies'] )
        {
            
$smilies_on_off "AN";
        }
        else
        {
            
$smilies_on_off "AUS";
        }

        
$Tframe = new Template("templates/" $style['styletemplate'] . "/frame.html");
        
$Tform = new Template("templates/" $style['styletemplate'] . "/edit.html");


        
        eval(
$Tform->GetTemplate("CONTENT"));
        eval(
$Tframe->GetTemplate());
    }
    else
    {
        unset(
$msg);

        if( 
strlen($newpost['posttext']) < $config['message_minlength'] )
        {
            
$msg .= "Ihr text ist zu kurz!<br>";
        }
        if( 
strlen($newpost['posttext']) > $config['message_maxlength'] )
        {
            
$msg .= "Ihr text ist zu lang!<br>";
        }

        if( 
strlen($msg) > )
        {
            
message("Fehler""Es sind leider folgende Fehler aufgetreten:<br><br><font color='$style[color_err]'>$msg</font>");
        }

        
// badwords
        
if( $config["usebwordprot"] >= BWORD_POST )
        {
            
$newpost["posttext"] = check_banned($newpost["posttext"]);
        }
        
$c_time time();
        
        
thwb_query("UPDATE ".$pref."post SET posttext='" addslashes(preparse_code($newpost['posttext'])) . "',
        postlasteditby='
$g_user[username]', postlastedittime='" time() . "',
        postsmilies='" 
. ($newpost['postsmilies'] ? 0) . "',
        postcode='" 
. ($newpost['postcode'] ? 0) . "',
        postemailnotify='" 
. ($newpost['postemailnotify'] ? 0) . "' WHERE postid='$post[postid]'");
        
        
// topic updaten, (auch board), nicht als normaluser
        
if( $firstpost && $P->has_permissionP_EDITTOPIC ) )
        {
            
// badwords
            
if( $config["usebwordprot"] == BWORD_TOPIC || $config["usebwordprot"] == BWORD_ALL )
            {
                
$newpost["posttopic"] = check_banned($newpost["posttopic"]);
            }

            
// topic setten
            
thwb_query("UPDATE ".$pref."thread SET threadtopic = '" addslashes(preparse_code($newpost['posttopic'])) . "' WHERE threadid = '$post[threadid]'");

            
// board updaten
            
updateboard($thread['boardid']);
        }
        
header("Location: showtopic.php?thread[threadid]=$thread[threadid]&pagenum=lastpage");
    }
}
else
{
    
message("Fehler""Sie k&ouml;nnen diesen Post nicht editieren");
}

?>