";
}
}
//$bannedlist = explode("\n",trim($user['blocklist']));
if(is_array($bannedlist))
{
while(list($key,$val)=each($bannedlist))
{
if(strlower($user_info['username']) == strlower($val)) {
// if they aren't an admin, block them...
if($adminstatus != true) {
eval("dooutput(\"".gettemplate("BlockedUser")."\");");
exit();
}
}
}
}
if($submission['adultsubmission'] == 1 && $seemature) {
$output="You are not allowed to view this image.";
$link="user.fpd?name=$_REQUEST[name]";
header("LOCATION: $link");
exit();
}
if($submission['story'] != "") {
$isstory = true;
}
if($submission['poetry'] != "") {
$ispoetry = true;
}
if($submission['musicfile'] != "") {
$ismusic = true;
}
if($adminstatus == true) {
if($_REQUEST['delcomment']) {
$sql->query("DELETE FROM iworks_comments WHERE rowid='$_REQUEST[delcomment]' AND submissionid='$submission[rowid]'");
}
}
if($_REQUEST['replyto']) {
if($config['readonly'] == true) {
$output="Fur Affinity is read-only mode, you cannot make any replies.";
$link="gallery.fpd?name=$name&i=$i";
header("LOCATION: $link");
exit();
}
$comment = $sql->query_first("SELECT * FROM iworks_comments WHERE rowid='$_REQUEST[replyto]'");
if($_REQUEST['send'] == "send") {
if($username!="Guest") {
$reply = addslashes($reply);
$thistime = time();
$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_comments WHERE submissionid='$submission[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_comments WHERE submissionid='$submission[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_comments WHERE submissionid='$submission[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_comments WHERE submissionid='$submission[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_comments WHERE submissionid='$submission[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_comments WHERE submissionid='$submission[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_comments WHERE submissionid='$submission[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_comments WHERE submissionid='$submission[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_comments WHERE submissionid='$submission[rowid]' AND nestid >= '$nimin' AND nestid <= '$nimax' ")) +1;
$newnestid = $newnestid + (1 * $multiplier);
break;
}
$sql->query("INSERT INTO iworks_comments
(userid,submissionid,strlower,fromname,date,subject,message,level,commentid,nestid)
VALUES
('$user_info[userid]','$submission[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['userid'] != $user_info['userid']) {
comment_on_comment($comment['userid'],$comment['fromname'],$user_info['username'],"Comments",$comment['subject'],$submission['date'],"gallery.fpd",$thistime,$_REQUEST['name']);
$sql->query("UPDATE iworks_users SET commentcount=commentcount+1, commentsrecieved=commentsrecieved+1 WHERE userid='$comment[userid]'");
$sql->query("UPDATE iworks_users SET commentsgiven=commentsgiven+1 WHERE userid='$user_info[userid]'");
$sql->query("UPDATE iworks_submissions SET comments=comments+1 WHERE date='$_REQUEST[i]'");
}
$output="Your reply was made!";
$link="gallery.fpd?name=$_REQUEST[name]&i=$_REQUEST[i]";
header("LOCATION: $link");
exit();
} else {
$output="You must be registered to post comments.";
$link="gallery.fpd?name=$_REQUEST[name]&i=$_REQUEST[i]";
header("LOCATION: $link");
exit();
}
}
$newlevel = $comment['level']+1;
eval("dooutput(\"".gettemplate("replyto")."\");");
exit();
}
if($_REQUEST['action'] == "reply") {
if($config['readonly'] == true) {
$output="Fur Affinity is read-only mode, you cannot make any replies.";
$link="gallery.fpd?name=$name&i=$i";
require ("my.query.fpd");
eval("dooutput(\"".gettemplate("redirect")."\");");
exit();
}
if($username!="Guest") {
$reply = addslashes($reply);
$nestinfo = $sql->query("SELECT * FROM iworks_comments WHERE submissionid='$submission[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_comments
(submissionid,strlower,fromname,date,subject,message,nestid)
VALUES
('$submission[rowid]','".strlower($username)."','$username','".time()."','".addslashes($subject)."','".addslashes($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",$submission['title'],$_REQUEST['i'],"gallery.fpd");
$commentcount_user = $sql->get_count("rowid","iworks_comments","strlower='$user_info[strlower]'");
$commentcount_submission = $sql->get_count("rowid","iworks_comments","submissionid='$submission[rowid]'");
$sql->query("UPDATE iworks_users SET commentcount=commentcount+1, commentsrecieved=commentsrecieved+1 WHERE userid='$user[userid]'");
$sql->query("UPDATE iworks_users SET commentsgiven='$commentcount_user' WHERE userid='$user_info[userid]'");
$sql->query("UPDATE iworks_submissions SET comments='$commentcount_submission' WHERE date='$_REQUEST[i]'");
}
$output="Your comment has been posted!";
$link="gallery.fpd?name=$_REQUEST[name]&i=$_REQUEST[i]";
header("LOCATION: $link");
exit();
} else {
$output="You must be registered to post comments.";
$link="gallery.fpd?name=$_REQUEST[name]&i=$_REQUEST[i]";
require ("my.query.fpd");
eval("dooutput(\"".gettemplate("redirect")."\");");
exit();
}
}
if($_REQUEST['browse'] == "user") {
// Page information...
$maxpages = 20;
$totalpages = $sql->get_count("rowid","iworks_submissions","strlower='$_REQUEST[name]' $seemature");
if(!$page) $page=1;
$pages=ceil($totalpages/$maxpages);
if($pages>1) $showingpages = makepagelink("gallery.fpd?browse=user&name=$_REQUEST[name]", $page, $pages);
if(!$pages || $pages == 1) $showingpages="No pages to show";
$gallery.="";
$i=1;
$result = $sql->query("SELECT * FROM iworks_submissions WHERE strlower='$_REQUEST[name]' $seemature ORDER BY date DESC LIMIT ".($maxpages*($page-1)).",".$maxpages);
while ($row = $sql->fetch_array($result)) {
$thisdate = XBdate($config['today'],$row['date']);
eval ("\$gallery .= \"".gettemplate("gallery_thumbnails")."\";");
if($i == 5){
$gallery.="
";
$i=0;
}
$i++;
}
$sql->free_result($result);
$gallery.="
";
require ("my.query.fpd");
eval("dooutput(\"".gettemplate("gallery_viewgallery")."\");");
exit();
}
if($_REQUEST['browse'] == "favorites") {
$user = $sql->query_first("SELECT * FROM iworks_users WHERE strlower = '$_REQUEST[name]'");
// Page information...
$maxpages = 20;
$totalpages = $sql->get_count("rowid","iworks_favorites","user='$user[userid]' $seemature");
if(!$page) $page=1;
$pages=ceil($totalpages/$maxpages);
if($pages>1) $showingpages = makepagelink("gallery.fpd?browse=favorites&name=$_REQUEST[name]", $page, $pages);
if(!$pages || $pages == 1) $showingpages="No pages to show";
$gallery.="";
$i=1;
$result = $sql->query("SELECT * FROM iworks_favorites WHERE user='$user[userid]' $seemature ORDER BY rowid DESC LIMIT ".($maxpages*($page-1)).",".$maxpages);
while ($row = $sql->fetch_array($result)) {
$thisdate = XBdate($config['today'],$row['date']);
if($adminstatus == true || $_REQUEST['name'] == $user_info['strlower']) $remfav = "
[Remove]
";
eval ("\$gallery .= \"".gettemplate("gallery_thumbnails")."\";");
if($i == 5){
$gallery.="
";
$i=0;
}
$i++;
}
$sql->free_result($result);
$gallery.="
";
require ("my.query.fpd");
eval("dooutput(\"".gettemplate("gallery_viewgallery")."\");");
exit();
}
// Page information...
$maxpages = 50;
$totalpages = $sql->get_count("rowid","iworks_comments","submissionid='$submission[rowid]'");
if(!$page) $page=1;
$pages=ceil($totalpages/$maxpages);
if($pages>1) $showingpages = makepagelink("gallery.fpd?browse=user&name=$_REQUEST[name]", $page, $pages);
if(!$pages || $pages == 1) $showingpages="No pages to show";
$myi = 0;
$result = $sql->query("SELECT * FROM iworks_comments WHERE submissionid='$submission[rowid]' AND commentid>'0' ORDER BY nestid ASC");
while ($row = $sql->fetch_array($result)) {
$thisid = $row['commentid'];
$levwidth = levpercent($row['level']);
$row['message'] = nohtml($row['message']);
$row['message'] = nl2br($row['message']);
$row['message'] = docode($row['message']);
$thisdate = XBdate($config['longdateformat'],$row['date'],1);
$commentid = $row['commentid'];
$replies[$thisid] = $row[date];
if($adminstatus == true) {
eval ("\$commentdeletion = \"".gettemplate("gallery_delete_comment")."\";");
}
eval ("\$thesereplies[$date] = \"".gettemplate("comments")."\";");
$myi++;
}
$sql->free_result($result);
$result = $sql->query("SELECT * FROM iworks_comments WHERE submissionid='$submission[rowid]' ORDER BY nestid ASC");
while ($row = $sql->fetch_array($result)) {
$levwidth = levpercent($row['level']);
$row['message'] = nohtml($row['message']);
$row['message'] = nl2br($row['message']);
$row['message'] = docode($row['message']);
$thisdate = XBdate($config['longdateformat'],$row['date'],1);
if($adminstatus == true) {
eval ("\$commentdeletion = \"".gettemplate("gallery_delete_comment")."\";");
}
eval ("\$comments .= \"".gettemplate("comments")."\";");
}
$sql->free_result($result);
/*
$myi = 0;
$result = $sql->query("SELECT * FROM iworks_comments WHERE submissionid='$submission[rowid]' ORDER BY commentid DESC");
while ($row = $sql->fetch_array($result)) {
$thisid = $row['commentid'];
$levwidth = levpercent($row['level']);
$row['message'] = nl2br($row['message']);
$thisdate = XBdate($config['longdateformat'],$row['date'],1);
$commentid = $row['commentid'];
$replies[$thisid] = $row[date];
$commentids[$myi]=$row[commentid];
$rowids[$myi] = $row[rowid];
eval ("\$thesereplies[$myi] = \"".gettemplate("comments")."\";");
$myi++;
}
$sql->free_result($result);
$thesereplies = array_reverse($thesereplies);
if(is_array($thesereplies))
{
while(list($key,$val)=each($thesereplies))
{
//if($theserelies[])
echo $val;
}
}
*/
$thisdate = XBdate($config['longdateformat'],$submission['date'],1);
//image data...
$imagesize = format_sizeof(filesize($submission['url']),"kb");
$imgsize = @getimagesize($submission['url']);
$img_width = width($imgsize);
$img_height = height($imgsize);
$resolution = $img_width."x".$img_height;
if($user_info['username'] == $user['username'] || $adminstatus == true) {
eval ("\$useroptions = \"".gettemplate("gallery_useroptions")."\";");
}
if(!$submission['rowid']) {
$required = true;
require("./404.fpd");
exit();
}
if($f != "") {
$submission_data = "
";
} else {
$submission_data = "
";
}
if($user_info['fullview'] == "1") {
$submission_data = "
";
}
if($submission['adultsubmission'] == "1") {
$matureimage = "
";
}
if($submission['category'] == "flash" && ($_REQUEST['f'] == "full" || $user_info['fullview'] == "1")) {
$imgsize = @getimagesize($submission[url]);
$img_width = width($imgsize);
$img_height = height($imgsize);
$submission_data = "
";
}
$chk = $sql->query_first("SELECT * FROM iworks_favorites WHERE strlower='$_REQUEST[name]' AND date = '$_REQUEST[i]' AND user='$user_info[userid]'");
if($chk['date']) {
$favstring="-Fav";
} else {
$favstring="+Fav";
}
$today = XBdate("d",time());
$i = $_REQUEST['i'];
$gviews = unserialize($_COOKIE['gviews']);
if($gviews[$i] != $today) {
$sql->query("UPDATE iworks_submissions SET views=views+1 WHERE date='$_REQUEST[i]'");
$gviews[$i]=$today;
setcookie("gviews",serialize($gviews),0);
}
$submission['message'] = nl2br($submission['message']);
$submission['message'] = docode($submission['message']);
$submission['message'] = stripslashes($submission['message']);
$submission['title'] = stripslashes(stripslashes($submission['title']));
require ("my.query.fpd");
if($isstory != true && $ispoetry != true && $ismusic != true) {
eval("dooutput(\"".gettemplate("gallery_viewsubmission")."\");");
} elseif($isstory == true) {
eval("dooutput(\"".gettemplate("gallery_viewstory")."\");");
} elseif($ispoetry == true) {
eval("dooutput(\"".gettemplate("gallery_viewpoetry")."\");");
} elseif($ismusic == true) {
eval("dooutput(\"".gettemplate("gallery_viewmusic")."\");");
}
?>