29 |
if (!isset($config)) include('config.php'); |
if (!isset($config)) include('config.php'); |
30 |
|
|
31 |
$savemainfile = $mainfile; |
$savemainfile = $mainfile; |
32 |
if (ereg('/comments\.php$', $SCRIPT_NAME)) |
include('auth.inc.php'); |
33 |
include('mainfile.php'); |
#if (ereg('/comments\.php$', $SCRIPT_NAME)) |
34 |
|
# include('mainfile.php'); |
35 |
$mainfile = $savemainfile; |
$mainfile = $savemainfile; |
36 |
|
|
37 |
isRealUser($HTTP_COOKIE_VARS['user']); |
isRealUser($HTTP_COOKIE_VARS['user']); |
42 |
|
|
43 |
|
|
44 |
function modone() { |
function modone() { |
45 |
global $admin,$moderate,$REQUEST_URI, $typ; |
global $admintest,$moderate,$REQUEST_URI, $typ; |
46 |
if (((isset($admin)) && ($moderate == 1)) || ($moderate == 2)) { |
if ((($admintest == 1) && ($moderate == 1)) || ($moderate == 2)) { |
47 |
echo "<form method=\"POST\" action=\"comments.php\" name=\"mod_form\"><input type=\"hidden\" name=\"typ\" value=\"$typ\">\n"; |
echo "<form method=\"POST\" action=\"comments.php\" name=\"mod_form\"><input type=\"hidden\" name=\"typ\" value=\"$typ\">\n"; |
48 |
} |
} |
49 |
} |
} |
50 |
|
|
51 |
function modtwo($tid, $score, $reason) { |
function modtwo($tid, $score, $reason) { |
52 |
global $admin, $user, $moderate, $reasons; |
global $admintest, $user, $moderate, $reasons; |
53 |
$modder = ""; |
$modder = ""; |
54 |
if ((((isset($admin)) && ($moderate == 1)) || ($moderate == 2)) && ($user)) { |
if (((($admintest == 1) && ($moderate == 1)) || ($moderate == 2)) && ($user)) { |
55 |
$modder.= " | <select name=\"dkn$tid\">"; |
$modder.= " | <select name=\"dkn$tid\">"; |
56 |
for ($i=0; $i<sizeof($reasons); $i++) { |
for ($i=0; $i<sizeof($reasons); $i++) { |
57 |
$modder.= "<option value=\"$score:$i\">$reasons[$i]</option>\n"; |
$modder.= "<option value=\"$score:$i\">$reasons[$i]</option>\n"; |
62 |
} |
} |
63 |
|
|
64 |
function modthree($sid, $mode, $order, $thold=0) { |
function modthree($sid, $mode, $order, $thold=0) { |
65 |
global $admin, $user, $moderate, $uimages; |
global $admintest, $user, $moderate, $uimages; |
66 |
if ((((isset($admin)) && ($moderate == 1)) || ($moderate==2)) && ($user)) { |
if (((($admintest == 1) && ($moderate == 1)) || ($moderate==2)) && ($user)) { |
67 |
echo "<div align=\"center\">"; |
echo "<div align=\"center\">"; |
68 |
echo "<input class=\"textbox\" type=\"hidden\" name=\"sid\" value=\"$sid\">"; |
echo "<input class=\"textbox\" type=\"hidden\" name=\"sid\" value=\"$sid\">"; |
69 |
echo "<input class=\"textbox\" type=\"hidden\" name=\"mode\" value=\"$mode\">"; |
echo "<input class=\"textbox\" type=\"hidden\" name=\"mode\" value=\"$mode\">"; |
87 |
|
|
88 |
|
|
89 |
function format_comment_header($name,$subject,$tid,$date,$reason,$email,$score) { |
function format_comment_header($name,$subject,$tid,$date,$reason,$email,$score) { |
90 |
global $anonymous,$reasons,$cookie,$admin, $typ; |
global $anonymous,$reasons,$cookie,$admintest, $typ; |
91 |
if (!eregi("[a-z0-9]",$name)) $name = $anonymous; |
if (!eregi("[a-z0-9]",$name)) $name = $anonymous; |
92 |
if (!eregi("[a-z0-9]",$subject)) $subject = "[Inget ärende]"; |
if (!eregi("[a-z0-9]",$subject)) $subject = "[Inget ärende]"; |
93 |
$subject = wordlinks($subject); |
$subject = wordlinks($subject); |
108 |
|
|
109 |
# visa URL till riktig hemsida här? |
# visa URL till riktig hemsida här? |
110 |
|
|
111 |
if ($admin and $tid) { |
if ($admintest and $tid) { |
112 |
$result = mysql_query("SELECT host_name FROM comments WHERE tid='$tid' AND typ='$typ'"); |
$result = mysql_query("SELECT host_name FROM comments WHERE tid='$tid' AND typ='$typ'"); |
113 |
list($host_name) = mysql_fetch_row($result); |
list($host_name) = mysql_fetch_row($result); |
114 |
$header.= "<br><b>(IP: $host_name)</b>\n"; |
$header.= "<br><b>(IP: $host_name)</b>\n"; |
135 |
} |
} |
136 |
|
|
137 |
function format_comment_footer($tid,$sid,$pid,$mode,$order,$thold,$score,$reason) { |
function format_comment_footer($tid,$sid,$pid,$mode,$order,$thold,$score,$reason) { |
138 |
global $admin, $user, $anompost, $typ; |
global $admintest, $user, $anompost, $typ; |
139 |
if ($anompost or $admin or $user) |
if ($anompost or $admintest or $user) |
140 |
$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&pid=$tid&sid=$sid&mode=$mode&order=$order&thold=$thold\">Svara</a>\n"; |
141 |
else |
else |
142 |
$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 <a href=\"user.php\">registera dig</a></i>"; |
145 |
$footer.= " | <a href=\"comments.php?sid=$sid&typ=$typ&pid=$erin&mode=$mode&order=$order&thold=$thold\">Uppåt</a>\n"; |
$footer.= " | <a href=\"comments.php?sid=$sid&typ=$typ&pid=$erin&mode=$mode&order=$order&thold=$thold\">Uppåt</a>\n"; |
146 |
} |
} |
147 |
$footer.= modtwo($tid, $score, $reason); |
$footer.= modtwo($tid, $score, $reason); |
148 |
if ($admin) |
if ($admintest) |
149 |
$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&tid=$tid&sid=$sid\">Radera</a> ]<br><br>\n"; |
150 |
else |
else |
151 |
$footer.= " ]<br><br>\n"; |
$footer.= " ]<br><br>\n"; |
230 |
} |
} |
231 |
|
|
232 |
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", $order=0, $thold=0, $level=0, $nokids=0) { |
233 |
global $user, $datetime, $cookie, $mainfile, $admin, $typ; |
global $user, $datetime, $cookie, $mainfile, $admintest, $typ; |
234 |
global $bgcolor1, $bgcolor2, $bgcolor3; |
global $bgcolor1, $bgcolor2, $bgcolor3; |
235 |
global $dbhost,$dbuname,$dbpass,$dbname; |
global $dbhost,$dbuname,$dbpass,$dbname; |
236 |
if (!@$mainfile) |
if (!@$mainfile) |
339 |
echo "<input class=\"textbox\" type=\"text\" name=\"subject\" size=\"50\" maxlength=\"60\" value=\"".htmlspecialchars($subject)."\"><br>"; |
echo "<input class=\"textbox\" type=\"text\" name=\"subject\" size=\"50\" maxlength=\"60\" value=\"".htmlspecialchars($subject)."\"><br>"; |
340 |
echo "<p><font color=\"$bgcolor2\"><b>Kommentar</b></font><br>\n"; |
echo "<p><font color=\"$bgcolor2\"><b>Kommentar</b></font><br>\n"; |
341 |
echo "<textarea class=\"textbox\" wrap=\"virtual\" cols=\"50\" rows=\"10\" name=\"comment\"></textarea><br>\n"; |
echo "<textarea class=\"textbox\" wrap=\"virtual\" cols=\"50\" rows=\"10\" name=\"comment\"></textarea><br>\n"; |
342 |
echo "Tillåten HTML:<br>\n"; |
printAllowedHTML(); |
|
while (list($key,)= each($AllowableHTML)) echo " <".$key.">"; |
|
|
echo "<br>\n"; |
|
343 |
if ($user) { |
if ($user) { |
344 |
echo "<input type=\"checkbox\" name=\"postanon\"> Posta anonymt<br>\n"; |
echo "<input type=\"checkbox\" name=\"postanon\"> Posta anonymt<br>\n"; |
345 |
echo "<input type=\"checkbox\" name=\"medsig\" checked> Infoga signatur<br>\n"; |
echo "<input type=\"checkbox\" name=\"medsig\" checked> Infoga signatur<br>\n"; |
351 |
."<input class=\"textbox\" type=\"hidden\" name=\"sid\" value=\"$sid\"><input class=\"textbox\" type=\"hidden\" name=\"mode\" value=\"$mode\">\n" |
."<input class=\"textbox\" type=\"hidden\" name=\"sid\" value=\"$sid\"><input class=\"textbox\" type=\"hidden\" name=\"mode\" value=\"$mode\">\n" |
352 |
."<input class=\"textbox\" type=\"hidden\" name=\"order\" value=\"$order\"><input class=textbox type=\"hidden\" name=\"thold\" value=\"$thold\">\n" |
."<input class=\"textbox\" type=\"hidden\" name=\"order\" value=\"$order\"><input class=textbox type=\"hidden\" name=\"thold\" value=\"$thold\">\n" |
353 |
."<input type=\"submit\" name=\"op\" value=\"Preview\" class=\"button\">\n" |
."<input type=\"submit\" name=\"op\" value=\"Preview\" class=\"button\">\n" |
354 |
."<input type=\"submit\" name=\"op\" value=\"Ok!\" class=\"button\"> <select name=\"posttype\"><option value=\"exttrans\">Extrans (HTML till text)<option value=\"html\" >HTML-formatterad<option value=\"plaintext\" selected>Vanlig text</select></form><br>\n"; |
."<input type=\"submit\" name=\"op\" value=\"Ok!\" class=\"button\"> <select name=\"posttype\"><option value=\"source\">Källkod<option value=\"html\" >HTML-formatterad<option value=\"plaintext\" selected>Vanlig text</select></form><br>\n"; |
355 |
|
|
356 |
include('footer.php'); |
include('footer.php'); |
357 |
} |
} |
368 |
if ($user && $medsig && ($cookie[11]!="")) $usersig="<br>".stripslashes($cookie[11]); |
if ($user && $medsig && ($cookie[11]!="")) $usersig="<br>".stripslashes($cookie[11]); |
369 |
else $usersig=""; |
else $usersig=""; |
370 |
$subject = stripslashes($subject); |
$subject = stripslashes($subject); |
371 |
|
$subject = new_check_html($subject, 'nohtml'); |
372 |
$comment = stripslashes($comment); |
$comment = stripslashes($comment); |
373 |
if (!isset($pid) || !isset($sid)) { echo "Something is not right with passing a variable to this function. This message is just to keep things from messing up down the road"; exit(); } |
if (!isset($pid) || !isset($sid)) { echo "<img src=\"images/warning.png\">Någonting är väldigt fel."; exit(); } |
374 |
|
|
375 |
if ($user and !$postanon) |
if ($user and !$postanon) |
376 |
$name = $cookie[1]; |
$name = $cookie[1]; |
377 |
else { |
else { |
378 |
$name = $anonymous; $usersig=""; } |
$name = $anonymous; $usersig=""; } |
379 |
|
|
380 |
if ($posttype == "exttrans") |
if ($posttype == "source") |
381 |
$viewcomment = nl2br(htmlspecialchars($comment)).$usersig; |
$viewcomment = '<pre>'.nowordlinksshow($comment).'</pre>'.$usersig; |
382 |
elseif ($posttype == "plaintext") |
else { |
383 |
|
$comment = new_check_html($comment); |
384 |
|
if ($posttype == "plaintext") |
385 |
$viewcomment = nl2br($comment).$usersig; |
$viewcomment = nl2br($comment).$usersig; |
386 |
else |
else |
387 |
$viewcomment = $comment.$usersig; |
$viewcomment = $comment.$usersig; |
388 |
|
} |
389 |
|
|
390 |
echo format_comment_header($name,($spell) ? spellcheck($subject) : $subject,$tid,$date,"","",0); |
echo format_comment_header($name,($spell) ? spellcheck($subject) : $subject,$tid,$date,"","",0); |
391 |
echo format_comment_body(($spell) ? spellcheck($viewcomment) : $viewcomment,$sid,$tid,$thold,$order,$cookie[10]); |
echo format_comment_body(($spell) ? spellcheck($viewcomment) : $viewcomment,$sid,$tid,$thold,$order,$cookie[10]); |
398 |
echo "<p><font color=\"$bgcolor2\"><b>Ärende</b></font><br>\n" |
echo "<p><font color=\"$bgcolor2\"><b>Ärende</b></font><br>\n" |
399 |
."<input class=\"textbox\" type=\"text\" name=\"subject\" size=\"50\" maxlength=\"60\" value=\"".htmlspecialchars($subject)."\"><br>\n" |
."<input class=\"textbox\" type=\"text\" name=\"subject\" size=\"50\" maxlength=\"60\" value=\"".htmlspecialchars($subject)."\"><br>\n" |
400 |
."<p><b>Kommentar</b><br>\n" |
."<p><b>Kommentar</b><br>\n" |
401 |
."<textarea class=\"textbox\" wrap=\"virtual\" cols=\"50\" rows=\"10\" name=\"comment\">$comment</textarea><br>\n"; |
."<textarea class=\"textbox\" wrap=\"virtual\" cols=\"50\" rows=\"10\" name=\"comment\">".htmlspecialchars($comment)."</textarea><br>\n"; |
402 |
echo "Tillåten HTML:<br>\n"; |
printAllowedHTML(); |
|
while (list($key,)= each($AllowableHTML)) echo " <".$key.">"; |
|
|
echo "<br>\n"; |
|
403 |
if ($postanon) $postanon_check = " checked"; else $postanon_check = ""; |
if ($postanon) $postanon_check = " checked"; else $postanon_check = ""; |
404 |
if ($medsig) $medsig_check = " checked"; else $medsig_check = ""; |
if ($medsig) $medsig_check = " checked"; else $medsig_check = ""; |
405 |
if ($user) { |
if ($user) { |
413 |
."<input class=\"textbox\" type=\"hidden\" name=\"sid\" value=\"$sid\"><input class=\"textbox\" type=\"hidden\" name=\"mode\" value=\"$mode\">\n" |
."<input class=\"textbox\" type=\"hidden\" name=\"sid\" value=\"$sid\"><input class=\"textbox\" type=\"hidden\" name=\"mode\" value=\"$mode\">\n" |
414 |
."<input class=\"textbox\" type=\"hidden\" name=\"order\" value=\"$order\"><input class=\"textbox\" type=\"hidden\" name=\"thold\" value=\"$thold\">\n" |
."<input class=\"textbox\" type=\"hidden\" name=\"order\" value=\"$order\"><input class=\"textbox\" type=\"hidden\" name=\"thold\" value=\"$thold\">\n" |
415 |
."<input type=\"submit\" name=\"op\" value=\"Preview\" class=\"button\">\n" |
."<input type=\"submit\" name=\"op\" value=\"Preview\" class=\"button\">\n" |
416 |
."<input type=\"submit\" name=\"op\" value=\"Ok!\" class=\"button\"> <select name=\"posttype\"><option value=\"exttrans\""; |
."<input type=\"submit\" name=\"op\" value=\"Ok!\" class=\"button\"> <select name=\"posttype\"><option value=\"source\""; |
417 |
if ($posttype == "exttrans") echo " selected"; |
if ($posttype == "source") echo " selected"; |
418 |
echo ">Extrans (HTML till text)<option value=\"html\"";; |
echo ">Källkod<option value=\"html\"";; |
419 |
if ($posttype=="html") echo " selected"; |
if ($posttype=="html") echo " selected"; |
420 |
echo ">HTML-formatterad<option value=\"plaintext\""; |
echo ">HTML-formatterad<option value=\"plaintext\""; |
421 |
if (($posttype!="exttrans") && ($posttype!="html")) echo " selected"; |
if (($posttype!="source") && ($posttype!="html")) echo " selected"; |
422 |
echo ">Vanlig text</select></form><br>\n"; |
echo ">Vanlig text</select></form><br>\n"; |
423 |
|
|
424 |
include('footer.php'); |
include('footer.php'); |
429 |
global $user, $userinfo, $EditedMessage, $cookie; |
global $user, $userinfo, $EditedMessage, $cookie; |
430 |
dbconnect(); |
dbconnect(); |
431 |
$author = FixQuotes($author); |
$author = FixQuotes($author); |
432 |
$subject = FixQuotes(filter_text($subject, "nohtml")); |
$subject = stripslashes($subject); |
433 |
|
$subject = new_check_html($subject, 'nohtml'); |
434 |
|
$subject = addslashes($subject); |
435 |
if ($user && $medsig && ($cookie[11]!="")) $usersig="<br>".stripslashes($cookie[11]); |
if ($user && $medsig && ($cookie[11]!="")) $usersig="<br>".stripslashes($cookie[11]); |
436 |
else $usersig=""; |
else $usersig=""; |
437 |
if ($posttype == "exttrans") |
$comment = stripslashes($comment); |
438 |
$comment = FixQuotes(nl2br(htmlspecialchars($comment))).$usersig; |
if ($posttype == "source") |
439 |
|
$comment = '<pre>'.nowordlinksshow($comment).'</pre>'.$usersig; |
440 |
elseif ($posttype == "plaintext") |
elseif ($posttype == "plaintext") |
441 |
$comment = FixQuotes(nl2br(filter_text($comment))).$usersig; |
$comment = nl2br(new_check_html($comment)).$usersig; |
442 |
else |
else |
443 |
$comment = FixQuotes(filter_text($comment)).$usersig; |
$comment = new_check_html($comment).$usersig; |
444 |
|
$comment = addslashes($comment); |
445 |
if ($user) getusrinfo($user); |
if ($user) getusrinfo($user); |
446 |
if (($user) && (!$postanon)) { |
if (($user) && (!$postanon)) { |
447 |
getusrinfo($user); |
getusrinfo($user); |