query("SELECT * FROM iworks_journal_comments WHERE journal='$journal[rowid]' AND level=0");
if(mysql_num_rows($nestinfo)) { $nestid = mysql_num_rows($nestinfo) + 1; } else if(!mysql_num_rows($nestinfo)) { $nestid = 1; }
$nestid = $nestid * 1000000000000000000000000000;
if(!$subject) $subject = "Submission reply";
$sql->query("INSERT INTO iworks_journal_comments
(user,journal,strlower,username,date,subject,message,nestid)
VALUES
('$user_info[userid]','$journal[rowid]','".strlower($username)."','$username','".time()."','$subject','$reply','$nestid')
");
//allow the user to make a reply, but do not bump up stats or send himself/herself a message about it.
if($user['userid'] != $user_info['userid']) {
send_message($user['userid'],$user['username'],$user_info['username'],"Comments",$journal['subject'],$_REQUEST['i'],"viewjournal.fpd","viewjournal");
$sql->query("UPDATE iworks_users SET commentcount=commentcount+1, commentsrecieved=commentsrecieved+1 WHERE username='$user[username]'");
$sql->query("UPDATE iworks_users SET commentsgiven=commentsgiven+1 WHERE username='$user_info[username]'");
$sql->query("UPDATE iworks_journals SET comments=comments+1 WHERE date='$_REQUEST[i]'");
}
$output="Your comment has been posted!";
$link="viewjournal.fpd?name=$_REQUEST[name]&i=$_REQUEST[i]";
header("LOCATION: $link");
exit();
} else {
$output="You must be registered to post comments.";
$link="viewjournal.fpd?name=$_REQUEST[name]&i=$_REQUEST[i]";
require ("my.query.fpd");
eval("dooutput(\"".gettemplate("redirect")."\");");
exit();
}
}
if($_REQUEST['replyto']) {
if($config['readonly'] == true) {
$output="Fur Affinity is read-only mode, you cannot make any replies.";
$link="viewjournal.fpd?name=$_REQUEST[name]&i=$_REQUEST[i]";
require ("my.query.fpd");
eval("dooutput(\"".gettemplate("redirect")."\");");
exit();
}
$comment = $sql->query_first("SELECT * FROM iworks_journal_comments WHERE rowid='$_REQUEST[replyto]'");
if($_REQUEST['send'] == "send") {
if($username!="Guest") {
$reply = addslashes($reply);
$newnestid = $comment[nestid];
$nestswitch = $_REQUEST[level]-1;
switch ($nestswitch) {
case 0:
$nimax = $newnestid + 999000000000000000000000000;
$nimin = $newnestid + 1000000000000000000000000;
$multiplier = mysql_num_rows($sql->query("SELECT * FROM iworks_journal_comments WHERE journal='$journal[rowid]' AND nestid >= '$nimin' AND nestid <= '$nimax' ")) +1;
$newnestid = $newnestid + (1000000000000000000000000 * $multiplier);
break;
case 1:
$nimax = $newnestid + 999000000000000000000000;
$nimin = $newnestid + 1000000000000000000000;
$multiplier = mysql_num_rows($sql->query("SELECT * FROM iworks_journal_comments WHERE journal='$journal[rowid]' AND nestid >= '$nimin' AND nestid <= '$nimax' ")) +1;
$newnestid = $newnestid + (1000000000000000000000 * $multiplier);
break;
case 2:
$nimax = $newnestid + 999000000000000000000;
$nimin = $newnestid + 1000000000000000000;
$multiplier = mysql_num_rows($sql->query("SELECT * FROM iworks_journal_comments WHERE journal='$journal[rowid]' AND nestid >= '$nimin' AND nestid <= '$nimax' ")) +1;
$newnestid = $newnestid + (1000000000000000000 * $multiplier);
break;
case 3:
$nimax = $newnestid + 999000000000000000;
$nimin = $newnestid + 1000000000000000;
$multiplier = mysql_num_rows($sql->query("SELECT * FROM iworks_journal_comments WHERE journal='$journal[rowid]' AND nestid >= '$nimin' AND nestid <= '$nimax' ")) +1;
$newnestid = $newnestid + (1000000000000000 * $multiplier);
break;
case 4:
$nimax = $newnestid + 999000000000000;
$nimin = $newnestid + 1000000000000;
$multiplier = mysql_num_rows($sql->query("SELECT * FROM iworks_journal_comments WHERE journal='$journal[rowid]' AND nestid >= '$nimin' AND nestid <= '$nimax' ")) +1;
$newnestid = $newnestid + (1000000000000 * $multiplier);
break;
case 5:
$nimax = $newnestid + 999000000000;
$nimin = $newnestid + 1000000000;
$multiplier = mysql_num_rows($sql->query("SELECT * FROM iworks_journal_comments WHERE journal='$journal[rowid]' AND nestid >= '$nimin' AND nestid <= '$nimax' ")) +1;
$newnestid = $newnestid + (1000000000 * $multiplier);
break;
case 6:
$nimax = $newnestid + 999000000;
$nimin = $newnestid + 1000000;
$multiplier = mysql_num_rows($sql->query("SELECT * FROM iworks_journal_comments WHERE journal='$journal[rowid]' AND nestid >= '$nimin' AND nestid <= '$nimax' ")) +1;
$newnestid = $newnestid + (1000000 * $multiplier);
break;
case 7:
$nimax = $newnestid + 999000;
$nimin = $newnestid + 1000;
$multiplier = mysql_num_rows($sql->query("SELECT * FROM iworks_journal_comments WHERE journal='$journal[rowid]' AND nestid >= '$nimin' AND nestid <= '$nimax' ")) +1;
$newnestid = $newnestid + (1000 * $multiplier);
break;
case 8:
$nimax = $newnestid + 999;
$nimin = $newnestid + 1;
$multiplier = mysql_num_rows($sql->query("SELECT * FROM iworks_journal_comments WHERE journal='$journal[rowid]' AND nestid >= '$nimin' AND nestid <= '$nimax' ")) +1;
$newnestid = $newnestid + (1 * $multiplier);
break;
}
$thistime = time();
$sql->query("INSERT INTO iworks_journal_comments
(user,journal,strlower,username,date,subject,message,level,commentid,nestid)
VALUES
('$user_info[userid]','$journal[rowid]','".strlower($username)."','$username','".$thistime."','".addslashes($subject)."','".addslashes($reply)."','$_REQUEST[level]','$_REQUEST[replyto]','$newnestid')
");
//allow the user to make a reply, but do not bump up stats or send himself/herself a message about it.
if($comment['user'] != $user_info['userid']) {
send_message($comment['user'],$comment['username'],$user_info['username'],"Comments",$comment['subject'],$journal['date'],"viewjournal.fpd",$thistime);
$sql->query("UPDATE iworks_users SET commentcount=commentcount+1, commentsrecieved=commentsrecieved+1 WHERE userid='$comment[user]'");
$sql->query("UPDATE iworks_users SET commentsgiven=commentsgiven+1 WHERE userid='$user_info[userid]'");
$sql->query("UPDATE iworks_journals SET comments=comments+1 WHERE date='$_REQUEST[i]'");
}
$output="Your reply was made!";
$link="viewjournal.fpd?name=$_REQUEST[name]&i=$_REQUEST[i]";
header("LOCATION: $link");
exit();
} else {
$output="You must be registered to post comments.";
$link="viewjournal.fpd?name=$_REQUEST[name]&i=$_REQUEST[i]";
require ("my.query.fpd");
eval("dooutput(\"".gettemplate("redirect")."\");");
exit();
}
}
$newlevel = $comment['level']+1;
eval("dooutput(\"".gettemplate("replyto_journal")."\");");
exit();
}
//Smilie data...
if(is_array($smilies))
{
while(list($key,$val)=each($smilies))
{
$smilielist .= "
";
}
}
if($user['dlevel'] == 1) { $donationlevel = "FA Supporter: Bronze
"; }
if($user['dlevel'] == 2) { $donationlevel = "FA Supporter: Silver
"; }
if($user['dlevel'] == 3) { $donationlevel = "FA Supporter: Golden!
"; }
if($user['dlevel'] == 4) { $donationlevel = "FA Supporter: Platinum!!
"; }
if($user['homepage']) $website = makelink($user['homepage'],"[Website]");
if($user['aim']) $aim = "AIM: ".htmlspecialchars($user['aim'])."
";
if($user['icq']) $icq = "ICQ: ".htmlspecialchars($user['icq'])."
";
if($user['msn']) $msn = "MSN: ".htmlspecialchars($user['msn'])."
";
if($user['yahoo']) $yahoo = "Yahoo: ".htmlspecialchars($user['yahoo'])."
";
if($user['typeartist']) $typeartist = "Type of artist: $user[typeartist]
";
if($user['species']) $species = "Species: ".htmlspecialchars($user['species'])."
";
if($user['age']) $age = "Age: ".htmlspecialchars($user['age'])."
";
if($user['shell']) $shell = "Shell of choice: ".htmlspecialchars($user['shell'])."
";
if($user['os']) $os = "Operating system: ".htmlspecialchars($user['os'])."
";
if($user['quote']) $quote = "Personal quote: ".htmlspecialchars($user['quote'])."
";
if($user['tools']) $tools = "Tools commonly used: ".htmlspecialchars($user['tools'])."
";
if($user['music']) $music = "Music type/genre: ".htmlspecialchars($user['music'])."
";
if($user['favoritemovie']) $favoritemovie = "Favorite movie: ".htmlspecialchars($user['favoritemovie'])."
";
if($user['favoritegame']) $favoritegame = "Favorite game: ".htmlspecialchars($user['favoritegame'])."
";
if($user['favoriteplatform']) $favoriteplatform = "Favorite game platform: ".htmlspecialchars($user['favoriteplatform'])."
";
if($user['favoritemusicpalyer']) $favoritemusicpalyer = "Music player of choice: ".htmlspecialchars($user['favoritemusicpalyer'])."
";
if($user['favoriteartist']) $favoriteartist = "Favorite artist: ".htmlspecialchars($user['favoriteartist'])."
";
if($user['favoriteanimal']) $favoriteanimal = "Favorite animal: ".htmlspecialchars($user['favoriteanimal'])."
";
if($user['favoritewebsite']) $favoritewebsite = "Favorite website: ".htmlspecialchars($user['favoritewebsite'])."
";
if($user['favoritefood']) $favoritefood = "Favorite food: ".htmlspecialchars($user['favoritefood'])."
";
if($user['profileinfo']) $user['profileinfo'] = htmlspecialchars($user['profileinfo']);
if($user['mood']) $user['mood'] = htmlspecialchars($user['mood']);
if($user['fullname']) $user['fullname'] = htmlspecialchars($user['fullname']);
$result = $sql->query("SELECT * FROM iworks_journal_comments WHERE journal='$journal[rowid]' ORDER BY nestid ASC");
while ($row = $sql->fetch_array($result)) {
$levwidth = levpercent($row['level']);
$row['message'] = nohtml($row['message']);
//$row['message'] = htmlspecialchars($row['message']);
$row['message'] = nl2br($row['message']);
$row['message'] = docode($row['message']);
$row['fromname'] = $row['username'];
$thisdate = XBdate($config['longdateformat'],$row['date'],1);
eval ("\$comments .= \"".gettemplate("journal_comments")."\";");
}
$sql->free_result($result);
if($_REQUEST['i']) {
//$journal['message'] = htmlspecialchars($journal['message']);
$row['message'] = nohtml($row['message']);
$journal['message'] = nl2br($journal['message']);
$journal['message'] = docode($journal['message']);
$user['journalheader'] = nohtml($user['journalheader']);
$user['journalheader'] = nl2br($user['journalheader']);
$user['journalheader'] = docode($user['journalheader']);
$user['journalfooter'] = nohtml($user['journalfooter']);
$user['journalfooter'] = nl2br($user['journalfooter']);
$user['journalfooter'] = docode($user['journalfooter']);
require ("my.query.fpd");
eval("dooutput(\"".gettemplate("journal_viewjournal")."\");");
} else {
//journals...
$result = $sql->query("SELECT * FROM iworks_journals WHERE user='$user[userid]' ORDER BY date ASC");
while ($row = $sql->fetch_array($result)) {
$date = XBdate($config['longdateformat'],$row['date'],1);
//$row['message'] = htmlspecialchars($row['message']);
$row['message'] = nohtml($row['message']);
$row['message'] = nl2br($row['message']);
$row['message'] = docode($row['message']);
eval ("\$journallist .= \"".gettemplate("journal_bit")."\";");
eval ("\$journals .= \"".gettemplate("journal_first")."\";");
}
$sql->free_result($result);
require ("my.query.fpd");
eval("dooutput(\"".gettemplate("journal_journals")."\");");
}
?>