<?php
/*
* Vouksh.info Forums
* @Copyright: Vouksh.info 2005
* @Description: The forums... HELP!!!!!!
*/
if(!isset($_GET['subsec']))
{
$bit = $this->themepart("forumcatlist");
$categories = $mysql->select(PRE."forums_cats", NULL, "id");
$catbitsplit = between("{CATLOOP}", "{/CATLOOP}", $bit);
while($c = mysql_fetch_assoc($categories))
{
unset($catbit, $threadbit);
$catbit = str_replace("{CAT_NAME}", $c['name'], $catbitsplit);
$fincat = $mysql->select(PRE."forums_forums", "catid='".$c['id']."'", "id");
$frows = mysql_num_rows($fincat);
$threadbitsplit = between("{THREADLOOP}", "{/THREADLOOP}", $bit);
for($i=0; $i<$frows; $i++)
{
if($i % 2)
{
$style = "row1";
} else {
$style = "row2";
}
$a = mysql_fetch_assoc($fincat);
$tinforum = $mysql->select(PRE."forums_threads", "forumid='".$a['id']."'", "lastupdate", "DESC", "1");
$t = mysql_fetch_assoc($tinforum);
$pinthread = $mysql->select(PRE."forums_posts", "threadid='".$t['id']."'", "id", "DESC", "1");
$p = mysql_fetch_assoc($pinthread);
if(mysql_num_rows($tinforum) == "0")
{
$user = "n/a";
$user2 = "n/a";
$date = "n/a";
$subject = "n/a";
$thread = "n/a";
} else {
$user = getuserinfoid("username", $t["userid"]);
$user = '<a href="Members/Profile/'.$user.'/">'.$user.'</a>';
$user2 = getuserinfoid("username", $p["userid"]);
$user2 = '<a href="Members/Profile/'.$user2.'/">'.$user2.'</a>';
$date = gmdate(DATE." g:i A", timeoffset($p["date"]));
$threadlink = $t['id'];
$thread = '<a href="Forums/Thread/'.$threadlink.'/#end">'.$t["subject"].'</a>';
}
//read/unread stuff...
$type = $t['status'];
$lastvisit = $_SESSION['lastvisit'];
$lupd = $t['lastupdate'];
$rd = getread($t['id']);
if($rd < $lupd or empty($rd))
{
$read = 'no';
} else
{
$read = 'yes';
}
if($lupd > $lastvisit && $read !== 'yes' && $type == "normal" && $t['type'] == "normal")
{
$pimage = '<img src="themes/'.$theme.'/images/forum/new.gif" alt="New posts" title="New posts" />';
} elseif(($lupd <= $lastvisit or $read == 'yes') && $type == "normal" && $t['type'] == "normal")
{
$pimage = '<img src="themes/'.$theme.'/images/forum/no-new.gif" alt="No new posts" title="No new posts" />';
} elseif($lupd > $lastvisit && $read !== 'yes' && $type == "normal" && $t['type'] == "poll")
{
$pimage = '<img src="themes/'.$theme.'/images/forum/new-poll.gif" alt="New posts" title="New posts" />';
} elseif(($lupd <= $lastvisit or $read == 'yes') && $type == "normal" && $t['type'] == "poll")
{
$pimage = '<img src="themes/'.$theme.'/images/forum/no-new-poll.gif" alt="New posts" title="New posts" />';
} elseif($lupd > $lastvisit && $read !== 'yes' && $type == "locked")
{
$pimage = '<img src="themes/'.$theme.'/images/forum/new-locked.gif" alt="New posts" title="New posts" />';
} elseif(($lupd <= $lastvisit or $read == 'yes') && $type == "locked")
{
$pimage = '<img src="themes/'.$theme.'/images/forum/no-new-locked.gif" alt="New posts" title="New posts" />';
} elseif($lupd > $lastvisit && $read !== 'yes' && $type == "sticky")
{
$pimage = '<img src="themes/'.$theme.'/images/forum/new-sticky.gif" alt="New posts" title="New posts" />';
} elseif(($lupd <= $lastvisit or $read == 'yes') && $type == "sticky")
{
$pimage = '<img src="themes/'.$theme.'/images/forum/no-new-sticky.gif" alt="New posts" title="New posts" />';
} elseif($lupd > $lastvisit && $read !== 'yes' && $type == "sticky-locked")
{
$pimage = '<img src="themes/'.$theme.'/images/forum/new-stickylocked.gif" alt="New posts" title="New posts" />';
} elseif(($lupd <= $lastvisit or $read == 'yes') && $type == "sticky-locked")
{
$pimage = '<img src="themes/'.$theme.'/images/forum/no-new-stickylocked.gif" alt="New posts" title="New posts" />';
} else {
$pimage = NULL;
}
//end read/unread stuff...
$perms = $a["perms"];
if(!getuserinfo("groups"))
{
$userp = "-1";
} else {
$userp = getuserinfo("groups");
}
if($perms == "2" && $userp !== "1")
{
$threadbit .= str_replace(
array(
"{STYLE}",
"{PIMAGE}",
"{FORUMNAME}",
"{DESCRIPTION}",
"{THREAD}",
"{STARTER}",
"{LASTP}",
"{DATE}"
),
array(
$style,
$pimage,
htmlspecialchars($a["name"]),
nl2br(htmlspecialchars($a["descr"])),
"Protected Forum",
"Protected Forum",
"Protected Forum",
"Protected Forum"
),
$threadbitsplit
);
} elseif($perms == "1" && $userp == "-1")
{
$threadbit .= str_replace(
array(
"{STYLE}",
"{PIMAGE}",
"{FORUMNAME}",
"{DESCRIPTION}",
"{THREAD}",
"{STARTER}",
"{LASTP}",
"{DATE}"
),
array(
$style,
$pimage,
htmlspecialchars($a["name"]),
nl2br(htmlspecialchars($a["descr"])),
"Protected Forum",
"Protected Forum",
"Protected Forum",
"Protected Forum"
),
$threadbitsplit
);
} else {
$catrep = $a["id"];
$catlink = '<a href="Forums/Forum/'.$catrep.'/">';
$asd = '<tr class="'.$style.'" style="width:100%;">
<td class="tcol-left">'.$pimage.'</td>
<td class="tcol-main">'.$catlink.htmlspecialchars($a["name"]).'</a><br />
<span style="font-style:italic;">'.nl2br(htmlspecialchars($a["descr"])).'</span></td>
<td class="tcol-right">Thread: '.$thread.'<br />
Topic Starter: '.$user.'<br />
Last Poster: '.$user2.'<br />
Last Post: '.$date.'</td>
</tr>';
$threadbit .= str_replace(
array(
"{STYLE}",
"{PIMAGE}",
"{FORUMNAME}",
"{DESCRIPTION}",
"{THREAD}",
"{STARTER}",
"{LASTP}",
"{DATE}"
),
array(
$style,
$pimage,
$catlink.htmlspecialchars($a["name"]).'</a>',
nl2br(htmlspecialchars($a["descr"])),
$thread,
$user,
$user2,
$date
),
$threadbitsplit
);
}
}
$tforums = $tforums+$frows;
$addbit .= $catbit."\n".$threadbit;
}
$bit = preg_replace("@{CATLOOP}(.+){\/CATLOOP}@smi", $addbit, $bit);
$bit = preg_replace("@{THREADLOOP}(.+){\/THREADLOOP}@smi", $threadbit, $bit, $frows);
echo $bit;
} else {
switch(strtolower($_GET['subsec']))
{
case "forum":
$bit = $this->themepart("threadlist");
$userg = getuserinfoid('groups', $_COOKIE['mid']);
$stuff = $_GET['id'];
//echo $stuff;
$fincat = $mysql->select(PRE."forums_forums", "id='".$stuff."'", "id");
$a = mysql_fetch_assoc($fincat);
echo '<div style="text-align: center; width: 100%; font-size: 11px;"><a href="Forums/">Back to category listing</a>';
if(checkuser())
{
echo ' ¦ <a href="Forums/Post/'.$a["id"].'/">Start new thread</a>';
}
echo '</div><hr style="width:100%;" />';
echo '<table style="width: 100%; border:none;">';
if(!isset($_GET['id']))
{
echo 'You must enter a forum id';
} elseif(($a['perms'] !== "-1" && !checkuser()) || ($a['perms'] == "2" && $userg == "2"))
{
echo 'You do not have permission to view this forum';
} else {
//stickies..
$threads = $mysql->select(PRE."forums_threads", "forumid='".$a['id']."' AND status='sticky' OR status='sticky-locked'", "lastupdate", "DESC");
$trows = mysql_num_rows($threads);
if($trows == "0")
{
echo "";
} else {
echo '<tr>
<td class="content-title" style="width:100%;" colspan="5">Important Topics</td>
</tr>
<tr style="width:100%;" class="row1">
<td class="tcol-left">Status</td>
<td class="tcol-main">Forum name</td>
<td class="tcol-views">Views</td>
<td class="tcol-replys">Replies</td>
<td class="tcol-right">Thread info</td>
</tr>';
for($i=0;$i<$trows;$i++)
{
$t = mysql_fetch_assoc($threads);
$pinthread = $mysql->select(PRE."forums_posts", "threadid='".$t['id']."'", "id", "DESC", "1");
$p = mysql_fetch_assoc($pinthread);
if($i % 2)
{
$style = "row1";
} else {
$style = "row2";
}
//read/unread stuff...
$type = $t['status'];
$lastvisit = $_SESSION['lastvisit'];
$lupd = $t['lastupdate'];
$rd = getread($t['id']);
if($rd < $lupd or empty($rd))
{
$read = 'no';
} else
{
$read = 'yes';
}
if($lupd > $lastvisit && $read !== 'yes' && $type == "sticky")
{
$pimage = '<img src="images/forum/new-sticky.gif" alt="New posts" title="New posts" />';
} elseif(($lupd <= $lastvisit or $read == 'yes') && $type == "sticky")
{
$pimage = '<img src="images/forum/no-new-sticky.gif" alt="New posts" title="New posts" />';
} elseif($lupd > $lastvisit && $read !== 'yes' && $type == "sticky-locked")
{
$pimage = '<img src="images/forum/new-stickylocked.gif" alt="New posts" title="New posts" />';
} elseif(($lupd <= $lastvisit or $read == 'yes') && $type == "sticky-locked")
{
$pimage = '<img src="images/forum/no-new-stickylocked.gif" alt="New posts" title="New posts" />';
}
//end read/unread stuff...
$user = getuserinfoid("username", $t["userid"]);
$user = '<a href="Members/Profile/'.$user.'/">'.$user.'</a>';
$user2 = getuserinfoid("username", $p["userid"]);
$user2 = '<a href="Members/Profile/'.$user2.'/">'.$user2.'</a>';
$date = gmdate(DATE." g:i A", timeoffset($p["date"]));
$threadlink = $t['id'];
$replies = $mysql->rcount(PRE."forums_posts", "threadid='".$t['id']."'")-1;
echo '<tr class="'.$style.'" style="width:100%;">
<td class="tcol-left">'.$pimage.'</td>
<td class="tcol-main">
<a href="Forums/Thread/'.$threadlink.'/">'.htmlspecialchars($t["subject"]).'</a>
<br />
<a href="Forums/Thread/'.$threadlink.'/#end">(Last Post)</a>
</td>
<td class="tcol-views">'.$t["views"].'</td>
<td class="tcol-replys">'.$replies.'</td>
<td class="tcol-right">Topic Starter: '.$user.'<br />
Last Poster: '.$user2.'<br />
Last Post: '.$date.'</td>
</tr>';
unset($user, $user2, $date, $threadlink, $pimage, $type, $lastvisit, $lupd1, $rd, $read);
}
}
//normal
$threads = $mysql->select(PRE."forums_threads", "forumid='".$a['id']."' AND status='normal' OR status='locked'", "lastupdate", "DESC");
$trows = mysql_num_rows($threads);
if($trows == "0")
{
//bleh!
} else {
echo '<tr>
<td colspan="5" class="content-title" style="width:100%;">Normal Posts</td>
</tr>
<tr style="width:100%;" class="row1">
<td class="tcol-left">Status</td>
<td class="tcol-main">Forum name</td>
<td class="tcol-views">Views</td>
<td class="tcol-replys">Replies</td>
<td class="tcol-right">Thread info</td>
</tr>';
for($i=0;$i<$trows;$i++)
{
$t = mysql_fetch_assoc($threads);
$pinthread = $mysql->select(PRE."forums_posts", "threadid='".$t['id']."'", "id", "DESC", "1");
$p = mysql_fetch_assoc($pinthread);
if($i % 2)
{
$style = "row1";
} else {
$style = "row2";
}
//read/unread stuff...
$type = $t['status'];
$lastvisit = $_SESSION['lastvisit'];
$lupd = $t['lastupdate'];
$rd = getread($t['id']);
if($rd < $lupd or empty($rd))
{
$read = 'no';
} else
{
$read = 'yes';
}
if($lupd > $lastvisit && $read !== 'yes' && $type == "normal" && $t['type'] == "normal")
{
$pimage = '<img src="images/forum/new.gif" alt="New posts" title="New posts" />';
} elseif(($lupd <= $lastvisit or $read == 'yes') && $type == "normal" && $t['type'] == "normal")
{
$pimage = '<img src="images/forum/no-new.gif" alt="No new posts" title="No new posts" />';
} elseif($lupd > $lastvisit && $read !== 'yes' && $type == "normal" && $t['type'] == "poll")
{
$pimage = '<img src="images/forum/new-poll.gif" alt="New posts" title="New posts" />';
} elseif(($lupd <= $lastvisit or $read == 'yes') && $type == "normal" && $t['type'] == "poll")
{
$pimage = '<img src="images/forum/no-new-poll.gif" alt="New posts" title="New posts" />';
} elseif($lupd > $lastvisit && $read !== 'yes' && $type == "locked")
{
$pimage = '<img src="images/forum/new-locked.gif" alt="New posts" title="New posts" />';
} elseif(($lupd <= $lastvisit or $read == 'yes') && $type == "locked")
{
$pimage = '<img src="images/forum/no-new-locked.gif" alt="New posts" title="New posts" />';
}
//end read/unread stuff...
$user = getuserinfoid("username", $t["userid"]);
$user = '<a href="Members/Profile/'.$user.'/">'.$user.'</a>';
$user2 = getuserinfoid("username", $p["userid"]);
$user2 = '<a href="Members/Profile/'.$user2.'/">'.$user2.'</a>';
$date = gmdate(DATE." g:i A", timeoffset($p["date"]));
$threadlink = $t['id'];
$replies = $mysql->rcount(PRE."forums_posts", "threadid='".$t['id']."'")-1;
echo '<tr class="'.$style.'" style="width:100%;">
<td class="tcol-left">'.$pimage.'</td>
<td class="tcol-main">
<a href="Forums/Thread/'.$threadlink.'/">'.htmlspecialchars($t["subject"]).'</a>
<br />
<a href="Forums/Thread/'.$threadlink.'/#end">(Last Post)</a>
</td>
<td class="tcol-views">'.$t['views'].'</td>
<td class="tcol-replys">'.$replies.'</td>
<td class="tcol-right">Topic Starter: '.$user.'<br />
Last Poster: '.$user2.'<br />
Last Post: '.$date.'</td>
</tr>';
unset($user, $user2, $date, $threadlink, $pimage, $type, $lastvisit, $lupd, $rd, $read);
}
}
}
$asd = '</table>
<div class="buttondiv"><strong onclick="showhideforumstatus();">Show/Hide</strong>
<div id="forumstatus">
<div style="float: left; text-align: left;">
<img src="images/forum/new.gif" alt="New posts" title="New posts" /> - New Posts (normal)
<br /><img src="images/forum/no-new.gif" alt="No new posts" title="No new posts" /> - No New Posts (normal)<br />
<img src="images/forum/new-poll.gif" alt="New posts" title="New posts" /> - New Posts/Votes (poll)<br />
<img src="images/forum/no-new-poll.gif" alt="New posts" title="New posts" /> - No New Posts/Votes (poll)<br />
<img src="images/forum/new-locked.gif" alt="New posts" title="New posts" /> - New Posts (locked)<br />
<img src="images/forum/no-new-locked.gif" alt="New posts" title="New posts" /> - No New Posts (locked)
</div>
<div style="float: right;text-align: left;">
<img src="images/forum/new-sticky.gif" alt="New posts" title="New posts" /> - New Posts (sticky)<br />
<img src="images/forum/no-new-sticky.gif" alt="No new posts" title="No new posts" /> - No New Posts (sticky)<br />
<img src="images/forum/new-stickylocked.gif" alt="New posts" title="New posts" /> - New Posts (sticky & locked)<br />
<img src="images/forum/no-new-stickylocked.gif" alt="New posts" title="New posts" /> - No New Posts (sticky & locked)
</div></div></div>';
echo $bit;
break;
case "thread":
if(!isset($_GET['id']))
{
echo '<br />You must provide a thread id';
} else {
$ckreply = getuserinfoid('forumtopicnonotify', $_COOKIE['mid']);
$rplupd = str_replace('~'.$_GET['id'],'',$ckreply);
$thread = $mysql->select(PRE."forums_threads", "id='".$_GET['id']."'", "id");
$t = mysql_fetch_assoc($thread);
$posts = $mysql->select(PRE."forums_posts", "threadid='".$t['id']."'", "id");
$rows = mysql_num_rows($posts);
$forum = $mysql->select(PRE."forums_forums", "id='".$t['forumid']."'", "id");
$f = mysql_fetch_assoc($forum);
$rd = checkread($t['id'], $t['lastupdate']);
if(empty($rd) || $rd == false)
{
$ud = getuserinfoid('forumreadtopics', $_COOKIE['mid']);
$data = $t['id']."~".$t['lastupdate']."|";
$dat = $ud.$data;
//echo $rd;
$mysql->update(PRE."members", "forumreadtopics='".$dat."', forumtopicnonotify='".$rplupd."'", "id='".$_COOKIE['mid']."'");
$mysql->update(PRE."forums_threads", "views=views + 1", "id='".$t['id']."'");
} elseif($rd < $t['lastupdate'] || $rd == $t['lastupdate'])
{
$string = str_replace($t['id'].'~'.$rd.'|', $t['id'].'~'.$t['lastupdate'].'|', getuserinfoid('forumreadtopics', $_COOKIE['mid']));
//echo $string;
$mysql->update(PRE."members", "forumreadtopics='".$string."', forumtopicnonotify='".$rplupd."'", "id='".$_COOKIE['mid']."'");
}
echo '<div class="forum_link-list">
<a href="Forums/">Back to category listing</a> ¦
<a href="Forums/Forum/'.$f['id'].'/">Back to thread listing</a> ¦ ';
if($t['status'] !== 'locked' && $t['status'] !== 'sticky-locked' && isset($_COOKIE['mid']))
{
echo '<a href="Forums/Reply/'.$t["id"].'/">Reply to this thread</a> ¦ ';
}
if(checkuser())
{
echo '<a href="Forums/Post/'.$f["id"].'/">Start new thread</a>';
}
echo '</div><hr style="width:100%;" />
<div class="forumbar">'.$t['subject'].'</div>';
if($t["type"] == "poll")
{
if(mysql_num_rows($mysql->select(PRE."forums_polls_votes", "threadid='".$t['id']."' AND ident='".$_COOKIE['mid']."'", "id")) == "1" || checkuser() == false)
{
echo '<div class="forumpollq" style="float:none;">'.$t["pollq"].'</div>
<div style="width:75%;margin-left: 12.5%;">';
$totalvotes = 0;
$getnumvotes = $mysql->select(PRE."forums_polls_options", "threadid='".$t['id']."'", "id", "ASC");
while($votes = mysql_fetch_array($getnumvotes))
{
$totalvotes = $totalvotes + $votes['votes'];
}
$getpoll1 = $mysql->select(PRE."forums_polls_options", "threadid='".$t['id']."'", "id", "ASC");
while ($getpoll = mysql_fetch_array($getpoll1))
{
@$numvotes = $getpoll['votes'] / $totalvotes;
$numvotes2 = $numvotes * 50;
$round = ceil($numvotes2)-5;
if($round <= "0")
{
$round = $round+5;
}
echo "<div style=\"float: left;text-align: right;\">
<span style=\"text-align:right;\">".$getpoll['option']." (".$getpoll['votes']." votes)</span></div>
<div class=\"pollresult\" style=\"width: ".$round."%;float: right; text-align: left;\"> </div>
<br />";
}
echo '</div>';
} else {
echo '<form action="misc/forums.vote.php" method="post">
<div class="forumpollq" style="float: left;">'.$t["pollq"].'</div>
<div style="width:75%;margin-left: 12.5%;">';
$pl = $mysql->select(PRE."forums_polls_options", "threadid='".$t['id']."'", "id");
while($op = mysql_fetch_assoc($pl))
{
echo '<div class="formtext"><label for="p'.$op["id"].'">'.$op["option"].'</label><br /></div><div class="formdiv"><input type="radio" value="'.$op["id"].'" name="pollchoice" id="p'.$op["id"].'" /><br /></div>';
}
echo '</div><div class="buttondiv"><input type="hidden" name="threadid" value="'.$t["id"].'" /><input type="submit" name="submit" value="Vote" /></div></form>';
}
}
echo '<table style="width:100%; float: left;">';
for($i=0;$i<$rows;$i++)
{
if((1&$i))
{
$style = "row1";
} else {
$style = "row2";
}
$postn = $i+1;
$a = mysql_fetch_assoc($posts);
$sig = getuserinfoid("signature", $a['userid']);
$usern = getuserinfoid('username', $a['userid']);
$userposts = mysql_num_rows($mysql->select(PRE."forums_posts", "userid='".$a['userid']."'", "id"));
if($_COOKIE['mid'] == $a['userid'] || getuserinfo('groups', $_COOKIE['user']) == "1")
{
$edit = '<a href="Forums/Edit/'.$a['id'].'/">Edit</a>; <strong onclick="xajax_forumsedit(\''.$a["id"].'\');">Quick Edit</strong>; <strong onclick="xajax_deletepost(\''.$a["id"].'\');">Delete Post</strong>; ';
} else {
$edit = NULL;
}
if($a['type'] == 'user' && $a["userid"] !== "0")
{
$userstuff = '<a href="Members/Profile/'.$usern.'/">
<img src="avatar.php?f='.getuserinfoid('avatar', $a['userid']).'" alt="'.$usern.'\'s Avatar" /><br />
User: '.$usern.'</a><br />
Posts: '.$userposts.'<br />
Group: '.showgroup($a['userid']).'';
} else {
$userstuff = '<img src="avatar.php?f=noava.gif" alt="Guest Avatar" style="float: left;"/><br />
'.$a["guestname"].'<br />
Group: Guests';
}
echo '<tr class="'.$style.'" style="border-top: 1px solid #000; width: 100%;" id="post-tr-'.$a["id"].'">
<td class="userstuff">
'.$userstuff.'
</td>
<td class="mainpost">
<div id="post-'.$a['id'].'">'.parse($a['message']).'</div>
';
if(!empty($sig))
{
echo '
<hr style="margin-left: 10%; width: 80%; margin-top:20px;" />
'.parse($sig).'
';
}
echo '</td></tr>
<tr id="post-tr2-'.$a["id"].'" style=" margin-bottom: 10px;">
<td colspan="2" id="p-'.$postn.'" style="width: 100%; text-align: right;border-bottom: 1px solid #000;">
<fieldset>
<input type="button" onclick="xajax_quotepost(\''.$a["id"].'\',\''.$usern.'\');" value="Quote User" />
</fieldset>
Date: '.gmdate(DATE." g:i A", timeoffset($a["date"])).'; '. $edit .'Post #'.$postn.'
</td>
</tr>';
}
echo "</table>";
$nextid = $postn+1;
if($t['status'] !== 'locked' && $t['status'] !== 'sticky-locked')
{
if(isset($_COOKIE['mid']))
{
echo '<hr style="width: 100%; float: left;" />
<form action="misc/forums.reply.php" method="post" id="quickreply" enctype="multipart/form-data">
<div class="buttondiv">Quick Reply</div>
<div class="quickreply">
<input type="button" onclick="bbquote(\'qp\');" value="Quote" />
<input type="button" onclick="bbinsert(\'qp\', \'norm\', \'[code]\', \'\');" value="Code" />
<input type="button" onclick="bbinsert(\'qp\', \'norm\', \'[/code]\', \'\');" value="End Code" />
<input type="button" onclick="bbinsert(\'qp\', \'tbt\', \'[b]\', \'[/b]\');" value="Bold" />
<input type="button" onclick="bbinsert(\'qp\', \'tbt\', \'[i]\', \'[/i]\');" value="Italic" />
<input type="button" onclick="bbinsert(\'qp\', \'tbt\', \'[u]\', \'[/u]\');" value="Underline" />
<br />
Smiley: <select name="smiley">
<option value="">--</option>
<option value=":)" onclick="bbinsert(\'qp\', \'norm\', \':)\', \'\')">:)</option>
<option value=":(" onclick="bbinsert(\'qp\', \'norm\', \':(\', \'\')">:(</option>
<option value=";)" onclick="bbinsert(\'qp\', \'norm\', \';)\', \'\')">;)</option>
<option value=":p" onclick="bbinsert(\'qp\', \'norm\', \':p\', \'\')">:p</option>
<option value=";p" onclick="bbinsert(\'qp\', \'norm\', \';p\', \'\')">;p</option>
<option value="x_x" onclick="bbinsert(\'qp\', \'norm\', \'x_x\', \'\')">x_x</option>
</select>
<input type="button" onclick="bbinsert(\'qp\', \'list\', \'[ul]\', \'[/ul]\');" value="Unordered List" />
<input type="button" onclick="bbinsert(\'qp\', \'list\', \'[ol]\', \'[/ol]\');" value="Ordered List" />
<br />
<textarea id="qp" name="post" rows="10" cols="50"></textarea>
</div>
<div class="buttondiv" id="end">
<input type="hidden" name="threadid" value="'.$t['id'].'" />
<input type="hidden" name="postid" value="'.$nextid.'" />
<input type="hidden" name="type" value="user" />
<input type="submit" name="submit" value="Reply" id="submit" onclick="disablebutton(\'quickreply\', \'submit\');"/>
</div>
<div class="buttondiv">
<strong onclick="showhideattachopts(\'attachmentdiv\')">Show/Hide Attachment Box</strong></div>
<div style="display:block; float: left; width:100%; text-align: center;" id="attachmentdiv">
<strong onclick="addinput(\'attachmentdiv\')">Add another box</strong><br />
<input type="file" name="attachments[]" /><br />
</div>
</form>';
} else {
/* echo '<hr style="width: 100%; float: left;" />
<form action="misc/forums.guestreply.php" method="post" id="quickreply">
<div class="buttondiv">Quick Reply</div>
<div class="formtext">Name:</div><div class="formdiv"><input type="text" name="guestname" /></div>
<div class="quickreply"><textarea class="wysiwyg" name="post" rows="10" cols="50"></textarea></div>
<div class="buttondiv" id="end">
<input type="hidden" name="threadid" value="'.$t['id'].'" />
<input type="hidden" name="postid" value="'.$nextid.'" />
<input type="hidden" name="type" value="guest" />
<input type="submit" name="submit" value="Reply" id="submit" onclick="disablebutton(\'quickreply\', \'submit\');" />
</div>
</form>'; */
echo '<hr style="width: 100%; float: left;" /><div class="buttondiv">Guest posting disabled.</div>';
}
}
}
break;
case "post":
if(!isset($_GET['id']))
{
echo 'You must provide a forum id to post to. <a href="javascript:history.go(-1);">Go Back</a>';
} else {
echo '<form action="misc/forums.post.php" method="post" enctype="multipart/form-data">
<div class="formtext">Subject:</div>
<div class="formdiv"><input type="text" name="subject" /></div>';
if(getuserinfoid('groups', $_COOKIE['mid']) == "1")
{
echo '<div class="formtext">Status</div>
<div class="formdiv">
<select name="status">
<option value="normal">Normal</option>
<option value="sticky">Sticky</option>
<option value="locked">Locked</option>
<option value="sticky-locked">Sticky & Locked</option>
</select>
</div>';
}
echo '<div class="formtext">Type:</div>
<div class="formdiv"><select name="type">
<option value="normal" onclick="hidepollopts(\'pollopts\');">Normal</option>
<option value="poll" onclick="showpollopts(\'pollopts\');">Poll</option>
</select></div>
<div id="pollopts" style="display:none;">
<div class="formtext">Poll Question:</div>
<div class="formdiv"><input type="text" name="pollq" /></div>
<div class="formtext">Option 1:</div>
<div class="formdiv"><input type="text" name="opt1" /></div>
<div class="formtext">Option 2:</div>
<div class="formdiv"><input type="text" name="opt2" /></div>
<div class="formtext">Option 3:</div>
<div class="formdiv"><input type="text" name="opt3" /></div>
<div class="formtext">Option 4:</div>
<div class="formdiv"><input type="text" name="opt4" /></div>
<div class="formtext">Option 5:</div>
<div class="formdiv"><input type="text" name="opt5" /></div>
<div class="formtext">Option 6:</div>
<div class="formdiv"><input type="text" name="opt6" /></div>
<div class="formtext">Option 7:</div>
<div class="formdiv"><input type="text" name="opt7" /></div>
<div class="formtext">Option 8:</div>
<div class="formdiv"><input type="text" name="opt8" /></div>
<div class="formtext">Option 9:</div>
<div class="formdiv"><input type="text" name="opt9" /></div>
<div class="formtext">Option 10:</div>
<div class="formdiv"><input type="text" name="opt10" /></div>
</div>
<div class="buttondiv">Post:</div>
<div class="buttondiv">
<input type="button" onclick="bbquote(\'qp\');" value="Quote" />
<input type="button" onclick="bbinsert(\'qp\', \'norm\', \'[code]\', \'\');" value="Code" />
<input type="button" onclick="bbinsert(\'qp\', \'norm\', \'[/code]\', \'\');" value="End Code" />
<input type="button" onclick="bbinsert(\'qp\', \'tbt\', \'[b]\', \'[/b]\');" value="Bold" />
<input type="button" onclick="bbinsert(\'qp\', \'tbt\', \'[i]\', \'[/i]\');" value="Italic" />
<input type="button" onclick="bbinsert(\'qp\', \'tbt\', \'[u]\', \'[/u]\');" value="Underline" />
<br />
Smiley: <select name="smiley">
<option value=":)" onclick="bbinsert(\'qp\', \'norm\', \':)\', \'\')">:)</option>
<option value=":(" onclick="bbinsert(\'qp\', \'norm\', \':(\', \'\')">:(</option>
<option value=";)" onclick="bbinsert(\'qp\', \'norm\', \';)\', \'\')">;)</option>
<option value=":p" onclick="bbinsert(\'qp\', \'norm\', \':p\', \'\')">:p</option>
<option value=";p" onclick="bbinsert(\'qp\', \'norm\', \';p\', \'\')">;p</option>
<option value="x_x" onclick="bbinsert(\'qp\', \'norm\', \'x_x\', \'\')">x_x</option>
</select>
<input type="button" onclick="bbinsert(\'qp\', \'list\', \'[ul]\', \'[/ul]\');" value="Unordered List" />
<input type="button" onclick="bbinsert(\'qp\', \'list\', \'[ul]\', \'[/ol]\');" value="Ordered List" />
<br />
<textarea id="qp" name="post" rows="10" cols="50"></textarea>
</div>
<div style="display:block; float: left; width:100%; text-align: center;" id="attachmentdiv">
<strong onclick="addinput(\'attachmentdiv\')">Add another box</strong><br />
<input type="file" name="attachments[]" /><br />
<input type="file" name="attachments[]" /><br />
<input type="file" name="attachments[]" /><br />
</div>
<div class="buttondiv">
<input type="hidden" name="forumid" value="'.$_GET['id'].'" />
<input type="submit" name="submit" value="Post it!" />
</div>
</form>';
}
break;
case "reply":
if(!isset($_GET['id']))
{
echo 'You must provide a thread id to post to. <a href="javascript:history.go(-1);">Go Back</a>';
} else {
if(isset($_COOKIE['mid']))
{
echo '<hr style="width: 100%; float: left;" />
<form action="misc/forums.reply.php" method="post">
<div class="buttondiv">Reply</div>
<div class="quickreply"><textarea class="wysiwyg" name="post" rows="10" cols="50"></textarea></div>
<div class="buttondiv">
<input type="hidden" name="threadid" value="'.$_GET['id'].'" />
<input type="hidden" name="postid" value="'.$nextid.'" />
<input type="hidden" name="type" value="user" />
<input type="submit" name="submit" value="Reply" />
</div>
</form>';
} else {
echo '<hr style="width: 100%; float: left;" />
<form action="misc/forums.guestreply.php" method="post">
<div class="buttondiv">Reply</div>
<div class="formtext">Name:</div><div class="formdiv"><input type="text" name="guestname" /></div>
<div class="quickreply"><input type="button" onclick="bbquote(\'qp\');" value="Quote" />
<input type="button" onclick="bbinsert(\'qp\', \'norm\', \'[code]\', \'\');" value="Code" />
<input type="button" onclick="bbinsert(\'qp\', \'norm\', \'[/code]\', \'\');" value="End Code" />
<input type="button" onclick="bbinsert(\'qp\', \'tbt\', \'[b]\', \'[/b]\');" value="Bold" />
<input type="button" onclick="bbinsert(\'qp\', \'tbt\', \'[i]\', \'[/i]\');" value="Italic" />
<input type="button" onclick="bbinsert(\'qp\', \'tbt\', \'[u]\', \'[/u]\');" value="Underline" />
<br />
Smiley: <select name="smiley">
<option value=":)" onclick="bbinsert(\'qp\', \'norm\', \':)\', \'\')">:)</option>
<option value=":(" onclick="bbinsert(\'qp\', \'norm\', \':(\', \'\')">:(</option>
<option value=";)" onclick="bbinsert(\'qp\', \'norm\', \';)\', \'\')">;)</option>
<option value=":p" onclick="bbinsert(\'qp\', \'norm\', \':p\', \'\')">:p</option>
<option value=";p" onclick="bbinsert(\'qp\', \'norm\', \';p\', \'\')">;p</option>
<option value="x_x" onclick="bbinsert(\'qp\', \'norm\', \'x_x\', \'\')">x_x</option>
</select>
<input type="button" onclick="bbinsert(\'qp\', \'list\', \'[ul]\', \'[/ul]\');" value="Unordered List" />
<input type="button" onclick="bbinsert(\'qp\', \'list\', \'[ul]\', \'[/ol]\');" value="Ordered List" />
<br />
<textarea id="qp" name="post" rows="10" cols="50"></textarea></div>
<div class="buttondiv">
<input type="hidden" name="threadid" value="'.$_GET['id'].'" />
<input type="hidden" name="postid" value="'.$nextid.'" />
<input type="hidden" name="type" value="guest" />
<input type="submit" name="submit" value="Reply" />
</div>
</form>';
}
}
break;
case "edit":
if(!isset($_GET['id']))
{
echo 'You must provide a post id to edit. <a href="javascript:history.go(-1);">Go Back</a>';
} else {
if(getuserinfoid('groups', $_COOKIE['mid']) !== "1")
{
$sel = $mysql->select(PRE."forums_posts", "id='".$_GET['id']."' AND userid='".$_COOKIE['mid']."'", "id");
} else {
$sel = $mysql->select(PRE."forums_posts", "id='".$_GET['id']."'", "id");
}
if(!$sel)
{
echo 'You either entered a postid that doesn\'t exist, or you are trying to edit someone else\'s post';
} else {
$a = mysql_fetch_assoc($sel);
if($a['postid'] == "1")
{
$th = $mysql->select(PRE."forums_threads", "id='".$a['threadid']."'", "id");
$t = mysql_fetch_assoc($th);
echo '<form action="misc/forums.edit1.php" method="post">
<div class="formtext">Subject:</div>
<div class="formdiv"><input type="text" name="subject" value="'.$t["subject"].'" /></div>
<div class="buttondiv">Post:</div>
<div class="buttondiv"><input type="button" onclick="bbquote(\'qp\');" value="Quote" />
<input type="button" onclick="bbinsert(\'qp\', \'norm\', \'[code]\', \'\');" value="Code" />
<input type="button" onclick="bbinsert(\'qp\', \'norm\', \'[/code]\', \'\');" value="End Code" />
<input type="button" onclick="bbinsert(\'qp\', \'tbt\', \'[b]\', \'[/b]\');" value="Bold" />
<input type="button" onclick="bbinsert(\'qp\', \'tbt\', \'[i]\', \'[/i]\');" value="Italic" />
<input type="button" onclick="bbinsert(\'qp\', \'tbt\', \'[u]\', \'[/u]\');" value="Underline" />
<br />
Smiley: <select name="smiley">
<option value=":)" onclick="bbinsert(\'qp\', \'norm\', \':)\', \'\')">:)</option>
<option value=":(" onclick="bbinsert(\'qp\', \'norm\', \':(\', \'\')">:(</option>
<option value=";)" onclick="bbinsert(\'qp\', \'norm\', \';)\', \'\')">;)</option>
<option value=":p" onclick="bbinsert(\'qp\', \'norm\', \':p\', \'\')">:p</option>
<option value=";p" onclick="bbinsert(\'qp\', \'norm\', \';p\', \'\')">;p</option>
<option value="x_x" onclick="bbinsert(\'qp\', \'norm\', \'x_x\', \'\')">x_x</option>
</select>
<input type="button" onclick="bbinsert(\'qp\', \'list\', \'[ul]\', \'[/ul]\');" value="Unordered List" />
<input type="button" onclick="bbinsert(\'qp\', \'list\', \'[ul]\', \'[/ol]\');" value="Ordered List" />
<br />
<textarea id="qp" name="post" rows="20" cols="70">'.$a["message"].'</textarea>
</div>
<div class="buttondiv">
<input type="hidden" name="postid" value="'.$_GET['id'].'" />
<input type="hidden" name="threadid" value="'.$a['threadid'].'" />
<input type="submit" name="submit" value="Edit" />
</div>
</form>';
} else {
echo '<form action="misc/forums.edit2.php" method="post">
<div class="buttondiv">Post:</div>
<div class="buttondiv"><input type="button" onclick="bbquote(\'qp\');" value="Quote" />
<input type="button" onclick="bbinsert(\'qp\', \'norm\', \'[code]\', \'\');" value="Code" />
<input type="button" onclick="bbinsert(\'qp\', \'norm\', \'[/code]\', \'\');" value="End Code" />
<input type="button" onclick="bbinsert(\'qp\', \'tbt\', \'[b]\', \'[/b]\');" value="Bold" />
<input type="button" onclick="bbinsert(\'qp\', \'tbt\', \'[i]\', \'[/i]\');" value="Italic" />
<input type="button" onclick="bbinsert(\'qp\', \'tbt\', \'[u]\', \'[/u]\');" value="Underline" />
<br />
Smiley: <select name="smiley">
<option value=":)" onclick="bbinsert(\'qp\', \'norm\', \':)\', \'\')">:)</option>
<option value=":(" onclick="bbinsert(\'qp\', \'norm\', \':(\', \'\')">:(</option>
<option value=";)" onclick="bbinsert(\'qp\', \'norm\', \';)\', \'\')">;)</option>
<option value=":p" onclick="bbinsert(\'qp\', \'norm\', \':p\', \'\')">:p</option>
<option value=";p" onclick="bbinsert(\'qp\', \'norm\', \';p\', \'\')">;p</option>
<option value="x_x" onclick="bbinsert(\'qp\', \'norm\', \'x_x\', \'\')">x_x</option>
</select>
<input type="button" onclick="bbinsert(\'qp\', \'list\', \'[ul]\', \'[/ul]\');" value="Unordered List" />
<input type="button" onclick="bbinsert(\'qp\', \'list\', \'[ul]\', \'[/ol]\');" value="Ordered List" />
<br />
<textarea id="qp" name="post" rows="20" cols="70">'.$a["message"].'</textarea>
</div>
<div class="buttondiv">
<input type="hidden" name="postid" value="'.$_GET['id'].'" />
<input type="hidden" name="threadid" value="'.$a['threadid'].'" />
<input type="submit" name="submit" value="Edit" />
</div>
</form>';
}
}
}
break;
}
}
?>