function PrintMsg($f, $level) { global $l10nstr; global $table; global $FirstMsg; global $ThreadTop; global $ShowMsg; global $mainfile; global $editscript; global $descscript; global $banscript; global $scriptsurl; global $addfilescript; global $nulfrm; global $userfiles; global $MsgPerPage; global $msgread; global $IsManager; global $name; $query = "SELECT * FROM {$table} WHERE ancestor={$f}"; if ($f == 0 && $FirstMsg > 0) { $query .= " AND num<={$FirstMsg}"; } if ($f == 0) { if ($ThreadTop) { $query .= " AND num={$ThreadTop}"; } $query .= " ORDER BY lastmod DESC, date DESC, time DESC"; $query .= " LIMIT {$MsgPerPage}"; //print "$query<BR>\n"; } else { $query .= " ORDER BY date DESC, time DESC"; } $result = mysql_query($query); if (!$result) { echo mysql_error(); exit; } if (mysql_num_rows($result) == 0) { return; } /* end of recursive call */ while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { $msgnum = $line['num']; $title = $line['title']; $user = $line['name']; $title = SpecialCodes($title); //print "<LI type=disc dir=RTL><BIG><A id=t$msgnum HREF=\"javascript:void(0)\" onclick=\"blocking('msg$msgnum', 't$msgnum')\">$title</A></BIG> - "; // search if message was read... /* if($level == 0) print "<BR>\n"; print "<LI type=disc dir=RTL>"; */ if ($level == 0) { print "<TABLE width=100% height=\$3px><TR><TD></TABLE>\n"; } print "<TABLE dir=RTL border=0 width=100% cellpadding=0 cellspacing=0>\n"; print "<TR>\n"; print "<TD width={$i}%>\n"; print "<TD dir=RTL>\n"; if ($level == 0) { print "<UL><LI type=disk>"; } else { print "<UL><LI type=circle>"; } if (array_search($msgnum, $msgread)) { print "<A id=t{$msgnum} HREF={$nulfrm}?msg={$msgnum}&forum={$table} target=trce onclick=\"blocking('msg{$msgnum}', 't{$msgnum}')\"><FONT color=#ff0000>{$title}</FONT></A>"; } else { print "<A id=t{$msgnum} HREF={$nulfrm}?msg={$msgnum}&forum={$table} target=trce onclick=\"blocking('msg{$msgnum}', 't{$msgnum}')\">{$title}</A>"; } print "<TD width=20%>\n"; print "<A HREF={$descscript}?action=user&usrname={$user}&forum={$table} target=_blank>"; $alias = GetAlias($user); if (IsForumManager($user)) { print "<BIG><B><FONT color=blue>{$alias}</FONT></B></BIG></A>\n"; } else { if ($user == $name) { print "<BIG><B><FONT color=black>{$alias}</FONT></B></BIG></A>\n"; } else { print "{$alias}</A>\n"; } } $date = $line['date']; $time = $line['time']; $datearr = explode('-', $date); $timearr = explode(':', $time); $datetimestr = GetTimeStr($timearr[0], $timearr[1], $timearr[2], $datearr[1], $datearr[2], $datearr[0]); // $date = "$datearr[2]/$datearr[1]/$datearr[0]"; print "<TD width=25%>\n"; print "<FONT dir=LTR>"; print "{$datetimestr}</FONT></LI>\n"; /* Put message contents as DIV that will be displayed when clicking on message */ $contents = $line['contents']; $contents = SpecialCodes($contents); print "<TR>\n"; $i = $level * 2; print "<TD width={$i}%>\n"; print "<TD bgcolor=#fff8ff colspan=3>\n"; if ($ShowMsg == $msgnum) { print "<DIV id=msg{$msgnum}>"; } else { print "<DIV class=para id=msg{$msgnum}>"; } print "{$contents}<BR>\n"; $pic = $line['picture']; if (!empty($pic)) { $ext = GetExt($pic); if (IsImg($ext)) { $s = getimagesize("{$userfiles}/{$pic}"); $w = $s[0]; $h = $s[1]; if ($w > 100) { $ar = $h / $w; $h = 100 * $ar; $w = 100; } print "<A HREF={$userfiles}/{$pic}><IMG SRC={$userfiles}/{$pic} width={$w} height={$h} border=0></A><BR><BR>\n"; } else { print "<A HREF={$userfiles}/{$pic}>"; print "מצורף קובץ: "; print "{$ext}</A><BR>\n"; } } $url = $line['url1']; $urldesc = $line['urldesc1']; if (!empty($urldesc) && !empty($url)) { print "<A HREF={$url} target=_blank>{$urldesc}</A><BR>\n"; } $url = $line['url2']; $urldesc = $line['urldesc2']; if (!empty($urldesc) && !empty($url)) { print "<A HREF={$url} target=_blank>{$urldesc}</A><BR>\n"; } $url = $line['url3']; $urldesc = $line['urldesc3']; if (!empty($urldesc) && !empty($url)) { print "<A HREF={$url} target=_blank>{$urldesc}</A><BR>\n"; } print "<BR><A href={$editscript}?forum={$table}&action=reply&ancestor={$msgnum}>{$l10nstr['22']}</A>\n"; /* response */ if (editable($user)) { print " \n"; print "<A href={$editscript}?forum={$table}&action=edit&num={$msgnum}>{$l10nstr['23']}</A>\n"; /* edit message */ print " \n"; print "<A HREF=\"javascript:void(0)\" onclick=\"javascript:AddFile('{$addfilescript}?forum={$table}&num={$msgnum}');\">"; print "{$l10nstr['24']}"; /* add file to message */ print "</A>\n"; } if (deleteable($user, $msgnum)) { print " \n"; print "<A href={$editscript}?forum={$table}&action=delete&num={$msgnum}>{$l10nstr['25']}</A>\n"; /* delete message */ } if ($IsManager) { print " <A HREF={$banscript}?forum={$table}&user={$user}>{$l10nstr['26']}</A>\n"; /* ban a user */ print " {$msgnum}\n"; } print "<BR><BR></DIV>\n"; print "</TABLE>\n"; /* spacing table */ print "<TABLE width=100% height=\$3px><TR><TD></TABLE>\n"; /* recursive call */ PrintMsg($msgnum, $level + 1); } }
function FormatTime($t) { $timearr = explode(':', $t); $timestr = GetTimeStr($timearr[3], $timearr[4], $timearr[5], $timearr[1], $timearr[0], $timearr[2]); return $timestr; }