function ShowGuide($id, $ancestor) { global $last; global $name; global $editors; global $userfiles; $query = "SELECT * from guides WHERE id={$id} AND ancestor={$ancestor}"; $result = mysql_query($query); if (!$result) { echo mysql_error(); exit; } if (mysql_num_rows($result) == 0) { print "</TABLE>\n"; return 0; /* end of recursive call */ } $line = mysql_fetch_array($result, MYSQL_ASSOC); $num = $line['num']; $last = $num; $header = $line['header']; $contents = $line['contents']; $picture = $line['picture']; $header = SpecialCodes($header); $contents = SpecialCodes($contents); if ($ancestor == 0) { /* this is first time so start table */ print "<TABLE dir=RTL border=0 width=100%>\n"; } print "<TR><TD>\n"; print "<A HREF=javascript:void() onclick=\"blocking('s{$num}', 'h{$num}')\">{$header}</A><BR>\n"; print "<TR><TD>\n"; print "<DIV class=para id=s{$num}>\n"; print "<TABLE dir=RTL width=100%><TR><TD valign=top>\n"; DisplayContents($contents); print "<BR>\n"; if (!empty($picture)) { print "<TD valign=center align=center>\n"; $ext = GetExt($picture); if (IsImg($ext)) { $s = getimagesize("{$userfiles}/{$picture}"); $w = $s[0]; $ow = $w + 35; $h = $s[1]; $oh = $h + 35; if ($w > 100) { $ar = $h / $w; $h = 200 * $ar; $w = 200; } print "<A HREF=\"#\" onclick=\"javascript:window.open("; print "'{$userfiles}/{$picture}', 'Picture', 'height={$oh}, width={$ow} scrollbars=yes resizable=yes')\">"; print "<IMG SRC={$userfiles}/{$picture} width={$w} height={$h} border=0>"; print "</A><BR><BR>\n"; } else { print "<TD><A HREF={$userfiles}/{$picture} target=_blank>"; print "{$l10nstr['189']} "; print "{$ext}</A><BR>\n"; } } print "</TABLE>\n"; print "</DIV>\n"; ShowGuide($id, $num); }
function DispComments($blogmsgnum, $ancestor, $level) { global $blognum; global $l10nstr; global $name, $user; $query = "SELECT * FROM responses WHERE blogmsgnum={$blogmsgnum} AND ancestor={$ancestor} ORDER BY time DESC"; $result = mysql_query($query); if (!$result) { echo mysql_error(); exit; } if (mysql_num_rows($result) == 0) { return; } /* end of recursive call */ if ($level == 0) { print "<TABLE width=100% height=\$3px><TR><TD></TABLE>\n"; } /* spacer between two threades */ while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { $msgnum = $line['num']; $title = SpecialCodes($line['title']); $msguser = $line['name']; $email = $line['email']; $showname = $line['showname']; $comment = $line['comment']; $time = $line['time']; $i = $level * 4; print "<TABLE border=0 width=90% cellpadding=0 cellspacing=0 dir=RTL>\n"; print "<TR>\n"; print "<TD width={$i}%>\n"; /* spacer before beginning of response */ print "<TD>\n"; /* response title */ print "<A id=t{$msgnum} HREF=javascript:(void) onclick=\"blocking('msg{$msgnum}', 't{$msgnum}')\">{$title}</A>\n"; print "<TD width=20%>\n"; /* show name and email */ if ($showname) { print "<A HREF={$descscript}?action=user&usrname={$msguser} target=_blank>{$msguser}</A>\n"; } else { if ($email) { print "<A HREF=mailto:{$email}>{$msguser}</A>\n"; } else { print "{$msguser}\n"; } } print "<TD width=25%>\n"; /* show message time */ sscanf($time, "%d-%d-%d %d:%d:%d", &$year, &$month, &$day, &$hour, &$min, &$sec); if ($min < 10) { $min = "0{$min}"; } $time = "{$day}-{$month}-{$year} {$hour}:{$min}"; print "{$time}\n"; /* Put message contents as DIV that will be displayed when clicking on message */ print "<TR>\n"; print "<TD width={$i}%>\n"; /* spacer according to level */ print "<TD bgcolor=#FFF8FF colspan=3>\n"; print "<DIV class=para id=msg{$msgnum}>\n"; DisplayContents($comment); /* show link to add response */ print "<BR><A HREF=blogmsg.php?action=comment&blog={$blognum}&num={$blogmsgnum}&ancestor={$msgnum}>"; print "הגב להודעה"; print "</A> \n"; if ($user == $name) { print "<A HREF=blogs.php?action=delcomment&blog={$blognum}&num={$blogmsgnum}&msgnum={$msgnum}>{$l10nstr['25']}</A>\n"; /* delete message */ } print "<BR><BR>\n"; print "</DIV>\n"; print "</TABLE>\n"; DispComments($blogmsgnum, $msgnum, $level + 1); } }
$author = $line['author']; $email = $line['email']; $time = $line['time']; $tstr = GetTimeFromDateTime($time); $comment = $line['comment']; print "<TR bgcolor=#F0F0F0><TD align=right>\n"; if ($email) { print "<A HREF=mailto:{$email}>"; } print "{$author}"; if ($email) { print "</A>\n"; } if ($user == $name) { /* we are the blog owner */ print " \n"; print "<A HREF=guestbook.php?blognum={$blognum}&msg={$msgnum}&action=del>מחק</A>\n"; } print "<TD align=left>{$tstr}\n"; print "<TR><TD colspan=2>\n"; DisplayContents($comment); print "</TR>\n"; } print "</TABLE>\n"; /* end of internal table */ print "</TABLE>\n"; /* end of external table */ ?> </BODY> </HTML>
$result = mysql_query($query); if (!$result) { echo mysql_error(); exit; } $line = mysql_fetch_array($result, MYSQL_NUM); $contents = $line[0]; $pic = $line[1]; print "<TABLE border=0 width=80% dir=RTL>\n"; if ($ancestor) { print "<TR><TD>{$pic}\n"; /* $pic in this case contains title */ $pic = ''; } print "<TR bgcolor=#F0F0F0><TD valign=top>\n"; DisplayContents($contents); if (!empty($pic)) { $ext = GetExt($pic); if (IsImg($ext)) { print "<TD>\n"; DisplayImg($pic); } else { print "<BR><BR><A HREF=\"{$userfiles}/{$pic}\">{$ext} "; print "מצורף קובץ: "; print "</A>\n"; } } print "</TD></TR></TABLE><BR>\n"; print "<FORM action=blogmsg.php?action=submit&blog={$blognum}&num={$num}&ancestor={$ancestor} method=post>\n"; print "<TABLE border=8 dir=RTL>\n"; print "<TR><TD colspan=2 align=left>\n";