0) { $sQuery = "SELECT email,realname FROM user_list WHERE userId = '".$iUserId."' LIMIT 1"; $hResult = query_appdb($sQuery); $oUsr = mysql_fetch_object($hResult); $sMailto = '' . $oUsr->realname . ''; } else { $sMailto = 'Anonymous'; } return $sMailto; } /** * display a single comment (in $ob) */ function view_app_comment($ob) { echo html_frame_start('','98%'); echo '',"\n"; $ob->subject = stripslashes($ob->subject); $ob->body = stripslashes($ob->body); // message header echo "\n"; // delete message button, for admins if (loggedin() && (havepriv("admin") || $_SESSION['current']->is_maintainer($ob->appId,$ob->versionId) )) { echo ""; echo "","\n"; echo ""; } echo "
\n"; echo " ".$ob->subject."
\n"; echo " by ".forum_lookup_user($ob->userId)." on ".$ob->time."
\n"; echo "
\n"; // body echo htmlify_urls($ob->body), "

\n"; // only add RE: once if(eregi("RE:", $ob->subject)) $subject = $ob->subject; else $subject = "RE: ".$ob->subject; // reply post buttons echo " [post new] \n"; echo " [reply to this] \n"; echo "
\n"; echo "commentId\" />"; echo "appId\" />"; echo "versionId\" />
\n"; echo html_frame_end(); } /** * grab comments for appId / versionId * if parentId is not -1 only comments for that thread are returned */ function grab_comments($appId, $versionId, $parentId = -1) { $extra = ""; if($parentId != -1) $extra = "AND parentId = $parentId "; $qstring = "SELECT from_unixtime(unix_timestamp(time), \"%W %M %D %Y, %k:%i\") as time, ". "commentId, parentId, appId, versionId, userId, subject, body ". "FROM appComments WHERE appId = '$appId' AND versionId = '$versionId' ". $extra. "ORDER BY appComments.time ASC"; $result = query_appdb($qstring); return $result; } /** * grab comments for appId / versionId * if parentId is not -1 only comments for that thread are returned */ function count_comments($appId, $versionId) { $qstring = "SELECT count(commentId) as hits FROM appComments WHERE appId = $appId AND versionId = $versionId"; $result = query_appdb($qstring); $ob = mysql_fetch_object($result); return $ob->hits; } /** * display nested comments * handle is a db result set */ function do_display_comments_nested($handle) { while($ob = mysql_fetch_object($handle)) { view_app_comment($ob); $result = grab_comments($ob->appId, $ob->versionId, $ob->commentId); if($result && mysql_num_rows($result)) { echo "
\n"; do_display_comments_nested($result); echo "
\n"; } } } function display_comments_nested($appId, $versionId, $threadId) { $result = grab_comments($appId, $versionId, $threadId); do_display_comments_nested($result); } /** * display threaded comments * handle is a db result set */ function do_display_comments_threaded($handle, $is_main) { if (!$is_main) echo "\n"; } function display_comments_threaded($appId, $versionId, $threadId = 0) { $result = grab_comments($appId, $versionId, $threadId); do_display_comments_threaded($result, 1); } /** * display flat comments */ function display_comments_flat($appId, $versionId) { $result = grab_comments($appId, $versionId); if ($result) { while($ob = mysql_fetch_object($result)) { view_app_comment($ob); } } } function view_app_comments($appId, $versionId, $threadId = 0) { // count posts $result = query_appdb("SELECT commentId FROM appComments WHERE appId = $appId AND versionId = $versionId"); $messageCount = mysql_num_rows($result); //start comment format table echo html_frame_start("","98%",'',0); echo '',"\n"; echo '',"\n"; echo '
',"\n"; // message display mode changer if (loggedin()) { // FIXME we need to change this so not logged in users can change current view as well if (isset($_REQUEST['cmode'])) $_SESSION['current']->setpref("comments:mode", $_REQUEST['cmode']); $sel[$_SESSION['current']->getpref("comments:mode")] = 'selected'; echo '',"\n"; } // blank space echo '',"\n"; // post new message button echo '',"\n"; //end comment format table echo '
',"\n"; echo "Application Comments $messageCount total comments "; echo 'Mode ',"\n"; echo '
 
',"\n"; echo '
',"\n"; echo html_frame_end(); if( $messageCount > 0 ) { echo '

The following comments are owned by whoever posted them. WineHQ is not responsible for what they say.

'."\n"; } //start comments echo '
',"\n"; //hide or display depending on pref if (loggedin()) $mode = $_SESSION['current']->getpref("comments:mode"); else $mode = "flat"; switch ($mode) { case "flat": display_comments_flat($appId, $versionId); break; case "nested": display_comments_nested($appId, $versionId, $threadId); break; case "threaded": display_comments_threaded($appId, $versionId, $threadId); break; } echo '
',"\n"; } ?>