/[gnuheter]/gnuheter/comments.php
ViewVC logotype

Diff of /gnuheter/comments.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20 by pawal, Sun Dec 1 20:33:30 2002 UTC revision 1.21 by metaur, Tue Dec 10 23:01:43 2002 UTC
# Line 29  Line 29 
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']);
# Line 41  $typ=(isset($typ))?$typ:0; Line 42  $typ=(isset($typ))?$typ:0;
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";
# Line 61  function modtwo($tid, $score, $reason) { Line 62  function modtwo($tid, $score, $reason) {
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\">";
# Line 86  return "&middot; <a href=\"comments.php? Line 87  return "&middot; <a href=\"comments.php?
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);
# Line 107  function format_comment_header($name,$su Line 108  function format_comment_header($name,$su
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";
# Line 134  function format_comment_body($comment,$s Line 135  function format_comment_body($comment,$s
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&amp;typ=$typ&amp;pid=$tid&amp;sid=$sid&amp;mode=$mode&amp;order=$order&amp;thold=$thold\">Svara</a>\n";                  $footer = "[ <a href=\"comments.php?op=Reply&amp;typ=$typ&amp;pid=$tid&amp;sid=$sid&amp;mode=$mode&amp;order=$order&amp;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>";
# Line 144  function format_comment_footer($tid,$sid Line 145  function format_comment_footer($tid,$sid
145                  $footer.= " | <a href=\"comments.php?sid=$sid&amp;typ=$typ&amp;pid=$erin&amp;mode=$mode&amp;order=$order&amp;thold=$thold\">Uppåt</a>\n";                  $footer.= " | <a href=\"comments.php?sid=$sid&amp;typ=$typ&amp;pid=$erin&amp;mode=$mode&amp;order=$order&amp;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&amp;typ=$typ&amp;tid=$tid&amp;sid=$sid\">Radera</a> ]<br><br>\n";                  $footer.= " | <a href=\"admin.php?op=RemoveComment&amp;typ=$typ&amp;tid=$tid&amp;sid=$sid\">Radera</a> ]<br><br>\n";
150          else          else
151                  $footer.= " ]<br><br>\n";                  $footer.= " ]<br><br>\n";
# Line 229  function DisplayKids ($tid, $mode, $orde Line 230  function DisplayKids ($tid, $mode, $orde
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)
# Line 338  function reply($pid, $sid, $mode, $order Line 339  function reply($pid, $sid, $mode, $order
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 " &lt;".$key."&gt;";  
         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";
# Line 352  function reply($pid, $sid, $mode, $order Line 351  function reply($pid, $sid, $mode, $order
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  }  }
# Line 369  function replyPreview ($medsig, $pid, $s Line 368  function replyPreview ($medsig, $pid, $s
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]);
# Line 395  function replyPreview ($medsig, $pid, $s Line 398  function replyPreview ($medsig, $pid, $s
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 " &lt;".$key."&gt;";  
                 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) {
# Line 412  function replyPreview ($medsig, $pid, $s Line 413  function replyPreview ($medsig, $pid, $s
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');
# Line 428  function CreateTopic ($medsig, $postanon Line 429  function CreateTopic ($medsig, $postanon
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);

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26