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

Diff of /gnuheter/comments.php

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

revision 1.22 by metaur, Wed Dec 11 08:29:21 2002 UTC revision 1.23 by pawal, Wed Dec 18 06:55:01 2002 UTC
# Line 82  function format_short_comment($name,$sub Line 82  function format_short_comment($name,$sub
82          $datetime = formatTimestamp($date);          $datetime = formatTimestamp($date);
83          if ($name != $anonymous)          if ($name != $anonymous)
84                  $name = "<a href=\"user.php?op=userinfo&amp;uname=$name\">$name</a>";                  $name = "<a href=\"user.php?op=userinfo&amp;uname=$name\">$name</a>";
85  return "&middot; <a href=\"comments.php?op=showreply&amp;typ=$typ&amp;tid=$tid&amp;sid=$sid&amp;pid=$pid&amp;mode=$mode&amp;order=$order&amp;thold=$thold#$r_tid\">$subject</a> av $name den $datetime<br>\n";          return "&middot; <a href=\"comments.php?op=showreply&amp;typ=$typ&amp;"
86                 . "tid=$tid&amp;sid=$sid&amp;pid=$pid&amp;mode=$mode&amp;order=$order&amp;"
87                 . "thold=$thold#$r_tid\">$subject</a> av $name den $datetime<br>\n";
88  }  }
89    
90    
# Line 109  function format_comment_header($name,$su Line 111  function format_comment_header($name,$su
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          }          }
# Line 121  function format_comment_header($name,$su Line 124  function format_comment_header($name,$su
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&amp;typ=$typ&amp;tid=$tid&amp;mode=$mode&amp;order=$order&amp;thold=$thold\">Läs resten av den här kommentaren...</a></b>\n";          $morecomment = "<br><br><b><a href=\"comments.php?sid=$sid&amp;"
128              . "typ=$typ&amp;tid=$tid&amp;mode=$mode&amp;order=$order&amp;"
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;
# Line 137  function format_comment_body($comment,$s Line 142  function format_comment_body($comment,$s
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&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;"
146                            . "pid=$tid&amp;sid=$sid&amp;mode=$mode&amp;order=$order&amp;"
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&amp;typ=$typ&amp;pid=$erin&amp;mode=$mode&amp;order=$order&amp;thold=$thold\">Uppåt</a>\n";                                                          . "WHERE tid='$pid' "
154                                                            . "AND typ='$typ'"));
155                    $footer.= " | <a href=\"comments.php?sid=$sid&amp;typ=$typ&amp;"
156                            . "pid=$erin&amp;mode=$mode&amp;order=$order&amp;"
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&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;"
162                            . "tid=$tid&amp;sid=$sid\">Radera</a> ]<br><br>\n";
163          else          else
164                  $footer.= " ]<br><br>\n";                  $footer.= " ]<br><br>\n";
165          return $footer;          return $footer;
# Line 159  function navbar($sid, $thold, $mode, $or Line 172  function navbar($sid, $thold, $mode, $or
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">
# Line 191  function DisplayKids ($tid, $mode, $orde Line 204  function DisplayKids ($tid, $mode, $orde
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                  }                  }
# Line 229  function DisplayKids ($tid, $mode, $orde Line 261  function DisplayKids ($tid, $mode, $orde
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;
# Line 241  function DisplayTopic ($sid, $pid=0, $ti Line 274  function DisplayTopic ($sid, $pid=0, $ti
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 {
# Line 254  function DisplayTopic ($sid, $pid=0, $ti Line 289  function DisplayTopic ($sid, $pid=0, $ti
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]);
# Line 272  function singlecomment($tid, $sid, $mode Line 309  function singlecomment($tid, $sid, $mode
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);

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

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