diff --git a/include/comments.php b/include/comments.php index 48ee412..1430181 100644 --- a/include/comments.php +++ b/include/comments.php @@ -1,23 +1,42 @@ +/*========================================================================= + * + * get user info for posts + * + */ +function forum_lookup_user ($userid) +{ + $mailto = ''; + if ($userid > 0) + { + $qstring = "SELECT email,username FROM user_list WHERE userid = '".$userid."' LIMIT 1"; + $result = mysql_query($qstring); + $usr = mysql_fetch_object($result); + if ($usr->email) + { + $mailto = '' . $usr->username . ''; + } + else + { + $mailto = $usr->username; + } + unset($qstring, $result, $usr); + } + else + { + $mailto = 'Anonymous'; + } + return $mailto; +} + /*========================================================================= * * display a single comment (in $ob) * */ function view_app_comment($ob) -{ - $user = new User(); - - if ($ob->email) - { - $mailto = '' . $ob->username . ''; - } - else - { - $mailto = $ob->username; - } - +{ echo html_frame_start('','98%'); echo '
| \n";
- echo " $ob->subject \n"; - echo " by $mailto on $ob->time \n"; + echo " ".$ob->subject." \n"; + echo " by ".forum_lookup_user($ob->userid)." on ".$ob->time." \n"; echo " | |
\n";
// body
@@ -37,7 +56,7 @@ function view_app_comment($ob)
if(eregi("RE:", $ob->subject))
$subject = $ob->subject;
else
- $subject = "RE: $ob->subject";
+ $subject = "RE: ".$ob->subject;
// reply post buttons
echo " [post new] \n";
@@ -62,11 +81,10 @@ function grab_comments($appId, $versionId, $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, username, email, subject, body ".
- "FROM appComments, user_list WHERE appComments.userId = user_list.userid ".
- $extra .
- "AND appId = $appId AND versionId = $versionId ".
- "ORDER BY appComments.time ASC";
+ "commentId, parentId, appId, versionId, userid, subject, body ".
+ "FROM appComments WHERE appId = '$appId' AND versionId = '$versionId' ".
+ $extra.
+ "ORDER BY appComments.time ASC";
$result = mysql_query($qstring);
@@ -126,26 +144,32 @@ function display_comments_nested($appId, $versionId, $threadId)
*/
function do_display_comments_threaded($handle, $is_main)
{
- if(!$is_main)
- echo "
\n"; - do_display_comments_threaded($result, 0); - echo "\n"; - } - } - if(!$is_main) - echo " \n"; + do_display_comments_threaded($result, 0); + echo "\n"; + } + } + + if (!$is_main) + echo "
|
The following comments are owned by whoever posted them. WineHQ is not responsible for what they say.
'."\n"; //start comments echo '| ',"\n"; |