Comments were not showing who posted them

This commit is contained in:
Jonathan Ernst
2005-01-11 00:24:06 +00:00
committed by WineHQ
parent d9826427da
commit d2a1505ad5

View File

@@ -3,22 +3,21 @@
/* get user info for posts */ /* get user info for posts */
/***************************/ /***************************/
function forum_lookup_user ($userid) function forum_lookup_user($iUserId)
{ {
$mailto = ''; $mailto = '';
if ($userid > 0) if ($iUserId > 0)
{ {
$qstring = "SELECT email FROM user_list WHERE userid = '".$userid."' LIMIT 1"; $sQuery = "SELECT email,realname FROM user_list WHERE userId = '".$iUserId."' LIMIT 1";
$result = mysql_query($qstring); $hResult = query_appdb($sQuery);
$usr = mysql_fetch_object($result); $oUsr = mysql_fetch_object($hResult);
$mailto = '<a href="mailto:' . $usr->email . '">' . $usr->realname . '</a>'; $sMailto = '<a href="mailto:' . $oUsr->email . '">' . $oUsr->realname . '</a>';
unset($qstring, $result, $usr);
} }
else else
{ {
$mailto = '<font color="#999999">Anonymous</font>'; $sMailto = '<font color="#999999">Anonymous</font>';
} }
return $mailto; return $sMailto;
} }
/** /**
@@ -36,7 +35,7 @@ function view_app_comment($ob)
// message header // message header
echo "<tr bgcolor=#E0E0E0><td>\n"; echo "<tr bgcolor=#E0E0E0><td>\n";
echo " <b>".$ob->subject."</b><br>\n"; echo " <b>".$ob->subject."</b><br>\n";
echo " by ".forum_lookup_user($ob->userid)." on ".$ob->time."<br>\n"; echo " by ".forum_lookup_user($ob->userId)." on ".$ob->time."<br>\n";
echo "</td></tr><tr><td>\n"; echo "</td></tr><tr><td>\n";
// body // body
@@ -83,7 +82,7 @@ function grab_comments($appId, $versionId, $parentId = -1)
$extra = "AND parentId = $parentId "; $extra = "AND parentId = $parentId ";
$qstring = "SELECT from_unixtime(unix_timestamp(time), \"%W %M %D %Y, %k:%i\") as time, ". $qstring = "SELECT from_unixtime(unix_timestamp(time), \"%W %M %D %Y, %k:%i\") as time, ".
"commentId, parentId, appId, versionId, userid, subject, body ". "commentId, parentId, appId, versionId, userId, subject, body ".
"FROM appComments WHERE appId = '$appId' AND versionId = '$versionId' ". "FROM appComments WHERE appId = '$appId' AND versionId = '$versionId' ".
$extra. $extra.
"ORDER BY appComments.time ASC"; "ORDER BY appComments.time ASC";
@@ -149,7 +148,7 @@ function do_display_comments_threaded($handle, $is_main)
} else } else
{ {
echo '<li><a href="commentview.php?appId='.$ob->appId.'&versionId='.$ob->versionId.'&threadId='.$ob->parentId.'"> '. echo '<li><a href="commentview.php?appId='.$ob->appId.'&versionId='.$ob->versionId.'&threadId='.$ob->parentId.'"> '.
$ob->subject.' </a> by '.forum_lookup_user($ob->userid).' on '.$ob->time.' </li>'."\n"; $ob->subject.' </a> by '.forum_lookup_user($ob->userId).' on '.$ob->time.' </li>'."\n";
} }
$result = grab_comments($ob->appId, $ob->versionId, $ob->commentId); $result = grab_comments($ob->appId, $ob->versionId, $ob->commentId);