82 |
$datetime = formatTimestamp($date); |
$datetime = formatTimestamp($date); |
83 |
if ($name != $anonymous) |
if ($name != $anonymous) |
84 |
$name = "<a href=\"user.php?op=userinfo&uname=$name\">$name</a>"; |
$name = "<a href=\"user.php?op=userinfo&uname=$name\">$name</a>"; |
85 |
return "· <a href=\"comments.php?op=showreply&typ=$typ&tid=$tid&sid=$sid&pid=$pid&mode=$mode&order=$order&thold=$thold#$r_tid\">$subject</a> av $name den $datetime<br>\n"; |
return "· <a href=\"comments.php?op=showreply&typ=$typ&" |
86 |
|
. "tid=$tid&sid=$sid&pid=$pid&mode=$mode&order=$order&" |
87 |
|
. "thold=$thold#$r_tid\">$subject</a> av $name den $datetime<br>\n"; |
88 |
} |
} |
89 |
|
|
90 |
|
|
111 |
# visa URL till riktig hemsida här? |
# visa URL till riktig hemsida här? |
112 |
|
|
113 |
if ($admintest and $tid) { |
if ($admintest and $tid) { |
114 |
$result = mysql_query("SELECT host_name FROM comments WHERE tid='$tid' AND typ='$typ'"); |
$result = mysql_query("SELECT host_name FROM comments " |
115 |
|
. "WHERE tid='$tid' AND typ='$typ'"); |
116 |
list($host_name) = mysql_fetch_row($result); |
list($host_name) = mysql_fetch_row($result); |
117 |
$header.= "<br><b>(IP: $host_name)</b>\n"; |
$header.= "<br><b>(IP: $host_name)</b>\n"; |
118 |
} |
} |
124 |
function format_comment_body($comment,$sid,$tid,$thold,$order,$maxlength) { |
function format_comment_body($comment,$sid,$tid,$thold,$order,$maxlength) { |
125 |
global $commentlimit, $typ; # from config.php |
global $commentlimit, $typ; # from config.php |
126 |
if ($maxlength) $commentlimit = $maxlength; |
if ($maxlength) $commentlimit = $maxlength; |
127 |
$morecomment = "<br><br><b><a href=\"comments.php?sid=$sid&typ=$typ&tid=$tid&mode=$mode&order=$order&thold=$thold\">Läs resten av den här kommentaren...</a></b>\n"; |
$morecomment = "<br><br><b><a href=\"comments.php?sid=$sid&" |
128 |
|
. "typ=$typ&tid=$tid&mode=$mode&order=$order&" |
129 |
|
. "thold=$thold\">Läs resten av den här kommentaren...</a></b>\n"; |
130 |
$body = "<tr><td><div class=\"commentbody\">\n"; |
$body = "<tr><td><div class=\"commentbody\">\n"; |
131 |
if (($maxlength) && (strlen($comment) > $maxlength)) |
if (($maxlength) && (strlen($comment) > $maxlength)) |
132 |
$body.= substr("$comment", 0, $maxlength).$morecomment; |
$body.= substr("$comment", 0, $maxlength).$morecomment; |
142 |
function format_comment_footer($tid,$sid,$pid,$mode,$order,$thold,$score,$reason) { |
function format_comment_footer($tid,$sid,$pid,$mode,$order,$thold,$score,$reason) { |
143 |
global $admintest, $user, $anompost, $typ; |
global $admintest, $user, $anompost, $typ; |
144 |
if ($anompost or $admintest or $user) |
if ($anompost or $admintest or $user) |
145 |
$footer = "[ <a href=\"comments.php?op=Reply&typ=$typ&pid=$tid&sid=$sid&mode=$mode&order=$order&thold=$thold\">Svara</a>\n"; |
$footer = "[ <a href=\"comments.php?op=Reply&typ=$typ&" |
146 |
|
. "pid=$tid&sid=$sid&mode=$mode&order=$order&" |
147 |
|
. "thold=$thold\">Svara</a>\n"; |
148 |
else |
else |
149 |
$footer = "[ <i>Du får inte kommentera anonymt, var vänlig <a href=\"user.php\">registera dig</a></i>"; |
$footer = "[ <i>Du får inte kommentera anonymt, var vänlig " |
150 |
|
. "<a href=\"user.php\">registera dig</a></i>"; |
151 |
if ($pid != 0) { |
if ($pid != 0) { |
152 |
list($erin) = mysql_fetch_row(mysql_query("SELECT pid FROM comments WHERE tid='$pid' AND typ='$typ'")); |
list($erin) = mysql_fetch_row(mysql_query("SELECT pid FROM comments " |
153 |
$footer.= " | <a href=\"comments.php?sid=$sid&typ=$typ&pid=$erin&mode=$mode&order=$order&thold=$thold\">Uppåt</a>\n"; |
. "WHERE tid='$pid' " |
154 |
|
. "AND typ='$typ'")); |
155 |
|
$footer.= " | <a href=\"comments.php?sid=$sid&typ=$typ&" |
156 |
|
. "pid=$erin&mode=$mode&order=$order&" |
157 |
|
. "thold=$thold\">Uppåt</a>\n"; |
158 |
} |
} |
159 |
$footer.= modtwo($tid, $score, $reason); |
$footer.= modtwo($tid, $score, $reason); |
160 |
if ($admintest) |
if ($admintest) |
161 |
$footer.= " | <a href=\"admin.php?op=RemoveComment&typ=$typ&tid=$tid&sid=$sid\">Radera</a> ]<br><br>\n"; |
$footer.= " | <a href=\"admin.php?op=RemoveComment&typ=$typ&" |
162 |
|
. "tid=$tid&sid=$sid\">Radera</a> ]<br><br>\n"; |
163 |
else |
else |
164 |
$footer.= " ]<br><br>\n"; |
$footer.= " ]<br><br>\n"; |
165 |
return $footer; |
return $footer; |
172 |
|
|
173 |
<table width="99%" border="0" cellspacing="1" cellpadding="2"> |
<table width="99%" border="0" cellspacing="1" cellpadding="2"> |
174 |
<tr><td align="center"> |
<tr><td align="center"> |
175 |
<form method="GET" action="<?= $REQUEST_URI; ?>"> |
<form method="POST" action="<?= $REQUEST_URI; ?>"> |
176 |
<input type="hidden" name="typ" value="<?= $typ; ?>"> |
<input type="hidden" name="typ" value="<?= $typ; ?>"> |
177 |
Gräns: |
Gräns: |
178 |
<select name="thold"> |
<select name="thold"> |
204 |
if (!isset($config)) include('config.php'); |
if (!isset($config)) include('config.php'); |
205 |
$comments = 0; |
$comments = 0; |
206 |
cookiedecode($user); |
cookiedecode($user); |
207 |
$result = mysql_query("SELECT tid, pid, sid, date, name, email, url, host_name, subject, comment, score, reason FROM comments WHERE pid='$tid' AND typ='$typ' ORDER BY date, tid"); |
$result = mysql_query("SELECT tid, pid, sid, date, name, email, url, " |
208 |
|
. "host_name, subject, comment, score, reason " |
209 |
|
. "FROM comments WHERE pid='$tid' AND typ='$typ' " |
210 |
|
. "ORDER BY date, tid"); |
211 |
if ($mode == 'nested') { |
if ($mode == 'nested') { |
212 |
while (list($r_tid, $r_pid, $r_sid, $r_date, $r_name, $r_email, $r_url, $r_host_name, $r_subject, $r_comment, $r_score, $r_reason) = mysql_fetch_row($result)) { |
while (list($r_tid, $r_pid, $r_sid, $r_date, $r_name, |
213 |
|
$r_email, $r_url, $r_host_name, $r_subject, |
214 |
|
$r_comment, $r_score, $r_reason) = mysql_fetch_row($result)) { |
215 |
if ($r_score >= $thold) { |
if ($r_score >= $thold) { |
216 |
if (isset($level) and !$comments) |
if (isset($level) and !$comments) |
217 |
echo '<div class="commentbox">'; |
echo '<div class="commentbox">'; |
218 |
$comments++; |
$comments++; |
219 |
|
|
220 |
echo format_comment_header($r_name,$r_subject,$r_tid,$r_date,$r_reason,$r_email,$r_score); |
echo format_comment_header($r_name,$r_subject, |
221 |
echo format_comment_body($r_comment,$r_sid,$r_tid,$thold,$order,$cookie[10]); |
$r_tid,$r_date,$r_reason, |
222 |
echo format_comment_footer($r_tid,$r_sid,0,$mode,$order,$thold,$r_score,$r_reason); |
$r_email,$r_score); |
223 |
|
echo format_comment_body($r_comment,$r_sid,$r_tid, |
224 |
|
$thold,$order,$cookie[10]); |
225 |
|
echo format_comment_footer($r_tid,$r_sid,0,$mode, |
226 |
|
$order,$thold,$r_score,$r_reason); |
227 |
DisplayKids($r_tid, $mode, $order, $thold, $level+1); |
DisplayKids($r_tid, $mode, $order, $thold, $level+1); |
228 |
} |
} |
229 |
} |
} |
230 |
} elseif ($mode == 'flat') { |
} elseif ($mode == 'flat') { |
231 |
while (list($r_tid, $r_pid, $r_sid, $r_date, $r_name, $r_email, $r_url, $r_host_name, $r_subject, $r_comment, $r_score, $r_reason) = mysql_fetch_row($result)) { |
while (list($r_tid, $r_pid, $r_sid, $r_date, $r_name, $r_email, |
232 |
|
$r_url, $r_host_name, $r_subject, $r_comment, |
233 |
|
$r_score, $r_reason) = mysql_fetch_row($result)) { |
234 |
if ($r_score >= $thold) { |
if ($r_score >= $thold) { |
235 |
echo format_comment_header($r_name,$r_subject,$r_tid,$r_date,$r_reason,$r_email,$r_score); |
echo format_comment_header($r_name,$r_subject, |
236 |
echo format_comment_body($r_comment,$r_sid,$r_tid,$thold,$order,$cookie[10]); |
$r_tid,$r_date,$r_reason, |
237 |
echo format_comment_footer($r_tid,$r_sid,0,$mode,$order,$thold,$r_score,$r_reason); |
$r_email,$r_score); |
238 |
|
echo format_comment_body($r_comment,$r_sid,$r_tid, |
239 |
|
$thold,$order,$cookie[10]); |
240 |
|
echo format_comment_footer($r_tid,$r_sid,0,$mode, |
241 |
|
$order,$thold,$r_score,$r_reason); |
242 |
DisplayKids($r_tid, $mode, $order, $thold); |
DisplayKids($r_tid, $mode, $order, $thold); |
243 |
} |
} |
244 |
} |
} |
245 |
} else { |
} else { |
246 |
while (list($r_tid, $r_pid, $r_sid, $r_date, $r_name, $r_email, $r_url, $r_host_name, $r_subject, $r_comment, $r_score, $r_reason) = mysql_fetch_row($result)) { |
while (list($r_tid, $r_pid, $r_sid, $r_date, $r_name, $r_email, |
247 |
|
$r_url, $r_host_name, $r_subject, $r_comment, |
248 |
|
$r_score, $r_reason) = mysql_fetch_row($result)) { |
249 |
if ($r_score >= $thold) { |
if ($r_score >= $thold) { |
250 |
if (isset($level) and !$comments) |
if (isset($level) and !$comments) |
251 |
echo '<div class="commentbox">'; |
echo '<div class="commentbox">'; |
252 |
$comments++; |
$comments++; |
253 |
echo format_short_comment($r_name,$r_subject,$r_date,$r_tid,$r_sid,$r_pid,$mode,$order,$thold); |
echo format_short_comment($r_name,$r_subject,$r_date, |
254 |
|
$r_tid,$r_sid,$r_pid,$mode, |
255 |
|
$order,$thold); |
256 |
DisplayKids($r_tid, $mode, $order, $thold, $level+1); |
DisplayKids($r_tid, $mode, $order, $thold, $level+1); |
257 |
} |
} |
258 |
} |
} |
261 |
echo "</div>\n"; |
echo "</div>\n"; |
262 |
} |
} |
263 |
|
|
264 |
function DisplayTopic ($sid, $pid=0, $tid=0, $mode="thread", $order=0, $thold=0, $level=0, $nokids=0) { |
function DisplayTopic ($sid, $pid=0, $tid=0, $mode="thread", |
265 |
|
$order=0, $thold=0, $level=0, $nokids=0) { |
266 |
global $user, $datetime, $cookie, $mainfile, $admintest, $typ; |
global $user, $datetime, $cookie, $mainfile, $admintest, $typ; |
267 |
global $bgcolor1, $bgcolor2, $bgcolor3; |
global $bgcolor1, $bgcolor2, $bgcolor3; |
268 |
global $dbhost,$dbuname,$dbpass,$dbname; |
global $dbhost,$dbuname,$dbpass,$dbname; |
274 |
dbconnect(); |
dbconnect(); |
275 |
$count_times = 0; |
$count_times = 0; |
276 |
cookiedecode($user); |
cookiedecode($user); |
277 |
$q = "SELECT tid, pid, sid, date, name, email, url, host_name, subject, comment, score, reason FROM comments WHERE sid='$sid' AND pid='$pid' AND typ='$typ'"; |
$q = "SELECT tid, pid, sid, date, name, email, url, host_name, " |
278 |
|
. "subject, comment, score, reason FROM comments " |
279 |
|
. "WHERE sid='$sid' AND pid='$pid' AND typ='$typ'"; |
280 |
if ($thold != '') { |
if ($thold != '') { |
281 |
$q .= " AND score >= '$thold'"; |
$q .= " AND score >= '$thold'"; |
282 |
} else { |
} else { |
289 |
navbar($sid, $thold, $mode, $order); |
navbar($sid, $thold, $mode, $order); |
290 |
modone(); |
modone(); |
291 |
while ($count_times < $num_tid) { |
while ($count_times < $num_tid) { |
292 |
list($tid, $pid, $sid, $date, $name, $email, $url, $host_name, $subject, $comment, $score, $reason) = mysql_fetch_row($something); |
list($tid, $pid, $sid, $date, $name, $email, $url, |
293 |
|
$host_name, $subject, $comment, $score, |
294 |
|
$reason) = mysql_fetch_row($something); |
295 |
|
|
296 |
echo format_comment_header($name,$subject,$tid,$date,$reason,$email,$score); |
echo format_comment_header($name,$subject,$tid,$date,$reason,$email,$score); |
297 |
echo format_comment_body($comment,$sid,$tid,$thold,$order,$cookie[10]); |
echo format_comment_body($comment,$sid,$tid,$thold,$order,$cookie[10]); |
309 |
include('header.php'); |
include('header.php'); |
310 |
global $user, $cookie, $typ; |
global $user, $cookie, $typ; |
311 |
dbconnect(); |
dbconnect(); |
312 |
$result = mysql_query("SELECT date, name, email, url, subject, comment, score, reason FROM comments WHERE tid='$tid' AND sid='$sid' AND typ='$typ'"); |
$result = mysql_query("SELECT date, name, email, url, subject, comment, " |
313 |
|
. "score, reason FROM comments WHERE tid='$tid' " |
314 |
|
. "AND sid='$sid' AND typ='$typ'"); |
315 |
list($date, $name, $email, $url, $subject, $comment, $score, $reason) = mysql_fetch_row($result); |
list($date, $name, $email, $url, $subject, $comment, $score, $reason) = mysql_fetch_row($result); |
316 |
|
|
317 |
echo format_comment_header($name,$subject,$tid,$date,$reason,$email,$score); |
echo format_comment_header($name,$subject,$tid,$date,$reason,$email,$score); |